code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
/*
* Spine Runtimes Software License
* Version 2.3
*
* Copyright (c) 2013-2015, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable and
* non-transferable license to use, install, execute and perform the Spine
* Runtimes Software (the "Software") and derivative works solely for personal
* or internal use. Without the written permission of Esoteric Software (see
* Section 2 of the Spine Software License Agreement), you may not (a) modify,
* translate, adapt or otherwise create derivative works, improvements of the
* Software or develop new applications using the Software or (b) remove,
* delete, alter or obscure any trademarks or any copyright, trademark, patent
* or other intellectual property or proprietary rights notices on or in the
* Software, including any copy thereof. Redistributions in binary or source
* form must include this license and terms.
*
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.esotericsoftware.spine.attachments;
abstract public class Attachment {
final String name;
public Attachment (String name) {
if (name == null) throw new IllegalArgumentException("name cannot be null.");
this.name = name;
}
public String getName () {
return name;
}
public String toString () {
return getName();
}
}
| intrigus/VisEditor | Plugins/SpineRuntime/src/com/esotericsoftware/spine/attachments/Attachment.java | Java | apache-2.0 | 2,037 | [
30522,
1013,
1008,
1008,
8560,
2448,
7292,
2015,
4007,
6105,
1008,
2544,
1016,
1012,
1017,
1008,
1008,
9385,
1006,
1039,
1007,
2286,
1011,
2325,
1010,
9686,
29112,
4007,
1008,
2035,
2916,
9235,
1012,
1008,
1008,
2017,
2024,
4379,
1037,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python
# encoding: utf-8
from .user import User
| luke0922/celery_learning | application/models/__init__.py | Python | apache-2.0 | 63 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1001,
17181,
1024,
21183,
2546,
1011,
1022,
2013,
1012,
5310,
12324,
5310,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// -*- coding: us-ascii-unix -*-
// Copyright 2012 Lukas Kemmer
//
// 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.
#include "wx/panel.h"
#include "wx/sizer.h"
#include "geo/int-size.hh"
#include "gui/color-panel.hh"
#include "gui/events.hh"
#include "gui/frame-ctrl.hh"
#include "gui/grid-ctrl.hh"
#include "gui/palette-ctrl.hh"
#include "gui/selected-color-ctrl.hh"
#include "gui/zoom-ctrl.hh"
#include "util/dumb-ptr.hh"
#include "util/either.hh"
#include "util-wx/bind-event.hh"
#include "util-wx/fwd-wx.hh"
namespace faint{
class ColorPanelImpl : public wxPanel {
public:
ColorPanelImpl(wxWindow* parent,
const PaintMap& palette,
const pick_paint_f& pickPaint,
const Getter<Color>& getBg,
const Accessor<Grid>& gridAccess,
const std::function<void()>& showGridDialog,
std::unique_ptr<FrameContext>&& frameContext,
StatusInterface& status,
const Art& art)
: wxPanel(parent)
{
// The spacing between controls in this panel
const int spacing = FromDIP(5);
auto sizer = make_wx<wxBoxSizer>(wxHORIZONTAL);
m_selectedColor = std::make_unique<SelectedColorCtrl>(this,
from_DIP(IntSize(50,50), this),
status,
pickPaint,
getBg);
sizer->Add(m_selectedColor->AsWindow(), 0, wxALL, spacing);
m_palette = std::make_unique<PaletteCtrl>(this,
palette,
status,
pickPaint,
getBg);
sizer->Add(m_palette->AsWindow(), 0, wxALL | wxEXPAND | wxSHRINK, spacing);
m_zoom = std::make_unique<ZoomCtrl>(this, status);
sizer->Add(m_zoom->AsWindow(), 0, wxALL, spacing);
m_grid = make_dumb<GridCtrl>(this, art, status, showGridDialog, gridAccess);
sizer->Add(m_grid.get(), 0, wxALL, spacing);
m_frameCtrl = make_dumb<FrameCtrl>(this, std::move(frameContext), status, art);
sizer->Add(m_frameCtrl->AsWindow(), 0, wxALL, spacing);
SetSizer(sizer);
Layout();
// Handle resizing child controls (e.g. color added to palette
// or grid-control expanded).
bind(this, EVT_FAINT_ControlResized,
[&](){
Layout();
Refresh();
});
}
std::unique_ptr<ZoomCtrl> m_zoom;
dumb_ptr<GridCtrl> m_grid;
std::unique_ptr<SelectedColorCtrl> m_selectedColor;
std::unique_ptr<PaletteCtrl> m_palette;
dumb_ptr<FrameCtrl> m_frameCtrl;
};
ColorPanel::ColorPanel(wxWindow* parent,
const PaintMap& palette,
const pick_paint_f& pickPaint,
const Getter<Color>& getBg,
const Accessor<Grid>& gridAccess,
const std::function<void()>& showGridDialog,
std::unique_ptr<FrameContext>&& frameContext,
StatusInterface& status,
const Art& art)
: m_impl(make_dumb<ColorPanelImpl>(parent,
palette,
pickPaint,
getBg,
gridAccess,
showGridDialog,
std::move(frameContext),
status,
art))
{}
void ColorPanel::AddToPalette(const Paint& paint){
m_impl->m_palette->Add(paint);
}
wxWindow* ColorPanel::AsWindow(){
return m_impl.get();
}
void ColorPanel::Freeze(){
m_impl->Freeze();
}
void ColorPanel::Hide(){
Show(false);
}
void ColorPanel::SetPalette(const PaintMap& paintMap){
m_impl->m_palette->SetPalette(paintMap);
}
void ColorPanel::Show(bool show){
m_impl->Show(show);
}
void ColorPanel::Thaw(){
m_impl->Thaw();
}
void ColorPanel::UpdateFrames(){
if (m_impl->m_frameCtrl->Update()){
m_impl->Layout();
}
}
void ColorPanel::UpdateGrid(){
m_impl->m_grid->Update();
}
void ColorPanel::UpdateSelectedColors(const ColorChoice& c){
m_impl->m_selectedColor->UpdateColors(c);
}
void ColorPanel::UpdateZoom(const ZoomLevel& zoom){
m_impl->m_zoom->UpdateZoom(zoom);
}
bool ColorPanel::Visible() const{
return m_impl->IsShown();
}
} // namespace
| lukas-ke/faint-graphics-editor | gui/color-panel.cpp | C++ | apache-2.0 | 4,184 | [
30522,
1013,
1013,
1011,
1008,
1011,
16861,
1024,
2149,
1011,
2004,
6895,
2072,
1011,
19998,
1011,
1008,
1011,
1013,
1013,
9385,
2262,
23739,
17710,
15810,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
mxb - v4l2 driver for the Multimedia eXtension Board
Copyright (C) 1998-2003 Michael Hunold <michael@mihu.de>
Visit http://www.mihu.de/linux/saa7146/mxb/
for further details about this card.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define DEBUG_VARIABLE debug
#include <media/saa7146_vv.h>
#include <media/tuner.h>
#include <linux/video_decoder.h>
#include "mxb.h"
#include "tea6415c.h"
#include "tea6420.h"
#include "tda9840.h"
#define I2C_SAA7111 0x24
#define MXB_BOARD_CAN_DO_VBI(dev) (dev->revision != 0)
/* global variable */
static int mxb_num = 0;
/* initial frequence the tuner will be tuned to.
in verden (lower saxony, germany) 4148 is a
channel called "phoenix" */
static int freq = 4148;
module_param(freq, int, 0644);
MODULE_PARM_DESC(freq, "initial frequency the tuner will be tuned to while setup");
static int debug = 0;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
#define MXB_INPUTS 4
enum { TUNER, AUX1, AUX3, AUX3_YC };
static struct v4l2_input mxb_inputs[MXB_INPUTS] = {
{ TUNER, "Tuner", V4L2_INPUT_TYPE_TUNER, 1, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
{ AUX1, "AUX1", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
{ AUX3, "AUX3 Composite", V4L2_INPUT_TYPE_CAMERA, 4, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
{ AUX3_YC, "AUX3 S-Video", V4L2_INPUT_TYPE_CAMERA, 4, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
};
/* this array holds the information, which port of the saa7146 each
input actually uses. the mxb uses port 0 for every input */
static struct {
int hps_source;
int hps_sync;
} input_port_selection[MXB_INPUTS] = {
{ SAA7146_HPS_SOURCE_PORT_A, SAA7146_HPS_SYNC_PORT_A },
{ SAA7146_HPS_SOURCE_PORT_A, SAA7146_HPS_SYNC_PORT_A },
{ SAA7146_HPS_SOURCE_PORT_A, SAA7146_HPS_SYNC_PORT_A },
{ SAA7146_HPS_SOURCE_PORT_A, SAA7146_HPS_SYNC_PORT_A },
};
/* this array holds the information of the audio source (mxb_audios),
which has to be switched corresponding to the video source (mxb_channels) */
static int video_audio_connect[MXB_INPUTS] =
{ 0, 1, 3, 3 };
/* these are the necessary input-output-pins for bringing one audio source
(see above) to the CD-output */
static struct tea6420_multiplex TEA6420_cd[MXB_AUDIOS+1][2] =
{
{{1,1,0},{1,1,0}}, /* Tuner */
{{5,1,0},{6,1,0}}, /* AUX 1 */
{{4,1,0},{6,1,0}}, /* AUX 2 */
{{3,1,0},{6,1,0}}, /* AUX 3 */
{{1,1,0},{3,1,0}}, /* Radio */
{{1,1,0},{2,1,0}}, /* CD-Rom */
{{6,1,0},{6,1,0}} /* Mute */
};
/* these are the necessary input-output-pins for bringing one audio source
(see above) to the line-output */
static struct tea6420_multiplex TEA6420_line[MXB_AUDIOS+1][2] =
{
{{2,3,0},{1,2,0}},
{{5,3,0},{6,2,0}},
{{4,3,0},{6,2,0}},
{{3,3,0},{6,2,0}},
{{2,3,0},{3,2,0}},
{{2,3,0},{2,2,0}},
{{6,3,0},{6,2,0}} /* Mute */
};
#define MAXCONTROLS 1
static struct v4l2_queryctrl mxb_controls[] = {
{ V4L2_CID_AUDIO_MUTE, V4L2_CTRL_TYPE_BOOLEAN, "Mute", 0, 1, 1, 0, 0 },
};
static struct saa7146_extension_ioctls ioctls[] = {
{ VIDIOC_ENUMINPUT, SAA7146_EXCLUSIVE },
{ VIDIOC_G_INPUT, SAA7146_EXCLUSIVE },
{ VIDIOC_S_INPUT, SAA7146_EXCLUSIVE },
{ VIDIOC_QUERYCTRL, SAA7146_BEFORE },
{ VIDIOC_G_CTRL, SAA7146_BEFORE },
{ VIDIOC_S_CTRL, SAA7146_BEFORE },
{ VIDIOC_G_TUNER, SAA7146_EXCLUSIVE },
{ VIDIOC_S_TUNER, SAA7146_EXCLUSIVE },
{ VIDIOC_G_FREQUENCY, SAA7146_EXCLUSIVE },
{ VIDIOC_S_FREQUENCY, SAA7146_EXCLUSIVE },
{ VIDIOC_G_AUDIO, SAA7146_EXCLUSIVE },
{ VIDIOC_S_AUDIO, SAA7146_EXCLUSIVE },
{ MXB_S_AUDIO_CD, SAA7146_EXCLUSIVE }, /* custom control */
{ MXB_S_AUDIO_LINE, SAA7146_EXCLUSIVE }, /* custom control */
{ 0, 0 }
};
struct mxb
{
struct video_device *video_dev;
struct video_device *vbi_dev;
struct i2c_adapter i2c_adapter;
struct i2c_client* saa7111a;
struct i2c_client* tda9840;
struct i2c_client* tea6415c;
struct i2c_client* tuner;
struct i2c_client* tea6420_1;
struct i2c_client* tea6420_2;
int cur_mode; /* current audio mode (mono, stereo, ...) */
int cur_input; /* current input */
int cur_mute; /* current mute status */
struct v4l2_frequency cur_freq; /* current frequency the tuner is tuned to */
};
static struct saa7146_extension extension;
static int mxb_probe(struct saa7146_dev* dev)
{
struct mxb* mxb = NULL;
struct i2c_client *client;
struct list_head *item;
int result;
if ((result = request_module("saa7111")) < 0) {
printk("mxb: saa7111 i2c module not available.\n");
return -ENODEV;
}
if ((result = request_module("tuner")) < 0) {
printk("mxb: tuner i2c module not available.\n");
return -ENODEV;
}
if ((result = request_module("tea6420")) < 0) {
printk("mxb: tea6420 i2c module not available.\n");
return -ENODEV;
}
if ((result = request_module("tea6415c")) < 0) {
printk("mxb: tea6415c i2c module not available.\n");
return -ENODEV;
}
if ((result = request_module("tda9840")) < 0) {
printk("mxb: tda9840 i2c module not available.\n");
return -ENODEV;
}
mxb = (struct mxb*)kmalloc(sizeof(struct mxb), GFP_KERNEL);
if( NULL == mxb ) {
DEB_D(("not enough kernel memory.\n"));
return -ENOMEM;
}
memset(mxb, 0x0, sizeof(struct mxb));
mxb->i2c_adapter = (struct i2c_adapter) {
.class = I2C_CLASS_TV_ANALOG,
.name = "mxb",
};
saa7146_i2c_adapter_prepare(dev, &mxb->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480);
if(i2c_add_adapter(&mxb->i2c_adapter) < 0) {
DEB_S(("cannot register i2c-device. skipping.\n"));
kfree(mxb);
return -EFAULT;
}
/* loop through all i2c-devices on the bus and look who is there */
list_for_each(item,&mxb->i2c_adapter.clients) {
client = list_entry(item, struct i2c_client, list);
if( I2C_TEA6420_1 == client->addr )
mxb->tea6420_1 = client;
if( I2C_TEA6420_2 == client->addr )
mxb->tea6420_2 = client;
if( I2C_TEA6415C_2 == client->addr )
mxb->tea6415c = client;
if( I2C_TDA9840 == client->addr )
mxb->tda9840 = client;
if( I2C_SAA7111 == client->addr )
mxb->saa7111a = client;
if( 0x60 == client->addr )
mxb->tuner = client;
}
/* check if all devices are present */
if( 0 == mxb->tea6420_1 || 0 == mxb->tea6420_2 || 0 == mxb->tea6415c
|| 0 == mxb->tda9840 || 0 == mxb->saa7111a || 0 == mxb->tuner ) {
printk("mxb: did not find all i2c devices. aborting\n");
i2c_del_adapter(&mxb->i2c_adapter);
kfree(mxb);
return -ENODEV;
}
/* all devices are present, probe was successful */
/* we store the pointer in our private data field */
dev->ext_priv = mxb;
return 0;
}
/* some init data for the saa7740, the so-called 'sound arena module'.
there are no specs available, so we simply use some init values */
static struct {
int length;
char data[9];
} mxb_saa7740_init[] = {
{ 3, { 0x80, 0x00, 0x00 } },{ 3, { 0x80, 0x89, 0x00 } },
{ 3, { 0x80, 0xb0, 0x0a } },{ 3, { 0x00, 0x00, 0x00 } },
{ 3, { 0x49, 0x00, 0x00 } },{ 3, { 0x4a, 0x00, 0x00 } },
{ 3, { 0x4b, 0x00, 0x00 } },{ 3, { 0x4c, 0x00, 0x00 } },
{ 3, { 0x4d, 0x00, 0x00 } },{ 3, { 0x4e, 0x00, 0x00 } },
{ 3, { 0x4f, 0x00, 0x00 } },{ 3, { 0x50, 0x00, 0x00 } },
{ 3, { 0x51, 0x00, 0x00 } },{ 3, { 0x52, 0x00, 0x00 } },
{ 3, { 0x53, 0x00, 0x00 } },{ 3, { 0x54, 0x00, 0x00 } },
{ 3, { 0x55, 0x00, 0x00 } },{ 3, { 0x56, 0x00, 0x00 } },
{ 3, { 0x57, 0x00, 0x00 } },{ 3, { 0x58, 0x00, 0x00 } },
{ 3, { 0x59, 0x00, 0x00 } },{ 3, { 0x5a, 0x00, 0x00 } },
{ 3, { 0x5b, 0x00, 0x00 } },{ 3, { 0x5c, 0x00, 0x00 } },
{ 3, { 0x5d, 0x00, 0x00 } },{ 3, { 0x5e, 0x00, 0x00 } },
{ 3, { 0x5f, 0x00, 0x00 } },{ 3, { 0x60, 0x00, 0x00 } },
{ 3, { 0x61, 0x00, 0x00 } },{ 3, { 0x62, 0x00, 0x00 } },
{ 3, { 0x63, 0x00, 0x00 } },{ 3, { 0x64, 0x00, 0x00 } },
{ 3, { 0x65, 0x00, 0x00 } },{ 3, { 0x66, 0x00, 0x00 } },
{ 3, { 0x67, 0x00, 0x00 } },{ 3, { 0x68, 0x00, 0x00 } },
{ 3, { 0x69, 0x00, 0x00 } },{ 3, { 0x6a, 0x00, 0x00 } },
{ 3, { 0x6b, 0x00, 0x00 } },{ 3, { 0x6c, 0x00, 0x00 } },
{ 3, { 0x6d, 0x00, 0x00 } },{ 3, { 0x6e, 0x00, 0x00 } },
{ 3, { 0x6f, 0x00, 0x00 } },{ 3, { 0x70, 0x00, 0x00 } },
{ 3, { 0x71, 0x00, 0x00 } },{ 3, { 0x72, 0x00, 0x00 } },
{ 3, { 0x73, 0x00, 0x00 } },{ 3, { 0x74, 0x00, 0x00 } },
{ 3, { 0x75, 0x00, 0x00 } },{ 3, { 0x76, 0x00, 0x00 } },
{ 3, { 0x77, 0x00, 0x00 } },{ 3, { 0x41, 0x00, 0x42 } },
{ 3, { 0x42, 0x10, 0x42 } },{ 3, { 0x43, 0x20, 0x42 } },
{ 3, { 0x44, 0x30, 0x42 } },{ 3, { 0x45, 0x00, 0x01 } },
{ 3, { 0x46, 0x00, 0x01 } },{ 3, { 0x47, 0x00, 0x01 } },
{ 3, { 0x48, 0x00, 0x01 } },
{ 9, { 0x01, 0x03, 0xc5, 0x5c, 0x7a, 0x85, 0x01, 0x00, 0x54 } },
{ 9, { 0x21, 0x03, 0xc5, 0x5c, 0x7a, 0x85, 0x01, 0x00, 0x54 } },
{ 9, { 0x09, 0x0b, 0xb4, 0x6b, 0x74, 0x85, 0x95, 0x00, 0x34 } },
{ 9, { 0x29, 0x0b, 0xb4, 0x6b, 0x74, 0x85, 0x95, 0x00, 0x34 } },
{ 9, { 0x11, 0x17, 0x43, 0x62, 0x68, 0x89, 0xd1, 0xff, 0xb0 } },
{ 9, { 0x31, 0x17, 0x43, 0x62, 0x68, 0x89, 0xd1, 0xff, 0xb0 } },
{ 9, { 0x19, 0x20, 0x62, 0x51, 0x5a, 0x95, 0x19, 0x01, 0x50 } },
{ 9, { 0x39, 0x20, 0x62, 0x51, 0x5a, 0x95, 0x19, 0x01, 0x50 } },
{ 9, { 0x05, 0x3e, 0xd2, 0x69, 0x4e, 0x9a, 0x51, 0x00, 0xf0 } },
{ 9, { 0x25, 0x3e, 0xd2, 0x69, 0x4e, 0x9a, 0x51, 0x00, 0xf0 } },
{ 9, { 0x0d, 0x3d, 0xa1, 0x40, 0x7d, 0x9f, 0x29, 0xfe, 0x14 } },
{ 9, { 0x2d, 0x3d, 0xa1, 0x40, 0x7d, 0x9f, 0x29, 0xfe, 0x14 } },
{ 9, { 0x15, 0x73, 0xa1, 0x50, 0x5d, 0xa6, 0xf5, 0xfe, 0x38 } },
{ 9, { 0x35, 0x73, 0xa1, 0x50, 0x5d, 0xa6, 0xf5, 0xfe, 0x38 } },
{ 9, { 0x1d, 0xed, 0xd0, 0x68, 0x29, 0xb4, 0xe1, 0x00, 0xb8 } },
{ 9, { 0x3d, 0xed, 0xd0, 0x68, 0x29, 0xb4, 0xe1, 0x00, 0xb8 } },
{ 3, { 0x80, 0xb3, 0x0a } },
{-1, { 0} }
};
static const unsigned char mxb_saa7111_init[] = {
0x00, 0x00, /* 00 - ID byte */
0x01, 0x00, /* 01 - reserved */
/*front end */
0x02, 0xd8, /* 02 - FUSE=x, GUDL=x, MODE=x */
0x03, 0x23, /* 03 - HLNRS=0, VBSL=1, WPOFF=0, HOLDG=0, GAFIX=0, GAI1=256, GAI2=256 */
0x04, 0x00, /* 04 - GAI1=256 */
0x05, 0x00, /* 05 - GAI2=256 */
/* decoder */
0x06, 0xf0, /* 06 - HSB at xx(50Hz) / xx(60Hz) pixels after end of last line */
0x07, 0x30, /* 07 - HSS at xx(50Hz) / xx(60Hz) pixels after end of last line */
0x08, 0xa8, /* 08 - AUFD=x, FSEL=x, EXFIL=x, VTRC=x, HPLL=x, VNOI=x */
0x09, 0x02, /* 09 - BYPS=x, PREF=x, BPSS=x, VBLB=x, UPTCV=x, APER=x */
0x0a, 0x80, /* 0a - BRIG=128 */
0x0b, 0x47, /* 0b - CONT=1.109 */
0x0c, 0x40, /* 0c - SATN=1.0 */
0x0d, 0x00, /* 0d - HUE=0 */
0x0e, 0x01, /* 0e - CDTO=0, CSTD=0, DCCF=0, FCTC=0, CHBW=1 */
0x0f, 0x00, /* 0f - reserved */
0x10, 0xd0, /* 10 - OFTS=x, HDEL=x, VRLN=x, YDEL=x */
0x11, 0x8c, /* 11 - GPSW=x, CM99=x, FECO=x, COMPO=x, OEYC=1, OEHV=1, VIPB=0, COLO=0 */
0x12, 0x80, /* 12 - xx output control 2 */
0x13, 0x30, /* 13 - xx output control 3 */
0x14, 0x00, /* 14 - reserved */
0x15, 0x15, /* 15 - VBI */
0x16, 0x04, /* 16 - VBI */
0x17, 0x00, /* 17 - VBI */
};
/* bring hardware to a sane state. this has to be done, just in case someone
wants to capture from this device before it has been properly initialized.
the capture engine would badly fail, because no valid signal arrives on the
saa7146, thus leading to timeouts and stuff. */
static int mxb_init_done(struct saa7146_dev* dev)
{
struct mxb* mxb = (struct mxb*)dev->ext_priv;
struct video_decoder_init init;
struct i2c_msg msg;
struct tuner_setup tun_setup;
int i = 0, err = 0;
struct tea6415c_multiplex vm;
/* select video mode in saa7111a */
i = VIDEO_MODE_PAL;
/* fixme: currently pointless: gets overwritten by configuration below */
mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_NORM, &i);
/* write configuration to saa7111a */
init.data = mxb_saa7111_init;
init.len = sizeof(mxb_saa7111_init);
mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_INIT, &init);
/* select tuner-output on saa7111a */
i = 0;
mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_INPUT, &i);
/* enable vbi bypass */
i = 1;
mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i);
/* select a tuner type */
tun_setup.mode_mask = T_ANALOG_TV;
tun_setup.addr = ADDR_UNSET;
tun_setup.type = TUNER_PHILIPS_PAL;
mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup);
/* tune in some frequency on tuner */
mxb->cur_freq.tuner = 0;
mxb->cur_freq.type = V4L2_TUNER_ANALOG_TV;
mxb->cur_freq.frequency = freq;
mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY,
&mxb->cur_freq);
/* mute audio on tea6420s */
mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]);
mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]);
mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_cd[6][0]);
mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_cd[6][1]);
/* switch to tuner-channel on tea6415c*/
vm.out = 17;
vm.in = 3;
mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm);
/* select tuner-output on multicable on tea6415c*/
vm.in = 3;
vm.out = 13;
mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm);
/* the rest for mxb */
mxb->cur_input = 0;
mxb->cur_mute = 1;
mxb->cur_mode = V4L2_TUNER_MODE_STEREO;
mxb->tda9840->driver->command(mxb->tda9840, TDA9840_SWITCH, &mxb->cur_mode);
/* check if the saa7740 (aka 'sound arena module') is present
on the mxb. if so, we must initialize it. due to lack of
informations about the saa7740, the values were reverse
engineered. */
msg.addr = 0x1b;
msg.flags = 0;
msg.len = mxb_saa7740_init[0].length;
msg.buf = &mxb_saa7740_init[0].data[0];
if( 1 == (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) {
/* the sound arena module is a pos, that's probably the reason
philips refuses to hand out a datasheet for the saa7740...
it seems to screw up the i2c bus, so we disable fast irq
based i2c transactions here and rely on the slow and safe
polling method ... */
extension.flags &= ~SAA7146_USE_I2C_IRQ;
for(i = 1;;i++) {
if( -1 == mxb_saa7740_init[i].length ) {
break;
}
msg.len = mxb_saa7740_init[i].length;
msg.buf = &mxb_saa7740_init[i].data[0];
if( 1 != (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) {
DEB_D(("failed to initialize 'sound arena module'.\n"));
goto err;
}
}
INFO(("'sound arena module' detected.\n"));
}
err:
/* the rest for saa7146: you should definitely set some basic values
for the input-port handling of the saa7146. */
/* ext->saa has been filled by the core driver */
/* some stuff is done via variables */
saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source, input_port_selection[mxb->cur_input].hps_sync);
/* some stuff is done via direct write to the registers */
/* this is ugly, but because of the fact that this is completely
hardware dependend, it should be done directly... */
saa7146_write(dev, DD1_STREAM_B, 0x00000000);
saa7146_write(dev, DD1_INIT, 0x02000200);
saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
return 0;
}
/* interrupt-handler. this gets called when irq_mask is != 0.
it must clear the interrupt-bits in irq_mask it has handled */
/*
void mxb_irq_bh(struct saa7146_dev* dev, u32* irq_mask)
{
struct mxb* mxb = (struct mxb*)dev->ext_priv;
}
*/
static struct saa7146_ext_vv vv_data;
/* this function only gets called when the probing was successful */
static int mxb_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *info)
{
struct mxb* mxb = (struct mxb*)dev->ext_priv;
DEB_EE(("dev:%p\n",dev));
/* checking for i2c-devices can be omitted here, because we
already did this in "mxb_vl42_probe" */
saa7146_vv_init(dev,&vv_data);
if( 0 != saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) {
ERR(("cannot register capture v4l2 device. skipping.\n"));
return -1;
}
/* initialization stuff (vbi) (only for revision > 0 and for extensions which want it)*/
if( 0 != MXB_BOARD_CAN_DO_VBI(dev)) {
if( 0 != saa7146_register_device(&mxb->vbi_dev, dev, "mxb", VFL_TYPE_VBI)) {
ERR(("cannot register vbi v4l2 device. skipping.\n"));
}
}
i2c_use_client(mxb->tea6420_1);
i2c_use_client(mxb->tea6420_2);
i2c_use_client(mxb->tea6415c);
i2c_use_client(mxb->tda9840);
i2c_use_client(mxb->saa7111a);
i2c_use_client(mxb->tuner);
printk("mxb: found 'Multimedia eXtension Board'-%d.\n",mxb_num);
mxb_num++;
mxb_init_done(dev);
return 0;
}
static int mxb_detach(struct saa7146_dev* dev)
{
struct mxb* mxb = (struct mxb*)dev->ext_priv;
DEB_EE(("dev:%p\n",dev));
i2c_release_client(mxb->tea6420_1);
i2c_release_client(mxb->tea6420_2);
i2c_release_client(mxb->tea6415c);
i2c_release_client(mxb->tda9840);
i2c_release_client(mxb->saa7111a);
i2c_release_client(mxb->tuner);
saa7146_unregister_device(&mxb->video_dev,dev);
if( 0 != MXB_BOARD_CAN_DO_VBI(dev)) {
saa7146_unregister_device(&mxb->vbi_dev,dev);
}
saa7146_vv_release(dev);
mxb_num--;
i2c_del_adapter(&mxb->i2c_adapter);
kfree(mxb);
return 0;
}
static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
{
struct saa7146_dev *dev = fh->dev;
struct mxb* mxb = (struct mxb*)dev->ext_priv;
struct saa7146_vv *vv = dev->vv_data;
switch(cmd) {
case VIDIOC_ENUMINPUT:
{
struct v4l2_input *i = arg;
DEB_EE(("VIDIOC_ENUMINPUT %d.\n",i->index));
if( i->index < 0 || i->index >= MXB_INPUTS) {
return -EINVAL;
}
memcpy(i, &mxb_inputs[i->index], sizeof(struct v4l2_input));
return 0;
}
/* the saa7146 provides some controls (brightness, contrast, saturation)
which gets registered *after* this function. because of this we have
to return with a value != 0 even if the function succeded.. */
case VIDIOC_QUERYCTRL:
{
struct v4l2_queryctrl *qc = arg;
int i;
for (i = MAXCONTROLS - 1; i >= 0; i--) {
if (mxb_controls[i].id == qc->id) {
*qc = mxb_controls[i];
DEB_D(("VIDIOC_QUERYCTRL %d.\n",qc->id));
return 0;
}
}
return -EAGAIN;
}
case VIDIOC_G_CTRL:
{
struct v4l2_control *vc = arg;
int i;
for (i = MAXCONTROLS - 1; i >= 0; i--) {
if (mxb_controls[i].id == vc->id) {
break;
}
}
if( i < 0 ) {
return -EAGAIN;
}
switch (vc->id ) {
case V4L2_CID_AUDIO_MUTE: {
vc->value = mxb->cur_mute;
DEB_D(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n",vc->value));
return 0;
}
}
DEB_EE(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n",vc->value));
return 0;
}
case VIDIOC_S_CTRL:
{
struct v4l2_control *vc = arg;
int i = 0;
for (i = MAXCONTROLS - 1; i >= 0; i--) {
if (mxb_controls[i].id == vc->id) {
break;
}
}
if( i < 0 ) {
return -EAGAIN;
}
switch (vc->id ) {
case V4L2_CID_AUDIO_MUTE: {
mxb->cur_mute = vc->value;
if( 0 == vc->value ) {
/* switch the audio-source */
mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[mxb->cur_input]][0]);
mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[mxb->cur_input]][1]);
} else {
mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]);
mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]);
}
DEB_EE(("VIDIOC_S_CTRL, V4L2_CID_AUDIO_MUTE: %d.\n",vc->value));
break;
}
}
return 0;
}
case VIDIOC_G_INPUT:
{
int *input = (int *)arg;
*input = mxb->cur_input;
DEB_EE(("VIDIOC_G_INPUT %d.\n",*input));
return 0;
}
case VIDIOC_S_INPUT:
{
int input = *(int *)arg;
struct tea6415c_multiplex vm;
int i = 0;
DEB_EE(("VIDIOC_S_INPUT %d.\n",input));
if (input < 0 || input >= MXB_INPUTS) {
return -EINVAL;
}
/* fixme: locke das setzen des inputs mit hilfe des mutexes
down(&dev->lock);
video_mux(dev,*i);
up(&dev->lock);
*/
/* fixme: check if streaming capture
if ( 0 != dev->streaming ) {
DEB_D(("VIDIOC_S_INPUT illegal while streaming.\n"));
return -EPERM;
}
*/
mxb->cur_input = input;
saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source, input_port_selection[input].hps_sync);
/* prepare switching of tea6415c and saa7111a;
have a look at the 'background'-file for further informations */
switch( input ) {
case TUNER:
{
i = 0;
vm.in = 3;
vm.out = 17;
if ( 0 != mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm)) {
printk("VIDIOC_S_INPUT: could not address tea6415c #1\n");
return -EFAULT;
}
/* connect tuner-output always to multicable */
vm.in = 3;
vm.out = 13;
break;
}
case AUX3_YC:
{
/* nothing to be done here. aux3_yc is
directly connected to the saa711a */
i = 5;
break;
}
case AUX3:
{
/* nothing to be done here. aux3 is
directly connected to the saa711a */
i = 1;
break;
}
case AUX1:
{
i = 0;
vm.in = 1;
vm.out = 17;
break;
}
}
/* switch video in tea6415c only if necessary */
switch( input ) {
case TUNER:
case AUX1:
{
if ( 0 != mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm)) {
printk("VIDIOC_S_INPUT: could not address tea6415c #3\n");
return -EFAULT;
}
break;
}
default:
{
break;
}
}
/* switch video in saa7111a */
if ( 0 != mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_INPUT, &i)) {
printk("VIDIOC_S_INPUT: could not address saa7111a #1.\n");
}
/* switch the audio-source only if necessary */
if( 0 == mxb->cur_mute ) {
mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[input]][0]);
mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[input]][1]);
}
return 0;
}
case VIDIOC_G_TUNER:
{
struct v4l2_tuner *t = arg;
int byte = 0;
if( 0 != t->index ) {
DEB_D(("VIDIOC_G_TUNER: channel %d does not have a tuner attached.\n", t->index));
return -EINVAL;
}
DEB_EE(("VIDIOC_G_TUNER: %d\n", t->index));
memset(t,0,sizeof(*t));
strcpy(t->name, "Television");
t->type = V4L2_TUNER_ANALOG_TV;
t->capability = V4L2_TUNER_CAP_NORM | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2 | V4L2_TUNER_CAP_SAP;
t->rangelow = 772; /* 48.25 MHZ / 62.5 kHz = 772, see fi1216mk2-specs, page 2 */
t->rangehigh = 13684; /* 855.25 MHz / 62.5 kHz = 13684 */
/* FIXME: add the real signal strength here */
t->signal = 0xffff;
t->afc = 0;
mxb->tda9840->driver->command(mxb->tda9840,TDA9840_DETECT, &byte);
t->audmode = mxb->cur_mode;
if( byte < 0 ) {
t->rxsubchans = V4L2_TUNER_SUB_MONO;
} else {
switch(byte) {
case TDA9840_MONO_DETECT: {
t->rxsubchans = V4L2_TUNER_SUB_MONO;
DEB_D(("VIDIOC_G_TUNER: V4L2_TUNER_MODE_MONO.\n"));
break;
}
case TDA9840_DUAL_DETECT: {
t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
DEB_D(("VIDIOC_G_TUNER: V4L2_TUNER_MODE_LANG1.\n"));
break;
}
case TDA9840_STEREO_DETECT: {
t->rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO;
DEB_D(("VIDIOC_G_TUNER: V4L2_TUNER_MODE_STEREO.\n"));
break;
}
default: { /* TDA9840_INCORRECT_DETECT */
t->rxsubchans = V4L2_TUNER_MODE_MONO;
DEB_D(("VIDIOC_G_TUNER: TDA9840_INCORRECT_DETECT => V4L2_TUNER_MODE_MONO\n"));
break;
}
}
}
return 0;
}
case VIDIOC_S_TUNER:
{
struct v4l2_tuner *t = arg;
int result = 0;
int byte = 0;
if( 0 != t->index ) {
DEB_D(("VIDIOC_S_TUNER: channel %d does not have a tuner attached.\n",t->index));
return -EINVAL;
}
switch(t->audmode) {
case V4L2_TUNER_MODE_STEREO: {
mxb->cur_mode = V4L2_TUNER_MODE_STEREO;
byte = TDA9840_SET_STEREO;
DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_STEREO\n"));
break;
}
case V4L2_TUNER_MODE_LANG1: {
mxb->cur_mode = V4L2_TUNER_MODE_LANG1;
byte = TDA9840_SET_LANG1;
DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1\n"));
break;
}
case V4L2_TUNER_MODE_LANG2: {
mxb->cur_mode = V4L2_TUNER_MODE_LANG2;
byte = TDA9840_SET_LANG2;
DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG2\n"));
break;
}
default: { /* case V4L2_TUNER_MODE_MONO: {*/
mxb->cur_mode = V4L2_TUNER_MODE_MONO;
byte = TDA9840_SET_MONO;
DEB_D(("VIDIOC_S_TUNER: TDA9840_SET_MONO\n"));
break;
}
}
if( 0 != (result = mxb->tda9840->driver->command(mxb->tda9840, TDA9840_SWITCH, &byte))) {
printk("VIDIOC_S_TUNER error. result:%d, byte:%d\n",result,byte);
}
return 0;
}
case VIDIOC_G_FREQUENCY:
{
struct v4l2_frequency *f = arg;
if(0 != mxb->cur_input) {
DEB_D(("VIDIOC_G_FREQ: channel %d does not have a tuner!\n",mxb->cur_input));
return -EINVAL;
}
*f = mxb->cur_freq;
DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", mxb->cur_freq.frequency));
return 0;
}
case VIDIOC_S_FREQUENCY:
{
struct v4l2_frequency *f = arg;
if (0 != f->tuner)
return -EINVAL;
if (V4L2_TUNER_ANALOG_TV != f->type)
return -EINVAL;
if(0 != mxb->cur_input) {
DEB_D(("VIDIOC_S_FREQ: channel %d does not have a tuner!\n",mxb->cur_input));
return -EINVAL;
}
mxb->cur_freq = *f;
DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n", mxb->cur_freq.frequency));
/* tune in desired frequency */
mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY, &mxb->cur_freq);
/* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */
spin_lock(&dev->slock);
vv->vbi_fieldcount = 0;
spin_unlock(&dev->slock);
return 0;
}
case MXB_S_AUDIO_CD:
{
int i = *(int*)arg;
if( i < 0 || i >= MXB_AUDIOS ) {
DEB_D(("illegal argument to MXB_S_AUDIO_CD: i:%d.\n",i));
return -EINVAL;
}
DEB_EE(("MXB_S_AUDIO_CD: i:%d.\n",i));
mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_cd[i][0]);
mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_cd[i][1]);
return 0;
}
case MXB_S_AUDIO_LINE:
{
int i = *(int*)arg;
if( i < 0 || i >= MXB_AUDIOS ) {
DEB_D(("illegal argument to MXB_S_AUDIO_LINE: i:%d.\n",i));
return -EINVAL;
}
DEB_EE(("MXB_S_AUDIO_LINE: i:%d.\n",i));
mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[i][0]);
mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[i][1]);
return 0;
}
case VIDIOC_G_AUDIO:
{
struct v4l2_audio *a = arg;
if( a->index < 0 || a->index > MXB_INPUTS ) {
DEB_D(("VIDIOC_G_AUDIO %d out of range.\n",a->index));
return -EINVAL;
}
DEB_EE(("VIDIOC_G_AUDIO %d.\n",a->index));
memcpy(a, &mxb_audios[video_audio_connect[mxb->cur_input]], sizeof(struct v4l2_audio));
return 0;
}
case VIDIOC_S_AUDIO:
{
struct v4l2_audio *a = arg;
DEB_D(("VIDIOC_S_AUDIO %d.\n",a->index));
return 0;
}
default:
/*
DEB2(printk("does not handle this ioctl.\n"));
*/
return -ENOIOCTLCMD;
}
return 0;
}
static int std_callback(struct saa7146_dev* dev, struct saa7146_standard *std)
{
struct mxb* mxb = (struct mxb*)dev->ext_priv;
int zero = 0;
int one = 1;
if(V4L2_STD_PAL_I == std->id ) {
DEB_D(("VIDIOC_S_STD: setting mxb for PAL_I.\n"));
/* set the 7146 gpio register -- I don't know what this does exactly */
saa7146_write(dev, GPIO_CTRL, 0x00404050);
/* unset the 7111 gpio register -- I don't know what this does exactly */
mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &zero);
} else {
DEB_D(("VIDIOC_S_STD: setting mxb for PAL/NTSC/SECAM.\n"));
/* set the 7146 gpio register -- I don't know what this does exactly */
saa7146_write(dev, GPIO_CTRL, 0x00404050);
/* set the 7111 gpio register -- I don't know what this does exactly */
mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &one);
}
return 0;
}
static struct saa7146_standard standard[] = {
{
.name = "PAL-BG", .id = V4L2_STD_PAL_BG,
.v_offset = 0x17, .v_field = 288,
.h_offset = 0x14, .h_pixels = 680,
.v_max_out = 576, .h_max_out = 768,
}, {
.name = "PAL-I", .id = V4L2_STD_PAL_I,
.v_offset = 0x17, .v_field = 288,
.h_offset = 0x14, .h_pixels = 680,
.v_max_out = 576, .h_max_out = 768,
}, {
.name = "NTSC", .id = V4L2_STD_NTSC,
.v_offset = 0x16, .v_field = 240,
.h_offset = 0x06, .h_pixels = 708,
.v_max_out = 480, .h_max_out = 640,
}, {
.name = "SECAM", .id = V4L2_STD_SECAM,
.v_offset = 0x14, .v_field = 288,
.h_offset = 0x14, .h_pixels = 720,
.v_max_out = 576, .h_max_out = 768,
}
};
static struct saa7146_pci_extension_data mxb = {
.ext_priv = "Multimedia eXtension Board",
.ext = &extension,
};
static struct pci_device_id pci_tbl[] = {
{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7146,
.subvendor = 0x0000,
.subdevice = 0x0000,
.driver_data = (unsigned long)&mxb,
}, {
.vendor = 0,
}
};
MODULE_DEVICE_TABLE(pci, pci_tbl);
static struct saa7146_ext_vv vv_data = {
.inputs = MXB_INPUTS,
.capabilities = V4L2_CAP_TUNER | V4L2_CAP_VBI_CAPTURE,
.stds = &standard[0],
.num_stds = sizeof(standard)/sizeof(struct saa7146_standard),
.std_callback = &std_callback,
.ioctls = &ioctls[0],
.ioctl = mxb_ioctl,
};
static struct saa7146_extension extension = {
.name = MXB_IDENTIFIER,
.flags = SAA7146_USE_I2C_IRQ,
.pci_tbl = &pci_tbl[0],
.module = THIS_MODULE,
.probe = mxb_probe,
.attach = mxb_attach,
.detach = mxb_detach,
.irq_mask = 0,
.irq_func = NULL,
};
static int __init mxb_init_module(void)
{
if( 0 != saa7146_register_extension(&extension)) {
DEB_S(("failed to register extension.\n"));
return -ENODEV;
}
return 0;
}
static void __exit mxb_cleanup_module(void)
{
saa7146_unregister_extension(&extension);
}
module_init(mxb_init_module);
module_exit(mxb_cleanup_module);
MODULE_DESCRIPTION("video4linux-2 driver for the Siemens-Nixdorf 'Multimedia eXtension board'");
MODULE_AUTHOR("Michael Hunold <michael@mihu.de>");
MODULE_LICENSE("GPL");
| ipwndev/DSLinux-Mirror | linux-2.6.x/drivers/media/video/mxb.c | C | gpl-2.0 | 30,749 | [
30522,
1013,
1008,
25630,
2497,
1011,
1058,
2549,
2140,
2475,
4062,
2005,
1996,
14959,
5331,
2604,
9385,
1006,
1039,
1007,
2687,
1011,
2494,
2745,
15876,
3630,
6392,
1026,
2745,
1030,
2771,
6979,
1012,
2139,
1028,
3942,
8299,
1024,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Collections.Generic;
using RestSharp;
using SimpleJson;
namespace MoneySharp.Internal.Model
{
public class SalesInvoicePost : SalesInvoice
{
public IList<SalesInvoiceDetail> details_attributes { get; set; }
public JsonObject custom_fields_attributes { get; set; }
}
} | SpringIT/moneysharp | src/MoneySharp/Internal/Model/SalesInvoicePost.cs | C# | apache-2.0 | 322 | [
30522,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
16626,
8167,
2361,
1025,
2478,
3722,
22578,
2239,
1025,
3415,
15327,
2769,
7377,
14536,
1012,
4722,
1012,
2944,
1063,
2270,
2465,
4341,
2378,
6767,
6610,
19894,
1024,
4341,
2378,
6767,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.oodt.commons;
import junit.framework.TestCase;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.rmi.server.RemoteObject;
public class AvroMultiServerTest extends TestCase {
private InputStream testConfig;
public AvroMultiServerTest(String name) {
super(name);
}
protected void setUp() throws Exception {
super.setUp();
testConfig = getClass().getResourceAsStream("/test-multiserver.xml");
if (testConfig == null) throw new IOException("Cannot find `test-multiserver.xml'");
System.setProperty("my.other.setting", "Don't override");
}
public void tearDown() throws Exception {
if (testConfig != null) try {
testConfig.close();
} catch (IOException ignore) {}
System.getProperties().remove("my.setting");
System.getProperties().remove("my.other.setting");
super.tearDown();
}
public static class Svr1 extends RemoteObject {
public Svr1(ExecServer e) {}
}
public static class Svr2 extends RemoteObject {
public Svr2(ExecServer e) {}
}
public static class Svr3 extends RemoteObject {
public Svr3(ExecServer e) {}
}
public static class Svr4 extends RemoteObject {
public Svr4(ExecServer e) {}
}
public void testParsing() throws ParserConfigurationException, SAXException, IOException, ClassNotFoundException,
NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
InputSource is = new InputSource(testConfig);
MultiServer.parseConfig(is);
assertEquals("test.app", MultiServer.getAppName());
assertEquals(4, MultiServer.getServers().size());
MultiServer.Server server = (MultiServer.Server) MultiServer.getServers().get("urn:eda:rmi:Test1");
assertEquals("org.apache.oodt.commons.MultiServerTest$Svr1", server.getClassName());
assertEquals(MultiServer.BINDING, server.getBindingBehavior());
server = (MultiServer.Server) MultiServer.getServers().get("urn:eda:rmi:Test2");
assertEquals("org.apache.oodt.commons.MultiServerTest$Svr2", server.getClassName());
assertEquals(MultiServer.NONBINDING, server.getBindingBehavior());
server = (MultiServer.Server) MultiServer.getServers().get("urn:eda:rmi:Test3");
assertEquals("org.apache.oodt.commons.MultiServerTest$Svr3", server.getClassName());
assertEquals(MultiServer.REBINDING, server.getBindingBehavior());
MultiServer.AutobindingServer s = (MultiServer.AutobindingServer) MultiServer.getServers().get("urn:eda:rmi:Test4");
assertEquals("org.apache.oodt.commons.MultiServerTest$Svr4", s.getClassName());
assertEquals(MultiServer.AUTO, s.getBindingBehavior());
assertEquals(360000L, s.getPeriod());
assertEquals("My Value", System.getProperty("my.setting"));
assertEquals("Don't override", System.getProperty("my.other.setting"));
}
}
| apache/oodt | commons/src/test/java/org/apache/oodt/commons/AvroMultiServerTest.java | Java | apache-2.0 | 4,006 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
30524,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
1008,
1996,
2004,
2546,
15943,
2023,
5371,
2000,
2017,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1008,
1006,
1996,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>网页右键菜单</title>
<style type="text/css">
*{margin:0;padding:0;}
#right_button_menu{
width:100px;height:auto;border:1px solid;border-radius:3px;
position:absolute;display:none;z-index:100;
}
#right_button_menu>ul{
position:relative;background:hsl(134,70%,80%);
}
#right_button_menu>ul>li{
border-bottom:1px dashed;position:relative;
text-align:center;list-style:none;cursor:pointer;
}
#right_button_menu>ul>li>a{
text-decoration:none;
}
#right_button_menu>ul>li>ul{
position:absolute;left:100px;
border:1px solid;border-radius:5px ;
display:none;background:hsl(134,70%,80%);
}
#right_button_menu>ul>li>ul>li{
border-bottom:1px dashed;
text-align:center;list-style:none;
}
#right_button_menu>ul>li>ul>li>a{
text-decoration:none;
}
#right_button_menu>ul>li:hover>ul{
display:block;
}
</style>
<script type="text/javascript">
window.onload =function (){
var menu=document.getElementById('right_button_menu');//获取到菜单
document.oncontextmenu=function(e){return false;}//禁止火狐、IE、safari的右键菜单弹出
function click(e) {//点击处理函数
var e=e||event;//为了兼容
if (e.which==2||e.button==4) {//中键
hide_menu(menu);//隐藏菜单
return false;
}
else if(e.which==3||e.button==2){//右键
x=e.clientX;y=e.clientY;//获取鼠标在可视区的位置
var l=document.body.scrollLeft>0?document.body.scrollLeft:document.documentElement.scrollLeft;//获取鼠标所在地的左偏移
var t=document.body.scrollTop>0?document.body.scrollTop:document.documentElement.scrollTop;//获取鼠标所在地的上偏移
document.title="X 坐标: " + (x +l)+ ", Y 坐标: " +( y+t);//将CSS将要应用的left和top值打印在标题上
show_menu(menu,x +l,y+t);//展示菜单
}
else if(e.which==1||e.button==1){//左键
setTimeout(function (){hide_menu(menu);},100);//隐藏菜单,同时如果点击菜单内容,设置一个延迟让菜单的功能实现,否则在IE下会来不及实现菜单功能
}
}
document.onmousedown=click;//文档鼠标按下执行处理
function show_menu(obj,left,top){//展示函数
obj.style.left=left+'px';
obj.style.top=top+'px';
obj.style.display='block';
}
function hide_menu(obj){//隐藏函数
obj.style.display='none';
}
}
</script>
</head>
<body>
<div id="right_button_menu">
<ul>
<li><a href="">更换桌面背景</a></li>
<li><a href="">夜间模式</a></li>
<li><a href="">刷新</a></li>
<li class="has_sec_menu">
<ul>
<li><a href="">文本文档</a></li>
<li><a href="">Word文档</a></li>
<li><a href="">Excel表格</a></li>
<li><a href="">PowerPoint幻灯片</a></li>
</ul>新建
</li>
<li><a href="javascript:show('player');">听音乐</a></li>
</ul>
</div>
</body>
</html>
| 0end1/code_base | Css_CodeBase/按钮或链接/3.6/网页右键菜单.html | HTML | apache-2.0 | 3,001 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
13103,
1000,
4180,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"59064700","logradouro":"Rua Mois\u00e9s Sesyon","bairro":"Candel\u00e1ria","cidade":"Natal","uf":"RN","estado":"Rio Grande do Norte"});
| lfreneda/cepdb | api/v1/59064700.jsonp.js | JavaScript | cc0-1.0 | 150 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
25186,
21084,
19841,
2692,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
25175,
2015,
1032,
1057,
8889,
2063,
2683,
2015,
7367,
6508,
2239,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using Xunit;
using System.Linq;
using hihapi.Models;
using hihapi.Controllers;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.OData.Results;
using hihapi.test.common;
namespace hihapi.unittest.Finance
{
[Collection("HIHAPI_UnitTests#1")]
public class FinanceDocumentTypesControllerTest
{
private SqliteDatabaseFixture fixture = null;
public FinanceDocumentTypesControllerTest(SqliteDatabaseFixture fixture)
{
this.fixture = fixture;
}
[Theory]
[InlineData("")]
[InlineData(DataSetupUtility.UserA)]
public async Task TestCase_Read(string strusr)
{
var context = fixture.GetCurrentDataContext();
// 1. Read it without User assignment
var control = new FinanceDocumentTypesController(context);
if (String.IsNullOrEmpty(strusr))
{
var userclaim = DataSetupUtility.GetClaimForUser(strusr);
control.ControllerContext = new ControllerContext()
{
HttpContext = new DefaultHttpContext() { User = userclaim }
};
}
var getresult = control.Get();
Assert.NotNull(getresult);
var getokresult = Assert.IsType<OkObjectResult>(getresult);
var getqueryresult = Assert.IsAssignableFrom<IQueryable<FinanceDocumentType>>(getokresult.Value);
Assert.NotNull(getqueryresult);
if (String.IsNullOrEmpty(strusr))
{
var dbcategories = (from tt in context.FinDocumentTypes
where tt.HomeID == null
select tt).ToList<FinanceDocumentType>();
Assert.Equal(dbcategories.Count, getqueryresult.Count());
}
await context.DisposeAsync();
}
[Theory]
[InlineData(DataSetupUtility.UserA, DataSetupUtility.Home1ID, "Test 1")]
[InlineData(DataSetupUtility.UserB, DataSetupUtility.Home2ID, "Test 2")]
public async Task TestCase_CRUD(string currentUser, int hid, string name)
{
var context = fixture.GetCurrentDataContext();
// 1. Read it out before insert.
var control = new FinanceDocumentTypesController(context);
var userclaim = DataSetupUtility.GetClaimForUser(currentUser);
control.ControllerContext = new ControllerContext()
{
HttpContext = new DefaultHttpContext() { User = userclaim }
};
var getresult = control.Get();
Assert.NotNull(getresult);
var getokresult = Assert.IsType<OkObjectResult>(getresult);
var getqueryresult = Assert.IsAssignableFrom<IQueryable<FinanceDocumentType>>(getokresult.Value);
Assert.NotNull(getqueryresult);
// 2. Insert a new one.
FinanceDocumentType ctgy = new FinanceDocumentType();
ctgy.HomeID = hid;
ctgy.Name = name;
ctgy.Comment = name;
var postresult = await control.Post(ctgy);
var createdResult = Assert.IsType<CreatedODataResult<FinanceDocumentType>>(postresult);
Assert.NotNull(createdResult);
short nctgyid = createdResult.Entity.ID;
Assert.Equal(hid, createdResult.Entity.HomeID);
Assert.Equal(ctgy.Name, createdResult.Entity.Name);
Assert.Equal(ctgy.Comment, createdResult.Entity.Comment);
// 3. Read it out
var getsingleresult = control.Get(nctgyid);
Assert.NotNull(getsingleresult);
var getctgy = Assert.IsType<FinanceDocumentType>(getsingleresult);
Assert.Equal(hid, getctgy.HomeID);
Assert.Equal(ctgy.Name, getctgy.Name);
Assert.Equal(ctgy.Comment, getctgy.Comment);
// 4. Change it
getctgy.Comment += "Changed";
var putresult = control.Put(nctgyid, getctgy);
Assert.NotNull(putresult);
// 5. Delete it
var deleteresult = control.Delete(nctgyid);
Assert.NotNull(deleteresult);
await context.DisposeAsync();
}
}
}
| alvachien/achihapi | test/hihapi.test/UnitTests/Finance/Config/FinanceDocumentTypesControllerTest.cs | C# | mit | 4,350 | [
30522,
2478,
2291,
1025,
2478,
15990,
3490,
2102,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
7632,
3270,
8197,
1012,
4275,
1025,
2478,
7632,
3270,
8197,
1012,
21257,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
2478,
7513,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |

OpenCloudEnvMonitor
===================
**开源个人环境监测平台**
##系统简介
系统框图请参考[这里](https://github.com/xiaogan-Studio/OpenCloudEnvMonitor/blob/master/Doc/design/%E7%B3%BB%E7%BB%9F%E6%A1%86%E5%9B%BE.xlsx)
(Tips:点击 View Raw 下载excel文件查看。或者感兴趣的话,可以clone下来整个项目再查看。各种资料请到Doc目录下查看.)


## 相关资源列表
[oneNote共享笔记](https://onedrive.live.com/edit.aspx/Knowledge/OpenCloudEnvMonitor?cid=be5c272d3ffda8af&id=documents?&),用于记录软硬件开发过程,包括各种问题的探讨资料。共享笔记,任何人均可编辑。其中:
- *envMonitor软件UML设计* 包含软件前期设计时一些分析资料。
- *硬件相关探讨* 与硬件相关的探讨。
### 硬件设计资源
[envMonitor MainBoard工程目录](./Doc/hardware/原理图),包含PDF版本的原理图以及AD工程文件
[envMonitor MainBoard原理图设计分析](./Doc/design/EnvMonitor原理图分析.docx),简单分析,等硬件稳定后会提供详细分析文档。
### 软件设计资源
| xiaogan-Studio/OpenCloudEnvMonitor | README.md | Markdown | gpl-2.0 | 1,320 | [
30522,
999,
1031,
1829,
100,
100,
100,
100,
1033,
1006,
1012,
1013,
9986,
1013,
24501,
1013,
8154,
1012,
1052,
3070,
1007,
2330,
20464,
19224,
2368,
2615,
8202,
15660,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict-local
*/
'use strict';
import type {Node} from 'React';
import {ActivityIndicator, StyleSheet, View} from 'react-native';
import React, {Component} from 'react';
type State = {|animating: boolean|};
type Props = $ReadOnly<{||}>;
type Timer = TimeoutID;
class ToggleAnimatingActivityIndicator extends Component<Props, State> {
_timer: Timer;
constructor(props: Props) {
super(props);
this.state = {
animating: true,
};
}
componentDidMount() {
this.setToggleTimeout();
}
componentWillUnmount() {
clearTimeout(this._timer);
}
setToggleTimeout() {
this._timer = setTimeout(() => {
this.setState({animating: !this.state.animating});
this.setToggleTimeout();
}, 2000);
}
render(): Node {
return (
<ActivityIndicator
animating={this.state.animating}
style={[styles.centering, {height: 80}]}
size="large"
/>
);
}
}
const styles = StyleSheet.create({
centering: {
alignItems: 'center',
justifyContent: 'center',
padding: 8,
},
gray: {
backgroundColor: '#cccccc',
},
horizontal: {
flexDirection: 'row',
justifyContent: 'space-around',
padding: 8,
},
});
exports.displayName = (undefined: ?string);
exports.category = 'UI';
exports.framework = 'React';
exports.title = 'ActivityIndicator';
exports.documentationURL = 'https://reactnative.dev/docs/activityindicator';
exports.description = 'Animated loading indicators.';
exports.examples = [
{
title: 'Default (small, white)',
render(): Node {
return (
<ActivityIndicator
style={[styles.centering, styles.gray]}
color="white"
/>
);
},
},
{
title: 'Gray',
render(): Node {
return (
<View>
<ActivityIndicator style={[styles.centering]} />
<ActivityIndicator style={[styles.centering, styles.gray]} />
</View>
);
},
},
{
title: 'Custom colors',
render(): Node {
return (
<View style={styles.horizontal}>
<ActivityIndicator color="#0000ff" />
<ActivityIndicator color="#aa00aa" />
<ActivityIndicator color="#aa3300" />
<ActivityIndicator color="#00aa00" />
</View>
);
},
},
{
title: 'Large',
render(): Node {
return (
<ActivityIndicator
style={[styles.centering, styles.gray]}
size="large"
color="white"
/>
);
},
},
{
title: 'Large, custom colors',
render(): Node {
return (
<View style={styles.horizontal}>
<ActivityIndicator size="large" color="#0000ff" />
<ActivityIndicator size="large" color="#aa00aa" />
<ActivityIndicator size="large" color="#aa3300" />
<ActivityIndicator size="large" color="#00aa00" />
</View>
);
},
},
{
title: 'Start/stop',
render(): Node {
return <ToggleAnimatingActivityIndicator />;
},
},
{
title: 'Custom size',
render(): Node {
return (
<ActivityIndicator
style={[styles.centering, {transform: [{scale: 1.5}]}]}
size="large"
/>
);
},
},
{
platform: 'android',
title: 'Custom size (size: 75)',
render(): Node {
return <ActivityIndicator style={styles.centering} size={75} />;
},
},
];
| hoangpham95/react-native | packages/rn-tester/js/examples/ActivityIndicator/ActivityIndicatorExample.js | JavaScript | bsd-3-clause | 3,613 | [
30522,
1013,
1008,
1008,
1008,
30524,
1012,
1998,
2049,
18460,
1012,
1008,
1008,
2023,
3120,
3642,
2003,
7000,
2104,
1996,
10210,
6105,
2179,
1999,
1996,
1008,
6105,
5371,
1999,
1996,
7117,
14176,
1997,
2023,
3120,
3392,
1012,
1008,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{% load i18n %}
<form class="login-form" action="/login/" method="post">
{% trans "Email" as username_str %}
{% trans "Password" as pwd_str %}
{% csrf_token %}
<h3 class="form-title">{% trans "Login" %}</h3>
{% if error %}
<div class="alert alert-danger">
<button class="close" data-close="alert"></button>
<span id="errorMsg">{{ error }}</span>
<span id="errorMsg2" style="display:none;"> {% trans "Enter any username and password." %} </span>
</div>
{% else %}
<div class="alert alert-danger display-hide">
<button class="close" data-close="alert"></button>
<span id="errorMsg"> {% trans "Enter any username and password." %} </span>
<span id="errorMsg2" style="display:none;"> {% trans "Enter any username and password." %} </span>
</div>
{% endif %}
<div class="form-group">
<!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
<label class="control-label visible-ie8 visible-ie9">{% trans "Username" %}</label>
<input class="form-control form-control-solid placeholder-no-fix" type="text" autocomplete="off"
placeholder="{{ username_str }}" name="username"/>
</div>
<div class="form-group">
<label class="control-label visible-ie8 visible-ie9">{% trans "Password" %}</label>
<input class="form-control form-control-solid placeholder-no-fix" type="password" autocomplete="off"
placeholder="{{ pwd_str }}" name="password"/>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-success uppercase"><i class="fa fa-key"></i> {% trans "Login" %}</button>
<!--a href="/find-password/" class="forget-password">{% trans 'Forgot Password' %}</a-->
</div>
<div class="create-account">
<!--p>
<a href="/signup/" class="uppercase">{% trans "Create an account" %}</a>
</p-->
</div>
</form>
| lyndonChen/eonboard | eoncloud_web/render/templates/partial_login_form.html | HTML | apache-2.0 | 1,976 | [
30522,
1063,
1003,
7170,
1045,
15136,
2078,
1003,
1065,
1026,
2433,
2465,
1027,
1000,
8833,
2378,
1011,
2433,
1000,
2895,
1027,
1000,
1013,
8833,
2378,
1013,
1000,
4118,
1027,
1000,
2695,
1000,
1028,
1063,
1003,
9099,
1000,
10373,
1000,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# XML Data Source for Apache Spark
[](https://travis-ci.org/databricks/spark-xml) [](http://codecov.io/github/databricks/spark-xml?branch=master)
- A library for parsing and querying XML data with Apache Spark, for Spark SQL and DataFrames.
The structure and test tools are mostly copied from [CSV Data Source for Spark](https://github.com/databricks/spark-csv).
- This package supports to process format-free XML files in a distributed way, unlike JSON datasource in Spark restricts in-line JSON format.
## Requirements
This library requires Spark 1.3+
## Linking
You can link against this library in your program at the following coordinates:
### Scala 2.10
```
groupId: com.databricks
artifactId: spark-xml_2.10
version: 0.3.3
```
### Scala 2.11
```
groupId: com.databricks
artifactId: spark-xml_2.11
version: 0.3.3
```
## Using with Spark shell
This package can be added to Spark using the `--packages` command line option. For example, to include it when starting the spark shell:
### Spark compiled with Scala 2.10
```
$SPARK_HOME/bin/spark-shell --packages com.databricks:spark-xml_2.10:0.3.3
```
### Spark compiled with Scala 2.11
```
$SPARK_HOME/bin/spark-shell --packages com.databricks:spark-xml_2.11:0.3.3
```
## Features
This package allows reading XML files in local or distributed filesystem as [Spark DataFrames](https://spark.apache.org/docs/1.6.0/sql-programming-guide.html).
When reading files the API accepts several options:
* `path`: Location of files. Similar to Spark can accept standard Hadoop globbing expressions.
* `rowTag`: The row tag of your xml files to treat as a row. For example, in this xml `<books> <book><book> ...</books>`, the appropriate value would be `book`. Default is `ROW`.
* `samplingRatio`: Sampling ratio for inferring schema (0.0 ~ 1). Default is 1. Possible types are `StructType`, `ArrayType`, `StringType`, `LongType`, `DoubleType`, `BooleanType`, `TimestampType` and `NullType`, unless user provides a schema for this.
* `excludeAttribute` : Whether you want to exclude attributes in elements or not. Default is false.
* `treatEmptyValuesAsNulls` : Whether you want to treat whitespaces as a null value. Default is false.
* `failFast` : Whether you want to fail when it fails to parse malformed rows in XML files, instead of dropping the rows. Default is false.
* `attributePrefix`: The prefix for attributes so that we can differentiate attributes and elements. This will be the prefix for field names. Default is `@`.
* `valueTag`: The tag used for the value when there are attributes in the element having no child. Default is `#VALUE`.
* `charset`: Defaults to 'UTF-8' but can be set to other valid charset names
When writing files the API accepts several options:
* `path`: Location to write files.
* `rowTag`: The row tag of your xml files to treat as a row. For example, in this xml `<books> <book><book> ...</books>`, the appropriate value would be `book`. Default is `ROW`.
* `rootTag`: The root tag of your xml files to treat as the root. For example, in this xml `<books> <book><book> ...</books>`, the appropriate value would be `books`. Default is `ROWS`.
* `nullValue`: The value to write `null` value. Default is string `null`. When this is `null`, it does not write attributes and elements for fields.
* `attributePrefix`: The prefix for attributes so that we can differentiating attributes and elements. This will be the prefix for field names. Default is `@`.
* `valueTag`: The tag used for the value when there are attributes in the element having no child. Default is `#VALUE`.
* `codec`: compression codec to use when saving to file. Should be the fully qualified name of a class implementing `org.apache.hadoop.io.compress.CompressionCodec` or one of case-insensitive shorten names (`bzip2`, `gzip`, `lz4`, and `snappy`). Defaults to no compression when a codec is not specified.
Currently it supports the shortened name usage. You can use just `xml` instead of `com.databricks.spark.xml` from Spark 1.5.0+
## Structure Conversion
Due to the structure differences between `DataFrame` and XML, there are some conversion rules from XML data to `DataFrame` and from `DataFrame` to XML data. Note that handling attributes can be disabled with the option `excludeAttribute`.
### Conversion from XML to `DataFrame`
- __Attributes__: Attributes are converted as fields with the heading prefix, `attributePrefix`.
```xml
...
<one myOneAttrib="AAAA">
<two>two</two>
<three>three</three>
</one>
...
```
produces a schema below:
```
root
|-- @myOneAttrib: string (nullable = true)
|-- two: string (nullable = true)
|-- three: string (nullable = true)
```
- __Value in an element that has no child elements but attributes__: The value is put in a separate field, `valueTag`.
```xml
...
<one>
<two myTwoAttrib="BBBBB">two</two>
<three>three</three>
</one>
...
```
produces a schema below:
```
root
|-- two: struct (nullable = true)
| |-- #VALUE: string (nullable = true)
| |-- @myTwoAttrib: string (nullable = true)
|-- three: string (nullable = true)
```
### Conversion from `DataFrame` to XML
- __Element as an array in an array__: Writing a XML file from `DataFrame` having a field `ArrayType` with its element as `ArrayType` would have an additional nested field for the element. This would not happen in reading and writing XML data but writing a `DataFrame` read from other sources. Therefore, roundtrip in reading and writing XML files has the same structure but writing a `DataFrame` read from other sources is possible to have a different structure.
`DataFrame` with a schema below:
```
|-- a: array (nullable = true)
| |-- element: array (containsNull = true)
| | |-- element: string (containsNull = true)
```
with data below:
```
+------------------------------------+
| a|
+------------------------------------+
|[WrappedArray(aa), WrappedArray(bb)]|
+------------------------------------+
```
produces a XML file below:
```xml
...
<a>
<item>aa</item>
</a>
<a>
<item>bb</item>
</a>
...
```
## Examples
These examples use a XML file available for download [here](https://github.com/databricks/spark-xml/raw/master/src/test/resources/books.xml):
```
$ wget https://github.com/databricks/spark-xml/raw/master/src/test/resources/books.xml
```
### SQL API
XML data source for Spark can infer data types:
```sql
CREATE TABLE books
USING com.databricks.spark.xml
OPTIONS (path "books.xml", rowTag "book")
```
You can also specify column names and types in DDL. In this case, we do not infer schema.
```sql
CREATE TABLE books (author string, description string, genre string, @id string, price double, publish_date string, title string)
USING com.databricks.spark.xml
OPTIONS (path "books.xml", rowTag "book")
```
### Scala API
__Spark 1.4+:__
```scala
import org.apache.spark.sql.SQLContext
val sqlContext = new SQLContext(sc)
val df = sqlContext.read
.format("com.databricks.spark.xml")
.option("rowTag", "book")
.load("books.xml")
val selectedData = df.select("author", "@id")
selectedData.write
.format("com.databricks.spark.xml")
.option("rootTag", "books")
.option("rowTag", "book")
.save("newbooks.xml")
```
You can manually specify the schema when reading data:
```scala
import org.apache.spark.sql.SQLContext
import org.apache.spark.sql.types.{StructType, StructField, StringType, DoubleType};
val sqlContext = new SQLContext(sc)
val customSchema = StructType(Array(
StructField("@id", StringType, nullable = true),
StructField("author", StringType, nullable = true),
StructField("description", StringType, nullable = true),
StructField("genre", StringType ,nullable = true),
StructField("price", DoubleType, nullable = true),
StructField("publish_date", StringType, nullable = true),
StructField("title", StringType, nullable = true)))
val df = sqlContext.read
.format("com.databricks.spark.xml")
.option("rowTag", "book")
.schema(customSchema)
.load("books.xml")
val selectedData = df.select("author", "@id")
selectedData.write
.format("com.databricks.spark.xml")
.option("rootTag", "books")
.option("rowTag", "book")
.save("newbooks.xml")
```
__Spark 1.3:__
```scala
import org.apache.spark.sql.SQLContext
val sqlContext = new SQLContext(sc)
val df = sqlContext.load(
"com.databricks.spark.xml",
Map("path" -> "books.xml", "rowTag" -> "book"))
val selectedData = df.select("author", "@id")
selectedData.save("com.databricks.spark.xml",
SaveMode.ErrorIfExists,
Map("path" -> "newbooks.xml", "rootTag" -> "books", "rowTag" -> "book"))
```
You can manually specify the schema when reading data:
```scala
import org.apache.spark.sql.SQLContext
import org.apache.spark.sql.types.{StructType, StructField, StringType, IntegerType};
val sqlContext = new SQLContext(sc)
val customSchema = StructType(Array(
StructField("@id", StringType, nullable = true),
StructField("author", StringType, nullable = true),
StructField("description", StringType, nullable = true),
StructField("genre", StringType ,nullable = true),
StructField("price", DoubleType, nullable = true),
StructField("publish_date", StringType, nullable = true),
StructField("title", StringType, nullable = true)))
val df = sqlContext.load(
"com.databricks.spark.xml",
schema = customSchema,
Map("path" -> "books.xml", "rowTag" -> "book"))
val selectedData = df.select("author", "@id")
selectedData.save("com.databricks.spark.xml",
SaveMode.ErrorIfExists,
Map("path" -> "newbooks.xml", "rootTag" -> "books", "rowTag" -> "book"))
```
### Java API
__Spark 1.4+:__
```java
import org.apache.spark.sql.SQLContext
SQLContext sqlContext = new SQLContext(sc);
DataFrame df = sqlContext.read()
.format("com.databricks.spark.xml")
.option("rowTag", "book")
.load("books.xml");
df.select("author", "@id").write()
.format("com.databricks.spark.xml")
.option("rootTag", "books")
.option("rowTag", "book")
.save("newbooks.xml");
```
You can manually specify schema:
```java
import org.apache.spark.sql.SQLContext;
import org.apache.spark.sql.types.*;
SQLContext sqlContext = new SQLContext(sc);
StructType customSchema = new StructType(new StructField[] {
new StructField("@id", DataTypes.StringType, true, Metadata.empty()),
new StructField("author", DataTypes.StringType, true, Metadata.empty()),
new StructField("description", DataTypes.StringType, true, Metadata.empty()),
new StructField("genre", DataTypes.StringType, true, Metadata.empty()),
new StructField("price", DataTypes.DoubleType, true, Metadata.empty()),
new StructField("publish_date", DataTypes.StringType, true, Metadata.empty()),
new StructField("title", DataTypes.StringType, true, Metadata.empty())
});
DataFrame df = sqlContext.read()
.format("com.databricks.spark.xml")
.option("rowTag", "book")
.schema(customSchema)
.load("books.xml");
df.select("author", "@id").write()
.format("com.databricks.spark.xml")
.option("rootTag", "books")
.option("rowTag", "book")
.save("newbooks.xml");
```
__Spark 1.3:__
```java
import org.apache.spark.sql.SQLContext
SQLContext sqlContext = new SQLContext(sc);
HashMap<String, String> options = new HashMap<String, String>();
options.put("rowTag", "book");
options.put("path", "books.xml");
DataFrame df = sqlContext.load("com.databricks.spark.xml", options);
HashMap<String, String> options = new HashMap<String, String>();
options.put("rowTag", "book");
options.put("rootTag", "books");
options.put("path", "newbooks.xml");
df.select("author", "@id").save("com.databricks.spark.xml", SaveMode.ErrorIfExists, options)
```
You can manually specify schema:
```java
import org.apache.spark.sql.SQLContext;
import org.apache.spark.sql.types.*;
SQLContext sqlContext = new SQLContext(sc);
StructType customSchema = new StructType(new StructField[] {
new StructField("@id", DataTypes.StringType, true, Metadata.empty()),
new StructField("author", DataTypes.StringType, true, Metadata.empty()),
new StructField("description", DataTypes.StringType, true, Metadata.empty()),
new StructField("genre", DataTypes.StringType, true, Metadata.empty()),
new StructField("price", DataTypes.DoubleType, true, Metadata.empty()),
new StructField("publish_date", DataTypes.StringType, true, Metadata.empty()),
new StructField("title", DataTypes.StringType, true, Metadata.empty())
});
HashMap<String, String> options = new HashMap<String, String>();
options.put("rowTag", "book");
options.put("path", "books.xml");
DataFrame df = sqlContext.load("com.databricks.spark.xml", customSchema, options);
HashMap<String, String> options = new HashMap<String, String>();
options.put("rowTag", "book");
options.put("rootTag", "books");
options.put("path", "newbooks.xml");
df.select("author", "@id").save("com.databricks.spark.xml", SaveMode.ErrorIfExists, options)
```
### Python API
__Spark 1.4+:__
```python
from pyspark.sql import SQLContext
sqlContext = SQLContext(sc)
df = sqlContext.read.format('com.databricks.spark.xml').options(rowTag='book').load('books.xml')
df.select("author", "@id").write \
.format('com.databricks.spark.xml') \
.options(rowTag='book', rootTag='books') \
.save('newbooks.xml')
```
You can manually specify schema:
```python
from pyspark.sql import SQLContext
from pyspark.sql.types import *
sqlContext = SQLContext(sc)
customSchema = StructType([ \
StructField("@id", StringType(), True), \
StructField("author", StringType(), True), \
StructField("description", StringType(), True), \
StructField("genre", StringType(), True), \
StructField("price", DoubleType(), True), \
StructField("publish_date", StringType(), True), \
StructField("title", StringType(), True)])
df = sqlContext.read \
.format('com.databricks.spark.xml') \
.options(rowTag='book') \
.load('books.xml', schema = customSchema)
df.select("author", "@id").write \
.format('com.databricks.spark.xml') \
.options(rowTag='book', rootTag='books') \
.save('newbooks.xml')
```
__Spark 1.3:__
```python
from pyspark.sql import SQLContext
sqlContext = SQLContext(sc)
df = sqlContext.load(source="com.databricks.spark.xml", rowTag = 'book', path = 'books.xml')
df.select("author", "@id").save('newbooks.xml', rootTag = 'books', rowTag = 'book', path = 'newbooks.xml')
```
You can manually specify schema:
```python
from pyspark.sql import SQLContext
from pyspark.sql.types import *
sqlContext = SQLContext(sc)
customSchema = StructType([ \
StructField("@id", StringType(), True), \
StructField("author", StringType(), True), \
StructField("description", StringType(), True), \
StructField("genre", StringType(), True), \
StructField("price", DoubleType(), True), \
StructField("publish_date", StringType(), True), \
StructField("title", StringType(), True)])
df = sqlContext.load(source="com.databricks.spark.xml", rowTag = 'book', schema = customSchema, path = 'books.xml')
df.select("author", "@id").save('newbooks.xml', rootTag = 'books', rowTag = 'book', path = 'newbooks.xml')
```
### R API
__Spark 1.4+:__
Automatically infer schema (data types)
```R
library(SparkR)
Sys.setenv('SPARKR_SUBMIT_ARGS'='"--packages" "com.databricks:spark-xml_2.10:0.3.3" "sparkr-shell"')
sqlContext <- sparkRSQL.init(sc)
df <- read.df(sqlContext, "books.xml", source = "com.databricks.spark.xml", rowTag = "book")
# In this case, `rootTag` is set to "ROWS" and `rowTag` is set to "ROW".
write.df(df, "newbooks.csv", "com.databricks.spark.xml", "overwrite")
```
You can manually specify schema:
```R
library(SparkR)
Sys.setenv('SPARKR_SUBMIT_ARGS'='"--packages" "com.databricks:spark-csv_2.10:0.3.3" "sparkr-shell"')
sqlContext <- sparkRSQL.init(sc)
customSchema <- structType(
structField("@id", "string"),
structField("author", "string"),
structField("description", "string"),
structField("genre", "string"),
structField("price", "double"),
structField("publish_date", "string"),
structField("title", "string"))
df <- read.df(sqlContext, "books.xml", source = "com.databricks.spark.xml", rowTag = "book")
# In this case, `rootTag` is set to "ROWS" and `rowTag` is set to "ROW".
write.df(df, "newbooks.csv", "com.databricks.spark.xml", "overwrite")
```
## Hadoop InputFormat
The library contains a Hadoop input format for reading XML files by a start tag and an end tag. This is similar with [XmlInputFormat.java](https://github.com/apache/mahout/blob/9d14053c80a1244bdf7157ab02748a492ae9868a/integration/src/main/java/org/apache/mahout/text/wikipedia/XmlInputFormat.java) in [Mahout](http://mahout.apache.org) but supports to read compressed files, different encodings and read elements including attributes,
which you may make direct use of as follows:
```scala
import com.databricks.spark.xml.XmlInputFormat
// This will detect the tags including attributes
sc.hadoopConfiguration.set(XmlInputFormat.START_TAG_KEY, "<book>")
sc.hadoopConfiguration.set(XmlInputFormat.END_TAG_KEY, "</book>")
sc.hadoopConfiguration.set(XmlInputFormat.ENCODING_KEY, "utf-8")
val records = sc.newAPIHadoopFile(
path,
classOf[XmlInputFormat],
classOf[LongWritable],
classOf[Text])
```
## Building From Source
This library is built with [SBT](http://www.scala-sbt.org/0.13/docs/Command-Line-Reference.html), which is automatically downloaded by the included shell script. To build a JAR file simply run `sbt/sbt package` from the project root. The build configuration includes support for both Scala 2.10 and 2.11.
## Acknowledgements
This project was initially created by [HyukjinKwon](https://github.com/HyukjinKwon) and donated to [Databricks](https://databricks.com).
| lokm01/spark-xml | README.md | Markdown | apache-2.0 | 18,194 | [
30522,
1001,
20950,
2951,
3120,
2005,
15895,
12125,
1031,
999,
1031,
3857,
3570,
1033,
1006,
16770,
1024,
1013,
1013,
10001,
1011,
25022,
1012,
8917,
1013,
2951,
25646,
2015,
1013,
12125,
1011,
20950,
1012,
17917,
2290,
1029,
3589,
1027,
30... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from __future__ import unicode_literals
from django.utils import six
import pytest
from nicedjango.utils.compact_csv import CsvReader
@pytest.fixture
def stream():
csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8')
return six.StringIO(csv)
def test_reader_raw(stream):
r = CsvReader(stream, replacements=(), preserve_quotes=True, symbols=(),
replace_digits=False)
assert list(r) == [['''"a\x96b\\"c'd\\re\\nf,g\\\\"''', '1', 'NULL', '""']]
def test_reader_none(stream):
r = CsvReader(stream, replacements=(), preserve_quotes=True,
replace_digits=False)
assert list(r) == [['''"a\x96b\\"c'd\\re\\nf,g\\\\"''', '1', None, '""']]
def test_reader_quotes(stream):
r = CsvReader(stream, replacements=(), replace_digits=False)
assert list(r) == [['''a\x96b\\"c'd\\re\\nf,g\\\\''', '1', None, '']]
def test_reader_replace(stream):
r = CsvReader(stream, replace_digits=False)
assert list(r) == [['''a\x96b"c'd\re\nf,g\\''', '1', None, '']]
def test_reader_replace_digit(stream):
r = CsvReader(stream)
assert list(r) == [['''a\x96b"c'd\re\nf,g\\''', 1, None, '']]
| katakumpo/nicedjango | tests/test_compact_csv_reader.py | Python | mit | 1,175 | [
30522,
2013,
1035,
1035,
2925,
1035,
1035,
12324,
27260,
1035,
18204,
2015,
2013,
6520,
23422,
1012,
21183,
12146,
12324,
2416,
12324,
1052,
17250,
3367,
2013,
3835,
2094,
8405,
3995,
1012,
21183,
12146,
1012,
9233,
1035,
20116,
2615,
12324,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'bipbip'
require 'bipbip/plugin/memcached'
describe Bipbip::Plugin::Memcached do
let(:plugin) { Bipbip::Plugin::Memcached.new('memcached', { 'hostname' => 'localhost', 'port' => 11_211 }, 10) }
it 'should collect data' do
data = plugin.monitor
data['cmd_get'].should be_instance_of(Fixnum)
data['cmd_set'].should be_instance_of(Fixnum)
data['get_misses'].should be_instance_of(Fixnum)
data['bytes'].should be_instance_of(Fixnum)
data['evictions'].should be_instance_of(Fixnum)
end
end
| ppp0/bipbip | spec/bipbip/plugin/memcached_spec.rb | Ruby | mit | 526 | [
30522,
5478,
1005,
12170,
2361,
5638,
2361,
1005,
5478,
1005,
12170,
2361,
5638,
2361,
1013,
13354,
2378,
1013,
2033,
12458,
15395,
2094,
1005,
6235,
12170,
2361,
5638,
2361,
1024,
1024,
13354,
2378,
1024,
1024,
2033,
12458,
15395,
2094,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.comps.util;
import com.google.gson.Gson;
public class GsonManager {
private static Gson instance;
public static Gson getInstance(){
if (instance == null){
instance = new Gson();
}
return instance;
}
}
| diogocs1/comps | mobile/src/com/comps/util/GsonManager.java | Java | apache-2.0 | 231 | [
30522,
7427,
4012,
1012,
4012,
4523,
1012,
21183,
4014,
1025,
12324,
4012,
1012,
8224,
1012,
28177,
2239,
1012,
28177,
2239,
1025,
2270,
2465,
28177,
2239,
24805,
4590,
1063,
2797,
10763,
28177,
2239,
6013,
1025,
2270,
10763,
28177,
2239,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2018 Google LLC
//
// 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
//
// https://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.
// Simple tool to convert the text proto leap_table.pb to other formats.
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <cstring>
#include <string>
#include <vector>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/io/zero_copy_stream_impl.h"
#include "google/protobuf/text_format.h"
#include "google/protobuf/util/json_util.h"
#include "unsmear/leap_table.pb.h"
#include "unsmear/unsmear.h"
namespace {
constexpr char kUsage[] = "Usage: leap_table_tool FILENAME\n";
enum class Format { kProto, kTextProto, kJson, kDebug };
} // namespace
ABSL_FLAG(Format, input, Format::kTextProto, "input format");
ABSL_FLAG(Format, output, Format::kProto, "output format");
namespace {
bool AbslParseFlag(absl::string_view text, Format* format, std::string* error) {
if (text == "proto") {
*format = Format::kProto;
return true;
}
if (text == "textproto") {
*format = Format::kTextProto;
return true;
}
if (text == "json") {
*format = Format::kJson;
return true;
}
if (text == "debug") {
*format = Format::kDebug;
return true;
}
*error = "unknown format; must be proto, textproto, json, or debug";
return false;
}
std::string AbslUnparseFlag(Format format) {
switch (format) {
case Format::kProto:
return "proto";
case Format::kTextProto:
return "textproto";
case Format::kJson:
return "json";
case Format::kDebug:
return "debug";
}
return absl::StrCat(format);
}
bool OutputProto(const unsmear::LeapTableProto& pb) {
return pb.SerializeToFileDescriptor(STDOUT_FILENO);
}
bool OutputTextProto(const unsmear::LeapTableProto& pb) {
auto stream =
absl::make_unique<google::protobuf::io::FileOutputStream>(STDOUT_FILENO);
if (!google::protobuf::TextFormat::Print(pb, stream.get())) {
return false;
}
if (!stream->Close()) {
return false;
}
return true;
}
bool OutputJson(const unsmear::LeapTableProto& pb) {
std::string s;
google::protobuf::util::JsonOptions opts;
if (!google::protobuf::util::MessageToJsonString(pb, &s, opts).ok()) {
return false;
}
std::cout << s;
return true;
}
bool OutputDebug(const unsmear::LeapTableProto& pb) {
auto lt = unsmear::NewLeapTableFromProto(pb);
if (lt == nullptr) {
std::cerr << "Failed to construct leap table from proto\n";
return false;
}
std::cout << lt->DebugString();
return true;
}
} // namespace
int main(int argc, char** argv) {
std::vector<char*> args = absl::ParseCommandLine(argc, argv);
if (args.size() != 2) {
std::cerr << kUsage;
return 2;
}
const auto& filename = args[1];
unsmear::LeapTableProto pb;
int fd = open(filename, O_RDONLY);
if (fd < 0) {
std::cerr << "Couldn't open " << filename << ": " << strerror(errno)
<< "\n";
return 1;
}
switch (absl::GetFlag(FLAGS_input)) {
case Format::kProto:
if (!pb.ParseFromFileDescriptor(fd)) {
std::cerr << "Couldn't parse proto from " << filename << "\n";
return 1;
}
break;
case Format::kTextProto: {
google::protobuf::io::FileInputStream stream(fd);
if (!google::protobuf::TextFormat::Parse(&stream, &pb)) {
std::cerr << "Couldn't parse text proto from " << filename << "\n";
return 1;
}
break;
}
case Format::kJson:
case Format::kDebug:
std::cerr << "Unsupported --input\n";
return 2;
}
switch (absl::GetFlag(FLAGS_output)) {
case Format::kProto:
return OutputProto(pb) ? 0 : 1;
case Format::kTextProto:
return OutputTextProto(pb) ? 0 : 1;
case Format::kJson:
return OutputJson(pb) ? 0 : 1;
case Format::kDebug:
return OutputDebug(pb) ? 0 : 1;
}
}
| google/unsmear | leap_table/leap_table_tool.cc | C++ | apache-2.0 | 4,477 | [
30522,
1013,
1013,
9385,
2760,
8224,
11775,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1013,
1013,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_45) on Fri Dec 27 12:53:06 CST 2013 -->
<title>Uses of Class org.apache.cassandra.streaming.messages.FileMessageHeader (apache-cassandra API)</title>
<meta name="date" content="2013-12-27">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.cassandra.streaming.messages.FileMessageHeader (apache-cassandra API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../overview-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?org/apache/cassandra/streaming/messages/class-use/FileMessageHeader.html" target="_top">Frames</a></li>
<li><a href="FileMessageHeader.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.cassandra.streaming.messages.FileMessageHeader" class="title">Uses of Class<br>org.apache.cassandra.streaming.messages.FileMessageHeader</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.apache.cassandra.streaming">org.apache.cassandra.streaming</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#org.apache.cassandra.streaming.compress">org.apache.cassandra.streaming.compress</a></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="#org.apache.cassandra.streaming.messages">org.apache.cassandra.streaming.messages</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.apache.cassandra.streaming">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a> in <a href="../../../../../../org/apache/cassandra/streaming/package-summary.html">org.apache.cassandra.streaming</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../org/apache/cassandra/streaming/package-summary.html">org.apache.cassandra.streaming</a> with parameters of type <a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><span class="strong">StreamSession.</span><code><strong><a href="../../../../../../org/apache/cassandra/streaming/StreamSession.html#doRetry(org.apache.cassandra.streaming.messages.FileMessageHeader, java.lang.Throwable)">doRetry</a></strong>(<a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a> header,
java.lang.Throwable e)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><span class="strong">StreamSession.</span><code><strong><a href="../../../../../../org/apache/cassandra/streaming/StreamSession.html#fileSent(org.apache.cassandra.streaming.messages.FileMessageHeader)">fileSent</a></strong>(<a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a> header)</code>
<div class="block">Call back after sending FileMessageHeader.</div>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructors in <a href="../../../../../../org/apache/cassandra/streaming/package-summary.html">org.apache.cassandra.streaming</a> with parameters of type <a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colLast"><code><strong><a href="../../../../../../org/apache/cassandra/streaming/StreamReader.html#StreamReader(org.apache.cassandra.streaming.messages.FileMessageHeader, org.apache.cassandra.streaming.StreamSession)">StreamReader</a></strong>(<a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a> header,
<a href="../../../../../../org/apache/cassandra/streaming/StreamSession.html" title="class in org.apache.cassandra.streaming">StreamSession</a> session)</code> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.apache.cassandra.streaming.compress">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a> in <a href="../../../../../../org/apache/cassandra/streaming/compress/package-summary.html">org.apache.cassandra.streaming.compress</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructors in <a href="../../../../../../org/apache/cassandra/streaming/compress/package-summary.html">org.apache.cassandra.streaming.compress</a> with parameters of type <a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colLast"><code><strong><a href="../../../../../../org/apache/cassandra/streaming/compress/CompressedStreamReader.html#CompressedStreamReader(org.apache.cassandra.streaming.messages.FileMessageHeader, org.apache.cassandra.streaming.StreamSession)">CompressedStreamReader</a></strong>(<a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a> header,
<a href="../../../../../../org/apache/cassandra/streaming/StreamSession.html" title="class in org.apache.cassandra.streaming">StreamSession</a> session)</code> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.apache.cassandra.streaming.messages">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a> in <a href="../../../../../../org/apache/cassandra/streaming/messages/package-summary.html">org.apache.cassandra.streaming.messages</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation">
<caption><span>Fields in <a href="../../../../../../org/apache/cassandra/streaming/messages/package-summary.html">org.apache.cassandra.streaming.messages</a> declared as <a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a></code></td>
<td class="colLast"><span class="strong">FileMessage.</span><code><strong><a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessage.html#header">header</a></strong></code> </td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation">
<caption><span>Fields in <a href="../../../../../../org/apache/cassandra/streaming/messages/package-summary.html">org.apache.cassandra.streaming.messages</a> with type parameters of type <a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../../org/apache/cassandra/io/IVersionedSerializer.html" title="interface in org.apache.cassandra.io">IVersionedSerializer</a><<a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a>></code></td>
<td class="colLast"><span class="strong">FileMessageHeader.</span><code><strong><a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html#serializer">serializer</a></strong></code> </td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructors in <a href="../../../../../../org/apache/cassandra/streaming/messages/package-summary.html">org.apache.cassandra.streaming.messages</a> with parameters of type <a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colLast"><code><strong><a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessage.html#FileMessage(org.apache.cassandra.io.sstable.SSTableReader, org.apache.cassandra.streaming.messages.FileMessageHeader)">FileMessage</a></strong>(<a href="../../../../../../org/apache/cassandra/io/sstable/SSTableReader.html" title="class in org.apache.cassandra.io.sstable">SSTableReader</a> sstable,
<a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">FileMessageHeader</a> header)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/cassandra/streaming/messages/FileMessageHeader.html" title="class in org.apache.cassandra.streaming.messages">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../overview-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?org/apache/cassandra/streaming/messages/class-use/FileMessageHeader.html" target="_top">Frames</a></li>
<li><a href="FileMessageHeader.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 © 2013 The Apache Software Foundation</small></p>
</body>
</html>
| bkcloud/bkplatform | cassandra-scripts/javadoc/org/apache/cassandra/streaming/messages/class-use/FileMessageHeader.html | HTML | mpl-2.0 | 14,912 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Template Name: About Page
*
* Description: Twenty Twelve loves the no-sidebar look as much as
* you do. Use this page template to remove the sidebar from any page.
*
* Tip: to remove the sidebar from all posts and pages simply remove
* any active widgets from the Main Sidebar area, and the sidebar will
* disappear everywhere.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header();
?>
<div id="primary" class="site-content">
<div id="content" role="main">
<?php
while ( have_posts() ) : the_post();
$aboutPageCustomFields = get_post_custom();
?>
<?php get_template_part( 'content', 'page' ); ?>
<?php if( isset($aboutPageCustomFields['intro']) ) : ?>
<div id="tagline">
<?php echo $aboutPageCustomFields['intro'][0]; ?>
</div>
<?php endif; ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<div id="latest-blog-post">
<h2>Latest Blog Post</h2>
<?php
$args = array('numberposts' => '1');
$latestPosts = wp_get_recent_posts($args);
foreach( $latestPosts as $latestPost ):
?>
<a href="<?php echo get_permalink($latestPost["ID"]); ?>" title="<?php echo esc_attr($latestPost["post_title"]); ?>">
<?php echo $latestPost["post_title"]; ?>
</a>
<?php endforeach; ?>
</div>
<div class="on-tour-widget">
</div>
<p>LINK TO WRITING SITE
<?php get_template_part( 'content', 'twitter' ); ?>
<?php get_footer(); ?> | irabronson/atom | wp-content/themes/atom/page-templates/about-page.php | PHP | gpl-2.0 | 1,512 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
23561,
2171,
1024,
2055,
3931,
1008,
1008,
6412,
1024,
3174,
4376,
7459,
1996,
2053,
1011,
2217,
8237,
2298,
2004,
2172,
2004,
1008,
2017,
2079,
1012,
2224,
2023,
3931,
23561,
2000,
6366,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="de">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta name="referrer" content="no-referrer">
<title><?php wp_title(' - ', true, 'right'); ?> <?php bloginfo('name'); ?></title>
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_head(); ?>
</head>
<body class="custom-background">
| BK-bund/kaakeli | header-without-logo.php | PHP | apache-2.0 | 571 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
2139,
1000,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
1060,
1011,
25423,
1011,
11892,
1000,
4180,
1027,
1000,
29464,
1027,
3341,
1000,
1028,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.djlead.leadmod.blocks;
import com.djlead.leadmod.Reference;
import com.djlead.leadmod.sys.LogOut;
import com.djlead.leadmod.sys.MyBlocks;
import com.djlead.leadmod.sys.MyTab;
import com.sun.scenario.effect.Crop;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.Random;
/**
* Created by Lead on 5-10-2015.
*/
public class WhishSoil extends BaseBlock {
@SideOnly(Side.CLIENT)
private IIcon field_149824_a;
@SideOnly(Side.CLIENT)
private IIcon field_149823_b;
private static final String __OBFID = "CL_00000241";
public WhishSoil(){
super(Material.ground);
this.setTickRandomly(true);
// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
// this.setLightOpacity(255);
this.setBlockTextureName("whishsoil");
this.setBlockName("whishsoil");
this.setHardness(1.0F);
this.setResistance(2.0F);
this.setHarvestLevel("shovel", 1);
this.setCreativeTab(MyTab.CreaTab);
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
// public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_){
// return AxisAlignedBB.getBoundingBox((double)(p_149668_2_ + 0), (double)(p_149668_3_ + 0), (double)(p_149668_4_ + 0), (double)(p_149668_2_ + 1), (double)(p_149668_3_ + 1), (double)(p_149668_4_ + 1));
// }
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* Gets the block's texture. Args: side, meta
*/
@SideOnly(Side.CLIENT)
public IIcon getIcon(int p_149691_1_, int p_149691_2_){
return p_149691_1_ == 1 ? (p_149691_2_ > 0 ? this.field_149824_a : this.field_149823_b) : Blocks.dirt.getBlockTextureFromSide(p_149691_1_);
}
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World world, int posX, int posY, int posZ, Random random) {
Block block = world.getBlock(posX, posY, posZ);
if(block.getTickRandomly()){
block.updateTick(world, posX, posY + 1, posZ, random);
}
if (!this.func_149821_m(world, posX, posY, posZ) && !world.canLightningStrikeAt(posX, posY + 1, posZ)){
int l = world.getBlockMetadata(posX, posY, posZ);
if (l > 0){
world.setBlockMetadataWithNotify(posX, posY, posZ, l - 1, 2);
}else if (!this.func_149822_e(world, posX, posY, posZ)) {
// if no water around, change block in dirt
// world.setBlock(posX, posY, posZ, Blocks.dirt);
}
} else{
world.setBlockMetadataWithNotify(posX, posY, posZ, 7, 2);
}
}
/**
* Block's chance to react to an entity falling on it.
*/
// public void onFallenUpon(World p_149746_1_, int p_149746_2_, int p_149746_3_, int p_149746_4_, Entity p_149746_5_, float p_149746_6_){
// if (!p_149746_1_.isRemote && p_149746_1_.rand.nextFloat() < p_149746_6_ - 0.5F)
// {
// if (!(p_149746_5_ instanceof EntityPlayer) && !p_149746_1_.getGameRules().getGameRuleBooleanValue("mobGriefing"))
// {
// return;
// }
//
// // p_149746_1_.setBlock(p_149746_2_, p_149746_3_, p_149746_4_, Blocks.dirt);
// }
// }
private boolean func_149822_e(World p_149822_1_, int p_149822_2_, int p_149822_3_, int p_149822_4_){
byte b0 = 0;
for (int l = p_149822_2_ - b0; l <= p_149822_2_ + b0; ++l){
for (int i1 = p_149822_4_ - b0; i1 <= p_149822_4_ + b0; ++i1){
Block block = p_149822_1_.getBlock(l, p_149822_3_ + 1, i1);
if (block instanceof IPlantable && canSustainPlant(p_149822_1_, p_149822_2_, p_149822_3_, p_149822_4_, ForgeDirection.UP, (IPlantable)block)){
return true;
}
}
}
return false;
}
private boolean func_149821_m(World world, int posX, int posY, int posZ) {
for (int l = posX - 4; l <= posX + 4; ++l) {
for (int i1 = posY; i1 <= posY + 1; ++i1){
for (int j1 = posZ - 4; j1 <= posZ + 4; ++j1) {
if (world.getBlock(l, i1, j1).getMaterial() == Material.water){
return true;
}
}
}
}
return false;
// return true; // always act like water in area
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor Block
*/
public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block block){
// replace farmland with dirt when a solid block placed on top
super.onNeighborBlockChange(world, posX, posY, posZ, block);
Material material = world.getBlock(posX, posY + 1, posZ).getMaterial();
if (material.isSolid()){
// world.setBlock(posX, posY, posZ, Blocks.dirt);
}
}
public Item getItemDropped(int p_149650_1_, Random random, int p_149650_3_){
return MyBlocks.whishSoil.getItemDropped(0, random, p_149650_3_);
}
/**
* Gets an item for the block being called on. Args: world, x, y, z
*/
@SideOnly(Side.CLIENT)
public Item getItem(World world, int posX, int posY, int posZ)
{
return Item.getItemFromBlock(MyBlocks.whishSoil);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.field_149824_a = icon.registerIcon(Reference.MODID + ":" + this.getTextureName());
this.field_149823_b = icon.registerIcon(Reference.MODID + ":" + this.getTextureName()); // top part
}
////////////////////////////////////
// Sligthly more fertile than dirt, like tilled dirt near water
@Override
public boolean isFertile(World world, int posX, int posY, int posZ){
return true;
}
// better soil : all plans grow directly on it, no tilling required
@Override
public boolean canSustainPlant(IBlockAccess world, int posX, int posY, int posZ, ForgeDirection direction, IPlantable plantable) {
Block plant = plantable.getPlant(world, posX, posY + 1, posZ);
EnumPlantType plantType = plantable.getPlantType(world, posX, posY + 1, posZ);
/////
// switch (plantType) {
// case Crop:
// return true;
// default:
// return super.canSustainPlant(world, posX, posY, posZ, direction, plantable);
return true; // otherwise seed gets popped out
//
// }
}
}
| djLead/modelead | src/java/com/djlead/leadmod/blocks/WhishSoil.java | Java | gpl-2.0 | 7,746 | [
30522,
7427,
4012,
1012,
6520,
19738,
2094,
1012,
2599,
5302,
2094,
1012,
5991,
1025,
12324,
4012,
1012,
6520,
19738,
2094,
1012,
2599,
5302,
2094,
1012,
4431,
1025,
12324,
4012,
1012,
6520,
19738,
2094,
1012,
2599,
5302,
2094,
1012,
25353,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Ember.Handlebars.helper('headTitle', function(title) {
Ember.$('head').find('title').text(title);
}, 'title'); | therabble/yahara | app/helpers/head-title.js | JavaScript | gpl-3.0 | 112 | [
30522,
7861,
5677,
1012,
5047,
8237,
2015,
1012,
2393,
2121,
1006,
1005,
2132,
3775,
9286,
1005,
1010,
3853,
1006,
2516,
1007,
1063,
7861,
5677,
1012,
1002,
1006,
1005,
2132,
1005,
1007,
1012,
2424,
1006,
1005,
2516,
1005,
1007,
1012,
379... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Cms\Dao\Import;
use Cms\Dao\Import as Dao;
use Cms\Dao\Doctrine as DoctrineBase;
/**
* Doctrine Dao für den Import
*
* @package Cms
* @subpackage Dao
*/
class Doctrine extends DoctrineBase implements Dao
{
}
| rukzuk/rukzuk | app/server/library/Cms/Dao/Import/Doctrine.php | PHP | gpl-3.0 | 242 | [
30522,
1026,
1029,
25718,
3415,
15327,
4642,
2015,
1032,
4830,
2080,
1032,
12324,
1025,
2224,
4642,
2015,
1032,
4830,
2080,
1032,
12324,
2004,
4830,
2080,
1025,
2224,
4642,
2015,
1032,
4830,
2080,
1032,
8998,
2004,
8998,
15058,
1025,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* Fields and groups functions
*
* $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/fields.php $
* $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
* $LastChangedRevision: 1027712 $
* $LastChangedBy: iworks $
*
*/
require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
/**
* Gets post_types supported by specific group.
*
* @global type $wpdb
* @param type $group_id
* @return type
*/
function wpcf_admin_get_post_types_by_group( $group_id ) {
$post_types = get_post_meta( $group_id, '_wp_types_group_post_types', true );
if ( $post_types == 'all' ) {
return array();
}
$post_types = explode( ',', trim( $post_types, ',' ) );
return $post_types;
}
/**
* Gets taxonomies supported by specific group.
*
* @global type $wpdb
* @param type $group_id
* @return type
*/
function wpcf_admin_get_taxonomies_by_group( $group_id ) {
global $wpdb;
$terms = get_post_meta( $group_id, '_wp_types_group_terms', true );
if ( $terms == 'all' ) {
return array();
}
$terms = explode( ',', trim( $terms, ',' ) );
$taxonomies = array();
if ( !empty( $terms ) ) {
foreach ( $terms as $term ) {
$term = $wpdb->get_row( "SELECT tt.term_taxonomy_id, tt.taxonomy,
t.term_id, t.slug, t.name
FROM {$wpdb->prefix}term_taxonomy tt
JOIN {$wpdb->prefix}terms t
WHERE t.term_id = tt.term_id AND tt.term_taxonomy_id="
. intval( $term ), ARRAY_A );
if ( !empty( $term ) ) {
$taxonomies[$term['taxonomy']][$term['term_taxonomy_id']] = $term;
}
}
} else {
return array();
}
return $taxonomies;
}
/**
* Gets templates supported by specific group.
*
* @global type $wpdb
* @param type $group_id
* @return type
*/
function wpcf_admin_get_templates_by_group( $group_id ) {
global $wpdb;
$data = get_post_meta( $group_id, '_wp_types_group_templates', true );
if ( $data == 'all' ) {
return array();
}
$data = explode( ',', trim( $data, ',' ) );
$templates = get_page_templates();
$templates[] = 'default';
$templates_views = get_posts( 'post_type=view-template&numberposts=-1&status=publish' );
foreach ( $templates_views as $template_view ) {
$templates[] = $template_view->ID;
}
$result = array();
if ( !empty( $data ) ) {
foreach ( $templates as $template ) {
if ( in_array( $template, $data ) ) {
$result[] = $template;
}
}
}
return $result;
}
/**
* Activates group.
* Modified by Gen, 13.02.2013
*
* @global type $wpdb
* @param type $group_id
* @return type
*/
function wpcf_admin_fields_activate_group( $group_id,
$post_type = 'wp-types-group' ) {
global $wpdb;
return $wpdb->update( $wpdb->posts, array('post_status' => 'publish'),
array('ID' => intval( $group_id ), 'post_type' => $post_type),
array('%s'), array('%d', '%s')
);
}
/**
* Deactivates group.
* Modified by Gen, 13.02.2013
*
* @global type $wpdb
* @param type $group_id
* @return type
*/
function wpcf_admin_fields_deactivate_group( $group_id,
$post_type = 'wp-types-group' ) {
global $wpdb;
return $wpdb->update( $wpdb->posts, array('post_status' => 'draft'),
array('ID' => intval( $group_id ), 'post_type' => $post_type),
array('%s'), array('%d', '%s')
);
}
/**
* Removes specific field from group.
*
* @global type $wpdb
* @global type $wpdb
* @param type $group_id
* @param type $field_id
* @return type
*/
function wpcf_admin_fields_remove_field_from_group( $group_id, $field_id ) {
$group_fields = get_post_meta( $group_id, '_wp_types_group_fields', true );
if ( empty( $group_fields ) ) {
return false;
}
$group_fields = str_replace( ',' . $field_id . ',', ',', $group_fields );
update_post_meta( $group_id, '_wp_types_group_fields', $group_fields );
}
/**
* Bulk removal
*
* @param type $group_id
* @param type $fields
* @return type
*/
function wpcf_admin_fields_remove_field_from_group_bulk( $group_id, $fields ) {
foreach ( $fields as $field_id ) {
wpcf_admin_fields_remove_field_from_group( $group_id, $field_id );
}
}
/**
* Deletes field.
* Modified by Gen, 13.02.2013
*
* @param type $field_id
*/
function wpcf_admin_fields_delete_field( $field_id,
$post_type = 'wp-types-group', $meta_name = 'wpcf-fields' ) {
global $wpdb;
$fields = get_option( $meta_name, array() );
if ( isset( $fields[$field_id] ) ) {
// Remove from groups
$groups = wpcf_admin_fields_get_groups( $post_type );
foreach ( $groups as $key => $group ) {
wpcf_admin_fields_remove_field_from_group( $group['id'], $field_id );
}
// Remove from posts
if ( !wpcf_types_cf_under_control( 'check_outsider', $field_id,
$post_type, $meta_name ) ) {
$results = $wpdb->get_results( "SELECT post_id, meta_key FROM $wpdb->postmeta WHERE meta_key = '" . wpcf_types_get_meta_prefix( $fields[$field_id] ) . strval( $field_id ) . "'" );
foreach ( $results as $result ) {
delete_post_meta( $result->post_id, $result->meta_key );
}
}
unset( $fields[$field_id] );
wpcf_admin_fields_save_fields( $fields, true, $meta_name );
return true;
} else {
return false;
}
}
/**
* Deletes group by ID.
* Modified by Gen, 13.02.2013
*
* @global type $wpdb
* @param type $group_id
* @return type
*/
function wpcf_admin_fields_delete_group( $group_id,
$post_type = 'wp-types-group' ) {
$group = get_post( $group_id );
if ( empty( $group ) || $group->post_type != $post_type ) {
return false;
}
wp_delete_post( $group_id, true );
}
/**
* Saves group.
* Modified by Gen, 13.02.2013
*
* @param type $group
* @return type
*/
function wpcf_admin_fields_save_group( $group, $post_type = 'wp-types-group' ) {
if ( !isset( $group['name'] ) ) {
return false;
}
$post = array(
'post_status' => 'publish',
'post_type' => $post_type,
'post_title' => $group['name'],
'post_name' => $group['name'],
'post_content' => !empty( $group['description'] ) ? $group['description'] : '',
);
$update = false;
if ( isset( $group['id'] ) ) {
$update = true;
$post_to_update = get_post( $group['id'] );
if ( empty( $post_to_update ) || $post_to_update->post_type != $post_type ) {
return false;
}
$post['ID'] = $post_to_update->ID;
$post['post_status'] = $post_to_update->post_status;
}
if ( $update ) {
$group_id = wp_update_post( $post );
if ( !$group_id ) {
return false;
}
} else {
$group_id = wp_insert_post( $post, true );
if ( is_wp_error( $group_id ) ) {
return false;
}
}
if ( !empty( $group['filters_association'] ) ) {
update_post_meta( $group_id, '_wp_types_group_filters_association', $group['filters_association'] );
} else {
delete_post_meta( $group_id, '_wp_types_group_filters_association' );
}
// WPML register strings
if ( function_exists( 'icl_register_string' ) ) {
wpcf_translate_register_string( 'plugin Types',
'group ' . $group_id . ' name', $group['name'] );
wpcf_translate_register_string( 'plugin Types',
'group ' . $group_id . ' description', $group['description'] );
}
return $group_id;
}
/**
* Saves all fields.
* Modified by Gen, 13.02.2013
*
* @param type $fields
*/
function wpcf_admin_fields_save_fields( $fields, $forced = false,
$option_name = 'wpcf-fields' ) {
$original = get_option( $option_name, array() );
if ( !$forced ) {
$fields = array_merge( $original, $fields );
}
update_option( $option_name, $fields );
}
/**
* Saves field.
* Modified by Gen, 13.02.2013
*
* @param type $field
* @return type
*/
function wpcf_admin_fields_save_field( $field, $post_type = 'wp-types-group',
$meta_name = 'wpcf-fields' ) {
if ( !isset( $field['name'] ) || !isset( $field['type'] ) ) {
return new WP_Error( 'wpcf_save_field_no_name_or_type', __( "Error saving field",
'wpcf' ) );
}
$field = wpcf_sanitize_field( $field );
if ( empty( $field['name'] ) || empty( $field['slug'] ) ) {
return new WP_Error( 'wpcf_save_field_no_name', __( "Please set name for field",
'wpcf' ) );
}
$field['id'] = $field['slug'];
// Set field specific data
// NOTE: This was $field['data'] = $field and seemed to work on most systems.
// I changed it to asign via a temporary variable to fix on one system.
$temp_field = $field;
$field['data'] = $temp_field;
// Unset default fields
unset( $field['data']['type'], $field['data']['slug'],
$field['data']['name'], $field['data']['description'],
$field['data']['user_id'], $field['data']['id'],
$field['data']['data'] );
// Merge previous data (added because of outside fields)
// @TODO Remember why
if ( wpcf_types_cf_under_control( 'check_outsider', $field['id'],
$post_type, $meta_name ) ) {
$field_previous_data = wpcf_admin_fields_get_field( $field['id'], false,
true, false, $meta_name );
if ( !empty( $field_previous_data['data'] ) ) {
$field['data'] = array_merge( $field_previous_data['data'],
$field['data'] );
}
}
$field['data'] = apply_filters( 'wpcf_fields_' . $field['type'] . '_meta_data', $field['data'], $field );
// Check validation
if ( isset( $field['data']['validate'] ) ) {
foreach ( $field['data']['validate'] as $method => $data ) {
if ( !isset( $data['active'] ) ) {
unset( $field['data']['validate'][$method] );
}
}
if ( empty( $field['data']['validate'] ) ) {
unset( $field['data']['validate'] );
}
}
$save_data = array();
$save_data['id'] = $field['id'];
$save_data['slug'] = $field['slug'];
$save_data['type'] = $field['type'];
$save_data['name'] = $field['name'];
$save_data['description'] = $field['description'];
$save_data['data'] = $field['data'];
$save_data['data']['disabled_by_type'] = 0;
// For radios or select
if ( !empty( $field['data']['options'] ) ) {
foreach ( $field['data']['options'] as $name => $option ) {
if ( isset( $option['title'] ) ) {
$option['title'] = $field['data']['options'][$name]['title'] = htmlspecialchars_decode( $option['title'] );
}
if ( isset( $option['value'] ) ) {
$option['value'] = $field['data']['options'][$name]['value'] = htmlspecialchars_decode( $option['value'] );
}
if ( isset( $option['display_value'] ) ) {
$option['display_value'] = $field['data']['options'][$name]['display_value'] = htmlspecialchars_decode( $option['display_value'] );
}
// For checkboxes
if ( $field['type'] == 'checkboxes' && isset( $option['set_value'] )
&& $option['set_value'] != '1' ) {
$option['set_value'] = $field['data']['options'][$name]['set_value'] = htmlspecialchars_decode( $option['set_value'] );
}
if ( $field['type'] == 'checkboxes' && !empty( $option['display_value_selected'] ) ) {
$option['display_value_selected'] = $field['data']['options'][$name]['display_value_selected'] = htmlspecialchars_decode( $option['display_value_selected'] );
}
if ( $field['type'] == 'checkboxes' && !empty( $option['display_value_not_selected'] ) ) {
$option['display_value_not_selected'] = $field['data']['options'][$name]['display_value_not_selected'] = htmlspecialchars_decode( $option['display_value_not_selected'] );
}
}
}
// For checkboxes
if ( $field['type'] == 'checkbox' && $field['set_value'] != '1' ) {
$field['set_value'] = htmlspecialchars_decode( $field['set_value'] );
}
if ( $field['type'] == 'checkbox' && !empty( $field['display_value_selected'] ) ) {
$field['display_value_selected'] = htmlspecialchars_decode( $field['display_value_selected'] );
}
if ( $field['type'] == 'checkbox' && !empty( $field['display_value_not_selected'] ) ) {
$field['display_value_not_selected'] = htmlspecialchars_decode( $field['display_value_not_selected'] );
}
// Save field
$fields = get_option( $meta_name, array() );
$fields[$field['slug']] = $save_data;
update_option( $meta_name, $fields );
$field_id = $field['slug'];
// WPML register strings
if ( function_exists( 'icl_register_string' ) ) {
if ( isset($_POST['wpml_cf_translation_preferences'][$field_id] ) ) {
$__wpml_action = intval( $_POST['wpml_cf_translation_preferences'][$field_id] );
} else {
$__wpml_action = wpcf_wpml_get_action_by_type( $field['type'] );
}
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' name', $field['name'] );
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' description', $field['description'] );
// For radios or select
if ( !empty( $field['data']['options'] ) ) {
foreach ( $field['data']['options'] as $name => $option ) {
if ( $name == 'default' ) {
continue;
}
if ( isset( $option['title'] ) ) {
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' option ' . $name . ' title',
$option['title'] );
}
if ($__wpml_action === 2) {
if ( isset( $option['value'] ) ) {
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' option ' . $name . ' value',
$option['value'] );
}
}
if ( isset( $option['display_value'] ) ) {
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' option ' . $name . ' display value',
$option['display_value'] );
}
// For checkboxes
if ( isset( $option['set_value'] ) && $option['set_value'] != '1' ) {
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' option ' . $name . ' value',
$option['set_value'] );
}
if ( !empty( $option['display_value_selected'] ) ) {
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' option ' . $name . ' display value selected',
$option['display_value_selected'] );
}
if ( !empty( $option['display_value_not_selected'] ) ) {
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' option ' . $name . ' display value not selected',
$option['display_value_not_selected'] );
}
}
}
if ( $field['type'] == 'checkbox' && $field['set_value'] != '1' ) {
// we need to translate the check box value to store
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' checkbox value',
$field['set_value'] );
}
if ( $field['type'] == 'checkbox' && !empty( $field['display_value_selected'] ) ) {
// we need to translate the check box value to store
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' checkbox value selected',
$field['display_value_selected'] );
}
if ( $field['type'] == 'checkbox' && !empty( $field['display_value_not_selected'] ) ) {
// we need to translate the check box value to store
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' checkbox value not selected',
$field['display_value_not_selected'] );
}
// Validation message
if ( !empty( $field['data']['validate'] ) ) {
foreach ( $field['data']['validate'] as $method => $validation ) {
if ( !empty( $validation['message'] ) ) {
// Skip if it's same as default
$default_message = wpcf_admin_validation_messages( $method );
if ( $validation['message'] != $default_message ) {
wpcf_translate_register_string( 'plugin Types',
'field ' . $field_id . ' validation message ' . $method,
$validation['message'] );
}
}
}
}
}
return $field_id;
}
/**
* Changes field type.
* Modified by Gen, 13.02.2013
*
* @param type $fields
* @param type $type
*/
function wpcf_admin_custom_fields_change_type( $fields, $type,
$post_type = 'wp-types-group', $meta_name = 'wpcf-fields' ) {
if ( !is_array( $fields ) ) {
$fields = array(strval( $fields ));
}
$fields = wpcf_types_cf_under_control( 'add',
array('fields' => $fields, 'type' => $type), $post_type, $meta_name );
$allowed = array(
'audio' => array('wysiwyg', 'url', 'textarea', 'textfield', 'email', 'date', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'textfield' => array('wysiwyg', 'textfield', 'textarea', 'email', 'url', 'date', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'textarea' => array('wysiwyg', 'textfield', 'textarea', 'email', 'url', 'date', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'date' => array('wysiwyg', 'date', 'textarea', 'textfield', 'email', 'url', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'email' => array('wysiwyg', 'email', 'textarea', 'textfield', 'date', 'url', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'embed' => array('wysiwyg', 'url', 'textarea', 'textfield', 'email', 'date', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'file' => array('wysiwyg', 'file', 'textarea', 'textfield', 'email', 'url', 'phone', 'fdate', 'image', 'numeric', 'audio', 'video', 'embed'),
'image' => array('wysiwyg', 'image', 'textarea', 'textfield', 'email', 'url', 'phone', 'file', 'idate', 'numeric', 'audio', 'video', 'embed'),
'numeric' => array('wysiwyg', 'numeric', 'textarea', 'textfield', 'email', 'url', 'phone', 'file', 'image', 'date', 'audio', 'video', 'embed'),
'phone' => array('wysiwyg', 'phone', 'textarea', 'textfield', 'email', 'url', 'date', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'select' => array('wysiwyg', 'select', 'textarea', 'textfield', 'date', 'email', 'url', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'skype' => array('wysiwyg', 'skype', 'textarea', 'textfield', 'date', 'email', 'url', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'url' => array('wysiwyg', 'url', 'textarea', 'textfield', 'email', 'date', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'checkbox' => array('wysiwyg', 'checkbox', 'textarea', 'textfield', 'email', 'url', 'date', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'radio' => array('wysiwyg', 'radio', 'textarea', 'textfield', 'email', 'url', 'date', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'video' => array('wysiwyg', 'url', 'textarea', 'textfield', 'email', 'date', 'phone', 'file', 'image', 'numeric', 'audio', 'video', 'embed'),
'wysiwyg' => array('wysiwyg', 'textarea'),
);
$all_fields = wpcf_admin_fields_get_fields( false, false, false, $meta_name );
foreach ( $fields as $field_id ) {
if ( !isset( $all_fields[$field_id] ) ) {
continue;
}
$field = $all_fields[$field_id];
if ( !in_array( $type, $allowed[$field['type']] ) ) {
wpcf_admin_message_store( sprintf( __( 'Field "%s" type was converted from %s to %s. You need to set some further settings in the group editor.',
'wpcf' ), $field['name'], $field['type'],
$type ) );
$all_fields[$field_id]['data']['disabled_by_type'] = 1;
} else {
$all_fields[$field_id]['data']['disabled'] = 0;
$all_fields[$field_id]['data']['disabled_by_type'] = 0;
}
if ( $field['type'] == 'numeric' && isset( $all_fields[$field_id]['data']['validate']['number'] ) ) {
unset( $all_fields[$field_id]['data']['validate']['number'] );
} else if ( $type == 'numeric' ) {
$all_fields[$field_id]['data']['validate'] = array('number' => array(
'active' => true, 'message' => __('Please enter numeric data', 'wpcf')));
}
$all_fields[$field_id]['type'] = $type;
}
update_option( $meta_name, $all_fields );
}
/**
* Saves group's fields.
* Modified by Gen, 13.02.2013
*
* @global type $wpdb
* @param type $group_id
* @param type $fields
*/
function wpcf_admin_fields_save_group_fields( $group_id, $fields, $add = false,
$post_type = 'wp-types-group' ) {
$meta_name = ($post_type == 'wp-types-group' ? 'wpcf-fields' : 'wpcf-usermeta');
$fields = wpcf_types_cf_under_control( 'add', array('fields' => $fields),
$post_type, $meta_name );
if ( $add ) {
$existing_fields = wpcf_admin_fields_get_fields_by_group( $group_id,
'slug', false, true, false, $post_type, $meta_name );
$order = array();
if ( !empty( $existing_fields ) ) {
foreach ( $existing_fields as $field_id => $field ) {
if ( in_array( $field['id'], $fields ) ) {
continue;
}
$order[] = $field['id'];
}
foreach ( $fields as $field ) {
$order[] = $field;
}
$fields = $order;
}
}
if ( empty( $fields ) ) {
delete_post_meta( $group_id, '_wp_types_group_fields' );
return false;
}
$fields = ',' . implode( ',', (array) $fields ) . ',';
update_post_meta( $group_id, '_wp_types_group_fields', $fields );
}
/**
* Saves group's post types.
*
* @global type $wpdb
* @param type $group_id
* @param type $post_types
*/
function wpcf_admin_fields_save_group_post_types( $group_id, $post_types ) {
if ( empty( $post_types ) ) {
update_post_meta( $group_id, '_wp_types_group_post_types', 'all' );
return true;
}
$post_types = ',' . implode( ',', (array) $post_types ) . ',';
update_post_meta( $group_id, '_wp_types_group_post_types', $post_types );
}
/**
* Saves group's terms.
*
* @global type $wpdb
* @param type $group_id
* @param type $terms
*/
function wpcf_admin_fields_save_group_terms( $group_id, $terms ) {
if ( empty( $terms ) ) {
update_post_meta( $group_id, '_wp_types_group_terms', 'all' );
return true;
}
$terms = ',' . implode( ',', (array) $terms ) . ',';
update_post_meta( $group_id, '_wp_types_group_terms', $terms );
}
/**
* Saves group's templates.
*
* @global type $wpdb
* @param type $group_id
* @param type $terms
*/
function wpcf_admin_fields_save_group_templates( $group_id, $templates ) {
if ( empty( $templates ) ) {
update_post_meta( $group_id, '_wp_types_group_templates', 'all' );
return true;
}
$templates = ',' . implode( ',', (array) $templates ) . ',';
update_post_meta( $group_id, '_wp_types_group_templates', $templates );
}
/**
* Returns HTML formatted AJAX activation link.
*
* @param type $group_id
* @return type
*/
function wpcf_admin_fields_get_ajax_activation_link( $group_id ) {
return '<a href="' . admin_url( 'admin-ajax.php?action=wpcf_ajax&'
. 'wpcf_action=activate_group&group_id='
. $group_id . '&wpcf_ajax_update=wpcf_list_ajax_response_'
. $group_id ) . '&_wpnonce=' . wp_create_nonce( 'activate_group' )
. '" class="wpcf-ajax-link" id="wpcf-list-activate-'
. $group_id . '">'
. __( 'Activate', 'wpcf' ) . '</a>';
}
/**
* Returns HTML formatted AJAX deactivation link.
* @param type $group_id
* @return type
*/
function wpcf_admin_fields_get_ajax_deactivation_link( $group_id ) {
return '<a href="' . admin_url( 'admin-ajax.php?action=wpcf_ajax&'
. 'wpcf_action=deactivate_group&group_id='
. $group_id . '&wpcf_ajax_update=wpcf_list_ajax_response_'
. $group_id ) . '&_wpnonce=' . wp_create_nonce( 'deactivate_group' )
. '" class="wpcf-ajax-link" id="wpcf-list-activate-'
. $group_id . '">'
. __( 'Deactivate', 'wpcf' ) . '</a>';
}
/**
* Check how many posts needs checkbox update.
*
* @param type $field
* @param type $action
* @return boolean|int
*/
function wpcf_admin_fields_checkbox_migrate_empty_check( $field, $action ) {
if ( $field['type'] != 'checkbox' ) {
return false;
}
if ($field['meta_type'] == 'postmeta') {
$filter = wpcf_admin_fields_get_filter_by_field( $field['id'] );
if ( !empty( $filter ) ) {
$posts = array();
$meta_key = wpcf_types_get_meta_prefix( $field ) . $field['id'];
$meta_query = '';
if ( $action == 'do_not_save_check' ) {
$meta_query = "(m.meta_key = '$meta_key' AND m.meta_value = '0')";
$posts = wpcf_admin_fields_get_posts_by_filter( $filter, $meta_query );
} else if ( $action == 'save_check' ) {
$posts = wpcf_admin_fields_get_posts_by_filter_missing_meta( $filter,
$meta_key );
}
$option = get_option( 'wpcf_checkbox_migration', array() );
$cache_key = $action == 'do_not_save_check' ? 'do_not_save' : 'save';
$option[$cache_key] = $posts;
update_option( 'wpcf_checkbox_migration', $option );
return $posts;
}
} else if ($field['meta_type'] == 'usermeta') {
$option = get_option( 'wpcf_checkbox_migration_usermeta', array() );
$cache_key = $action == 'do_not_save_check' ? 'do_not_save' : 'save';
if ( $action == 'do_not_save_check' ) {
$user_query = new WP_User_Query( array('meta_key' => $field['meta_key'],
'meta_value' => '0', 'meta_compare' => '=', 'fields' => 'ID') );
$r = $user_query->results;
} else if ( $action == 'save_check' ) {
global $wpdb;
$_query = "SELECT u.ID FROM {$wpdb->users} u WHERE NOT EXISTS (SELECT um.user_id FROM {$wpdb->usermeta} um WHERE u.ID = um.user_id AND um.meta_key = '%s')";
$r = $wpdb->get_col($wpdb->prepare( $_query, $field['meta_key']) );
}
$option[$field['meta_key']][$cache_key] = $r;
update_option( 'wpcf_checkbox_migration_usermeta', $option );
return $r;
}
return false;
}
/**
* Update posts checkboxes fields.
*
* @param type $field
* @param type $action
* @return boolean|int
*/
function wpcf_admin_fields_checkbox_migrate_empty( $field, $action ) {
if ( $field['type'] != 'checkbox' ) {
return false;
}
if ( $field['meta_type'] == 'usermeta' ) {
$option = get_option( 'wpcf_checkbox_migration_usermeta', array() );
if ( empty( $option[$field['meta_key']][$action] ) ) {
$users = wpcf_admin_fields_checkbox_migrate_empty_check( $field,
$action . '_check' );
} else {
$users = $option[$field['meta_key']][$action];
}
if ( !empty( $users ) ) {
if ( $action == 'do_not_save' ) {
$count = 0;
foreach ( $users as $temp_key => $user_id ) {
if ( $count == 1000 ) {
$option[$field['meta_key']][$action] = $users;
update_option( 'wpcf_checkbox_migration', $option );
$data = array('offset' => $temp_key);
return $data;
}
delete_user_meta( $user_id, $field['meta_key'], 0 );
unset( $users[$temp_key] );
$count++;
}
unset( $option[$field['meta_key']][$action] );
update_option( 'wpcf_checkbox_migration_usermeta', $option );
return $users;
} else if ( $action == 'save' ) {
$count = 0;
foreach ( $users as $temp_key => $user_id ) {
if ( $count == 1000 ) {
$option[$field['meta_key']][$action] = $users;
update_option( 'wpcf_checkbox_migration_usermeta', $option );
$data = array('offset' => $temp_key);
return $data;
}
update_user_meta( $user_id, $field['meta_key'], 0 );
unset( $users[$temp_key] );
$count++;
}
unset( $option[$field['meta_key']][$action] );
update_option( 'wpcf_checkbox_migration_usermeta', $option );
return $users;
}
}
return false;
}
$option = get_option( 'wpcf_checkbox_migration', array() );
$meta_key = wpcf_types_get_meta_prefix( $field ) . $field['id'];
if ( empty( $option[$action] ) ) {
$posts = wpcf_admin_fields_checkbox_migrate_empty_check( $field,
$action . '_check' );
} else {
$posts = $option[$action];
}
if ( !empty( $posts ) ) {
if ( $action == 'do_not_save' ) {
$count = 0;
foreach ( $posts as $temp_key => $post_id ) {
if ( $count == 1000 ) {
$option[$action] = $posts;
update_option( 'wpcf_checkbox_migration', $option );
$data = array('offset' => $temp_key);
return $data;
}
delete_post_meta( $post_id, $meta_key, 0 );
unset( $posts[$temp_key] );
$count++;
}
unset( $option[$action] );
update_option( 'wpcf_checkbox_migration', $option );
return $posts;
} else if ( $action == 'save' ) {
$count = 0;
foreach ( $posts as $temp_key => $post_id ) {
if ( $count == 1000 ) {
$option[$action] = $posts;
update_option( 'wpcf_checkbox_migration', $option );
$data = array('offset' => $temp_key);
return $data;
}
update_post_meta( $post_id, $meta_key, 0 );
unset( $posts[$temp_key] );
$count++;
}
unset( $option[$action] );
update_option( 'wpcf_checkbox_migration', $option );
return $posts;
}
}
return false;
}
/**
* Gets all filters required for field to be used.
*
* @param type $field
* @return boolean|string
*/
function wpcf_admin_fields_get_filter_by_field( $field ) {
$field = wpcf_admin_fields_get_field( $field );
if ( empty( $field ) ) {
return false;
}
$filter = array();
$filter['types'] = array();
$filter['terms'] = array();
$filter['templates'] = array();
$groups = wpcf_admin_fields_get_groups_by_field( $field['id'] );
foreach ( $groups as $group_id => $group_data ) {
// Get filters
$filter['types'] = array_merge( $filter['types'],
explode( ',',
trim( get_post_meta( $group_id,
'_wp_types_group_post_types', true ),
',' ) ) );
$filter['terms'] = array_merge( $filter['terms'],
explode( ',',
trim( get_post_meta( $group_id, '_wp_types_group_terms',
true ), ',' ) ) );
$filter['templates'] = array_merge( $filter['templates'],
explode( ',',
trim( get_post_meta( $group_id,
'_wp_types_group_templates', true ), ',' ) ) );
$filter['association'] = isset( $group_data['filters_association'] ) && $group_data['filters_association'] == 'any' ? 'OR' : 'AND';
}
if ( in_array( 'all', $filter['types'] ) ) {
$filter['types'] = 'all';
}
if ( in_array( 'all', $filter['terms'] ) ) {
$filter['terms'] = 'all';
}
if ( in_array( 'all', $filter['templates'] ) ) {
$filter['templates'] = 'all';
}
return $filter;
}
/**
* Gets posts by filter fetched with wpcf_admin_fields_get_filter_by_field().
*
* @global type $wpdb
* @param type $filter
* @return type
*/
function wpcf_admin_fields_get_posts_by_filter( $filter, $meta_query = '' ) {
global $wpdb, $wpcf;
$query = array();
$join = array();
if ( $filter['types'] != 'all' && !empty( $filter['types'] ) ) {
$query[] = 'p.post_type IN (\'' . implode( '\',\'', $filter['types'] ) . '\')';
} else {
$post_types = get_post_types( array('show_ui' => true), 'names' );
foreach ( $post_types as $post_type_slug => $post_type ) {
if ( in_array( $post_type_slug, $wpcf->excluded_post_types ) ) {
unset( $post_types[$post_type_slug] );
}
}
$query[] = 'p.post_type IN (\'' . implode( '\',\'', $post_types ) . '\')';
}
if ( $filter['terms'] != 'all' && !empty( $filter['terms'] ) ) {
$ttid = array();
foreach ( $filter['terms'] as $term_id ) {
$term_taxonomy_id = $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id=%d",
$term_id ) );
if ( !empty( $term_taxonomy_id ) ) {
$ttid[] = $term_taxonomy_id;
}
}
$query[] = 't.term_taxonomy_id IN (\'' . implode( '\',\'', $ttid ) . '\')';
$join[] = "LEFT JOIN $wpdb->term_relationships t ON p.ID = t.object_id ";
}
if ( $filter['templates'] != 'all' && !empty( $filter['templates'] ) ) {
$query[] = '(m.meta_key = \'_wp_page_template\' AND m.meta_value IN (\'' . implode( '\',\'',
$filter['templates'] ) . '\'))';
}
if ( !empty( $meta_query )
|| ($filter['templates'] != 'all' && !empty( $filter['templates'] )) ) {
$join[] = "LEFT JOIN $wpdb->postmeta m ON p.ID = m.post_id ";
}
$_query = "SELECT p.ID FROM $wpdb->posts p " . implode( '', $join );
if ( !empty( $query ) ) {
$_query .= "WHERE " . implode( ' ' . $filter['association'] . ' ',
$query ) . ' ';
if ( !empty( $meta_query ) ) {
$_query .= ' AND ' . $meta_query . ' ';
}
} else if ( !empty( $meta_query ) ) {
$_query .= "WHERE " . $meta_query . ' ';
}
$_query .= "GROUP BY p.ID";
$posts = $wpdb->get_col( $_query );
return $posts;
}
/**
* Gets posts by filter with missing meta fetched
* with wpcf_admin_fields_get_filter_by_field().
*
* @global type $wpdb
* @param type $filter
* @return type
*/
function wpcf_admin_fields_get_posts_by_filter_missing_meta( $filter,
$meta_key = '' ) {
global $wpdb, $wpcf;
$query = array();
$join = array();
if ( $filter['types'] != 'all' && !empty( $filter['types'] ) ) {
$query[] = 'p.post_type IN (\'' . implode( '\',\'', $filter['types'] ) . '\')';
} else {
$post_types = get_post_types( array('show_ui' => true), 'names' );
foreach ( $post_types as $post_type_slug => $post_type ) {
if ( in_array( $post_type_slug, $wpcf->excluded_post_types ) ) {
unset( $post_types[$post_type_slug] );
}
}
$query[] = 'p.post_type IN (\'' . implode( '\',\'', $post_types ) . '\')';
}
if ( $filter['terms'] != 'all' && !empty( $filter['terms'] ) ) {
$ttid = array();
foreach ( $filter['terms'] as $term_id ) {
$term_taxonomy_id = $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id=%d",
$term_id ) );
if ( !empty( $term_taxonomy_id ) ) {
$ttid[] = $term_taxonomy_id;
}
}
$query[] = 't.term_taxonomy_id IN (\'' . implode( '\',\'', $ttid ) . '\')';
$join[] = "LEFT JOIN $wpdb->term_relationships t ON p.ID = t.object_id ";
}
if ( $filter['templates'] != 'all' && !empty( $filter['templates'] ) ) {
$query[] = '(m.meta_key = \'_wp_page_template\' AND m.meta_value IN (\'' . implode( '\',\'',
$filter['templates'] ) . '\'))';
$join[] = "LEFT JOIN $wpdb->postmeta m ON p.ID = m.post_id ";
}
$_query = "SELECT DISTINCT p.ID FROM $wpdb->posts p " . implode( '', $join );
$_query .= "WHERE NOT EXISTS (SELECT * FROM $wpdb->postmeta mm WHERE p.ID = mm.post_id AND mm.meta_key = '$meta_key')";
if ( !empty( $query ) ) {
$_query .= "AND (" . implode( ' ' . $filter['association'] . ' ', $query ) . ') ';
}
$_query .= "GROUP BY p.ID";
$posts = $wpdb->get_col( $_query );
return $posts;
}
/**
* Check how many posts needs checkboxes update.
*
* @param type $field
* @param type $action
* @return boolean|int
*/
function wpcf_admin_fields_checkboxes_migrate_empty_check( $field, $action ) {
if ( $field['type'] != 'checkboxes' || empty( $field['data']['options'] ) ) {
return false;
}
if ( $field['meta_type'] == 'usermeta' ) {
global $wpdb;
if ( $action == 'do_not_save_check' ) {
$query = array();
foreach ( $field['data']['options'] as $option_id => $option_data ) {
// $query[] = '\"' . $option_id . '\";s:1:\"0\";';
$query[] = '\"' . $option_id . '\";i:0;';
}
$meta_query = "SELECT u.ID FROM {$wpdb->users} u
LEFT JOIN {$wpdb->usermeta} um ON u.ID = um.user_id
WHERE (um.meta_key = '%s' AND (um.meta_value LIKE '%%"
. implode( "%%' OR um.meta_value LIKE '%%", $query ) . "%%'))";
} else if ( $action == 'save_check' ) {
$query = array();
foreach ( $field['data']['options'] as $option_id => $option_data ) {
// $query[] = '\"' . $option_id . '\";s:1:\"0\";';
// Check only if missing
$query[] = '\"' . $option_id . '\"';
}
$meta_query = "SELECT u.ID FROM {$wpdb->users} u
LEFT JOIN {$wpdb->usermeta} um ON u.ID = um.user_id
WHERE (um.meta_key = '%s' AND (um.meta_value NOT LIKE '%%"
. implode( "%%' OR um.meta_value NOT LIKE '%%", $query ) . "%%'))";
}
$users = $wpdb->get_col( $wpdb->prepare( $meta_query, $field['meta_key'] ) );
$option = get_option( 'wpcf_checkboxes_migration_usermeta', array() );
$cache_key = $action == 'do_not_save_check' ? 'do_not_save' : 'save';
$option[$field['meta_key']][$cache_key] = $users;
update_option( 'wpcf_checkboxes_migration_usermeta', $option );
return $users;
}
$filter = wpcf_admin_fields_get_filter_by_field( $field['id'] );
if ( !empty( $filter ) ) {
$posts = array();
$meta_key = wpcf_types_get_meta_prefix( $field ) . $field['id'];
$meta_query = '';
// "wpcf-fields-checkboxes-option-1873650245";s:1:"1";
if ( $action == 'do_not_save_check' ) {
$query = array();
foreach ( $field['data']['options'] as $option_id => $option_data ) {
$query[] = '\"' . $option_id . '\";i:0;';
}
$meta_query = "(m.meta_key = '$meta_key' AND (m.meta_value LIKE '%%"
. implode( "%%' OR m.meta_value LIKE '%%", $query ) . "%%'))";
$posts = wpcf_admin_fields_get_posts_by_filter( $filter, $meta_query );
} else if ( $action == 'save_check' ) {
$query = array();
foreach ( $field['data']['options'] as $option_id => $option_data ) {
// Check only if missing
$query[] = '\"' . $option_id . '\"';
}
$meta_query = "(m.meta_key = '$meta_key' AND (m.meta_value NOT LIKE '%%"
. implode( "%%' OR m.meta_value NOT LIKE '%%", $query ) . "%%'))";
$posts = wpcf_admin_fields_get_posts_by_filter( $filter, $meta_query );
}
$option = get_option( 'wpcf_checkboxes_migration', array() );
$cache_key = $action == 'do_not_save_check' ? 'do_not_save' : 'save';
$option[$cache_key] = $posts;
update_option( 'wpcf_checkboxes_migration', $option );
return $posts;
}
return false;
}
/**
* Update posts checkboxes fields.
*
* @param type $field
* @param type $action
* @return boolean|int
*/
function wpcf_admin_fields_checkboxes_migrate_empty( $field, $action ) {
if ( $field['type'] != 'checkboxes' || empty( $field['data']['options'] ) ) {
return false;
}
if ( $field['meta_type'] == 'usermeta' ) {
$option = get_option( 'wpcf_checkboxes_migration_usermeta', array() );
if ( empty( $option[$field['meta_key']][$action] ) ) {
$users = wpcf_admin_fields_checkboxes_migrate_empty_check( $field,
$action . '_check' );
} else {
$users = $option[$field['meta_key']][$action];
}
if ( !empty( $users ) ) {
if ( $action == 'do_not_save' ) {
$count = 0;
foreach ( $users as $temp_key => $user_id ) {
if ( $count == 1000 ) {
$option[$field['meta_key']][$action] = $users;
update_option( 'wpcf_checkboxes_migration_usermeta', $option );
$data = array('offset' => $temp_key);
return $data;
}
$meta_saved = get_user_meta( $user_id, $field['meta_key'] );
if ( !empty( $meta_saved ) ) {
foreach ( $meta_saved as $key => $value ) {
if ( !is_array( $value ) ) {
$value_check = array();
} else {
$value_check = $value;
}
foreach ( $field['data']['options'] as $option_id => $option_data ) {
if ( isset( $value_check[$option_id] ) && $value_check[$option_id] == '0' ) {
unset( $value_check[$option_id] );
}
}
update_user_meta( $user_id, $field['meta_key'], $value_check,
$value );
}
}
unset( $users[$temp_key] );
$count++;
}
unset( $option[$field['meta_key']][$action] );
update_option( 'wpcf_checkboxes_migration_usermeta', $option );
return $users;
} else if ( $action == 'save' ) {
$count = 0;
foreach ( $users as $temp_key => $user_id ) {
if ( $count == 1000 ) {
$option[$field['meta_key']][$action] = $users;
update_option( 'wpcf_checkboxes_migration_usermeta', $option );
$data = array('offset' => $temp_key);
return $data;
}
$meta_saved = get_user_meta( $user_id, $field['meta_key'] );
if ( !empty( $meta_saved ) ) {
foreach ( $meta_saved as $key => $value ) {
if ( !is_array( $value ) ) {
$value_check = array();
} else {
$value_check = $value;
}
$set_value = array();
foreach ( $field['data']['options'] as $option_id => $option_data ) {
if ( !isset( $value_check[$option_id] ) ) {
$set_value[$option_id] = 0;
}
}
$updated_value = $value_check + $set_value;
update_user_meta( $user_id, $field['meta_key'],
$updated_value, $value );
}
}
unset( $users[$temp_key] );
$count++;
}
unset( $option[$field['meta_key']][$action] );
update_option( 'wpcf_checkboxes_migration_usermeta', $option );
return $users;
}
}
return false;
}
$option = get_option( 'wpcf_checkboxes_migration', array() );
$meta_key = wpcf_types_get_meta_prefix( $field ) . $field['id'];
if ( empty( $option[$action] ) ) {
$posts = wpcf_admin_fields_checkboxes_migrate_empty_check( $field,
$action . '_check' );
} else {
$posts = $option[$action];
}
if ( !empty( $posts ) ) {
if ( $action == 'do_not_save' ) {
$count = 0;
foreach ( $posts as $temp_key => $post_id ) {
if ( $count == 1000 ) {
$option[$action] = $posts;
update_option( 'wpcf_checkboxes_migration', $option );
$data = array('offset' => $temp_key);
return $data;
}
$meta_saved = get_post_meta( $post_id, $meta_key );
if ( !empty( $meta_saved ) ) {
foreach ( $meta_saved as $key => $value ) {
if ( !is_array( $value ) ) {
$value_check = array();
} else {
$value_check = $value;
}
foreach ( $field['data']['options'] as $option_id =>
$option_data ) {
if ( isset( $value_check[$option_id] ) && $value_check[$option_id] == '0' ) {
unset( $value_check[$option_id] );
}
}
update_post_meta( $post_id, $meta_key, $value_check, $value );
}
}
unset( $posts[$temp_key] );
$count++;
}
unset( $option[$action] );
update_option( 'wpcf_checkboxes_migration', $option );
return $posts;
} else if ( $action == 'save' ) {
$count = 0;
foreach ( $posts as $temp_key => $post_id ) {
if ( $count == 1000 ) {
$option[$action] = $posts;
update_option( 'wpcf_checkboxes_migration', $option );
$data = array('offset' => $temp_key);
return $data;
}
$meta_saved = get_post_meta( $post_id, $meta_key );
if ( !empty( $meta_saved ) ) {
foreach ( $meta_saved as $key => $value ) {
if ( !is_array( $value ) ) {
$value_check = array();
} else {
$value_check = $value;
}
$set_value = array();
foreach ( $field['data']['options'] as $option_id =>
$option_data ) {
if ( !isset( $value_check[$option_id] ) ) {
$set_value[$option_id] = 0;
}
}
$updated_value = $value_check + $set_value;
update_post_meta( $post_id, $meta_key, $updated_value, $value );
}
}
unset( $posts[$temp_key] );
$count++;
}
unset( $option[$action] );
update_option( 'wpcf_checkboxes_migration', $option );
return $posts;
}
}
return false;
}
function wpcf_admin_fields_form_fix_styles()
{
$suffix = SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_style(
'wpcf-dashicons',
site_url( "/wp-includes/css/dashicons$suffix.css" )
);
}
| vperezma/h2osite | wp-content/plugins/types/includes/fields.php | PHP | gpl-2.0 | 51,409 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
4249,
1998,
2967,
4972,
1008,
1008,
1002,
2132,
3126,
2140,
1024,
8299,
1024,
1013,
1013,
13354,
7076,
1012,
17917,
2078,
1012,
2773,
20110,
1012,
8917,
1013,
4127,
1013,
22073,
1013,
1015,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from brambling.utils.payment import dwolla_update_tokens
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option(
'--days',
action='store',
dest='days',
default=15,
help='Number of days ahead of time to update refresh tokens.'),
)
def handle(self, *args, **options):
try:
days = int(options['days'])
except ValueError:
raise CommandError("Days must be an integer value.")
self.stdout.write("Updating dwolla tokens...")
self.stdout.flush()
count, test_count = dwolla_update_tokens(days)
self.stdout.write("Test tokens updated: {}".format(count))
self.stdout.write("Live tokens updated: {}".format(test_count))
self.stdout.flush()
| j-po/django-brambling | brambling/management/commands/update_tokens.py | Python | bsd-3-clause | 931 | [
30522,
2013,
23569,
19362,
3366,
12324,
2191,
1035,
5724,
2013,
6520,
23422,
1012,
4563,
1012,
2968,
1012,
2918,
12324,
2918,
9006,
2386,
2094,
1010,
3474,
29165,
2013,
20839,
9709,
1012,
21183,
12146,
1012,
7909,
12324,
1040,
12155,
4571,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="pt_PT" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About LVGcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source><b>LVGcoin</b> version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2015 The LVGcoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation>
Este é um programa experimental.
Distribuído sob uma licença de software MIT/X11, por favor verifique o ficheiro anexo license.txt ou http://www.opensource.org/licenses/mit-license.php.
Este produto inclui software desenvolvido pelo Projecto OpenSSL para uso no OpenSSL Toolkit (http://www.openssl.org/), software criptográfico escrito por Eric Young (eay@cryptsoft.com) e software UPnP escrito por Thomas Bernard.</translation>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation>Clique duas vezes para editar o endereço ou o rótulo</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Criar um novo endereço</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Copie o endereço selecionado para a área de transferência</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-46"/>
<source>These are your LVGcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<source>&Copy Address</source>
<translation>&Copiar Endereço</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a LVGcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Apagar o endereço selecionado da lista</translation>
</message>
<message>
<location line="-14"/>
<source>Verify a message to ensure it was signed with a specified LVGcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>E&liminar</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+65"/>
<source>Copy &Label</source>
<translation>Copiar &Rótulo</translation>
</message>
<message>
<location line="+2"/>
<source>&Edit</source>
<translation>&Editar</translation>
</message>
<message>
<location line="+250"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Ficheiro separado por vírgulas (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Rótulo</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Endereço</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(sem rótulo)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Diálogo de Frase-Passe</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Escreva a frase de segurança</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Nova frase de segurança</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Repita a nova frase de segurança</translation>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>For staking only</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+35"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Escreva a nova frase de seguraça da sua carteira. <br/> Por favor, use uma frase de <b>10 ou mais caracteres aleatórios,</b> ou <b>oito ou mais palavras</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Encriptar carteira</translation>
</message>
<message>
<location line="+7"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>A sua frase de segurança é necessária para desbloquear a carteira.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Desbloquear carteira</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>A sua frase de segurança é necessária para desencriptar a carteira.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Desencriptar carteira</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Alterar frase de segurança</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Escreva a frase de segurança antiga seguida da nova para a carteira.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Confirmar encriptação da carteira</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Tem a certeza que deseja encriptar a carteira?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>IMPORTANTE: Qualquer cópia de segurança anterior da carteira deverá ser substituída com o novo, actualmente encriptado, ficheiro de carteira. Por razões de segurança, cópias de segurança não encriptadas efectuadas anteriormente do ficheiro da carteira tornar-se-ão inúteis assim que começar a usar a nova carteira encriptada.</translation>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Atenção: A tecla Caps Lock está activa!</translation>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation>Carteira encriptada</translation>
</message>
<message>
<location line="-58"/>
<source>LVGcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>A encriptação da carteira falhou</translation>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>A encriptação da carteira falhou devido a um erro interno. A carteira não foi encriptada.</translation>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation>As frases de segurança fornecidas não coincidem.</translation>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation>O desbloqueio da carteira falhou</translation>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>A frase de segurança introduzida para a desencriptação da carteira estava incorreta.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>A desencriptação da carteira falhou</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>A frase de segurança da carteira foi alterada com êxito.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+282"/>
<source>Sign &message...</source>
<translation>Assinar &mensagem...</translation>
</message>
<message>
<location line="+251"/>
<source>Synchronizing with network...</source>
<translation>Sincronizando com a rede...</translation>
</message>
<message>
<location line="-319"/>
<source>&Overview</source>
<translation>Visã&o geral</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Mostrar visão geral da carteira</translation>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation>&Transações</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Navegar pelo histórico de transações</translation>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-13"/>
<source>&Receive coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-7"/>
<source>&Send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>E&xit</source>
<translation>Fec&har</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Sair da aplicação</translation>
</message>
<message>
<location line="+6"/>
<source>Show information about LVGcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Sobre &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Mostrar informação sobre Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Opções...</translation>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation>E&ncriptar Carteira...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>&Guardar Carteira...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>Mudar &Palavra-passe...</translation>
</message>
<message numerus="yes">
<location line="+259"/>
<source>~%n block(s) remaining</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-256"/>
<source>&Export...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Send coins to a LVGcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>Modify configuration options for LVGcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Encrypt or decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup wallet to another location</source>
<translation>Faça uma cópia de segurança da carteira para outra localização</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Mudar a frase de segurança utilizada na encriptação da carteira</translation>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation>Janela de &depuração</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Abrir consola de diagnóstico e depuração</translation>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation>&Verificar mensagem...</translation>
</message>
<message>
<location line="-202"/>
<source>LVGcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet</source>
<translation>Carteira</translation>
</message>
<message>
<location line="+180"/>
<source>&About LVGcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>Mo&strar / Ocultar</translation>
</message>
<message>
<location line="+9"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>&File</source>
<translation>&Ficheiro</translation>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation>Con&figurações</translation>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation>A&juda</translation>
</message>
<message>
<location line="+12"/>
<source>Tabs toolbar</source>
<translation>Barra de separadores</translation>
</message>
<message>
<location line="+8"/>
<source>Actions toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+9"/>
<source>[testnet]</source>
<translation>[rede de testes]</translation>
</message>
<message>
<location line="+0"/>
<location line="+60"/>
<source>LVGcoin client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+75"/>
<source>%n active connection(s) to LVGcoin network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+40"/>
<source>Downloaded %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+413"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-403"/>
<source>%n second(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="-312"/>
<source>About LVGcoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about LVGcoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>&Unlock Wallet...</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+297"/>
<source>%n minute(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Up to date</source>
<translation>Atualizado</translation>
</message>
<message>
<location line="+7"/>
<source>Catching up...</source>
<translation>Recuperando...</translation>
</message>
<message>
<location line="+10"/>
<source>Last received block was generated %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation>Transação enviada</translation>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation>Transação recebida</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Data: %1
Quantia: %2
Tipo: %3
Endereço: %4
</translation>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid LVGcoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>A carteira está <b>encriptada</b> e atualmente <b>desbloqueada</b></translation>
</message>
<message>
<location line="+10"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>A carteira está <b>encriptada</b> e atualmente <b>bloqueada</b></translation>
</message>
<message>
<location line="+25"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+76"/>
<source>%n second(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s)</source>
<translation><numerusform>%n hora</numerusform><numerusform>%n horas</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n dia</numerusform><numerusform>%n dias</numerusform></translation>
</message>
<message>
<location line="+18"/>
<source>Not staking</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+109"/>
<source>A fatal error occurred. LVGcoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+90"/>
<source>Network Alert</source>
<translation>Alerta da Rede</translation>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation>Quantidade:</translation>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation>Bytes:</translation>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation>Quantia:</translation>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation>Prioridade:</translation>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation>Taxa:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Saída Baixa:</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+551"/>
<source>no</source>
<translation>não</translation>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation>Depois de taxas:</translation>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation>Troco:</translation>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation>(des)seleccionar todos</translation>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation>Modo de árvore</translation>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation>Modo lista</translation>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation>Quantia</translation>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation>Endereço</translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation>Confirmados</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation>Confirmada</translation>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation>Prioridade</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-515"/>
<source>Copy address</source>
<translation>Copiar endereço</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Copiar rótulo</translation>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation>Copiar quantia</translation>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation>Copiar ID da Transação</translation>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation>Copiar quantidade</translation>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation>Taxa de cópia</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation>Taxa depois de cópia</translation>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation>Copiar bytes</translation>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>Prioridade de Cópia</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation>Copiar output baixo</translation>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation>Copiar alteração</translation>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation>o maior</translation>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation>alto</translation>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation>médio-alto</translation>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation>médio</translation>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation>baixo-médio</translation>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation>baixo</translation>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation>O mais baixo</translation>
</message>
<message>
<location line="+155"/>
<source>DUST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation>sim</translation>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+66"/>
<source>(no label)</source>
<translation>(Sem rótulo)</translation>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation>Alteração de %1 (%2)</translation>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation>(Alteração)</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Editar Endereço</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Rótulo</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>E&ndereço</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+20"/>
<source>New receiving address</source>
<translation>Novo endereço de entrada</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Novo endereço de saída</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Editar endereço de entrada</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Editar endereço de saída</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>O endereço introduzido "%1" já se encontra no livro de endereços.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid LVGcoin address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Impossível desbloquear carteira.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Falha ao gerar nova chave.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+420"/>
<location line="+12"/>
<source>lvgcoin-qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Opções</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Principal</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Pagar &taxa de transação</translation>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start LVGcoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start LVGcoin on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Detach databases at shutdown</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation>&Rede</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the LVGcoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Mapear porta usando &UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the LVGcoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>&IP do proxy:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Porta:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Porta do proxy (p.ex. 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>&Versão SOCKS:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>Versão do proxy SOCKS (p.ex. 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Janela</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Apenas mostrar o ícone da bandeja após minimizar a janela.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Minimizar para a bandeja e não para a barra de ferramentas</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Minimize ao invés de sair da aplicação quando a janela é fechada. Com esta opção selecionada, a aplicação apenas será encerrada quando escolher Sair da aplicação no menú.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>M&inimizar ao fechar</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>Vis&ualização</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>&Linguagem da interface de utilizador:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting LVGcoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Unidade a usar em quantias:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Escolha a subdivisão unitária a ser mostrada por defeito na aplicação e ao enviar moedas.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show LVGcoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>Mostrar en&dereços na lista de transações</translation>
</message>
<message>
<location line="+7"/>
<source>Whether to show coin control features or not.</source>
<translation>Escolha para mostrar funcionalidades de controlo "coin" ou não.</translation>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Cancelar</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+55"/>
<source>default</source>
<translation>padrão</translation>
</message>
<message>
<location line="+149"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting LVGcoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>O endereço de proxy introduzido é inválido. </translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Formulário</translation>
</message>
<message>
<location line="+33"/>
<location line="+231"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the LVGcoin network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-160"/>
<source>Stake:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-107"/>
<source>Wallet</source>
<translation>Carteira</translation>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation>O seu saldo disponível para gastar</translation>
</message>
<message>
<location line="+71"/>
<source>Immature:</source>
<translation>Imaturo:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>O saldo minado ainda não maturou</translation>
</message>
<message>
<location line="+20"/>
<source>Total:</source>
<translation>Total:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation>O seu saldo total actual</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Transações recentes</b></translation>
</message>
<message>
<location line="-108"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+113"/>
<location line="+1"/>
<source>out of sync</source>
<translation>fora de sincronia</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Nome do Cliente</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+348"/>
<source>N/A</source>
<translation>N/D</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Versão do Cliente</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Informação</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Usando versão OpenSSL</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Tempo de início</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Rede</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Número de ligações</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Cadeia de blocos</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Número actual de blocos</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Total estimado de blocos</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Tempo do último bloco</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Abrir</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the lvgcoin-qt help message to get a list with possible LVGcoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Consola</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Data de construção</translation>
</message>
<message>
<location line="-104"/>
<source>LVGcoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>LVGcoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Ficheiro de registo de depuração</translation>
</message>
<message>
<location line="+7"/>
<source>Open the LVGcoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Limpar consola</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-33"/>
<source>Welcome to the LVGcoin RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Use as setas para cima e para baixo para navegar no histórico e <b>Ctrl-L</b> para limpar o ecrã.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Digite <b>help</b> para visualizar os comandos disponíveis.</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Enviar Moedas</translation>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation>Funcionalidades de Coin Controlo:</translation>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation>Entradas</translation>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation>Selecção automática</translation>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation>Fundos insuficientes!</translation>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation>Quantidade:</translation>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation>Bytes:</translation>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation>Quantia:</translation>
</message>
<message>
<location line="+22"/>
<location line="+86"/>
<location line="+86"/>
<location line="+32"/>
<source>0.00 hack</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-191"/>
<source>Priority:</source>
<translation>Prioridade:</translation>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation>Taxa:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Output Baixo:</translation>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation>Depois de taxas:</translation>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation>Enviar para múltiplos destinatários de uma vez</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>Adicionar &Destinatário</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>&Limpar Tudo</translation>
</message>
<message>
<location line="+28"/>
<source>Balance:</source>
<translation>Saldo:</translation>
</message>
<message>
<location line="+16"/>
<source>123.456 hack</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Confirme ação de envio</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>&Enviar</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-173"/>
<source>Enter a LVGcoin address (e.g. Ld9EDYP4c2M3rXuETZ9sSXbMsx8yAQzTm9)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation>Copiar quantidade</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Copiar quantia</translation>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation>Taxa de cópia</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation>Taxa depois de cópia</translation>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation>Copiar bytes</translation>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>Prioridade de Cópia</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation>Copiar output baixo</translation>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation>Copiar alteração</translation>
</message>
<message>
<location line="+86"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Confirme envio de moedas</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>O endereço de destino não é válido, por favor verifique.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>A quantia a pagar deverá ser maior que 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>A quantia excede o seu saldo.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>O total excede o seu saldo quando a taxa de transação de %1 for incluída.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Endereço duplicado encontrado, apenas poderá enviar uma vez para cada endereço por cada operação de envio.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+251"/>
<source>WARNING: Invalid LVGcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation>(Sem rótulo)</translation>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>Qu&antia:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>&Pagar A:</translation>
</message>
<message>
<location line="+24"/>
<location filename="../sendcoinsentry.cpp" line="+25"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Escreva um rótulo para este endereço para o adicionar ao seu livro de endereços</translation>
</message>
<message>
<location line="+9"/>
<source>&Label:</source>
<translation>Rótu&lo:</translation>
</message>
<message>
<location line="+18"/>
<source>The address to send the payment to (e.g. Ld9EDYP4c2M3rXuETZ9sSXbMsx8yAQzTm9)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Cole endereço da área de transferência</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a LVGcoin address (e.g. Ld9EDYP4c2M3rXuETZ9sSXbMsx8yAQzTm9)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Assinaturas - Assinar / Verificar uma Mensagem</translation>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation>A&ssinar Mensagem</translation>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation>Pode assinar mensagens com os seus endereços para provar que são seus. Tenha atenção ao assinar mensagens ambíguas, pois ataques de phishing podem tentar enganá-lo, de modo a assinar a sua identidade para os atacantes. Apenas assine declarações completamente detalhadas com as quais concorde.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ld9EDYP4c2M3rXuETZ9sSXbMsx8yAQzTm9)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation>Cole endereço da área de transferência</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Escreva aqui a mensagem que deseja assinar</translation>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Copiar a assinatura actual para a área de transferência</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this LVGcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation>Repôr todos os campos de assinatura de mensagem</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Limpar &Tudo</translation>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation>&Verificar Mensagem</translation>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation>Introduza o endereço de assinatura, mensagem (assegure-se de copiar quebras de linha, espaços, tabuladores, etc. exactamente) e assinatura abaixo para verificar a mensagem. Tenha atenção para não ler mais na assinatura do que o que estiver na mensagem assinada, para evitar ser enganado por um atacante que se encontre entre si e quem assinou a mensagem.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ld9EDYP4c2M3rXuETZ9sSXbMsx8yAQzTm9)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified LVGcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation>Repôr todos os campos de verificação de mensagem</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a LVGcoin address (e.g. Ld9EDYP4c2M3rXuETZ9sSXbMsx8yAQzTm9)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Clique "Assinar mensagem" para gerar a assinatura</translation>
</message>
<message>
<location line="+3"/>
<source>Enter LVGcoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>O endereço introduzido é inválido. </translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Por favor verifique o endereço e tente de novo.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>O endereço introduzido não refere a chave alguma.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>O desbloqueio da carteira foi cancelado.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>A chave privada para o endereço introduzido não está disponível.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Assinatura de mensagem falhou.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Mensagem assinada.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>A assinatura não pôde ser descodificada.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Por favor verifique a assinatura e tente de novo.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>A assinatura não condiz com o conteúdo da mensagem.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Verificação da mensagem falhou.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Mensagem verificada.</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+19"/>
<source>Open until %1</source>
<translation>Aberto até %1</translation>
</message>
<message numerus="yes">
<location line="-2"/>
<source>Open for %n block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+8"/>
<source>conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation>%1/desligado</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/não confirmada</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 confirmações</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Estado</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, transmitida através de %n nó</numerusform><numerusform>, transmitida através de %n nós</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Origem</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Gerado</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>De</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>Para</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>endereço próprio</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>rótulo</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Crédito</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>matura daqui por %n bloco</numerusform><numerusform>matura daqui por %n blocos</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>não aceite</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Débito</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Taxa de transação</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Valor líquido</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Mensagem</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>ID da Transação</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 510 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Informação de depuração</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Transação</translation>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation>Entradas</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Quantia</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>verdadeiro</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>falso</translation>
</message>
<message>
<location line="-211"/>
<source>, has not been successfully broadcast yet</source>
<translation>, ainda não foi transmitida com sucesso</translation>
</message>
<message>
<location line="+35"/>
<source>unknown</source>
<translation>desconhecido</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Detalhes da transação</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Esta janela mostra uma descrição detalhada da transação</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+226"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Tipo</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Endereço</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Quantia</translation>
</message>
<message>
<location line="+60"/>
<source>Open until %1</source>
<translation>Aberto até %1</translation>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Confirmada (%1 confirmações)</translation>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Aberta por mais %n bloco</numerusform><numerusform>Aberta por mais %n blocos</numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Este bloco não foi recebido por outros nós e provavelmente não será aceite pela rede!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Gerado mas não aceite</translation>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation>Recebido com</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Recebido de</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Enviado para</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Pagamento ao próprio</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Minadas</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(n/d)</translation>
</message>
<message>
<location line="+190"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Estado da transação. Pairar por cima deste campo para mostrar o número de confirmações.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Data e hora a que esta transação foi recebida.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Tipo de transação.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Endereço de destino da transação.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Quantia retirada ou adicionada ao saldo.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+55"/>
<location line="+16"/>
<source>All</source>
<translation>Todas</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Hoje</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Esta semana</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Este mês</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Mês passado</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Este ano</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Período...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Recebida com</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Enviada para</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Para si</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Minadas</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Outras</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Escreva endereço ou rótulo a procurar</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Quantia mínima</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Copiar endereço</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Copiar rótulo</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Copiar quantia</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Copiar ID da Transação</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Editar rótulo</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Mostrar detalhes da transação</translation>
</message>
<message>
<location line="+144"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Ficheiro separado por vírgula (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Confirmada</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Tipo</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Rótulo</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Endereço</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Quantia</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Período:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>até</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+206"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+33"/>
<source>LVGcoin version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation>Utilização:</translation>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or lvgcoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation>Listar comandos</translation>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation>Obter ajuda para um comando</translation>
</message>
<message>
<location line="+2"/>
<source>Options:</source>
<translation>Opções:</translation>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: LVGcoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: lvgcoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation>Especifique ficheiro de carteira (dentro da pasta de dados)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Especificar pasta de dados</translation>
</message>
<message>
<location line="+2"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Definir o tamanho da cache de base de dados em megabytes (por defeito: 25)</translation>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Listen for connections on <port> (default: 15714 or testnet: 25714)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Manter no máximo <n> ligações a outros nós da rede (por defeito: 125)</translation>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Ligar a um nó para recuperar endereços de pares, e desligar</translation>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation>Especifique o seu endereço público</translation>
</message>
<message>
<location line="+5"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Stake your coins to support network and gain reward (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Tolerância para desligar nós mal-formados (por defeito: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Número de segundos a impedir que nós mal-formados se liguem de novo (por defeito: 86400)</translation>
</message>
<message>
<location line="-44"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>Ocorreu um erro ao definir a porta %u do serviço RPC a escutar em IPv4: %s</translation>
</message>
<message>
<location line="+51"/>
<source>Detach block and address databases. Increases shutdown time (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+109"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>Listen for JSON-RPC connections on <port> (default: 15715 or testnet: 25715)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-11"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Aceitar comandos da consola e JSON-RPC</translation>
</message>
<message>
<location line="+101"/>
<source>Error: Transaction creation failed </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: Wallet locked, unable to create transaction </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-8"/>
<source>Importing blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Importing bootstrap blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-88"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Correr o processo como um daemon e aceitar comandos</translation>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation>Utilizar a rede de testes - testnet</translation>
</message>
<message>
<location line="-24"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Aceitar ligações externas (padrão: 1 sem -proxy ou -connect)</translation>
</message>
<message>
<location line="-38"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>Ocorreu um erro ao definir a porta %u do serviço RPC a escutar em IPv6, a usar IPv4: %s</translation>
</message>
<message>
<location line="+117"/>
<source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Atenção: -paytxfee está definida com um valor muito alto! Esta é a taxa que irá pagar se enviar uma transação.</translation>
</message>
<message>
<location line="+61"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong LVGcoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-31"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>Atenção: erro ao ler wallet.dat! Todas as chaves foram lidas correctamente, mas dados de transação ou do livro de endereços podem estar em falta ou incorrectos.</translation>
</message>
<message>
<location line="-18"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation>Atenção: wallet.dat corrupto, dados recuperados! wallet.dat original salvo como wallet.{timestamp}.bak em %s; se o seu saldo ou transações estiverem incorrectos deverá recuperar de uma cópia de segurança.</translation>
</message>
<message>
<location line="-30"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Tentar recuperar chaves privadas de um wallet.dat corrupto</translation>
</message>
<message>
<location line="+4"/>
<source>Block creation options:</source>
<translation>Opções de criação de bloco:</translation>
</message>
<message>
<location line="-62"/>
<source>Connect only to the specified node(s)</source>
<translation>Apenas ligar ao(s) nó(s) especificado(s)</translation>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Descobrir endereço IP próprio (padrão: 1 ao escutar e sem -externalip)</translation>
</message>
<message>
<location line="+94"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Falhou a escutar em qualquer porta. Use -listen=0 se quer isto.</translation>
</message>
<message>
<location line="-90"/>
<source>Find peers using DNS lookup (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync checkpoints policy (default: strict)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+83"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-82"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Armazenamento intermédio de recepção por ligação, <n>*1000 bytes (por defeito: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Armazenamento intermédio de envio por ligação, <n>*1000 bytes (por defeito: 1000)</translation>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Apenas ligar a nós na rede <net> (IPv4, IPv6 ou Tor)</translation>
</message>
<message>
<location line="+28"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation>Opções SSL: (ver a Wiki Bitcoin para instruções de configuração SSL)</translation>
</message>
<message>
<location line="-74"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Enviar informação de rastreio/depuração para a consola e não para o ficheiro debug.log</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Definir tamanho minímo de um bloco em bytes (por defeito: 0)</translation>
</message>
<message>
<location line="-29"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Encolher ficheiro debug.log ao iniciar o cliente (por defeito: 1 sem -debug definido)</translation>
</message>
<message>
<location line="-42"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Especificar tempo de espera da ligação em millisegundos (por defeito: 5000)</translation>
</message>
<message>
<location line="+109"/>
<source>Unable to sign checkpoint, wrong checkpointkey?
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Usar UPnP para mapear a porta de escuta (padrão: 0)</translation>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Usar UPnP para mapear a porta de escuta (padrão: 1 ao escutar)</translation>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Username for JSON-RPC connections</source>
<translation>Nome de utilizador para ligações JSON-RPC</translation>
</message>
<message>
<location line="+47"/>
<source>Verifying database integrity...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+57"/>
<source>WARNING: syncronized checkpoint violation detected, but skipped!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Atenção: Esta versão está obsoleta, é necessário actualizar!</translation>
</message>
<message>
<location line="-48"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corrupta, recuperação falhou</translation>
</message>
<message>
<location line="-54"/>
<source>Password for JSON-RPC connections</source>
<translation>Palavra-passe para ligações JSON-RPC</translation>
</message>
<message>
<location line="-84"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=LVGcoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "LVGcoin Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Find peers using internet relay chat (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Permitir ligações JSON-RPC do endereço IP especificado</translation>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Enviar comandos para o nó a correr em <ip> (por defeito: 127.0.0.1)</translation>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Executar comando quando mudar o melhor bloco (no comando, %s é substituído pela hash do bloco)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Executar comando quando uma das transações na carteira mudar (no comando, %s é substituído pelo ID da Transação)</translation>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation>Atualize a carteira para o formato mais recente</translation>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Definir o tamanho da memória de chaves para <n> (por defeito: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Reexaminar a cadeia de blocos para transações em falta na carteira</translation>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 2500, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external blk000?.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Usar OpenSSL (https) para ligações JSON-RPC</translation>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Ficheiro de certificado do servidor (por defeito: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Chave privada do servidor (por defeito: server.pem)</translation>
</message>
<message>
<location line="+1"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+53"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-158"/>
<source>This help message</source>
<translation>Esta mensagem de ajuda</translation>
</message>
<message>
<location line="+95"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot obtain a lock on data directory %s. LVGcoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-98"/>
<source>LVGcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+140"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Incapaz de vincular a %s neste computador (vínculo retornou erro %d, %s)</translation>
</message>
<message>
<location line="-130"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Permitir procuras DNS para -addnode, -seednode e -connect</translation>
</message>
<message>
<location line="+122"/>
<source>Loading addresses...</source>
<translation>Carregar endereços...</translation>
</message>
<message>
<location line="-15"/>
<source>Error loading blkindex.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Erro ao carregar wallet.dat: Carteira danificada</translation>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of LVGcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart LVGcoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation>Erro ao carregar wallet.dat</translation>
</message>
<message>
<location line="-16"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Endereço -proxy inválido: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Rede desconhecida especificada em -onlynet: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Versão desconhecida de proxy -socks requisitada: %i</translation>
</message>
<message>
<location line="+4"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Não conseguiu resolver endereço -bind: '%s'</translation>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Não conseguiu resolver endereço -externalip: '%s'</translation>
</message>
<message>
<location line="-24"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Quantia inválida para -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Error: could not start node</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation>Quantia inválida</translation>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation>Fundos insuficientes</translation>
</message>
<message>
<location line="-34"/>
<source>Loading block index...</source>
<translation>Carregar índice de blocos...</translation>
</message>
<message>
<location line="-103"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Adicione um nó ao qual se ligar e tentar manter a ligação aberta</translation>
</message>
<message>
<location line="+122"/>
<source>Unable to bind to %s on this computer. LVGcoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-97"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Loading wallet...</source>
<translation>Carregar carteira...</translation>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation>Impossível mudar a carteira para uma versão anterior</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot initialize keypool</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation>Impossível escrever endereço por defeito</translation>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation>Reexaminando...</translation>
</message>
<message>
<location line="+5"/>
<source>Done loading</source>
<translation>Carregamento completo</translation>
</message>
<message>
<location line="-167"/>
<source>To use the %s option</source>
<translation>Para usar a opção %s</translation>
</message>
<message>
<location line="+14"/>
<source>Error</source>
<translation>Erro</translation>
</message>
<message>
<location line="+6"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>Deverá definir rpcpassword=<password> no ficheiro de configuração:
%s
Se o ficheiro não existir, crie-o com permissões de leitura apenas para o dono.</translation>
</message>
</context>
</TS> | cryptographynetwork/LVGCoin | src/qt/locale/bitcoin_pt_PT.ts | TypeScript | mit | 119,243 | [
30522,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
1029,
1028,
1026,
999,
9986,
13874,
24529,
1028,
1026,
24529,
2653,
1027,
1000,
13866,
1035,
13866,
1000,
2544,
1027,
1000,
1016,
1012,
1015,
1000,
1028,
1026,
6123,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import unittest
import numpy as np
import theano
import theano.tensor as T
from tests.helpers import (SimpleTrainer, SimpleClf, SimpleTransformer,
simple_reg)
from theano_wrapper.layers import (BaseLayer, HiddenLayer, MultiLayerBase,
BaseEstimator, BaseTransformer,
LinearRegression, LogisticRegression,
MultiLayerPerceptron, MultiLayerRegression,
TiedAutoEncoder, AutoEncoder)
# BASE LAYERS ################################################################
class TestBaseLayer(unittest.TestCase):
""" Tests for layer.py module, which includes various types of layers
for theano-wrapper
"""
def test_base_layer_has_params(self):
base = BaseLayer(100, 10)
self.assertTrue(hasattr(base, 'params'),
msg="Class has no attribute 'parameters'")
def test_base_layer_params_not_empty(self):
base = BaseLayer(100, 10)
self.assertTrue(base.params, msg="Class 'parameters' are empty")
def test_base_layer_no_args(self):
# Test if BaseLayer initializes as expected when given no
# extra arguements
try:
BaseLayer(100, 10)
except Exception as e:
self.fail("Class initialization failed: %s" % str(e))
def test_base_layer_params_are_theano_shared_variables(self):
base = BaseLayer(100, 10)
for p in base.params:
self.assertIsInstance(p, theano.compile.SharedVariable)
def test_base_layer_has_input(self):
base = BaseLayer(100, 10)
self.assertTrue(hasattr(base, 'X'))
def test_base_layer_input_is_theano_variable(self):
base = BaseLayer(100, 10)
self.assertIsInstance(base.X, theano.tensor.TensorVariable)
def test_base_layer_weights_shape(self):
base = BaseLayer(100, 10)
self.assertEqual(base.W.get_value().shape, (100, 10))
def test_base_layer_bias_shape(self):
base = BaseLayer(100, 10)
self.assertEqual(base.b.get_value().shape, (10,))
def test_base_layer_weights_shape_single_output(self):
base = BaseLayer(100, 1)
self.assertEqual(base.W.get_value().shape, (100,))
def test_base_layer_bias_shape_single_output(self):
base = BaseLayer(100, 1)
self.assertEqual(base.b.get_value().shape, ())
def test_base_layer_no_output(self):
base = BaseLayer(100, 10)
self.assertFalse(hasattr(base, 'y'))
def test_base_layer_int_output(self):
base = BaseLayer(100, 10, y='int')
self.assertTrue(hasattr(base, 'y'))
self.assertTrue(hasattr(base.y, 'dtype'))
self.assertEqual(base.y.dtype, 'int32')
def test_base_layer_float_output(self):
base = BaseLayer(100, 10, y='float')
self.assertTrue(hasattr(base, 'y'))
self.assertTrue(hasattr(base.y, 'dtype'))
self.assertEqual(base.y.dtype, 'float32')
def test_base_layer_custom_weights(self):
try:
BaseLayer(100, 10, weights=np.random.random_sample((100, 10)))
except TypeError:
self.fail("Class did not accept 'weights' arg")
class TestHiddenLayer(unittest.TestCase):
""" Tests for HiddenLayer class.
This class is used only by other classes, so mostly basic stuff here.
"""
def test_hidden_layer_has_params(self):
base = HiddenLayer(100, 10)
self.assertTrue(hasattr(base, 'params'),
msg="Class has no attribute 'parameters'")
def test_hidden_layer_params_not_empty(self):
base = HiddenLayer(100, 10)
self.assertTrue(base.params, msg="Class 'parameters' are empty")
def test_hidden_layer_no_args(self):
# Test if HiddenLayer initializes as expected when given no
# extra arguements
try:
HiddenLayer(100, 10)
except Exception as e:
self.fail("Class initialization failed: %s" % str(e))
def test_hidden_layer_params_are_theano_shared_variables(self):
base = HiddenLayer(100, 10)
for p in base.params:
self.assertIsInstance(p, theano.compile.SharedVariable)
def test_hidden_layer_has_input(self):
base = HiddenLayer(100, 10)
self.assertTrue(hasattr(base, 'X'))
def test_hidden_layer_input_is_theano_variable(self):
base = HiddenLayer(100, 10)
self.assertIsInstance(base.X, theano.tensor.TensorVariable)
def test_hidden_layer_weights_shape(self):
base = HiddenLayer(100, 10)
self.assertEqual(base.W.get_value().shape, (100, 10))
def test_hidden_layer_bias_shape(self):
base = HiddenLayer(100, 10)
self.assertEqual(base.b.get_value().shape, (10,))
def test_hidden_layer_weights_shape_single_output(self):
base = HiddenLayer(100, 1)
self.assertEqual(base.W.get_value().shape, (100,))
def test_hidden_layer_bias_shape_single_output(self):
base = HiddenLayer(100, 1)
self.assertEqual(base.b.get_value().shape, ())
def test_hidden_layer_no_output(self):
base = HiddenLayer(100, 10)
self.assertFalse(hasattr(base, 'y'))
def test_hidden_layer_int_output(self):
base = HiddenLayer(100, 10, y='int')
self.assertTrue(hasattr(base, 'y'))
self.assertTrue(hasattr(base.y, 'dtype'))
self.assertEqual(base.y.dtype, 'int32')
def test_hidden_layer_float_output(self):
base = HiddenLayer(100, 10, y='float')
self.assertTrue(hasattr(base, 'y'))
self.assertTrue(hasattr(base.y, 'dtype'))
self.assertEqual(base.y.dtype, 'float32')
class TestMultiLayerBase(unittest.TestCase):
""" Tests for MultiLayerBase class """
def test_multi_layer_base_has_params(self):
base = MultiLayerBase(100, 50, 10, SimpleClf)
self.assertTrue(hasattr(base, 'params'),
msg="Class has no attribute 'parameters'")
def test_multi_layer_base_params_not_empty(self):
base = MultiLayerBase(100, 50, 10, SimpleClf)
self.assertTrue(base.params, msg="Class 'parameters' are empty")
def test_multi_layer_base_no_args(self):
# Test if MultiLayerBase initializes as expected when given no
# extra arguements
try:
MultiLayerBase(100, 50, 10, SimpleClf)
except Exception as e:
self.fail("Class initialization failed: %s" % str(e))
def test_multi_layer_base_single_layer(self):
# Test if MultiLayerBase initializes as expected when given no
# extra arguements
try:
MultiLayerBase(100, 50, 10, SimpleClf)
except Exception as e:
self.fail("Class initialization failed: %s" % str(e))
def test_multi_layer_base_multi_layer_single_activation(self):
# Test if MultiLayerBase initializes as expected when given no
# extra arguements
try:
MultiLayerBase(100, [100, 30, 50], 10, SimpleClf, lambda x: x)
except Exception as e:
self.fail("Class initialization failed: %s" % str(e))
def test_multi_layer_base_multi_layer_multi_activation(self):
# Test if MultiLayerBase initializes as expected when given no
# extra arguements
try:
MultiLayerBase(100, [100, 30, 50], 10, SimpleClf,
[lambda x: x for i in range(3)])
except Exception as e:
self.fail("Class initialization failed: %s" % str(e))
class BaseEstimatorTransformerTests:
def test_has_trainers(self):
clf = self.Clf()
for t in ['epoch', 'sgd']:
self.assertIn(t, clf.trainer_aliases)
def test_builtin_sgd_trainer(self):
clf = self.Clf()
try:
clf.fit(*self.fit_args, 'sgd', max_iter=1)
except Exception as e:
self.fail("Fitting failed: %s" % str(e))
def test_builtin_sgd_trainer_all_args(self):
clf = self.Clf()
try:
clf.fit(*self.fit_args, 'sgd', alpha=0.1, batch_size=20,
max_iter=1, patience=100, p_inc=3, imp_thresh=0.9,
random=10, verbose=1000)
except Exception as e:
self.fail("Fitting failed: %s" % str(e))
def test_builtin_trainer_regularizer(self):
clf = self.Clf()
reg = simple_reg(clf)
try:
clf.fit(*self.fit_args, reg=reg, max_iter=2)
except Exception as e:
self.fail("Fitting failed: %s" % str(e))
class TestBaseEstimator(unittest.TestCase, BaseEstimatorTransformerTests):
TheBase = BaseEstimator
TheClf = SimpleClf
X = np.random.standard_normal((500, 100)).astype(np.float32)
y = np.random.randint(0, 9, (500,)).astype(np.int32)
fit_args = (X, y,)
def setUp(self):
class Clf(self.TheClf, self.TheBase):
def __init__(*args, **kwargs):
SimpleClf.__init__(*args, **kwargs)
self.Clf = Clf
class TestBaseTransformer(unittest.TestCase, BaseEstimatorTransformerTests):
TheBase = BaseTransformer
TheClf = SimpleTransformer
X = np.random.standard_normal((500, 100)).astype(np.float32)
fit_args = (X,)
def setUp(self):
class Clf(self.TheClf, self.TheBase):
def __init__(*args, **kwargs):
self.TheClf.__init__(*args, **kwargs)
self.Clf = Clf
# ESTIMATORS #################################################################
class EstimatorTests:
X = np.random.standard_normal((500, 100)).astype(np.float32)
def test_estimator_has_params(self):
clf = self.estimator(*self.args)
self.assertTrue(hasattr(clf, 'params'))
self.assertIsNotNone(clf.params)
def test_estimator_has_output(self):
clf = self.estimator(*self.args)
self.assertIsInstance(clf.output, theano.tensor.TensorVariable)
def test_estimator_has_cost(self):
clf = self.estimator(*self.args)
self.assertIsInstance(clf.cost, theano.tensor.TensorVariable)
def test_estimator_fit(self):
trn = SimpleTrainer(self.estimator(*self.args))
try:
trn.fit(self.X, self.y)
except Exception as e:
self.fail("Training failed: %s" % str(e))
def test_estimator_with_regularization(self):
clf = self.estimator(*self.args)
reg = simple_reg(clf)
try:
trn = SimpleTrainer(clf, reg)
trn.fit(self.X, self.y)
except Exception as e:
self.fail("Estimator failed: %s" % str(e))
def test_estimator_builtin_fit(self):
clf = self.estimator(*self.args)
try:
clf.fit(self.X, self.y, max_iter=1)
except Exception as e:
self.fail("Estimator failed: %s" % str(e))
def test_estimator_builtin_predict(self):
clf = self.estimator(*self.args)
clf.fit(self.X, self.y, max_iter=1)
pred = clf.predict(self.X)
self.assertEqual(pred.shape, (self.X.shape[0],))
class MultiLayerEstimatorMixin:
def test_estimator_fit_three_hidden_single_activation(self):
args = list(self.args)
# set n_hidden arg to an array of n_nodes for three layers
args[1] = [args[0], int(args[0]/2), int(args[0]/3)]
trn = SimpleTrainer(self.estimator(*args))
try:
trn.fit(self.X, self.y)
except Exception as e:
self.fail("Training failed: %s" % str(e))
def test_estimator_random_arguement_int_seed(self):
# The estimator should accept a random arguement for initialization
# of weights. Here we test an integer seed.
trn = SimpleTrainer(self.estimator(*self.args, random=42))
try:
trn.fit(self.X, self.y)
except Exception as e:
self.fail("Training failed: %s" % str(e))
def test_estimator_random_arguement_rng(self):
# The estimator should accept a random arguement for initialization
# of weights. Here we test a random state generator
trn = SimpleTrainer(self.estimator(*self.args,
random=np.random.RandomState(42)))
try:
trn.fit(self.X, self.y)
except Exception as e:
self.fail("Training failed: %s" % str(e))
class ClassificationTest(EstimatorTests):
y = np.random.randint(0, 9, (500,)).astype(np.int32)
class RegressionTest(EstimatorTests):
y = np.random.random((500,)).astype(np.float32)
def test_estimator_fit_multivariate(self):
args = list(self.args)
args[-1] = 5
y = np.random.random((500, 5)).astype(np.float32)
trn = SimpleTrainer(self.estimator(*args))
try:
trn.fit(self.X, y)
except Exception as e:
self.fail("Training failed: %s" % str(e))
class TestLinearRegression(unittest.TestCase, RegressionTest):
estimator = LinearRegression
args = (100, 1)
class TestLogisticRegression(unittest.TestCase, ClassificationTest):
estimator = LogisticRegression
args = (100, 10)
class TestMultiLayerPerceptron(unittest.TestCase,
ClassificationTest, MultiLayerEstimatorMixin):
estimator = MultiLayerPerceptron
args = (100, 100, 10)
class TestMultiLayerRegression(unittest.TestCase,
RegressionTest, MultiLayerEstimatorMixin):
estimator = MultiLayerRegression
args = (100, 100, 1)
# TRANSFORMERS ###############################################################
class TransformerTests:
X = np.random.standard_normal((500, 100)).astype(np.float32)
def test_transformer_has_params(self):
clf = self.transformer(*self.args)
self.assertTrue(hasattr(clf, 'params'))
self.assertIsNotNone(clf.params)
def test_transformer_has_encode(self):
clf = self.transformer(*self.args)
self.assertIsInstance(clf.encode, theano.tensor.TensorVariable)
def test_transformer_has_cost(self):
clf = self.transformer(*self.args)
self.assertIsInstance(clf.cost, theano.tensor.TensorVariable)
def test_transformer_fit(self):
trn = SimpleTrainer(self.transformer(*self.args))
try:
trn.fit(self.X)
except Exception as e:
self.fail("Training failed: %s" % str(e))
def test_transformer_with_regularization(self):
clf = self.transformer(*self.args)
reg = simple_reg(clf)
try:
trn = SimpleTrainer(clf, reg)
trn.fit(self.X)
except Exception as e:
self.fail("Estimator failed: %s" % str(e))
def test_transfomer_float_n_hidden(self):
args = list(self.args)
args[-1] = 0.5
trn = SimpleTrainer(self.transformer(*args))
try:
trn.fit(self.X)
except Exception as e:
self.fail("Training failed: %s" % str(e))
def test_transformer_builtin_fit(self):
clf = self.transformer(*self.args)
try:
clf.fit(self.X, max_iter=1)
except Exception as e:
self.fail("Estimator failed: %s" % str(e))
def test_transformer_builtin_predict(self):
clf = self.transformer(*self.args)
clf.fit(self.X, max_iter=1)
pred = clf.predict(self.X)
self.assertEqual(pred.shape, (self.X.shape))
def test_transformer_builtin_transform(self):
clf = self.transformer(*self.args)
clf.fit(self.X, max_iter=1)
pred = clf.transform(self.X)
self.assertEqual(pred.shape, (self.X.shape[0], self.args[-1]))
class MultiLayerTransformerMixin:
def test_transformer_fit_three_hidden_single_activation(self):
args = list(self.args)
# set n_hidden arg to an array of n_nodes for three layers
args[1] = [args[0], int(args[0]/2), int(args[0]/3)]
trn = SimpleTrainer(self.transformer(*args))
try:
trn.fit(self.X)
except Exception as e:
self.fail("Training failed: %s" % str(e))
def test_transformer_fit_three_hidden_all_activations(self):
args = list(self.args)
# set n_hidden arg to an array of n_nodes for three layers
args[1] = [args[0], int(args[0]/2), int(args[0]/3)]
activation = [T.nnet.sigmoid, T.nnet.softplus, T.nnet.softmax,
T.nnet.sigmoid]
trn = SimpleTrainer(self.transformer(*args, activation))
try:
trn.fit(self.X)
except Exception as e:
self.fail("Training failed: %s" % str(e))
def test_transformer_random_arguement_int_seed(self):
# The transformer should accept a random arguement for initialization
# of weights. Here we test an integer seed.
trn = SimpleTrainer(self.transformer(*self.args, random=42))
try:
trn.fit(self.X)
except Exception as e:
self.fail("Training failed: %s" % str(e))
def test_transformer_random_arguement_rng(self):
# The transformer should accept a random arguement for initialization
# of weights. Here we test a random state generator
trn = SimpleTrainer(self.transformer(*self.args,
random=np.random.RandomState(42)))
try:
trn.fit(self.X)
except Exception as e:
self.fail("Training failed: %s" % str(e))
class TestTiedAutoEncoder(unittest.TestCase, TransformerTests):
transformer = TiedAutoEncoder
args = (100, 50)
class TestAutoEncoder(unittest.TestCase, TransformerTests,
MultiLayerTransformerMixin):
transformer = AutoEncoder
args = (100, 50)
def test_cost_cross_entropy(self):
try:
trn = SimpleTrainer(self.transformer(*self.args,
cost='cross_entropy'))
trn.fit(self.X)
except Exception as e:
self.fail("Training failed: %s" % str(e))
def test_denoising_mode(self):
try:
trn = SimpleTrainer(self.transformer(*self.args,
corrupt=0.1))
trn.fit(self.X)
except Exception as e:
self.fail("Training failed: %s" % str(e))
| sotlampr/theano-wrapper | tests/test_layers.py | Python | mit | 18,340 | [
30522,
12324,
3131,
22199,
12324,
16371,
8737,
2100,
2004,
27937,
12324,
1996,
6761,
12324,
1996,
6761,
1012,
23435,
2004,
1056,
2013,
5852,
1012,
2393,
2545,
12324,
1006,
3722,
23654,
2121,
1010,
3722,
20464,
2546,
1010,
3722,
6494,
3619,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace siigap\FichasBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use siigap\FichasBundle\Form\ConsultaPersonasType;
use siigap\FichasBundle\Form\ConsultaViviendasType;
use siigap\FichasBundle\Form\ConsultaFichasType;
class ConsultasController extends Controller
{
public function consultaFichasAction(Request $request)
{
$form = $this->createForm(new ConsultaFichasType(), array());
return $this->render('siigapFichasBundle:Consultas:consultaFichas.html.twig', array('form'=>$form->createView()));
}
public function consultaFichasShowAction(Request $request)
{
$form = $this->createForm(new ConsultaFichasType(), array());
$form->handleRequest($request);
if ($form->isValid())
{
$results = $this->getDoctrine()->getRepository('siigapMainBundle:TsgFichasIdentificacion')->getFiltroFichas($form, $this->getUser()->getGobierno());
return $this->render('siigapFichasBundle:Consultas:consultaFichasShow.html.twig', array(
'datos' => $results['resultQuery']
));
}
else
{
$errors = array();
$errors[]['message'] = 'Se ha producido un error desconocido. Es probable una manipulación deliberada de los datos. '.$form->getErrorsAsString();
return $this->render('siigapMainBundle:Default:errores.html.twig', array('errors'=>$errors));
}
}
public function consultaViviendasAction(Request $request)
{
$options = array('codigoGeografico'=>$this->getUser()->getGobierno()->getCodigoGeografico());
$form = $this->createForm(new ConsultaViviendasType($options), array());
return $this->render('siigapFichasBundle:Consultas:consultaViviendas.html.twig', array('form'=>$form->createView()));
}
public function consultaViviendasShowAction(Request $request)
{
$options = array('codigoGeografico'=>$this->getUser()->getGobierno()->getCodigoGeografico());
$form = $this->createForm(new ConsultaViviendasType($options), array());
$form->handleRequest($request);
if ($form->isValid())
{
$results = $this->getDoctrine()->getRepository('siigapMainBundle:TsgViviendas')->getFiltroViviendas($form, $this->getUser()->getGobierno());
$datos = array();
$i = 0;
foreach($results['resultQuery'] as $dato)
{
$datos[$i]['codigoVivienda'] = $dato->getCodigoVivienda();
$datos[$i]['geograficoMinimo'] = $dato->getGeograficoMinimo();//$this->getLocalidadMinima($dato->getGeograficoMinimo());
$datos[$i]['tipoConstruccion'] = $dato->getTipoConstruccion();
$datos[$i]['esMiduvi'] = ($dato->getEsMiduvi()) ? 'SI' : 'NO';
$datos[$i]['totalPersonas'] = count($dato->getPersonas());
$datos[$i]['idFicha'] = $dato->getFichaIdentificacion()->getId();
$datos[$i]['numeroFicha'] = $dato->getFichaIdentificacion()->getNumeroFicha();
$i++;
}
return $this->render('siigapFichasBundle:Consultas:consultaViviendasShow.html.twig', array(
'datos' => $datos
));
}
else
{
$errors = array();
$errors[]['message'] = 'Se ha producido un error desconocido. Es probable una manipulación deliberada de los datos. '.$form->getErrorsAsString();
return $this->render('siigapMainBundle:Default:errores.html.twig', array('errors'=>$errors));
}
}
private function getLocalidadMinima($geograficoMinimo)
{
$result = '';
if ($geograficoMinimo->getPadre())
{
$result .= $geograficoMinimo->getPadre()->getNombre();
}
if ($geograficoMinimo->getPadre()->getPadre())
{
$result .= ' - '.$geograficoMinimo->getPadre()->getPadre()->getNombre();
}
$result .= ($result <> '') ? ' - '.$geograficoMinimo->getNombre() : $geograficoMinimo->getNombre();
return $result;
}
public function consultaPersonasAction(Request $request)
{
$form = $this->createForm(new ConsultaPersonasType(), array());
return $this->render('siigapFichasBundle:Consultas:consultaPersonas.html.twig', array('form'=>$form->createView()));
}
public function consultaPersonasShowAction(Request $request)
{
$form = $this->createForm(new ConsultaPersonasType(), array());
$form->handleRequest($request);
if ($form->isValid())
{
$results = $this->getDoctrine()->getRepository('siigapMainBundle:TsgPersonasVivienda')->getFiltroPersonas($form, $this->getUser()->getGobierno());
return $this->render('siigapFichasBundle:Consultas:consultaPersonasShow.html.twig', array(
'datos' => $results['resultQuery']
));
}
else
{
$errors = array();
$errors[]['message'] = 'Se ha producido un error desconocido. Es probable una manipulación deliberada de los datos. '.$form->getErrorsAsString();
return $this->render('siigapMainBundle:Default:errores.html.twig', array('errors'=>$errors));
}
}
public function consultaGrupoAtencionShowAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$nick = $request->get('name');
$grupoAtencion = $this->getDoctrine()->getRepository('siigapMainBundle:TsgGruposAtencion')->findOneByNick($nick);
if (!$grupoAtencion)
{
throw $this->createNotFoundException('No se encontro el grupo de atencion solicitado.');
}
$repository = $em->getRepository('siigapMainBundle:TsgPersonasVivienda');
$query = $repository->createQueryBuilder('tsp')
->innerJoin('tsp.grupoAtencion', 'tga')
->where('tga.id = :grupoAtencion')->setParameter('grupoAtencion', $grupoAtencion)
->getQuery();
$datos = $query->getResult();
return $this->render('siigapFichasBundle:Consultas:consultaPersonasShow.html.twig', array(
'datos' => $datos
));
}
public function consultaFichaCompletaShowAction(Request $request)
{
$id = $request->get('id');
$fichaIdentificacion = $this->getDoctrine()->getRepository('siigapMainBundle:TsgFichasIdentificacion')->findOneById($id);
if (!$fichaIdentificacion)
{
throw $this->createNotFoundException('No se encontron los datos solicitados.');
}
$existeVivienda = ($fichaIdentificacion->getVivienda()) ? true : false;
return $this->render('siigapFichasBundle:Consultas:fichaCompletaShow.html.twig', array(
'fichaIdentificacion' => $fichaIdentificacion,
'existeVivienda' => $existeVivienda
));
}
}
| isabelmonterob/iframe | src/siigap/FichasBundle/Controller/ConsultasController.php | PHP | mit | 7,249 | [
30522,
1026,
1029,
25718,
3415,
15327,
9033,
13340,
2361,
1032,
10882,
7507,
19022,
8630,
2571,
1032,
11486,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
14012,
1032,
7705,
27265,
2571,
1032,
11486,
1032,
11486,
1025,
2224,
25353,
2213,
14876,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>basic_socket::remote_endpoint (1 of 2 overloads)</title>
<link rel="stylesheet" href="../../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" href="../../../../boost_asio.html" title="Boost.Asio">
<link rel="up" href="../remote_endpoint.html" title="basic_socket::remote_endpoint">
<link rel="prev" href="../remote_endpoint.html" title="basic_socket::remote_endpoint">
<link rel="next" href="overload2.html" title="basic_socket::remote_endpoint (2 of 2 overloads)">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../remote_endpoint.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../remote_endpoint.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../boost_asio.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="overload2.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h5 class="title">
<a name="boost_asio.reference.basic_socket.remote_endpoint.overload1"></a><a class="link" href="overload1.html" title="basic_socket::remote_endpoint (1 of 2 overloads)">
basic_socket::remote_endpoint (1 of 2 overloads)</a>
</h5></div></div></div>
<p>
Get the remote endpoint of the socket.
</p>
<pre class="programlisting"><span class="identifier">endpoint_type</span> <span class="identifier">remote_endpoint</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
</pre>
<p>
This function is used to obtain the remote endpoint of the socket.
</p>
<a name="boost_asio.reference.basic_socket.remote_endpoint.overload1.return_value"></a><h6>
<a name="id2996791"></a>
<a class="link" href="overload1.html#boost_asio.reference.basic_socket.remote_endpoint.overload1.return_value">Return
Value</a>
</h6>
<p>
An object that represents the remote endpoint of the socket.
</p>
<a name="boost_asio.reference.basic_socket.remote_endpoint.overload1.exceptions"></a><h6>
<a name="id2996818"></a>
<a class="link" href="overload1.html#boost_asio.reference.basic_socket.remote_endpoint.overload1.exceptions">Exceptions</a>
</h6>
<div class="variablelist">
<p class="title"><b></b></p>
<dl>
<dt><span class="term">boost::system::system_error</span></dt>
<dd><p>
Thrown on failure.
</p></dd>
</dl>
</div>
<a name="boost_asio.reference.basic_socket.remote_endpoint.overload1.example"></a><h6>
<a name="id2996860"></a>
<a class="link" href="overload1.html#boost_asio.reference.basic_socket.remote_endpoint.overload1.example">Example</a>
</h6>
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">io_service</span><span class="special">);</span>
<span class="special">...</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">endpoint</span> <span class="identifier">endpoint</span> <span class="special">=</span> <span class="identifier">socket</span><span class="special">.</span><span class="identifier">remote_endpoint</span><span class="special">();</span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003 - 2008 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../remote_endpoint.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../remote_endpoint.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../boost_asio.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="overload2.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| scs/uclinux | lib/boost/boost_1_38_0/doc/html/boost_asio/reference/basic_socket/remote_endpoint/overload1.html | HTML | gpl-2.0 | 5,663 | [
30522,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
11163,
1011,
6070,
28154,
1011,
1015,
1000,
1028,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* 100% stacked area are multi-series area charts where categories are stacked (percentage
* values) on top of each other, with an additional category 'Others' that is used to sum
* up the various categories for each series to a perfect 100%.
*/
Ext.define('KitchenSink.view.charts.area.Stacked100', {
extend: 'Ext.Panel',
xtype: 'area-stacked-100',
controller: 'area-stacked-100',
// <example>
// Content between example tags is omitted from code preview.
bodyStyle: 'background: transparent !important',
layout: {
type: 'vbox',
pack: 'center'
},
otherContent: [{
type: 'Controller',
path: 'classic/samples/view/charts/area/Stacked100Controller.js'
}, {
type: 'Store',
path: 'classic/samples/store/Browsers.js'
}],
// </example>
width: 650,
tbar: [
'->',
{
text: 'Preview',
handler: 'onPreview'
}
],
items: [{
xtype: 'cartesian',
reference: 'chart',
width: '100%',
height: 500,
insetPadding: 40,
store: {
type: 'browsers'
},
legend: {
docked: 'bottom'
},
sprites: [{
type: 'text',
text: 'Area Charts - 100% Stacked Area',
fontSize: 22,
width: 100,
height: 30,
x: 40, // the sprite x position
y: 20 // the sprite y position
}, {
type: 'text',
text: 'Data: Browser Stats 2012',
fontSize: 10,
x: 12,
y: 420
}, {
type: 'text',
text: 'Source: http://www.w3schools.com/',
fontSize: 10,
x: 12,
y: 435
}],
axes: [{
type: 'numeric',
position: 'left',
fields: ['data1', 'data2', 'data3', 'data4', 'other' ],
grid: true,
minimum: 0,
maximum: 100,
renderer: 'onAxisLabelRender'
}, {
type: 'category',
position: 'bottom',
fields: 'month',
grid: true,
label: {
rotate: {
degrees: -45
}
}
}],
series: [{
type: 'area',
fullStack: true,
title: [ 'IE', 'Firefox', 'Chrome', 'Safari', 'Others' ],
xField: 'month',
yField: [ 'data1', 'data2', 'data3', 'data4', 'other' ],
style: {
opacity: 0.80
},
marker: {
opacity: 0,
scaling: 0.01,
fx: {
duration: 200,
easing: 'easeOut'
}
},
highlightCfg: {
opacity: 1,
scaling: 1.5
},
tooltip: {
trackMouse: true,
renderer: 'onSeriesTooltipRender'
}
}]
//<example>
}, {
style: 'margin-top: 10px;',
xtype: 'gridpanel',
columns : {
defaults: {
sortable: false,
menuDisabled: true,
renderer: 'onColumnRender'
},
items: [
{ text: 'Month', dataIndex: 'month', renderer: Ext.identityFn },
{ text: 'IE', dataIndex: 'data1' },
{ text: 'Firefox', dataIndex: 'data2' },
{ text: 'Chrome', dataIndex: 'data3' },
{ text: 'Safari', dataIndex: 'data4' },
{ text: 'Other', dataIndex: 'other' }
]
},
store: {
type: 'browsers'
},
width: '100%'
//</example>
}]
});
| gedOHub/GClientGUI | ext/examples/kitchensink/classic/samples/view/charts/area/Stacked100.js | JavaScript | gpl-3.0 | 3,841 | [
30522,
1013,
1008,
1008,
1008,
2531,
1003,
16934,
2181,
2024,
4800,
1011,
2186,
2181,
6093,
2073,
7236,
2024,
16934,
1006,
7017,
1008,
5300,
1007,
2006,
2327,
1997,
2169,
2060,
1010,
2007,
2019,
3176,
4696,
1005,
2500,
1005,
2008,
2003,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Класс-помощник для работы с сессией
class SessionHelper:
def __init__(self, app):
self.app = app
# Функция входа на сайт
def login(self, username, password):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_by_name("user").send_keys(username)
wd.find_element_by_name("pass").click()
wd.find_element_by_name("pass").clear()
wd.find_element_by_name("pass").send_keys(password)
wd.find_element_by_xpath("//form[@id='LoginForm']/input[3]").click()
# Функция выхода с сайта
def logout(self):
wd = self.app.wd
wd.find_element_by_link_text("Logout").click()
# Функция удаления фикстуры после завершения теста
def destroy(self):
self.app.wd.quit()
# Функция проверки выхода с сайта
def ensure_logout(self):
wd = self.app.wd
if self.is_logged_in():
self.logout()
# Функция проверки входа на сайт
def is_logged_in(self):
wd = self.app.wd
# Если на странице есть элемент с текстом "Logout", то пользователь вошел на сайт
return len(wd.find_elements_by_link_text("Logout")) > 0
# Функция проверки имени с которым произошел вход на сайт
def is_logged_in_as(self, username):
wd = self.app.wd
# Если на странице есть элемент с текстом который соответсвует имени пользователя, то есть логин
return wd.find_element_by_xpath("//div/div[1]/form/b").text == "("+username+")"
# Функция проверки логина во время прогона тестов
def ensure_login(self, username, password):
wd = self.app.wd
# Если пользователь вошел на сайт
if self.is_logged_in():
# И если пользователь вошел на сайт под ожидаемым именем
if self.is_logged_in_as(username):
# Тогда ничего не делаем
return
else:
# Иначе производим выход с сайта, для последующего входа
self.logout()
self.login(username, password) | kochetov-a/python_training | fixture/session.py | Python | apache-2.0 | 2,654 | [
30522,
1001,
1189,
29436,
10260,
29747,
29747,
1011,
1194,
14150,
29745,
14150,
29754,
18947,
10325,
23925,
1184,
29436,
17432,
1195,
10260,
29740,
14150,
22919,
29113,
1196,
1196,
15290,
29747,
29747,
10325,
15290,
10325,
2465,
5219,
16001,
48... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2010-2013 The SINA WEIBO Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.joy.library.share.weibo.openapi.legacy;
import android.content.Context;
import com.sina.weibo.sdk.auth.Oauth2AccessToken;
import com.sina.weibo.sdk.net.RequestListener;
import com.sina.weibo.sdk.net.WeiboParameters;
import com.joy.library.share.weibo.openapi.AbsOpenAPI;
/**
* 该类封装了标签接口。
* 详情请参考<a href="http://t.cn/8F1nHUA">标签接口</a>
*
* @author SINA
* @date 2014-03-03
*/
public class TagsAPI extends AbsOpenAPI {
public TagsAPI(Context context, String appKey, Oauth2AccessToken accessToken) {
super(context, appKey, accessToken);
}
private static final String SERVER_URL_PRIX = API_SERVER + "/tags";
/**
* 返回指定用户的标签列表。
*
* @param uid 要获取的标签列表所属的用户ID
* @param count 单页返回的记录条数,默认为20
* @param page 返回结果的页码,默认为1
* @param listener 异步请求回调接口
*/
public void tags(long uid, int count, int page, RequestListener listener) {
WeiboParameters params = new WeiboParameters(mAppKey);
params.put("uid", uid);
params.put("count", count);
params.put("page", page);
requestAsync(SERVER_URL_PRIX + ".json", params, HTTPMETHOD_GET, listener);
}
/**
* 批量获取用户的标签列表。
*
* @param uids 要获取标签的用户ID。最大20
* @param listener 异步请求回调接口
*/
public void tagsBatch(String[] uids, RequestListener listener) {
WeiboParameters params = new WeiboParameters(mAppKey);
StringBuilder strb = new StringBuilder();
for (String uid : uids) {
strb.append(uid).append(",");
}
strb.deleteCharAt(strb.length() - 1);
params.put("uids", strb.toString());
requestAsync(SERVER_URL_PRIX + "/tags_batch.json", params, HTTPMETHOD_GET, listener);
}
/**
* 获取系统推荐的标签列表。
*
* @param count 返回记录数,默认10,最大10
* @param listener 异步请求回调接口
*/
public void suggestions(int count, RequestListener listener) {
WeiboParameters params = new WeiboParameters(mAppKey);
params.put("count", count);
requestAsync(SERVER_URL_PRIX + "/suggestions.json", params, HTTPMETHOD_GET, listener);
}
/**
* 为当前登录用户添加新的用户标签(无论调用该接口次数多少,每个用户最多可以创建10个标签)。
*
* @param tags 要创建的一组标签,每个标签的长度不可超过7个汉字,14个半角字符
* @param listener 异步请求回调接口
*/
public void create(String[] tags, RequestListener listener) {
WeiboParameters params = new WeiboParameters(mAppKey);
StringBuilder strb = new StringBuilder();
for (String tag : tags) {
strb.append(tag).append(",");
}
strb.deleteCharAt(strb.length() - 1);
params.put("tags", strb.toString());
requestAsync(SERVER_URL_PRIX + "/create.json", params, HTTPMETHOD_POST, listener);
}
/**
* 删除一个用户标签。
*
* @param tag_id 要删除的标签ID
* @param listener 异步请求回调接口
*/
public void destroy(long tag_id, RequestListener listener) {
WeiboParameters params = new WeiboParameters(mAppKey);
params.put("tag_id", tag_id);
requestAsync(SERVER_URL_PRIX + "/destroy.json", params, HTTPMETHOD_POST, listener);
}
/**
* 批量删除一组标签。
*
* @param ids 要删除的一组标签ID,一次最多提交10个ID
* @param listener 异步请求回调接口
*/
public void destroyBatch(String[] ids, RequestListener listener) {
WeiboParameters params = new WeiboParameters(mAppKey);
StringBuilder strb = new StringBuilder();
for (String id : ids) {
strb.append(id).append(",");
}
strb.deleteCharAt(strb.length() - 1);
params.put("ids", strb.toString());
requestAsync(SERVER_URL_PRIX + "/destroy_batch.json", params, HTTPMETHOD_POST, listener);
}
}
| joy-inc/joy-library | library-joy/src/main/java/com/joy/library/share/weibo/openapi/legacy/TagsAPI.java | Java | apache-2.0 | 4,888 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
1011,
2286,
1996,
8254,
2050,
11417,
5092,
2330,
3120,
2622,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import axios from 'axios';
export default axios.create({
baseURL: 'http://localhost:9000/v1/'
}); | FrederikS/das-blog-frontend | app/http/client.js | JavaScript | mit | 102 | [
30522,
12324,
22260,
10735,
2013,
1005,
22260,
10735,
1005,
1025,
9167,
12398,
22260,
10735,
1012,
3443,
1006,
1063,
2918,
3126,
2140,
1024,
1005,
8299,
1024,
1013,
1013,
2334,
15006,
2102,
1024,
7706,
2692,
1013,
1058,
2487,
1013,
1005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @(#)HeaderTokenizer.java 1.9 02/03/27
*/
package com.sun.xml.internal.messaging.saaj.packaging.mime.internet;
/**
* This class tokenizes RFC822 and MIME headers into the basic
* symbols specified by RFC822 and MIME. <p>
*
* This class handles folded headers (ie headers with embedded
* CRLF SPACE sequences). The folds are removed in the returned
* tokens.
*
* @version 1.9, 02/03/27
* @author John Mani
*/
public class HeaderTokenizer {
/**
* The Token class represents tokens returned by the
* HeaderTokenizer.
*/
public static class Token {
private int type;
private String value;
/**
* Token type indicating an ATOM.
*/
public static final int ATOM = -1;
/**
* Token type indicating a quoted string. The value
* field contains the string without the quotes.
*/
public static final int QUOTEDSTRING = -2;
/**
* Token type indicating a comment. The value field
* contains the comment string without the comment
* start and end symbols.
*/
public static final int COMMENT = -3;
/**
* Token type indicating end of input.
*/
public static final int EOF = -4;
/**
* Constructor.
* @param type Token type
* @param value Token value
*/
public Token(int type, String value) {
this.type = type;
this.value = value;
}
/**
* Return the type of the token. If the token represents a
* delimiter or a control character, the type is that character
* itself, converted to an integer. Otherwise, it's value is
* one of the following:
* <ul>
* <li><code>ATOM</code> A sequence of ASCII characters
* delimited by either SPACE, CTL, "(", <"> or the
* specified SPECIALS
* <li><code>QUOTEDSTRING</code> A sequence of ASCII characters
* within quotes
* <li><code>COMMENT</code> A sequence of ASCII characters
* within "(" and ")".
* <li><code>EOF</code> End of header
* </ul>
*/
public int getType() {
return type;
}
/**
* Returns the value of the token just read. When the current
* token is a quoted string, this field contains the body of the
* string, without the quotes. When the current token is a comment,
* this field contains the body of the comment.
*
* @return token value
*/
public String getValue() {
return value;
}
}
private String string; // the string to be tokenized
private boolean skipComments; // should comments be skipped ?
private String delimiters; // delimiter string
private int currentPos; // current parse position
private int maxPos; // string length
private int nextPos; // track start of next Token for next()
private int peekPos; // track start of next Token for peek()
/**
* RFC822 specials
*/
public final static String RFC822 = "()<>@,;:\\\"\t .[]";
/**
* MIME specials
*/
public final static String MIME = "()<>@,;:\\\"\t []/?=";
// The EOF Token
private final static Token EOFToken = new Token(Token.EOF, null);
/**
* Constructor that takes a rfc822 style header.
*
* @param header The rfc822 header to be tokenized
* @param delimiters Set of delimiter characters
* to be used to delimit ATOMS. These
* are usually <code>RFC822</code> or
* <code>MIME</code>
* @param skipComments If true, comments are skipped and
* not returned as tokens
*/
public HeaderTokenizer(String header, String delimiters,
boolean skipComments) {
string = (header == null) ? "" : header; // paranoia ?!
this.skipComments = skipComments;
this.delimiters = delimiters;
currentPos = nextPos = peekPos = 0;
maxPos = string.length();
}
/**
* Constructor. Comments are ignored and not returned as tokens
*
* @param header The header that is tokenized
* @param delimiters The delimiters to be used
*/
public HeaderTokenizer(String header, String delimiters) {
this(header, delimiters, true);
}
/**
* Constructor. The RFC822 defined delimiters - RFC822 - are
* used to delimit ATOMS. Also comments are skipped and not
* returned as tokens
*/
public HeaderTokenizer(String header) {
this(header, RFC822);
}
/**
* Parses the next token from this String. <p>
*
* Clients sit in a loop calling next() to parse successive
* tokens until an EOF Token is returned.
*
* @return the next Token
* @exception ParseException if the parse fails
*/
public Token next() throws ParseException {
Token tk;
currentPos = nextPos; // setup currentPos
tk = getNext();
nextPos = peekPos = currentPos; // update currentPos and peekPos
return tk;
}
/**
* Peek at the next token, without actually removing the token
* from the parse stream. Invoking this method multiple times
* will return successive tokens, until <code>next()</code> is
* called. <p>
*
* @return the next Token
* @exception ParseException if the parse fails
*/
public Token peek() throws ParseException {
Token tk;
currentPos = peekPos; // setup currentPos
tk = getNext();
peekPos = currentPos; // update peekPos
return tk;
}
/**
* Return the rest of the Header.
*
* @return String rest of header. null is returned if we are
* already at end of header
*/
public String getRemainder() {
return string.substring(nextPos);
}
/*
* Return the next token starting from 'currentPos'. After the
* parse, 'currentPos' is updated to point to the start of the
* next token.
*/
private Token getNext() throws ParseException {
// If we're already at end of string, return EOF
if (currentPos >= maxPos)
return EOFToken;
// Skip white-space, position currentPos beyond the space
if (skipWhiteSpace() == Token.EOF)
return EOFToken;
char c;
int start;
boolean filter = false;
c = string.charAt(currentPos);
// Check or Skip comments and position currentPos
// beyond the comment
while (c == '(') {
// Parsing comment ..
int nesting;
for (start = ++currentPos, nesting = 1;
nesting > 0 && currentPos < maxPos;
currentPos++) {
c = string.charAt(currentPos);
if (c == '\\') { // Escape sequence
currentPos++; // skip the escaped character
filter = true;
} else if (c == '\r')
filter = true;
else if (c == '(')
nesting++;
else if (c == ')')
nesting--;
}
if (nesting != 0)
throw new ParseException("Unbalanced comments");
if (!skipComments) {
// Return the comment, if we are asked to.
// Note that the comment start & end markers are ignored.
String s;
if (filter) // need to go thru the token again.
s = filterToken(string, start, currentPos-1);
else
s = string.substring(start,currentPos-1);
return new Token(Token.COMMENT, s);
}
// Skip any whitespace after the comment.
if (skipWhiteSpace() == Token.EOF)
return EOFToken;
c = string.charAt(currentPos);
}
// Check for quoted-string and position currentPos
// beyond the terminating quote
if (c == '"') {
for (start = ++currentPos; currentPos < maxPos; currentPos++) {
c = string.charAt(currentPos);
if (c == '\\') { // Escape sequence
currentPos++;
filter = true;
} else if (c == '\r')
filter = true;
else if (c == '"') {
currentPos++;
String s;
if (filter)
s = filterToken(string, start, currentPos-1);
else
s = string.substring(start,currentPos-1);
return new Token(Token.QUOTEDSTRING, s);
}
}
throw new ParseException("Unbalanced quoted string");
}
// Check for SPECIAL or CTL
if (c < 040 || c >= 0177 || delimiters.indexOf(c) >= 0) {
currentPos++; // re-position currentPos
char ch[] = new char[1];
ch[0] = c;
return new Token((int)c, new String(ch));
}
// Check for ATOM
for (start = currentPos; currentPos < maxPos; currentPos++) {
c = string.charAt(currentPos);
// ATOM is delimited by either SPACE, CTL, "(", <">
// or the specified SPECIALS
if (c < 040 || c >= 0177 || c == '(' || c == ' ' ||
c == '"' || delimiters.indexOf(c) >= 0)
break;
}
return new Token(Token.ATOM, string.substring(start, currentPos));
}
// Skip SPACE, HT, CR and NL
private int skipWhiteSpace() {
char c;
for (; currentPos < maxPos; currentPos++)
if (((c = string.charAt(currentPos)) != ' ') &&
(c != '\t') && (c != '\r') && (c != '\n'))
return currentPos;
return Token.EOF;
}
/* Process escape sequences and embedded LWSPs from a comment or
* quoted string.
*/
private static String filterToken(String s, int start, int end) {
StringBuffer sb = new StringBuffer();
char c;
boolean gotEscape = false;
boolean gotCR = false;
for (int i = start; i < end; i++) {
c = s.charAt(i);
if (c == '\n' && gotCR) {
// This LF is part of an unescaped
// CRLF sequence (i.e, LWSP). Skip it.
gotCR = false;
continue;
}
gotCR = false;
if (!gotEscape) {
// Previous character was NOT '\'
if (c == '\\') // skip this character
gotEscape = true;
else if (c == '\r') // skip this character
gotCR = true;
else // append this character
sb.append(c);
} else {
// Previous character was '\'. So no need to
// bother with any special processing, just
// append this character
sb.append(c);
gotEscape = false;
}
}
return sb.toString();
}
}
| samskivert/ikvm-openjdk | build/linux-amd64/impsrc/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/HeaderTokenizer.java | Java | gpl-2.0 | 12,766 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2384,
1010,
2294,
1010,
14721,
1998,
1013,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
2079,
2025,
11477,
2030,
6366,
9385,
14444,
2030,
2023,
5371,
20346,
1012,
1008,
1008,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!-- Change some CSS. -->
<style>
/* Change thickness of horizontal rule line. */
hr {
border : none;
height : 71px;
background : url(images/hr.png) 50% 0 no-repeat;
margin : 1em 0;
}
h1 {text-shadow:#888 2px 2px 3px;}
h2 {text-shadow:#888 1px 1px 2px;}
h3 {text-shadow:#666 1px 1px 2px;}
/*
h1:first-child:first-letter {
color: #903;
float: left;
font-family: Georgia;
font-size: 24px;
line-height: 70px;
}
thick
*/
#toc.toc2{
outline: #006eee dotted;
background-color: #ffe4c4;
}
</style>
<!-- We could also include Javascript for example in this document. -->
| jnorthr/DoctorPepper | src/docs/asciidoc/docinfo.html | HTML | apache-2.0 | 612 | [
30522,
1026,
999,
1011,
1011,
2689,
2070,
20116,
2015,
1012,
1011,
1011,
1028,
1026,
2806,
1028,
1013,
1008,
2689,
14983,
1997,
9876,
3627,
2240,
1012,
1008,
1013,
17850,
1063,
3675,
1024,
3904,
1025,
4578,
1024,
6390,
2361,
2595,
1025,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "meshToMesh0.H"
#include "volFields.H"
#include "interpolationCellPoint.H"
#include "SubField.H"
#include "mixedFvPatchField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, class CombineOp>
void Foam::meshToMesh0::mapField
(
Field<Type>& toF,
const Field<Type>& fromVf,
const labelList& adr,
const CombineOp& cop
) const
{
// Direct mapping of nearest-cell values
forAll(toF, celli)
{
if (adr[celli] != -1)
{
cop(toF[celli], fromVf[adr[celli]]);
}
}
// toF.map(fromVf, adr);
}
template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
const labelListList& adr,
const scalarListList& weights,
const CombineOp& cop
) const
{
// Inverse volume weighted interpolation
forAll(toF, celli)
{
const labelList& overlapCells = adr[celli];
const scalarList& w = weights[celli];
Type f = Zero;
forAll(overlapCells, i)
{
label fromCelli = overlapCells[i];
f += fromVf[fromCelli]*w[i];
cop(toF[celli], f);
}
}
}
template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
const labelList& adr,
const scalarListList& weights,
const CombineOp& cop
) const
{
// Inverse distance weighted interpolation
// get reference to cellCells
const labelListList& cc = fromMesh_.cellCells();
forAll(toF, celli)
{
if (adr[celli] != -1)
{
const labelList& neighbours = cc[adr[celli]];
const scalarList& w = weights[celli];
Type f = fromVf[adr[celli]]*w[0];
for (label ni = 1; ni < w.size(); ni++)
{
f += fromVf[neighbours[ni - 1]]*w[ni];
}
cop(toF[celli], f);
}
}
}
template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
const labelList& adr,
const vectorField& centres,
const CombineOp& cop
) const
{
// Cell-Point interpolation
interpolationCellPoint<Type> interpolator(fromVf);
forAll(toF, celli)
{
if (adr[celli] != -1)
{
cop
(
toF[celli],
interpolator.interpolate
(
centres[celli],
adr[celli]
)
);
}
}
}
template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateInternalField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
{
if (fromVf.mesh() != fromMesh_)
{
FatalErrorInFunction
<< "the argument field does not correspond to the right mesh. "
<< "Field size: " << fromVf.size()
<< " mesh size: " << fromMesh_.nCells()
<< exit(FatalError);
}
if (toF.size() != toMesh_.nCells())
{
FatalErrorInFunction
<< "the argument field does not correspond to the right mesh. "
<< "Field size: " << toF.size()
<< " mesh size: " << toMesh_.nCells()
<< exit(FatalError);
}
switch(ord)
{
case MAP:
mapField(toF, fromVf, cellAddressing_, cop);
break;
case INTERPOLATE:
{
interpolateField
(
toF,
fromVf,
cellAddressing_,
inverseDistanceWeights(),
cop
);
break;
}
case CELL_POINT_INTERPOLATE:
{
interpolateField
(
toF,
fromVf,
cellAddressing_,
toMesh_.cellCentres(),
cop
);
break;
}
case CELL_VOLUME_WEIGHT:
{
const labelListList& cellToCell = cellToCellAddressing();
const scalarListList& invVolWeights = inverseVolumeWeights();
interpolateField
(
toF,
fromVf,
cellToCell,
invVolWeights,
cop
);
break;
}
default:
FatalErrorInFunction
<< "unknown interpolation scheme " << ord
<< exit(FatalError);
}
}
template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateInternalField
(
Field<Type>& toF,
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
{
interpolateInternalField(toF, tfromVf(), ord, cop);
tfromVf.clear();
}
template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolate
(
GeometricField<Type, fvPatchField, volMesh>& toVf,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
{
interpolateInternalField(toVf, fromVf, ord, cop);
typename GeometricField<Type, fvPatchField, volMesh>::
Boundary& toVfBf = toVf.boundaryFieldRef();
forAll(toMesh_.boundaryMesh(), patchi)
{
const fvPatch& toPatch = toMesh_.boundary()[patchi];
if (cuttingPatches_.found(toPatch.name()))
{
switch(ord)
{
case MAP:
{
mapField
(
toVfBf[patchi],
fromVf,
boundaryAddressing_[patchi],
cop
);
break;
}
case INTERPOLATE:
{
interpolateField
(
toVfBf[patchi],
fromVf,
boundaryAddressing_[patchi],
toPatch.Cf(),
cop
);
break;
}
case CELL_POINT_INTERPOLATE:
{
interpolateField
(
toVfBf[patchi],
fromVf,
boundaryAddressing_[patchi],
toPatch.Cf(),
cop
);
break;
}
case CELL_VOLUME_WEIGHT:
{
break;
}
default:
FatalErrorInFunction
<< "unknown interpolation scheme " << ord
<< exit(FatalError);
}
if (isA<mixedFvPatchField<Type>>(toVfBf[patchi]))
{
refCast<mixedFvPatchField<Type>>
(
toVfBf[patchi]
).refValue() = toVfBf[patchi];
}
}
else if
(
patchMap_.found(toPatch.name())
&& fromMeshPatches_.found(patchMap_.find(toPatch.name())())
)
{
mapField
(
toVfBf[patchi],
fromVf.boundaryField()
[
fromMeshPatches_.find(patchMap_.find(toPatch.name())())()
],
boundaryAddressing_[patchi],
cop
);
}
}
}
template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolate
(
GeometricField<Type, fvPatchField, volMesh>& toVf,
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
{
interpolate(toVf, tfromVf(), ord, cop);
tfromVf.clear();
}
template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::meshToMesh0::interpolate
(
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
{
// Create and map the internal-field values
Field<Type> internalField(toMesh_.nCells());
interpolateInternalField(internalField, fromVf, ord, cop);
// check whether both meshes have got the same number
// of boundary patches
if (fromMesh_.boundary().size() != toMesh_.boundary().size())
{
FatalErrorInFunction
<< "Incompatible meshes: different number of boundaries, "
"only internal field may be interpolated"
<< exit(FatalError);
}
// Create and map the patch field values
PtrList<fvPatchField<Type>> patchFields
(
boundaryAddressing_.size()
);
forAll(boundaryAddressing_, patchi)
{
patchFields.set
(
patchi,
fvPatchField<Type>::New
(
fromVf.boundaryField()[patchi],
toMesh_.boundary()[patchi],
DimensionedField<Type, volMesh>::null(),
patchFieldInterpolator
(
boundaryAddressing_[patchi]
)
)
);
}
// Create the complete field from the pieces
tmp<GeometricField<Type, fvPatchField, volMesh>> ttoF
(
new GeometricField<Type, fvPatchField, volMesh>
(
IOobject
(
"interpolated(" + fromVf.name() + ')',
toMesh_.time().timeName(),
toMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
toMesh_,
fromVf.dimensions(),
internalField,
patchFields
)
);
return ttoF;
}
template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::meshToMesh0::interpolate
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
{
tmp<GeometricField<Type, fvPatchField, volMesh>> tint =
interpolate(tfromVf(), ord, cop);
tfromVf.clear();
return tint;
}
// ************************************************************************* //
| OpenFOAM/OpenFOAM-dev | src/sampling/meshToMesh0/meshToMesh0Templates.C | C++ | gpl-3.0 | 11,780 | [
30522,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
###############################################################
#
# Copyright 2011 Red Hat, Inc.
#
# 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.
#
###############################################################
##################################################################
## Begin the CPACK variable on-slaught.
##
## Start with the common section.
##################################################################
set (PACKAGE_REVISION "${BUILDID}")
set (CPACK_PACKAGE_NAME ${PACKAGE_NAME})
set (CPACK_PACKAGE_VENDOR "Condor Team - University of Wisconsin Madison")
set (CPACK_PACKAGE_VERSION ${PACKAGE_VERSION})
set (CPACK_PACKAGE_CONTACT "condor-users@cs.wisc.edu")
set (URL "http://www.cs.wisc.edu/condor/")
set (CONDOR_VERSION "${PACKAGE_NAME}-${PACKAGE_VERSION}")
GET_TIMEDATE( BUILD_TIMEDATE )
if(PRE_RELEASE)
if(BUILDID)
CLEAN_STRING( CLEAN_BUILDID "${BUILDID}" )
set (CONDOR_PACKAGE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}-${CLEAN_BUILDID}")
set (CONDOR_TEST_PACKAGE_NAME "${TEST_PACKAGE_NAME}-${PACKAGE_VERSION}-${CLEAN_BUILDID}")
elseif(BUILD_DATETIME)
set (CONDOR_PACKAGE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}-${BUILD_TIMEDATE}")
set (CONDOR_TEST_PACKAGE_NAME "${TEST_PACKAGE_NAME}-${PACKAGE_VERSION}-${BUILD_TIMEDATE}")
else()
CLEAN_STRING( CLEAN_RELEASE "${PRE_RELEASE}" )
set (CONDOR_PACKAGE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}-${CLEAN_RELEASE}")
set (CONDOR_TEST_PACKAGE_NAME "${TEST_PACKAGE_NAME}-${PACKAGE_VERSION}-${CLEAN_RELEASE}")
endif(BUILDID)
else()
set (CONDOR_PACKAGE_NAME "${CONDOR_VERSION}")
set (CONDOR_TEST_PACKAGE_NAME "${TEST_PACKAGE_NAME}-${CONDOR_VERSION}")
endif()
set (CPACK_PACKAGE_DESCRIPTION "Condor is a specialized workload management system for
compute-intensive jobs. Like other full-featured batch systems,
Condor provides a job queueing mechanism, scheduling policy,
priority scheme, resource monitoring, and resource management.
Users submit their serial or parallel jobs to Condor, Condor places
them into a queue, chooses when and where to run the jobs based
upon a policy, carefully monitors their progress, and ultimately
informs the user upon completion.")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Condor: High Throughput Computing")
# Debian need this indentation to look nicely
# Short describtion (1st line) copied from Ubuntu's package description
set(CPACK_DEBIAN_DESCRIPTION_SUMMARY "a workload management system for compute-intensive jobs
Condor is a specialized workload management system for
compute-intensive jobs. Condor provides a job queueing mechanism,
scheduling policy, priority scheme, resource monitoring,
and resource management. Users submit their serial or parallel jobs
to Condor, Condor places them into a queue, chooses when and where
to run the jobs based upon a policy, carefully monitors their progress,
and ultimately informs the user upon completion.")
set(CPACK_RESOURCE_FILE_LICENSE "${CONDOR_SOURCE_DIR}/LICENSE-2.0.txt")
#set(CPACK_RESOURCE_FILE_README "${CONDOR_SOURCE_DIR}/build/backstage/release_notes/README")
#set(CPACK_RESOURCE_FILE_WELCOME "${CONDOR_SOURCE_DIR}/build/backstage/release_notes/DOC") # this should be more of a Hiya welcome.
if(SYSTEM_NAME)
set(CPACK_SYSTEM_NAME "${SYSTEM_NAME}" )
else()
set(CPACK_SYSTEM_NAME "${OS_NAME}-${SYS_ARCH}" )
endif()
set(CPACK_TOPLEVEL_TAG "${OS_NAME}-${SYS_ARCH}" )
set(CPACK_PACKAGE_ARCHITECTURE ${SYS_ARCH} )
# always strip the source files.
set(CPACK_SOURCE_STRIP_FILES TRUE)
# here is where we can
if (PLATFORM)
set (CPACK_PACKAGE_FILE_NAME "${CONDOR_PACKAGE_NAME}-${PLATFORM}" )
set (CPACK_TEST_PACKAGE_FILE_NAME "${CONDOR_TEST_PACKAGE_NAME}-${PLATFORM}" )
elseif(SYSTEM_NAME)
set (CPACK_PACKAGE_FILE_NAME "${CONDOR_PACKAGE_NAME}-${SYSTEM_NAME}" )
set (CPACK_TEST_PACKAGE_FILE_NAME "${CONDOR_TEST_PACKAGE_NAME}-${SYSTEM_NAME}" )
else()
set (CPACK_PACKAGE_FILE_NAME "${CONDOR_PACKAGE_NAME}-${OS_NAME}-${SYS_ARCH}" )
set (CPACK_TEST_PACKAGE_FILE_NAME "${CONDOR_TEST_PACKAGE_NAME}-${OS_NAME}-${SYS_ARCH}" )
endif()
# you can enable/disable file stripping.
option(CONDOR_STRIP_PACKAGES "Enables stripping of packaged binaries" ON)
set(CPACK_STRIP_FILES ${CONDOR_STRIP_PACKAGES})
if (NOT CONDOR_STRIP_PACKAGES)
set (PACKAGE_REVISION "${PACKAGE_REVISION}+symbols" )
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-unstripped" )
else()
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-stripped" )
endif()
##################################################################
## Now onto platform specific package generation
## http://www.itk.org/Wiki/CMake:CPackPackageGenerators
##################################################################
#option used to enable/disable make package for rpm/deb with different install paths
option(CONDOR_PACKAGE_BUILD "Enables a package build" OFF)
#option used to control RPATH when using rpmbuild directly
option(CONDOR_RPMBUILD "Whether rpmbuild is being used to build HTCondor" OFF)
# 1st set the location of the install targets, these are the defaults for
set( C_BIN bin)
set( C_LIB lib)
set( C_LIB_PUBLIC lib)
set( C_LIB32 lib)
set( C_LIBEXEC libexec )
set( C_LIBEXEC_BLAHP libexec )
set( C_SBIN sbin)
set( C_PYTHONARCHLIB lib/python)
set( C_PYTHON3ARCHLIB lib/python3)
set( C_INCLUDE include)
set( C_INCLUDE_PUBLIC include)
set( C_MAN man)
set( C_SRC src)
set( C_SQL sql)
set( C_SERVICES services)
set( C_INIT etc/init.d )
set( C_ETC etc/examples )
set( C_CONFIGD etc/condor/config.d )
set( C_GANGLIAD etc/condor/ganglia.d )
set( C_SYSCONFIG etc/sysconfig )
set( C_ETC_EXAMPLES etc/examples )
set( C_SHARE_EXAMPLES .)
set( C_DOC . )
set( C_LOCAL_DIR var/lib/condor )
set( C_LOG_DIR var/log/condor )
set( C_LOCK_DIR var/lock/condor )
set( C_RUN_DIR var/run/condor )
# NOTE: any RPATH should use these variables + PREFIX for location
# set a default generator
set ( CPACK_GENERATOR "TGZ" )
# Here, we set CONDOR_RPATH for the tarball build. If we're doing a native
# package build, it'll be overwritten further below. EXTERNALS_RPATH must
# include both paths, as we build the externals once for both types. The
# settings for EXTERNALS_RPATH must be kept in synch with the C_LIB
# settings made below for package builds.
if ( ${OS_NAME} STREQUAL "LINUX" )
set( EXTERNALS_LIB "${C_LIB}/condor" )
if (${BIT_MODE} MATCHES "32" OR ${SYS_ARCH} MATCHES "IA64" )
set( CONDOR_RPATH "$ORIGIN/../lib:/lib:/usr/lib:$ORIGIN/../lib/condor:/usr/lib/condor" )
set( EXTERNALS_RPATH "$ORIGIN/../lib:/lib:/usr/lib:$ORIGIN/../lib/condor:/usr/lib/condor" )
set( PYTHON_RPATH "$ORIGIN/../../:/lib:/usr/lib:$ORIGIN/../../condor" )
else()
set( CONDOR_RPATH "$ORIGIN/../lib:/lib64:/usr/lib64:$ORIGIN/../lib/condor:/usr/lib64/condor" )
set( EXTERNALS_RPATH "$ORIGIN/../lib:/lib64:/usr/lib64:$ORIGIN/../lib/condor:/usr/lib64/condor" )
if ( ${SYSTEM_NAME} MATCHES "rhel7" OR ${SYSTEM_NAME} MATCHES "centos7" OR ${SYSTEM_NAME} MATCHES "sl7")
set( PYTHON_RPATH "$ORIGIN/../../:/usr/lib64/boost169:/lib64:/usr/lib64:$ORIGIN/../../condor" )
else()
set( PYTHON_RPATH "$ORIGIN/../../:/lib64:/usr/lib64:$ORIGIN/../../condor" )
endif()
endif()
elseif( ${OS_NAME} STREQUAL "DARWIN" )
set( EXTERNALS_LIB "${C_LIB}/condor" )
endif()
# Use the limited RPATH when building directly with RPM
if ( CONDOR_RPMBUILD )
if (${BIT_MODE} MATCHES "32" OR ${SYS_ARCH} MATCHES "IA64" )
set( CONDOR_RPATH "/usr/lib:/usr/lib/condor" )
set( PYTHON_RPATH "/usr/lib/condor" )
else()
set( CONDOR_RPATH "/usr/lib64:/usr/lib64/condor" )
if ( ${SYSTEM_NAME} MATCHES "rhel7" OR ${SYSTEM_NAME} MATCHES "centos7" OR ${SYSTEM_NAME} MATCHES "sl7")
set( PYTHON_RPATH "/usr/lib64/condor:/usr/lib64/boost169" )
else()
set( PYTHON_RPATH "/usr/lib64/condor" )
endif()
endif ()
endif()
#this needs to be evaluated in order due to WIN collision.
if(${OS_NAME} STREQUAL "DARWIN")
# enable if we desire native packaging.
# set ( CPACK_GENERATOR "${CPACK_GENERATOR};PackageMaker" ) ;
# set (CPACK_OSX_PACKAGE_VERSION)
elseif ( ${OS_NAME} STREQUAL "FREEBSD" )
# Condor installs nothing useful to FreeBSD in C_INIT, so
# just tuck it out of the way. FreeBSD RC scripts come from
# the port's "files" directory.
set( C_INIT etc/condor )
set( C_ETC etc/condor )
set( C_CONFIGD etc/condor/config.d )
set( C_SYSCONFIG etc/condor/sysconfig )
set( C_ETC_EXAMPLES etc/condor/examples )
# Condor installs an "examples" directory into C_SHARE_EXAMPLES
# so set it to share/condor instead of share/condor/examples.
set( C_SHARE_EXAMPLES share/examples/condor )
set( C_DOC share/doc/condor )
elseif ( ${OS_NAME} MATCHES "WIN" )
# override for windows.
set( C_BIN bin )
set( C_LIB bin )
set( C_LIB_PUBLIC bin )
set( C_LIBEXEC bin )
set( C_SBIN bin )
set( C_ETC etc )
set (CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CONDOR_PACKAGE_NAME}")
set (CPACK_PACKAGE_FILE_NAME "${CONDOR_PACKAGE_NAME}")
set (CPACK_TEST_PACKAGE_FILE_NAME "${CONDOR_TEST_PACKAGE_NAME}")
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CONDOR_VERSION}")
############################################################
# create the WIX package input file (condor.xsl) even if we aren't doing packaging.
set (CONDOR_WIX_LOC ${CONDOR_SOURCE_DIR}/msconfig/WiX)
# branding and licensing
set (CPACK_PACKAGE_ICON ${CONDOR_WIX_LOC}/Bitmaps/dlgbmp.bmp)
set (CPACK_RESOURCE_FILE_LICENSE "${CONDOR_SOURCE_DIR}/msconfig/license.rtf")
# set the product GUID as a hash of $(CONDOR_VERSION) in condor_version_namespace.
CLEAN_STRING( CLEAN_RELEASE "${PRE_RELEASE}" )
message (STATUS "Generating CPACK_WIX_PRODUCT_GUID from ${CONDOR_VERSION} ${CLEAN_RELEASE}")
execute_process(COMMAND ${CONDOR_SOURCE_DIR}/msconfig/generate_product_guid.cmd ${CONDOR_VERSION} ${CLEAN_RELEASE}
OUTPUT_VARIABLE CPACK_WIX_PRODUCT_GUID)
message (STATUS "CPACK_WIX_PRODUCT_GUID = ${CPACK_WIX_PRODUCT_GUID}")
# this will strip trailing whitespace and newlines
#string(REGEX REPLACE "[ \t\n]+" "" CPACK_WIX_PRODUCT_GUID "${CPACK_WIX_PRODUCT_GUID}")
#set (CPACK_WIX_PRODUCT_GUID "61F15EF4-0C24-4240-8706-3EB2EA0AF62C")
set (CPACK_WIX_UPGRADE_GUID "ef96d7c4-29df-403c-8fab-662386a089a4")
set (CPACK_WIX_WXS_FILES ${CONDOR_WIX_LOC}/xml/CondorCfgDlg.wxs;${CONDOR_WIX_LOC}/xml/CondorPoolCfgDlg.wxs;${CONDOR_WIX_LOC}/xml/CondorExecCfgDlg.wxs;${CONDOR_WIX_LOC}/xml/CondorDomainCfgDlg.wxs;${CONDOR_WIX_LOC}/xml/CondorEmailCfgDlg.wxs;${CONDOR_WIX_LOC}/xml/CondorJavaCfgDlg.wxs;${CONDOR_WIX_LOC}/xml/CondorPermCfgDlg.wxs;${CONDOR_WIX_LOC}/xml/CondorVMCfgDlg.wxs;${CONDOR_WIX_LOC}/xml/CondorUpHostDlg.wxs)
set (CPACK_WIX_BITMAP_FOLDER ${CONDOR_WIX_LOC}/Bitmaps)
#setup all the merge module settings.
if (MSVC90)
set (VC_CRT_MSM Microsoft_VC90_CRT_x86.msm)
find_file( CPACK_VC_POLICY_MODULE
policy_9_0_Microsoft_VC90_CRT_x86.msm
"C:/Program Files/Common Files/Merge Modules" "C:/Program Files (x86)/Common Files/Merge Modules" )
set (WIX_MERGE_MODLES "<Merge Id=\"VCPolicy\" Language=\"1033\" DiskId=\"1\" SourceFile=\"${CPACK_VC_POLICY_MODULE}\"/>")
set (WIX_MERGE_REFS "<MergeRef Id=\"VCPolicy\"/>")
set (MSVCVER vc90)
set (MSVCVERNUM 9.0)
elseif(MSVC10)
set (VC_CRT_MSM Microsoft_VC100_CRT_x86.msm)
set (MSVCVER vc100)
set (MSVCVERNUM 10.0)
elseif(MSVC11)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set (VC_CRT_MSM Microsoft_VC110_CRT_x64.msm)
else()
set (VC_CRT_MSM Microsoft_VC110_CRT_x86.msm)
endif()
set (MSVCVER vc110)
set (MSVCVERNUM 11.0)
elseif(MSVC14)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set (VC_CRT_MSM Microsoft_VC140_CRT_x64.msm)
else()
set (VC_CRT_MSM Microsoft_VC140_CRT_x86.msm)
endif()
set (MSVCVER vc140)
set (MSVCVERNUM 14.0)
else()
message(FATAL_ERROR "unsupported compiler version")
endif()
# look for the all important C-runtime
find_file( CPACK_VC_MERGE_MODULE
${VC_CRT_MSM}
"C:/Program Files/Common Files/Merge Modules" "C:/Program Files (x86)/Common Files/Merge Modules" )
set (WIX_MERGE_MODLES "<Merge Id=\"VCCRT\" Language=\"1033\" DiskId=\"1\" SourceFile=\"${CPACK_VC_MERGE_MODULE}\"/>\n${WIX_MERGE_MODLES}")
set (WIX_MERGE_REFS "<MergeRef Id=\"VCCRT\"/>\n${WIX_MERGE_REFS}")
configure_file(${CONDOR_WIX_LOC}/xml/win.xsl.in ${CONDOR_BINARY_DIR}/msconfig/WiX/xml/condor.xsl @ONLY)
set (CPACK_GENERATOR "ZIP")
install ( FILES ${CPACK_WIX_WXS_FILES} ${CONDOR_BINARY_DIR}/msconfig/WiX/xml/condor.xsl
DESTINATION ${C_ETC}/WiX/xml )
install ( DIRECTORY ${CPACK_WIX_BITMAP_FOLDER}
DESTINATION ${C_ETC}/WiX)
install ( FILES ${CONDOR_SOURCE_DIR}/msconfig/license.rtf ${CONDOR_SOURCE_DIR}/msconfig/do_wix.bat ${CONDOR_SOURCE_DIR}/msconfig/WiX/config.vbs
DESTINATION ${C_ETC}/WiX )
# the following will dump a header used to insert file info into bin's
set ( WINVER ${CMAKE_CURRENT_BINARY_DIR}/src/condor_includes/condor_winver.h)
file( WRITE ${WINVER} "#define CONDOR_VERSION \"${PACKAGE_VERSION}\"\n")
#file( APPEND ${WINVER} "#define CONDOR_BLAH \"${YOUR_VAR}\"\n")
# below are options an overrides to enable packge generation for rpm & deb
elseif( ${OS_NAME} STREQUAL "LINUX" AND CONDOR_PACKAGE_BUILD )
execute_process( COMMAND python2 -c "import distutils.sysconfig; import sys; sys.stdout.write(distutils.sysconfig.get_python_lib(1)[1:])" OUTPUT_VARIABLE C_PYTHONARCHLIB)
execute_process( COMMAND python3 -c "import distutils.sysconfig; import sys; sys.stdout.write(distutils.sysconfig.get_python_lib(1)[1:])" OUTPUT_VARIABLE C_PYTHON3ARCHLIB)
# it's a smaller subset easier to differentiate.
# check the operating system name
if ( DEB_SYSTEM_NAME )
message (STATUS "Configuring for Debian package on ${LINUX_NAME}-${LINUX_VER}-${DEBIAN_CODENAME}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
##############################################################
# For details on DEB package generation see:
# http://www.itk.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
##############################################################
set ( CPACK_GENERATOR "DEB" )
# Use dkpg-shlibdeps to generate dependency list
set ( CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON )
# Enable debug message
set ( CPACK_DEBIAN_PACKAGE_DEBUG 1 )
set (CPACK_PACKAGE_FILE_NAME "${CONDOR_PACKAGE_NAME}-${PACKAGE_REVISION}-${DEB_SYSTEM_NAME}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" )
string( TOLOWER "${CPACK_PACKAGE_FILE_NAME}" CPACK_PACKAGE_FILE_NAME )
set (CPACK_TEST_PACKAGE_FILE_NAME "${CONDOR_TEST_PACKAGE_NAME}-${PACKAGE_REVISION}-${DEB_SYSTEM_NAME}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" )
string( TOLOWER "${CPACK_TEST_PACKAGE_FILE_NAME}" CPACK_TEST_PACKAGE_FILE_NAME )
set ( CPACK_DEBIAN_PACKAGE_SECTION "contrib/misc")
set ( CPACK_DEBIAN_PACKAGE_PRIORITY "extra")
set ( CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_DESCRIPTION_SUMMARY}")
set ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Condor Team <${CPACK_PACKAGE_CONTACT}>" )
set ( CPACK_DEBIAN_PACKAGE_VERSION "${PACKAGE_VERSION}-${PACKAGE_REVISION}")
set ( CPACK_DEBIAN_PACKAGE_HOMEPAGE "${URL}")
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "python, adduser, libdate-manip-perl, ecryptfs-utils")
#Control files
set( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${CMAKE_CURRENT_SOURCE_DIR}/build/packaging/debian/postinst"
"${CMAKE_CURRENT_SOURCE_DIR}/build/packaging/debian/postrm"
"${CMAKE_CURRENT_SOURCE_DIR}/build/packaging/debian/preinst"
"${CMAKE_CURRENT_SOURCE_DIR}/build/packaging/debian/prerm"
"${CMAKE_CURRENT_SOURCE_DIR}/build/packaging/debian/conffiles")
#Directory overrides
#Same as RPM
set( C_BIN usr/bin )
set( C_LIB usr/lib/condor )
set( C_LIB_PUBLIC usr/lib )
set( C_LIB32 usr/lib/condor )
set( C_SBIN usr/sbin )
set( C_INCLUDE usr/include/condor )
set( C_INCLUDE_PUBLIC usr/include )
set( C_MAN usr/share/man )
set( C_SRC usr/src)
set( C_SQL usr/share/condor/sql)
set( C_INIT etc/init.d )
set( C_ETC etc/condor )
set( C_CONFIGD etc/condor/config.d )
set( C_GANGLIAD etc/condor/ganglia.d )
#Debian specific
set( C_ETC_EXAMPLES usr/share/doc/condor/etc/examples )
set( C_SHARE_EXAMPLES usr/share/doc/condor)
set( C_DOC usr/share/doc/condor )
set( C_LIBEXEC usr/lib/condor/libexec )
set( C_LIBEXEC_BLAHP usr/libexec/blahp )
set( C_SYSCONFIG etc/default )
elseif ( RPM_SYSTEM_NAME )
# This variable will be defined if the platfrom support RPM
message (STATUS "Configuring RPM package on ${LINUX_NAME}-${LINUX_VER} -> ${RPM_SYSTEM_NAME}.${SYS_ARCH}")
##############################################################
# For details on RPM package generation see:
# http://www.itk.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29
##############################################################
set ( CPACK_GENERATOR "RPM" )
#set ( CPACK_SOURCE_GENERATOR "RPM" )
#Enable trace during packaging
set(CPACK_RPM_PACKAGE_DEBUG 1)
set (CPACK_PACKAGE_FILE_NAME "${CONDOR_PACKAGE_NAME}-${PACKAGE_REVISION}.${RPM_SYSTEM_NAME}.${SYS_ARCH}" )
string( TOLOWER "${CPACK_PACKAGE_FILE_NAME}" CPACK_PACKAGE_FILE_NAME )
set (CPACK_TEST_PACKAGE_FILE_NAME "${CONDOR_TEST_PACKAGE_NAME}-${PACKAGE_REVISION}.${RPM_SYSTEM_NAME}.${SYS_ARCH}" )
string( TOLOWER "${CPACK_TEST_PACKAGE_FILE_NAME}" CPACK_TEST_PACKAGE_FILE_NAME )
set ( CPACK_RPM_PACKAGE_RELEASE ${PACKAGE_REVISION})
set ( CPACK_RPM_PACKAGE_GROUP "Applications/System")
set ( CPACK_RPM_PACKAGE_LICENSE "Apache License, Version 2.0")
set ( CPACK_RPM_PACKAGE_VENDOR ${CPACK_PACKAGE_VENDOR})
set ( CPACK_RPM_PACKAGE_URL ${URL})
set ( CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
string(TIMESTAMP CPACK_RPM_DATE "+%a %b %d %Y")
#Specify SPEC file template
set(CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_SOURCE_DIR}/build/packaging/rpm/condor.spec.in")
#Directory overrides
if (${BIT_MODE} MATCHES "32" OR ${SYS_ARCH} MATCHES "IA64" )
set( C_LIB usr/lib/condor )
set( C_LIB_PUBLIC usr/lib )
set( C_LIB32 usr/lib/condor )
else()
set( C_LIB usr/lib64/condor )
set( C_LIB_PUBLIC usr/lib64 )
set( C_LIB32 usr/lib/condor )
endif ()
if ( ${LINUX_NAME} MATCHES "openSUSE" OR ${LINUX_NAME} MATCHES "sles" )
set( CPACK_RPM_SHADOW_PACKAGE "pwdutils" )
else()
set( CPACK_RPM_SHADOW_PACKAGE "shadow-utils" )
endif()
set( C_BIN usr/bin )
set( C_LIBEXEC usr/libexec/condor )
set( C_LIBEXEC_BLAHP usr/libexec/blahp )
set( C_SBIN usr/sbin )
set( C_INCLUDE usr/include/condor )
set( C_INCLUDE_PUBLIC usr/include )
set( C_MAN usr/share/man/man1 )
set( C_SRC usr/src)
set( C_SQL usr/share/condor/sql)
set( C_INIT etc/init.d )
set( C_ETC etc/condor )
set( C_CONFIGD etc/condor/config.d )
set( C_GANGLIAD etc/condor/ganglia.d )
set( C_SYSCONFIG etc/sysconfig )
set( C_ETC_EXAMPLES usr/share/doc/${CONDOR_VERSION}/etc/examples )
set( C_SHARE_EXAMPLES usr/share/doc/${CONDOR_VERSION})
set( C_DOC usr/share/doc/${CONDOR_VERSION} )
endif()
set( EXTERNALS_LIB "${C_LIB}" )
set( CONDOR_RPATH "/${C_LIB_PUBLIC}:/${C_LIB}" )
set( PYTHON_RPATH "/${C_LIB}" )
# Generate empty folder to ship with package
# Local dir
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/execute )
add_custom_target( change_execute_folder_permission
ALL
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND chmod 1777 execute
DEPENDS ${CMAKE_BINARY_DIR}/execute)
install(DIRECTORY ${CMAKE_BINARY_DIR}/execute
DESTINATION "${C_LOCAL_DIR}"
DIRECTORY_PERMISSIONS USE_SOURCE_PERMISSIONS)
# Blank directory means we are creating an emtpy directoy
# CPackDeb does not package empyty directoy, so we will recreate them during posinst
install(DIRECTORY
DESTINATION "${C_LOCAL_DIR}/spool")
install(DIRECTORY
DESTINATION "${C_CONFIGD}")
install(DIRECTORY
DESTINATION "${C_LOCK_DIR}")
install(DIRECTORY
DESTINATION "${C_LOG_DIR}")
install(DIRECTORY
DESTINATION "${C_RUN_DIR}")
install(DIRECTORY
DESTINATION "${C_LIB32}")
endif()
| htcondor/htcondor | build/cmake/CondorPackageConfig.cmake | CMake | apache-2.0 | 20,583 | [
30522,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.railwaystations.api.resources;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.StringUtils;
import org.railwaystations.api.PhotoImporter;
import org.railwaystations.api.StationsRepository;
import org.railwaystations.api.model.Station;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Path("/")
public class SlackCommandResource {
private static final Pattern PATTERN_SEARCH = Pattern.compile("\\s*search\\s*(.*)");
private static final Pattern PATTERN_SHOW = Pattern.compile("\\s*show\\s\\s*([a-z]{1,3})\\s\\s*(\\w*)");
private static final Pattern PATTERN_SHOW_LEGACY = Pattern.compile("\\s*show\\s\\s*(\\d*)");
private final StationsRepository repository;
private final String verificationToken;
private final PhotoImporter photoImporter;
public SlackCommandResource(final StationsRepository repository, final String verificationToken, final PhotoImporter photoImporter) {
this.repository = repository;
this.verificationToken = verificationToken;
this.photoImporter = photoImporter;
}
@POST
@Path("slack")
@Produces({MediaType.APPLICATION_JSON + ";charset=UTF-8"})
public SlackResponse command(@FormParam("token") final String token,
@FormParam("text") final String text,
@FormParam("response_url") final String responseUrl) {
if (!StringUtils.equals(verificationToken, token)) {
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
}
if (StringUtils.equals("import", text)) {
photoImporter.importPhotosAsync();
return new SlackResponse(ResponseType.in_channel, "Importing photos");
}
final Matcher matcherSearch = PATTERN_SEARCH.matcher(text);
if (matcherSearch.matches()) {
final Map<Station.Key, String> stations = repository.findByName(matcherSearch.group(1));
if (!stations.isEmpty()){
return new SlackResponse(ResponseType.in_channel, toMessage(stations));
}
return new SlackResponse(ResponseType.in_channel, "No stations found");
}
final Matcher matcherShow = PATTERN_SHOW.matcher(text);
if (matcherShow.matches()) {
return showStation(matcherShow.group(1).toLowerCase(Locale.ENGLISH), matcherShow.group(2));
}
final Matcher matcherShowLegacy = PATTERN_SHOW_LEGACY.matcher(text);
if (matcherShowLegacy.matches()) {
return showStation(null, matcherShowLegacy.group(1));
}
return new SlackResponse(ResponseType.ephimeral, String.format("I understand:%n- '/rsapi search <station-name>'%n- '/rsapi show <country-code> <station-id>%n- '/rsapi import'%n"));
}
private SlackResponse showStation(final String country, final String id) {
final Station.Key key = new Station.Key(country, id);
final Station station = repository.findByKey(key);
if (station == null) {
return new SlackResponse(ResponseType.in_channel, "Station with " + key + " not found");
} else {
return new SlackResponse(ResponseType.in_channel, toMessage(station));
}
}
private String toMessage(final Map<Station.Key, String> stations) {
final StringBuilder sb = new StringBuilder(String.format("Found:%n"));
stations.keySet().forEach(station -> sb.append(String.format("- %s: %s%n", stations.get(station), station)));
return sb.toString();
}
private String toMessage(final Station station) {
return String.format("Station: %s - %s%nCountry: %s%nLocation: %f,%f%nPhotographer: %s%nLicense: %s%nPhoto: %s%n", station.getKey().getId(), station.getTitle(), station.getKey().getCountry(), station.getCoordinates().getLat(), station.getCoordinates().getLon(), station.getPhotographer(), station.getLicense(), station.getPhotoUrl());
}
public enum ResponseType {
ephimeral,
in_channel
}
/**
* <div>
* {
* “response_type”: “ephemeral”,
* “text”: “How to use /please”,
* “attachments”:[
* {
* “text”:”To be fed, use `/please feed` to request food. We hear the elf needs food badly.\nTo tease, use `/please tease` — we always knew you liked noogies.\nYou’ve already learned how to getStationsByCountry help with `/please help`.”
* }
* ]
* }
* </div>
*/
private static class SlackResponse {
@JsonProperty("response_type")
private final ResponseType responseType;
@JsonProperty("text")
private final String text;
private SlackResponse(final ResponseType responseType, final String text) {
this.responseType = responseType;
this.text = text;
}
public String getText() {
return text;
}
public ResponseType getResponseType() {
return responseType;
}
}
}
| pstorch/bahnhoefe.gpx | src/main/java/org/railwaystations/api/resources/SlackCommandResource.java | Java | mit | 5,251 | [
30522,
7427,
8917,
1012,
7111,
12516,
2015,
1012,
17928,
1012,
4219,
1025,
12324,
4012,
1012,
5514,
2595,
19968,
1012,
4027,
1012,
5754,
17287,
3508,
1012,
1046,
3385,
21572,
4842,
3723,
1025,
12324,
8917,
1012,
15895,
1012,
7674,
1012,
113... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*******************************************************************************
*//**
* @mainpage
* @section section1 Introduction:
* Having studied this LAB you will able to: \n
* - Understand the advanced Timer functions \n
* - Study the programs related to the Advanced timer
*
* @section section2 Example14 :
* Objective: Write a program to generate complimentary PWM output in Edge align mode with deadtime(Timer1)
*
* @section section3 Program Description:
* This program demonstrates generation of complimentary PWM signal using advanced timer in edge align mode with deadtime.
*
* @section section4 Included Files:
*
* | Header Files | Source Files |
* | :------------------------------:| :----------------------------: |
* | @ref stm32f4xx_hal_conf.h | @ref stm32f4xx_hal_msp.c |
* | @ref stm32f4xx_it.h | @ref stm32f4xx_it.c |
* | @ref stm32f4_discovery.h | @ref stm32f4_discovery.c |
* | @ref stm32f4_discovery_timer.h | @ref stm32f4_discovery_timer.c |
* | | @ref main.c |
*
* \n
* @section section5 Pin Assignments
*
* | STM32F407 Reference | On board |
* | :------------------:|-----------:|
* | GPIOC.06 | TIM8_CH1 |
* | GPIOA.05N | TIM8_CH1N |
*
*
* @section section6 Program Folder Location
* <Eg14>
*
*
* @section section7 Part List
* - STM32F4Discovery Board \n
* - USB cable \n
* - Eclipse IDE \n
* - PC \n
*
*
* @section section8 Hardware Configuration
* - Connect the board using USB port of PC using USB cable.
* - Apply Reset condition by pressing the Reset switch to ensure proper communication.
* - Using download tool (STM ST-LINK Utility) download the .hex file developed using available tools.
* - Reset the board.
* - Observe the Output.
*
* @section section9 Output:
* 20KHZ complimentary PWM signal will be generated on the Timer8 channel1N port pin in edge align mode with deadtime.
*\n
*\n
*******************************************************************************/
| bhavindarji/STM32F4-Dev | Example Projects/Timer/eg14/Inc/doxy_wb.h | C | mit | 2,208 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//login with system user
grant select on v_$statname to yy;
grant select on v_$mystat to yy;
grant select on v_$timer to yy;
grant select on v_$latch to yy;
create or replace view stats
as select 'STAT...' || a.name name, b.value
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
union all
select 'LATCH.' || name, gets
from v$latch
union all
select 'STAT...Elapsed Time', hsecs from v$timer;
create global temporary table run_stats
( runid varchar2(15),
name varchar2(80),
value int )
on commit preserve rows;
create or replace package runstats_pkg
as
procedure rs_start;
procedure rs_middle;
procedure rs_stop( p_difference_threshold in number default 0 );
end;
/
create or replace package body runstats_pkg
as
g_start number;
g_run1 number;
g_run2 number;
procedure rs_start
is
begin
delete from run_stats;
insert into run_stats
select 'before', stats.* from stats;
g_start := dbms_utility.get_time;
end;
procedure rs_middle
is
begin
g_run1 := (dbms_utility.get_time-g_start);
insert into run_stats
select 'after 1', stats.* from stats;
g_start := dbms_utility.get_time;
end;
procedure rs_stop(p_difference_threshold in number default 0)
is
begin
g_run2 := (dbms_utility.get_cpu_time-g_start);
dbms_output.put_line
( 'Run1 ran in ' || g_run1 || ' cpu hsecs' );
dbms_output.put_line
( 'Run2 ran in ' || g_run2 || ' cpu hsecs' );
if ( g_run2 <> 0 )
then
dbms_output.put_line
( 'run 1 ran in ' || round(g_run1/g_run2*100,2) ||
'% of the time' );
end if;
dbms_output.put_line( chr(9) );
insert into run_stats
select 'after 2', stats.* from stats;
dbms_output.put_line
( rpad( 'Name', 30 ) || lpad( 'Run1', 12 ) ||
lpad( 'Run2', 12 ) || lpad( 'Diff', 12 ) );
for x in
( select rpad( a.name, 30 ) ||
to_char( b.value-a.value, '999,999,999' ) ||
to_char( c.value-b.value, '999,999,999' ) ||
to_char( ( (c.value-b.value)-(b.value-a.value)),
'999,999,999' ) data
from run_stats a, run_stats b, run_stats c
where a.name = b.name
and b.name = c.name
and a.runid = 'before'
and b.runid = 'after 1'
and c.runid = 'after 2'
and abs( (c.value-b.value) - (b.value-a.value) )
> p_difference_threshold
order by abs( (c.value-b.value)-(b.value-a.value))
) loop
dbms_output.put_line( x.data );
end loop;
dbms_output.put_line( chr(9) );
dbms_output.put_line
( 'Run1 latches total versus runs -- difference and pct' );
dbms_output.put_line
( lpad( 'Run1', 12 ) || lpad( 'Run2', 12 ) ||
lpad( 'Diff', 12 ) || lpad( 'Pct', 10 ) );
for x in
( select to_char( run1, '999,999,999' ) ||
to_char( run2, '999,999,999' ) ||
to_char( diff, '999,999,999' ) ||
to_char( round( run1/decode( run2, 0,
to_number(0), run2) *100,2 ), '99,999.99' ) || '%' data
from ( select sum(b.value-a.value) run1, sum(c.value-b.value) run2,
sum( (c.value-b.value)-(b.value-a.value)) diff
from run_stats a, run_stats b, run_stats c
where a.name = b.name
and b.name = c.name
and a.runid = 'before'
and b.runid = 'after 1'
and c.runid = 'after 2'
and a.name like 'LATCH%'
)
) loop
dbms_output.put_line( x.data );
end loop;
end;
end;
/
create table big_table
as
select rownum id, a.*
from all_objects a
where 1=0
/
alter table big_table nologging;
declare
l_cnt number;
l_rows number := &1;
begin
insert /*+ append */
into big_table
select rownum, a.*
from all_objects a
where rownum <= &1;
l_cnt := sql%rowcount;
commit;
while (l_cnt < l_rows)
loop
insert /*+ APPEND */ into big_table
select rownum+l_cnt,
OWNER, OBJECT_NAME, SUBOBJECT_NAME, OBJECT_ID, DATA_OBJECT_ID,
OBJECT_TYPE, CREATED, LAST_DDL_TIME, TIMESTAMP, STATUS,
TEMPORARY, GENERATED, SECONDARY/*, NAMESPACE, EDITION_NAME */
from big_table
where rownum <= l_rows-l_cnt;
l_cnt := l_cnt + sql%rowcount;
commit;
end loop;
end;
/
alter table big_table add constraint
big_table_pk primary key(id);
exec dbms_stats.gather_table_stats( user, 'BIG_TABLE', estimate_percent=> 1);
create or replace procedure show_space
( p_segname in varchar2,
p_owner in varchar2 default user,
p_type in varchar2 default 'TABLE',
p_partition in varchar2 default NULL )
-- this procedure uses authid current user so it can query DBA_*
-- views using privileges from a ROLE and so it can be installed
-- once per database, instead of once per user that wants to use it
authid current_user
as
l_free_blks number;
l_total_blocks number;
l_total_bytes number;
l_unused_blocks number;
l_unused_bytes number;
l_LastUsedExtFileId number;
l_LastUsedExtBlockId number;
l_LAST_USED_BLOCK number;
l_segment_space_mgmt varchar2(255);
l_unformatted_blocks number;
l_unformatted_bytes number;
l_fs1_blocks number; l_fs1_bytes number;
l_fs2_blocks number; l_fs2_bytes number;
l_fs3_blocks number; l_fs3_bytes number;
l_fs4_blocks number; l_fs4_bytes number;
l_full_blocks number; l_full_bytes number;
-- inline procedure to print out numbers nicely formatted
-- with a simple label
procedure p( p_label in varchar2, p_num in number )
is
begin
dbms_output.put_line( rpad(p_label,40,'.') ||
to_char(p_num,'999,999,999,999') );
end;
begin
-- this query is executed dynamically in order to allow this procedure
-- to be created by a user who has access to DBA_SEGMENTS/TABLESPACES
-- via a role as is customary.
-- NOTE: at runtime, the invoker MUST have access to these two
-- views!
-- this query determines if the object is an ASSM object or not
begin
execute immediate
'select ts.segment_space_management
from dba_segments seg, dba_tablespaces ts
where seg.segment_name = :p_segname
and (:p_partition is null or
seg.partition_name = :p_partition)
and seg.owner = :p_owner
and seg.tablespace_name = ts.tablespace_name'
into l_segment_space_mgmt
using p_segname, p_partition, p_partition, p_owner;
exception
when too_many_rows then
dbms_output.put_line
( 'This must be a partitioned table, use p_partition => ');
return;
end;
-- if the object is in an ASSM tablespace, we must use this API
-- call to get space information, else we use the FREE_BLOCKS
-- API for the user managed segments
if l_segment_space_mgmt = 'AUTO'
then
dbms_space.space_usage
( p_owner, p_segname, p_type, l_unformatted_blocks,
l_unformatted_bytes, l_fs1_blocks, l_fs1_bytes,
l_fs2_blocks, l_fs2_bytes, l_fs3_blocks, l_fs3_bytes,
l_fs4_blocks, l_fs4_bytes, l_full_blocks, l_full_bytes, p_partition);
p( 'Unformatted Blocks ', l_unformatted_blocks );
p( 'FS1 Blocks (0-25) ', l_fs1_blocks );
p( 'FS2 Blocks (25-50) ', l_fs2_blocks );
p( 'FS3 Blocks (50-75) ', l_fs3_blocks );
p( 'FS4 Blocks (75-100)', l_fs4_blocks );
p( 'Full Blocks ', l_full_blocks );
else
dbms_space.free_blocks(
segment_owner => p_owner,
segment_name => p_segname,
segment_type => p_type,
freelist_group_id => 0,
free_blks => l_free_blks);
p( 'Free Blocks', l_free_blks );
end if;
-- and then the unused space API call to get the rest of the
-- information
dbms_space.unused_space
( segment_owner => p_owner,
segment_name => p_segname,
segment_type => p_type,
partition_name => p_partition,
total_blocks => l_total_blocks,
total_bytes => l_total_bytes,
unused_blocks => l_unused_blocks,
unused_bytes => l_unused_bytes,
LAST_USED_EXTENT_FILE_ID => l_LastUsedExtFileId,
LAST_USED_EXTENT_BLOCK_ID => l_LastUsedExtBlockId,
LAST_USED_BLOCK => l_LAST_USED_BLOCK );
p( 'Total Blocks', l_total_blocks );
p( 'Total Bytes', l_total_bytes );
p( 'Total MBytes', trunc(l_total_bytes/1024/1024) );
p( 'Unused Blocks', l_unused_blocks );
p( 'Unused Bytes', l_unused_bytes );
p( 'Last Used Ext FileId', l_LastUsedExtFileId );
p( 'Last Used Ext BlockId', l_LastUsedExtBlockId );
p( 'Last Used Block', l_LAST_USED_BLOCK );
end;
/
| yyitsz/myjavastudio | studyoracle/runstat.sql | SQL | apache-2.0 | 9,351 | [
30522,
1013,
1013,
8833,
2378,
2007,
2291,
5310,
3946,
7276,
2006,
1058,
1035,
1002,
28093,
18442,
2000,
1061,
2100,
1025,
3946,
7276,
2006,
1058,
1035,
1002,
2026,
9153,
2102,
2000,
1061,
2100,
1025,
3946,
7276,
2006,
1058,
1035,
1002,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# frozen_string_literal: false
require File.expand_path '../xref_test_case', __FILE__
class TestRDocCrossReference < XrefTestCase
def setup
super
@xref = RDoc::CrossReference.new @c1
end
def assert_ref expected, name
assert_equal expected, @xref.resolve(name, 'fail')
end
def refute_ref name
assert_equal name, @xref.resolve(name, name)
end
def test_METHOD_REGEXP_STR
re = /#{RDoc::CrossReference::METHOD_REGEXP_STR}/
%w'=== [] []= << >>'.each do |x|
re =~ x
assert_equal x, $&
end
end
def test_resolve_C2
@xref = RDoc::CrossReference.new @c2
refute_ref '#m'
assert_ref @c1__m, 'C1::m'
assert_ref @c2_c3, 'C2::C3'
assert_ref @c2_c3_m, 'C2::C3#m'
assert_ref @c2_c3_h1, 'C3::H1'
assert_ref @c4, 'C4'
assert_ref @c3_h2, 'C3::H2'
refute_ref 'H1'
end
def test_resolve_C2_C3
@xref = RDoc::CrossReference.new @c2_c3
assert_ref @c2_c3_m, '#m'
assert_ref @c2_c3, 'C3'
assert_ref @c2_c3_m, 'C3#m'
assert_ref @c2_c3_h1, 'H1'
assert_ref @c2_c3_h1, 'C3::H1'
assert_ref @c4, 'C4'
assert_ref @c3_h2, 'C3::H2'
end
def test_resolve_C3
@xref = RDoc::CrossReference.new @c3
assert_ref @c3, 'C3'
refute_ref '#m'
refute_ref 'C3#m'
assert_ref @c3_h1, 'H1'
assert_ref @c3_h1, 'C3::H1'
assert_ref @c3_h2, 'C3::H2'
assert_ref @c4, 'C4'
end
def test_resolve_C4
@xref = RDoc::CrossReference.new @c4
# C4 ref inside a C4 containing a C4 should resolve to the contained class
assert_ref @c4_c4, 'C4'
end
def test_resolve_C4_C4
@xref = RDoc::CrossReference.new @c4_c4
# A C4 reference inside a C4 class contained within a C4 class should
# resolve to the inner C4 class.
assert_ref @c4_c4, 'C4'
end
def test_resolve_class
assert_ref @c1, 'C1'
refute_ref 'H1'
assert_ref @c2, 'C2'
assert_ref @c2_c3, 'C2::C3'
assert_ref @c2_c3_h1, 'C2::C3::H1'
assert_ref @c3, '::C3'
assert_ref @c3_h1, '::C3::H1'
assert_ref @c4_c4, 'C4::C4'
end
def test_resolve_file
refute_ref 'xref_data.rb'
end
def test_resolve_method
assert_ref @c1__m, 'm'
assert_ref @c1_m, '#m'
assert_ref @c1__m, '::m'
assert_ref @c1_m, 'C1#m'
assert_ref @c1__m, 'C1.m'
assert_ref @c1__m, 'C1::m'
assert_ref @c1_m, 'C1#m'
assert_ref @c1_m, 'C1#m()'
assert_ref @c1_m, 'C1#m(*)'
assert_ref @c1__m, 'C1.m'
assert_ref @c1__m, 'C1.m()'
assert_ref @c1__m, 'C1.m(*)'
assert_ref @c1__m, 'C1::m'
assert_ref @c1__m, 'C1::m()'
assert_ref @c1__m, 'C1::m(*)'
assert_ref @c2_c3_m, 'C2::C3#m'
assert_ref @c2_c3_m, 'C2::C3.m'
# TODO stop escaping - HTML5 allows anything but space
assert_ref @c2_c3_h1_meh, 'C2::C3::H1#m?'
assert_ref @c2_c3_m, '::C2::C3#m'
assert_ref @c2_c3_m, '::C2::C3#m()'
assert_ref @c2_c3_m, '::C2::C3#m(*)'
end
def test_resolve_method_equals3
m = RDoc::AnyMethod.new '', '==='
@c1.add_method m
assert_ref m, '==='
end
def test_resolve_page
page = @store.add_file 'README.txt'
page.parser = RDoc::Parser::Simple
assert_ref page, 'README'
end
def test_resolve_percent
i_percent = RDoc::AnyMethod.new nil, '%'
i_percent.singleton = false
@c1.add_method i_percent
c_percent = RDoc::AnyMethod.new nil, '%'
c_percent.singleton = true
@c1.add_method c_percent
assert_ref i_percent, '%'
assert_ref i_percent, '#%'
assert_ref c_percent, '::%'
assert_ref i_percent, 'C1#%'
assert_ref c_percent, 'C1::%'
end
def test_resolve_no_ref
assert_equal '', @xref.resolve('', '')
assert_equal "bogus", @xref.resolve("bogus", "bogus")
assert_equal "\\bogus", @xref.resolve("\\bogus", "\\bogus")
assert_equal "\\\\bogus", @xref.resolve("\\\\bogus", "\\\\bogus")
assert_equal "\\#n", @xref.resolve("\\#n", "fail")
assert_equal "\\#n()", @xref.resolve("\\#n()", "fail")
assert_equal "\\#n(*)", @xref.resolve("\\#n(*)", "fail")
assert_equal "C1", @xref.resolve("\\C1", "fail")
assert_equal "::C3", @xref.resolve("\\::C3", "fail")
assert_equal "succeed", @xref.resolve("::C3::H1#n", "succeed")
assert_equal "succeed", @xref.resolve("::C3::H1#n(*)", "succeed")
assert_equal "\\::C3::H1#n", @xref.resolve("\\::C3::H1#n", "fail")
end
end
| rokn/Count_Words_2015 | fetched_code/ruby/test_rdoc_cross_reference.rb | Ruby | mit | 4,435 | [
30522,
1001,
7708,
1035,
5164,
1035,
18204,
1024,
6270,
5478,
5371,
1012,
7818,
1035,
4130,
1005,
1012,
1012,
1013,
1060,
2890,
2546,
1035,
3231,
1035,
2553,
1005,
1010,
1035,
1035,
5371,
1035,
1035,
2465,
3231,
20683,
9468,
25725,
2890,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Imports Transporter_AEHF.BurchfieldPositionerControl
Imports Transporter_AEHF.Objects.Enumerations
Imports Transporter_AEHF.Objects.Positioners
Imports NLog
Public Class PositionerConnectionForm
Private _addressType As PumaEnums.ConnectionType
Private _positionerModel As PumaEnums.PositionerModel
Private _main As Main
Private _positioner As Object
Private Const EthernetHeader = ""
Private Const EthernetFooter = ""
Private Const UsbHeader = ""
Private _log As Logger = LogManager.GetCurrentClassLogger
Private _loggerSelection As String
Sub New(ByVal aMain As Main)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
_loggerSelection = aMain.LoggerSelection
_main = aMain
End Sub
Private Sub cmboBoxConnectionType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmboBoxConnectionType.SelectedIndexChanged
If cmboBoxConnectionType.SelectedIndex = 0 Then 'if user selects ethernet
lblConnectionAddress.Text = "Enter IP Adress"
txtBoxConnectionAddress.Text = "192.168.100.179" '"TCPIP0::192.168.100.179::80::SOCKET" '169.254.117.216::INSTR"
lblPort.Text = "Enter Port"
txtBoxConnectionPort.Text = "4000"
txtBoxConnectionAddress.Enabled = True
txtBoxConnectionPort.Enabled = True
_addressType = PumaEnums.ConnectionType.Ip
ElseIf cmboBoxConnectionType.SelectedIndex = 1 Then 'if user selects com
lblConnectionAddress.Text = "Com"
txtBoxConnectionAddress.Text = "COM"
lblPort.Text = "Enter Port"
txtBoxConnectionPort.Text = "4"
txtBoxConnectionPort.Enabled = True
_addressType = PumaEnums.ConnectionType.Com
End If
End Sub
Private Sub btnConnectPositioner_Click(sender As Object, e As EventArgs) Handles btnConnectPositioner.Click
Dim address = Trim(txtBoxConnectionAddress.Text)
Dim port = Trim(txtBoxConnectionPort.Text)
'check the type of connection
If _addressType = PumaEnums.ConnectionType.Ip Then 'if ethernet then use visa session
'check the positioner type
If _positionerModel = PumaEnums.PositionerModel.Burchfield Then 'if ethernet and Burchfield
'try to establish a session
'session should be managed with positioner object
Try
'establish positioner object
_positioner = New BurchfieldUnit()
_positioner.connect(address, port, _addressType, _loggerSelection)
'send positioner object to positioner form
Dim posForm = New BurchfieldPositionerForm(_positioner, _loggerSelection)
posForm.Show()
Close()
Catch ex As Exception
ErrorMessageFormat("Error trying to connect.", ex)
If _positioner IsNot Nothing Then
_positioner.dispose()
End If
End Try
ElseIf _positionerModel = PumaEnums.PositionerModel.DirectedPerception Then 'if ethernet and direct perception
MsgBox("We do not currently support ethernet connections to direct perception positioners. Try USB/Serial connection.")
End If
ElseIf _addressType = PumaEnums.ConnectionType.Com Then 'if usb then use serial session
'check positioner type
If _positionerModel = PumaEnums.PositionerModel.Burchfield Then 'if serial and Burchfield
MsgBox("We do not currently support serial connections to Burchfield positioners. Try Ethernet connection.")
ElseIf _positionerModel = PumaEnums.PositionerModel.DirectedPerception Then 'if serial and direct perception
Try
_positioner = New FlirUnit()
_positioner.connect(address & port)
Dim posForm = New FlirPositionerForm(_main, _positioner)
posForm.Show()
Me.Close()
Catch ex As Exception
ErrorMessageFormat("Error trying to connect.", ex)
_positioner.dispose()
End Try
End If
End If
End Sub
Private Sub cmboBoxPositionerType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmboBoxPositionerType.SelectedIndexChanged
If cmboBoxPositionerType.SelectedIndex = 0 Then 'if Burchfield selected
_positionerModel = PumaEnums.PositionerModel.Burchfield
cmboBoxConnectionType.Enabled = True
ElseIf cmboBoxPositionerType.SelectedIndex = 1 Then 'if direct perception selected
_positionerModel = PumaEnums.PositionerModel.DirectedPerception
cmboBoxConnectionType.Enabled = True
End If
End Sub
Private Sub btnPositionConnectCancel_Click(sender As Object, e As EventArgs) Handles btnPositionConnectCancel.Click
Me.Dispose()
Me.Close()
End Sub
Private Sub ErrorMessageFormat(ByVal message As String, ByVal ex As Exception)
If ex.InnerException IsNot Nothing Then
MsgBox(message & vbNewLine & "Message:" & vbNewLine & ex.Message & vbNewLine & "Inner Exception" & vbNewLine & _
ex.InnerException.Message, vbMsgBoxSetForeground)
Else
MsgBox(message & vbNewLine & "Message:" & vbNewLine & ex.Message, vbMsgBoxSetForeground)
End If
End Sub
End Class | wboxx1/85-EIS-PUMA | puma/src/Supporting Forms/Positioners/PositionerConnectionForm.vb | Visual Basic | mit | 5,690 | [
30522,
17589,
3665,
2121,
1035,
29347,
2232,
2546,
1012,
20934,
11140,
3790,
26994,
2121,
8663,
13181,
2140,
17589,
3665,
2121,
1035,
29347,
2232,
2546,
1012,
5200,
1012,
4372,
17897,
28893,
17589,
3665,
2121,
1035,
29347,
2232,
2546,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import os
import json
from base import BaseController
from nqueens.models import Piece, Panel, Meta
class NQueensController(BaseController):
def __init__(self, view):
super(NQueensController, self)
self._piece_data = None
self._piece_cache = None
self.view = view
@classmethod
def get_instance(cls, view):
return cls(view)
def pre_switch(self):
pass
def start(self):
dim = self.view.get_dimension()
# Cached factory, only 1 file read per list
pieces = [Piece.from_file(self._piece_data) for i in range(dim)]
panel = Panel(dim)
self.view.notify({
'func': 'update_panel',
'data': {
'pieces': {},
}
})
res = self.run(panel, pieces, idx=0, ci=0)
if res:
self.view.notify({
'func': 'update_panel',
'data': {
'pieces': panel.pieces,
}
})
else:
self.view.notify({
'func': 'display_error',
'data': {
'message': 'No solution found :(',
}
})
def run(self, panel, pieces, idx, ci):
dim = panel.dimension
# Base case
if idx == len(pieces):
return True
else:
# Ultra-fast because:
# 1. All the pieces are the same (less combinations and shit)
# 2. We start from the previous index, this makes the panel smaller
# each time
# 3. Instead of keeping track of the killing positions we do a
# check each time a piece is added in order to avoid a kill
# (which is faster)
# 4. Python dict operations are astonishingly fast
for i in range(ci, dim):
for j in range(dim):
if panel.add_piece(pieces[idx], (i, j)):
if self.run(panel, pieces, idx+1, i):
return True
else:
panel.remove_piece(pieces[idx])
return False
def piece_selected(self, piece_name):
if not self._piece_cache:
self._piece_cache = Meta.get_piece_definitions()
self._piece_data = self._piece_cache.get(piece_name)
if self._piece_data:
self._piece_data = self._piece_data[1]
self.view.notify({
'func': 'enable_run',
'data': {
'enable': bool(self._piece_data),
}
})
@staticmethod
def get_pieces_attr(attr):
candidates = Meta.get_piece_definitions()
if all(attr in candidate[0].keys() for candidate in candidates.values()):
return [candidate[0][attr] for candidate in candidates.values()]
else:
return []
| PereBal/advanced-algorithms | nqueens/controller.py | Python | mit | 2,927 | [
30522,
12324,
9808,
12324,
1046,
3385,
2013,
2918,
12324,
2918,
8663,
13181,
10820,
2013,
1050,
4226,
6132,
1012,
4275,
12324,
3538,
1010,
5997,
1010,
18804,
2465,
1050,
4226,
6132,
8663,
13181,
10820,
1006,
2918,
8663,
13181,
10820,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package net.adanicx.cyancraft.client.model;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.adanicx.cyancraft.client.OpenGLHelper;
import net.adanicx.cyancraft.entities.EntityArmorStand;
@SideOnly(Side.CLIENT)
public class ModelArmorStand extends ModelArmorStandArmor {
public ModelRenderer standRightSide;
public ModelRenderer standLeftSide;
public ModelRenderer standWaist;
public ModelRenderer standBase;
public ModelArmorStand() {
this(0.0F);
}
public ModelArmorStand(float size) {
super(size, 64, 64);
bipedHead = new ModelRenderer(this, 0, 0);
bipedHead.addBox(-1.0F, -7.0F, -1.0F, 2, 7, 2, size);
bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F);
bipedBody = new ModelRenderer(this, 0, 26);
bipedBody.addBox(-6.0F, 0.0F, -1.5F, 12, 3, 3, size);
bipedBody.setRotationPoint(0.0F, 0.0F, 0.0F);
bipedRightArm = new ModelRenderer(this, 24, 0);
bipedRightArm.addBox(-2.0F, -2.0F, -1.0F, 2, 12, 2, size);
bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
bipedLeftArm = new ModelRenderer(this, 32, 16);
bipedLeftArm.mirror = true;
bipedLeftArm.addBox(0.0F, -2.0F, -1.0F, 2, 12, 2, size);
bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F);
bipedRightLeg = new ModelRenderer(this, 8, 0);
bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 11, 2, size);
bipedRightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
bipedLeftLeg = new ModelRenderer(this, 40, 16);
bipedLeftLeg.mirror = true;
bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 11, 2, size);
bipedLeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
standRightSide = new ModelRenderer(this, 16, 0);
standRightSide.addBox(-3.0F, 3.0F, -1.0F, 2, 7, 2, size);
standRightSide.setRotationPoint(0.0F, 0.0F, 0.0F);
standRightSide.showModel = true;
standLeftSide = new ModelRenderer(this, 48, 16);
standLeftSide.addBox(1.0F, 3.0F, -1.0F, 2, 7, 2, size);
standLeftSide.setRotationPoint(0.0F, 0.0F, 0.0F);
standWaist = new ModelRenderer(this, 0, 48);
standWaist.addBox(-4.0F, 10.0F, -1.0F, 8, 2, 2, size);
standWaist.setRotationPoint(0.0F, 0.0F, 0.0F);
standBase = new ModelRenderer(this, 0, 32);
standBase.addBox(-6.0F, 11.0F, -6.0F, 12, 1, 12, size);
standBase.setRotationPoint(0.0F, 12.0F, 0.0F);
}
@Override
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entity) {
super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entity);
if (entity instanceof EntityArmorStand) {
EntityArmorStand stand = (EntityArmorStand) entity;
bipedLeftArm.showModel = stand.getShowArms();
bipedRightArm.showModel = stand.getShowArms();
standBase.showModel = !stand.hasNoBasePlate();
bipedLeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
bipedRightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
standRightSide.rotateAngleX = 0.017453292F * stand.getBodyRotation().getX();
standRightSide.rotateAngleY = 0.017453292F * stand.getBodyRotation().getY();
standRightSide.rotateAngleZ = 0.017453292F * stand.getBodyRotation().getZ();
standLeftSide.rotateAngleX = 0.017453292F * stand.getBodyRotation().getX();
standLeftSide.rotateAngleY = 0.017453292F * stand.getBodyRotation().getY();
standLeftSide.rotateAngleZ = 0.017453292F * stand.getBodyRotation().getZ();
standWaist.rotateAngleX = 0.017453292F * stand.getBodyRotation().getX();
standWaist.rotateAngleY = 0.017453292F * stand.getBodyRotation().getY();
standWaist.rotateAngleZ = 0.017453292F * stand.getBodyRotation().getZ();
standBase.rotateAngleX = 0.0F;
standBase.rotateAngleY = 0.017453292F * -entity.rotationYaw;
standBase.rotateAngleZ = 0.0F;
}
}
@Override
public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) {
super.render(p_78088_1_, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_);
OpenGLHelper.pushMatrix();
if (isChild) {
float f6 = 2.0F;
OpenGLHelper.scale(1.0F / f6, 1.0F / f6, 1.0F / f6);
OpenGLHelper.translate(0.0F, 24.0F * p_78088_7_, 0.0F);
standRightSide.render(p_78088_7_);
standLeftSide.render(p_78088_7_);
standWaist.render(p_78088_7_);
standBase.render(p_78088_7_);
} else {
if (p_78088_1_.isSneaking())
OpenGLHelper.translate(0.0F, 0.2F, 0.0F);
standRightSide.render(p_78088_7_);
standLeftSide.render(p_78088_7_);
standWaist.render(p_78088_7_);
standBase.render(p_78088_7_);
}
OpenGLHelper.popMatrix();
}
}
| Cyancraft/Cyancraft | src/main/java/net/adanicx/cyancraft/client/model/ModelArmorStand.java | Java | gpl-3.0 | 4,767 | [
30522,
7427,
5658,
1012,
15262,
8713,
2595,
1012,
22330,
2319,
10419,
1012,
7396,
1012,
2944,
1025,
12324,
18133,
2860,
1012,
16913,
2015,
1012,
4718,
2140,
1012,
2128,
17298,
26091,
2099,
1012,
2217,
1025,
12324,
18133,
2860,
1012,
16913,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
td.key {
width: 1%;
}
TEXTAREA{
width: auto !important;
}
img.calendar {
vertical-align: top !important;
margin-left: 3px !important;
}
.params-line {
clear: both;
margin-bottom: 8px;
vertical-align: middle !important;
}
.params-line input,
.params-line select,
table.adminlist td fieldset input,
table.adminlist td fieldset select {
margin: 0px !important;
vertical-align: top;
margin-right: 10px !important;
clear: none !important;
float: none !important;
}
.params-line label,
table.adminlist td fieldset label {
clear: none !important;
float: none !important;
display: inline !important;
margin-right: 10px;
margin-top: 0px !important;
font-size: 12px !important;
vertical-align: top !important;
min-width: 250px !important;
}
.params-line fieldset,
table.adminlist td fieldset {
border: 0px solid white !important;
margin: 0px !important;
padding: 0px !important;
padding-left: 5px !important;
margin-right: 10px !important;
background-color: transparent !important;
display: inline !important;
vertical-align: middle !important;
}
.params-line fieldset label,
table.adminlist td fieldset label
{
margin: 0px 5px !important;
}
.params-line fieldset input,
table.adminlist td fieldset input
{
margin: 0px 3px !important;
}
.current{
width: 98% !important;
} | AxelFG/ckbran-inf | old/libraries/mint/forms/style.css | CSS | gpl-2.0 | 1,298 | [
30522,
14595,
1012,
3145,
1063,
9381,
1024,
1015,
1003,
1025,
1065,
3793,
12069,
2050,
1063,
9381,
1024,
8285,
999,
2590,
1025,
1065,
10047,
2290,
1012,
8094,
1063,
7471,
1011,
25705,
1024,
2327,
999,
2590,
1025,
7785,
1011,
2187,
1024,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
*
* Copyright (c) 2015-2017 Stanislav Zhukov
*
* 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.
*
*/
#ifndef YAPE_OPTEST_HPP
#define YAPE_OPTEST_HPP
#include "OpAND.hpp"
class OpTEST : public OpAND
{
public:
void Execute() override;
int GetOpcode() const override;
};
#endif //YAPE_OPTEST_HPP
| Koncord/YAPE | apps/Core/Instructions/OpTEST.hpp | C++ | apache-2.0 | 830 | [
30522,
1013,
1008,
1008,
1008,
9385,
1006,
1039,
1007,
2325,
1011,
2418,
9761,
19834,
15503,
7724,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
30524,
1013,
6105,
1011,
1016,
1012,
1014,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Woaf\HtmlTokenizer\HtmlTokens\Builder;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\LoggerInterface;
use Woaf\HtmlTokenizer\HtmlTokens\HtmlDocTypeToken;
use Woaf\HtmlTokenizer\ProtectedBuffer;
class HtmlDocTypeTokenBuilder implements LoggerAwareInterface
{
use LoggerAwareTrait;
/**
* @var ProtectedBuffer
*/
private $name = null;
/**
* @var ProtectedBuffer
*/
private $publicIdentifier = null;
/**
* @var ProtectedBuffer
*/
private $systemIdentifier = null;
/**
* @var boolean
*/
private $forceQuirks = false;
public function __construct(LoggerInterface $logger = null)
{
$this->name = new ProtectedBuffer();
$this->publicIdentifier = new ProtectedBuffer();
$this->systemIdentifier = new ProtectedBuffer();
$this->logger = $logger;
}
public function setNamePresent()
{
$this->name->init();
return $this;
}
public function appendToName($str)
{
$this->name->append($str);
return $this;
}
/**
* @param bool $forceQuirks
* @return HtmlDocTypeTokenBuilder
*/
public function isForceQuirks($forceQuirks)
{
$this->forceQuirks = $forceQuirks;
return $this;
}
public function build()
{
return new HtmlDocTypeToken($this->name->getValueOrNull(), $this->publicIdentifier->getValueOrNull(), $this->systemIdentifier->getValueOrNull(), $this->forceQuirks);
}
public function setPublicIdentifierPresent()
{
$this->publicIdentifier->init();
return $this;
}
public function setSystemIdentifierPresent()
{
$this->systemIdentifier->init();
return $this;
}
public function appendToPublicIdentifier($data)
{
$this->publicIdentifier->append($data);
return $this;
}
public function appendToSystemIdentifier($data)
{
$this->systemIdentifier->append($data);
return $this;
}
} | JonathanO/html-tokenizer | lib/Woaf/HtmlTokenizer/HtmlTokens/Builder/HtmlDocTypeTokenBuilder.php | PHP | mit | 2,072 | [
30522,
1026,
1029,
25718,
3415,
30524,
16129,
18715,
6132,
1032,
12508,
1025,
2224,
8827,
2099,
1032,
8833,
1032,
8833,
4590,
10830,
2890,
18447,
2121,
12172,
1025,
2224,
8827,
2099,
1032,
8833,
1032,
8833,
4590,
10830,
13465,
14995,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
NAME Parser
; Contains from the point of view of the Motor board,
; ParseSerialChar, which is a finite state machine
; that parses passed characters into serial commands,
; and its helper functions.
;
; Last Revision 12/27/2014 SSundaresh created
; 12/29/2014 SSundaresh restricted
; alphabet for hw9
; Base Constants
$INCLUDE (GenConst.inc)
$INCLUDE (Events.inc)
$INCLUDE (Errors.inc)
; Constants for valid characters, state bits
$INCLUDE (Parser.inc)
; Constants for execution calls
$INCLUDE (Motors.inc)
CGROUP GROUP CODE
CODE SEGMENT PUBLIC 'CODE'
ASSUME CS:CGROUP
; When a command is parsed, it must be executed. These
; are the commands to be executed. They are
; testing functions for now, but will be replaced by
; true versions later.
EXTRN SetMotorSpeed:NEAR
EXTRN GetMotorSpeed:NEAR
EXTRN GetMotorDirection:NEAR
EXTRN SetLaser:NEAR
EXTRN GetLaser:NEAR
EXTRN TransmitStatus:NEAR
EXTRN ClearEOFlag:NEAR
EXTRN GetEOFlag:NEAR
; Functional Spec, ParseSerialChar
; Description: this function implements a finite state machine
; that remembers its current state defined by past inputs, where
; the current state is a growing command. Invalid parsed commands
; yield AX = 1 and valid parsed commands are executed in-house,
; and yield a return value of AX = 0. The character to be parsed
; into the growing command is passed by value in AL.
; Operation: The simplest way to describe the operation of this function
; is to write out the state table.
;
; Ignore the command characters for the moment. All commands have
; a common grammar. If they take numerical arguments, the arguments must
; be be of the form -32768,+32767. This is not strictly in line with
; the specs for executable functions related to these commands,
; but checking the test code and the command formats, the commands themselves
; when sent over serial must have this restriction. It works out that
; if you want a speed of > 7fff, you just need to use both S and V commands
; instead of just one SetMotorSpeed.
; So, yes, all the various commands have different limits on the numbers,
; but first parsing whether the condition above is met gets us 95 percent
; of the way there. Finally checking whether we're in the bounds can be
; abstracted for now. So..
; Let CommandCharacter be K in VDFOR and let
; Bits543 of the StateBits be referenced as 543, and to update their state
; we write 543++. These bits refer to which digit we're considering in
; the argument, out of a maximum of 5 (10000s place).
;
; We're going to parse F, O, R commands till a \CR, expecting no arguments,
; and V, D will be parsed to either a \CR or at most 5 post-sign digits
; whichever comes first. At this point we will not yet be applying
; size cutoffs - it's just the grammar we're parsing here.
;
; The states of the form ArgZero exist to deal with inputs of the form
; K+-00000000... which are condensed to one state, which just tells us
; we've seen A digit, that was 0, so if we see a \CR next, it's ok,
; we did get an argument.
; So, let
; ESURSZFR = Execute, Status Update, Reset State, ZF Reset.
; CESURSZFR = Check Argument, conditional ESURSZFR, else Error, NotParsing
; where the argument is understood to be 0 if we're in the ArgZero states.
;
;
; Finally, until we reach an ArgZero state, assume there is a dedicated
; 0 state bit, and when we reach it, that bit goes high. Assume when we
; leave an ArgZero state the bit goes low again.
; Similarly assume there are three bits 543 that only take non-zero values
; for ArgGEQOne states, and there index the argument from digits 0-4 that we
; are currently waiting for. So, bits543 = 5 in binary implies an error, as
; there is now no way the magnitude of the argument could fit in [0,32768].
; These are understood, below. We increment 543++ for example, but if
; it yields a value >= 5 we would call an error and revert to NoParsing.
; In addition when we increment we also mean we would write the
; character c in question to a buffer for later conversion to a binary
; encoding, for bounds checking and as an input to command function calls.
; Input Class 1 2 3 4
; States\c v-r 0-9 +- \CR Lumped STATE_ID
; NotParsing Parsing(c) Error, NotParsing Error, NotParsing NotParsing 1
; Parsing_NoNumbersYet_SignUnclear Error, NotParsing K=f,o,r Error, NotParsing Error, NotParsing ESURSZFR 2
; K=v,d, c=1-9, Parsing_ArgGEQOne (sign clear, no sign) K=v-r, Error, NotParsing
; K=v,d, c=0, Parsing_ArgZero (sign clear, no sign)
; K=v,d, Parsing_NoNumbersYet (sign clear)
; All commands that reach the following states require numerical arguments.
; Parsing_ArgZero Error, NotParsing c=0 , Parsing_ArgZero Error, NotParsing CESURSZFR 3
; c=1-9, 543++ Parsing_ArgGEQOne
; Parsing_ArgGEQOne Error, NotParsing c=0-9, 543++ Parsing_ArgGEQOne Error, NotParsing CESURSZFR 4
; Parsing_NoNumbersYet Error, NotParsing c=0 , Parsing_ArgZero Error, NotParsing Error, NotParsing 5
; c=1-9, 543++ Parsing_ArgGEQOne
;
; These transitions and related outputs and error checking
; are broken up into helper functions equivalently named.
;
; Note that all the command-specific checks happen in either Lumped State 2
; or CESURSZFR, so as long as the grammar is maintained,
; adding commands requires that we change only two functions.
;
; Arguments: character c, in AL by value
; Return values: AX = 0 if c did not yield an invalid command state, else 1
; Constants: ParsingBit, SignBits, ZeroSeenBit, ArgIndexBits
; Local Variables:
; BL ParserStateBits
; AL input character, vetted, converted to lowercase
; Shared Variables: ParserStateBits
; Global Variables: none
; Registers used: AX, BX
; Stack depth: 0 words
; Input: none
; Output: none
; Error handling: none
; Algorithms: none
; Data structures: none
; Known bugs: none
; Limitations: not visually simple, like macros/lookup tables
; Revision History:
; 12/27/2014 SSundaresh created
; 12/29/2014 SSundaresh state table updated for hw9 command set
; Pseudocode
; Check if input is a valid character using ValidateInputCharacter
; If not, ignore - call ReportValid and return.
; If valid, now have it in AL in lowercase (if applicable).
; Split into states, and call appropriate state output/transition functions
; which set the ZF if there was a problem (which they handled).
; Check the zero-flag and if it is set, report a parsing error, and otherwise
; report no parsing error.
ParseSerialChar PROC NEAR
PUBLIC ParseSerialChar
CALL ValidateInputCharacter ; c in AL in lowercase if ok
JZ Report_Valid_Character ; ZF set, ignorable input
JNZ Allowed_Character
Allowed_Character:
MOV BX, offset(ParserStateBits) ; identify current state
MOV BL, DS:[BX]
MOV BH, ParsingBit ; are we parsing a command
AND BH, BL
JZ STATE_NotParsing ; we are not parsing a command
; we're parsing a command
MOV BH, SignBits ; are we sure of the argument sign
AND BH, BL ; yet
JZ STATE_Parsing_NoNumbersYet_SignUnclear
; yes, we're sure of a sign bit
MOV BH, NoNumbersBit
AND BH, BL
JZ STATE_Parsing_NoNumbersYet
; yes, we've seen at least a digit
AND BH, ZeroSeenBit
JNZ STATE_Parsing_ArgZero
JMP STATE_Parsing_ArgGEQOne
STATE_NotParsing:
CALL NotParsing ; AL contains valid character
JMP ParserReporting
STATE_Parsing_NoNumbersYet_SignUnclear:
CALL Parsing_NoNumbersYet_SignUnclear ; AL contains valid character
JMP ParserReporting
STATE_Parsing_NoNumbersYet:
CALL Parsing_NoNumbersYet
JMP ParserReporting
STATE_Parsing_ArgGEQOne:
CALL Parsing_ArgGEQOne ; AL contains valid character
JMP ParserReporting
STATE_Parsing_ArgZero:
CALL Parsing_ArgZero ; AL contains valid character
JMP ParserReporting
ParserReporting:
JZ Report_ParsingError
JNZ Report_Valid_Character
Report_Valid_Character:
MOV AX, 0
JMP Done_Parsing
Report_ParsingError:
CALL ResetParserState ; reset to NotParsing
MOV AX, 1
JMP Done_Parsing
Done_Parsing:
RET
ParseSerialChar ENDP
; helper functions follow to make ParseSerialChar easier to read
; ValidateInputCharacter
; Description. Takes input character in AL. Checks if allowed, given
; Valid_Characters code table. If allowed, converts to lowercase
; if the character is an ASCII letter, and regardless returns it in AL.
; If the character is not allowed it returns with the ZF set.
; Operation: This code depends heavily on the ASCII set used to
; transmit commands. That is, the way uppercase letters are identified
; is entirely dependent on us not using other characters on those lines
; as command characters. Be careful.
; Loops through the code table of allowed characters and if it finds a
; match checks if its a letter and uses the ASCII encoding to
; shift the letter to lowercase if it is uppercase (ASCIII_UL bit not set).
; Returns with the ZF reset by clearing AH and adding a non-zero constant.
; If the character is not found, by default clears AH and ZF is set.
; Arguments: AL, input character c
; Return Values: ZF set if not an allowed character.
; ZF reset if allowed.
; Constants: Valid_Characters, a code table.
; NUM_VALID_CHARACTERS, size of the code table.
; Local Variables:
; BX absolute index in code table
; AL ASCII character to validate
; CX, counter so we know when to stop looking
; Registers Used: AX, BX
; Last Revised: 12/27/2014 SSundaresh created
ValidateInputCharacter PROC NEAR
PUBLIC ValidateInputCharacter
MOV CX, 0 ; start at the beginning of
; Valid_Characters
MOV BX, offset(Valid_Characters) ; CS:BX is Valid_Characters[0]
ValidationLoop_ST:
CMP AL, CS:[BX] ; is this our character?
JE FORMAT_CHARACTER ; if so, format it
INC CX
INC BX ; o/w move to the next
CMP CX, NUM_VALID_CHARACTERS ; if we've checked all of Valid_Characters
JNE ValidationLoop_ST ; this isn't a valid character.
INVALID_CHARACTER:
CALL SetZF
JMP DONE_PROCESSING_CHARACTER
FORMAT_CHARACTER:
MOV BL, ASCIILetterIdentifier ; let's check if the character is
; a letter.
AND BL, AL
JZ ALMOST_DONE_PROCESSING ; not a letter
; is a letter
; is it uppercase?
MOV BL, ASCIII_UL
AND BL, AL
JZ ASCII_Uppercase ; if that bit isn't set, Uppercase
JNZ ALMOST_DONE_PROCESSING
ASCII_Uppercase:
ADD AL, ASCIII_UL ; convert letter to lowercase
ALMOST_DONE_PROCESSING:
CALL ClearZF
JMP DONE_PROCESSING_CHARACTER
DONE_PROCESSING_CHARACTER:
RET
ValidateInputCharacter ENDP
; SetZF
; Sets the ZF, destroying AH in the process.
; Registers used: AH
SetZF PROC NEAR
PUBLIC SetZF
XOR AH, AH ; set ZF
RET
SetZF ENDP
; ClearZF
; Clears the ZF, screwing up AH in the process.
; Registers used: AH
ClearZF PROC NEAR
PUBLIC ClearZF
XOR AH, AH ; clear AH
ADD AH, 1 ; clear ZF
RET
ClearZF ENDP
; StoreArgDigit
; Description: Takes input digit character for current command in AL.
; If storing this digit would not set ParserStateBits 543 (argument index)
; greater than Parser_MAX_DIGITS, stores it in the buffer
; ParserNumericalArgumentBuffer at the index
; specified by bits 543 of the current ParserStateBits. Increments
; these state bits to point to the next open position in the buffer
; and returns ZF reset.
; Otherwise does not modify state bits.
;
; If adding would overflow buffer, i.e. if bits 543 + 1 >
; Parser_MAX_DIGITS, sets ZF and doesn't add anything to buffer.
;
; Might fail if ParserStateBits 543 not currently in 0,Parser_MAX_DIGITS-1
;
; Arguments: AL, digit in 0-9 ASCII.
; Return Value: ZF set/reset as described above.
; Registers Used: AX, BX, DI
; Last Revised: 12/28/2014 SSundaresh created
StoreArgDigit PROC NEAR
PUBLIC StoreArgDigit
MOV DI, offset(ParserStateBits) ; identify current state
MOV BL, DS:[DI]
AND BL, ArgIndexBits
SHR BL, 3 ; isolate ArgIndexBits and get them to bits 210
XOR BH, BH ; in BX
PUSH BX ; store BX, current relative argument index
INC BL
CMP BL, Parser_MAX_DIGITS
JG ArgBufferOverflow
; no overflow, prepare to add arg to buffer
; and update index in state bits
SHL BL, 3 ; get updated index in right position
MOV BH, DS:[DI] ; get state bits in BH
AND BH, ArgIndexMask ; clear out index bits in BH
ADD BH, BL ; replace with updated index bits
MOV DS:[DI], BH ; store updated state
POP BX ; get relative index to store arg
ADD BX, offset(ParserNumericalArgumentBuffer)
; BX is now an absolute address in DS
MOV DS:[BX], AL ; store AL there
CALL ClearZF
JMP StoreArgDigit_DONE
ArgBufferOverflow:
POP BX ; so we don't have mismatched push/pops
CALL SetZF
JMP StoreArgDigit_DONE
StoreArgDigit_DONE:
RET
StoreArgDigit ENDP
; NotParsing
; Description.
; This is the state NotParsing.
; Input Class 1 2 3 4
; States\c v-r 0-9 +- \CR Lumped STATE_ID
; NotParsing Parsing(c) Error, NotParsing Error, NotParsing NotParsing 1
; Takes input character in AL. The character is
; guaranteed to be in Valid_Characters, which for now
; means it is in 0-9, +-, vdfor, or ASCII_CR. Since whitespace
; has been ignored before this point, seeing ASCII_CR in this state
; is equivalent to having seen a blank line, and seeing 0-9+-
; is invalid, as we by definiton haven't yet seen a command character.
; So, depending on the input character, this function will transition
; the state to either Parsing (with a target CommandCharacter set and
; state bits set), or stay in NotParsing, if a line break is seen,
; or stay in Not Parsing, but report back an error by setting the ZF.
; By default if there is no issue the ZF is reset.
; Arguments: AL, input character c in lowercase
; Return Values: ZF set if parsing error noted
; ZF reset otherwise
; Constants: ASCII_CR, ASCIILetterIdentifier
; SBP_NoNumbersYet_SignUnclear
; Local Variables:
; AL, c character
; AH masks and state bits
; Registers Used: AX, DI
; Last Revised: 12/27/2014 SSundaresh created
NotParsing PROC NEAR
PUBLIC NotParsing
MOV AH, ASCIILetterIdentifier ; AL has character c
AND AH, AL ; letter will yield > 0
JNZ State1_CommandID ; letter is command
; start parsing
MOV AH, ASCII_CR
CMP AH, AL ; either it is a
; blank line, or
; it is an error
JNE State1_ParseError
JMP State1_ValidInput ; stay NotParsing
State1_ParseError: ; c was 0-9+-
CALL SetZF
JMP State1_Done
State1_CommandID:
MOV DI, offset(CommandCharacter)
MOV DS:[DI], AL
MOV AH, SBP_NoNumbersYet_SignUnclear
MOV DI, offset(ParserStateBits)
MOV DS:[DI], AH
; set new state
JMP State1_ValidInput
State1_ValidInput:
CALL ClearZF
State1_Done:
RET
NotParsing ENDP
; Parsing_NoNumbersYet_SignUnclear
; Description: Takes input c in AL in lowercase.
; Sets ZF if parse error noted, else clears.
; The states transitions:
; Input Class 1 2 3 4
; States\c v-r 0-9 +- \CR Lumped STATE_ID
; Parsing_NoNumbersYet_SignUnclear Error, NotParsing K=f,o,r Error, NotParsing Error, NotParsing ESURSZFR 2
; K=v,d, c=1-9, Parsing_ArgGEQOne (sign clear, no sign) K=s-e, Error, NotParsing
; K=v,d, c=0, Parsing_ArgZero (sign clear, no sign)
; K=v,d, Parsing_NoNumbersYet (sign clear)
; Arguments: AL, input character c in lowercase
; Return Values: ZF set if parsing error noted
; ZF reset otherwise
; Registers Used: AX, BX (in calls), DI
; Last Revised: 12/27/2014 SSundaresh created
; PseudoCode
; is the input a letter? If so, error.
; is the input a number? If f,o,r commands, error, else transition on c=0, 1-9.
; is the input a sign? if f,o,r commands, error, else, no issue,
; set sign bit and transition
; is the input a \CR? if f,o,r commands, great, call execute, but if not,
; error.
;
; Note: by construction of SerialParseChar parse errors (ZFs) force a
; transition to NotParsing, and that ExecuteCommand will reset to NotParsing
; after a valid execution.
Parsing_NoNumbersYet_SignUnclear PROC NEAR
PUBLIC Parsing_NoNumbersYet_SignUnclear
MOV AH, ASCIILetterIdentifier ; identify input class
AND AH, AL
JNZ State2_LetterInput
MOV AH, ASCIINumberIdentifier
AND AH, AL
JNZ State2_NumberInput
MOV AH, ASCIISignIdentifier
AND AH, AL
JNZ State2_SignInput
; only other option is \CR
State2_ASCIICRInput:
MOV DI, offset(CommandCharacter)
MOV AH, DS:[DI]
CMP AH, 'f' ; f command complete
JE State2_Execute_Command
CMP AH, 'o' ; o command complete
JE State2_Execute_Command
CMP AH, 'r' ; r command complete
JE State2_Execute_Command
JMP State2_ParseError ; else with \CR input, error.
State2_LetterInput:
JMP State2_ParseError ; multi command per line error
State2_NumberInput:
MOV DI, offset(CommandCharacter)
MOV AH, DS:[DI]
CMP AH, 'f' ; f takes no arguments
JE State2_ParseError
CMP AH, 'o' ; o parse error
JE State2_ParseError
CMP AH, 'r' ; r parse error
JE State2_ParseError
CMP AL, '0' ; if number is 0, no Sign, ArgZero
; else 1-9, so noSign, ArgGEQone
JE State2_Transition_ArgZero_noSign
JMP State2_Transition_ArgGEQOne_noSign
State2_Transition_ArgZero_noSign:
MOV AH, SBP_ArgZero_noSign
MOV DI, offset(ParserStateBits)
MOV DS:[DI], AH ; set new state
JMP State2_ValidInput
State2_Transition_ArgGEQOne_noSign:
MOV AH, SBP_ArgGEQOne_noSign
MOV DI, offset(ParserStateBits)
MOV DS:[DI], AH ; set new state
CALL StoreArgDigit ; digit in AL, stores in
; ParserNumericalArgumentBuffer
; increments arg index state bits'
; ZF implies too many input digits
; (not possible here)
JNZ State2_ValidInput
JZ State2_ParseError
State2_SignInput:
MOV DI, offset(CommandCharacter)
MOV AH, DS:[DI]
CMP AH, 'f' ; f parse error
JE State2_ParseError
CMP AH, 'o' ; o parse error
JE State2_ParseError
CMP AH, 'r' ; r parse error
JE State2_ParseError
State2_SignedTransition:
CMP AL, '-'
JNE State2_Transition_PosSign
JE State2_Transition_NegSign
State2_Transition_NegSign:
MOV AH, SBP_NoNumbersYet_negative
MOV DI, offset(ParserStateBits)
MOV DS:[DI], AH ; set new state
JMP State2_ValidInput
State2_Transition_PosSign:
MOV AH, SBP_NoNumbersYet_positive
MOV DI, offset(ParserStateBits)
MOV DS:[DI], AH ; set new state
JMP State2_ValidInput
State2_ParseError:
CALL SetZF
JMP State2_Done
State2_Execute_Command:
CALL ExecuteCommand
JMP State2_Done
State2_ValidInput:
CALL ClearZF
JMP State2_Done
State2_Done:
RET
Parsing_NoNumbersYet_SignUnclear ENDP
; Parsing_ArgZero
; Description: Takes input c in AL in lowercase.
; Sets ZF if parse error noted, else clears.
; The states transitions:
; Input Class 1 2 3 4
; States\c v-r 0-9 +- \CR Lumped STATE_ID
; Parsing_ArgZero Error, NotParsing c=0 , Parsing_ArgZero Error, NotParsing CESURSZFR 3
; c=1-9, 543++ Parsing_ArgGEQOne
; Arguments: AL, input character c in lowercase
; Return Values: ZF set if parsing error noted
; ZF reset otherwise
; Registers Used: AX, BX (in calls), DI
; Last Revised: 12/28/2014 SSundaresh created
; PseudoCode.
; Only commands that take arguments get this far.
; is the input a letter? If so, error.
; is the input a number? Transition on c=0, 1-9.
; is the input a sign? If so, error.
; is the input a \CR? Call ExecuteCommand, which carries out CESURSZFR.
Parsing_ArgZero PROC NEAR
PUBLIC Parsing_ArgZero
MOV AH, ASCIILetterIdentifier ; identify input class
AND AH, AL
JNZ State3_LetterInput
MOV AH, ASCIINumberIdentifier
AND AH, AL
JNZ State3_NumberInput
MOV AH, ASCIISignIdentifier
AND AH, AL
JNZ State3_SignInput
; only other option is \CR
State3_ASCIICRInput:
JMP State3_Execute_Command
State3_LetterInput:
JMP State3_ParseError ; multi command per line error
State3_NumberInput:
CMP AL, '0' ; if number is 0, stay in ArgZero
; else 1-9, transition to ArgGEQOne
JE State3_ValidInput ; with appropriate sign bit.
JMP State3_Transition_ArgGEQOne
State3_Transition_ArgGEQOne:
MOV BH, SignBits
MOV DI, offset(ParserStateBits)
MOV AH, DS:[DI]
AND BH, AH ; get sign bits in BH
MOV AH, SBP_ArgGEQOne
ADD AH, BH ; full transition state with proper sign
MOV DS:[DI], AH ; set new state
CALL StoreArgDigit ; digit in AL, stores in
; ParserNumericalArgumentBuffer
; increments arg index state bits'
; ZF implies too many input digits
; (not possible here)
JNZ State3_ValidInput
JZ State3_ParseError
State3_SignInput:
JMP State3_ParseError
State3_ParseError:
CALL SetZF
JMP State3_Done
State3_Execute_Command:
CALL ExecuteCommand
JMP State3_Done
State3_ValidInput:
CALL ClearZF
JMP State3_Done
State3_Done:
RET
Parsing_ArgZero ENDP
; Parsing_ArgGEQOne
; Description: Takes input c in AL in lowercase.
; Sets ZF if parse error noted, else clears.
; The states transitions:
; Input Class 1 2 3 4
; States\c v-r 0-9 +- \CR Lumped STATE_ID
; Parsing_ArgGEQOne Error, NotParsing c=0-9, 543++ Parsing_ArgGEQOne Error, NotParsing CESURSZFR 4
;
; Arguments: AL, input character c in lowercase
; Return Values: ZF set if parsing error noted
; ZF reset otherwise
; Registers Used: AX, BX (in calls)
; Last Revised: 12/28/2014 SSundaresh created
; PseudoCode.
; Only commands that take arguments get this far.
; is the input a letter? If so, error.
; is the input a number? Stay in this state unless bits 543 > Parser_MAX_DIGITS
; is the input a sign? If so, error.
; is the input a \CR? Call ExecuteCommand, which carries out CESURSZFR.
Parsing_ArgGEQOne PROC NEAR
PUBLIC Parsing_ArgGEQOne
MOV AH, ASCIILetterIdentifier ; identify input class
AND AH, AL
JNZ State4_LetterInput
MOV AH, ASCIINumberIdentifier
AND AH, AL
JNZ State4_NumberInput
MOV AH, ASCIISignIdentifier
AND AH, AL
JNZ State4_SignInput
; only other option is \CR
State4_ASCIICRInput:
JMP State4_Execute_Command
State4_LetterInput:
JMP State4_ParseError ; multi command per line error
State4_NumberInput:
CALL StoreArgDigit ; digit in AL, stores in
; ParserNumericalArgumentBuffer
; increments arg index state bits'
; ZF implies too many input digits
; (not possible here)
JNZ State4_ValidInput
JZ State4_ParseError
State4_SignInput:
JMP State4_ParseError
State4_ParseError:
CALL SetZF
JMP State4_Done
State4_Execute_Command:
CALL ExecuteCommand
JMP State4_Done
State4_ValidInput:
CALL ClearZF
JMP State4_Done
State4_Done:
RET
Parsing_ArgGEQOne ENDP
; Parsing_NoNumbersYet
; Description: Takes input c in AL in lowercase.
; Sets ZF if parse error noted, else clears.
; The states transitions:
; Input Class 1 2 3 4
; States\c v-r 0-9 +- \CR Lumped STATE_ID
; Parsing_NoNumbersYet Error, NotParsing c=0 , Parsing_ArgZero Error, NotParsing Error, NotParsing 5
; c=1-9, 543++ Parsing_ArgGEQOne
; Arguments: AL, input character c in lowercase
; Return Values: ZF set if parsing error noted
; ZF reset otherwise
; Registers Used: AX, BX (in calls), DI
; Last Revised: 12/28/2014 SSundaresh created
; PseudoCode.
; Only commands that take arguments get this far.
; is the input a letter? If so, error.
; is the input a number? Transition on c=0, 1-9.
; is the input a sign? If so, error.
; is the input a \CR? If so, error.
Parsing_NoNumbersYet PROC NEAR
PUBLIC Parsing_NoNumbersYet
MOV AH, ASCIILetterIdentifier ; identify input class
AND AH, AL
JNZ State5_LetterInput
MOV AH, ASCIINumberIdentifier
AND AH, AL
JNZ State5_NumberInput
MOV AH, ASCIISignIdentifier
AND AH, AL
JNZ State5_SignInput
; only other option is \CR
State5_ASCIICRInput:
JMP State5_ParseError
State5_LetterInput:
JMP State5_ParseError ; multi command per line error
State5_NumberInput:
MOV BH, SignBits
MOV DI, offset(ParserStateBits)
MOV AH, DS:[DI]
AND BH, AH ; get sign bits in BH
CMP AL, '0' ; if number is 0, trans to ArgZero
; else 1-9, transition to ArgGEQOne
; with appropriate sign bit.
JE State5_Transition_ArgZero
JMP State5_Transition_ArgGEQOne
State5_Transition_ArgZero:
MOV AH, SBP_ArgZero
ADD AH, BH ; full transition state with proper sign
MOV DS:[DI], AH ; set new state
JMP State5_ValidInput
State5_Transition_ArgGEQOne:
MOV AH, SBP_ArgGEQOne
ADD AH, BH ; full transition state with proper sign
MOV DS:[DI], AH ; set new state
CALL StoreArgDigit ; digit in AL, stores in
; ParserNumericalArgumentBuffer
; increments arg index state bits'
; ZF implies too many input digits
; (not possible here)
JNZ State5_ValidInput
JZ State5_ParseError
State5_SignInput:
JMP State5_ParseError
State5_ParseError:
CALL SetZF
JMP State5_Done
State5_ValidInput:
CALL ClearZF
JMP State5_Done
State5_Done:
RET
Parsing_NoNumbersYet ENDP
; ExecuteCommand
; Description: Called when a \CR is input to ParseSerialChar
; and the current parse state is otherwise Parsing and valid. For the current
; CommandCharacter, does bounds-checks on the argument in
; ParserNumericalArgumentBuffer if the ZeroSeenBit is not set in the
; ParserStateBits. This requires converting the parsed string argument
; into a signed 16-bit binary number using SignedDecString2Bin,
; an internal conversion function.
;
; If the ZeroSeenBit is set, the argument is understood to be 0.
; If the sign bit is not specified, the argument at this stage is
; understood to be positive.
;
; If the argument fits within a signed word, this function uses
; the sign bit (+,-,none) to determine which execution function would need
; to be called (absolute, relative settings, for example).
; If relative settings are required, the current MotorBoard state is
; accessed and the desired relative mutation is calculated.
; This net (absolute) setting is bounds-checked, on a command-by-command
; basis. If the argument is within bounds, appropriate execution
; functions are called.
; In all cases where arguments are not in bounds, the ZF is set and
; the function immediately returns.
; If the arguments are in bounds, the execution function is called,
; we request that the Motor Board status be transmitted, and we reset the
; parser state to NotParsing to await the next command, then return
; with the ZF reset.
;
;
; Note: If this ParseSerialChar is called when Handlers.EOFlag is set,
; this function will not execute any command but R, and will
; return ZF reset for anything else that makes it here.
;
; Shared Variables: CommandCharacter, ParserNumericalArgumentBuffer,
; ParserStateBits
; Arguments: none
; Return Values:
; ZF set if arguments parsed do not match specified bounds for the CommandChar
; ZF reset if command arguments in valid bounds, and command called.
; Resets parser state to NotParsing if it executes a valid command.
; Registers Used: AX,BX,CX,DX,SI,DI,flags, considering nested functions
; Last Revised: 12/28/2014 SSundaresh created
; 12/29/2014 SSundaresh removed S,T,E commands, added R
; added error handling state
; for parsing after an error.
; only R command is recognized then.
ExecuteCommand PROC NEAR
PUBLIC ExecuteCommand
CALL GetEOFlag
MOV AL, BL ; store EO flag from Handlers.asm in AL
MOV SI, offset(CommandCharacter)
MOV BL, DS:[SI] ; first deal with those that don't
; take arguments
CMP BL, 'r'
JE EXECUTE_COMMAND_R
OR AL, AL ; is EOF set?
JNZ EC_ParsingDuringError ; if so, just return with ZF reset
JZ EC_NO_EOF_SET
EC_ParsingDuringError:
CALL ResetParserState
CALL ClearZF
JMP EC_Done
EC_NO_EOF_SET:
CMP BL, 'f'
JE EXECUTE_COMMAND_F
CMP BL, 'o'
JE EXECUTE_COMMAND_O
; everything else takes an argument
; with clear sign. before splitting
; off to deal on a command-by-command
; basis, do some gross error checking
MOV SI, offset(ParserStateBits)
MOV AL, DS:[SI]
MOV AH, ZeroSeenBit
AND AH, AL
JZ ExecuteWithArgGEQOne ; otherwise, argument 0,
; no need for further error checking
JMP ExecuteWithArgZero
ExecuteWithArgGEQOne:
MOV AH, SignBits
AND AH, AL ; get just sign bits in AH
MOV BH, NegSignBit ; check sign before conversion
; for initial bounds-checking
; if not negative, default positive
CMP AH, BH
JE BOUNDS_CHECK1_NEGATIVE
JNE BOUNDS_CHECK1_POSITIVE
BOUNDS_CHECK1_NEGATIVE:
MOV BH, 1 ; see SignedDecString2Bin spec
; BH contains 1 if sign negative
JMP BOUNDS_CHECK1
BOUNDS_CHECK1_POSITIVE:
MOV BH, 0 ; and 0 if sign positive
JMP BOUNDS_CHECK1
BOUNDS_CHECK1:
MOV BL, AL
AND BL, ArgIndexBits
SHR BL, 3 ; BL contains n, length of arg string
MOV SI, offset(ParserNumericalArgumentBuffer)
; SI contains string offset in DS
CALL SignedDecString2Bin ; now ZF tells us if there's an OF
; and BX contains binarized argument
JZ EC_ParseError
MOV AX, BX ; argument was in loosest bounds
; move to AX and do careful checks
JMP Execute_ArgumentPassedCheck1
ExecuteWithArgZero:
MOV AX, 0
JMP Execute_ArgumentPassedCheck1 ; want to handle all commands
; with same code.
Execute_ArgumentPassedCheck1: ; binarized argument in AX
; get parser state, command char
; in BL, BH
MOV SI, offset(CommandCharacter)
MOV BH, DS:[SI]
MOV SI, offset(ParserStateBits)
MOV BL, DS:[SI]
CMP BH, 'v'
JE EXECUTE_COMMAND_V
CMP BH, 'd'
JE EXECUTE_COMMAND_D
EXECUTE_COMMAND_F:
CALL COMMAND_F
JMP EC_ValidInput
EXECUTE_COMMAND_O:
CALL COMMAND_0
JMP EC_ValidInput
EXECUTE_COMMAND_R:
CALL COMMAND_R
JMP EC_ValidInput
; previous bounds check is suffient here.
EXECUTE_COMMAND_V:
CALL COMMAND_V
JMP EC_ValidInput
EXECUTE_COMMAND_D:
CALL COMMAND_D
JMP EC_ValidInput
EC_ValidInput:
CALL TransmitStatus
CALL ResetParserState
CALL ClearZF
JMP EC_Done
EC_ParseError:
CALL SetZF
JMP EC_Done
EC_Done:
RET
ExecuteCommand ENDP
; See Comments and ExecuteCommand for Details on when the following
; are called. They are stub functions, originally part of ExecuteCommand
; but split to avoid far-jump errors.
; Each of the functions below implements the Serial Command Format Spec.
; For each, below, expect BL = state, AX argument, signed 16bit
COMMAND_F PROC NEAR
PUBLIC COMMAND_F
MOV AX, 1 ; AX nonzero turns laser on
CALL SetLaser
RET
COMMAND_F ENDP
COMMAND_0 PROC NEAR
PUBLIC COMMAND_0
MOV AX, 0 ; see COMMAND_F
CALL SetLaser
RET
COMMAND_0 ENDP
COMMAND_R PROC NEAR
PUBLIC COMMAND_R
MOV AX, 0 ; just set speed, direction to 0
MOV BX, 0
CALL SetMotorSpeed
CALL ClearEOFlag ; clear error_occurred flag just
; in case that's why we saw R
RET
COMMAND_R ENDP
COMMAND_V PROC NEAR
PUBLIC COMMAND_V
PUSH AX
CALL GetMotorSpeed
MOV BX, AX
POP AX ; AX = relative speed in [-32768,32767]
; BX = current speed in [0,65534]
; if we consider TEST11, which
; is of the form
; S+32767 = 7fff
; V+32767 = 7fff
; Expected Output: Speed fffe.
; So, here, we make a decision:
; If V forces speed > 65534 by adding,
; we truncate to 65534.
; If V forces speed < 0 by adding
; we truncate to 0.
; BX can be in [0,fffe] unsigned
; AX can be in [-8000,7fff] signed
; so break it up.
; if BX SF is set, AX > 0
; -BX works out to 2^16-BX >= 2
; so if AX >= |2^16-BX|-2
; we'll hit either ffff or overflow,
; both of which are bad for us.
; if BX SF is set, AX < 0
; no issue when we just add
; if BX SF is unset, AX > 0
; no issue when we just add
; if BX SF is unset, AX < 0
; if BX + AX < 0 we set to 0 instead
OR BX, BX ; set SF by BX
JS BX_SF_SET
JNS BX_SF_UNSET
BX_SF_SET:
CMP AX, 0
JLE COMMAND_V_JustAdd
MOV CX, BX ; AX > 0
NEG CX ; this acts like |2^16-BX| effectively for AX > 0, at least
MOV DI, 2
NEG DI
ADD CX, DI ; |2^16-BX|-2
CMP AX, CX
JGE COMMAND_V_MAX_SPEED
JL COMMAND_V_JustAdd
BX_SF_UNSET:
CMP AX, 0
JGE COMMAND_V_JustAdd
JL COMMAND_V_CompareMagnitudes ; AX < 0, is -AX > BX, will BX+AX < 0?
COMMAND_V_CompareMagnitudes:
MOV CX, AX
NEG CX
CMP CX, BX
JLE COMMAND_V_JustAdd
JG COMMAND_V_Halt ; negative result, so halt
COMMAND_V_JustAdd:
ADD AX, BX
MOV BX, SAME_ANGLE
CALL SetMotorSpeed
JMP V_DONE
COMMAND_V_Halt:
MOV AX, 0
MOV BX, SAME_ANGLE
CALL SetMotorSpeed
JMP V_DONE
COMMAND_V_MAX_SPEED:
MOV AX, MAX_SPEED
MOV BX, SAME_ANGLE
CALL SetMotorSpeed
JMP V_DONE
V_DONE:
RET
COMMAND_V ENDP
COMMAND_D PROC NEAR
PUBLIC COMMAND_D
; the spec assumes CW angles
; but in Motors I made my case for
; why CCW made more sense given
; the test cases for HW6 so
; 'right' and 'left' here mean
; decrease and increase theta
; respectively, from my POV.
; get Current Direction in [0,359]
; know our angle is of the form
; [-32768, 32767]
; don't want to risk overflow,
; and don't want to risk
; sending 32768 by accident
; (seen as SAME but not from
; this command's perspective).
; if positive, subtract 720
; with no risk of overflow
; if negative, add 720
; with no risk of overflow
; and without changing
; the direction mod 360.
;
; then just add to Current Direction
; and rely on
; SetMotorSpeed(65535, new angle)
; to calculate the modulus.
OR AX, AX ; get SF set
JS ADD_720
JNS SUB_720
ADD_720:
ADD AX, 720
JMP COMMANDD_UPDATE_DIRECTION
SUB_720:
SUB AX, 720
JMP COMMANDD_UPDATE_DIRECTION
COMMANDD_UPDATE_DIRECTION:
MOV BX, AX ; store our argument
CALL GetMotorDirection
; AX holds current direction in 0,359
ADD BX, AX
MOV AX, SAME_SPEED
CALL SetMotorSpeed
RET
COMMAND_D ENDP
; Code Segment Arrays for
; Numerical String Conversion Constants (internal conversions)
; MaxPositiveArgument
; A code segment array containing the ASCII string '32767'
;
; Author: SSundaresh
; Last Modified: 12/28/2014
MaxPositiveArgument LABEL BYTE
PUBLIC MaxPositiveArgument
DB '3'
DB '2'
DB '7'
DB '6'
DB '7'
; MaxNegativeArgument
; A code segment array containing the ASCII string '32768'
;
; Author: SSundaresh
; Last Modified: 12/28/2014
MaxNegativeArgument LABEL BYTE
PUBLIC MaxNegativeArgument
DB '3'
DB '2'
DB '7'
DB '6'
DB '8'
; SignedDecString2Bin
;
; Note
; I do not believe this function belongs in Converts.asm.
; It is too specific to the problem at hand, and its input
; specifications are strict enough that
; I'd not likely use it again for another purpose.
; So this feels more like an internal (private) function to me.
;
; Arguments:
; Takes a string from 1-5 ASCII decimal digits at address DS:SI, passed in SI
; by reference, without leading zeros (i.e. binary magnitude is greater than 0)
; and ordered in index 0..n-1 (n length) from MSD to LSD.
; Takes an intended sign in BH (0 +, 1 -) and
; takes the string length in BL.
; Return Values:
; Returns in BX the word equivalent of the
; signed decimal string if there is no overflow during conversion,
; i.e. if the string is of the form [-32768, +32767],
; and resets the ZF. Otherwise sets the ZF to signify an overflow.
; Operation
; First, we take advantage of the fact that ASCII 0-9 are numerically
; ordered in their binary encoding as well, to decide whether
; our input string will fit in [-32768, +32767].
; If the string length is =5, we compare char by char with the
; code-strings '32678' (if the sign is negative) or
; '32767' (if the sign is positive) from MSD to LSD.
; The first time our input char is less than those code-strings,
; we stop, we know we have no overflow. If we reach the end and are
; at most equal to those code-strings, still no issue.
; If in this way, we at some point are greater than the code-strings,
; we will have an overflow so we set the ZF and exit.
; If the string length is <5, we're fine.
; If we've reached this point we can convert the string input, raw,
; as a positive quantity in [0,32768] and negate it afterwards if
; need be, with no worry about overflow.
; Convert raw characters ASCII to binary by masking high 4 bits of
; argument characters, which yield binary 0-9 in the low nibble.
; As there are n>0 characters to process, the first has power
; 10^(n-1), so we can multiply by this. We store this
; then proceed to the next digit, multiply by 10^(n-2), add, store,
; repeat till we're out of input characters.
; The result is negated if the input sign value was 1, and remains
; as is if the input sign value was 0.
; This is returned in BX along with a reset ZF.
; Constants: MaxPositiveArgument, MaxNegativeArgument code strings
; Local Variables (meaning changes, so some are shown twice):
; First, INIT OVERFLOW CHECk
; SI, address of string of magnitude > 0, no leading 0's, to convert
; BL, string length, n in 1-5
; BH, intended sign, {0,+}, {1,-}
; then CODE-STRING-COMPARISON
; CX, characters left to compare
; AL, current character being compared between code-string and input string
; SI, BX, offset addresses in input/code string
; then PWR10-CALCULATION
;
; then CONVERSION
; SI, absolute index in input string during conversion
; BL, string length, n in 1..5 used as relative index
; CX, current power of 10 for conversion from [10^4..10^0]
; DI, stored sum (intermediate conversion term)
; Registers Used: AX, BX, CX, DX, DI, SI
; Stack Depth: 0 words
;
; Last Revised: 12/28/2014 SSundaresh created
SignedDecString2Bin PROC NEAR
PUBLIC SignedDecString2Bin
PUSH BX ; going to need these saved for
PUSH SI ; when we actually start converting
; error checking:
; see arguments
; BL in 1..5
CMP BL, 5 ; if we need to convert less than 4
; digits, we cannot overflow a word
JL START_Dec2Bin_CONVERSION
JMP POSSIBLE_OVERFLOW ; should only be < or =
POSSIBLE_OVERFLOW:
MOV CL, BL
XOR CH, CH ; CX now contains n = 5, length of both
; CS:MaxNegativeArgument and input string
; in DS:SI
CMP BH, 0 ; see arguments, + sign intended
JE CHECK_POSITIVE_OVERFLOW
JNE CHECK_NEGATIVE_OVERFLOW
CHECK_NEGATIVE_OVERFLOW:
MOV BX, offset(MaxNegativeArgument)
JMP COMPARISON_LOOP
CHECK_POSITIVE_OVERFLOW:
MOV BX, offset(MaxPositiveArgument)
JMP COMPARISON_LOOP
COMPARISON_LOOP:
MOV AL, CS:[BX]
CMP AL, DS:[SI]
JG START_Dec2Bin_CONVERSION ; can't overflow, guaranteed
JL GUARANTEED_OVERFLOW ; will overflow
INC SI ; not yet sure
INC BX
DEC CX
CMP CX, 0
JE START_Dec2Bin_CONVERSION ; exact equality between strings - no issue
JMP COMPARISON_LOOP
GUARANTEED_OVERFLOW:
POP SI
POP BX ; so stack untouched
CALL SetZF
JMP Dec2Bin_Conversion_DONE
START_Dec2Bin_CONVERSION:
POP SI
POP BX ; restore arguments.. need original BL
PUSH BX ; calculate initial power of 10, uses BX, store
; original arguments again
MOV CL, BL
XOR CH, CH ; CX holds string length n
DEC CX ; CX holds n - 1
MOV AX, 1 ; AX holds 1
XOR DX, DX ; clear DX for DX:AX word multiplication
; as pwr10 for n = 4 can be more than a byte
MOV BX, 10 ; word 10 for word MUL by BX
PWR10LOOP:
CMP CX, 0
JE INIT_PWR10_FOUND
MUL BX ; will fit in AX, DX as 0:AX <- AX * 10
DEC CX
JMP PWR10LOOP
INIT_PWR10_FOUND: ; it is in AX
POP BX ; restore BX, original argument: BL, n,BH,+0,-1
; SI: original string address in DS
XOR DI, DI ; DI will be our accumulator
MOV CX, AX ; CX our current power of 10
CONVERSION_LOOP:
XOR DX, DX ; clear DX for word mul
MOV AL, DS:[SI]
XOR AH, AH
AND AL, LOWNIBBLEMASK ; ASCIIDecimal2Bin conversion of ASCII char
MUL CX ; DX <- 0, guaranteed
; AX <- pwr10*[0-9], no overflow
ADD DI, AX ; store in accumulator
XOR DX, DX ; prepare to calculate CX = pwr10 / 10
MOV AX, CX
MOV CX, 10 ; need word division as can have up to 10000/10
; = 1000 > byte. no remainders expected.
DIV CX
MOV CX, AX ; pwr10 -> pwr10/10
INC SI
DEC BL
CMP BL, 0
JG CONVERSION_LOOP
CMP BH, 1
JE NEGATE_CONVERTED ; BH still contains sign input argument
JMP PREPARE_TO_OUTPUT ; positive conversions are already ok
NEGATE_CONVERTED:
NEG DI
JMP PREPARE_TO_OUTPUT
PREPARE_TO_OUTPUT:
MOV BX, DI ; want to output in BX
CALL ClearZF
JMP Dec2Bin_Conversion_DONE
Dec2Bin_Conversion_DONE:
RET
SignedDecString2Bin ENDP
; ResetParserState
; Description: clear state bits, i.e. set to Not_Parsing state.
; Operational Notes: we only change state bits outside interrupts
; so this is not critical.
; Registers Used: AX, SI
; Last Revised: 12/27/2014 SSundaresh created
ResetParserState PROC NEAR
PUBLIC ResetParserState
MOV AL, STATE_BITS_NOT_PARSING
MOV SI, offset(ParserStateBits)
MOV DS:[SI], AL
RET
ResetParserState ENDP
; Valid_Characters
; A code segment array containing the valid input characters.
; This effectively says, non-valid characters are ignored (whitespace
; included)
;
; Author: SSundaresh
; Last Modified: 12/29/2014 for HW9
Valid_Characters LABEL BYTE
PUBLIC Valid_Characters
DB 'v' ; set relative speed
DB 'V'
DB 'd' ; set direction
DB 'D'
DB 'f' ; fire laser
DB 'F'
DB 'o' ; laser off
DB 'O'
DB 'r' ; reset motors, direction
DB 'R'
DB '0' ; numerical argument digits
DB '1'
DB '2'
DB '3'
DB '4'
DB '5'
DB '6'
DB '7'
DB '8'
DB '9'
DB '+' ; numerical argument sign
DB '-'
DB ASCII_CR ; carriage return, ctrl-M
CODE ENDS
;Shared Variables
DATA SEGMENT PUBLIC 'DATA'
; the command character whose argument we're currently trying to parse.
CommandCharacter DB ?
;LSB
;0 1, Parsing a command. 0, not parsing, idle.
;1,2 0,0 sign character unknown
; 0,1 - sign
; 1,0 + sign
; 1,1 unsigned
;3,4,5 next index in the ParserArgumentBuffer, read as a 3-bit binary number
;6 unused
;7 1: have seen at least one 'starting zero'
;MSB
ParserStateBits DB ?
; Store parsed numbers known to be arguments of a command
; indexed by state bits 3-5
ParserNumericalArgumentBuffer DB Parser_MAX_DIGITS DUP (?)
DATA ENDS
END | sssundar/RoboTrike | Motor/Parser.asm | Assembly | gpl-2.0 | 45,643 | [
30522,
2171,
11968,
8043,
1025,
3397,
2013,
1996,
2391,
1997,
3193,
1997,
1996,
5013,
2604,
1010,
1025,
11968,
8583,
11610,
29358,
2906,
1010,
2029,
2003,
1037,
10713,
2110,
3698,
1025,
2008,
11968,
8583,
2979,
3494,
2046,
7642,
10954,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package br.copacabana;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import javax.cache.Cache;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import br.com.copacabana.cb.entities.Address;
import br.com.copacabana.cb.entities.Client;
import br.com.copacabana.cb.entities.MealOrder;
import br.com.copacabana.cb.entities.OrderedPlate;
import br.com.copacabana.cb.entities.Plate;
import br.com.copacabana.cb.entities.Restaurant;
import br.com.copacabana.cb.entities.TurnType;
import br.com.copacabana.cb.entities.WorkingHours.DayOfWeek;
import br.copacabana.order.paypal.PayPalProperties.PayPalConfKeys;
import br.copacabana.spring.AddressManager;
import br.copacabana.spring.ClientManager;
import br.copacabana.spring.ConfigurationManager;
import br.copacabana.spring.PlateManager;
import br.copacabana.spring.RestaurantManager;
import br.copacabana.usecase.control.UserActionManager;
import br.copacabana.util.TimeController;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;
/**
* @author Rafael Coutinho
*/
public class PlaceOrderController extends JsonViewController {
private String formView;
private String successView;
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
model.put("mode", "view");
try {
Cache cache = CacheController.getCache();
if (cache.get(PayPalConfKeys.pppFixedRate.name()) == null) {
ConfigurationManager cm = new ConfigurationManager();
cache.put(PayPalConfKeys.pppFixedRate.name(), cm.getConfigurationValue(PayPalConfKeys.pppFixedRate.name()));
cache.put(PayPalConfKeys.pppPercentageValue.name(), cm.getConfigurationValue(PayPalConfKeys.pppPercentageValue.name()));
}
if (!Authentication.isUserLoggedIn(request.getSession())) {
String orderData = request.getParameter("orderData");
request.getSession().setAttribute("orderData", orderData);
model.put("forwardUrl", "/continueOrder.jsp");
UserActionManager.startOrderNotLogged(orderData, request.getSession().getId());
return new ModelAndView(getFormView(), model);
} else {
String orderData = "";
JsonObject user = Authentication.getLoggedUser(request.getSession());
String loggedUserId = user.get("entity").getAsJsonObject().get("id").getAsString();
if (request.getParameter("orderData") == null) {
orderData = (String) request.getSession().getAttribute("orderData");
} else {
orderData = request.getParameter("orderData");
}
log.log(Level.INFO, "OrderJSon: {0}", orderData);
JsonParser pa = new JsonParser();
JsonObject orderDataJson = (JsonObject) pa.parse(orderData);
ClientManager cman = new ClientManager();
Client c = cman.find(KeyFactory.stringToKey(loggedUserId), Client.class);
MealOrder mo = getMealOrder(c, orderDataJson);
request.getSession().setAttribute("clientPhone", "");
DateSerializer dateSerializer = new DateSerializer(request);
DateDeSerializer dateDeSerializer = new DateDeSerializer(request);
GsonBuilder gsonBuilder = GsonBuilderFactory.getInstance();// new
// GsonBuilder().setPrettyPrinting().serializeNulls().excludeFieldsWithoutExposeAnnotation();
gsonBuilder.registerTypeAdapter(Date.class, dateSerializer);
gsonBuilder.registerTypeAdapter(Date.class, dateDeSerializer);
gsonBuilder.registerTypeAdapter(Key.class, new KeyDeSerializer());
gsonBuilder.registerTypeAdapter(Key.class, new KeySerializer());
Gson gson = gsonBuilder.create();
model.putAll(updateModelData(mo, c, gson));
String json = gson.toJson(mo); // Or use new
json = GsonBuilderFactory.escapeString(json);
request.getSession().setAttribute("orderData", json);
UserActionManager.startOrder(json, loggedUserId, request.getSession().getId());
return new ModelAndView(getSuccessView(), model);
}
} catch (Exception e) {
log.log(Level.SEVERE, "Failed to place order.");
try {
String orderData = "";
log.log(Level.SEVERE, "Checking logged user.");
JsonObject user = Authentication.getLoggedUser(request.getSession());
if (user == null) {
log.log(Level.SEVERE, "user is not logged in.");
}
String loggedUserId = user.get("entity").getAsJsonObject().get("id").getAsString();
log.log(Level.SEVERE, "logged user id {0}", loggedUserId);
if (request.getParameter("orderData") == null) {
log.log(Level.SEVERE, "Order is not in request, checking session");
orderData = (String) request.getSession().getAttribute("orderData");
} else {
log.log(Level.SEVERE, "Order is in request");
orderData = request.getParameter("orderData");
}
if (orderData == null) {
log.log(Level.SEVERE, "Order was null!");
}
log.log(Level.SEVERE, "Order is order :" + orderData);
log.log(Level.SEVERE, "Exception was {0}.", e);
log.log(Level.SEVERE, "Error was {0}.", e.getMessage());
UserActionManager.registerMajorError(request, e, loggedUserId, request.getSession().getId(), "placing order");
} catch (Exception ex) {
log.log(Level.SEVERE, "Failed during loggin of error was {0}.", e);
UserActionManager.registerMajorError(request, e, "placing order 2");
}
throw e;
}
}
public static Map<String, Object> updateModelData(MealOrder mo, Client c, Gson gson) {
Map<String, Object> model = new HashMap<String, Object>();
RestaurantManager rman = new RestaurantManager();
Restaurant r = rman.getRestaurant(mo.getRestaurant());
Boolean b = r.getOnlyForRetrieval();
if (b != null && true == b) {
model.put("onlyForRetrieval", Boolean.TRUE);
} else {
model.put("onlyForRetrieval", Boolean.FALSE);
}
model.put("restaurantAddressKey", KeyFactory.keyToString(r.getAddress()));
model.put("clientCpf", c.getCpf());
model.put("level", c.getLevel().ordinal());
JsonObject json = new JsonObject();
ConfigurationManager cm = new ConfigurationManager();
String hasSpecificLogic = cm.getConfigurationValue("hasSpecificLogic");
model.put("noTakeAwayOrders", "false");
if (hasSpecificLogic != null && hasSpecificLogic.endsWith("true")) {
json = getSteakHouseSpecificData(mo, c, gson);
getMakisSpecificLogic(mo, c, gson, json);
getPapagaiosSpecificLogic(mo, c, gson, json);
getPizzadoroSpecificLogic(mo,c,gson,json);
if (noTakeAwayOrders(mo) == true) {
model.put("noTakeAwayOrders", "true");
}
}
model.put("hasSpecificLogic", json.toString());
if (json.get("javascript") != null && json.get("javascript").getAsString().length() > 0) {
model.put("hasSpecificLogicJavascript", json.get("javascript").getAsString());
}
Address restAddress = new AddressManager().getAddress(r.getAddress());
model.put("restaurantAddress", gson.toJson(restAddress));
return model;
}
private static boolean noTakeAwayOrders(MealOrder mo) {
ConfigurationManager cm = new ConfigurationManager();
String ids = cm.getConfigurationValue("no.takeaway.ids");
String restId = KeyFactory.keyToString(mo.getRestaurant());
if (ids.contains(restId)) {
return true;
}
return false;
}
private static void getPapagaiosSpecificLogic(MealOrder mo, Client c, Gson gson, JsonObject json) {
ConfigurationManager cm = new ConfigurationManager();
String idStr = cm.getConfigurationValue("papagaios.id");
if (idStr != null && idStr.length() > 0) {
Key k = KeyFactory.stringToKey(idStr);
if (k.equals(mo.getRestaurant())) {
json.add("javascript", new JsonPrimitive("/scripts/custom/papagaios.js"));
}
}
}
private static void getPizzadoroSpecificLogic(MealOrder mo, Client c, Gson gson, JsonObject json) {
ConfigurationManager cm = new ConfigurationManager();
String idStr = cm.getConfigurationValue("pizzadoro.id");
if (idStr != null && idStr.length() > 0) {
Key k = KeyFactory.stringToKey(idStr);
if (k.equals(mo.getRestaurant())) {
json.add("javascript", new JsonPrimitive("/scripts/custom/pizzadoro.js"));
}
}
}
private static void getMakisSpecificLogic(MealOrder mo, Client c, Gson gson, JsonObject json) {
try {
ConfigurationManager cm = new ConfigurationManager();
PlateManager pm = new PlateManager();
String makisIdStr = cm.getConfigurationValue("makis.Id");
if (makisIdStr != null && makisIdStr.length() > 0) {
Key makis = KeyFactory.stringToKey(makisIdStr);
if (makis != null && makis.equals(mo.getRestaurant())) {
String packageId = cm.getConfigurationValue("makis.package.id");
if (packageId != null && packageId.length() > 0) {
json.add("makisPackageCostId", new JsonPrimitive(packageId));
json.add("makisMsg", new JsonPrimitive(cm.getConfigurationValue("makis.msg")));
boolean isIncluded = false;
Key packageKey = KeyFactory.stringToKey(packageId);
for (Iterator<OrderedPlate> iterator = mo.getPlates().iterator(); iterator.hasNext();) {
OrderedPlate plate = (OrderedPlate) iterator.next();
if (Boolean.FALSE.equals(plate.getIsFraction()) && plate.getPlate().equals(packageKey)) {
isIncluded = true;
break;
}
}
if (isIncluded == false) {
Plate packagePlate = pm.get(packageKey);
OrderedPlate oplate = new OrderedPlate();
oplate.setName(packagePlate.getName());
oplate.setPrice(packagePlate.getPrice());
oplate.setPriceInCents(packagePlate.getPriceInCents());
oplate.setQty(1);
oplate.setPlate(packageKey);
mo.getPlates().add(oplate);
}
}
}
}
} catch (Exception e) {
log.log(Level.SEVERE, "failed to add makis specific logic", e);
}
}
private static JsonObject getSteakHouseSpecificData(MealOrder mo, Client c, Gson gson) {
JsonObject json = new JsonObject();
json.add("freeDelivery", new JsonPrimitive("false"));
try {
ConfigurationManager cm = new ConfigurationManager();
String steakIdStr = cm.getConfigurationValue("steakHouse.Id");
if (steakIdStr != null && steakIdStr.length() > 0) {
Key steak = KeyFactory.stringToKey(steakIdStr);
if (steak.equals(mo.getRestaurant())) {
if (!TimeController.getDayOfWeek().equals(DayOfWeek.SATURDAY) && !TimeController.getDayOfWeek().equals(DayOfWeek.SUNDAY)) {
if (TimeController.getCurrentTurn().equals(TurnType.LUNCH)) {
String foodCatsStr = cm.getConfigurationValue("steakHouse.FoodCats");
if (foodCatsStr != null && foodCatsStr.length() > 0) {
String[] foodCatsArray = foodCatsStr.split("\\|");
Set<Key> foodCats = new HashSet<Key>();
for (int i = 0; i < foodCatsArray.length; i++) {
if (foodCatsArray[i].length() > 0) {
foodCats.add(KeyFactory.stringToKey(foodCatsArray[i]));
}
}
List<OrderedPlate> plates = mo.getPlates();
PlateManager pm = new PlateManager();
for (Iterator iterator = plates.iterator(); iterator.hasNext();) {
OrderedPlate orderedPlate = (OrderedPlate) iterator.next();
Plate p = null;
if (Boolean.TRUE.equals(orderedPlate.getIsFraction())) {
p = pm.getPlate(orderedPlate.getFractionPlates().iterator().next());
} else {
p = pm.getPlate(orderedPlate.getPlate());
}
if (!foodCats.contains(p.getFoodCategory())) {
json.add("freeDelivery", new JsonPrimitive("false"));
return json;
}
}
json.add("freeDelivery", new JsonPrimitive("true"));
json.add("msg", new JsonPrimitive(cm.getConfigurationValue("steakHouse.msg")));
}
}
}
}
}
} catch (Exception e) {
log.log(Level.SEVERE, "Could not set up things for SteakHouse", e);
}
return json;
}
public MealOrder getMealOrder(Client c, JsonObject sessionOderData) {
MealOrder mo = new MealOrder();
mo.setClient(c);
if (c.getContact() != null) {
mo.setClientPhone(c.getContact().getPhone());
}
mo.setAddress(getAddress(sessionOderData, c));
mo.setObservation(getObservation(sessionOderData));
mo.setRestaurant(getRestKey(sessionOderData));
mo.setPlates(getPlates(sessionOderData));
return mo;
}
private Key getAddress(JsonObject sessionOderData, Client c) {
try {
if (sessionOderData.get("address") == null) {
if (c.getMainAddress() != null) {
return c.getMainAddress();
} else {
return null;
}
} else {
if (sessionOderData.get("address") != null && !sessionOderData.get("address").isJsonNull() ) {
return KeyFactory.stringToKey(sessionOderData.get("address").getAsString());
}else{
return null;
}
}
} catch (Exception e) {
log.log(Level.SEVERE, "no address da sessão havia {0}", sessionOderData.get("address"));
log.log(Level.SEVERE, "Error ao buscar endereço de cliente ou em sessão", e);
return null;
}
}
public List<OrderedPlate> getPlates(JsonObject sessionOderData) {
List<OrderedPlate> orderedPlates = new ArrayList<OrderedPlate>();
JsonArray array = sessionOderData.get("plates").getAsJsonArray();
for (int i = 0; i < array.size(); i++) {
JsonObject pjson = array.get(i).getAsJsonObject();
orderedPlates.add(getOrdered(pjson));
}
return orderedPlates;
}
private OrderedPlate getOrdered(JsonObject pjson) {
OrderedPlate oplate = new OrderedPlate();
oplate.setName(pjson.get("name").getAsString());
oplate.setPrice(pjson.get("price").getAsDouble());
oplate.setPriceInCents(Double.valueOf(pjson.get("price").getAsDouble() * 100.0).intValue());
oplate.setQty(pjson.get("qty").getAsInt());
if (pjson.get("isFraction").getAsBoolean() == true) {
oplate.setIsFraction(Boolean.TRUE);
Set<Key> fractionPlates = new HashSet<Key>();
JsonArray fractionKeys = pjson.get("fractionKeys").getAsJsonArray();
for (int i = 0; i < fractionKeys.size(); i++) {
Key fractionKey = KeyFactory.stringToKey(fractionKeys.get(i).getAsString());
fractionPlates.add(fractionKey);
}
oplate.setFractionPlates(fractionPlates);
return oplate;
} else {
String pkey = "";
if (pjson.get("plate").isJsonObject()) {
pkey = pjson.get("plate").getAsJsonObject().get("id").getAsString();
} else {
pkey = pjson.get("plate").getAsString();
}
oplate.setPlate(KeyFactory.stringToKey(pkey));
return oplate;
}
}
public Key getRestKey(JsonObject sessionOderData) {
String restKey;
if (sessionOderData.get("restaurant") != null) {
if (sessionOderData.get("restaurant").isJsonObject()) {
restKey = sessionOderData.get("restaurant").getAsJsonObject().get("id").getAsString();
} else {
restKey = sessionOderData.get("restaurant").getAsString();
}
} else {
restKey = sessionOderData.get("plates").getAsJsonArray().get(0).getAsJsonObject().get("plate").getAsJsonObject().get("value").getAsJsonObject().get("restaurant").getAsString();
}
return KeyFactory.stringToKey(restKey);
}
public String getObservation(JsonObject sessionOderData) {
return sessionOderData.get("observation").getAsString();
}
public String getFormView() {
return formView;
}
public void setFormView(String formView) {
this.formView = formView;
}
public String getSuccessView() {
return successView;
}
public void setSuccessView(String successView) {
this.successView = successView;
}
} | rafaelcoutinho/comendobemdelivery | src/br/copacabana/PlaceOrderController.java | Java | apache-2.0 | 16,224 | [
30522,
7427,
7987,
1012,
10613,
3540,
19445,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
3058,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
23325,
2863,
2361,
1025,
12324,
9262,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
BT=${BT-../../bin/bedtools}
check()
{
if diff $1 $2; then
echo ok
return 1
else
echo fail
return 0
fi
}
echo " fisher.t1...\c"
echo \
"# Number of query intervals: 3
# Number of db intervals: 2
# Number of overlaps: 2
# Number of possible intervals (estimated): 34
# phyper(2 - 1, 3, 34 - 3, 2, lower.tail=F)
# Contingency Table Of Counts
#_________________________________________
# | in -b | not in -b |
# in -a | 2 | 1 |
# not in -a | 0 | 31 |
#_________________________________________
# p-values for fisher's exact test
left right two-tail ratio
1 0.0053476 0.0053476 inf" > exp
$BT fisher -a a.bed -b b.bed -g t.500.genome > obs
check obs exp
rm obs exp
echo " fisher.t2...\c"
echo \
"# Number of query intervals: 3
# Number of db intervals: 2
# Number of overlaps: 2
# Number of possible intervals (estimated): 4
# phyper(2 - 1, 3, 4 - 3, 2, lower.tail=F)
# Contingency Table Of Counts
#_________________________________________
# | in -b | not in -b |
# in -a | 2 | 1 |
# not in -a | 0 | 1 |
#_________________________________________
# p-values for fisher's exact test
left right two-tail ratio
1 0.5 1 inf" > exp
$BT fisher -a a.bed -b b.bed -g t.60.genome > obs
check obs exp
rm obs exp
echo " fisher.t3...\c"
echo \
"# Number of query intervals: 4
# Number of db intervals: 2
# Number of overlaps: 3
# Number of possible intervals (estimated): 4
# phyper(3 - 1, 4, 4 - 4, 2, lower.tail=F)
# Contingency Table Of Counts
#_________________________________________
# | in -b | not in -b |
# in -a | 3 | 1 |
# not in -a | 0 | 0 |
#_________________________________________
# p-values for fisher's exact test
left right two-tail ratio
1 1 1 nan" > exp
$BT fisher -a a_merge.bed -b b.bed -g t.60.genome > obs
check obs exp
rm obs exp
echo " fisher.t4...\c"
echo \
"# Number of query intervals: 3
# Number of db intervals: 2
# Number of overlaps: 2
# Number of possible intervals (estimated): 4
# phyper(2 - 1, 3, 4 - 3, 2, lower.tail=F)
# Contingency Table Of Counts
#_________________________________________
# | in -b | not in -b |
# in -a | 2 | 1 |
# not in -a | 0 | 1 |
#_________________________________________
# p-values for fisher's exact test
left right two-tail ratio
1 0.5 1 inf" > exp
$BT fisher -a a_merge.bed -b b.bed -g t.60.genome -m > obs
check obs exp
rm obs exp
| Debian/bedtools2 | test/fisher/test-fisher.sh | Shell | gpl-2.0 | 2,595 | [
30522,
18411,
1027,
1002,
1063,
18411,
1011,
1012,
1012,
1013,
1012,
1012,
1013,
8026,
1013,
2793,
3406,
27896,
1065,
4638,
1006,
1007,
1063,
2065,
4487,
4246,
1002,
1015,
1002,
1016,
1025,
2059,
9052,
7929,
2709,
1015,
2842,
9052,
8246,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
"use strict";
var uuid = require('node-uuid');
var crypto = require('crypto');
var NodeGeocoder = require('node-geocoder');
var secret = "I@Love@NNNode.JS";
var options = {
provider: 'google',
httpAdapter: 'https',
apiKey: 'AIzaSyBF9xb6TLxfTEji1O4UqL7rwZc16fQRctA',
formatter: null
};
var Util = function () {
return {
GenerateAuthToken: function () {
return uuid.v4();
},
Encrypt: function (strToEncrypt) {
return crypto.createHmac('sha256', secret)
.update(strToEncrypt)
.digest('hex');
},
getLatLon: function (address, callback) {
var geocoder = NodeGeocoder(options);
geocoder.geocode(address, function(err, res) {
if (err) {
callback(err.message, null)
}
else {
callback(null, {"lat": res[0].latitude, "lon": res[0].longitude});
}
});
}
};
}();
module.exports = Util;
| oczane/geochat | util.js | JavaScript | gpl-3.0 | 1,071 | [
30522,
1000,
2224,
9384,
1000,
1025,
13075,
1057,
21272,
1027,
5478,
1006,
1005,
13045,
1011,
1057,
21272,
1005,
1007,
1025,
13075,
19888,
2080,
1027,
5478,
1006,
1005,
19888,
2080,
1005,
1007,
1025,
13075,
13045,
3351,
24163,
4063,
1027,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* */
var convert = require('./convert');
module.exports = convert('partial', require('../partial'));
| EpitaJS/js-class-2016-episode-2 | jspm_packages/npm/lodash@4.6.1/fp/partial.js | JavaScript | unlicense | 103 | [
30522,
1013,
1008,
1008,
1013,
13075,
10463,
1027,
5478,
1006,
1005,
1012,
1013,
10463,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import { Injectable } from '@angular/core';
import { AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';
//import firebase namespace for functions that aren't in AngularFire2
import * as firebase from 'firebase/app';
import * as moment from 'moment';
import { AdminService } from './admin.service';
@Injectable()
export class RefeicaoService {
constructor(private db: AngularFireDatabase, private _admin: AdminService) { }
add(refeicao: any): firebase.Promise<any> {
//Additional info
refeicao['created_at'] = moment().valueOf();
refeicao['updated_at'] = moment().valueOf();
refeicao['created_by'] = this._admin.email;
refeicao['vagas'] = 350;
refeicao['sold_out'] = false;
refeicao['queue_count'] = 0;
refeicao['queue_released'] = 0;
refeicao['users_count'] = 0;
refeicao['usersVeg_count'] = 0;
return Promise.all([
firebase.database().ref(`refeicoes/`).push(refeicao),
firebase.database().ref('refeicoes/count').transaction(count => count + 1)
]);
}
edit(key: string, formValues: any): firebase.Promise<any>{
return this.db.object(`refeicoes/${key}`).update(formValues);
}
refFromDatepicker(date: any): FirebaseListObservable<any> {
let timestamp = moment(`${date.year}-${date.month}-${date.day}`)
.add(11,'hours').add(30,'minutes')
.valueOf();
console.log('procurando por refeicoes com a timestamp',timestamp);
return this.db.list('refeicoes/',{
query:{
orderByChild: 'timestamp',
equalTo: timestamp
}
})
}
exists(timestamp: number): firebase.Promise<any>{
return new Promise((resolve,reject)=>{
firebase.database().ref('refeicoes/')
.orderByChild('timestamp')
.equalTo(timestamp)
.once('value')
.then(snap => {
if (snap.val() !== null) resolve(true);
else resolve(false)
})
.catch(reason => reject(reason));
})
}
}
| luizcieslak/ru-unesp-admin | src/app/providers/refeicao.service.ts | TypeScript | gpl-3.0 | 2,038 | [
30522,
12324,
1063,
1999,
20614,
3085,
1065,
30524,
16429,
20614,
16429,
8043,
12423,
1065,
2013,
1005,
16108,
10273,
2475,
1013,
7809,
1005,
1025,
12324,
1063,
16108,
10273,
4887,
2705,
1065,
2013,
1005,
16108,
10273,
2475,
1013,
8740,
2705,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Compiladores
examen de compiladores
| erickpmacias/Compiladores | README.md | Markdown | apache-2.0 | 38 | [
30522,
1001,
4012,
8197,
27266,
16610,
11360,
2368,
2139,
4012,
8197,
27266,
16610,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// LevelManager.h
// SoA
//
// Created by John Doe on 2/2/16.
// Copyright © 2016 John Doe. All rights reserved.
//
#ifndef LevelManager_h
#define LevelManager_h
#import <UIKit/UIKit.h>
@interface LevelManager : NSObject
- (void) Load;
- (void) Unload;
@end
#endif /* LevelManager_h */
| nelfurion/IOS-Project | soa/SoA/SoA/Levels/LevelManager.h | C | mit | 300 | [
30522,
1013,
1013,
1013,
1013,
2504,
24805,
4590,
1012,
1044,
1013,
1013,
2061,
2050,
1013,
1013,
1013,
1013,
2580,
2011,
2198,
18629,
2006,
1016,
1013,
1016,
1013,
2385,
1012,
1013,
1013,
9385,
1075,
2355,
2198,
18629,
1012,
2035,
2916,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* zxatasp.h: ZXATASP interface routines
Copyright (c) 2003-2004 Garry Lancaster,
2004 Philip Kendall
$Id: zxatasp.h 4972 2013-05-19 16:46:43Z zubzero $
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: Philip Kendall <philip-fuse@shadowmagic.org.uk>
*/
#ifndef FUSE_ZXATASP_H
#define FUSE_ZXATASP_H
#include <libspectrum.h>
int zxatasp_init( void );
int zxatasp_end( void );
int zxatasp_insert( const char *filename, libspectrum_ide_unit unit );
int zxatasp_commit( libspectrum_ide_unit unit );
int zxatasp_eject( libspectrum_ide_unit unit );
int zxatasp_unittest( void );
#endif /* #ifndef FUSE_ZXATASP_H */
| matthewbauer/fuse-libretro | fuse/peripherals/ide/zxatasp.h | C | gpl-3.0 | 1,336 | [
30522,
1013,
1008,
1062,
18684,
10230,
2361,
1012,
1044,
1024,
1062,
18684,
10230,
2361,
8278,
23964,
9385,
1006,
1039,
1007,
2494,
1011,
2432,
21507,
10237,
1010,
2432,
5170,
14509,
1002,
8909,
1024,
1062,
18684,
10230,
2361,
1012,
1044,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2005 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.drools.decisiontable.parser;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.drools.decisiontable.parser.xls.ExcelParser;
import org.drools.template.parser.DataListener;
public class RulesheetUtil {
/**
* Utility method showing how to get a rule sheet listener from a stream.
*/
public static RuleSheetListener getRuleSheetListener(final InputStream stream) throws IOException {
final Map<String, List<DataListener>> sheetListeners = new HashMap<String, List<DataListener>>();
final List<DataListener> listeners = new ArrayList<DataListener>();
final RuleSheetListener listener = new DefaultRuleSheetListener();
listeners.add(listener);
sheetListeners.put( ExcelParser.DEFAULT_RULESHEET_NAME,
listeners );
final ExcelParser parser = new ExcelParser( sheetListeners );
try {
parser.parseFile( stream );
} finally {
stream.close();
}
stream.close();
return listener;
}
}
| amckee23/drools | drools-decisiontables/src/test/java/org/drools/decisiontable/parser/RulesheetUtil.java | Java | apache-2.0 | 1,757 | [
30522,
1013,
1008,
1008,
9385,
2384,
1046,
15853,
2015,
4297,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Automatically generated file. Please do not edit.
* @author Highcharts Config Generator by Karasiq
* @see [[http://api.highcharts.com/highmaps]]
*/
package com.highmaps.config
import scalajs.js, js.`|`
import com.highcharts.CleanJsObject
import com.highcharts.HighchartsUtils._
/**
* @note JavaScript name: <code>plotOptions-sma-states-select</code>
*/
@js.annotation.ScalaJSDefined
class PlotOptionsSmaStatesSelect extends com.highcharts.HighchartsGenericObject {
/**
* <p>Animation setting for hovering the graph in line-type series.</p>
* @since 5.0.8
*/
val animation: js.UndefOr[Boolean | js.Object] = js.undefined
/**
* <p>The additional line width for the graph of a hovered series.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-linewidthplus/">5 pixels wider</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-linewidthplus/">5 pixels wider</a>
* @since 4.0.3
*/
val lineWidthPlus: js.UndefOr[Double] = js.undefined
/**
* <p>In Highcharts 1.0, the appearance of all markers belonging to the
* hovered series. For settings on the hover state of the individual
* point, see
* <a href="#plotOptions.series.marker.states.hover">marker.states.hover</a>.</p>
* @since 6.0.0
*/
val marker: js.UndefOr[CleanJsObject[PlotOptionsSmaStatesSelectMarker]] = js.undefined
/**
* <p>Options for the halo appearing around the hovered point in line-
* type series as well as outside the hovered slice in pie charts.
* By default the halo is filled by the current point or series
* color with an opacity of 0.25. The halo can be disabled by
* setting the <code>halo</code> option to <code>false</code>.</p>
* <p>In styled mode, the halo is styled with the <code>.highcharts-halo</code>
* class, with colors inherited from <code>.highcharts-color-{n}</code>.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/halo/">Halo options</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/halo/">Halo options</a>
* @since 4.0
*/
val halo: js.Any = js.undefined
/**
* <p>Enable separate styles for the hovered series to visualize that
* the user hovers either the series itself or the legend. .</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-enabled/">Line</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-enabled-column/">Column</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-enabled-pie/">Pie</a>
* @since 1.2
*/
val enabled: js.UndefOr[Boolean] = js.undefined
/**
* <p>Pixel width of the graph line. By default this property is
* undefined, and the <code>lineWidthPlus</code> property dictates how much
* to increase the linewidth from normal state.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-linewidth/">5px line on hover</a>
* @since 6.0.0
*/
val lineWidth: js.UndefOr[Double] = js.undefined
/**
* <p>The color of the shape in this state</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/maps/plotoptions/series-states-hover/">Hover options</a>
* @since 6.0.0
*/
val color: js.UndefOr[String | js.Object] = js.undefined
/**
* <p>The border color of the point in this state.</p>
* @since 6.0.0
*/
val borderColor: js.UndefOr[String | js.Object] = js.undefined
/**
* <p>The border width of the point in this state</p>
* @since 6.0.0
*/
val borderWidth: js.UndefOr[Double] = js.undefined
}
object PlotOptionsSmaStatesSelect {
/**
* @param animation <p>Animation setting for hovering the graph in line-type series.</p>
* @param lineWidthPlus <p>The additional line width for the graph of a hovered series.</p>
* @param marker <p>In Highcharts 1.0, the appearance of all markers belonging to the. hovered series. For settings on the hover state of the individual. point, see. <a href="#plotOptions.series.marker.states.hover">marker.states.hover</a>.</p>
* @param halo <p>Options for the halo appearing around the hovered point in line-. type series as well as outside the hovered slice in pie charts.. By default the halo is filled by the current point or series. color with an opacity of 0.25. The halo can be disabled by. setting the <code>halo</code> option to <code>false</code>.</p>. <p>In styled mode, the halo is styled with the <code>.highcharts-halo</code>. class, with colors inherited from <code>.highcharts-color-{n}</code>.</p>
* @param enabled <p>Enable separate styles for the hovered series to visualize that. the user hovers either the series itself or the legend. .</p>
* @param lineWidth <p>Pixel width of the graph line. By default this property is. undefined, and the <code>lineWidthPlus</code> property dictates how much. to increase the linewidth from normal state.</p>
* @param color <p>The color of the shape in this state</p>
* @param borderColor <p>The border color of the point in this state.</p>
* @param borderWidth <p>The border width of the point in this state</p>
*/
def apply(animation: js.UndefOr[Boolean | js.Object] = js.undefined, lineWidthPlus: js.UndefOr[Double] = js.undefined, marker: js.UndefOr[CleanJsObject[PlotOptionsSmaStatesSelectMarker]] = js.undefined, halo: js.UndefOr[js.Any] = js.undefined, enabled: js.UndefOr[Boolean] = js.undefined, lineWidth: js.UndefOr[Double] = js.undefined, color: js.UndefOr[String | js.Object] = js.undefined, borderColor: js.UndefOr[String | js.Object] = js.undefined, borderWidth: js.UndefOr[Double] = js.undefined): PlotOptionsSmaStatesSelect = {
val animationOuter: js.UndefOr[Boolean | js.Object] = animation
val lineWidthPlusOuter: js.UndefOr[Double] = lineWidthPlus
val markerOuter: js.UndefOr[CleanJsObject[PlotOptionsSmaStatesSelectMarker]] = marker
val haloOuter: js.Any = halo
val enabledOuter: js.UndefOr[Boolean] = enabled
val lineWidthOuter: js.UndefOr[Double] = lineWidth
val colorOuter: js.UndefOr[String | js.Object] = color
val borderColorOuter: js.UndefOr[String | js.Object] = borderColor
val borderWidthOuter: js.UndefOr[Double] = borderWidth
com.highcharts.HighchartsGenericObject.toCleanObject(new PlotOptionsSmaStatesSelect {
override val animation: js.UndefOr[Boolean | js.Object] = animationOuter
override val lineWidthPlus: js.UndefOr[Double] = lineWidthPlusOuter
override val marker: js.UndefOr[CleanJsObject[PlotOptionsSmaStatesSelectMarker]] = markerOuter
override val halo: js.Any = haloOuter
override val enabled: js.UndefOr[Boolean] = enabledOuter
override val lineWidth: js.UndefOr[Double] = lineWidthOuter
override val color: js.UndefOr[String | js.Object] = colorOuter
override val borderColor: js.UndefOr[String | js.Object] = borderColorOuter
override val borderWidth: js.UndefOr[Double] = borderWidthOuter
})
}
}
| Karasiq/scalajs-highcharts | src/main/scala/com/highmaps/config/PlotOptionsSmaStatesSelect.scala | Scala | mit | 7,549 | [
30522,
1013,
1008,
1008,
1008,
8073,
7013,
5371,
1012,
3531,
2079,
2025,
10086,
1012,
1008,
1030,
3166,
2152,
7507,
21217,
9530,
8873,
2290,
13103,
2011,
13173,
5332,
4160,
1008,
1030,
2156,
1031,
1031,
8299,
1024,
1013,
1013,
17928,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @package HUBzero CMS
* @author Alissa Nedossekina <alisa@purdue.edu>
* @copyright Copyright 2005-2009 by Purdue Research Foundation, West Lafayette, IN 47906
* @license http://www.gnu.org/licenses/gpl-2.0.html GPLv2
*
* Copyright 2005-2009 by Purdue Research Foundation, West Lafayette, IN 47906.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License,
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
// Build url
$route = $this->project->provisioned
? 'index.php?option=com_publications' . a . 'task=submit'
: 'index.php?option=com_projects' . a . 'alias=' . $this->project->alias;
$p_url = JRoute::_($route . a . 'active=files');
// Directory path breadcrumbs
$desect_path = explode(DS, $this->subdir);
$path_bc = '';
$url = '';
$parent = '';
if(count($desect_path) > 0) {
for($p = 0; $p < count($desect_path); $p++) {
$parent .= count($desect_path) > 1 && $p != count($desect_path) ? $url : '';
$url .= DS.$desect_path[$p];
$path_bc .= ' » <span><a href="'.$p_url.'/?subdir='.urlencode($url).'" class="folder">'.$desect_path[$p].'</a></span> ';
}
}
$shown = array();
?>
<form action="<?php echo JRoute::_($route).'?active=publications'; ?>" method="post" enctype="multipart/form-data" id="upload-form" >
<ul id="c-browser" <?php if(count($this->files) == 0) { echo 'class="hidden"'; } ?>>
<?php
if($this->subdir) { ?>
<li><a href="<?php echo $p_url.'/?action=browser'.a.'subdir='.$parent; ?>" class="uptoparent gotodir"><?php echo JText::_('COM_PROJECTS_FILES_BACK_TO_PARENT_DIR'); ?></a></li>
<?php }
if(count($this->files) > 0) {
// Do ordering
$names = array();
foreach ($this->files as $f) {
$names[] = $f['name'];
}
sort($names);
array_multisort($this->files, SORT_ASC, SORT_STRING, $names, SORT_ASC );
$i = 0;
foreach($this->files as $file) {
if($this->images) {
// if(!in_array(strtolower($file['ext']), $this->image_ext)) {
if(!in_array(strtolower($file['ext']), $this->image_ext) && !in_array(strtolower($file['ext']), $this->video_ext)) {
// Skip non-image/video files
continue;
}
}
if(in_array($file['fpath'], $this->exclude)) {
// Skip files attached in another role
continue;
}
// Ignore hidden files
if(substr(basename($file['fpath']), 0, 1) == '.')
{
continue;
}
$shown[] = $file['fpath'];
?>
<li class="c-click item|file::<?php echo urlencode($file['fpath']); ?>"><img src="<?php echo ProjectsHtml::getFileIcon($file['ext']); ?>" alt="<?php echo $file['ext']; ?>" /><?php echo $file['fpath']; ?></li>
<?php
$i++;
?>
<?php }
}
$missing = array();
// Check for missing items
// Primary content / Supporting docs
if(isset($this->attachments)) {
if(count($this->attachments) > 0) {
foreach($this->attachments as $attachment) {
if(!in_array($attachment->path, $shown)) {
// Found missing
$miss = array();
$miss['fpath'] = $attachment->path;
$miss['ext'] = ProjectsHtml::getFileAttribs( $attachment->path, '', 'ext' );
$missing[] = $miss;
}
}
}
}
// Screenshots
if($this->images) {
if(count($this->shots) > 0) {
foreach($this->shots as $shot) {
if(!in_array($shot->filename, $shown)) {
// Found missing
$miss = array();
$miss['fpath'] = $shot->filename;
$miss['ext'] = ProjectsHtml::getFileAttribs( $shot->filename, '', 'ext' );
$missing[] = $miss;
}
}
}
}
// Add missing items
if(count($missing) > 0) {
foreach ($missing as $miss) { ?>
<li class="c-click item|file::<?php echo urlencode($miss['fpath']); ?> i-missing"><img src="<?php echo ProjectsHtml::getFileIcon($miss['ext']); ?>" alt="<?php echo $miss['ext']; ?>" /><?php echo $miss['fpath']; ?><span class="c-missing"><?php echo JText::_('PLG_PROJECTS_FILES_MISSING_FILE'); ?></span></li>
<?php }
}
?>
</ul>
<label class="addnew">
<input name="upload[]" type="file" size="20" class="option" id="uploader" />
</label>
<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
<input type="hidden" name="id" value="<?php echo $this->project->id; ?>" />
<input type="hidden" name="uid" id="uid" value="<?php echo $this->uid; ?>" />
<input type="hidden" name="pid" id="pid" value="<?php echo $this->pid; ?>" />
<input type="hidden" name="images" id="images" value="<?php echo $this->images; ?>" />
<input type="hidden" name="active" value="files" />
<input type="hidden" name="action" value="<?php echo $this->project->provisioned == 1 && !$this->pid ? 'saveprov' : 'save'; ?>" />
<input type="hidden" name="view" value="pub" />
<input type="hidden" name="ajax" value="0" />
<input type="hidden" name="no_html" value="0" />
<input type="hidden" name="return_status" id="return_status" value="0" />
<input type="hidden" name="expand_zip" id="expand_zip" value="0" />
<input type="hidden" name="subdir" value="<?php echo $this->subdir; ?>" />
<input type="hidden" name="provisioned" id="provisioned" value="<?php echo $this->project->provisioned == 1 ? 1 : 0; ?>" />
<?php if($this->project->provisioned == 1 ) { ?>
<input type="hidden" name="task" value="submit" />
<?php } ?>
<input type="submit" value="<?php echo JText::_('COM_PROJECTS_UPLOAD'); ?>" class="btn yesbtn" id="b-upload" />
</form> | CI-Water-DASYCIM/CIWaterHubZeroPortalDev | plugins/projects/files/views/upload/tmpl/files.php | PHP | gpl-2.0 | 6,034 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
7427,
9594,
6290,
2080,
4642,
2015,
1008,
1030,
3166,
4862,
11488,
12311,
15094,
26576,
2532,
1026,
4862,
3736,
1030,
19749,
1012,
3968,
2226,
1028,
1008,
1030,
9385,
9385,
2384,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<#
Microsoft provides programming examples for illustration only, without warranty either expressed or
implied, including, but not limited to, the implied warranties of merchantability and/or fitness
for a particular purpose.
This sample assumes that you are familiar with the programming language being demonstrated and the
tools used to create and debug procedures. Microsoft support professionals can help explain the
functionality of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. if you have limited programming
experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting
line at (800) 936-5200.
HISTORY
08-28-2017 - Created
==============================================================#>
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
function Get-CustomResultSource
{
<#
.SYNOPSIS
This cmdlet will return Site Url, Web Url, Name, Creation Date, Status and IsDefault value for each custom search resource source for
the specificed site collection.
.EXAMPLE
Get-CustomResultSource -Site $site -SearchServiceApplication $ssa
.FUNCTIONALITY
PowerShell Language
#>
[cmdletbinding()]
[OutputType([object[]])]
param
(
# SPSite to search for custom result sources
[Parameter(Mandatory=$true)][Microsoft.SharePoint.SPSite]$Site,
# SearchServiceApplication associated with the site collection
[Parameter(Mandatory=$true)][Microsoft.Office.Server.Search.Administration.SearchServiceApplication]$SearchServiceApplication
)
begin
{
$siteLevel = [Microsoft.Office.Server.Search.Administration.SearchObjectLevel]::SPSite
$webLevel = [Microsoft.Office.Server.Search.Administration.SearchObjectLevel]::SPWeb
$defaultSource = $null
}
process
{
# we can't read from readlocked sites, so skip them
if (-not $site.IsReadLocked )
{
$owner = New-Object Microsoft.Office.Server.Search.Administration.SearchObjectOwner( $siteLevel, $site.RootWeb )
$filter = New-Object Microsoft.Office.Server.Search.Administration.SearchObjectFilter( $owner )
$filter.IncludeHigherLevel = $false
$federationManager = New-Object Microsoft.Office.Server.Search.Administration.Query.FederationManager($SearchServiceApplication)
$siteSources = $federationManager.ListSourcesWithDefault( $filter, $false, [ref]$defaultSource )
# filter out all built in and non-site level result sources
$siteSources | ? { -not $_.BuiltIn -and $_.Owner.Level -eq $siteLevel } | SELECT @{ Name="SiteUrl"; Expression={ $site.Url}}, @{ Name="WebUrl"; Expression={ $site.Url}}, Name, CreatedDate, @{ Name="Status"; Expression={ if ($_.Active) { return "Active"}else{ return "Inactive"} }}, @{ Name="IsDefault"; Expression={ $_.Id -eq $defaultSource.Id}}
foreach ($web in $site.AllWebs | ? { -not $_.IsAppWeb })
{
$owner = New-Object Microsoft.Office.Server.Search.Administration.SearchObjectOwner( $webLevel, $web )
$filter = New-Object Microsoft.Office.Server.Search.Administration.SearchObjectFilter( $owner )
$filter.IncludeHigherLevel = $false
$federationManager = New-Object Microsoft.Office.Server.Search.Administration.Query.FederationManager($SearchServiceApplication)
$webSources = $federationManager.ListSourcesWithDefault( $filter, $false, [ref]$defaultSource )
# filter out all built in and non-web level result sources
$webSources | ? { -not $_.BuiltIn -and $_.Owner.Level -eq $webLevel } | SELECT @{ Name="SiteUrl"; Expression={ $site.Url}}, @{ Name="WebUrl"; Expression={ $web.Url}}, Name, CreatedDate, @{ Name="Status"; Expression={ if ($_.Active) { return "Active"}else{ return "Inactive"} }}, @{ Name="IsDefault"; Expression={ $_.Id -eq $defaultSource.Id}}
}
}
}
end
{
}
}
# array to store results
$customResultSources = @()
# get the search service
$ssa = Get-SPEnterpriseSearchServiceApplication | SELECT -First 1
# get the custom result sources for all sites in the farm
Get-SPSite -Limit All | % { $customResultSources += Get-CustomResultSource -Site $_ -SearchServiceApplication $ssa }
# save the results to the ULS logs directory in CSV format
$customResultSources | Export-Csv -Path "$($(Get-SPDiagnosticConfig).LogLocation)\CustomResultSources$($(Get-Date).ToString('yyyyMMdd')).csv" -NoTypeInformation
| joerodgers/powershell | SharePoint/ServiceApplications/Search/Get-CustomResultSource.ps1 | PowerShell | mit | 4,744 | [
30522,
1026,
1001,
7513,
3640,
4730,
4973,
2005,
14614,
2069,
1010,
2302,
10943,
2100,
2593,
5228,
2030,
13339,
1010,
2164,
1010,
2021,
2025,
3132,
2000,
1010,
1996,
13339,
10943,
3111,
1997,
6432,
8010,
1998,
1013,
2030,
10516,
2005,
1037,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'bundler'
Bundler.require :default, :test
require 'quill'
Spec::Runner.configure do |config|
config.mock_with :mocha
end
| craigw/quill | spec/spec_helper.rb | Ruby | mit | 133 | [
30522,
5478,
1005,
14012,
2099,
1005,
14012,
2099,
1012,
5478,
1024,
12398,
1010,
1024,
3231,
5478,
1005,
21864,
3363,
1005,
28699,
1024,
1024,
5479,
1012,
9530,
8873,
27390,
2063,
2079,
1064,
9530,
8873,
2290,
1064,
9530,
8873,
2290,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**************************************************
*
* This is a template for early application low-level initialization.
*
* Copyright 1996-2010 IAR Systems AB.
*
* $Revision: 5993 $
*
**************************************************/
/*
* The function __low_level_init it called by the start-up code before
* "main" is called, and before data segment initialization is
* performed.
*
* This is a template file, modify to perform any initialization that
* should take place early.
*
* The return value of this function controls if data segment
* initialization should take place. If 0 is returned, it is bypassed.
*
* For the MSP430 microcontroller family, please consider disabling
* the watchdog timer here, as it could time-out during the data
* segment initialization.
*/
/*
* To disable the watchdog timer, include a suitable device header
* file (or "msp430.h") and add the following line to the function
* below:
*
* WDTCTL = WDTPW+WDTHOLD;
*
*/
#include <intrinsics.h>
#include "msp430.h"
int __low_level_init(void)
{
/* Insert your low-level initializations here */
_DINT();
WDTCTL = WDTPW+WDTHOLD;
/*
* Return value:
*
* 1 - Perform data segment initialization.
* 0 - Skip data segment initialization.
*/
return 1;
}
| openthread/ot-rtos | third_party/freertos/repo/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/low_level_init.c | C | bsd-3-clause | 1,354 | [
30522,
1013,
1008,
1008,
30524,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
/**
* appdevUrlGenerator
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class appdevUrlGenerator extends Symfony\Component\Routing\Generator\UrlGenerator
{
static private $declaredRouteNames = array(
'_wdt' => true,
'_profiler_search' => true,
'_profiler_purge' => true,
'_profiler_import' => true,
'_profiler_export' => true,
'_profiler_search_results' => true,
'_profiler' => true,
'_configurator_home' => true,
'_configurator_step' => true,
'_configurator_final' => true,
'Creditunions' => true,
'Creditunions_show' => true,
'Creditunions_new' => true,
'Creditunions_create' => true,
'Creditunions_edit' => true,
'Creditunions_update' => true,
'Creditunions_delete' => true,
'Customers' => true,
'Customers_show' => true,
'Customers_new' => true,
'Customers_create' => true,
'Customers_edit' => true,
'Customers_update' => true,
'Customers_delete' => true,
'creditunion_frontend_default_index' => true,
'creditunion_frontend_default_contact' => true,
'Depositsandloans' => true,
'Depositsandloans_show' => true,
'Depositsandloans_new' => true,
'Depositsandloans_create' => true,
'Depositsandloans_edit' => true,
'Depositsandloans_update' => true,
'Depositsandloans_delete' => true,
'Price' => true,
'Price_show' => true,
'Price_new' => true,
'Price_create' => true,
'Price_edit' => true,
'Price_update' => true,
'Price_delete' => true,
'creditunion_frontend_welcome_index' => true,
'worker' => true,
'worker_show' => true,
'worker_new' => true,
'worker_create' => true,
'worker_edit' => true,
'worker_update' => true,
'worker_delete' => true,
);
/**
* Constructor.
*/
public function __construct(RequestContext $context)
{
$this->context = $context;
}
public function generate($name, $parameters = array(), $absolute = false)
{
if (!isset(self::$declaredRouteNames[$name])) {
throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name));
}
$escapedName = str_replace('.', '__', $name);
list($variables, $defaults, $requirements, $tokens) = $this->{'get'.$escapedName.'RouteInfo'}();
return $this->doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $absolute);
}
private function get_wdtRouteInfo()
{
return array(array ( 0 => 'token',), array ( '_controller' => 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController::toolbarAction',), array (), array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'token', ), 1 => array ( 0 => 'text', 1 => '/_wdt', ),));
}
private function get_profiler_searchRouteInfo()
{
return array(array (), array ( '_controller' => 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController::searchAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/_profiler/search', ),));
}
private function get_profiler_purgeRouteInfo()
{
return array(array (), array ( '_controller' => 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController::purgeAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/_profiler/purge', ),));
}
private function get_profiler_importRouteInfo()
{
return array(array (), array ( '_controller' => 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController::importAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/_profiler/import', ),));
}
private function get_profiler_exportRouteInfo()
{
return array(array ( 0 => 'token',), array ( '_controller' => 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController::exportAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '.txt', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/\\.]+?', 3 => 'token', ), 2 => array ( 0 => 'text', 1 => '/_profiler/export', ),));
}
private function get_profiler_search_resultsRouteInfo()
{
return array(array ( 0 => 'token',), array ( '_controller' => 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController::searchResultsAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/search/results', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'token', ), 2 => array ( 0 => 'text', 1 => '/_profiler', ),));
}
private function get_profilerRouteInfo()
{
return array(array ( 0 => 'token',), array ( '_controller' => 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController::panelAction',), array (), array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'token', ), 1 => array ( 0 => 'text', 1 => '/_profiler', ),));
}
private function get_configurator_homeRouteInfo()
{
return array(array (), array ( '_controller' => 'Sensio\\Bundle\\DistributionBundle\\Controller\\ConfiguratorController::checkAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/_configurator/', ),));
}
private function get_configurator_stepRouteInfo()
{
return array(array ( 0 => 'index',), array ( '_controller' => 'Sensio\\Bundle\\DistributionBundle\\Controller\\ConfiguratorController::stepAction',), array (), array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'index', ), 1 => array ( 0 => 'text', 1 => '/_configurator/step', ),));
}
private function get_configurator_finalRouteInfo()
{
return array(array (), array ( '_controller' => 'Sensio\\Bundle\\DistributionBundle\\Controller\\ConfiguratorController::finalAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/_configurator/final', ),));
}
private function getCreditunionsRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CreditunionsController::indexAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/Creditunions/', ),));
}
private function getCreditunions_showRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CreditunionsController::showAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/show', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Creditunions', ),));
}
private function getCreditunions_newRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CreditunionsController::newAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/Creditunions/new', ),));
}
private function getCreditunions_createRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CreditunionsController::createAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/Creditunions/create', ),));
}
private function getCreditunions_editRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CreditunionsController::editAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/edit', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Creditunions', ),));
}
private function getCreditunions_updateRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CreditunionsController::updateAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/update', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Creditunions', ),));
}
private function getCreditunions_deleteRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CreditunionsController::deleteAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/delete', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Creditunions', ),));
}
private function getCustomersRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CustomersController::indexAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/Customers/', ),));
}
private function getCustomers_showRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CustomersController::showAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/show', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Customers', ),));
}
private function getCustomers_newRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CustomersController::newAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/Customers/new', ),));
}
private function getCustomers_createRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CustomersController::createAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/Customers/create', ),));
}
private function getCustomers_editRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CustomersController::editAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/edit', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Customers', ),));
}
private function getCustomers_updateRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CustomersController::updateAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/update', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Customers', ),));
}
private function getCustomers_deleteRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\CustomersController::deleteAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/delete', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Customers', ),));
}
private function getcreditunion_frontend_default_indexRouteInfo()
{
return array(array ( 0 => 'name',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\DefaultController::indexAction',), array (), array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'name', ), 1 => array ( 0 => 'text', 1 => '/hello', ),));
}
private function getcreditunion_frontend_default_contactRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\DefaultController::contact',), array (), array ( 0 => array ( 0 => 'text', 1 => '/contact', ),));
}
private function getDepositsandloansRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\DepositsandloansController::indexAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/Depositsandloans/', ),));
}
private function getDepositsandloans_showRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\DepositsandloansController::showAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/show', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Depositsandloans', ),));
}
private function getDepositsandloans_newRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\DepositsandloansController::newAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/Depositsandloans/new', ),));
}
private function getDepositsandloans_createRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\DepositsandloansController::createAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/Depositsandloans/create', ),));
}
private function getDepositsandloans_editRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\DepositsandloansController::editAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/edit', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Depositsandloans', ),));
}
private function getDepositsandloans_updateRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\DepositsandloansController::updateAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/update', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Depositsandloans', ),));
}
private function getDepositsandloans_deleteRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\DepositsandloansController::deleteAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/delete', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Depositsandloans', ),));
}
private function getPriceRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\PricelistController::indexAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/Price/', ),));
}
private function getPrice_showRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\PricelistController::showAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/show', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Price', ),));
}
private function getPrice_newRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\PricelistController::newAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/Price/new', ),));
}
private function getPrice_createRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\PricelistController::createAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/Price/create', ),));
}
private function getPrice_editRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\PricelistController::editAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/edit', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Price', ),));
}
private function getPrice_updateRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\PricelistController::updateAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/update', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Price', ),));
}
private function getPrice_deleteRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\PricelistController::deleteAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/delete', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Price', ),));
}
private function getcreditunion_frontend_welcome_indexRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\WelcomeController::indexAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/', ),));
}
private function getworkerRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\WorkerController::indexAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/Worker/', ),));
}
private function getworker_showRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\WorkerController::showAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/show', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Worker', ),));
}
private function getworker_newRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\WorkerController::newAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/Worker/new', ),));
}
private function getworker_createRouteInfo()
{
return array(array (), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\WorkerController::createAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/Worker/create', ),));
}
private function getworker_editRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\WorkerController::editAction',), array (), array ( 0 => array ( 0 => 'text', 1 => '/edit', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Worker', ),));
}
private function getworker_updateRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\WorkerController::updateAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/update', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Worker', ),));
}
private function getworker_deleteRouteInfo()
{
return array(array ( 0 => 'id',), array ( '_controller' => 'CreditUnion\\FrontendBundle\\Controller\\WorkerController::deleteAction',), array ( '_method' => 'post',), array ( 0 => array ( 0 => 'text', 1 => '/delete', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]+?', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/Worker', ),));
}
}
| JKord/CreditUnionSoftwareDb | app/cache/dev/appdevUrlGenerator.php | PHP | mit | 20,470 | [
30522,
1026,
1029,
25718,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
16972,
1032,
5227,
8663,
18209,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
16972,
1032,
6453,
1032,
2799,
17048,
14876,
8630,
10288,
24422,
1025,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# This file is part of authapi.
# Copyright (C) 2014-2020 Agora Voting SL <contact@nvotes.com>
# authapi is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License.
# authapi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with authapi. If not, see <http://www.gnu.org/licenses/>.
from django.conf.urls import url
from .decorators import captcha_required
from captcha import views
urlpatterns = [
url(r'^new/', views.new_captcha, name='new_captcha'),
]
| agoravoting/authapi | authapi/captcha/urls.py | Python | agpl-3.0 | 874 | [
30522,
1001,
2023,
5371,
2003,
2112,
1997,
8740,
8322,
8197,
1012,
1001,
9385,
1006,
1039,
1007,
2297,
1011,
12609,
3283,
2527,
6830,
22889,
1026,
3967,
1030,
1050,
22994,
2229,
1012,
4012,
1028,
1001,
8740,
8322,
8197,
2003,
2489,
4007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'spec_helper'
RSpec.describe Circuitry::Locks::NOOP, type: :model do
subject { described_class.new }
let(:id) { SecureRandom.hex(100) }
describe '#soft_lock' do
it 'returns true' do
expect(subject.soft_lock(id)).to be true
end
end
describe '#lock!' do
it 'returns nil' do
expect(subject.hard_lock(id)).to be nil
end
end
end
| kapost/circuitry | spec/circuitry/locks/noop_spec.rb | Ruby | mit | 376 | [
30522,
5478,
1005,
28699,
1035,
2393,
2121,
1005,
12667,
5051,
2278,
1012,
6235,
4984,
2854,
1024,
1024,
11223,
30524,
1001,
3730,
1035,
5843,
1005,
2079,
2009,
1005,
5651,
2995,
1005,
2079,
5987,
1006,
3395,
1012,
3730,
1035,
5843,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// This file is part of par2cmdline (a PAR 2.0 compatible file verification and
// repair tool). See http://parchive.sourceforge.net for details of PAR 2.0.
//
// Copyright (c) 2003 Peter Brian Clements
//
// par2cmdline is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// par2cmdline is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef __PAR1REPAIRERSOURCEFILE_H__
#define __PAR1REPAIRERSOURCEFILE_H__
// The Par1RepairerSourceFile object is used during verification and repair
// to record details about a particular source file and the data blocks
// for that file.
class Par1RepairerSourceFile
{
public:
// Construct the object and set the description and verification packets
Par1RepairerSourceFile(PAR1FILEENTRY *fileentry, string searchpath);
~Par1RepairerSourceFile(void);
string FileName(void) const {return filename;}
u64 FileSize(void) const {return filesize;}
const MD5Hash& HashFull(void) const {return hashfull;}
const MD5Hash& Hash16k(void) const {return hash16k;}
// Set/Get which DiskFile will contain the final repaired version of the file
void SetTargetFile(DiskFile *diskfile);
DiskFile* GetTargetFile(void) const;
// Set/Get whether or not the target file actually exists
void SetTargetExists(bool exists);
bool GetTargetExists(void) const;
// Set/Get which DiskFile contains a full undamaged version of the source file
void SetCompleteFile(DiskFile *diskfile);
DiskFile* GetCompleteFile(void) const;
void SetTargetBlock(DiskFile *diskfile);
DataBlock* SourceBlock(void) {return &sourceblock;}
DataBlock* TargetBlock(void) {return &targetblock;}
protected:
string filename;
u64 filesize;
MD5Hash hashfull;
MD5Hash hash16k;
DataBlock sourceblock;
DataBlock targetblock;
bool targetexists; // Whether the target file exists
DiskFile *targetfile; // The final version of the file
DiskFile *completefile; // A complete version of the file
};
#endif // __PAR1REPAIRERSOURCEFILE_H__
| BlackIkeEagle/par2cmdline | src/par1repairersourcefile.h | C | gpl-2.0 | 2,641 | [
30522,
1013,
1013,
2023,
5371,
2003,
2112,
1997,
11968,
2475,
27487,
19422,
3170,
1006,
1037,
11968,
1016,
1012,
1014,
11892,
5371,
22616,
1998,
1013,
1013,
7192,
6994,
1007,
1012,
2156,
8299,
1024,
1013,
1013,
27985,
4048,
3726,
1012,
3120... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
namespace FluentAssertions.Analyzers
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class StringShouldBeNullOrWhiteSpaceAnalyzer : StringAnalyzer
{
public const string DiagnosticId = Constants.Tips.Strings.StringShouldBeNullOrWhiteSpace;
public const string Category = Constants.Tips.Category;
public const string Message = "Use .Should() followed by .IsNullOrWhiteSpace() instead.";
protected override DiagnosticDescriptor Rule => new DiagnosticDescriptor(DiagnosticId, Title, Message, Category, DiagnosticSeverity.Info, true);
protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors
{
get
{
yield return new StringShouldBeNullOrWhiteSpaceSyntaxVisitor();
}
}
public class StringShouldBeNullOrWhiteSpaceSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public StringShouldBeNullOrWhiteSpaceSyntaxVisitor() : base(new MemberValidator("IsNullOrWhiteSpace"), MemberValidator.Should, new MemberValidator("BeTrue"))
{
}
}
}
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(StringShouldBeNullOrWhiteSpaceCodeFix)), Shared]
public class StringShouldBeNullOrWhiteSpaceCodeFix : FluentAssertionsCodeFixProvider
{
public override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(StringShouldBeNullOrWhiteSpaceAnalyzer.DiagnosticId);
protected override ExpressionSyntax GetNewExpression(ExpressionSyntax expression, FluentAssertionsDiagnosticProperties properties)
{
var remove = NodeReplacement.RemoveAndExtractArguments("IsNullOrWhiteSpace");
var newExpression = GetNewExpression(expression, remove);
var rename = NodeReplacement.Rename("BeTrue", "BeNullOrWhiteSpace");
newExpression = GetNewExpression(newExpression, rename);
var stringKeyword = newExpression.DescendantNodes().OfType<PredefinedTypeSyntax>().Single();
var subject = remove.Arguments.First().Expression;
return newExpression.ReplaceNode(stringKeyword, subject.WithTriviaFrom(stringKeyword));
}
}
} | fluentassertions/fluentassertions.analyzers | src/FluentAssertions.Analyzers/Tips/Strings/StringShouldBeNullOrWhiteSpace.cs | C# | mit | 2,512 | [
30522,
2478,
7513,
1012,
3642,
25902,
1025,
2478,
7513,
1012,
3642,
25902,
1012,
3642,
8873,
20156,
1025,
2478,
7513,
1012,
3642,
25902,
1012,
20116,
8167,
2361,
1012,
20231,
1025,
2478,
7513,
1012,
3642,
25902,
1012,
16474,
2015,
1025,
247... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* ========================================================================
* DOM-based Routing
* Based on http://goo.gl/EUTi53 by Paul Irish
*
* Only fires on body classes that match. If a body class contains a dash,
* replace the dash with an underscore when adding it to the object below.
*
* .noConflict()
* The routing is enclosed within an anonymous function so that you can
* always reference jQuery with $, even when in .noConflict() mode.
* ======================================================================== */
(function($) {
// Use this variable to set up the common and page specific functions. If you
// rename this variable, you will also need to rename the namespace below.
var Gruntd = {
// All pages
'common': {
init: function() {
// JavaScript to be fired on all pages
},
finalize: function() {
// JavaScript to be fired on all pages, after page specific JS is fired
}
},
// Home page
'home': {
init: function() {
// JavaScript to be fired on the home page
},
finalize: function() {
// JavaScript to be fired on the home page, after the init JS
}
},
// About us page, note the change from about-us to about_us.
'about_us': {
init: function() {
// JavaScript to be fired on the about us page
}
}
};
// The routing fires all common scripts, followed by the page specific scripts.
// Add additional events for more control over timing e.g. a finalize event
var UTIL = {
fire: function(func, funcname, args) {
var fire;
var namespace = Gruntd;
funcname = (funcname === undefined) ? 'init' : funcname;
fire = func !== '';
fire = fire && namespace[func];
fire = fire && typeof namespace[func][funcname] === 'function';
if (fire) {
namespace[func][funcname](args);
}
},
loadEvents: function() {
// Fire common init JS
UTIL.fire('common');
// Fire page-specific init JS, and then finalize JS
$.each(document.body.className.replace(/-/g, '_').split(/\s+/), function(i, classnm) {
UTIL.fire(classnm);
UTIL.fire(classnm, 'finalize');
});
// Fire common finalize JS
UTIL.fire('common', 'finalize');
}
};
// Load Events
$(document).ready(UTIL.loadEvents);
})(jQuery); // Fully reference jQuery after this point. | GFargo/gruntd | assets/js/src/main.js | JavaScript | mit | 2,425 | [
30522,
1013,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*!
* iCheck v1.0.1, http://git.io/arlzeA
* ===================================
* Powerful jQuery and Zepto plugin for checkboxes and radio buttons customization
*
* (c) 2013 Damir Sultanov, http://fronteed.com
* MIT Licensed
*/
(function($) {
// Cached vars
var _iCheck = 'iCheck',
_iCheckHelper = _iCheck + '-helper',
_checkbox = 'checkbox',
_radio = 'radio',
_checked = 'checked',
_unchecked = 'un' + _checked,
_disabled = 'disabled',
_determinate = 'determinate',
_indeterminate = 'in' + _determinate,
_update = 'update',
_type = 'type',
_click = 'click',
_touch = 'touchbegin.i touchend.i',
_add = 'addClass',
_remove = 'removeClass',
_callback = 'trigger',
_label = 'label',
_cursor = 'cursor',
_mobile = /ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);
// Plugin init
$.fn[_iCheck] = function(options, fire) {
// Walker
var handle = 'input[type="' + _checkbox + '"], input[type="' + _radio + '"]',
stack = $(),
walker = function(object) {
object.each(function() {
var self = $(this);
if (self.is(handle)) {
stack = stack.add(self);
} else {
stack = stack.add(self.find(handle));
};
});
};
// Check if we should operate with some method
if (/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(options)) {
// Normalize method's name
options = options.toLowerCase();
// Find checkboxes and radio buttons
walker(this);
return stack.each(function() {
var self = $(this);
if (options == 'destroy') {
tidy(self, 'ifDestroyed');
} else {
operate(self, true, options);
};
// Fire method's callback
if ($.isFunction(fire)) {
fire();
};
});
// Customization
} else if (typeof options == 'object' || !options) {
// Check if any options were passed
var settings = $.extend({
checkedClass: _checked,
disabledClass: _disabled,
indeterminateClass: _indeterminate,
labelHover: true,
aria: false
}, options),
selector = settings.handle,
hoverClass = settings.hoverClass || 'hover',
focusClass = settings.focusClass || 'focus',
activeClass = settings.activeClass || 'active',
labelHover = !!settings.labelHover,
labelHoverClass = settings.labelHoverClass || 'hover',
// Setup clickable area
area = ('' + settings.increaseArea).replace('%', '') | 0;
// Selector limit
if (selector == _checkbox || selector == _radio) {
handle = 'input[type="' + selector + '"]';
};
// Clickable area limit
if (area < -50) {
area = -50;
};
// Walk around the selector
walker(this);
return stack.each(function() {
var self = $(this);
// If already customized
tidy(self);
var node = this,
id = node.id,
// Layer styles
offset = -area + '%',
size = 100 + (area * 2) + '%',
layer = {
position: 'absolute',
top: offset,
left: offset,
display: 'block',
width: size,
height: size,
margin: 0,
padding: 0,
background: '#fff',
border: 0,
opacity: 0
},
// Choose how to hide input
hide = _mobile ? {
position: 'absolute',
visibility: 'hidden'
} : area ? layer : {
position: 'absolute',
opacity: 0
},
// Get proper class
className = node[_type] == _checkbox ? settings.checkboxClass || 'i' + _checkbox : settings.radioClass || 'i' + _radio,
// Find assigned labels
label = $(_label + '[for="' + id + '"]').add(self.closest(_label)),
// Check ARIA option
aria = !!settings.aria,
// Set ARIA placeholder
ariaID = _iCheck + '-' + Math.random().toString(36).substr(2,6),
// Parent & helper
parent = '<div class="' + className + '" ' + (aria ? 'role="' + node[_type] + '" ' : ''),
helper;
// Set ARIA "labelledby"
if (aria) {
label.each(function() {
parent += 'aria-labelledby="';
if (this.id) {
parent += this.id;
} else {
this.id = ariaID;
parent += ariaID;
}
parent += '"';
});
};
// Wrap input
parent = self.wrap(parent + '/>')[_callback]('ifCreated').parent().append(settings.insert);
// Layer addition
helper = $('<ins class="' + _iCheckHelper + '"/>').css(layer).appendTo(parent);
// Finalize customization
self.data(_iCheck, {o: settings, s: self.attr('style')}).css(hide);
!!settings.inheritClass && parent[_add](node.className || '');
!!settings.inheritID && id && parent.attr('id', _iCheck + '-' + id);
parent.css('position') == 'static' && parent.css('position', 'relative');
operate(self, true, _update);
// Label events
if (label.length) {
label.on(_click + '.i mouseover.i mouseout.i ' + _touch, function(event) {
var type = event[_type],
item = $(this);
// Do nothing if input is disabled
if (!node[_disabled]) {
// Click
if (type == _click) {
if ($(event.target).is('a')) {
return;
}
operate(self, false, true);
// Hover state
} else if (labelHover) {
// mouseout|touchend
if (/ut|nd/.test(type)) {
parent[_remove](hoverClass);
item[_remove](labelHoverClass);
} else {
parent[_add](hoverClass);
item[_add](labelHoverClass);
};
};
if (_mobile) {
event.stopPropagation();
} else {
return false;
};
};
});
};
// Input events
self.on(_click + '.i focus.i blur.i keyup.i keydown.i keypress.i', function(event) {
var type = event[_type],
key = event.keyCode;
// Click
if (type == _click) {
return false;
// Keydown
} else if (type == 'keydown' && key == 32) {
if (!(node[_type] == _radio && node[_checked])) {
if (node[_checked]) {
off(self, _checked);
} else {
on(self, _checked);
};
};
return false;
// Keyup
} else if (type == 'keyup' && node[_type] == _radio) {
!node[_checked] && on(self, _checked);
// Focus/blur
} else if (/us|ur/.test(type)) {
parent[type == 'blur' ? _remove : _add](focusClass);
};
});
// Helper events
helper.on(_click + ' mousedown mouseup mouseover mouseout ' + _touch, function(event) {
var type = event[_type],
// mousedown|mouseup
toggle = /wn|up/.test(type) ? activeClass : hoverClass;
// Do nothing if input is disabled
if (!node[_disabled]) {
// Click
if (type == _click) {
operate(self, false, true);
// Active and hover states
} else {
// State is on
if (/wn|er|in/.test(type)) {
// mousedown|mouseover|touchbegin
parent[_add](toggle);
// State is off
} else {
parent[_remove](toggle + ' ' + activeClass);
};
// Label hover
if (label.length && labelHover && toggle == hoverClass) {
// mouseout|touchend
label[/ut|nd/.test(type) ? _remove : _add](labelHoverClass);
};
};
if (_mobile) {
event.stopPropagation();
} else {
return false;
};
};
});
});
} else {
return this;
};
};
// Do something with inputs
function operate(input, direct, method) {
var node = input[0],
state = /er/.test(method) ? _indeterminate : /bl/.test(method) ? _disabled : _checked,
active = method == _update ? {
checked: node[_checked],
disabled: node[_disabled],
indeterminate: input.attr(_indeterminate) == 'true' || input.attr(_determinate) == 'false'
} : node[state];
// Check, disable or indeterminate
if (/^(ch|di|in)/.test(method) && !active) {
on(input, state);
// Uncheck, enable or determinate
} else if (/^(un|en|de)/.test(method) && active) {
off(input, state);
// Update
} else if (method == _update) {
// Handle states
for (var state in active) {
if (active[state]) {
on(input, state, true);
} else {
off(input, state, true);
};
};
} else if (!direct || method == 'toggle') {
// Helper or label was clicked
if (!direct) {
input[_callback]('ifClicked');
};
// Toggle checked state
if (active) {
if (node[_type] !== _radio) {
off(input, state);
};
} else {
on(input, state);
};
};
};
// Add checked, disabled or indeterminate state
function on(input, state, keep) {
var node = input[0],
parent = input.parent(),
checked = state == _checked,
indeterminate = state == _indeterminate,
disabled = state == _disabled,
callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled',
regular = option(input, callback + capitalize(node[_type])),
specific = option(input, state + capitalize(node[_type]));
// Prevent unnecessary actions
if (node[state] !== true) {
// Toggle assigned radio buttons
if (!keep && state == _checked && node[_type] == _radio && node.name) {
var form = input.closest('form'),
inputs = 'input[name="' + node.name + '"]';
inputs = form.length ? form.find(inputs) : $(inputs);
inputs.each(function() {
if (this !== node && $(this).data(_iCheck)) {
off($(this), state);
};
});
};
// Indeterminate state
if (indeterminate) {
// Add indeterminate state
node[state] = true;
// Remove checked state
if (node[_checked]) {
off(input, _checked, 'force');
};
// Checked or disabled state
} else {
// Add checked or disabled state
if (!keep) {
node[state] = true;
};
// Remove indeterminate state
if (checked && node[_indeterminate]) {
off(input, _indeterminate, false);
};
};
// Trigger callbacks
callbacks(input, checked, state, keep);
};
// Add proper cursor
if (node[_disabled] && !!option(input, _cursor, true)) {
parent.find('.' + _iCheckHelper).css(_cursor, 'default');
};
// Add state class
parent[_add](specific || option(input, state) || '');
// Set ARIA attribute
disabled ? parent.attr('aria-disabled', 'true') : parent.attr('aria-checked', indeterminate ? 'mixed' : 'true');
// Remove regular state class
parent[_remove](regular || option(input, callback) || '');
};
// Remove checked, disabled or indeterminate state
function off(input, state, keep) {
var node = input[0],
parent = input.parent(),
checked = state == _checked,
indeterminate = state == _indeterminate,
disabled = state == _disabled,
callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled',
regular = option(input, callback + capitalize(node[_type])),
specific = option(input, state + capitalize(node[_type]));
// Prevent unnecessary actions
if (node[state] !== false) {
// Toggle state
if (indeterminate || !keep || keep == 'force') {
node[state] = false;
};
// Trigger callbacks
callbacks(input, checked, callback, keep);
};
// Add proper cursor
if (!node[_disabled] && !!option(input, _cursor, true)) {
parent.find('.' + _iCheckHelper).css(_cursor, 'pointer');
};
// Remove state class
parent[_remove](specific || option(input, state) || '');
// Set ARIA attribute
disabled ? parent.attr('aria-disabled', 'false') : parent.attr('aria-checked', 'false');
// Add regular state class
parent[_add](regular || option(input, callback) || '');
};
// Remove all traces
function tidy(input, callback) {
if (input.data(_iCheck)) {
// Remove everything except input
input.parent().html(input.attr('style', input.data(_iCheck).s || ''));
// Callback
if (callback) {
input[_callback](callback);
};
// Unbind events
input.off('.i').unwrap();
$(_label + '[for="' + input[0].id + '"]').add(input.closest(_label)).off('.i');
};
};
// Get some option
function option(input, state, regular) {
if (input.data(_iCheck)) {
return input.data(_iCheck).o[state + (regular ? '' : 'Class')];
};
};
// Capitalize some string
function capitalize(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
};
// Executable handlers
function callbacks(input, checked, callback, keep) {
if (!keep) {
if (checked) {
input[_callback]('ifToggled');
};
input[_callback]('ifChanged')[_callback]('if' + capitalize(callback));
};
};
})(window.jQuery || window.Zepto); | mautd29388/mtheme | wp-content/themes/01-Sources/js/icheck/icheck.js | JavaScript | gpl-2.0 | 14,154 | [
30522,
1013,
1008,
999,
1008,
22564,
11012,
1058,
2487,
1012,
1014,
1012,
1015,
1010,
8299,
1024,
1013,
1013,
21025,
2102,
1012,
22834,
1013,
12098,
23858,
5243,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
<title>Generates</title>
<link href="//fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css" type="text/css" media="screen,projection">
<link href="//goswagger.io//css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link rel="stylesheet" href="//goswagger.io//css/prism.css" />
<style type="text/css">
footer.page-footer{background-image: url(//goswagger.io//images/default.png);}
</style>
</head>
<body>
<ul id="slide-out" class="side-nav">
<li><a href="//goswagger.io/"><i class="mdi-action-home left"></i>Home</a></li>
<li><a href="//goswagger.io//generate/spec/"><i class="mdi-action-loyalty left"></i>Swagger.json</a></li>
<li><a href="//goswagger.io//generate/client/"><i class="mdi-action-polymer left"></i>Generate Client</a></li>
<li><a href="//goswagger.io//generate/server/"><i class="mdi-action-perm-data-setting left"></i>Generate Server</a></li>
<li><a href="//goswagger.io//usage/validate/"><i class="mdi-action-perm-media left"></i>Validate Spec</a></li>
</ul>
<div id="index-banner" class="parallax-container">
<a data-activates="slide-out" class="btn-floating button-collapse" style="top: 5px; left: 5px;"><i class="mdi-navigation-menu"></i></a>
<div class="section no-pad-bot">
<div class="container">
<h1 class="header center teal-text text-lighten-2"><a href="//goswagger.io/">go-swagger toolkit</a></h1>
<div class="row center">
<h5 class="header col s12 light">Swagger 2.0 describes your API's for you, so you don't have to</h5>
</div>
<div class="row center">
<a href="https://github.com/go-swagger/go-swagger"><img src="//goswagger.io//images/github2-dreamstale35.png"></a>
</div>
</div>
</div>
<div class="parallax">
<img src="//goswagger.io//images/default.png">
</div>
</div>
<div class="container">
<div class="section">
<div class="row">
<div class="col m4 s12">
<div class="card-panel">
<h4><a href="//goswagger.io/generate/spec/">swagger.json generation</a></h4>
<p>
<a href="//goswagger.io//categories/generate/">generate</a>
</p>
<p><p>The toolkit has a command that will let you generate a swagger spec document from your code.
The command integrates with go doc comments, and makes use of structs when it needs to know of
types.</p>
</p>
<p>
9 Nov 2015
</p>
</div>
</div>
<div class="col m4 s12">
<div class="card-panel">
<h4><a href="//goswagger.io/generate/client/">Generate an API client</a></h4>
<p>
<a href="//goswagger.io//categories/generate/">generate</a>
<a href="//goswagger.io//categories/client/">client</a>
</p>
<p><p>The toolkit has a command that will let you generate a client.</p>
</p>
<p>
23 Oct 2015
</p>
</div>
</div>
<div class="col m4 s12">
<div class="card-panel">
<h4><a href="//goswagger.io/generate/server/">Generate a server for a swagger spec</a></h4>
<p>
<a href="//goswagger.io//categories/generate/">generate</a>
<a href="//goswagger.io//categories/server/">server</a>
</p>
<p><p>The toolkit has a command that will let you generate a docker friendly server with support for TLS.
You can configure it through environment variables that are commonly used on PaaS services.</p>
</p>
<p>
22 Nov 2015
</p>
</div>
</div>
</div>
<div class="row">
<div class="col m4 s12">
<div class="card-panel">
<h4><a href="//goswagger.io/generate/spec/meta/">swagger:meta</a></h4>
<p>
<a href="//goswagger.io//categories/spec/">spec</a>
</p>
<p>The swagger:meta annotation flags a file as source for metadata about the API. This is typically a doc.go file with your package documentation. You can specify a Consumes and Produces key which has a new content type on each line Schemes is a tag that is required and allows for a comma separated string composed of: http, https, ws or wss Host and BasePath can be specified but those values will be defaults, they should get substituted when serving the swagger spec.</p>
<p>
14 Nov 2015
<a href="//goswagger.io//tags/meta-data/">#meta data</a>
</p>
</div>
</div>
<div class="col m4 s12">
<div class="card-panel">
<h4><a href="//goswagger.io/generate/spec/route/">swagger:route</a></h4>
<p>
<a href="//goswagger.io//categories/spec/">spec</a>
</p>
<p><p>A <strong>swagger:route</strong> annotation links a path to a method.
This operation gets a unique id, which is used in various places as method name.
One such usage is in method names for client generation for example.</p>
<p>Because there are many routers available, this tool does not try to parse the paths
you provided to your routing library of choice. So you have to specify your path pattern
yourself in valid swagger syntax.</p>
</p>
<p>
14 Nov 2015
<a href="//goswagger.io//tags/operations/">#operations</a>
</p>
</div>
</div>
<div class="col m4 s12">
<div class="card-panel">
<h4><a href="//goswagger.io/generate/spec/params/">swagger:params</a></h4>
<p>
<a href="//goswagger.io//categories/spec/">spec</a>
</p>
<p><p>The <strong>swagger:params</strong> annotation links a struct to one or more operations. The params in the resulting swagger spec can be composed of several structs.
There are no guarantees given on how property name overlaps are resolved when several structs apply to the same operation.
This tag works very similar to the swagger:model tag except that it produces valid parameter objects instead of schema
objects.</p>
</p>
<p>
14 Nov 2015
<a href="//goswagger.io//tags/operations/">#operations</a>
</p>
</div>
</div>
</div>
<div class="row">
<div class="col m4 s12">
<div class="card-panel">
<h4><a href="//goswagger.io/generate/spec/response/">swagger:response</a></h4>
<p>
<a href="//goswagger.io//categories/spec/">spec</a>
</p>
<p><p>Reads a struct decorated with <strong>swagger:response</strong> and uses that information to fill up the headers and the schema for a response.
A swagger:route can specify a response name for a status code and then the matching response will be used for that operation in the swagger definition.</p>
</p>
<p>
14 Nov 2015
<a href="//goswagger.io//tags/operations/">#operations</a>
</p>
</div>
</div>
<div class="col m4 s12">
<div class="card-panel">
<h4><a href="//goswagger.io/generate/spec/model/">swagger:model</a></h4>
<p>
<a href="//goswagger.io//categories/spec/">spec</a>
</p>
<p><p>A <strong>swagger:model</strong> annotation optionally gets a model name as extra data on the line.
when this appears anywhere in a comment for a struct, then that struct becomes a schema
in the definitions object of swagger.</p>
</p>
<p>
14 Nov 2015
<a href="//goswagger.io//tags/definitions/">#definitions</a>
</p>
</div>
</div>
<div class="col m4 s12">
<div class="card-panel">
<h4><a href="//goswagger.io/generate/spec/allOf/">swagger:allOf</a></h4>
<p>
<a href="//goswagger.io//categories/spec/">spec</a>
</p>
<p><p>Marks an embedded type as a member for allOf</p>
</p>
<p>
14 Nov 2015
<a href="//goswagger.io//tags/polymorphism/">#polymorphism</a>
</p>
</div>
</div>
</div>
<div class="row">
<div class="col s3 m1">
<a class="btn-floating btn-large disabled"><i class="mdi-navigation-arrow-back"></i></a>
</div>
<div class="col s6 m10 center"> </div>
<div class="col s3 m1">
<a class="btn-floating btn-large waves-effect waves-light" href="/generate/page/2/"><i class="mdi-navigation-arrow-forward"></i></a>
</div>
</div>
</div>
</div>
<footer class="page-footer">
<div class="footer-copyright">
<div class="container">
© 2015 go-swagger contributors
<div class="right">Design <a class="grey-text text-lighten-4" href="http://pdevty.github.io/blog/">pdevty</a></div>
</div>
</div>
</footer>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<script src="//goswagger.io//js/init.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/prism/0.0.1/prism.min.js"></script>
</body>
</html>
| aleksandr-vin/go-swagger | docs/public/generate/index.html | HTML | apache-2.0 | 9,658 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1011,
2149,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.erp.lib.server.exception;
public class UnauthorizedException extends Exception {
}
| desweemerl/erp-lib-server | src/main/java/com/erp/lib/server/exception/UnauthorizedException.java | Java | mit | 96 | [
30522,
7427,
4012,
1012,
9413,
2361,
1012,
5622,
2497,
1012,
8241,
1012,
6453,
1025,
2270,
2465,
24641,
10288,
24422,
8908,
6453,
1063,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>NugetFrameworkReferences - FAKE - F# Make</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Steffen Forkmann, Mauricio Scheffer, Colin Bull">
<script src="http://code.jquery.com/jquery-1.8.0.js"></script>
<script src="http://code.jquery.com/ui/1.8.23/jquery-ui.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="http://fsharp.github.io/FAKE/content/style.css" />
<script type="text/javascript" src="http://fsharp.github.io/FAKE/content/tips.js"></script>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="masthead">
<ul class="nav nav-pills pull-right">
<li><a href="http://fsharp.org">fsharp.org</a></li>
<li><a href="http://github.com/fsharp/fake">github page</a></li>
</ul>
<h3 class="muted">FAKE - F# Make</h3>
</div>
<hr />
<div class="row">
<div class="span9" id="main">
<h1>NugetFrameworkReferences</h1>
<div class="xmldoc">
</div>
<h3>Record Fields</h3>
<table class="table table-bordered member-list">
<thead>
<tr><td>Record Field</td><td>Description</td></tr>
</thead>
<tbody>
<tr>
<td class="member-name">
<code onmouseout="hideTip(event, '1123', 1123)" onmouseover="showTip(event, '1123', 1123)">
FrameworkVersion
</code>
<div class="tip" id="1123">
<strong>Signature:</strong>string<br />
</div>
</td>
<td class="xmldoc">
<a href="https://github.com/fsharp/FAKE/blob/master/src/app/FakeLib/NuGet/NugetHelper.fs#L19-19" class="github-link">Go to GitHub source</a>
</td>
</tr>
<tr>
<td class="member-name">
<code onmouseout="hideTip(event, '1124', 1124)" onmouseover="showTip(event, '1124', 1124)">
References
</code>
<div class="tip" id="1124">
<strong>Signature:</strong>NugetReferences<br />
</div>
</td>
<td class="xmldoc">
<a href="https://github.com/fsharp/FAKE/blob/master/src/app/FakeLib/NuGet/NugetHelper.fs#L20-20" class="github-link">Go to GitHub source</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="span3">
<img src="http://fsharp.github.io/FAKE/pics/logo.png" alt="FAKE - F# Make" style="width:150px;margin-left: 20px;" />
<ul class="nav nav-list" id="menu" style="margin-top: 20px;">
<li class="nav-header">FAKE - F# Make</li>
<li><a href="http://fsharp.github.io/FAKE/index.html">Home page</a></li>
<li class="divider"></li>
<li><a href="https://nuget.org/packages/Fake">Get FAKE via NuGet</a></li>
<li><a href="http://github.com/fsharp/fake">Source Code on GitHub</a></li>
<li><a href="https://github.com/fsharp/FAKE/blob/develop/License.txt">License (MS-PL)</a></li>
<li><a href="http://fsharp.github.io/FAKE/users.html">Who is using FAKE?</a></li>
<li><a href="http://fsharp.github.io/FAKE/RELEASE_NOTES.html">Release Notes</a></li>
<li><a href="http://fsharp.github.io/FAKE/contributing.html">Contributing to FAKE</a></li>
<li><a href="http://stackoverflow.com/questions/tagged/f%23-fake">Ask a question</a></li>
<li class="nav-header">Articles</li>
<li><a href="http://fsharp.github.io/FAKE/gettingstarted.html">Getting started</a></li>
<li class="divider"></li>
<li><a href="http://fsharp.github.io/FAKE/nuget.html">NuGet package restore</a></li>
<li><a href="http://fsharp.github.io/FAKE/fxcop.html">Using FxCop in a build</a></li>
<li><a href="http://fsharp.github.io/FAKE/assemblyinfo.html">Generating AssemblyInfo</a></li>
<li><a href="http://fsharp.github.io/FAKE/create-nuget-package.html">Create NuGet packages</a></li>
<li><a href="http://fsharp.github.io/FAKE/specifictargets.html">Running specific targets</a></li>
<li><a href="http://fsharp.github.io/FAKE/commandline.html">Running FAKE from command line</a></li>
<li><a href="http://fsharp.github.io/FAKE/customtasks.html">Creating custom tasks</a></li>
<li><a href="http://fsharp.github.io/FAKE/teamcity.html">TeamCity integration</a></li>
<li><a href="http://fsharp.github.io/FAKE/canopy.html">Running canopy tests</a></li>
<li><a href="http://fsharp.github.io/FAKE/octopusdeploy.html">Octopus Deploy</a></li>
<li><a href="http://fsharp.github.io/FAKE/typescript.html">TypeScript support</a></li>
<li class="divider"></li>
<li><a href="http://fsharp.github.io/FAKE/deploy.html">Fake.Deploy</a></li>
<li class="nav-header">Documentation</li>
<li><a href="http://fsharp.github.io/FAKE/apidocs/index.html">API Reference</a></li>
</ul>
</div>
</div>
</div>
<a href="http://github.com/fsharp/fake"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
</body>
</html>
| TeaDrivenDev/Graphology | packages/FAKE/docs/apidocs/fake-nugethelper-nugetframeworkreferences.html | HTML | mit | 5,946 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
2516,
1028,
16371,
18150,
15643,
6198,
2890,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Hyperframework\Web;
use Exception;
abstract class HttpException extends Exception {
private $statusCode;
private $statusReasonPhrase;
/**
* @param string $message
* @param int $statusCode
* @param string $statusReasonPhrase
* @param Exception $previous
*/
public function __construct(
$message, $statusCode, $statusReasonPhrase, $previous = null
) {
if ($message === null) {
$message = $statusCode . ' ' . $statusReasonPhrase . '.';
}
parent::__construct($message, 0, $previous);
$this->statusCode = $statusCode;
$this->statusReasonPhrase = $statusReasonPhrase;
}
/**
* @return string
*/
public function getStatus() {
return $this->statusCode . ' ' . $this->statusReasonPhrase;
}
/**
* @return int
*/
public function getStatusCode() {
return $this->statusCode;
}
/**
* @return string
*/
public function getStatusReasonPhrase() {
return $this->statusReasonPhrase;
}
/**
* @return array
*/
public function getHttpHeaders() {
return [];
}
}
| hyperframework/hyperframework | lib/Web/HttpException.php | PHP | mit | 1,190 | [
30522,
1026,
1029,
25718,
3415,
15327,
23760,
15643,
6198,
1032,
4773,
1025,
2224,
6453,
1025,
10061,
2465,
8299,
10288,
24422,
8908,
6453,
1063,
2797,
1002,
3570,
16044,
1025,
2797,
1002,
3570,
16416,
3385,
8458,
23797,
1025,
1013,
1008,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"59145830","logradouro":"Rua Pires de Campos","bairro":"Passagem de Areia","cidade":"Parnamirim","uf":"RN","estado":"Rio Grande do Norte"});
| lfreneda/cepdb | api/v1/59145830.jsonp.js | JavaScript | cc0-1.0 | 154 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
5354,
16932,
27814,
14142,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
14255,
6072,
2139,
26925,
1000,
1010,
1000,
21790,
18933,
1000,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var Q = require('q');
var uuid = require('uuid');
var crypto = require('../../../../crypto/crypto');
function Connect() {
}
var connect = new Connect();
module.exports = connect;
Connect.prototype.init = function(letter, handler) {
console.log(letter);
var deferred = Q.defer();
var back_letter = {
signature: letter.signature,
directive: {
connect: {
init: null
}
}
};
deferred.resolve(back_letter);
return deferred.promise;
};
Connect.prototype.crypto = function(letter, handler) {
let deferred = Q.defer();
let public_str = letter.crypto.public_str;
// 使用uuid 作为密码
// let secret = uuid.v4();
let secret = '12345678';
let encryptSecret = crypto.publicEncrypt(public_str, secret);
let json = encryptSecret.toJSON();
console.log('密码为:');
console.log(secret);
// console.log(encryptSecret.toString());
letter.crypto.encryptSecret = JSON.stringify(encryptSecret.toJSON());
deferred.resolve(letter);
setTimeout(function() {
handler.crypto = true;
handler.encryptSecret = secret;
let letter = {
directive: {
test: null
}
};
letter = JSON.stringify(letter);
letter = crypto.cipher(letter, secret);
handler.evenEmitter.emit('letter', letter);
}, 5000);
return deferred.promise;
};
| xunull/letter | lib/core/directive/net.connect/client/connect.js | JavaScript | mit | 1,450 | [
30522,
13075,
1053,
1027,
5478,
1006,
1005,
1053,
1005,
1007,
1025,
13075,
1057,
21272,
1027,
5478,
1006,
1005,
1057,
21272,
1005,
1007,
1025,
13075,
19888,
2080,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
1012,
1012,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
exports.name = 'should';
exports.category = 'bdd/tdd';
exports.homepage = 'https://npmjs.org/package/should';
| ek1437/PeerTutor | www.peertutor.com/node_modules/nodeman/docs/should.meta.js | JavaScript | apache-2.0 | 110 | [
30522,
14338,
1012,
2171,
1027,
1005,
2323,
1005,
1025,
14338,
1012,
4696,
1027,
1005,
1038,
14141,
1013,
14595,
2094,
1005,
1025,
14338,
1012,
2188,
13704,
1027,
1005,
16770,
1024,
1013,
1013,
27937,
2213,
22578,
1012,
8917,
1013,
7427,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//===- LiveDebugVariables.cpp - Tracking debug info variables -------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the LiveDebugVariables analysis.
//
// Remove all DBG_VALUE instructions referencing virtual registers and replace
// them with a data structure tracking where live user variables are kept - in a
// virtual register or in a stack slot.
//
// Allow the data structure to be updated during register allocation when values
// are moved between registers and stack slots. Finally emit new DBG_VALUE
// instructions after register allocation is complete.
//
//===----------------------------------------------------------------------===//
#include "LiveDebugVariables.h"
#include "llvm/ADT/IntervalMap.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <memory>
#include <utility>
using namespace llvm;
#define DEBUG_TYPE "livedebug"
static cl::opt<bool>
EnableLDV("live-debug-variables", cl::init(true),
cl::desc("Enable the live debug variables pass"), cl::Hidden);
STATISTIC(NumInsertedDebugValues, "Number of DBG_VALUEs inserted");
char LiveDebugVariables::ID = 0;
INITIALIZE_PASS_BEGIN(LiveDebugVariables, "livedebugvars",
"Debug Variable Analysis", false, false)
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
INITIALIZE_PASS_END(LiveDebugVariables, "livedebugvars",
"Debug Variable Analysis", false, false)
void LiveDebugVariables::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<MachineDominatorTree>();
AU.addRequiredTransitive<LiveIntervals>();
AU.setPreservesAll();
MachineFunctionPass::getAnalysisUsage(AU);
}
LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID), pImpl(nullptr) {
initializeLiveDebugVariablesPass(*PassRegistry::getPassRegistry());
}
/// LocMap - Map of where a user value is live, and its location.
typedef IntervalMap<SlotIndex, unsigned, 4> LocMap;
namespace {
/// UserValueScopes - Keeps track of lexical scopes associated with a
/// user value's source location.
class UserValueScopes {
DebugLoc DL;
LexicalScopes &LS;
SmallPtrSet<const MachineBasicBlock *, 4> LBlocks;
public:
UserValueScopes(DebugLoc D, LexicalScopes &L) : DL(std::move(D)), LS(L) {}
/// dominates - Return true if current scope dominates at least one machine
/// instruction in a given machine basic block.
bool dominates(MachineBasicBlock *MBB) {
if (LBlocks.empty())
LS.getMachineBasicBlocks(DL, LBlocks);
return LBlocks.count(MBB) != 0 || LS.dominates(DL, MBB);
}
};
} // end anonymous namespace
/// UserValue - A user value is a part of a debug info user variable.
///
/// A DBG_VALUE instruction notes that (a sub-register of) a virtual register
/// holds part of a user variable. The part is identified by a byte offset.
///
/// UserValues are grouped into equivalence classes for easier searching. Two
/// user values are related if they refer to the same variable, or if they are
/// held by the same virtual register. The equivalence class is the transitive
/// closure of that relation.
namespace {
class LDVImpl;
class UserValue {
const MDNode *Variable; ///< The debug info variable we are part of.
const MDNode *Expression; ///< Any complex address expression.
unsigned offset; ///< Byte offset into variable.
bool IsIndirect; ///< true if this is a register-indirect+offset value.
DebugLoc dl; ///< The debug location for the variable. This is
///< used by dwarf writer to find lexical scope.
UserValue *leader; ///< Equivalence class leader.
UserValue *next; ///< Next value in equivalence class, or null.
/// Numbered locations referenced by locmap.
SmallVector<MachineOperand, 4> locations;
/// Map of slot indices where this value is live.
LocMap locInts;
/// coalesceLocation - After LocNo was changed, check if it has become
/// identical to another location, and coalesce them. This may cause LocNo or
/// a later location to be erased, but no earlier location will be erased.
void coalesceLocation(unsigned LocNo);
/// insertDebugValue - Insert a DBG_VALUE into MBB at Idx for LocNo.
void insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx, unsigned LocNo,
LiveIntervals &LIS, const TargetInstrInfo &TII);
/// splitLocation - Replace OldLocNo ranges with NewRegs ranges where NewRegs
/// is live. Returns true if any changes were made.
bool splitLocation(unsigned OldLocNo, ArrayRef<unsigned> NewRegs,
LiveIntervals &LIS);
public:
/// UserValue - Create a new UserValue.
UserValue(const MDNode *var, const MDNode *expr, unsigned o, bool i,
DebugLoc L, LocMap::Allocator &alloc)
: Variable(var), Expression(expr), offset(o), IsIndirect(i),
dl(std::move(L)), leader(this), next(nullptr), locInts(alloc) {}
/// getLeader - Get the leader of this value's equivalence class.
UserValue *getLeader() {
UserValue *l = leader;
while (l != l->leader)
l = l->leader;
return leader = l;
}
/// getNext - Return the next UserValue in the equivalence class.
UserValue *getNext() const { return next; }
/// match - Does this UserValue match the parameters?
bool match(const MDNode *Var, const MDNode *Expr, const DILocation *IA,
unsigned Offset, bool indirect) const {
return Var == Variable && Expr == Expression && dl->getInlinedAt() == IA &&
Offset == offset && indirect == IsIndirect;
}
/// merge - Merge equivalence classes.
static UserValue *merge(UserValue *L1, UserValue *L2) {
L2 = L2->getLeader();
if (!L1)
return L2;
L1 = L1->getLeader();
if (L1 == L2)
return L1;
// Splice L2 before L1's members.
UserValue *End = L2;
while (End->next) {
End->leader = L1;
End = End->next;
}
End->leader = L1;
End->next = L1->next;
L1->next = L2;
return L1;
}
/// getLocationNo - Return the location number that matches Loc.
unsigned getLocationNo(const MachineOperand &LocMO) {
if (LocMO.isReg()) {
if (LocMO.getReg() == 0)
return ~0u;
// For register locations we dont care about use/def and other flags.
for (unsigned i = 0, e = locations.size(); i != e; ++i)
if (locations[i].isReg() &&
locations[i].getReg() == LocMO.getReg() &&
locations[i].getSubReg() == LocMO.getSubReg())
return i;
} else
for (unsigned i = 0, e = locations.size(); i != e; ++i)
if (LocMO.isIdenticalTo(locations[i]))
return i;
locations.push_back(LocMO);
// We are storing a MachineOperand outside a MachineInstr.
locations.back().clearParent();
// Don't store def operands.
if (locations.back().isReg())
locations.back().setIsUse();
return locations.size() - 1;
}
/// mapVirtRegs - Ensure that all virtual register locations are mapped.
void mapVirtRegs(LDVImpl *LDV);
/// addDef - Add a definition point to this value.
void addDef(SlotIndex Idx, const MachineOperand &LocMO) {
// Add a singular (Idx,Idx) -> Loc mapping.
LocMap::iterator I = locInts.find(Idx);
if (!I.valid() || I.start() != Idx)
I.insert(Idx, Idx.getNextSlot(), getLocationNo(LocMO));
else
// A later DBG_VALUE at the same SlotIndex overrides the old location.
I.setValue(getLocationNo(LocMO));
}
/// extendDef - Extend the current definition as far as possible down the
/// dominator tree. Stop when meeting an existing def or when leaving the live
/// range of VNI.
/// End points where VNI is no longer live are added to Kills.
/// @param Idx Starting point for the definition.
/// @param LocNo Location number to propagate.
/// @param LR Restrict liveness to where LR has the value VNI. May be null.
/// @param VNI When LR is not null, this is the value to restrict to.
/// @param Kills Append end points of VNI's live range to Kills.
/// @param LIS Live intervals analysis.
/// @param MDT Dominator tree.
void extendDef(SlotIndex Idx, unsigned LocNo,
LiveRange *LR, const VNInfo *VNI,
SmallVectorImpl<SlotIndex> *Kills,
LiveIntervals &LIS, MachineDominatorTree &MDT,
UserValueScopes &UVS);
/// addDefsFromCopies - The value in LI/LocNo may be copies to other
/// registers. Determine if any of the copies are available at the kill
/// points, and add defs if possible.
/// @param LI Scan for copies of the value in LI->reg.
/// @param LocNo Location number of LI->reg.
/// @param Kills Points where the range of LocNo could be extended.
/// @param NewDefs Append (Idx, LocNo) of inserted defs here.
void addDefsFromCopies(LiveInterval *LI, unsigned LocNo,
const SmallVectorImpl<SlotIndex> &Kills,
SmallVectorImpl<std::pair<SlotIndex, unsigned> > &NewDefs,
MachineRegisterInfo &MRI,
LiveIntervals &LIS);
/// computeIntervals - Compute the live intervals of all locations after
/// collecting all their def points.
void computeIntervals(MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI,
LiveIntervals &LIS, MachineDominatorTree &MDT,
UserValueScopes &UVS);
/// splitRegister - Replace OldReg ranges with NewRegs ranges where NewRegs is
/// live. Returns true if any changes were made.
bool splitRegister(unsigned OldLocNo, ArrayRef<unsigned> NewRegs,
LiveIntervals &LIS);
/// rewriteLocations - Rewrite virtual register locations according to the
/// provided virtual register map.
void rewriteLocations(VirtRegMap &VRM, const TargetRegisterInfo &TRI);
/// emitDebugValues - Recreate DBG_VALUE instruction from data structures.
void emitDebugValues(VirtRegMap *VRM,
LiveIntervals &LIS, const TargetInstrInfo &TRI);
/// getDebugLoc - Return DebugLoc of this UserValue.
DebugLoc getDebugLoc() { return dl;}
void print(raw_ostream &, const TargetRegisterInfo *);
};
} // namespace
/// LDVImpl - Implementation of the LiveDebugVariables pass.
namespace {
class LDVImpl {
LiveDebugVariables &pass;
LocMap::Allocator allocator;
MachineFunction *MF;
LiveIntervals *LIS;
LexicalScopes LS;
MachineDominatorTree *MDT;
const TargetRegisterInfo *TRI;
/// Whether emitDebugValues is called.
bool EmitDone;
/// Whether the machine function is modified during the pass.
bool ModifiedMF;
/// userValues - All allocated UserValue instances.
SmallVector<std::unique_ptr<UserValue>, 8> userValues;
/// Map virtual register to eq class leader.
typedef DenseMap<unsigned, UserValue*> VRMap;
VRMap virtRegToEqClass;
/// Map user variable to eq class leader.
typedef DenseMap<const MDNode *, UserValue*> UVMap;
UVMap userVarMap;
/// getUserValue - Find or create a UserValue.
UserValue *getUserValue(const MDNode *Var, const MDNode *Expr,
unsigned Offset, bool IsIndirect, const DebugLoc &DL);
/// lookupVirtReg - Find the EC leader for VirtReg or null.
UserValue *lookupVirtReg(unsigned VirtReg);
/// handleDebugValue - Add DBG_VALUE instruction to our maps.
/// @param MI DBG_VALUE instruction
/// @param Idx Last valid SLotIndex before instruction.
/// @return True if the DBG_VALUE instruction should be deleted.
bool handleDebugValue(MachineInstr &MI, SlotIndex Idx);
/// collectDebugValues - Collect and erase all DBG_VALUE instructions, adding
/// a UserValue def for each instruction.
/// @param mf MachineFunction to be scanned.
/// @return True if any debug values were found.
bool collectDebugValues(MachineFunction &mf);
/// computeIntervals - Compute the live intervals of all user values after
/// collecting all their def points.
void computeIntervals();
public:
LDVImpl(LiveDebugVariables *ps)
: pass(*ps), MF(nullptr), EmitDone(false), ModifiedMF(false) {}
bool runOnMachineFunction(MachineFunction &mf);
/// clear - Release all memory.
void clear() {
MF = nullptr;
userValues.clear();
virtRegToEqClass.clear();
userVarMap.clear();
// Make sure we call emitDebugValues if the machine function was modified.
assert((!ModifiedMF || EmitDone) &&
"Dbg values are not emitted in LDV");
EmitDone = false;
ModifiedMF = false;
LS.reset();
}
/// mapVirtReg - Map virtual register to an equivalence class.
void mapVirtReg(unsigned VirtReg, UserValue *EC);
/// splitRegister - Replace all references to OldReg with NewRegs.
void splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs);
/// emitDebugValues - Recreate DBG_VALUE instruction from data structures.
void emitDebugValues(VirtRegMap *VRM);
void print(raw_ostream&);
};
} // namespace
static void printDebugLoc(const DebugLoc &DL, raw_ostream &CommentOS,
const LLVMContext &Ctx) {
if (!DL)
return;
auto *Scope = cast<DIScope>(DL.getScope());
// Omit the directory, because it's likely to be long and uninteresting.
CommentOS << Scope->getFilename();
CommentOS << ':' << DL.getLine();
if (DL.getCol() != 0)
CommentOS << ':' << DL.getCol();
DebugLoc InlinedAtDL = DL.getInlinedAt();
if (!InlinedAtDL)
return;
CommentOS << " @[ ";
printDebugLoc(InlinedAtDL, CommentOS, Ctx);
CommentOS << " ]";
}
static void printExtendedName(raw_ostream &OS, const DILocalVariable *V,
const DILocation *DL) {
const LLVMContext &Ctx = V->getContext();
StringRef Res = V->getName();
if (!Res.empty())
OS << Res << "," << V->getLine();
if (auto *InlinedAt = DL->getInlinedAt()) {
if (DebugLoc InlinedAtDL = InlinedAt) {
OS << " @[";
printDebugLoc(InlinedAtDL, OS, Ctx);
OS << "]";
}
}
}
void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) {
auto *DV = cast<DILocalVariable>(Variable);
OS << "!\"";
printExtendedName(OS, DV, dl);
OS << "\"\t";
if (offset)
OS << '+' << offset;
for (LocMap::const_iterator I = locInts.begin(); I.valid(); ++I) {
OS << " [" << I.start() << ';' << I.stop() << "):";
if (I.value() == ~0u)
OS << "undef";
else
OS << I.value();
}
for (unsigned i = 0, e = locations.size(); i != e; ++i) {
OS << " Loc" << i << '=';
locations[i].print(OS, TRI);
}
OS << '\n';
}
void LDVImpl::print(raw_ostream &OS) {
OS << "********** DEBUG VARIABLES **********\n";
for (unsigned i = 0, e = userValues.size(); i != e; ++i)
userValues[i]->print(OS, TRI);
}
void UserValue::coalesceLocation(unsigned LocNo) {
unsigned KeepLoc = 0;
for (unsigned e = locations.size(); KeepLoc != e; ++KeepLoc) {
if (KeepLoc == LocNo)
continue;
if (locations[KeepLoc].isIdenticalTo(locations[LocNo]))
break;
}
// No matches.
if (KeepLoc == locations.size())
return;
// Keep the smaller location, erase the larger one.
unsigned EraseLoc = LocNo;
if (KeepLoc > EraseLoc)
std::swap(KeepLoc, EraseLoc);
locations.erase(locations.begin() + EraseLoc);
// Rewrite values.
for (LocMap::iterator I = locInts.begin(); I.valid(); ++I) {
unsigned v = I.value();
if (v == EraseLoc)
I.setValue(KeepLoc); // Coalesce when possible.
else if (v > EraseLoc)
I.setValueUnchecked(v-1); // Avoid coalescing with untransformed values.
}
}
void UserValue::mapVirtRegs(LDVImpl *LDV) {
for (unsigned i = 0, e = locations.size(); i != e; ++i)
if (locations[i].isReg() &&
TargetRegisterInfo::isVirtualRegister(locations[i].getReg()))
LDV->mapVirtReg(locations[i].getReg(), this);
}
UserValue *LDVImpl::getUserValue(const MDNode *Var, const MDNode *Expr,
unsigned Offset, bool IsIndirect,
const DebugLoc &DL) {
UserValue *&Leader = userVarMap[Var];
if (Leader) {
UserValue *UV = Leader->getLeader();
Leader = UV;
for (; UV; UV = UV->getNext())
if (UV->match(Var, Expr, DL->getInlinedAt(), Offset, IsIndirect))
return UV;
}
userValues.push_back(
make_unique<UserValue>(Var, Expr, Offset, IsIndirect, DL, allocator));
UserValue *UV = userValues.back().get();
Leader = UserValue::merge(Leader, UV);
return UV;
}
void LDVImpl::mapVirtReg(unsigned VirtReg, UserValue *EC) {
assert(TargetRegisterInfo::isVirtualRegister(VirtReg) && "Only map VirtRegs");
UserValue *&Leader = virtRegToEqClass[VirtReg];
Leader = UserValue::merge(Leader, EC);
}
UserValue *LDVImpl::lookupVirtReg(unsigned VirtReg) {
if (UserValue *UV = virtRegToEqClass.lookup(VirtReg))
return UV->getLeader();
return nullptr;
}
bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) {
// DBG_VALUE loc, offset, variable
if (MI.getNumOperands() != 4 ||
!(MI.getOperand(1).isReg() || MI.getOperand(1).isImm()) ||
!MI.getOperand(2).isMetadata()) {
DEBUG(dbgs() << "Can't handle " << MI);
return false;
}
// Get or create the UserValue for (variable,offset).
bool IsIndirect = MI.isIndirectDebugValue();
unsigned Offset = IsIndirect ? MI.getOperand(1).getImm() : 0;
const MDNode *Var = MI.getDebugVariable();
const MDNode *Expr = MI.getDebugExpression();
//here.
UserValue *UV = getUserValue(Var, Expr, Offset, IsIndirect, MI.getDebugLoc());
UV->addDef(Idx, MI.getOperand(0));
return true;
}
bool LDVImpl::collectDebugValues(MachineFunction &mf) {
bool Changed = false;
for (MachineFunction::iterator MFI = mf.begin(), MFE = mf.end(); MFI != MFE;
++MFI) {
MachineBasicBlock *MBB = &*MFI;
for (MachineBasicBlock::iterator MBBI = MBB->begin(), MBBE = MBB->end();
MBBI != MBBE;) {
if (!MBBI->isDebugValue()) {
++MBBI;
continue;
}
// DBG_VALUE has no slot index, use the previous instruction instead.
SlotIndex Idx =
MBBI == MBB->begin()
? LIS->getMBBStartIdx(MBB)
: LIS->getInstructionIndex(*std::prev(MBBI)).getRegSlot();
// Handle consecutive DBG_VALUE instructions with the same slot index.
do {
if (handleDebugValue(*MBBI, Idx)) {
MBBI = MBB->erase(MBBI);
Changed = true;
} else
++MBBI;
} while (MBBI != MBBE && MBBI->isDebugValue());
}
}
return Changed;
}
/// We only propagate DBG_VALUES locally here. LiveDebugValues performs a
/// data-flow analysis to propagate them beyond basic block boundaries.
void UserValue::extendDef(SlotIndex Idx, unsigned LocNo, LiveRange *LR,
const VNInfo *VNI, SmallVectorImpl<SlotIndex> *Kills,
LiveIntervals &LIS, MachineDominatorTree &MDT,
UserValueScopes &UVS) {
SlotIndex Start = Idx;
MachineBasicBlock *MBB = LIS.getMBBFromIndex(Start);
SlotIndex Stop = LIS.getMBBEndIdx(MBB);
LocMap::iterator I = locInts.find(Start);
// Limit to VNI's live range.
bool ToEnd = true;
if (LR && VNI) {
LiveInterval::Segment *Segment = LR->getSegmentContaining(Start);
if (!Segment || Segment->valno != VNI) {
if (Kills)
Kills->push_back(Start);
return;
}
if (Segment->end < Stop) {
Stop = Segment->end;
ToEnd = false;
}
}
// There could already be a short def at Start.
if (I.valid() && I.start() <= Start) {
// Stop when meeting a different location or an already extended interval.
Start = Start.getNextSlot();
if (I.value() != LocNo || I.stop() != Start)
return;
// This is a one-slot placeholder. Just skip it.
++I;
}
// Limited by the next def.
if (I.valid() && I.start() < Stop) {
Stop = I.start();
ToEnd = false;
}
// Limited by VNI's live range.
else if (!ToEnd && Kills)
Kills->push_back(Stop);
if (Start < Stop)
I.insert(Start, Stop, LocNo);
}
void
UserValue::addDefsFromCopies(LiveInterval *LI, unsigned LocNo,
const SmallVectorImpl<SlotIndex> &Kills,
SmallVectorImpl<std::pair<SlotIndex, unsigned> > &NewDefs,
MachineRegisterInfo &MRI, LiveIntervals &LIS) {
if (Kills.empty())
return;
// Don't track copies from physregs, there are too many uses.
if (!TargetRegisterInfo::isVirtualRegister(LI->reg))
return;
// Collect all the (vreg, valno) pairs that are copies of LI.
SmallVector<std::pair<LiveInterval*, const VNInfo*>, 8> CopyValues;
for (MachineOperand &MO : MRI.use_nodbg_operands(LI->reg)) {
MachineInstr *MI = MO.getParent();
// Copies of the full value.
if (MO.getSubReg() || !MI->isCopy())
continue;
unsigned DstReg = MI->getOperand(0).getReg();
// Don't follow copies to physregs. These are usually setting up call
// arguments, and the argument registers are always call clobbered. We are
// better off in the source register which could be a callee-saved register,
// or it could be spilled.
if (!TargetRegisterInfo::isVirtualRegister(DstReg))
continue;
// Is LocNo extended to reach this copy? If not, another def may be blocking
// it, or we are looking at a wrong value of LI.
SlotIndex Idx = LIS.getInstructionIndex(*MI);
LocMap::iterator I = locInts.find(Idx.getRegSlot(true));
if (!I.valid() || I.value() != LocNo)
continue;
if (!LIS.hasInterval(DstReg))
continue;
LiveInterval *DstLI = &LIS.getInterval(DstReg);
const VNInfo *DstVNI = DstLI->getVNInfoAt(Idx.getRegSlot());
assert(DstVNI && DstVNI->def == Idx.getRegSlot() && "Bad copy value");
CopyValues.push_back(std::make_pair(DstLI, DstVNI));
}
if (CopyValues.empty())
return;
DEBUG(dbgs() << "Got " << CopyValues.size() << " copies of " << *LI << '\n');
// Try to add defs of the copied values for each kill point.
for (unsigned i = 0, e = Kills.size(); i != e; ++i) {
SlotIndex Idx = Kills[i];
for (unsigned j = 0, e = CopyValues.size(); j != e; ++j) {
LiveInterval *DstLI = CopyValues[j].first;
const VNInfo *DstVNI = CopyValues[j].second;
if (DstLI->getVNInfoAt(Idx) != DstVNI)
continue;
// Check that there isn't already a def at Idx
LocMap::iterator I = locInts.find(Idx);
if (I.valid() && I.start() <= Idx)
continue;
DEBUG(dbgs() << "Kill at " << Idx << " covered by valno #"
<< DstVNI->id << " in " << *DstLI << '\n');
MachineInstr *CopyMI = LIS.getInstructionFromIndex(DstVNI->def);
assert(CopyMI && CopyMI->isCopy() && "Bad copy value");
unsigned LocNo = getLocationNo(CopyMI->getOperand(0));
I.insert(Idx, Idx.getNextSlot(), LocNo);
NewDefs.push_back(std::make_pair(Idx, LocNo));
break;
}
}
}
void
UserValue::computeIntervals(MachineRegisterInfo &MRI,
const TargetRegisterInfo &TRI,
LiveIntervals &LIS,
MachineDominatorTree &MDT,
UserValueScopes &UVS) {
SmallVector<std::pair<SlotIndex, unsigned>, 16> Defs;
// Collect all defs to be extended (Skipping undefs).
for (LocMap::const_iterator I = locInts.begin(); I.valid(); ++I)
if (I.value() != ~0u)
Defs.push_back(std::make_pair(I.start(), I.value()));
// Extend all defs, and possibly add new ones along the way.
for (unsigned i = 0; i != Defs.size(); ++i) {
SlotIndex Idx = Defs[i].first;
unsigned LocNo = Defs[i].second;
const MachineOperand &Loc = locations[LocNo];
if (!Loc.isReg()) {
extendDef(Idx, LocNo, nullptr, nullptr, nullptr, LIS, MDT, UVS);
continue;
}
// Register locations are constrained to where the register value is live.
if (TargetRegisterInfo::isVirtualRegister(Loc.getReg())) {
LiveInterval *LI = nullptr;
const VNInfo *VNI = nullptr;
if (LIS.hasInterval(Loc.getReg())) {
LI = &LIS.getInterval(Loc.getReg());
VNI = LI->getVNInfoAt(Idx);
}
SmallVector<SlotIndex, 16> Kills;
extendDef(Idx, LocNo, LI, VNI, &Kills, LIS, MDT, UVS);
if (LI)
addDefsFromCopies(LI, LocNo, Kills, Defs, MRI, LIS);
continue;
}
// For physregs, use the live range of the first regunit as a guide.
unsigned Unit = *MCRegUnitIterator(Loc.getReg(), &TRI);
LiveRange *LR = &LIS.getRegUnit(Unit);
const VNInfo *VNI = LR->getVNInfoAt(Idx);
// Don't track copies from physregs, it is too expensive.
extendDef(Idx, LocNo, LR, VNI, nullptr, LIS, MDT, UVS);
}
// Finally, erase all the undefs.
for (LocMap::iterator I = locInts.begin(); I.valid();)
if (I.value() == ~0u)
I.erase();
else
++I;
}
void LDVImpl::computeIntervals() {
for (unsigned i = 0, e = userValues.size(); i != e; ++i) {
UserValueScopes UVS(userValues[i]->getDebugLoc(), LS);
userValues[i]->computeIntervals(MF->getRegInfo(), *TRI, *LIS, *MDT, UVS);
userValues[i]->mapVirtRegs(this);
}
}
bool LDVImpl::runOnMachineFunction(MachineFunction &mf) {
clear();
MF = &mf;
LIS = &pass.getAnalysis<LiveIntervals>();
MDT = &pass.getAnalysis<MachineDominatorTree>();
TRI = mf.getSubtarget().getRegisterInfo();
LS.initialize(mf);
DEBUG(dbgs() << "********** COMPUTING LIVE DEBUG VARIABLES: "
<< mf.getName() << " **********\n");
bool Changed = collectDebugValues(mf);
computeIntervals();
DEBUG(print(dbgs()));
ModifiedMF = Changed;
return Changed;
}
static void removeDebugValues(MachineFunction &mf) {
for (MachineBasicBlock &MBB : mf) {
for (auto MBBI = MBB.begin(), MBBE = MBB.end(); MBBI != MBBE; ) {
if (!MBBI->isDebugValue()) {
++MBBI;
continue;
}
MBBI = MBB.erase(MBBI);
}
}
}
bool LiveDebugVariables::runOnMachineFunction(MachineFunction &mf) {
if (!EnableLDV)
return false;
if (!mf.getFunction()->getSubprogram()) {
removeDebugValues(mf);
return false;
}
if (!pImpl)
pImpl = new LDVImpl(this);
return static_cast<LDVImpl*>(pImpl)->runOnMachineFunction(mf);
}
void LiveDebugVariables::releaseMemory() {
if (pImpl)
static_cast<LDVImpl*>(pImpl)->clear();
}
LiveDebugVariables::~LiveDebugVariables() {
if (pImpl)
delete static_cast<LDVImpl*>(pImpl);
}
//===----------------------------------------------------------------------===//
// Live Range Splitting
//===----------------------------------------------------------------------===//
bool
UserValue::splitLocation(unsigned OldLocNo, ArrayRef<unsigned> NewRegs,
LiveIntervals& LIS) {
DEBUG({
dbgs() << "Splitting Loc" << OldLocNo << '\t';
print(dbgs(), nullptr);
});
bool DidChange = false;
LocMap::iterator LocMapI;
LocMapI.setMap(locInts);
for (unsigned i = 0; i != NewRegs.size(); ++i) {
LiveInterval *LI = &LIS.getInterval(NewRegs[i]);
if (LI->empty())
continue;
// Don't allocate the new LocNo until it is needed.
unsigned NewLocNo = ~0u;
// Iterate over the overlaps between locInts and LI.
LocMapI.find(LI->beginIndex());
if (!LocMapI.valid())
continue;
LiveInterval::iterator LII = LI->advanceTo(LI->begin(), LocMapI.start());
LiveInterval::iterator LIE = LI->end();
while (LocMapI.valid() && LII != LIE) {
// At this point, we know that LocMapI.stop() > LII->start.
LII = LI->advanceTo(LII, LocMapI.start());
if (LII == LIE)
break;
// Now LII->end > LocMapI.start(). Do we have an overlap?
if (LocMapI.value() == OldLocNo && LII->start < LocMapI.stop()) {
// Overlapping correct location. Allocate NewLocNo now.
if (NewLocNo == ~0u) {
MachineOperand MO = MachineOperand::CreateReg(LI->reg, false);
MO.setSubReg(locations[OldLocNo].getSubReg());
NewLocNo = getLocationNo(MO);
DidChange = true;
}
SlotIndex LStart = LocMapI.start();
SlotIndex LStop = LocMapI.stop();
// Trim LocMapI down to the LII overlap.
if (LStart < LII->start)
LocMapI.setStartUnchecked(LII->start);
if (LStop > LII->end)
LocMapI.setStopUnchecked(LII->end);
// Change the value in the overlap. This may trigger coalescing.
LocMapI.setValue(NewLocNo);
// Re-insert any removed OldLocNo ranges.
if (LStart < LocMapI.start()) {
LocMapI.insert(LStart, LocMapI.start(), OldLocNo);
++LocMapI;
assert(LocMapI.valid() && "Unexpected coalescing");
}
if (LStop > LocMapI.stop()) {
++LocMapI;
LocMapI.insert(LII->end, LStop, OldLocNo);
--LocMapI;
}
}
// Advance to the next overlap.
if (LII->end < LocMapI.stop()) {
if (++LII == LIE)
break;
LocMapI.advanceTo(LII->start);
} else {
++LocMapI;
if (!LocMapI.valid())
break;
LII = LI->advanceTo(LII, LocMapI.start());
}
}
}
// Finally, remove any remaining OldLocNo intervals and OldLocNo itself.
locations.erase(locations.begin() + OldLocNo);
LocMapI.goToBegin();
while (LocMapI.valid()) {
unsigned v = LocMapI.value();
if (v == OldLocNo) {
DEBUG(dbgs() << "Erasing [" << LocMapI.start() << ';'
<< LocMapI.stop() << ")\n");
LocMapI.erase();
} else {
if (v > OldLocNo)
LocMapI.setValueUnchecked(v-1);
++LocMapI;
}
}
DEBUG({dbgs() << "Split result: \t"; print(dbgs(), nullptr);});
return DidChange;
}
bool
UserValue::splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs,
LiveIntervals &LIS) {
bool DidChange = false;
// Split locations referring to OldReg. Iterate backwards so splitLocation can
// safely erase unused locations.
for (unsigned i = locations.size(); i ; --i) {
unsigned LocNo = i-1;
const MachineOperand *Loc = &locations[LocNo];
if (!Loc->isReg() || Loc->getReg() != OldReg)
continue;
DidChange |= splitLocation(LocNo, NewRegs, LIS);
}
return DidChange;
}
void LDVImpl::splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs) {
bool DidChange = false;
for (UserValue *UV = lookupVirtReg(OldReg); UV; UV = UV->getNext())
DidChange |= UV->splitRegister(OldReg, NewRegs, *LIS);
if (!DidChange)
return;
// Map all of the new virtual registers.
UserValue *UV = lookupVirtReg(OldReg);
for (unsigned i = 0; i != NewRegs.size(); ++i)
mapVirtReg(NewRegs[i], UV);
}
void LiveDebugVariables::
splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs, LiveIntervals &LIS) {
if (pImpl)
static_cast<LDVImpl*>(pImpl)->splitRegister(OldReg, NewRegs);
}
void
UserValue::rewriteLocations(VirtRegMap &VRM, const TargetRegisterInfo &TRI) {
// Iterate over locations in reverse makes it easier to handle coalescing.
for (unsigned i = locations.size(); i ; --i) {
unsigned LocNo = i-1;
MachineOperand &Loc = locations[LocNo];
// Only virtual registers are rewritten.
if (!Loc.isReg() || !Loc.getReg() ||
!TargetRegisterInfo::isVirtualRegister(Loc.getReg()))
continue;
unsigned VirtReg = Loc.getReg();
if (VRM.isAssignedReg(VirtReg) &&
TargetRegisterInfo::isPhysicalRegister(VRM.getPhys(VirtReg))) {
// This can create a %noreg operand in rare cases when the sub-register
// index is no longer available. That means the user value is in a
// non-existent sub-register, and %noreg is exactly what we want.
Loc.substPhysReg(VRM.getPhys(VirtReg), TRI);
} else if (VRM.getStackSlot(VirtReg) != VirtRegMap::NO_STACK_SLOT) {
// FIXME: Translate SubIdx to a stackslot offset.
Loc = MachineOperand::CreateFI(VRM.getStackSlot(VirtReg));
} else {
Loc.setReg(0);
Loc.setSubReg(0);
}
coalesceLocation(LocNo);
}
}
/// findInsertLocation - Find an iterator for inserting a DBG_VALUE
/// instruction.
static MachineBasicBlock::iterator
findInsertLocation(MachineBasicBlock *MBB, SlotIndex Idx,
LiveIntervals &LIS) {
SlotIndex Start = LIS.getMBBStartIdx(MBB);
Idx = Idx.getBaseIndex();
// Try to find an insert location by going backwards from Idx.
MachineInstr *MI;
while (!(MI = LIS.getInstructionFromIndex(Idx))) {
// We've reached the beginning of MBB.
if (Idx == Start) {
MachineBasicBlock::iterator I = MBB->SkipPHIsAndLabels(MBB->begin());
return I;
}
Idx = Idx.getPrevIndex();
}
// Don't insert anything after the first terminator, though.
return MI->isTerminator() ? MBB->getFirstTerminator() :
std::next(MachineBasicBlock::iterator(MI));
}
void UserValue::insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx,
unsigned LocNo,
LiveIntervals &LIS,
const TargetInstrInfo &TII) {
MachineBasicBlock::iterator I = findInsertLocation(MBB, Idx, LIS);
MachineOperand &Loc = locations[LocNo];
++NumInsertedDebugValues;
assert(cast<DILocalVariable>(Variable)
->isValidLocationForIntrinsic(getDebugLoc()) &&
"Expected inlined-at fields to agree");
if (Loc.isReg())
BuildMI(*MBB, I, getDebugLoc(), TII.get(TargetOpcode::DBG_VALUE),
IsIndirect, Loc.getReg(), offset, Variable, Expression);
else
BuildMI(*MBB, I, getDebugLoc(), TII.get(TargetOpcode::DBG_VALUE))
.addOperand(Loc)
.addImm(offset)
.addMetadata(Variable)
.addMetadata(Expression);
}
void UserValue::emitDebugValues(VirtRegMap *VRM, LiveIntervals &LIS,
const TargetInstrInfo &TII) {
MachineFunction::iterator MFEnd = VRM->getMachineFunction().end();
for (LocMap::const_iterator I = locInts.begin(); I.valid();) {
SlotIndex Start = I.start();
SlotIndex Stop = I.stop();
unsigned LocNo = I.value();
DEBUG(dbgs() << "\t[" << Start << ';' << Stop << "):" << LocNo);
MachineFunction::iterator MBB = LIS.getMBBFromIndex(Start)->getIterator();
SlotIndex MBBEnd = LIS.getMBBEndIdx(&*MBB);
DEBUG(dbgs() << " BB#" << MBB->getNumber() << '-' << MBBEnd);
insertDebugValue(&*MBB, Start, LocNo, LIS, TII);
// This interval may span multiple basic blocks.
// Insert a DBG_VALUE into each one.
while(Stop > MBBEnd) {
// Move to the next block.
Start = MBBEnd;
if (++MBB == MFEnd)
break;
MBBEnd = LIS.getMBBEndIdx(&*MBB);
DEBUG(dbgs() << " BB#" << MBB->getNumber() << '-' << MBBEnd);
insertDebugValue(&*MBB, Start, LocNo, LIS, TII);
}
DEBUG(dbgs() << '\n');
if (MBB == MFEnd)
break;
++I;
}
}
void LDVImpl::emitDebugValues(VirtRegMap *VRM) {
DEBUG(dbgs() << "********** EMITTING LIVE DEBUG VARIABLES **********\n");
if (!MF)
return;
const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo();
for (unsigned i = 0, e = userValues.size(); i != e; ++i) {
DEBUG(userValues[i]->print(dbgs(), TRI));
userValues[i]->rewriteLocations(*VRM, *TRI);
userValues[i]->emitDebugValues(VRM, *LIS, *TII);
}
EmitDone = true;
}
void LiveDebugVariables::emitDebugValues(VirtRegMap *VRM) {
if (pImpl)
static_cast<LDVImpl*>(pImpl)->emitDebugValues(VRM);
}
bool LiveDebugVariables::doInitialization(Module &M) {
return Pass::doInitialization(M);
}
#ifndef NDEBUG
LLVM_DUMP_METHOD void LiveDebugVariables::dump() {
if (pImpl)
static_cast<LDVImpl*>(pImpl)->print(dbgs());
}
#endif
| cd80/UtilizedLLVM | lib/CodeGen/LiveDebugVariables.cpp | C++ | unlicense | 36,643 | [
30522,
1013,
1013,
1027,
1027,
1027,
1011,
2973,
15878,
15916,
10755,
19210,
2015,
1012,
18133,
2361,
1011,
9651,
2139,
8569,
2290,
18558,
10857,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1027,
1027,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
showWord(["v. ","korije, redrese."
]) | georgejhunt/HaitiDictionary.activity | data/words/rektifye.js | JavaScript | gpl-2.0 | 37 | [
30522,
2265,
18351,
1006,
1031,
1000,
1058,
1012,
1000,
1010,
1000,
12849,
3089,
6460,
1010,
2417,
6072,
2063,
1012,
1000,
1033,
1007,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# Makefile for the i2c bus drivers.
#
obj-$(CONFIG_I2C_BCM2708) += i2c-bcm2708.o
# ACPI drivers
obj-$(CONFIG_I2C_SCMI) += i2c-scmi.o
# PC SMBus host controller drivers
obj-$(CONFIG_I2C_ALI1535) += i2c-ali1535.o
obj-$(CONFIG_I2C_ALI1563) += i2c-ali1563.o
obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o
obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o
obj-$(CONFIG_I2C_AMD756_S4882) += i2c-amd756-s4882.o
obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o
obj-$(CONFIG_I2C_I801) += i2c-i801.o
obj-$(CONFIG_I2C_ISCH) += i2c-isch.o
obj-$(CONFIG_I2C_ISMT) += i2c-ismt.o
obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o
obj-$(CONFIG_I2C_NFORCE2_S4985) += i2c-nforce2-s4985.o
obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o
obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o
obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o
obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o
obj-$(CONFIG_I2C_VIA) += i2c-via.o
obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o
# Mac SMBus host controller drivers
obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o
obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o
# Embedded system I2C/SMBus host controller drivers
obj-$(CONFIG_I2C_AT91) += i2c-at91.o
obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o
obj-$(CONFIG_I2C_AXXIA) += i2c-axxia.o
obj-$(CONFIG_I2C_BCM2835) += i2c-bcm2835.o
obj-$(CONFIG_I2C_BCM_IPROC) += i2c-bcm-iproc.o
obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o
obj-$(CONFIG_I2C_CADENCE) += i2c-cadence.o
obj-$(CONFIG_I2C_CBUS_GPIO) += i2c-cbus-gpio.o
obj-$(CONFIG_I2C_CPM) += i2c-cpm.o
obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o
obj-$(CONFIG_I2C_DESIGNWARE_CORE) += i2c-designware-core.o
obj-$(CONFIG_I2C_DESIGNWARE_PLATFORM) += i2c-designware-platform.o
i2c-designware-platform-objs := i2c-designware-platdrv.o
i2c-designware-platform-$(CONFIG_I2C_DESIGNWARE_BAYTRAIL) += i2c-designware-baytrail.o
obj-$(CONFIG_I2C_DESIGNWARE_PCI) += i2c-designware-pci.o
i2c-designware-pci-objs := i2c-designware-pcidrv.o
obj-$(CONFIG_I2C_DIGICOLOR) += i2c-digicolor.o
obj-$(CONFIG_I2C_EFM32) += i2c-efm32.o
obj-$(CONFIG_I2C_EG20T) += i2c-eg20t.o
obj-$(CONFIG_I2C_EXYNOS5) += i2c-exynos5.o
obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o
obj-$(CONFIG_I2C_HIGHLANDER) += i2c-highlander.o
obj-$(CONFIG_I2C_HIX5HD2) += i2c-hix5hd2.o
obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o
obj-$(CONFIG_I2C_IMG) += i2c-img-scb.o
obj-$(CONFIG_I2C_IMX) += i2c-imx.o
obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o
obj-$(CONFIG_I2C_JZ4780) += i2c-jz4780.o
obj-$(CONFIG_I2C_KEMPLD) += i2c-kempld.o
obj-$(CONFIG_I2C_MESON) += i2c-meson.o
obj-$(CONFIG_I2C_MPC) += i2c-mpc.o
obj-$(CONFIG_I2C_MT65XX) += i2c-mt65xx.o
obj-$(CONFIG_I2C_MV64XXX) += i2c-mv64xxx.o
obj-$(CONFIG_I2C_MXS) += i2c-mxs.o
obj-$(CONFIG_I2C_NOMADIK) += i2c-nomadik.o
obj-$(CONFIG_I2C_OCORES) += i2c-ocores.o
obj-$(CONFIG_I2C_OMAP) += i2c-omap.o
obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi.o
obj-$(CONFIG_I2C_PCA_PLATFORM) += i2c-pca-platform.o
obj-$(CONFIG_I2C_PMCMSP) += i2c-pmcmsp.o
obj-$(CONFIG_I2C_PNX) += i2c-pnx.o
obj-$(CONFIG_I2C_PUV3) += i2c-puv3.o
obj-$(CONFIG_I2C_PXA) += i2c-pxa.o
obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o
obj-$(CONFIG_I2C_QUP) += i2c-qup.o
obj-$(CONFIG_I2C_RIIC) += i2c-riic.o
obj-$(CONFIG_I2C_RK3X) += i2c-rk3x.o
obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o
obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o
obj-$(CONFIG_I2C_SH_MOBILE) += i2c-sh_mobile.o
obj-$(CONFIG_I2C_SIMTEC) += i2c-simtec.o
obj-$(CONFIG_I2C_SIRF) += i2c-sirf.o
obj-$(CONFIG_I2C_ST) += i2c-st.o
obj-$(CONFIG_I2C_STU300) += i2c-stu300.o
obj-$(CONFIG_I2C_SUN6I_P2WI) += i2c-sun6i-p2wi.o
obj-$(CONFIG_I2C_TEGRA) += i2c-tegra.o
obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
obj-$(CONFIG_I2C_WMT) += i2c-wmt.o
obj-$(CONFIG_I2C_OCTEON) += i2c-octeon.o
obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o
obj-$(CONFIG_I2C_XLR) += i2c-xlr.o
obj-$(CONFIG_I2C_XLP9XX) += i2c-xlp9xx.o
obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o
# External I2C/SMBus adapter drivers
obj-$(CONFIG_I2C_DIOLAN_U2C) += i2c-diolan-u2c.o
obj-$(CONFIG_I2C_DLN2) += i2c-dln2.o
obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o
obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o
obj-$(CONFIG_I2C_ROBOTFUZZ_OSIF) += i2c-robotfuzz-osif.o
obj-$(CONFIG_I2C_TAOS_EVM) += i2c-taos-evm.o
obj-$(CONFIG_I2C_TINY_USB) += i2c-tiny-usb.o
obj-$(CONFIG_I2C_VIPERBOARD) += i2c-viperboard.o
# Other I2C/SMBus bus drivers
obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o
obj-$(CONFIG_I2C_BCM_KONA) += i2c-bcm-kona.o
obj-$(CONFIG_I2C_BRCMSTB) += i2c-brcmstb.o
obj-$(CONFIG_I2C_CROS_EC_TUNNEL) += i2c-cros-ec-tunnel.o
obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o
obj-$(CONFIG_I2C_OPAL) += i2c-opal.o
obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o
obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o
obj-$(CONFIG_I2C_XGENE_SLIMPRO) += i2c-xgene-slimpro.o
obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
ccflags-$(CONFIG_I2C_DEBUG_BUS) := -DDEBUG
| RaspberryPi-CM/android_kernel_raspberry_pi2 | drivers/i2c/busses/Makefile | Makefile | gpl-2.0 | 4,726 | [
30522,
1001,
1001,
2191,
8873,
2571,
2005,
1996,
1045,
2475,
2278,
3902,
6853,
1012,
1001,
27885,
3501,
1011,
1002,
1006,
9530,
8873,
2290,
1035,
1045,
2475,
2278,
1035,
4647,
2213,
22907,
2692,
2620,
1007,
1009,
1027,
1045,
2475,
2278,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*! jQuery UI - v1.10.3 - 2013-09-04
* http://jqueryui.com
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
jQuery(function(t){t.datepicker.regional.da={closeText:"Luk",prevText:"<Forrige",nextText:"Næste>",currentText:"Idag",monthNames:["Januar","Februar","Marts","April","Maj","Juni","Juli","August","September","Oktober","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],dayNames:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],dayNamesShort:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],dayNamesMin:["Sø","Ma","Ti","On","To","Fr","Lø"],weekHeader:"Uge",dateFormat:"dd-mm-yy",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},t.datepicker.setDefaults(t.datepicker.regional.da)}); | jamiepg1/rearview-engine | public/rearview-src/vendor/jquery/plugins/jquery-ui/development-bundle/ui/minified/i18n/jquery.ui.datepicker-da.min.js | JavaScript | mit | 813 | [
30522,
1013,
1008,
999,
1046,
4226,
2854,
21318,
1011,
1058,
2487,
1012,
2184,
1012,
1017,
1011,
2286,
1011,
5641,
1011,
5840,
1008,
8299,
1024,
1013,
1013,
1046,
4226,
30524,
3058,
24330,
5484,
1012,
3164,
1012,
4830,
1027,
1063,
9346,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
define(function(require) {
var QuestionView = require('coreViews/questionView');
var Adapt = require('coreJS/adapt');
var Slider = QuestionView.extend({
events: {
'click .slider-sliderange': 'onSliderSelected',
'click .slider-handle': 'preventEvent',
'click .slider-scale-number': 'onNumberSelected',
'touchstart .slider-handle':'onHandlePressed',
'mousedown .slider-handle': 'onHandlePressed',
'focus .slider-handle':'onHandleFocus',
'blur .slider-handle':'onHandleBlur'
},
// Used by the question to reset the question when revisiting the component
resetQuestionOnRevisit: function() {
this.setAllItemsEnabled(true);
this.deselectAllItems();
this.resetQuestion();
},
// Used by question to setup itself just before rendering
setupQuestion: function() {
if(!this.model.get('_items')) {
this.setupModelItems();
}
this.model.set({
_selectedItem: {}
});
this.restoreUserAnswers();
if (this.model.get('_isSubmitted')) return;
this.selectItem(0);
},
setupModelItems: function() {
var items = [];
var answer = this.model.get('_correctAnswer');
var range = this.model.get('_correctRange');
var start = this.model.get('_scaleStart');
var end = this.model.get('_scaleEnd');
for (var i = start; i <= end; i++) {
if (answer) {
items.push({value: i, selected: false, correct: (i == answer)});
} else {
items.push({value: i, selected: false, correct: (i >= range._bottom && i <= range._top)});
}
}
this.model.set('_items', items);
},
restoreUserAnswers: function() {
if (!this.model.get('_isSubmitted')) return;
var items = this.model.get('_items');
var userAnswer = this.model.get('_userAnswer');
for (var i = 0, l = items.length; i < l; i++) {
var item = items[i];
if (item.value == userAnswer) {
this.model.set('_selectedItem', item);
this.selectItem(this.getIndexFromValue(item.value));
break;
}
}
this.setQuestionAsSubmitted();
this.markQuestion();
this.setScore();
this.showMarking();
this.setupFeedback();
},
// Used by question to disable the question during submit and complete stages
disableQuestion: function() {
this.setAllItemsEnabled(false);
},
// Used by question to enable the question during interactions
enableQuestion: function() {
this.setAllItemsEnabled(true);
},
setAllItemsEnabled: function(isEnabled) {
if (isEnabled) {
this.$('.slider-widget').removeClass('disabled');
} else {
this.$('.slider-widget').addClass('disabled');
}
},
// Used by question to setup itself just after rendering
onQuestionRendered: function() {
this.setScalePositions();
this.onScreenSizeChanged();
this.showScaleMarker(true);
this.listenTo(Adapt, 'device:resize', this.onScreenSizeChanged);
this.setAltText(this.model.get('_scaleStart'));
this.setReadyStatus();
},
// this should make the slider handle, slider marker and slider bar to animate to give position
animateToPosition: function(newPosition) {
this.$('.slider-handle').stop(true).animate({
left: newPosition + 'px'
},200);
this.$('.slider-bar').stop(true).animate({width:newPosition + 'px'});
this.$('.slider-scale-marker').stop(true).animate({
left: newPosition + 'px'
},200);
this.$('.slider-bar').stop(true).animate({width:newPosition + 'px'});
},
// this shoud give the index of item using given slider value
getIndexFromValue: function(itemValue) {
var scaleStart = this.model.get('_scaleStart'),
scaleEnd = this.model.get('_scaleEnd');
return Math.floor(this.mapValue(itemValue, scaleStart, scaleEnd, 0, this.model.get('_items').length - 1));
},
// this should set given value to slider handle
setAltText: function(value) {
this.$('.slider-handle').attr('aria-valuenow', value);
},
mapIndexToPixels: function(value, $widthObject) {
var numberOfItems = this.model.get('_items').length,
width = $widthObject ? $widthObject.width() : this.$('.slider-sliderange').width();
return Math.round(this.mapValue(value, 0, numberOfItems - 1, 0, width));
},
mapPixelsToIndex: function(value) {
var numberOfItems = this.model.get('_items').length,
width = this.$('.slider-sliderange').width();
return Math.round(this.mapValue(value, 0, width, 0, numberOfItems - 1));
},
normalise: function(value, low, high) {
var range = high - low;
return (value - low) / range;
},
mapValue: function(value, inputLow, inputHigh, outputLow, outputHigh) {
var normal = this.normalise(value, inputLow, inputHigh);
return normal * (outputHigh - outputLow) + outputLow;
},
onDragReleased: function (event) {
event.preventDefault();
if (Modernizr.touch) {
this.$('.slider-handle').off('touchmove');
} else {
$(document).off('mousemove.adapt-contrib-slider');
}
var itemValue = this.model.get('_selectedItem').value;
var itemIndex = this.getIndexFromValue(itemValue);
this.animateToPosition(this.mapIndexToPixels(itemIndex));
this.setAltText(itemValue);
},
onHandleDragged: function (event) {
event.preventDefault();
var left = (event.pageX || event.originalEvent.touches[0].pageX) - event.data.offsetLeft;
left = Math.max(Math.min(left, event.data.width), 0);
this.$('.slider-handle').css({
left: left + 'px'
});
this.$('.slider-scale-marker').css({
left: left + 'px'
});
this.selectItem(this.mapPixelsToIndex(left));
},
onHandleFocus: function(event) {
event.preventDefault();
this.$('.slider-handle').on('keydown', _.bind(this.onKeyDown, this));
},
onHandleBlur: function(event) {
event.preventDefault();
this.$('.slider-handle').off('keydown');
},
onHandlePressed: function (event) {
event.preventDefault();
if (!this.model.get('_isEnabled') || this.model.get('_isSubmitted')) return;
this.showScaleMarker(true);
var eventData = {
width:this.$('.slider-sliderange').width(),
offsetLeft: this.$('.slider-sliderange').offset().left
};
if(Modernizr.touch) {
this.$('.slider-handle').on('touchmove', eventData, _.bind(this.onHandleDragged, this));
this.$('.slider-handle').one('touchend', eventData, _.bind(this.onDragReleased, this));
} else {
$(document).on('mousemove.adapt-contrib-slider', eventData, _.bind(this.onHandleDragged, this));
$(document).one('mouseup', eventData, _.bind(this.onDragReleased, this));
}
},
onKeyDown: function(event) {
if(event.which == 9) return; // tab key
event.preventDefault();
var newItemIndex = this.getIndexFromValue(this.model.get('_selectedItem').value);
switch (event.which) {
case 40: // ↓ down
case 37: // ← left
newItemIndex = Math.max(newItemIndex - 1, 0);
break;
case 38: // ↑ up
case 39: // → right
newItemIndex = Math.min(newItemIndex + 1, this.model.get('_items').length - 1);
break;
}
this.selectItem(newItemIndex);
if(typeof newItemIndex == 'number') this.showScaleMarker(true);
this.animateToPosition(this.mapIndexToPixels(newItemIndex));
this.setAltText(this.getValueFromIndex(newItemIndex));
},
onSliderSelected: function (event) {
event.preventDefault();
if (!this.model.get('_isEnabled') || this.model.get('_isSubmitted')) {
return;
}
this.showScaleMarker(true);
var offsetLeft = this.$('.slider-sliderange').offset().left;
var width = this.$('.slider-sliderange').width();
var left = (event.pageX || event.originalEvent.touches[0].pageX) - offsetLeft;
left = Math.max(Math.min(left, width), 0);
var itemIndex = this.mapPixelsToIndex(left);
this.selectItem(itemIndex);
this.animateToPosition(this.mapIndexToPixels(itemIndex));
this.setAltText(this.getValueFromIndex(itemIndex));
},
onNumberSelected: function(event) {
event.preventDefault();
if (this.model.get('_isComplete')) {
return;
}
var itemValue = parseInt($(event.currentTarget).attr('data-id'));
var index = this.getIndexFromValue(itemValue);
var $scaler = this.$('.slider-scaler');
this.selectItem(index);
this.animateToPosition(this.mapIndexToPixels(index, $scaler));
this.setAltText(itemValue);
},
getValueFromIndex: function(index) {
return this.model.get('_items')[index].value;
},
preventEvent: function(event) {
event.preventDefault();
},
resetControlStyles: function() {
this.$('.slider-handle').empty();
this.showScaleMarker(false);
this.$('.slider-bar').animate({width:'0px'});
},
/**
* allow the user to submit immediately; the slider handle may already be in the position they want to choose
*/
canSubmit: function() {
return true;
},
// Blank method for question to fill out when the question cannot be submitted
onCannotSubmit: function() {},
//This preserves the state of the users answers for returning or showing the users answer
storeUserAnswer: function() {
this.model.set('_userAnswer', this.model.get('_selectedItem').value);
},
isCorrect: function() {
var numberOfCorrectAnswers = 0;
_.each(this.model.get('_items'), function(item, index) {
if(item.selected && item.correct) {
this.model.set('_isAtLeastOneCorrectSelection', true);
numberOfCorrectAnswers++;
}
}, this);
this.model.set('_numberOfCorrectAnswers', numberOfCorrectAnswers);
return this.model.get('_isAtLeastOneCorrectSelection') ? true : false;
},
// Used to set the score based upon the _questionWeight
setScore: function() {
var numberOfCorrectAnswers = this.model.get('_numberOfCorrectAnswers');
var questionWeight = this.model.get('_questionWeight');
var score = questionWeight * numberOfCorrectAnswers;
this.model.set('_score', score);
},
// This is important and should give the user feedback on how they answered the question
// Normally done through ticks and crosses by adding classes
showMarking: function() {
this.$('.slider-item').removeClass('correct incorrect')
.addClass(this.model.get('_selectedItem').correct ? 'correct' : 'incorrect');
},
isPartlyCorrect: function() {
return this.model.get('_isAtLeastOneCorrectSelection');
},
// Used by the question view to reset the stored user answer
resetUserAnswer: function() {
this.model.set({
_selectedItem: {},
_userAnswer: undefined
});
},
// Used by the question view to reset the look and feel of the component.
// This could also include resetting item data
resetQuestion: function() {
this.selectItem(0);
this.animateToPosition(0);
this.resetControlStyles();
this.showScaleMarker(true);
this.setAltText(this.model.get('_scaleStart'));
},
setScalePositions: function() {
var numberOfItems = this.model.get('_items').length;
_.each(this.model.get('_items'), function(item, index) {
var normalisedPosition = this.normalise(index, 0, numberOfItems -1);
this.$('.slider-scale-number').eq(index).data('normalisedPosition', normalisedPosition);
}, this);
},
showScale: function () {
this.$('.slider-markers').empty();
if (this.model.get('_showScale') === false) {
this.$('.slider-markers').eq(0).css({display: 'none'});
this.model.get('_showScaleIndicator')
? this.$('.slider-scale-numbers').eq(0).css({visibility: 'hidden'})
: this.$('.slider-scale-numbers').eq(0).css({display: 'none'});
} else {
var $scaler = this.$('.slider-scaler');
var $markers = this.$('.slider-markers');
for (var i = 0, count = this.model.get('_items').length; i < count; i++) {
$markers.append("<div class='slider-line component-item-color'>");
$('.slider-line', $markers).eq(i).css({left: this.mapIndexToPixels(i, $scaler) + 'px'});
}
var scaleWidth = $scaler.width(),
$numbers = this.$('.slider-scale-number');
for (var i = 0, count = this.model.get('_items').length; i < count; i++) {
var $number = $numbers.eq(i),
newLeft = Math.round($number.data('normalisedPosition') * scaleWidth);
$number.css({left: newLeft});
}
}
},
//Labels are enabled in slider.hbs. Here we manage their containing div.
showLabels: function () {
if(!this.model.get('labelStart') && !this.model.get('labelEnd')) {
this.$('.slider-scale-labels').eq(0).css({display: 'none'});
}
},
remapSliderBar: function() {
var $scaler = this.$('.slider-scaler');
var currentIndex = this.getIndexFromValue(this.model.get('_selectedItem').value);
this.$('.slider-handle').css({left: this.mapIndexToPixels(currentIndex, $scaler) + 'px'});
this.$('.slider-scale-marker').css({left: this.mapIndexToPixels(currentIndex, $scaler) + 'px'});
this.$('.slider-bar').width(this.mapIndexToPixels(currentIndex, $scaler));
},
onScreenSizeChanged: function() {
this.showScale();
this.showLabels();
this.remapSliderBar();
if (this.$('.slider-widget.user .button.model').css('display') === 'inline-block') {
this.hideCorrectAnswer();
} else if (this.$('.slider-widget.model .button.user ').css('display') === 'inline-block') {
this.showCorrectAnswer();
}
},
showCorrectAnswer: function() {
var answers = [];
var bottom = this.model.get('_correctRange')._bottom;
var top = this.model.get('_correctRange')._top;
var range = top - bottom;
var correctAnswer = this.model.get('_correctAnswer');
this.showScaleMarker(false);
if (correctAnswer) {
// Check that correctAnswer is neither undefined nor empty
answers.push(correctAnswer);
} else if (bottom !== undefined) {
for (var i = 0; i <= range; i++) {
answers.push(this.model.get('_items')[this.getIndexFromValue(bottom) + i].value);
}
} else {
console.log(this.constructor + "::WARNING: no correct answer or correct range set in JSON")
}
var middleAnswer = answers[Math.floor(answers.length / 2)];
this.animateToPosition(this.mapIndexToPixels(this.getIndexFromValue(middleAnswer)));
this.showModelAnswers(answers);
},
showModelAnswers: function(correctAnswerArray) {
var $parentDiv = this.$('.slider-modelranges');
_.each(correctAnswerArray, function(correctAnswer, index) {
$parentDiv.append($("<div class='slider-model-answer component-item-color component-item-text-color'>"));
var $element = $(this.$('.slider-modelranges .slider-model-answer')[index]),
startingLeft = this.mapIndexToPixels(this.getIndexFromValue(this.model.get('_selectedItem').value));
if(this.model.get('_showNumber')) $element.html(correctAnswer);
$element.css({left:startingLeft}).fadeIn(0, _.bind(function() {
$element.animate({left: this.mapIndexToPixels(this.getIndexFromValue(correctAnswer))});
}, this));
}, this);
},
// Used by the question to display the users answer and
// hide the correct answer
// Should use the values stored in storeUserAnswer
hideCorrectAnswer: function() {
var userAnswerIndex = this.getIndexFromValue(this.model.get('_userAnswer'));
this.$('.slider-modelranges').empty();
this.showScaleMarker(true);
this.selectItem(userAnswerIndex);
this.animateToPosition(this.mapIndexToPixels(userAnswerIndex));
},
// according to given item index this should make the item as selected
selectItem: function(itemIndex) {
this.$el.a11y_selected(false);
_.each(this.model.get('_items'), function(item, index) {
item.selected = (index == itemIndex);
if(item.selected) {
this.model.set('_selectedItem', item);
this.$('.slider-scale-number[data-id="'+(itemIndex+1)+'"]').a11y_selected(true);
}
}, this);
this.showNumber(true);
},
// this should reset the selected state of each item
deselectAllItems: function() {
_.each(this.model.get('_items'), function(item) {
item.selected = false;
}, this);
},
// this makes the marker visible or hidden
showScaleMarker: function(show) {
var $scaleMarker = this.$('.slider-scale-marker');
if (this.model.get('_showScaleIndicator')) {
this.showNumber(show);
if(show) {
$scaleMarker.addClass('display-block');
} else {
$scaleMarker.removeClass('display-block');
}
}
},
// this should add the current slider value to the marker
showNumber: function(show) {
var $scaleMarker = this.$('.slider-scale-marker');
if(this.model.get('_showNumber')) {
if(show) {
$scaleMarker.html(this.model.get('_selectedItem').value);
} else {
$scaleMarker.html = "";
}
}
},
/**
* Used by adapt-contrib-spoor to get the user's answers in the format required by the cmi.interactions.n.student_response data field
*/
getResponse:function() {
return this.model.get('_userAnswer').toString();
},
/**
* Used by adapt-contrib-spoor to get the type of this question in the format required by the cmi.interactions.n.type data field
*/
getResponseType:function() {
return "numeric";
}
});
Adapt.register('slider', Slider);
return Slider;
});
| lc-thomasberger/mlTest | src/components/adapt-contrib-slider/js/adapt-contrib-slider.js | JavaScript | gpl-3.0 | 20,869 | [
30522,
9375,
1006,
3853,
1006,
5478,
1007,
1063,
13075,
3160,
8584,
1027,
5478,
1006,
1005,
4563,
8584,
2015,
1013,
3160,
8584,
1005,
1007,
1025,
13075,
15581,
1027,
5478,
1006,
1005,
4563,
22578,
1013,
15581,
1005,
1007,
1025,
13075,
7358,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tempest import clients
from tempest.common.utils.data_utils import rand_name
import tempest.test
class BaseIdentityAdminTest(tempest.test.BaseTestCase):
@classmethod
def setUpClass(cls):
super(BaseIdentityAdminTest, cls).setUpClass()
os = clients.AdminManager(interface=cls._interface)
cls.client = os.identity_client
cls.token_client = os.token_client
cls.endpoints_client = os.endpoints_client
cls.v3_client = os.identity_v3_client
cls.service_client = os.service_client
cls.policy_client = os.policy_client
cls.v3_token = os.token_v3_client
cls.creds_client = os.credentials_client
if not cls.client.has_admin_extensions():
raise cls.skipException("Admin extensions disabled")
cls.data = DataGenerator(cls.client)
cls.v3data = DataGenerator(cls.v3_client)
os = clients.Manager(interface=cls._interface)
cls.non_admin_client = os.identity_client
cls.v3_non_admin_client = os.identity_v3_client
@classmethod
def tearDownClass(cls):
cls.data.teardown_all()
cls.v3data.teardown_all()
super(BaseIdentityAdminTest, cls).tearDownClass()
def disable_user(self, user_name):
user = self.get_user_by_name(user_name)
self.client.enable_disable_user(user['id'], False)
def disable_tenant(self, tenant_name):
tenant = self.get_tenant_by_name(tenant_name)
self.client.update_tenant(tenant['id'], enabled=False)
def get_user_by_name(self, name):
_, users = self.client.get_users()
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]
def get_tenant_by_name(self, name):
_, tenants = self.client.list_tenants()
tenant = [t for t in tenants if t['name'] == name]
if len(tenant) > 0:
return tenant[0]
def get_role_by_name(self, name):
_, roles = self.client.list_roles()
role = [r for r in roles if r['name'] == name]
if len(role) > 0:
return role[0]
class DataGenerator(object):
def __init__(self, client):
self.client = client
self.users = []
self.tenants = []
self.roles = []
self.role_name = None
self.v3_users = []
self.projects = []
self.v3_roles = []
def setup_test_user(self):
"""Set up a test user."""
self.setup_test_tenant()
self.test_user = rand_name('test_user_')
self.test_password = rand_name('pass_')
self.test_email = self.test_user + '@testmail.tm'
resp, self.user = self.client.create_user(self.test_user,
self.test_password,
self.tenant['id'],
self.test_email)
self.users.append(self.user)
def setup_test_tenant(self):
"""Set up a test tenant."""
self.test_tenant = rand_name('test_tenant_')
self.test_description = rand_name('desc_')
resp, self.tenant = self.client.create_tenant(
name=self.test_tenant,
description=self.test_description)
self.tenants.append(self.tenant)
def setup_test_role(self):
"""Set up a test role."""
self.test_role = rand_name('role')
resp, self.role = self.client.create_role(self.test_role)
self.roles.append(self.role)
def setup_test_v3_user(self):
"""Set up a test v3 user."""
self.setup_test_project()
self.test_user = rand_name('test_user_')
self.test_password = rand_name('pass_')
self.test_email = self.test_user + '@testmail.tm'
resp, self.v3_user = self.client.create_user(self.test_user,
self.test_password,
self.project['id'],
self.test_email)
self.v3_users.append(self.v3_user)
def setup_test_project(self):
"""Set up a test project."""
self.test_project = rand_name('test_project_')
self.test_description = rand_name('desc_')
resp, self.project = self.client.create_project(
name=self.test_project,
description=self.test_description)
self.projects.append(self.project)
def setup_test_v3_role(self):
"""Set up a test v3 role."""
self.test_role = rand_name('role')
resp, self.v3_role = self.client.create_role(self.test_role)
self.v3_roles.append(self.v3_role)
def teardown_all(self):
for user in self.users:
self.client.delete_user(user['id'])
for tenant in self.tenants:
self.client.delete_tenant(tenant['id'])
for role in self.roles:
self.client.delete_role(role['id'])
for v3_user in self.v3_users:
self.client.delete_user(v3_user['id'])
for v3_project in self.projects:
self.client.delete_project(v3_project['id'])
for v3_role in self.v3_roles:
self.client.delete_role(v3_role['id'])
| itskewpie/tempest | tempest/api/identity/base.py | Python | apache-2.0 | 6,216 | [
30522,
1001,
6819,
2213,
1024,
21628,
16033,
2361,
1027,
1018,
5670,
9148,
11927,
2232,
1027,
1018,
3730,
2696,
5910,
14399,
1027,
1018,
1001,
9385,
2262,
7480,
2696,
3600,
3192,
1001,
2035,
2916,
9235,
1012,
1001,
1001,
7000,
2104,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// Created by Gregory Istratov on 11/13/16.
//
#ifndef LIBSTRATUM_TYPES_H
#define LIBSTRATUM_TYPES_H
enum
{
ST_OK,
ST_ERR,
ST_NOT_FOUND,
ST_EMPTY,
ST_EXISTS,
ST_OUT_OF_RANGE,
ST_SIZE_EXCEED,
ST_UNKNOWN
};
#endif //LIBSTRATUM_TYPES_H
| GregoryIstratov/libstratum | types.h | C | lgpl-3.0 | 271 | [
30522,
1013,
1013,
1013,
1013,
2580,
2011,
7296,
21541,
8609,
4492,
2006,
2340,
1013,
2410,
1013,
2385,
1012,
1013,
1013,
1001,
2065,
13629,
2546,
5622,
5910,
6494,
11667,
1035,
4127,
1035,
1044,
1001,
9375,
5622,
5910,
6494,
11667,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Text;
namespace MqttLib
{
public interface IMqttConnectDisconnect
{
/// <summary>
/// Connect to the MQTT message broker
/// </summary>
void Connect();
/// <summary>
/// Connect to the MQTT message broker
/// </summary>
/// <param name="cleanStart">If true, all previous subscriptions and pending messages for client are lost</param>
void Connect(bool cleanStart);
/// <summary>
/// Connect to the MQTT message broker specifying last will & testament (LWT)
/// </summary>
/// <param name="willTopic">Destination of LWT</param>
/// <param name="willQoS">QoS of LWT</param>
/// <param name="willMsg">Message body of LWT</param>
/// <param name="willRetain">Whether LWT is retained</param>
void Connect(string willTopic, QoS willQoS, MqttPayload willMsg, bool willRetain);
/// <summary>
/// Connect to the MQTT message broker specifying last will & testament (LWT)
/// </summary>
/// <param name="willTopic">Destination of LWT</param>
/// <param name="willQoS">QoS of LWT</param>
/// <param name="willMsg">Message body of LWT</param>
/// <param name="willRetain">Whether LWT is retained</param>
/// <param name="cleanStart">If true, all previous subscriptions and pending messages for client are lost</param>
void Connect(string willTopic, QoS willQoS, MqttPayload willMsg, bool willRetain, bool cleanStart);
/// <summary>
/// Disconnect from the MQTT message broker
/// </summary>
void Disconnect();
/// <summary>
/// Fired when the connection to the broker is lost
/// </summary>
event ConnectionDelegate ConnectionLost;
/// <summary>
/// Fired when a connection is made with a broker
/// </summary>
event ConnectionDelegate Connected;
/// <summary>
/// Returns true if the client is connected to a broker, false otherwise
/// </summary>
bool IsConnected { get;}
/// <summary>
/// Interval (in seconds) in which Client is expected to Ping Broker to keep session alive.
/// If this interval expires without communication, the broker will assume the client
/// is disconnected, close the channel, and broker any last will and testament contract.
/// </summary>
ushort KeepAliveInterval { get; set;}
}
}
| stevenlovegrove/MqttDotNet | MqttLib/IMqttConnectDisconnect.cs | C# | mit | 2,434 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
3793,
1025,
3415,
15327,
1049,
4160,
4779,
29521,
1063,
2270,
8278,
10047,
4160,
4779,
8663,
30524,
1996,
1049,
4160,
4779,
4471,
20138,
1013,
1013,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2010-2013 Project SkyFire <http://www.projectskyfire.org/>
* Copyright (C) 2010-2013 Oregon <http://www.oregoncore.com/>
* Copyright (C) 2006-2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Boss_Lorekeeper_Polkelt
SD%Complete: 100
SDComment:
SDCategory: Scholomance
EndScriptData */
#include "ScriptPCH.h"
#include "scholomance.h"
#define SPELL_VOLATILEINFECTION 24928
#define SPELL_DARKPLAGUE 18270
#define SPELL_CORROSIVEACID 23313
#define SPELL_NOXIOUSCATALYST 18151
struct boss_lorekeeperpolkeltAI : public ScriptedAI
{
boss_lorekeeperpolkeltAI(Creature *c) : ScriptedAI(c) {}
uint32 VolatileInfection_Timer;
uint32 Darkplague_Timer;
uint32 CorrosiveAcid_Timer;
uint32 NoxiousCatalyst_Timer;
void Reset()
{
VolatileInfection_Timer = 38000;
Darkplague_Timer = 8000;
CorrosiveAcid_Timer = 45000;
NoxiousCatalyst_Timer = 35000;
}
void JustDied(Unit * /*killer*/)
{
ScriptedInstance *instance = me->GetInstanceScript();
if (instance)
{
instance->SetData(DATA_LOREKEEPERPOLKELT_DEATH, 0);
if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS)
me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0);
}
}
void EnterCombat(Unit * /*who*/)
{
}
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
//VolatileInfection_Timer
if (VolatileInfection_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_VOLATILEINFECTION);
VolatileInfection_Timer = 32000;
} else VolatileInfection_Timer -= diff;
//Darkplague_Timer
if (Darkplague_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_DARKPLAGUE);
Darkplague_Timer = 8000;
} else Darkplague_Timer -= diff;
//CorrosiveAcid_Timer
if (CorrosiveAcid_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_CORROSIVEACID);
CorrosiveAcid_Timer = 25000;
} else CorrosiveAcid_Timer -= diff;
//NoxiousCatalyst_Timer
if (NoxiousCatalyst_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_NOXIOUSCATALYST);
NoxiousCatalyst_Timer = 38000;
} else NoxiousCatalyst_Timer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_lorekeeperpolkelt(Creature* creature)
{
return new boss_lorekeeperpolkeltAI (creature);
}
void AddSC_boss_lorekeeperpolkelt()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_lorekeeper_polkelt";
newscript->GetAI = &GetAI_boss_lorekeeperpolkelt;
newscript->RegisterSelf();
}
| SkyFireArchives/SkyFire_one | src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp | C++ | gpl-2.0 | 3,544 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
1011,
2286,
2622,
3712,
10273,
1026,
8299,
1024,
1013,
1013,
7479,
1012,
3934,
4801,
10273,
1012,
8917,
1013,
1028,
1008,
9385,
1006,
1039,
1007,
2230,
1011,
2286,
5392,
1026,
8299,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CrashHandler.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CrashHandler.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
| argo2445/chummer5a | CrashHandler/Properties/Resources.Designer.cs | C# | gpl-3.0 | 2,852 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# EANN - Evolutional artificial neuronal Network
and learning java...
[](https://travis-ci.org/ufobat/EANN)[](https://codecov.io/github/ufobat/EANN)
| ufobat/EANN | README.md | Markdown | mit | 294 | [
30522,
1001,
19413,
10695,
1011,
6622,
2389,
7976,
11265,
21017,
2389,
2897,
1998,
4083,
9262,
1012,
1012,
1012,
1031,
999,
1031,
3857,
3570,
1033,
1006,
16770,
1024,
1013,
1013,
10001,
1011,
25022,
1012,
8917,
1013,
24321,
14479,
1013,
194... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var d = require('../dtrace-provider');
var dtp = d.createDTraceProvider('test');
dtp.addProbe('probe1', 'int', 'int');
dtp.addProbe('probe2', 'int', 'int');
dtp.enable();
var dtp2 = d.createDTraceProvider('test');
dtp2.addProbe('probe3', 'int', 'int');
dtp2.addProbe('probe1', 'int', 'int');
dtp2.enable();
var dtp3 = d.createDTraceProvider('test', 'mymod1');
dtp3.addProbe('probe1', 'int', 'int');
dtp3.addProbe('probe2', 'int', 'int');
dtp3.enable();
var dtp4 = d.createDTraceProvider('test', 'mymod2');
dtp4.addProbe('probe1', 'int', 'int');
dtp4.addProbe('probe3', 'int', 'int');
dtp4.enable();
dtp.fire('probe1', function () {
return ([12, 3]);
});
dtp2.fire('probe1', function () {
return ([12, 73]);
});
dtp3.fire('probe1', function () {
return ([12, 3]);
});
dtp4.fire('probe1', function () {
return ([12, 73]);
});
| hejiheji001/HexoBlog | node_modules/hexo/node_modules/bunyan/node_modules/dtrace-provider/test/disambiguation_fire.js | JavaScript | mit | 885 | [
30522,
13075,
1040,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
26718,
22903,
1011,
10802,
1005,
1007,
1025,
13075,
26718,
2361,
1027,
1040,
1012,
2580,
6494,
3401,
21572,
17258,
2121,
1006,
1005,
3231,
1005,
1007,
1025,
26718,
2361,
1012,
55... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Butia capitata var. erythrospatha VARIETY
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Agric. Colon. 10(2):515, t. 7A. 1916
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Liliopsida/Arecales/Arecaceae/Butia/Butia odorata/ Syn. Butia capitata erythrospatha/README.md | Markdown | apache-2.0 | 222 | [
30522,
1001,
2021,
2401,
8353,
2696,
13075,
1012,
9413,
22123,
8093,
2891,
15069,
2050,
3528,
1001,
1001,
1001,
1001,
3570,
10675,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.eclipse.viatra.cep.examples.sosym.tests.internal;
import org.eclipse.core.databinding.observable.Realm;
/**
* Simple realm implementation that will set itself as default when constructed.
* Invoke {@link #dispose()} to remove the realm from being the default. Does
* not support asyncExec(...).
*/
public class DefaultRealm extends Realm {
private Realm previousRealm;
public DefaultRealm() {
previousRealm = super.setDefault(this);
}
/**
* @return always returns true
*/
public boolean isCurrent() {
return true;
}
protected void syncExec(Runnable runnable) {
runnable.run();
}
/**
* @throws UnsupportedOperationException
*/
public void asyncExec(Runnable runnable) {
throw new UnsupportedOperationException("asyncExec is unsupported");
}
/**
* Removes the realm from being the current and sets the previous realm to
* the default.
*/
public void dispose() {
if (getDefault() == this) {
setDefault(previousRealm);
}
}
} | FTSRG/viatra-cep-examples | quickfix/org.eclipse.viatra.cep.examples.sosym.tests/src/org/eclipse/viatra/cep/examples/sosym/tests/internal/DefaultRealm.java | Java | epl-1.0 | 986 | [
30522,
7427,
8917,
1012,
13232,
1012,
3081,
6494,
1012,
8292,
2361,
1012,
4973,
1012,
2061,
6508,
2213,
1012,
5852,
1012,
4722,
1025,
12324,
8917,
1012,
13232,
1012,
4563,
1012,
2951,
8428,
4667,
1012,
27885,
8043,
12423,
1012,
8391,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# RFC-0009: Controller Unit Testing
**Authors:** Glyn Normington
**Status:** Accepted
**Pull Request URL:** https://github.com/projectriff/riff/pull/1372
**Superseded by:** N/A
**Supersedes:** N/A
**Related:** N/A
## Problem
The Kubernetes controllers in riff need unit testing in a consistent way. Other projects
have adopted and promoted various ways of testing controllers. For ease of maintenance,
riff needs to adopt a single, consistent approach.
For the purpose of this document, unit testing refers to testing the
`Reconcile` method of a controller.
Apart from checking that various objects are created etc., it should be straightforward
to test error paths by injecting errors in object lookup and creation.
### Anti-Goals
It is not a goal of this RFC to tie down the details of the test framework.
## Solution
The approach taken is to use a fake Kubernetes client and introduce a test framework
which allows tests to be written in a declarative style. See "Rejected Alternatives" below for
some other approaches which were tried out.
The test framework supports table-driven tests. Each row of the table tests a single call to `Reconcile` by
setting up some initial Kubernetes objects, modifying the client behaviour using various hooks
or reactors, and then asserting that various Kubernetes objects are created, updated, tracked, etc.
When a helper function (a utility function provided by a test) is used to construct a Kubernetes object, it should
construct a fixed value and any variations should be explicitly coded in the table row. This avoids details of a
particular test being "buried" in helper functions.
Since kubebuilder was used to generate the controllers, some packages contain more than one controller and so
helper functions need to be named or organised carefully to avoid clashes.
### User Impact
Users of riff are not impacted.
### Backwards Compatibility and Upgrade Path
Not applicable.
## Rejected Alternatives
### Testing with a Local Control Plane
riff's controllers were generated by kubebuilder and depend on the controller
runtime. Kubebuilder recommends integration testing using a local control plane.
This was rejected because the control plane
(specifically `etcd`) sometimes fails to start, which causes intermittent test failures.
Such failures are a time sink when developers, particularly newcomers, end up diagnosing
false positives, especially in CI.
A local control plane also complicates tests because
deletion of Kubernetes objects is not synchronous and so this needs to be worked around by
generating distinct object names or by other means.
Also, a local control plane is not
deterministic when it generates object names, which complicates the setting up of test
expectations.
See here for a quick
[spike](https://github.com/projectriff/system/pull/232) using a local control plane.
### Depending on Knative testing packages
Another approach which was quickly [spiked](https://github.com/projectriff/system/pull/233) and
rejected was to depend on Knative testing packages. This was abandoned because Knative uses a different client interface
to that used by controller runtime. Also, it was not possible to resolve the dependency management problems associated
with depending on Knative testing packages.
### BDD testing
[Ginkgo](http://onsi.github.io/ginkgo/) and [Gomega](https://onsi.github.io/gomega/) allow Behavior-Driven
Development(BDD) tests to be written in Go. One advantage of BDD is that it facilitates writing tests with
a tree structure and which can explore arbitrary "corners" of the behaviour in as much detail as necessary.
Reading a BDD test involves reading the test tree from root to leaves building up an understanding of the context in
which the tests run.
Table-driven testing was chosen instead so that each test could simply be read from a row of the table without
having to perform a mental calculation of the test context.
## FAQ
| markfisher/sk8s | rfc/rfc-0009-controller-unit-testing.md | Markdown | apache-2.0 | 3,951 | [
30522,
1001,
14645,
1011,
2199,
2683,
1024,
11486,
3131,
5604,
1008,
1008,
6048,
1024,
1008,
1008,
1043,
9644,
13373,
7853,
1008,
1008,
3570,
1024,
1008,
1008,
3970,
1008,
1008,
4139,
5227,
24471,
2140,
1024,
1008,
1008,
16770,
1024,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define CATCH_CONFIG_MAIN
#include <memory>
#include <string>
#include <set>
#include "../TestBase.h"
#include <ExecuteScript.h>
#include "processors/LogAttribute.h"
#include "processors/GetFile.h"
#include "processors/PutFile.h"
TEST_CASE("Lua: Test Log", "[executescriptLuaLog]") { // NOLINT
TestController testController;
LogTestController &logTestController = LogTestController::getInstance();
logTestController.setDebug<TestPlan>();
logTestController.setDebug<minifi::processors::LogAttribute>();
logTestController.setDebug<minifi::processors::ExecuteScript>();
auto plan = testController.createPlan();
auto getFile = plan->addProcessor("GetFile", "getFile");
auto executeScript = plan->addProcessor("ExecuteScript",
"executeScript",
core::Relationship("success", "description"),
true);
plan->setProperty(executeScript, processors::ExecuteScript::ScriptEngine.getName(), "lua");
plan->setProperty(executeScript, processors::ExecuteScript::ScriptBody.getName(), R"(
function onTrigger(context, session)
log:info('hello from lua')
end
)");
char getFileDirFmt[] = "/tmp/ft.XXXXXX";
char *getFileDir = testController.createTempDirectory(getFileDirFmt);
plan->setProperty(getFile, processors::GetFile::Directory.getName(), getFileDir);
std::fstream file;
std::stringstream ss;
ss << getFileDir << "/" << "tstFile.ext";
file.open(ss.str(), std::ios::out);
file << "tempFile";
file.close();
plan->reset();
testController.runSession(plan, false);
testController.runSession(plan, false);
REQUIRE(LogTestController::getInstance().contains(
"[org::apache::nifi::minifi::processors::ExecuteScript] [info] hello from lua"));
logTestController.reset();
}
TEST_CASE("Lua: Test Read File", "[executescriptLuaRead]") { // NOLINT
TestController testController;
LogTestController &logTestController = LogTestController::getInstance();
logTestController.setDebug<TestPlan>();
logTestController.setDebug<minifi::processors::LogAttribute>();
logTestController.setDebug<minifi::processors::ExecuteScript>();
auto plan = testController.createPlan();
auto getFile = plan->addProcessor("GetFile", "getFile");
auto logAttribute = plan->addProcessor("LogAttribute", "logAttribute",
core::Relationship("success", "description"),
true);
auto executeScript = plan->addProcessor("ExecuteScript",
"executeScript",
core::Relationship("success", "description"),
true);
auto putFile = plan->addProcessor("PutFile", "putFile", core::Relationship("success", "description"), true);
plan->setProperty(executeScript, processors::ExecuteScript::ScriptEngine.getName(), "lua");
plan->setProperty(executeScript, processors::ExecuteScript::ScriptBody.getName(), R"(
read_callback = {}
function read_callback.process(self, input_stream)
content = input_stream:read()
log:info('file content: ' .. content)
return #content
end
function onTrigger(context, session)
flow_file = session:get()
if flow_file ~= nil then
log:info('got flow file: ' .. flow_file:getAttribute('filename'))
session:read(flow_file, read_callback)
session:transfer(flow_file, REL_SUCCESS)
end
end
)");
char getFileDirFmt[] = "/tmp/ft.XXXXXX";
char *getFileDir = testController.createTempDirectory(getFileDirFmt);
plan->setProperty(getFile, processors::GetFile::Directory.getName(), getFileDir);
char putFileDirFmt[] = "/tmp/ft.XXXXXX";
char *putFileDir = testController.createTempDirectory(putFileDirFmt);
plan->setProperty(putFile, processors::PutFile::Directory.getName(), putFileDir);
testController.runSession(plan, false);
auto records = plan->getProvenanceRecords();
std::shared_ptr<core::FlowFile> record = plan->getCurrentFlowFile();
REQUIRE(record == nullptr);
REQUIRE(records.empty());
std::fstream file;
std::stringstream ss;
ss << getFileDir << "/" << "tstFile.ext";
file.open(ss.str(), std::ios::out);
file << "tempFile";
file.close();
plan->reset();
testController.runSession(plan, false);
testController.runSession(plan, false);
testController.runSession(plan, false);
records = plan->getProvenanceRecords();
record = plan->getCurrentFlowFile();
testController.runSession(plan, false);
unlink(ss.str().c_str());
REQUIRE(logTestController.contains("[info] file content: tempFile"));
// Verify that file content was preserved
REQUIRE(!std::ifstream(ss.str()).good());
std::stringstream movedFile;
movedFile << putFileDir << "/" << "tstFile.ext";
REQUIRE(std::ifstream(movedFile.str()).good());
file.open(movedFile.str(), std::ios::in);
std::string contents((std::istreambuf_iterator<char>(file)),
std::istreambuf_iterator<char>());
REQUIRE("tempFile" == contents);
file.close();
logTestController.reset();
}
TEST_CASE("Lua: Test Write File", "[executescriptLuaWrite]") { // NOLINT
TestController testController;
LogTestController &logTestController = LogTestController::getInstance();
logTestController.setDebug<TestPlan>();
logTestController.setDebug<minifi::processors::LogAttribute>();
logTestController.setDebug<minifi::processors::ExecuteScript>();
auto plan = testController.createPlan();
auto getFile = plan->addProcessor("GetFile", "getFile");
auto logAttribute = plan->addProcessor("LogAttribute", "logAttribute",
core::Relationship("success", "description"),
true);
auto executeScript = plan->addProcessor("ExecuteScript",
"executeScript",
core::Relationship("success", "description"),
true);
auto putFile = plan->addProcessor("PutFile", "putFile", core::Relationship("success", "description"), true);
plan->setProperty(executeScript, processors::ExecuteScript::ScriptEngine.getName(), "lua");
plan->setProperty(executeScript, processors::ExecuteScript::ScriptBody.getName(), R"(
write_callback = {}
function write_callback.process(self, output_stream)
new_content = 'hello 2'
output_stream:write(new_content)
return #new_content
end
function onTrigger(context, session)
flow_file = session:get()
if flow_file ~= nil then
log:info('got flow file: ' .. flow_file:getAttribute('filename'))
session:write(flow_file, write_callback)
session:transfer(flow_file, REL_SUCCESS)
end
end
)");
char getFileDirFmt[] = "/tmp/ft.XXXXXX";
char *getFileDir = testController.createTempDirectory(getFileDirFmt);
plan->setProperty(getFile, processors::GetFile::Directory.getName(), getFileDir);
char putFileDirFmt[] = "/tmp/ft.XXXXXX";
char *putFileDir = testController.createTempDirectory(putFileDirFmt);
plan->setProperty(putFile, processors::PutFile::Directory.getName(), putFileDir);
testController.runSession(plan, false);
auto records = plan->getProvenanceRecords();
std::shared_ptr<core::FlowFile> record = plan->getCurrentFlowFile();
REQUIRE(record == nullptr);
REQUIRE(records.empty());
std::fstream file;
std::stringstream ss;
ss << getFileDir << "/" << "tstFile.ext";
file.open(ss.str(), std::ios::out);
file << "tempFile";
file.close();
plan->reset();
testController.runSession(plan, false);
testController.runSession(plan, false);
testController.runSession(plan, false);
records = plan->getProvenanceRecords();
record = plan->getCurrentFlowFile();
testController.runSession(plan, false);
unlink(ss.str().c_str());
// Verify new content was written
REQUIRE(!std::ifstream(ss.str()).good());
std::stringstream movedFile;
movedFile << putFileDir << "/" << "tstFile.ext";
REQUIRE(std::ifstream(movedFile.str()).good());
file.open(movedFile.str(), std::ios::in);
std::string contents((std::istreambuf_iterator<char>(file)),
std::istreambuf_iterator<char>());
REQUIRE("hello 2" == contents);
file.close();
logTestController.reset();
}
TEST_CASE("Lua: Test Update Attribute", "[executescriptLuaUpdateAttribute]") { // NOLINT
TestController testController;
LogTestController &logTestController = LogTestController::getInstance();
logTestController.setDebug<TestPlan>();
logTestController.setDebug<minifi::processors::LogAttribute>();
logTestController.setDebug<minifi::processors::ExecuteScript>();
auto plan = testController.createPlan();
auto getFile = plan->addProcessor("GetFile", "getFile");
auto executeScript = plan->addProcessor("ExecuteScript",
"executeScript",
core::Relationship("success", "description"),
true);
auto logAttribute = plan->addProcessor("LogAttribute", "logAttribute",
core::Relationship("success", "description"),
true);
plan->setProperty(executeScript, processors::ExecuteScript::ScriptEngine.getName(), "lua");
plan->setProperty(executeScript, processors::ExecuteScript::ScriptBody.getName(), R"(
function onTrigger(context, session)
flow_file = session:get()
if flow_file ~= nil then
log:info('got flow file: ' .. flow_file:getAttribute('filename'))
flow_file:addAttribute('test_attr', '1')
attr = flow_file:getAttribute('test_attr')
log:info('got flow file attr \'test_attr\': ' .. attr)
flow_file:updateAttribute('test_attr', attr + 1)
session:transfer(flow_file, REL_SUCCESS)
end
end
)");
char getFileDirFmt[] = "/tmp/ft.XXXXXX";
char *getFileDir = testController.createTempDirectory(getFileDirFmt);
plan->setProperty(getFile, processors::GetFile::Directory.getName(), getFileDir);
std::fstream file;
std::stringstream ss;
ss << getFileDir << "/" << "tstFile.ext";
file.open(ss.str(), std::ios::out);
file << "tempFile";
file.close();
plan->reset();
testController.runSession(plan, false);
testController.runSession(plan, false);
testController.runSession(plan, false);
REQUIRE(LogTestController::getInstance().contains("key:test_attr value:2"));
logTestController.reset();
}
TEST_CASE("Lua: Test Create", "[executescriptLuaCreate]") { // NOLINT
TestController testController;
LogTestController &logTestController = LogTestController::getInstance();
logTestController.setDebug<TestPlan>();
logTestController.setDebug<minifi::processors::ExecuteScript>();
auto plan = testController.createPlan();
auto executeScript = plan->addProcessor("ExecuteScript",
"executeScript");
plan->setProperty(executeScript, processors::ExecuteScript::ScriptEngine.getName(), "lua");
plan->setProperty(executeScript, processors::ExecuteScript::ScriptBody.getName(), R"(
function onTrigger(context, session)
flow_file = session:create(nil)
if flow_file ~= nil then
log:info('created flow file: ' .. flow_file:getAttribute('filename'))
session:transfer(flow_file, REL_SUCCESS)
end
end
)");
plan->reset();
testController.runSession(plan, false);
REQUIRE(LogTestController::getInstance().contains("[info] created flow file:"));
logTestController.reset();
}
TEST_CASE("Lua: Test Require", "[executescriptLuaRequire]") { // NOLINT
TestController testController;
LogTestController &logTestController = LogTestController::getInstance();
logTestController.setDebug<TestPlan>();
logTestController.setDebug<minifi::processors::ExecuteScript>();
auto plan = testController.createPlan();
auto executeScript = plan->addProcessor("ExecuteScript",
"executeScript");
plan->setProperty(executeScript, processors::ExecuteScript::ScriptEngine.getName(), "lua");
plan->setProperty(executeScript, processors::ExecuteScript::ScriptBody.getName(), R"(
require 'os'
require 'coroutine'
require 'math'
require 'io'
require 'string'
require 'table'
require 'package'
log:info('OK')
)");
plan->reset();
testController.runSession(plan, false);
REQUIRE(LogTestController::getInstance().contains("[info] OK"));
logTestController.reset();
}
| kevdoran/nifi-minifi-cpp | libminifi/test/script-tests/LuaExecuteScriptTests.cpp | C++ | apache-2.0 | 13,511 | [
30522,
1013,
1008,
1008,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module.exports = require('./lib/dustjs-browserify'); | scottbrady/dustjs-browserify | index.js | JavaScript | mit | 52 | [
30522,
11336,
1012,
14338,
1027,
5478,
1006,
1005,
1012,
1013,
5622,
2497,
1013,
6497,
22578,
1011,
16602,
8757,
1005,
1007,
1025,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import sys
import time
import logging
from socketio import socketio_manage
from socketio.mixins import BroadcastMixin
from socketio.namespace import BaseNamespace
from DataAggregation.webdata_aggregator import getAvailableWorkshops
logger = logging.getLogger(__name__)
std_out_logger = logging.StreamHandler(sys.stdout)
logger.addHandler(std_out_logger)
def broadcast_msg(server, ns_name, event, *args):
pkt = dict(type="event",
name=event,
args=args,
endpoint=ns_name)
for sessid, socket in server.sockets.iteritems():
socket.send_packet(pkt)
def workshops_monitor(server):
sizes = []
workshops = getAvailableWorkshops()
for w in workshops:
tmp = [w.workshopName, w.q.qsize()]
sizes.append(tmp)
broadcast_msg(server, '', "sizes", tmp)
while True:
logger.info("Participants viewing frontend:" + str(len(server.sockets)))
workshops_available = []
curr_workshops = getAvailableWorkshops()
for w in curr_workshops:
workshops_available.append([w.workshopName, w.q.qsize()])
wq = filter(lambda x: x[0] == w.workshopName, sizes)[0]
if wq[1] != w.q.qsize():
wq[1] = w.q.qsize()
logging.info("client_updater: New update being pushed to clients: " + str(wq))
broadcast_msg(server, '', 'sizes', wq)
logger.info("Workshops available:" + str(workshops_available))
time.sleep(1)
class RequestHandlerApp(object):
def __call__(self, environ, start_response):
if environ['PATH_INFO'].startswith('/socket.io'):
socketio_manage(environ, {'': QueueStatusHandler})
class QueueStatusHandler(BaseNamespace, BroadcastMixin):
def on_connect(self):
sizes = []
workshops = getAvailableWorkshops()
for w in workshops:
tmp = [w.workshopName, w.q.qsize()]
sizes.append(tmp)
self.emit('sizes', tmp)
| ARL-UTEP-OC/emubox | workshop-manager/bin/RequestHandler/client_updater.py | Python | gpl-2.0 | 2,004 | [
30522,
12324,
25353,
2015,
12324,
2051,
12324,
15899,
2013,
22278,
3695,
12324,
22278,
3695,
1035,
6133,
2013,
22278,
3695,
1012,
4666,
7076,
12324,
3743,
4328,
20303,
2013,
22278,
3695,
1012,
3415,
15327,
12324,
2918,
18442,
23058,
2013,
295... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Document : green
Created on : Jul 6, 2014, 2:28:39 AM
Author : Bilal
Description:
Purpose of the stylesheet follows.
*/
a,a:visited,
body.single-event .event-details{
color: #699120;
}
a:hover,#site-navigation.main-navigation li a:hover,
.site-branding.dark #site-navigation.main-navigation li a:hover{
color: #699120;
}
.site-branding .site-title a{
color: #699120;
}
.primary-color{ color: #699120;}
a.button-primary,
input[type="submit"] {
background-color: #699120;
color: #ffffff;
}
.button-primary:hover,
.button-primary:focus,
.button-primary:active,
.button-primary.active,
.open .dropdown-toggle.button-primary,
input[type="submit"]:hover{
background-color: #537418;
}
fieldset[disabled] .button-primary.active {
background-color: #699120;
}
.button-primary .badge {
color: #699120;
}
.button-link {
color: #699120;
}
.sc-primary-color{ color: #699120;}
.sc-primary-border{ border-color: #699120;}
.site-branding .search-bar .search-field:focus{
border-bottom: 1px solid #699120;
}
.icon404{
color: #699120;
}
.nav-menu > li a:hover{
color: #699120;
}
.scroll-top:hover{
border-color: #699120;
}
#site-toolbar{
/*border-bottom: 7px solid #699120;*/
}
@media(max-width: 600px){
.nav-menu > li.current_page_item a{
color: #699120;
}
}
/* Additional Rules */
#sc-slider-banner.banner-below,
.byblos-pricing-table .inner.special {
border-color: #699120;
}
.byblos-pricing-table .inner.special .widget-title,
#homepage-area-b .byblos-pricing-table .inner.special span.special {
color: #699120;
}
.byblos-pricing-table .inner.special span.special,
.camera_wrap .camera_pag .camera_pag_ul li:hover > span,
.sc-slider-wrapper .camera_caption div a.slider-button,
div#homepage-area-b.homepage-widget-area > .inner,
body.single-event .event-details span.fa {
background-color: #699120;
}
.sc-slider-wrapper .camera_caption div a.slider-button:hover {
background-color: #537418;
} | bilalhassan/Byblos | inc/css/temps/green.css | CSS | gpl-2.0 | 2,004 | [
30522,
1013,
1008,
30524,
1010,
1016,
1024,
2654,
1024,
4464,
2572,
3166,
1024,
12170,
13837,
6412,
1024,
3800,
1997,
1996,
6782,
21030,
2102,
4076,
1012,
1008,
1013,
1037,
1010,
1037,
1024,
4716,
1010,
2303,
1012,
2309,
1011,
2724,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Chaetoplea crossata (Ellis & Everh.) M.E. Barr SPECIES
#### Status
ACCEPTED
#### According to
Index Fungorum
#### Published in
Mem. N. Y. bot. Gdn 62: 50 (1990)
#### Original name
Teichospora crossata Ellis & Everh.
### Remarks
null | mdoering/backbone | life/Fungi/Ascomycota/Dothideomycetes/Pleosporales/Leptosphaeriaceae/Chaetoplea/Chaetoplea crossata/README.md | Markdown | apache-2.0 | 239 | [
30522,
1001,
15775,
18903,
10814,
2050,
2892,
6790,
1006,
8547,
1004,
2412,
2232,
1012,
1007,
1049,
1012,
1041,
1012,
19820,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
5950,
4569,
20255,
2819,
1001,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */
package org.cfeclipse.cfml.parser.cfscript;
/**
* This exception is thrown when parse errors are encountered.
* You can explicitly create objects of this exception type by
* calling the method generateParseException in the generated
* parser.
*
* You can modify this class to customize your error reporting
* mechanisms so long as you retain the public fields.
*/
public class ParseException extends Exception {
/**
* This constructor is used by the method "generateParseException"
* in the generated parser. Calling this constructor generates
* a new object of this type with the fields "currentToken",
* "expectedTokenSequences", and "tokenImage" set. The boolean
* flag "specialConstructor" is also set to true to indicate that
* this constructor was used to create this object.
* This constructor calls its super class with the empty string
* to force the "toString" method of parent class "Throwable" to
* print the error message in the form:
* ParseException: <result of getMessage>
*/
public ParseException(Token currentTokenVal,
int[][] expectedTokenSequencesVal,
String[] tokenImageVal
)
{
super("");
specialConstructor = true;
currentToken = currentTokenVal;
expectedTokenSequences = expectedTokenSequencesVal;
tokenImage = tokenImageVal;
}
/**
* The following constructors are for use by you for whatever
* purpose you can think of. Constructing the exception in this
* manner makes the exception behave in the normal way - i.e., as
* documented in the class "Throwable". The fields "errorToken",
* "expectedTokenSequences", and "tokenImage" do not contain
* relevant information. The JavaCC generated code does not use
* these constructors.
*/
public ParseException() {
super();
specialConstructor = false;
}
public ParseException(String message) {
super(message);
specialConstructor = false;
}
/**
* This variable determines which constructor was used to create
* this object and thereby affects the semantics of the
* "getMessage" method (see below).
*/
protected boolean specialConstructor;
/**
* This is the last token that has been consumed successfully. If
* this object has been created due to a parse error, the token
* followng this token will (therefore) be the first error token.
*/
public Token currentToken;
/**
* Each entry in this array is an array of integers. Each array
* of integers represents a sequence of tokens (by their ordinal
* values) that is expected at this point of the parse.
*/
public int[][] expectedTokenSequences;
/**
* This is a reference to the "tokenImage" array of the generated
* parser within which the parse error occurred. This array is
* defined in the generated ...Constants interface.
*/
public String[] tokenImage;
/**
* This method has the standard behavior when this object has been
* created using the standard constructors. Otherwise, it uses
* "currentToken" and "expectedTokenSequences" to generate a parse
* error message and returns it. If this object has been created
* due to a parse error, and you do not catch it (it gets thrown
* from the parser), then this method is called during the printing
* of the final stack trace, and hence the correct error message
* gets displayed.
*/
public String getMessage() {
if (!specialConstructor) {
return super.getMessage();
}
String expected = "";
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
maxSize = expectedTokenSequences[i].length;
}
for (int j = 0; j < expectedTokenSequences[i].length; j++) {
expected += tokenImage[expectedTokenSequences[i][j]] + " ";
}
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
expected += "...";
}
expected += eol + " ";
}
String retval = "Encountered \"";
Token tok = currentToken.next;
for (int i = 0; i < maxSize; i++) {
if (i != 0) retval += " ";
if (tok.kind == 0) {
retval += tokenImage[0];
break;
}
retval += add_escapes(tok.image);
tok = tok.next;
}
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
retval += "." + eol;
if (expectedTokenSequences.length == 1) {
retval += "Was expecting:" + eol + " ";
} else {
retval += "Was expecting one of:" + eol + " ";
}
retval += expected;
return retval;
}
/**
* The end of line string for this machine.
*/
protected String eol = System.getProperty("line.separator", "\n");
/**
* Used to convert raw characters to their escaped version
* when these raw version cannot be used as part of an ASCII
* string literal.
*/
protected String add_escapes(String str) {
StringBuffer retval = new StringBuffer();
char ch;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i))
{
case 0 :
continue;
case '\b':
retval.append("\\b");
continue;
case '\t':
retval.append("\\t");
continue;
case '\n':
retval.append("\\n");
continue;
case '\f':
retval.append("\\f");
continue;
case '\r':
retval.append("\\r");
continue;
case '\"':
retval.append("\\\"");
continue;
case '\'':
retval.append("\\\'");
continue;
case '\\':
retval.append("\\\\");
continue;
default:
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
String s = "0000" + Integer.toString(ch, 16);
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
} else {
retval.append(ch);
}
continue;
}
}
return retval.toString();
}
}
| cybersonic/org.cfeclipse.cfml | src/org/cfeclipse/cfml/parser/cfscript/ParseException.java | Java | mit | 6,569 | [
30522,
1013,
1008,
7013,
2011,
1024,
9262,
9468,
1024,
2079,
2025,
10086,
2023,
2240,
1012,
11968,
19763,
2595,
24422,
1012,
9262,
2544,
1017,
1012,
1014,
1008,
1013,
7427,
8917,
1012,
12935,
8586,
15000,
3366,
1012,
12935,
19968,
1012,
119... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <SDL_events.h>
class Engine
{
public:
static bool StaticInit();
virtual ~Engine();
static std::unique_ptr< Engine > sInstance;
virtual int Run();
void SetShouldKeepRunning( bool inShouldKeepRunning ) { mShouldKeepRunning = inShouldKeepRunning; }
virtual void HandleEvent( SDL_Event* inEvent );
protected:
Engine();
virtual void DoFrame();
private:
int DoRunLoop();
bool mShouldKeepRunning;
}; | nurbed/MasterVR2017 | Networking/MultiplayerBook/Chapter 6/RoboCatRTS/RoboCatRTS/Inc/Engine.h | C | gpl-3.0 | 434 | [
30522,
1001,
2421,
1026,
17371,
2140,
1035,
2824,
1012,
1044,
1028,
2465,
3194,
1063,
2270,
1024,
10763,
22017,
2140,
10763,
5498,
2102,
1006,
1007,
1025,
7484,
1066,
3194,
1006,
1007,
1025,
10763,
2358,
2094,
1024,
1024,
4310,
1035,
13866,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package main
import (
"database/sql"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"strconv"
"github.com/go-martini/martini"
"github.com/martini-contrib/render"
. "github.com/russross/codegrinder/types"
"github.com/russross/meddler"
)
// GetProblemTypes handles a request to /v2/problemtypes,
// returning a complete list of problem types.
func GetProblemTypes(w http.ResponseWriter, tx *sql.Tx, render render.Render) {
problemTypes := []*ProblemType{}
err := meddler.QueryAll(tx, &problemTypes, `SELECT * FROM problem_types ORDER BY name`)
if err != nil {
loggedHTTPDBNotFoundError(w, err)
return
}
for i, elt := range problemTypes {
pt, err := getProblemType(tx, elt.Name)
if err != nil {
loggedHTTPErrorf(w, http.StatusInternalServerError, "error loading problem type %s: %v", elt.Name, err)
return
}
problemTypes[i] = pt
}
render.JSON(http.StatusOK, problemTypes)
}
// GetProblemType handles a request to /v2/problemtypes/:name,
// returning a single problem type with the given name.
func GetProblemType(w http.ResponseWriter, tx *sql.Tx, params martini.Params, render render.Render) {
name := params["name"]
problemType, err := getProblemType(tx, name)
if err != nil {
loggedHTTPDBNotFoundError(w, err)
return
}
render.JSON(http.StatusOK, problemType)
}
func getProblemType(tx *sql.Tx, name string) (*ProblemType, error) {
problemType := new(ProblemType)
err := meddler.QueryRow(tx, problemType, `SELECT * FROM problem_types WHERE name = ?`, name)
if err != nil {
return nil, err
}
// gather files
problemType.Files = make(map[string][]byte)
dir := filepath.Join(root, "files", name)
dirInfo, err := os.Lstat(dir)
if err == nil && dirInfo.IsDir() {
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
// skip errors, directories, non-regular files
if err != nil {
return err
}
if info.IsDir() {
return nil
}
relpath, err := filepath.Rel(dir, path)
if err != nil {
return err
}
raw, err := ioutil.ReadFile(path)
if err != nil {
return err
}
problemType.Files[relpath] = raw
return nil
})
if err != nil && err != os.ErrNotExist {
return nil, err
}
}
problemTypeActions := []*ProblemTypeAction{}
err = meddler.QueryAll(tx, &problemTypeActions, `SELECT * FROM problem_type_actions WHERE problem_type = ?`, name)
if err != nil {
return nil, err
}
problemType.Actions = make(map[string]*ProblemTypeAction)
for _, elt := range problemTypeActions {
problemType.Actions[elt.Action] = elt
}
return problemType, nil
}
// GetProblems handles a request to /v2/problems,
// returning a list of all problems.
//
// If parameter unique=<...> present, results will be filtered by matching Unique field.
// If parameter problemType=<...> present, results will be filtered by matching ProblemType.
// If parameter note=<...> present, results will be filtered by case-insensitive substring match on Note field.
func GetProblems(w http.ResponseWriter, r *http.Request, tx *sql.Tx, currentUser *User, render render.Render) {
// build search terms
where := ""
args := []interface{}{}
if unique := r.FormValue("unique"); unique != "" {
where, args = addWhereEq(where, args, "unique_id", unique)
}
if problemType := r.FormValue("problemType"); problemType != "" {
where, args = addWhereEq(where, args, "problem_type", problemType)
}
if name := r.FormValue("note"); name != "" {
where, args = addWhereLike(where, args, "note", name)
}
// get the problems
problems := []*Problem{}
var err error
if currentUser.Admin || currentUser.Author {
err = meddler.QueryAll(tx, &problems, `SELECT * FROM problems`+where+` ORDER BY id`, args...)
} else {
where, args = addWhereEq(where, args, "user_id", currentUser.ID)
err = meddler.QueryAll(tx, &problems, `SELECT problems.* FROM problems JOIN user_problems ON problems.id = problem_id`+where+` ORDER BY id`, args...)
}
if err != nil {
loggedHTTPErrorf(w, http.StatusInternalServerError, "db error: %v", err)
return
}
render.JSON(http.StatusOK, problems)
}
// GetProblem handles a request to /v2/problems/:problem_id,
// returning a single problem.
func GetProblem(w http.ResponseWriter, tx *sql.Tx, params martini.Params, currentUser *User, render render.Render) {
problemID, err := parseID(w, "problem_id", params["problem_id"])
if err != nil {
return
}
problem := new(Problem)
if currentUser.Admin || currentUser.Author {
err = meddler.Load(tx, "problems", problem, problemID)
} else {
err = meddler.QueryRow(tx, problem, `SELECT problems.* `+
`FROM problems JOIN user_problems ON problems.id = problem_id `+
`WHERE user_id = ? AND problem_id = ?`,
currentUser.ID, problemID)
}
if err != nil {
loggedHTTPDBNotFoundError(w, err)
return
}
render.JSON(http.StatusOK, problem)
}
// DeleteProblem handles request to /v2/problems/:problem_id,
// deleting the given problem.
// Note: this deletes all steps, assignments, and commits related to the problem,
// and it removes it from any problem sets it was part of.
func DeleteProblem(w http.ResponseWriter, tx *sql.Tx, params martini.Params, render render.Render) {
problemID, err := strconv.ParseInt(params["problem_id"], 10, 64)
if err != nil {
loggedHTTPErrorf(w, http.StatusBadRequest, "error parsing problem_id from URL: %v", err)
return
}
if _, err := tx.Exec(`DELETE FROM problems WHERE id = ?`, problemID); err != nil {
loggedHTTPErrorf(w, http.StatusInternalServerError, "db error: %v", err)
return
}
}
// GetProblemSteps handles a request to /v2/problems/:problem_id/steps,
// returning a list of all steps for a problem.
func GetProblemSteps(w http.ResponseWriter, r *http.Request, tx *sql.Tx, params martini.Params, currentUser *User, render render.Render) {
problemID, err := parseID(w, "problem_id", params["problem_id"])
if err != nil {
return
}
problemSteps := []*ProblemStep{}
if currentUser.Admin || currentUser.Author {
err = meddler.QueryAll(tx, &problemSteps, `SELECT * FROM problem_steps WHERE problem_id = ? ORDER BY step`, problemID)
} else {
err = meddler.QueryAll(tx, &problemSteps, `SELECT problem_steps.* `+
`FROM problem_steps JOIN user_problems ON problem_steps.problem_id = user_problems.problem_id `+
`WHERE user_problems.user_id = ? AND user_problems.problem_id = ? `+
`ORDER BY step`,
currentUser.ID, problemID)
}
if err != nil {
loggedHTTPErrorf(w, http.StatusInternalServerError, "db error: %v", err)
return
}
if len(problemSteps) == 0 {
loggedHTTPErrorf(w, http.StatusNotFound, "not found")
return
}
if !currentUser.Admin && !currentUser.Author {
for _, elt := range problemSteps {
elt.Solution = nil
}
}
render.JSON(http.StatusOK, problemSteps)
}
// GetProblemStep handles a request to /v2/problems/:problem_id/steps/:step,
// returning a single problem step.
func GetProblemStep(w http.ResponseWriter, tx *sql.Tx, params martini.Params, currentUser *User, render render.Render) {
problemID, err := parseID(w, "problem_id", params["problem_id"])
if err != nil {
return
}
step, err := parseID(w, "step", params["step"])
if err != nil {
return
}
problemStep := new(ProblemStep)
if currentUser.Admin || currentUser.Author {
err = meddler.QueryRow(tx, problemStep, `SELECT * FROM problem_steps WHERE problem_id = ? AND step = ?`, problemID, step)
} else {
err = meddler.QueryRow(tx, problemStep, `SELECT problem_steps.* `+
`FROM problem_steps JOIN user_problems ON problem_steps.problem_id = user_problems.problem_id `+
`WHERE user_problems.user_id = ? AND problem_steps.problem_id = ? AND problem_steps.step = ?`,
currentUser.ID, problemID, step)
}
if err != nil {
loggedHTTPDBNotFoundError(w, err)
return
}
if !currentUser.Admin && !currentUser.Author {
problemStep.Solution = nil
}
render.JSON(http.StatusOK, problemStep)
}
// GetProblemSets handles a request to /v2/problem_sets,
// returning a list of all problem sets.
//
// If parameter unique=<...> present, results will be filtered by matching Unique field.
// If parameter note=<...> present, results will be filtered by case-insensitive substring match on Note field.
//
// If parameter search=<...> present (cat be repeated), it will be interpreted as search terms,
// and results will be filtered by case-insensitive substring match on several fields
// related to the problem set, including the unique ID, note, tags, and the same fields
// on each problem in the problem set. The returned problem sets match all search terms.
func GetProblemSets(w http.ResponseWriter, r *http.Request, tx *sql.Tx, currentUser *User, render render.Render) {
if err := r.ParseForm(); err != nil {
loggedHTTPErrorf(w, http.StatusBadRequest, "parsing form data: %v", err)
return
}
// build search terms
where := ""
args := []interface{}{}
// build search terms
search := false
for _, term := range r.Form["search"] {
where, args = addWhereLike(where, args, "problem_set_search_fields.search_text", term)
search = true
}
if unique := r.FormValue("unique"); unique != "" {
where, args = addWhereEq(where, args, "problem_sets.unique_id", unique)
}
if name := r.FormValue("note"); name != "" {
where, args = addWhereLike(where, args, "problem_sets.note", name)
}
// get the problemsets
problemSets := []*ProblemSet{}
var err error
if currentUser.Admin || currentUser.Author {
query := `SELECT problem_sets.* FROM problem_sets`
if search {
query += ` JOIN problem_set_search_fields ON problem_sets.id = problem_set_search_fields.problem_set_id`
}
query += where + ` ORDER BY problem_sets.id`
err = meddler.QueryAll(tx, &problemSets, query, args...)
} else {
query := `SELECT problem_sets.* FROM problem_sets ` +
`JOIN user_problem_sets ON problem_sets.id = problem_set_id`
if search {
query += ` JOIN problem_set_search_fields ON problem_sets.id = problem_set_search_fields.problem_set_id`
}
query += where + ` ORDER BY problem_sets.id`
err = meddler.QueryAll(tx, &problemSets, query, args...)
}
if err != nil {
loggedHTTPErrorf(w, http.StatusInternalServerError, "db error: %v", err)
return
}
render.JSON(http.StatusOK, problemSets)
}
// GetProblemSet handles a request to /v2/problem_sets/:problem_set_id,
// returning a single problem set.
func GetProblemSet(w http.ResponseWriter, tx *sql.Tx, params martini.Params, currentUser *User, render render.Render) {
problemSetID, err := parseID(w, "problem_set_id", params["problem_set_id"])
if err != nil {
return
}
problemSet := new(ProblemSet)
if currentUser.Admin || currentUser.Author {
err = meddler.Load(tx, "problem_sets", problemSet, problemSetID)
} else {
err = meddler.QueryRow(tx, problemSet, `SELECT problem_sets.* `+
`FROM problem_sets JOIN user_problem_sets ON problem_sets.id = problem_set_id `+
`WHERE user_id = ? AND problem_set_id = ?`,
currentUser.ID, problemSetID)
}
if err != nil {
loggedHTTPDBNotFoundError(w, err)
return
}
render.JSON(http.StatusOK, problemSet)
}
// GetProblemSetProblems handles a request to /v2/problem_sets/:problem_set_id/problems,
// returning a list of all problems set problems for a given problem set.
func GetProblemSetProblems(w http.ResponseWriter, r *http.Request, tx *sql.Tx, params martini.Params, currentUser *User, render render.Render) {
problemSetID, err := parseID(w, "problem_set_id", params["problem_set_id"])
if err != nil {
return
}
problemSetProblems := []*ProblemSetProblem{}
if currentUser.Admin || currentUser.Author {
err = meddler.QueryAll(tx, &problemSetProblems, `SELECT * FROM problem_set_problems WHERE problem_set_id = ? ORDER BY problem_id`, problemSetID)
} else {
err = meddler.QueryAll(tx, &problemSetProblems, `SELECT problem_set_problems.* `+
`FROM problem_set_problems JOIN user_problem_sets ON problem_set_problems.problem_set_id = user_problem_sets.problem_set_id `+
`WHERE user_problem_sets.user_id = ? AND problem_set_problems.problem_set_id = ? `+
`ORDER BY problem_id`, currentUser.ID, problemSetID)
}
if err != nil {
loggedHTTPErrorf(w, http.StatusInternalServerError, "db error: %v", err)
return
}
if len(problemSetProblems) == 0 {
loggedHTTPErrorf(w, http.StatusNotFound, "not found")
return
}
render.JSON(http.StatusOK, problemSetProblems)
}
// DeleteProblemSet handles request to /v2/problem_sets/:problem_set_id,
// deleting the given problem set.
// Note: this deletes all assignments and commits related to the problem set.
func DeleteProblemSet(w http.ResponseWriter, tx *sql.Tx, params martini.Params, render render.Render) {
problemSetID, err := parseID(w, "problem_set_id", params["problem_set_id"])
if err != nil {
return
}
if _, err := tx.Exec(`DELETE FROM problem_sets WHERE id = ?`, problemSetID); err != nil {
loggedHTTPErrorf(w, http.StatusInternalServerError, "db error: %v", err)
return
}
}
| russross/codegrinder | server/problem.go | GO | agpl-3.0 | 12,910 | [
30522,
7427,
2364,
12324,
1006,
1000,
7809,
1013,
29296,
1000,
1000,
22834,
1013,
22834,
21823,
2140,
1000,
1000,
5658,
1013,
8299,
1000,
1000,
9808,
1000,
1000,
4130,
1013,
5371,
15069,
1000,
1000,
2358,
29566,
2078,
2615,
1000,
1000,
2102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>numeric: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="../MathJax/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">numeric
 <span id="projectnumber">1.3.2</span>
</div>
<div id="projectbrief">C++-11 Library for Numerical Computation</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div>
<h3><a id="index_f"></a>- f -</h3><ul>
<li>f()
: <a class="el" href="classnum_1_1dense__table.html#ae478dd7e7522cfdedbb9be1226e5cf81">dense_table< A, F ></a>
, <a class="el" href="structnum_1_1sparse__table_1_1rec.html#ae9d1dfd4e5675b23771b59c24b4ca9e3">sparse_table< A >::rec</a>
</li>
<li>f_
: <a class="el" href="classnum_1_1dense__table.html#abe22d83ce8703cd4061d154943d6009a">dense_table< A, F ></a>
</li>
<li>fa
: <a class="el" href="structnum_1_1interval.html#a9bbc451535aa8b012a852bec24497e02">interval< A, R ></a>
</li>
<li>fabs
: <a class="el" href="classnum_1_1dyndim.html#a742fe13bb3b7be9812bf52e8acc57061">dyndim</a>
, <a class="el" href="classnum_1_1statdim.html#a36e3cfaab8b6844ec3732e13228a3248">statdim< TI, D, M, C, TE ></a>
</li>
<li>fb
: <a class="el" href="structnum_1_1interval.html#a95d77ff967b483e62d73913de9fec84e">interval< A, R ></a>
</li>
<li>feet()
: <a class="el" href="structnum_1_1u_1_1feet.html#a180d8e44a3c7cf639bd05b84a6bb7990">feet</a>
</li>
<li>func
: <a class="el" href="classnum_1_1dyndim.html#a385f53f375a572872c2703889dcf64bf">dyndim</a>
, <a class="el" href="classnum_1_1rk__quad.html#aeb026a3352b57d4bc126eb6a5da3167d">rk_quad< X, Y ></a>
, <a class="el" href="classnum_1_1statdim.html#a385f53f375a572872c2703889dcf64bf">statdim< TI, D, M, C, TE ></a>
</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
| tevaughan/numeric | docs/doxygen-html/functions_f.html | HTML | lgpl-3.0 | 4,287 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.