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
// vim: et sw=4 sts=4 tabstop=4 /* * 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.issc.widget; import com.issc.R; import android.app.DialogFragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class LoadingFragment extends DialogFragment { public LoadingFragment() { super(); setStyle(DialogFragment.STYLE_NO_FRAME, 0); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.progressdialog, container, false); return v; } }
ISSC/Bluebit
src/com/issc/widget/LoadingFragment.java
Java
apache-2.0
1,195
[ 30522, 1013, 1013, 6819, 2213, 1024, 3802, 25430, 1027, 1018, 8541, 1027, 1018, 21628, 16033, 2361, 1027, 1018, 1013, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 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...
package pl.openrest.filters.query; import java.io.Serializable; import org.springframework.data.mapping.PersistentProperty; import pl.openrest.predicate.parser.FilterPart; import pl.openrest.predicate.parser.PredicateParts; public interface PredicateContextBuilder { PredicateContextBuilder withFilterTree(FilterPart tree); PredicateContextBuilder withId(PersistentProperty<?> idProperty, Serializable id); PredicateContextBuilder withPredicateParts(PredicateParts predicateParts); PredicateContextBuilder withStaticFilters(); PredicateContext<?> build(); }
konik32/openrest
openrest-filters/src/main/java/pl/openrest/filters/query/PredicateContextBuilder.java
Java
apache-2.0
587
[ 30522, 7427, 20228, 1012, 2330, 28533, 1012, 17736, 1012, 23032, 1025, 12324, 9262, 1012, 22834, 1012, 7642, 21335, 3468, 1025, 12324, 30524, 1012, 2951, 1012, 12375, 1012, 14516, 21572, 4842, 3723, 1025, 12324, 20228, 1012, 2330, 28533, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2009-2011 Red Hat, Inc. * * Author: Mikulas Patocka <mpatocka@redhat.com> * * This file is released under the GPL. */ #ifndef _LINUX_DM_BUFIO_H #define _LINUX_DM_BUFIO_H #include <linux/blkdev.h> #include <linux/types.h> /*----------------------------------------------------------------*/ struct dm_bufio_client; struct dm_buffer; /* * Create a buffered IO cache on a given device */ struct dm_bufio_client * dm_bufio_client_create(struct block_device *bdev, unsigned block_size, unsigned reserved_buffers, unsigned aux_size, void (*alloc_callback)(struct dm_buffer *), void (*write_callback)(struct dm_buffer *)); /* * Release a buffered IO cache. */ void dm_bufio_client_destroy(struct dm_bufio_client *c); /* * Set the sector range. * When this function is called, there must be no I/O in progress on the bufio * client. */ void dm_bufio_set_sector_offset(struct dm_bufio_client *c, sector_t start); /* * WARNING: to avoid deadlocks, these conditions are observed: * * - At most one thread can hold at most "reserved_buffers" simultaneously. * - Each other threads can hold at most one buffer. * - Threads which call only dm_bufio_get can hold unlimited number of * buffers. */ /* * Read a given block from disk. Returns pointer to data. Returns a * pointer to dm_buffer that can be used to release the buffer or to make * it dirty. */ void *dm_bufio_read(struct dm_bufio_client *c, sector_t block, struct dm_buffer **bp); /* * Like dm_bufio_read, but return buffer from cache, don't read * it. If the buffer is not in the cache, return NULL. */ void *dm_bufio_get(struct dm_bufio_client *c, sector_t block, struct dm_buffer **bp); /* * Like dm_bufio_read, but don't read anything from the disk. It is * expected that the caller initializes the buffer and marks it dirty. */ void *dm_bufio_new(struct dm_bufio_client *c, sector_t block, struct dm_buffer **bp); /* * Prefetch the specified blocks to the cache. * The function starts to read the blocks and returns without waiting for * I/O to finish. */ void dm_bufio_prefetch(struct dm_bufio_client *c, sector_t block, unsigned n_blocks); /* * Release a reference obtained with dm_bufio_{read,get,new}. The data * pointer and dm_buffer pointer is no longer valid after this call. */ void dm_bufio_release(struct dm_buffer *b); /* * Mark a buffer dirty. It should be called after the buffer is modified. * * In case of memory pressure, the buffer may be written after * dm_bufio_mark_buffer_dirty, but before dm_bufio_write_dirty_buffers. So * dm_bufio_write_dirty_buffers guarantees that the buffer is on-disk but * the actual writing may occur earlier. */ void dm_bufio_mark_buffer_dirty(struct dm_buffer *b); /* * Mark a part of the buffer dirty. * * The specified part of the buffer is scheduled to be written. dm-bufio may * write the specified part of the buffer or it may write a larger superset. */ void dm_bufio_mark_partial_buffer_dirty(struct dm_buffer *b, unsigned start, unsigned end); /* * Initiate writing of dirty buffers, without waiting for completion. */ void dm_bufio_write_dirty_buffers_async(struct dm_bufio_client *c); /* * Write all dirty buffers. Guarantees that all dirty buffers created prior * to this call are on disk when this call exits. */ int dm_bufio_write_dirty_buffers(struct dm_bufio_client *c); /* * Send an empty write barrier to the device to flush hardware disk cache. */ int dm_bufio_issue_flush(struct dm_bufio_client *c); /* * Send a discard request to the underlying device. */ int dm_bufio_issue_discard(struct dm_bufio_client *c, sector_t block, sector_t count); /* * Like dm_bufio_release but also move the buffer to the new * block. dm_bufio_write_dirty_buffers is needed to commit the new block. */ void dm_bufio_release_move(struct dm_buffer *b, sector_t new_block); /* * Free the given buffer. * This is just a hint, if the buffer is in use or dirty, this function * does nothing. */ void dm_bufio_forget(struct dm_bufio_client *c, sector_t block); /* * Free the given range of buffers. * This is just a hint, if the buffer is in use or dirty, this function * does nothing. */ void dm_bufio_forget_buffers(struct dm_bufio_client *c, sector_t block, sector_t n_blocks); /* * Set the minimum number of buffers before cleanup happens. */ void dm_bufio_set_minimum_buffers(struct dm_bufio_client *c, unsigned n); unsigned dm_bufio_get_block_size(struct dm_bufio_client *c); sector_t dm_bufio_get_device_size(struct dm_bufio_client *c); sector_t dm_bufio_get_block_number(struct dm_buffer *b); void *dm_bufio_get_block_data(struct dm_buffer *b); void *dm_bufio_get_aux_data(struct dm_buffer *b); struct dm_bufio_client *dm_bufio_get_client(struct dm_buffer *b); /*----------------------------------------------------------------*/ #endif
CSE3320/kernel-code
linux-5.8/include/linux/dm-bufio.h
C
gpl-2.0
4,917
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2268, 1011, 2249, 2417, 6045, 1010, 4297, 1012, 1008, 1008, 3166, 1024, 2771, 5283, 8523, 6986, 7432, 2050, 1026, 6131, 10610, 3600, 2050, 1030, 2417, 12707, 1012, 4012, 1028, 1008, 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...
#!/bin/bash # Copyright 2014 The Kubernetes Authors All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## Contains configuration values for interacting with the Vagrant cluster # Number of minions in the cluster NUM_MINIONS=${NUM_MINIONS-"1"} export NUM_MINIONS # The IP of the master export MASTER_IP="10.245.1.2" export KUBE_MASTER_IP="10.245.1.2" export INSTANCE_PREFIX="kubernetes" export MASTER_NAME="${INSTANCE_PREFIX}-master" # Map out the IPs, names and container subnets of each minion export MINION_IP_BASE="10.245.1." MINION_CONTAINER_SUBNET_BASE="10.246" MASTER_CONTAINER_NETMASK="255.255.255.0" MASTER_CONTAINER_ADDR="${MINION_CONTAINER_SUBNET_BASE}.0.1" MASTER_CONTAINER_SUBNET="${MINION_CONTAINER_SUBNET_BASE}.0.1/24" CONTAINER_SUBNET="${MINION_CONTAINER_SUBNET_BASE}.0.0/16" for ((i=0; i < NUM_MINIONS; i++)) do MINION_IPS[$i]="${MINION_IP_BASE}$((i+3))" MINION_NAMES[$i]="${INSTANCE_PREFIX}-minion-$((i+1))" MINION_CONTAINER_SUBNETS[$i]="${MINION_CONTAINER_SUBNET_BASE}.$((i+1)).1/24" MINION_CONTAINER_ADDRS[$i]="${MINION_CONTAINER_SUBNET_BASE}.$((i+1)).1" MINION_CONTAINER_NETMASKS[$i]="255.255.255.0" VAGRANT_MINION_NAMES[$i]="minion-$((i+1))" done PORTAL_NET=10.247.0.0/16 # Since this isn't exposed on the network, default to a simple user/passwd MASTER_USER=vagrant MASTER_PASSWD=vagrant # Admission Controllers to invoke prior to persisting objects in cluster ADMISSION_CONTROL=NamespaceLifecycle,NamespaceAutoProvision,LimitRanger,SecurityContextDeny,ResourceQuota # Optional: Install node monitoring. ENABLE_NODE_MONITORING=true # Optional: Enable node logging. ENABLE_NODE_LOGGING=false LOGGING_DESTINATION=elasticsearch # Optional: When set to true, Elasticsearch and Kibana will be setup as part of the cluster bring up. ENABLE_CLUSTER_LOGGING=false ELASTICSEARCH_LOGGING_REPLICAS=1 # Optional: When set to true, heapster, Influxdb and Grafana will be setup as part of the cluster bring up. ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-true}" # Extra options to set on the Docker command line. This is useful for setting # --insecure-registry for local registries. DOCKER_OPTS="" # Optional: Install cluster DNS. ENABLE_CLUSTER_DNS=true DNS_SERVER_IP="10.247.0.10" DNS_DOMAIN="kubernetes.local" DNS_REPLICAS=1 # Optional: Enable setting flags for kube-apiserver to turn on behavior in active-dev #RUNTIME_CONFIG="" RUNTIME_CONFIG="api/v1beta3"
bprashanth/kubernetes
cluster/vagrant/config-default.sh
Shell
apache-2.0
2,933
[ 30522, 1001, 999, 1013, 8026, 1013, 24234, 1001, 9385, 2297, 1996, 13970, 5677, 7159, 2229, 6048, 2035, 2916, 9235, 1012, 1001, 1001, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- layout: page title: Alpha Financial Party date: 2016-05-24 author: Larry Thornton tags: weekly links, java status: published summary: Phasellus eget pulvinar leo. Sed tincidunt. banner: images/banner/office-01.jpg booking: startDate: 05/10/2016 endDate: 05/12/2016 ctyhocn: SUXSOHX groupCode: AFP published: true --- Nam blandit iaculis augue, et molestie justo egestas eget. Nunc ac nisl rutrum, tempor orci eu, pharetra urna. Nulla placerat nibh sagittis, finibus felis eget, consectetur tellus. Curabitur eleifend leo nunc, eget porta mauris placerat nec. Fusce eget mi ac nisi porta vestibulum sit amet sit amet est. Pellentesque vestibulum lorem velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec vitae urna eget odio cursus mattis. Nunc vel pulvinar leo. Suspendisse cursus felis ac euismod pharetra. Sed quis enim rhoncus massa vestibulum dignissim at a turpis. Nam gravida massa convallis, sodales ante vitae, feugiat leo. Cras finibus laoreet dui, at ultricies magna ullamcorper in. Donec lobortis at justo id pretium. Donec sagittis vel ante non commodo. Aliquam id commodo neque, sit amet rutrum dolor. Ut vel turpis ex. Aenean et dignissim nunc. Etiam pharetra magna et leo consectetur, vitae congue metus auctor. Sed et ipsum mattis, viverra sapien nec, euismod neque. In vel suscipit nulla. Aenean quis elementum magna, semper maximus quam. Pellentesque laoreet scelerisque dolor, non volutpat turpis euismod non. Nunc pharetra, eros a pulvinar finibus, dui mauris tempor diam, eu gravida justo augue vel odio. Nulla ut mi faucibus, consectetur nibh vel, convallis ex. Aenean non mauris quis lacus maximus gravida. Cras ac egestas risus, eu egestas libero. Nulla sit amet efficitur nisi, et iaculis ex. Sed sit amet vestibulum sem, a dapibus elit. 1 Curabitur in nulla laoreet leo malesuada lacinia 1 Donec vitae orci molestie, volutpat tellus vel, feugiat mauris 1 Integer lacinia lectus non dui tempus, vitae convallis metus molestie 1 Sed et orci quis dolor congue gravida sit amet ac mauris. Morbi congue neque a diam vestibulum malesuada. Aenean eu risus erat. Sed et magna hendrerit, malesuada mauris ut, ullamcorper felis. Proin hendrerit nisi nec efficitur facilisis. Cras faucibus est ac nunc dapibus aliquet. Fusce et maximus odio, sit amet posuere diam. Morbi in orci viverra, venenatis nibh non, semper orci. Maecenas condimentum viverra tellus ac iaculis. Mauris ultrices leo sed dolor congue maximus. Nunc egestas, velit in ultricies maximus, justo augue vulputate turpis, non egestas lectus nisl eget lorem. Aliquam erat volutpat. Nullam hendrerit, ligula at rhoncus lacinia, arcu neque facilisis quam, dapibus aliquet sapien magna vel mauris. Nam tempor tincidunt sem nec vestibulum. Nam pellentesque ipsum placerat volutpat facilisis. In hac habitasse platea dictumst. Aliquam erat volutpat. Fusce hendrerit vestibulum tortor iaculis semper. Sed cursus sem sed mi fringilla tempor. Integer eu consequat dui. Donec fermentum ex quis euismod tempor.
KlishGroup/prose-pogs
pogs/S/SUXSOHX/AFP/index.md
Markdown
mit
3,041
[ 30522, 1011, 1011, 1011, 9621, 1024, 3931, 2516, 1024, 6541, 3361, 2283, 3058, 1024, 2355, 1011, 5709, 1011, 2484, 3166, 1024, 6554, 14630, 22073, 1024, 4882, 6971, 1010, 9262, 3570, 1024, 2405, 12654, 1024, 4403, 20159, 1041, 18150, 16405,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 echo error(validation_errors()); echo form_open("admin/create_board"); echo "<label>Name</label><input type='text' maxlenght='64' name='name' value='".@$_POST['name']."'><br />"; echo "<label>Description</label>"; echo "<textarea name='description'>".@$_POST['description']."</textarea>"; echo "<i>Minimum access to see and use the board.</i><br /><label>Access</label>"; echo "<input type='text' name='access' value='".@$_POST['access']."'><br />"; echo "<label>Closed</label>"; echo "<select name='closed'><option ".set_select('closed', 0, TRUE)." value='0'>No</option><option ".set_select('closed', 1)." value='1'>Yes</option></select>"; echo "<br /><i>Specify if user must be logged in to see the board.</i><br /><label>Login required</label><select name='login'><option ".set_select('login', 0, TRUE)." value='0'>No</option><option ".set_select('login', 1)." value='1'>Yes</option></select><br />"; echo "<i>Moderators, divide them by comma \",\" example: Paxton,Teragon,Mafiozo<br />"; echo "<label>Moderators</label><input type='text' name='moderators' value='".@$_POST['moderators']."'><br />"; echo "<i>Number of position in the listing, the lower it is the higher to board will be.</i><br />"; echo "<label>Order</label><input type='text' name='order' value='".@$_POST['order']."'><br />"; echo "<input type='submit' value='Create'>"; echo "</form>"; ?>
celopeccin/modernaac
system/application/views/admin_new_board.php
PHP
gpl-3.0
1,387
[ 30522, 1026, 1029, 25718, 9052, 7561, 1006, 27354, 1035, 10697, 1006, 1007, 1007, 1025, 9052, 2433, 1035, 2330, 1006, 1000, 4748, 10020, 1013, 3443, 1035, 2604, 1000, 1007, 1025, 9052, 1000, 1026, 3830, 1028, 2171, 1026, 1013, 3830, 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...
var chai = require('chai') , sinon = require('sinon') , sinonChai = require('sinon-chai') , expect = chai.expect , Promise = require('es6-promise').Promise , UpdateTemplatesController = require('../../../platypi-cli/controllers/cli/updatetemplates.controller'); chai.use(sinonChai); describe('TemplateUpdate controller', function () { it('should return a new controller', function (done) { try { var controller = new UpdateTemplatesController({ viewStuff: 'fakeview' }); expect(controller).to.be.an.object; expect(controller.model).to.be.an.object; expect(controller.view).to.be.an.object; expect(controller.view.model).to.equal(controller.model); done(); } catch (e) { done(e); } }); describe('getResponseView method', function () { var sandbox, controller, updateFunc; beforeEach(function (done) { sandbox = sinon.sandbox.create(); controller = new UpdateTemplatesController({ viewStuff: 'fakeview' }); updateFunc = sandbox.stub(controller.__provider, 'update'); done(); }); afterEach(function (done) { sandbox.restore(); done(); }); it('should call the clean method and return the view', function (done) { updateFunc.returns(Promise.resolve('')); controller.getResponseView().then(function (view) { try { expect(updateFunc).to.have.been.called; expect(controller.model.successMessage).not.to.equal(''); expect(view).to.exist; done(); } catch (e) { done(e); } }, function (err) { done(err); }); }); it('should call the update method and throw an error', function (done) { updateFunc.returns(Promise.reject('Err')); controller.getResponseView().then(function (view) { try { expect(updateFunc).to.have.been.called; expect(controller.model.errorMessage).not.to.equal(''); expect(view).to.exist; done(); } catch (e) { done(e); } }, function (err) { done(err); }); }); }); });
tonylegrone/platypi-cli
test/controllers/cli/updatetemplates.controller.test.js
JavaScript
gpl-3.0
2,558
[ 30522, 13075, 15775, 2072, 1027, 5478, 1006, 1005, 15775, 2072, 1005, 1007, 1010, 19432, 2078, 1027, 5478, 1006, 1005, 19432, 2078, 1005, 1007, 1010, 19432, 12680, 4886, 1027, 5478, 1006, 1005, 19432, 2078, 1011, 15775, 2072, 1005, 1007, 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...
/* * winsftp.c: the Windows-specific parts of PSFTP and PSCP. */ #include <winsock2.h> /* need to put this first, for winelib builds */ #include <assert.h> #define NEED_DECLARATION_OF_SELECT #include "putty.h" #include "psftp.h" #include "ssh.h" #include "int64.h" #include "winsecur.h" char *get_ttymode(void *frontend, const char *mode) { return NULL; } int get_userpass_input(prompts_t *p, const unsigned char *in, int inlen) { int ret; ret = cmdline_get_passwd_input(p, in, inlen); if (ret == -1) ret = console_get_userpass_input(p, in, inlen); return ret; } void platform_get_x11_auth(struct X11Display *display, Conf *conf) { /* Do nothing, therefore no auth. */ } const int platform_uses_x11_unix_by_default = TRUE; /* ---------------------------------------------------------------------- * File access abstraction. */ /* * Set local current directory. Returns NULL on success, or else an * error message which must be freed after printing. */ char *psftp_lcd(char *dir) { char *ret = NULL; wchar_t* w = utf8_to_wide(dir); if (!w) return dupstr("Failed to convert to wide character set"); if (!SetCurrentDirectoryW(w)) { LPVOID message; int i; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&message, 0, NULL); i = strcspn((char *)message, "\n"); ret = dupprintf("%.*s", i, (LPCTSTR)message); LocalFree(message); } sfree(w); return ret; } /* * Get local current directory. Returns a string which must be * freed. */ char *psftp_getcwd(void) { char* ret; wchar_t *w = snewn(256, wchar_t); int len = GetCurrentDirectoryW(256, w); if (len > 256) w = sresize(w, len, wchar_t); GetCurrentDirectoryW(len, w); ret = wide_to_utf8(w); sfree(w); return ret; } #define TIME_POSIX_TO_WIN(t, ft) do { \ ULARGE_INTEGER uli; \ uli.QuadPart = ((ULONGLONG)(t) + 11644473600ull) * 10000000ull; \ (ft).dwLowDateTime = uli.LowPart; \ (ft).dwHighDateTime = uli.HighPart; \ } while(0) #define TIME_WIN_TO_POSIX(ft, t) do { \ ULARGE_INTEGER uli; \ uli.LowPart = (ft).dwLowDateTime; \ uli.HighPart = (ft).dwHighDateTime; \ uli.QuadPart = uli.QuadPart / 10000000ull - 11644473600ull; \ (t) = (unsigned long) uli.QuadPart; \ } while(0) struct RFile { HANDLE h; }; RFile *open_existing_file(const char *name, uint64 *size, unsigned long *mtime, unsigned long *atime, long *perms) { HANDLE h; RFile *ret; wchar_t* wname = utf8_to_wide(name); if (!wname) return NULL; h = CreateFileW(wname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); sfree(wname); if (h == INVALID_HANDLE_VALUE) return NULL; ret = snew(RFile); ret->h = h; if (size) { DWORD lo, hi; lo = GetFileSize(h, &hi); size->lo = lo; size->hi = hi; } if (mtime || atime) { FILETIME actime, wrtime; GetFileTime(h, NULL, &actime, &wrtime); if (atime) TIME_WIN_TO_POSIX(actime, *atime); if (mtime) TIME_WIN_TO_POSIX(wrtime, *mtime); } if (perms) *perms = -1; return ret; } int read_from_file(RFile *f, void *buffer, int length) { int ret; DWORD read; ret = ReadFile(f->h, buffer, length, &read, NULL); if (!ret) return -1; /* error */ else return (int)read; } void close_rfile(RFile *f) { CloseHandle(f->h); sfree(f); } struct WFile { HANDLE h; }; WFile *open_new_file(const char *name, long perms) { HANDLE h; WFile *ret; wchar_t* wname = utf8_to_wide(name); if (!wname) return NULL; h = CreateFileW(wname, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); sfree(wname); if (h == INVALID_HANDLE_VALUE) return NULL; ret = snew(WFile); ret->h = h; return ret; } WFile *open_existing_wfile(const char *name, uint64 *size) { HANDLE h; WFile *ret; wchar_t* wname = utf8_to_wide(name); if (!wname) return NULL; h = CreateFileW(wname, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); sfree(wname); if (h == INVALID_HANDLE_VALUE) return NULL; ret = snew(WFile); ret->h = h; if (size) { DWORD lo, hi; lo = GetFileSize(h, &hi); size->lo = lo; size->hi = hi; } return ret; } int write_to_file(WFile *f, void *buffer, int length) { int ret; DWORD written; ret = WriteFile(f->h, buffer, length, &written, NULL); if (!ret) return -1; /* error */ else return (int)written; } void set_file_times(WFile *f, unsigned long mtime, unsigned long atime) { FILETIME actime, wrtime; TIME_POSIX_TO_WIN(atime, actime); TIME_POSIX_TO_WIN(mtime, wrtime); SetFileTime(f->h, NULL, &actime, &wrtime); } void close_wfile(WFile *f) { CloseHandle(f->h); sfree(f); } /* Seek offset bytes through file, from whence, where whence is FROM_START, FROM_CURRENT, or FROM_END */ int seek_file(WFile *f, uint64 offset, int whence) { DWORD movemethod; switch (whence) { case FROM_START: movemethod = FILE_BEGIN; break; case FROM_CURRENT: movemethod = FILE_CURRENT; break; case FROM_END: movemethod = FILE_END; break; default: return -1; } { LONG lo = offset.lo, hi = offset.hi; SetFilePointer(f->h, lo, &hi, movemethod); } if (GetLastError() != NO_ERROR) return -1; else return 0; } uint64 get_file_posn(WFile *f) { uint64 ret; LONG lo, hi = 0; lo = SetFilePointer(f->h, 0L, &hi, FILE_CURRENT); ret.lo = lo; ret.hi = hi; return ret; } int file_type(const char *name) { DWORD attr; wchar_t* wname = utf8_to_wide(name); if (!wname) return FILE_TYPE_NONEXISTENT; attr = GetFileAttributesW(wname); sfree(wname); /* We know of no `weird' files under Windows. */ if (attr == (DWORD)-1) return FILE_TYPE_NONEXISTENT; else if (attr & FILE_ATTRIBUTE_DIRECTORY) return FILE_TYPE_DIRECTORY; else return FILE_TYPE_FILE; } struct DirHandle { HANDLE h; char *name; }; DirHandle *open_directory(const char *name) { HANDLE h; WIN32_FIND_DATAW fdat; char *findfile; wchar_t *wfindfile; DirHandle *ret; /* Enumerate files in dir `foo'. */ findfile = dupcat(name, "/*", NULL); wfindfile = utf8_to_wide(findfile); if (!wfindfile) return NULL; h = FindFirstFileW(wfindfile, &fdat); if (h == INVALID_HANDLE_VALUE) return NULL; sfree(wfindfile); sfree(findfile); ret = snew(DirHandle); ret->h = h; ret->name = wide_to_utf8(fdat.cFileName); return ret; } char *read_filename(DirHandle *dir) { do { if (!dir->name) { WIN32_FIND_DATAW fdat; int ok = FindNextFileW(dir->h, &fdat); if (!ok) return NULL; else dir->name = wide_to_utf8(fdat.cFileName); } assert(dir->name); if (dir->name[0] == '.' && (dir->name[1] == '\0' || (dir->name[1] == '.' && dir->name[2] == '\0'))) { sfree(dir->name); dir->name = NULL; } } while (!dir->name); if (dir->name) { char *ret = dir->name; dir->name = NULL; return ret; } else return NULL; } void close_directory(DirHandle *dir) { FindClose(dir->h); if (dir->name) sfree(dir->name); sfree(dir); } int test_wildcard(const char *name, int cmdline) { HANDLE fh; WIN32_FIND_DATAW fdat; wchar_t* wname = utf8_to_wide(name); if (!wname) return WCTYPE_NONEXISTENT; /* First see if the exact name exists. */ if (GetFileAttributesW(wname) != (DWORD)-1) { sfree(wname); return WCTYPE_FILENAME; } /* Otherwise see if a wildcard match finds anything. */ fh = FindFirstFileW(wname, &fdat); if (fh == INVALID_HANDLE_VALUE) { sfree(wname); return WCTYPE_NONEXISTENT; } sfree(wname); FindClose(fh); return WCTYPE_WILDCARD; } struct WildcardMatcher { HANDLE h; char *name; char *srcpath; }; char *stripslashes(const char *str, int local) { char *p; /* * On Windows, \ / : are all path component separators. */ if (local) { p = strchr(str, ':'); if (p) str = p+1; } p = strrchr(str, '/'); if (p) str = p+1; if (local) { p = strrchr(str, '\\'); if (p) str = p+1; } return (char *)str; } WildcardMatcher *begin_wildcard_matching(const char *name) { HANDLE h; WIN32_FIND_DATA fdat; WildcardMatcher *ret; char *last; h = FindFirstFile(name, &fdat); if (h == INVALID_HANDLE_VALUE) return NULL; ret = snew(WildcardMatcher); ret->h = h; ret->srcpath = dupstr(name); last = stripslashes(ret->srcpath, 1); *last = '\0'; if (fdat.cFileName[0] == '.' && (fdat.cFileName[1] == '\0' || (fdat.cFileName[1] == '.' && fdat.cFileName[2] == '\0'))) ret->name = NULL; else ret->name = dupcat(ret->srcpath, fdat.cFileName, NULL); return ret; } char *wildcard_get_filename(WildcardMatcher *dir) { while (!dir->name) { WIN32_FIND_DATA fdat; int ok = FindNextFile(dir->h, &fdat); if (!ok) return NULL; if (fdat.cFileName[0] == '.' && (fdat.cFileName[1] == '\0' || (fdat.cFileName[1] == '.' && fdat.cFileName[2] == '\0'))) dir->name = NULL; else dir->name = dupcat(dir->srcpath, fdat.cFileName, NULL); } if (dir->name) { char *ret = dir->name; dir->name = NULL; return ret; } else return NULL; } void finish_wildcard_matching(WildcardMatcher *dir) { FindClose(dir->h); if (dir->name) sfree(dir->name); sfree(dir->srcpath); sfree(dir); } int vet_filename(const char *name) { if (strchr(name, '/') || strchr(name, '\\') || strchr(name, ':')) return FALSE; if (!name[strspn(name, ".")]) /* entirely composed of dots */ return FALSE; return TRUE; } int create_directory(const char *name) { int res; wchar_t *wname = utf8_to_wide(name); if (!wname) return 0; res = CreateDirectoryW(wname, NULL) != 0; sfree(wname); return res; } char *dir_file_cat(const char *dir, const char *file) { return dupcat(dir, "\\", file, NULL); } /* ---------------------------------------------------------------------- * Platform-specific network handling. */ /* * Be told what socket we're supposed to be using. */ static SOCKET sftp_ssh_socket = INVALID_SOCKET; static HANDLE netevent = INVALID_HANDLE_VALUE; char *do_select(SOCKET skt, int startup) { int events; if (startup) sftp_ssh_socket = skt; else sftp_ssh_socket = INVALID_SOCKET; if (p_WSAEventSelect) { if (startup) { events = (FD_CONNECT | FD_READ | FD_WRITE | FD_OOB | FD_CLOSE | FD_ACCEPT); netevent = CreateEvent(NULL, FALSE, FALSE, NULL); } else { events = 0; } if (p_WSAEventSelect(skt, netevent, events) == SOCKET_ERROR) { switch (p_WSAGetLastError()) { case WSAENETDOWN: return "Network is down"; default: return "WSAEventSelect(): unknown error"; } } } return NULL; } int do_eventsel_loop(HANDLE other_event) { int n, nhandles, nallhandles, netindex, otherindex; unsigned long next, then; long ticks; HANDLE *handles; SOCKET *sklist; int skcount; unsigned long now = GETTICKCOUNT(); if (toplevel_callback_pending()) { ticks = 0; next = now; } else if (run_timers(now, &next)) { then = now; now = GETTICKCOUNT(); if (now - then > next - then) ticks = 0; else ticks = next - now; } else { ticks = INFINITE; /* no need to initialise next here because we can never get * WAIT_TIMEOUT */ } handles = handle_get_events(&nhandles); handles = sresize(handles, nhandles+2, HANDLE); nallhandles = nhandles; if (netevent != INVALID_HANDLE_VALUE) handles[netindex = nallhandles++] = netevent; else netindex = -1; if (other_event != INVALID_HANDLE_VALUE) handles[otherindex = nallhandles++] = other_event; else otherindex = -1; n = WaitForMultipleObjects(nallhandles, handles, FALSE, ticks); if ((unsigned)(n - WAIT_OBJECT_0) < (unsigned)nhandles) { handle_got_event(handles[n - WAIT_OBJECT_0]); } else if (netindex >= 0 && n == WAIT_OBJECT_0 + netindex) { WSANETWORKEVENTS things; SOCKET socket; extern SOCKET first_socket(int *), next_socket(int *); int i, socketstate; /* * We must not call select_result() for any socket * until we have finished enumerating within the * tree. This is because select_result() may close * the socket and modify the tree. */ /* Count the active sockets. */ i = 0; for (socket = first_socket(&socketstate); socket != INVALID_SOCKET; socket = next_socket(&socketstate)) i++; /* Expand the buffer if necessary. */ sklist = snewn(i, SOCKET); /* Retrieve the sockets into sklist. */ skcount = 0; for (socket = first_socket(&socketstate); socket != INVALID_SOCKET; socket = next_socket(&socketstate)) { sklist[skcount++] = socket; } /* Now we're done enumerating; go through the list. */ for (i = 0; i < skcount; i++) { WPARAM wp; socket = sklist[i]; wp = (WPARAM) socket; if (!p_WSAEnumNetworkEvents(socket, NULL, &things)) { static const struct { int bit, mask; } eventtypes[] = { {FD_CONNECT_BIT, FD_CONNECT}, {FD_READ_BIT, FD_READ}, {FD_CLOSE_BIT, FD_CLOSE}, {FD_OOB_BIT, FD_OOB}, {FD_WRITE_BIT, FD_WRITE}, {FD_ACCEPT_BIT, FD_ACCEPT}, }; int e; noise_ultralight(socket); noise_ultralight(things.lNetworkEvents); for (e = 0; e < lenof(eventtypes); e++) if (things.lNetworkEvents & eventtypes[e].mask) { LPARAM lp; int err = things.iErrorCode[eventtypes[e].bit]; lp = WSAMAKESELECTREPLY(eventtypes[e].mask, err); select_result(wp, lp); } } } sfree(sklist); } sfree(handles); run_toplevel_callbacks(); if (n == WAIT_TIMEOUT) { now = next; } else { now = GETTICKCOUNT(); } if (otherindex >= 0 && n == WAIT_OBJECT_0 + otherindex) return 1; return 0; } /* * Wait for some network data and process it. * * We have two variants of this function. One uses select() so that * it's compatible with WinSock 1. The other uses WSAEventSelect * and MsgWaitForMultipleObjects, so that we can consistently use * WSAEventSelect throughout; this enables us to also implement * ssh_sftp_get_cmdline() using a parallel mechanism. */ int ssh_sftp_loop_iteration(void) { if (p_WSAEventSelect == NULL) { fd_set readfds; int ret; unsigned long now = GETTICKCOUNT(), then; if (sftp_ssh_socket == INVALID_SOCKET) return -1; /* doom */ if (socket_writable(sftp_ssh_socket)) select_result((WPARAM) sftp_ssh_socket, (LPARAM) FD_WRITE); do { unsigned long next; long ticks; struct timeval tv, *ptv; if (run_timers(now, &next)) { then = now; now = GETTICKCOUNT(); if (now - then > next - then) ticks = 0; else ticks = next - now; tv.tv_sec = ticks / 1000; tv.tv_usec = ticks % 1000 * 1000; ptv = &tv; } else { ptv = NULL; } FD_ZERO(&readfds); FD_SET(sftp_ssh_socket, &readfds); ret = p_select(1, &readfds, NULL, NULL, ptv); if (ret < 0) return -1; /* doom */ else if (ret == 0) now = next; else now = GETTICKCOUNT(); } while (ret == 0); select_result((WPARAM) sftp_ssh_socket, (LPARAM) FD_READ); return 0; } else { return do_eventsel_loop(INVALID_HANDLE_VALUE); } } /* * Read a command line from standard input. * * In the presence of WinSock 2, we can use WSAEventSelect to * mediate between the socket and stdin, meaning we can send * keepalives and respond to server events even while waiting at * the PSFTP command prompt. Without WS2, we fall back to a simple * fgets. */ struct command_read_ctx { HANDLE event; char *line; }; static DWORD WINAPI command_read_thread(void *param) { struct command_read_ctx *ctx = (struct command_read_ctx *) param; ctx->line = fgetline(stdin); SetEvent(ctx->event); return 0; } char *ssh_sftp_get_cmdline(const char *prompt, int no_fds_ok) { int ret; struct command_read_ctx actx, *ctx = &actx; DWORD threadid; HANDLE hThread; /* Not used in fzsftp fputs(prompt, stdout); fflush(stdout); */ if ((sftp_ssh_socket == INVALID_SOCKET && no_fds_ok) || p_WSAEventSelect == NULL) { return fgetline(stdin); /* very simple */ } /* * Create a second thread to read from stdin. Process network * and timing events until it terminates. */ ctx->event = CreateEvent(NULL, FALSE, FALSE, NULL); ctx->line = NULL; hThread = CreateThread(NULL, 0, command_read_thread, ctx, 0, &threadid); if (!hThread) { CloseHandle(ctx->event); fzprintf(sftpError, "Unable to create command input thread"); cleanup_exit(1); } do { ret = do_eventsel_loop(ctx->event); /* Error return can only occur if netevent==NULL, and it ain't. */ assert(ret >= 0); } while (ret == 0); CloseHandle(hThread); CloseHandle(ctx->event); return ctx->line; } void platform_psftp_pre_conn_setup(void) { if (restricted_acl) { logevent(NULL, "Running with restricted process ACL"); } } /* ---------------------------------------------------------------------- * Main program. Parse arguments etc. */ int main(int argc, char *argv[]) { int ret; dll_hijacking_protection(); ret = psftp_main(argc, argv); return ret; }
madnight/filezilla
src/putty/windows/winsftp.c
C
gpl-2.0
17,741
[ 30522, 1013, 1008, 1008, 5222, 6199, 2361, 1012, 1039, 1024, 1996, 3645, 1011, 3563, 3033, 1997, 8827, 6199, 2361, 1998, 8827, 21906, 1012, 1008, 1013, 1001, 2421, 1026, 5222, 7432, 2475, 1012, 1044, 30524, 2404, 2023, 2034, 1010, 2005, 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...
package com.charmyin.cmstudio.basic.authorize.service.impl; import java.util.List; import javax.annotation.Resource; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Service; import com.charmyin.cmstudio.basic.authorize.persistence.MenuMapper; import com.charmyin.cmstudio.basic.authorize.service.MenuService; import com.charmyin.cmstudio.basic.authorize.vo.Menu; @Service public class MenuServiceImpl implements MenuService { @Resource private MenuMapper menuMapper ; @Override /*@RequiresPermissions("menu:getallxx")*/ public List<Menu> getAllMenu() { List<Menu> menuList = menuMapper.getAllMenu(); return menuList; } @Override public List<Menu> getChildrenMenus(int parentId) { Menu menu = new Menu(); menu.setParentId(parentId); List<Menu> menuList = menuMapper.getMenuEqual(menu); return menuList; } @Override public void insertMenu(Menu menu){ menuMapper.insertMenu(menu); } @Override public void updateMenu(Menu menu) { menuMapper.updateMenu(menu); } @Override public void deleteMenu(int[] ids) { for(int id : ids){ menuMapper.deleteMenu(id); } } @Override public List<Menu> searchMenu(Menu menu) { List<Menu> menuList = menuMapper.getMenuEqual(menu); return menuList; } @Override public Menu getMenuById(int id) { Menu menu = menuMapper.getMenuById(id); return menu; } @Override public List<Menu> getMenuByRole() { return null; } @Override public List<Menu> getMenuByUser() { // TODO Auto-generated method stub return null; } public MenuMapper getMenuMapper() { return menuMapper; } public void setMenuMapper(MenuMapper menuMapper) { this.menuMapper = menuMapper; } }
Feolive/EmploymentWebsite
src/main/java/com/charmyin/cmstudio/basic/authorize/service/impl/MenuServiceImpl.java
Java
mit
1,729
[ 30522, 7427, 4012, 1012, 11084, 25811, 1012, 4642, 3367, 21041, 2080, 1012, 3937, 1012, 3166, 4697, 1012, 2326, 1012, 17727, 2140, 1025, 12324, 9262, 1012, 21183, 4014, 1012, 2862, 1025, 12324, 9262, 2595, 1012, 5754, 17287, 3508, 1012, 769...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 /** * @var TbActiveForm $form */ $this->title = Yii::t('UserModule.user', 'Password recovery'); $this->breadcrumbs = [Yii::t('UserModule.user', 'Password recovery')]; ?> <?php $this->widget('yupe\widgets\YFlashMessages'); ?> <?php $form = $this->beginWidget( 'bootstrap.widgets.TbActiveForm', [ 'id' => 'registration-form', 'type' => 'vertical', 'htmlOptions' => [ 'class' => 'well', ] ] ); ?> <?= $form->errorSummary($model); ?> <div class='row'> <div class="col-sm-6 col-sm-offset-1"> <?= $form->textFieldGroup($model, 'email', [ 'hint' => Yii::t('UserModule.user', 'Enter an email you have used during signup'), 'labelOptions' => [ 'label' => false ] ]); ?> </div> <div class="col-sm-3 text-center"> <?php $this->widget( 'bootstrap.widgets.TbButton', [ 'buttonType' => 'submit', 'context' => 'primary', 'label' => Yii::t('UserModule.user', 'Recover password'), ] ); ?> </div> </div> <?php $this->endWidget(); ?>
u4aew/MyHotelG
themes/default/views/user/account/recovery.php
PHP
bsd-3-clause
1,174
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1030, 13075, 26419, 19620, 14192, 1002, 2433, 1008, 1013, 1002, 2023, 1011, 1028, 2516, 1027, 12316, 2072, 1024, 1024, 1056, 1006, 1005, 5310, 5302, 8566, 2571, 1012, 5310, 1005, 1010, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<div id="helpHTMLWrapper" style="padding:8px 18px;max-width:640px;margin:0 auto"> <h2>JavaScript Code Tracker <span id="jsctAbbr" style="font-weight:normal;font-size:.9em">(JSCT)</span></h2> <div id="firstUseContent" style="display:none;margin-bottom:22px;"> <p><span class="hiliteText">Welcome!</span> It looks like this is your first visit with this browser. To get you started several Backbone-related items have been created and added to the db. You can edit, delete, or add to these items.</p> </div> <div style="border: 1px solid green; border-bottom:none; background-color:#ffffcc;padding:10px;margin-top:10px;"> <h3 style="margin:0 0 9px 0;font-size:1.1em">tl;dr</h3> <p class=pseudoBullet>&#10003;<span class=pseudoBulletContent>this application demos basic features of SPAs and Backbone</span></p> <p class=pseudoBullet>&#10003;<span class=pseudoBulletContent>it's targeted at intermediate JavaScript developers new to Backbone</span></p> <p class=pseudoBullet>&#10003;<span class=pseudoBulletContent>commented code accessible via developer tools like Chrome devtools and on <a target="_blank" href="https://github.com/dangNYC/jsct">github</a></span> </p> <p class=pseudoBullet>&#10003;<span class=pseudoBulletContent>detailed info on architecture and more in <a target="_blank" href="/primers/JSCT_SPA_Backbone_demo_app.php">JSCT Overview post</a></span></p> </div> <div style="border: 1px solid green; background-color:#FFCCFF;padding:10px;"> <p class=pseudoBullet>&#10003;<span class=pseudoBulletContent>this isn't a "real" application, just a vehicle for exploring Backbone</span></p> <p class=pseudoBullet>&#10003;<span class=pseudoBulletContent>requires modern browsers with HTML5, CSS3, localStorage, and Flexbox support</span></p> <p class=pseudoBullet>&#10003;<span class=pseudoBulletContent>uses localStorage as its data store, which means <em>all data is specific to a browser instance</em> (i.e. different db for each browser)</span></p> </div> <h3>JSCT Overview</h3> <p>This application demonstrates features of <a target="_blank" href="http://en.wikipedia.org/wiki/Single-page_application">Single Page Applications</a> (SPAs) and the <a target="_blank" href="http://backbonejs.org/">Backbone</a> MV* architecture lib.</p> <p>The code and associated <a target="_blank" href="/primers/JSCT_SPA_Backbone_demo_app.php">JSCT Overview post</a> are targeted at intermediate JavaScript programmers just getting started with Backbone. </p> <p class="listLeader">As with Addy Osmani's <a target="_blank" href="http://todomvc.com/examples/backbone/">TodoMVC Backbone sample application</a> (which JSCT builds upon) some fundamental Backbone functionality is demo'd here: </p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>seperation of model and view via Backbone classes Model, View, Collection</span></p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>loose coupling through built-in Backbone events</span></p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>application navigation/bookmarking through Backbone Router</span></p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>CRUD through Backbone methods <em>create</em>, <em>fetch</em>, <em>save</em>, <em>destroy</em>, etc.</span></p> <p class="listLeader">In addition, some more general JavaScript application principles are demonstrated:</p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>general good coding practices such as loose coupling via pubsub, use of templates, use of an application namespace, etc.</span></p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>responsive design to handle browser resize and mobile browsers</span></p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>localStorage is used to save/restore user sessions</span></p> <p>As with the Backbone TodoMVC sample application app you should NOT consider this a model Backbone app &#8212; this demo app is very simple and uses implementations that might not scale well in large, real-world applications. </p> <p class="commentBox" style="background-color:#FFCCFF"> NOTE: This demo app is written for modern browsers and doesn't polyfill missing features into older browsers. Specifically, it requires browser support for HTML5, CSS3, JS ES5 and localStorage. It also uses scrolling divs (i.e. CSS overflow:scroll, so not supported on Android 2.x stock browser) and it also uses Flexbox (lack of support is mostly IE9 and earlier).</p> <p>For general info on this demo app see <a target="_blank" href="/primers/JSCT_SPA_Backbone_demo_app.php#_jsct_overview">Application Overview</a> section of my JSCT Overview post.</p> <p> To browse the database use the <a href="#home">list view</a>. From list view you can select an item to view/modify.</p> <h3>Application purpose and features</h3> <p>On the surface JSCT's purpose is to help you keep track of coding tips and traps, sample code, useful sample applications, etc. However, it's really just a vehicle for exploring Backbone. In that regard it's similar to the very useful <a href="http://todomvc.com/examples/backbone/" target="_blank">TodoMVC Backbone sample application</a>, letting you see a simple Backbone application in action while providing well commented source code and an in-depth description of the application architecture. In fact JSCT uses the TodoMVC application as its model and starting point, extending it and in some places restructuring it to demo more Backbone features. </p> <p class="commentBox" style="background-color: #ffffcc">If you're a total Backbone noob you should start with the TodoMVC sample application, it's simpler than JSCT so is better for grok'ing the fundamentals. Moreover, Osmani has an in-depth analysis of TodoMVC in <a target="_blank" href="http://addyosmani.github.io/backbone-fundamentals/">his online Backbone book</a>.</p> <p>As with the TodoMVC Backbone sample app, this JS Code Tracker (JSCT) demo app lets you do CRUD on a simple dataset. In the TODOs demo app you work with a list of tasks, here the data is focused on keeping track of coding tips and traps, sample applications, etc. </p> <p>This demo app also uses more views and more nested views than the TODOs demo app, makes greater uses of Backbone routing, and throws in some other architectural pieces like an application model, use of pubsub, and some crude use of state machine. </p> <p>For info on this demo app's Architecture see my JSCT Overview post's <a target="_blank" href="/primers/JSCT_SPA_Backbone_demo_app.php#_jsct_architecture">Architecture section</a>.</p> <h3>Usage notes</h3> <p class="listLeader">Here's what JSCT lets you do<strong>...</strong></p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>store and manage info on coding related tips, techniques, useful sites (these are the "tracks" of JSCT)</span></p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>display summary list of items or display all details for a single item</span></p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>categorize items and filter visible items by content and category</span></p> <p class=pseudoBullet>&#10027;<span class=pseudoBulletContent>tag items for quick access and display only tagged items</span></p> <br/> <p><strong>...</strong>and here's how you do it:</p> <h4>View navigation</h4> <p class="snug">use icon buttons at upper right and your browser Back and Forward buttons. On smaller screens a 'home' button will appear at upper left</p> <h4>List view (home view)</h4> <p class="snug">shows all data in a scrollable list. This list can be filtered using criteria you enter on the filterBar (see next item)</p> <h4>Filter Bar</h4> <p class="snug">Near the top of the screen is a group of contols that let you subset the data. You can subset by a case-insensitive string search and/or by type (described below) and/or by tagged status (see next item) </p> <h4>Tagging items</h4> <p class="snug">in the scrollable list you can tag an item for quick access by selecting its 'star'. Use the FilterBar to show only 'starred' items.</p> <h4>Browse/Edit</h4> <p class="snug">to view or edit data for an item click its green arrow button in list view </p> <h4>Create new item</h4> <p class="snug">use the '+' button at upper right to create an item. URLs you enter must use full valid format including the 'http://'. </p> <h4>CodeTrack Types </h4> <p style="margin:0 0 0 5px"> Items are categorized as follows:</p> <p class="snug"><span class="codeTrackType">tip</span>: smart coding practices, shortcuts, etc.</p> <p class="snug"><span class="codeTrackType">trap</span>: dumb coding practices, gotchas, antipatterns, etc.</p> <p class="snug"><span class="codeTrackType">bookmark</span>: functionally the same as a browser bookmark </p> <p class="snug"><span class="codeTrackType">demo app</span>: specialized bookmark - for live demo of features, techniques, etc.</p> <p class="snug"><span class="codeTrackType">other</span>: catchall (a 'real' app might allow user-defined categories)</p> <p class="commentBox" style="background-color: #ffffcc">Usage notes are also summarized in the first item of the sample data.</p> <p> To browse the database use the <a href="#home">list view</a>. From list view you can select an item to view/modify.</p> <br/><br/> </div>
dangNYC/jsct
help.html
HTML
mit
9,653
[ 30522, 1026, 4487, 2615, 8909, 1027, 1000, 2393, 11039, 19968, 13088, 29098, 2121, 1000, 2806, 1027, 1000, 11687, 4667, 1024, 1022, 2361, 2595, 2324, 2361, 2595, 1025, 4098, 1011, 9381, 1024, 19714, 2361, 2595, 1025, 7785, 1024, 1014, 8285,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
sap.ui.jsview(ui5nameSpace, { // define the (default) controller type for this View getControllerName: function() { return "my.own.controller"; }, // defines the UI of this View createContent: function(oController) { // button text is bound to Model, "press" action is bound to Controller's event handler return; } });
Ryan-Boyd/ui5-artisan
lib/stubs/views/PlainView.js
JavaScript
gpl-3.0
368
[ 30522, 20066, 1012, 21318, 1012, 1046, 2015, 8584, 1006, 21318, 2629, 18442, 23058, 1010, 1063, 1013, 1013, 9375, 1996, 1006, 12398, 1007, 11486, 2828, 2005, 2023, 3193, 2131, 8663, 13181, 10820, 18442, 1024, 3853, 1006, 1007, 1063, 2709, 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...
// String literal types are only valid in overload signatures function foo(x: any); function foo(x: 'hi') { } class C { foo(x: string); foo(x: 'hi') { } } interface I { (x: 'a'); (x: 'hi'); foo(x: 'a', y: 'a'); foo(x: 'hi', y: 'hi'); } var a: { (x: 'hi'); (x: 'a'); foo(x: 'hi'); foo(x: 'a'); } var b = { foo(x: 'hi') { }, foo(x: 'a') { }, }
Pajn/prettier
tests/typescript/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts
TypeScript
mit
395
[ 30522, 1013, 1013, 5164, 18204, 4127, 2024, 2069, 9398, 1999, 2058, 11066, 16442, 3853, 29379, 1006, 1060, 1024, 2151, 1007, 1025, 3853, 29379, 1006, 1060, 1024, 1005, 7632, 1005, 1007, 1063, 1065, 2465, 1039, 1063, 29379, 1006, 1060, 1024,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// // AnnotatedImage+Create.h // DetectMe // // Created by Josep Marc Mingot Hidalgo on 11/10/13. // Copyright (c) 2013 Josep Marc Mingot Hidalgo. All rights reserved. // #import <CoreLocation/CoreLocation.h> #import <coreMotion/CoreMotion.h> #import "AnnotatedImage.h" #import "Detector.h" #import "Box.h" @interface AnnotatedImage (Create) + (AnnotatedImage *) annotatedImageWithImage:(UIImage *)image box:(Box *)box forLocation:(CLLocation *) location forMotion:(CMDeviceMotion *) motion forUser:(User *)currentUser inManagedObjectContext:(NSManagedObjectContext *)context; + (AnnotatedImage *) annotatedImageWithDictionaryInfo:(NSDictionary *)annotatedImageInfo inManagedObjectContext:(NSManagedObjectContext *)context forDetector:(Detector *)detector; - (Box *) boxForAnnotatedImage; - (void) setBox:(Box *) box; @end
mingot/detectme
CoreData/AnnotatedImage+Create.h
C
mit
1,075
[ 30522, 1013, 1013, 1013, 1013, 5754, 17287, 3064, 9581, 3351, 1009, 3443, 1012, 1044, 1013, 1013, 11487, 4168, 1013, 1013, 1013, 1013, 2580, 2011, 4560, 2361, 7871, 11861, 4140, 24715, 2006, 2340, 1013, 2184, 1013, 2410, 1012, 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...
<?php namespace App; use Illuminate\Database\Eloquent\Model; class TraningToWeek extends Model { protected $table = 'training_OfWeeks'; protected $guarded = array('id'); /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'id_training_detail', 'numDay', 'start_time','end_time' ]; public function getTrainingDetail(){ return $this->hasOne('App\TraningDetails','id','id_training_detail'); } }
MILLKA3000/endorfine_dashboard
app/TraningToWeek.php
PHP
mit
499
[ 30522, 1026, 1029, 25718, 3415, 15327, 10439, 1025, 2224, 5665, 12717, 12556, 1032, 7809, 1032, 3449, 2080, 15417, 1032, 2944, 1025, 2465, 25283, 2075, 18790, 4402, 2243, 8908, 2944, 1063, 5123, 1002, 2795, 1027, 1005, 2731, 1035, 1997, 280...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
/* * PROJECT: ReactOS i8042 (ps/2 keyboard-mouse controller) driver * LICENSE: GPL - See COPYING in the top level directory * FILE: drivers/input/i8042prt/pnp.c * PURPOSE: IRP_MJ_PNP operations * PROGRAMMERS: Copyright 2006-2007 Hervé Poussineau (hpoussin@reactos.org) * Copyright 2008 Colin Finck (mail@colinfinck.de) */ /* INCLUDES ******************************************************************/ #include "i8042prt.h" #include <debug.h> /* FUNCTIONS *****************************************************************/ /* This is all pretty confusing. There's more than one way to * disable/enable the keyboard. You can send KBD_ENABLE to the * keyboard, and it will start scanning keys. Sending KBD_DISABLE * will disable the key scanning but also reset the parameters to * defaults. * * You can also send 0xAE to the controller for enabling the * keyboard clock line and 0xAD for disabling it. Then it'll * automatically get turned on at the next command. The last * way is by modifying the bit that drives the clock line in the * 'command byte' of the controller. This is almost, but not quite, * the same as the AE/AD thing. The difference can be used to detect * some really old broken keyboard controllers which I hope won't be * necessary. * * We change the command byte, sending KBD_ENABLE/DISABLE seems to confuse * some kvm switches. */ BOOLEAN i8042ChangeMode( IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR FlagsToDisable, IN UCHAR FlagsToEnable) { UCHAR Value; NTSTATUS Status; if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, KBD_READ_MODE)) { WARN_(I8042PRT, "Can't read i8042 mode\n"); return FALSE; } Status = i8042ReadDataWait(DeviceExtension, &Value); if (!NT_SUCCESS(Status)) { WARN_(I8042PRT, "No response after read i8042 mode\n"); return FALSE; } Value &= ~FlagsToDisable; Value |= FlagsToEnable; if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, KBD_WRITE_MODE)) { WARN_(I8042PRT, "Can't set i8042 mode\n"); return FALSE; } if (!i8042Write(DeviceExtension, DeviceExtension->DataPort, Value)) { WARN_(I8042PRT, "Can't send i8042 mode\n"); return FALSE; } return TRUE; } static NTSTATUS i8042BasicDetect( IN PPORT_DEVICE_EXTENSION DeviceExtension) { NTSTATUS Status; ULONG ResendIterations; UCHAR Value = 0; /* Don't enable keyboard and mouse interrupts, disable keyboard/mouse */ i8042Flush(DeviceExtension); if (!i8042ChangeMode(DeviceExtension, CCB_KBD_INT_ENAB | CCB_MOUSE_INT_ENAB, CCB_KBD_DISAB | CCB_MOUSE_DISAB)) return STATUS_IO_DEVICE_ERROR; i8042Flush(DeviceExtension); /* Issue a CTRL_SELF_TEST command to check if this is really an i8042 controller */ ResendIterations = DeviceExtension->Settings.ResendIterations + 1; while (ResendIterations--) { if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, CTRL_SELF_TEST)) { WARN_(I8042PRT, "Writing CTRL_SELF_TEST command failed\n"); return STATUS_IO_TIMEOUT; } Status = i8042ReadDataWait(DeviceExtension, &Value); if (!NT_SUCCESS(Status)) { WARN_(I8042PRT, "Failed to read CTRL_SELF_TEST response, status 0x%08lx\n", Status); return Status; } if (Value == KBD_SELF_TEST_OK) { INFO_(I8042PRT, "CTRL_SELF_TEST completed successfully!\n"); break; } else if (Value == KBD_RESEND) { TRACE_(I8042PRT, "Resending...\n"); KeStallExecutionProcessor(50); } else { WARN_(I8042PRT, "Got 0x%02x instead of 0x55\n", Value); return STATUS_IO_DEVICE_ERROR; } } return STATUS_SUCCESS; } static VOID i8042DetectKeyboard( IN PPORT_DEVICE_EXTENSION DeviceExtension) { NTSTATUS Status; /* Set LEDs (that is not fatal if some error occurs) */ Status = i8042SynchWritePort(DeviceExtension, 0, KBD_CMD_SET_LEDS, TRUE); if (NT_SUCCESS(Status)) { Status = i8042SynchWritePort(DeviceExtension, 0, 0, TRUE); if (!NT_SUCCESS(Status)) { WARN_(I8042PRT, "Can't finish SET_LEDS (0x%08lx)\n", Status); return; } } else { WARN_(I8042PRT, "Warning: can't write SET_LEDS (0x%08lx)\n", Status); } /* Turn on translation and SF (Some machines don't reboot if SF is not set, see ReactOS bug CORE-1713) */ if (!i8042ChangeMode(DeviceExtension, 0, CCB_TRANSLATE | CCB_SYSTEM_FLAG)) return; /* * We used to send a KBD_LINE_TEST (0xAB) command, but on at least HP * Pavilion notebooks the response to that command was incorrect. * So now we just assume that a keyboard is attached. */ DeviceExtension->Flags |= KEYBOARD_PRESENT; INFO_(I8042PRT, "Keyboard detected\n"); } static VOID i8042DetectMouse( IN PPORT_DEVICE_EXTENSION DeviceExtension) { NTSTATUS Status; UCHAR Value; UCHAR ExpectedReply[] = { MOUSE_ACK, 0xAA }; UCHAR ReplyByte; /* First do a mouse line test */ if (i8042Write(DeviceExtension, DeviceExtension->ControlPort, MOUSE_LINE_TEST)) { Status = i8042ReadDataWait(DeviceExtension, &Value); if (!NT_SUCCESS(Status) || Value != 0) { WARN_(I8042PRT, "Mouse line test failed\n"); goto failure; } } /* Now reset the mouse */ i8042Flush(DeviceExtension); if(!i8042IsrWritePort(DeviceExtension, MOU_CMD_RESET, CTRL_WRITE_MOUSE)) { WARN_(I8042PRT, "Failed to write reset command to mouse\n"); goto failure; } /* The implementation of the "Mouse Reset" command differs much from chip to chip. By default, the first byte is an ACK, when the mouse is plugged in and working and NACK when it's not. On success, the next bytes are 0xAA and 0x00. But on some systems (like ECS K7S5A Pro, SiS 735 chipset), we always get an ACK and 0xAA. Only the last byte indicates, whether a mouse is plugged in. It is either sent or not, so there is no byte, which indicates a failure here. After the Mouse Reset command was issued, it usually takes some time until we get a response. So get the first two bytes in a loop. */ for (ReplyByte = 0; ReplyByte < sizeof(ExpectedReply) / sizeof(ExpectedReply[0]); ReplyByte++) { ULONG Counter = 500; do { Status = i8042ReadDataWait(DeviceExtension, &Value); if(!NT_SUCCESS(Status)) { /* Wait some time before trying again */ KeStallExecutionProcessor(50); } } while (Status == STATUS_IO_TIMEOUT && Counter--); if (!NT_SUCCESS(Status)) { WARN_(I8042PRT, "No ACK after mouse reset, status 0x%08lx\n", Status); goto failure; } else if (Value != ExpectedReply[ReplyByte]) { WARN_(I8042PRT, "Unexpected reply: 0x%02x (expected 0x%02x)\n", Value, ExpectedReply[ReplyByte]); goto failure; } } /* Finally get the third byte, but only try it one time (see above). Otherwise this takes around 45 seconds on a K7S5A Pro, when no mouse is plugged in. */ Status = i8042ReadDataWait(DeviceExtension, &Value); if(!NT_SUCCESS(Status)) { WARN_(I8042PRT, "Last byte was not transmitted after mouse reset, status 0x%08lx\n", Status); goto failure; } else if(Value != 0x00) { WARN_(I8042PRT, "Last byte after mouse reset was not 0x00, but 0x%02x\n", Value); goto failure; } DeviceExtension->Flags |= MOUSE_PRESENT; INFO_(I8042PRT, "Mouse detected\n"); return; failure: /* There is probably no mouse present. On some systems, the probe locks the entire keyboard controller. Let's try to get access to the keyboard again by sending a reset */ i8042Flush(DeviceExtension); i8042Write(DeviceExtension, DeviceExtension->ControlPort, CTRL_SELF_TEST); i8042ReadDataWait(DeviceExtension, &Value); i8042Flush(DeviceExtension); INFO_(I8042PRT, "Mouse not detected\n"); } static NTSTATUS i8042ConnectKeyboardInterrupt( IN PI8042_KEYBOARD_EXTENSION DeviceExtension) { PPORT_DEVICE_EXTENSION PortDeviceExtension; KIRQL DirqlMax; NTSTATUS Status; TRACE_(I8042PRT, "i8042ConnectKeyboardInterrupt()\n"); PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; DirqlMax = MAX( PortDeviceExtension->KeyboardInterrupt.Dirql, PortDeviceExtension->MouseInterrupt.Dirql); INFO_(I8042PRT, "KeyboardInterrupt.Vector %lu\n", PortDeviceExtension->KeyboardInterrupt.Vector); INFO_(I8042PRT, "KeyboardInterrupt.Dirql %lu\n", PortDeviceExtension->KeyboardInterrupt.Dirql); INFO_(I8042PRT, "KeyboardInterrupt.DirqlMax %lu\n", DirqlMax); INFO_(I8042PRT, "KeyboardInterrupt.InterruptMode %s\n", PortDeviceExtension->KeyboardInterrupt.InterruptMode == LevelSensitive ? "LevelSensitive" : "Latched"); INFO_(I8042PRT, "KeyboardInterrupt.ShareInterrupt %s\n", PortDeviceExtension->KeyboardInterrupt.ShareInterrupt ? "yes" : "no"); INFO_(I8042PRT, "KeyboardInterrupt.Affinity 0x%lx\n", PortDeviceExtension->KeyboardInterrupt.Affinity); Status = IoConnectInterrupt( &PortDeviceExtension->KeyboardInterrupt.Object, i8042KbdInterruptService, DeviceExtension, &PortDeviceExtension->SpinLock, PortDeviceExtension->KeyboardInterrupt.Vector, PortDeviceExtension->KeyboardInterrupt.Dirql, DirqlMax, PortDeviceExtension->KeyboardInterrupt.InterruptMode, PortDeviceExtension->KeyboardInterrupt.ShareInterrupt, PortDeviceExtension->KeyboardInterrupt.Affinity, FALSE); if (!NT_SUCCESS(Status)) { WARN_(I8042PRT, "IoConnectInterrupt() failed with status 0x%08x\n", Status); return Status; } if (DirqlMax == PortDeviceExtension->KeyboardInterrupt.Dirql) PortDeviceExtension->HighestDIRQLInterrupt = PortDeviceExtension->KeyboardInterrupt.Object; PortDeviceExtension->Flags |= KEYBOARD_INITIALIZED; return STATUS_SUCCESS; } static NTSTATUS i8042ConnectMouseInterrupt( IN PI8042_MOUSE_EXTENSION DeviceExtension) { PPORT_DEVICE_EXTENSION PortDeviceExtension; KIRQL DirqlMax; NTSTATUS Status; TRACE_(I8042PRT, "i8042ConnectMouseInterrupt()\n"); Status = i8042MouInitialize(DeviceExtension); if (!NT_SUCCESS(Status)) return Status; PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; DirqlMax = MAX( PortDeviceExtension->KeyboardInterrupt.Dirql, PortDeviceExtension->MouseInterrupt.Dirql); INFO_(I8042PRT, "MouseInterrupt.Vector %lu\n", PortDeviceExtension->MouseInterrupt.Vector); INFO_(I8042PRT, "MouseInterrupt.Dirql %lu\n", PortDeviceExtension->MouseInterrupt.Dirql); INFO_(I8042PRT, "MouseInterrupt.DirqlMax %lu\n", DirqlMax); INFO_(I8042PRT, "MouseInterrupt.InterruptMode %s\n", PortDeviceExtension->MouseInterrupt.InterruptMode == LevelSensitive ? "LevelSensitive" : "Latched"); INFO_(I8042PRT, "MouseInterrupt.ShareInterrupt %s\n", PortDeviceExtension->MouseInterrupt.ShareInterrupt ? "yes" : "no"); INFO_(I8042PRT, "MouseInterrupt.Affinity 0x%lx\n", PortDeviceExtension->MouseInterrupt.Affinity); Status = IoConnectInterrupt( &PortDeviceExtension->MouseInterrupt.Object, i8042MouInterruptService, DeviceExtension, &PortDeviceExtension->SpinLock, PortDeviceExtension->MouseInterrupt.Vector, PortDeviceExtension->MouseInterrupt.Dirql, DirqlMax, PortDeviceExtension->MouseInterrupt.InterruptMode, PortDeviceExtension->MouseInterrupt.ShareInterrupt, PortDeviceExtension->MouseInterrupt.Affinity, FALSE); if (!NT_SUCCESS(Status)) { WARN_(I8042PRT, "IoConnectInterrupt() failed with status 0x%08x\n", Status); goto cleanup; } if (DirqlMax == PortDeviceExtension->MouseInterrupt.Dirql) PortDeviceExtension->HighestDIRQLInterrupt = PortDeviceExtension->MouseInterrupt.Object; PortDeviceExtension->Flags |= MOUSE_INITIALIZED; Status = STATUS_SUCCESS; cleanup: if (!NT_SUCCESS(Status)) { PortDeviceExtension->Flags &= ~MOUSE_INITIALIZED; if (PortDeviceExtension->MouseInterrupt.Object) { IoDisconnectInterrupt(PortDeviceExtension->MouseInterrupt.Object); PortDeviceExtension->HighestDIRQLInterrupt = PortDeviceExtension->KeyboardInterrupt.Object; } } return Status; } static NTSTATUS EnableInterrupts( IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR FlagsToDisable, IN UCHAR FlagsToEnable) { i8042Flush(DeviceExtension); if (!i8042ChangeMode(DeviceExtension, FlagsToDisable, FlagsToEnable)) return STATUS_UNSUCCESSFUL; return STATUS_SUCCESS; } static NTSTATUS StartProcedure( IN PPORT_DEVICE_EXTENSION DeviceExtension) { NTSTATUS Status = STATUS_UNSUCCESSFUL; UCHAR FlagsToDisable = 0; UCHAR FlagsToEnable = 0; KIRQL Irql; if (DeviceExtension->DataPort == 0) { /* Unable to do something at the moment */ return STATUS_SUCCESS; } if (!(DeviceExtension->Flags & (KEYBOARD_PRESENT | MOUSE_PRESENT))) { /* Try to detect them */ TRACE_(I8042PRT, "Check if the controller is really a i8042\n"); Status = i8042BasicDetect(DeviceExtension); if (!NT_SUCCESS(Status)) { WARN_(I8042PRT, "i8042BasicDetect() failed with status 0x%08lx\n", Status); return STATUS_UNSUCCESSFUL; } /* First detect the mouse and then the keyboard! If we do it the other way round, some systems throw away settings like the keyboard translation, when detecting the mouse. */ TRACE_(I8042PRT, "Detecting mouse\n"); i8042DetectMouse(DeviceExtension); TRACE_(I8042PRT, "Detecting keyboard\n"); i8042DetectKeyboard(DeviceExtension); INFO_(I8042PRT, "Keyboard present: %s\n", DeviceExtension->Flags & KEYBOARD_PRESENT ? "YES" : "NO"); INFO_(I8042PRT, "Mouse present : %s\n", DeviceExtension->Flags & MOUSE_PRESENT ? "YES" : "NO"); TRACE_(I8042PRT, "Enabling i8042 interrupts\n"); if (DeviceExtension->Flags & KEYBOARD_PRESENT) { FlagsToDisable |= CCB_KBD_DISAB; FlagsToEnable |= CCB_KBD_INT_ENAB; } if (DeviceExtension->Flags & MOUSE_PRESENT) { FlagsToDisable |= CCB_MOUSE_DISAB; FlagsToEnable |= CCB_MOUSE_INT_ENAB; } Status = EnableInterrupts(DeviceExtension, FlagsToDisable, FlagsToEnable); if (!NT_SUCCESS(Status)) { WARN_(I8042PRT, "EnableInterrupts failed: %lx\n", Status); DeviceExtension->Flags &= ~(KEYBOARD_PRESENT | MOUSE_PRESENT); return Status; } } /* Connect interrupts */ if (DeviceExtension->Flags & KEYBOARD_PRESENT && DeviceExtension->Flags & KEYBOARD_CONNECTED && DeviceExtension->Flags & KEYBOARD_STARTED && !(DeviceExtension->Flags & KEYBOARD_INITIALIZED)) { /* Keyboard is ready to be initialized */ Status = i8042ConnectKeyboardInterrupt(DeviceExtension->KeyboardExtension); if (NT_SUCCESS(Status)) { DeviceExtension->Flags |= KEYBOARD_INITIALIZED; } else { WARN_(I8042PRT, "i8042ConnectKeyboardInterrupt failed: %lx\n", Status); } } if (DeviceExtension->Flags & MOUSE_PRESENT && DeviceExtension->Flags & MOUSE_CONNECTED && DeviceExtension->Flags & MOUSE_STARTED && !(DeviceExtension->Flags & MOUSE_INITIALIZED)) { /* Mouse is ready to be initialized */ Status = i8042ConnectMouseInterrupt(DeviceExtension->MouseExtension); if (NT_SUCCESS(Status)) { DeviceExtension->Flags |= MOUSE_INITIALIZED; } else { WARN_(I8042PRT, "i8042ConnectMouseInterrupt failed: %lx\n", Status); } /* Start the mouse */ Irql = KeAcquireInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt); /* HACK: the mouse has already been reset in i8042DetectMouse. This second reset prevents some touchpads/mice from working (Dell D531, D600). See CORE-6901 */ if (!(i8042HwFlags & FL_INITHACK)) { i8042IsrWritePort(DeviceExtension, MOU_CMD_RESET, CTRL_WRITE_MOUSE); } KeReleaseInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt, Irql); } return Status; } static NTSTATUS i8042PnpStartDevice( IN PDEVICE_OBJECT DeviceObject, IN PCM_RESOURCE_LIST AllocatedResources, IN PCM_RESOURCE_LIST AllocatedResourcesTranslated) { PFDO_DEVICE_EXTENSION DeviceExtension; PPORT_DEVICE_EXTENSION PortDeviceExtension; PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor, ResourceDescriptorTranslated; INTERRUPT_DATA InterruptData = { NULL }; BOOLEAN FoundDataPort = FALSE; BOOLEAN FoundControlPort = FALSE; BOOLEAN FoundIrq = FALSE; ULONG i; NTSTATUS Status; TRACE_(I8042PRT, "i8042PnpStartDevice(%p)\n", DeviceObject); DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; PortDeviceExtension = DeviceExtension->PortDeviceExtension; ASSERT(DeviceExtension->PnpState == dsStopped); if (!AllocatedResources) { WARN_(I8042PRT, "No allocated resources sent to driver\n"); return STATUS_INSUFFICIENT_RESOURCES; } if (AllocatedResources->Count != 1) { WARN_(I8042PRT, "Wrong number of allocated resources sent to driver\n"); return STATUS_INSUFFICIENT_RESOURCES; } if (AllocatedResources->List[0].PartialResourceList.Version != 1 || AllocatedResources->List[0].PartialResourceList.Revision != 1 || AllocatedResourcesTranslated->List[0].PartialResourceList.Version != 1 || AllocatedResourcesTranslated->List[0].PartialResourceList.Revision != 1) { WARN_(I8042PRT, "Revision mismatch: %u.%u != 1.1 or %u.%u != 1.1\n", AllocatedResources->List[0].PartialResourceList.Version, AllocatedResources->List[0].PartialResourceList.Revision, AllocatedResourcesTranslated->List[0].PartialResourceList.Version, AllocatedResourcesTranslated->List[0].PartialResourceList.Revision); return STATUS_REVISION_MISMATCH; } /* Get Irq and optionally control port and data port */ for (i = 0; i < AllocatedResources->List[0].PartialResourceList.Count; i++) { ResourceDescriptor = &AllocatedResources->List[0].PartialResourceList.PartialDescriptors[i]; ResourceDescriptorTranslated = &AllocatedResourcesTranslated->List[0].PartialResourceList.PartialDescriptors[i]; switch (ResourceDescriptor->Type) { case CmResourceTypePort: { if (ResourceDescriptor->u.Port.Length == 1) { /* We assume that the first resource will * be the control port and the second one * will be the data port... */ if (!FoundDataPort) { PortDeviceExtension->DataPort = ULongToPtr(ResourceDescriptor->u.Port.Start.u.LowPart); INFO_(I8042PRT, "Found data port: %p\n", PortDeviceExtension->DataPort); FoundDataPort = TRUE; } else if (!FoundControlPort) { PortDeviceExtension->ControlPort = ULongToPtr(ResourceDescriptor->u.Port.Start.u.LowPart); INFO_(I8042PRT, "Found control port: %p\n", PortDeviceExtension->ControlPort); FoundControlPort = TRUE; } else { /* FIXME: implement PS/2 Active Multiplexing */ ERR_(I8042PRT, "Unhandled I/O ranges provided: 0x%lx\n", ResourceDescriptor->u.Port.Length); } } else WARN_(I8042PRT, "Invalid I/O range length: 0x%lx\n", ResourceDescriptor->u.Port.Length); break; } case CmResourceTypeInterrupt: { if (FoundIrq) return STATUS_INVALID_PARAMETER; InterruptData.Dirql = (KIRQL)ResourceDescriptorTranslated->u.Interrupt.Level; InterruptData.Vector = ResourceDescriptorTranslated->u.Interrupt.Vector; InterruptData.Affinity = ResourceDescriptorTranslated->u.Interrupt.Affinity; if (ResourceDescriptorTranslated->Flags & CM_RESOURCE_INTERRUPT_LATCHED) InterruptData.InterruptMode = Latched; else InterruptData.InterruptMode = LevelSensitive; InterruptData.ShareInterrupt = (ResourceDescriptorTranslated->ShareDisposition == CmResourceShareShared); INFO_(I8042PRT, "Found irq resource: %lu\n", ResourceDescriptor->u.Interrupt.Level); FoundIrq = TRUE; break; } default: WARN_(I8042PRT, "Unknown resource descriptor type 0x%x\n", ResourceDescriptor->Type); } } if (!FoundIrq) { WARN_(I8042PRT, "Interrupt resource was not found in allocated resources list\n"); return STATUS_INSUFFICIENT_RESOURCES; } else if (DeviceExtension->Type == Keyboard && (!FoundDataPort || !FoundControlPort)) { WARN_(I8042PRT, "Some required resources were not found in allocated resources list\n"); return STATUS_INSUFFICIENT_RESOURCES; } else if (DeviceExtension->Type == Mouse && (FoundDataPort || FoundControlPort)) { WARN_(I8042PRT, "Too much resources were provided in allocated resources list\n"); return STATUS_INVALID_PARAMETER; } switch (DeviceExtension->Type) { case Keyboard: { RtlCopyMemory( &PortDeviceExtension->KeyboardInterrupt, &InterruptData, sizeof(INTERRUPT_DATA)); PortDeviceExtension->Flags |= KEYBOARD_STARTED; Status = StartProcedure(PortDeviceExtension); break; } case Mouse: { RtlCopyMemory( &PortDeviceExtension->MouseInterrupt, &InterruptData, sizeof(INTERRUPT_DATA)); PortDeviceExtension->Flags |= MOUSE_STARTED; Status = StartProcedure(PortDeviceExtension); break; } default: { WARN_(I8042PRT, "Unknown FDO type %u\n", DeviceExtension->Type); ASSERT(!(PortDeviceExtension->Flags & KEYBOARD_CONNECTED) || !(PortDeviceExtension->Flags & MOUSE_CONNECTED)); Status = STATUS_INVALID_DEVICE_REQUEST; } } if (NT_SUCCESS(Status)) DeviceExtension->PnpState = dsStarted; return Status; } static VOID i8042RemoveDevice( IN PDEVICE_OBJECT DeviceObject) { PI8042_DRIVER_EXTENSION DriverExtension; KIRQL OldIrql; PFDO_DEVICE_EXTENSION DeviceExtension; DriverExtension = (PI8042_DRIVER_EXTENSION)IoGetDriverObjectExtension(DeviceObject->DriverObject, DeviceObject->DriverObject); DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; KeAcquireSpinLock(&DriverExtension->DeviceListLock, &OldIrql); RemoveEntryList(&DeviceExtension->ListEntry); KeReleaseSpinLock(&DriverExtension->DeviceListLock, OldIrql); IoDetachDevice(DeviceExtension->LowerDevice); IoDeleteDevice(DeviceObject); } NTSTATUS NTAPI i8042Pnp( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { PIO_STACK_LOCATION Stack; ULONG MinorFunction; I8042_DEVICE_TYPE DeviceType; ULONG_PTR Information = 0; NTSTATUS Status; Stack = IoGetCurrentIrpStackLocation(Irp); MinorFunction = Stack->MinorFunction; DeviceType = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type; switch (MinorFunction) { case IRP_MN_START_DEVICE: /* 0x00 */ { TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_START_DEVICE\n"); /* Call lower driver (if any) */ if (DeviceType != PhysicalDeviceObject) { Status = ForwardIrpAndWait(DeviceObject, Irp); if (NT_SUCCESS(Status)) Status = i8042PnpStartDevice( DeviceObject, Stack->Parameters.StartDevice.AllocatedResources, Stack->Parameters.StartDevice.AllocatedResourcesTranslated); } else Status = STATUS_SUCCESS; break; } case IRP_MN_QUERY_DEVICE_RELATIONS: /* (optional) 0x07 */ { switch (Stack->Parameters.QueryDeviceRelations.Type) { case BusRelations: { TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n"); return ForwardIrpAndForget(DeviceObject, Irp); } case RemovalRelations: { TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n"); return ForwardIrpAndForget(DeviceObject, Irp); } default: ERR_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n", Stack->Parameters.QueryDeviceRelations.Type); return ForwardIrpAndForget(DeviceObject, Irp); } break; } case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0x0d */ { TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n"); return ForwardIrpAndForget(DeviceObject, Irp); } case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */ { TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n"); return ForwardIrpAndForget(DeviceObject, Irp); } case IRP_MN_QUERY_REMOVE_DEVICE: { TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_REMOVE_DEVICE\n"); return ForwardIrpAndForget(DeviceObject, Irp); } case IRP_MN_CANCEL_REMOVE_DEVICE: { TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_CANCEL_REMOVE_DEVICE\n"); return ForwardIrpAndForget(DeviceObject, Irp); } case IRP_MN_REMOVE_DEVICE: { TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n"); Status = ForwardIrpAndForget(DeviceObject, Irp); i8042RemoveDevice(DeviceObject); return Status; } default: { ERR_(I8042PRT, "IRP_MJ_PNP / unknown minor function 0x%x\n", MinorFunction); return ForwardIrpAndForget(DeviceObject, Irp); } } Irp->IoStatus.Information = Information; Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); return Status; }
sunnyden/reactos
drivers/input/i8042prt/pnp.c
C
gpl-2.0
27,818
[ 30522, 1013, 1008, 1008, 2622, 1024, 10509, 2891, 1045, 17914, 20958, 1006, 8827, 1013, 1016, 9019, 1011, 8000, 11486, 1007, 4062, 1008, 6105, 1024, 14246, 2140, 1011, 2156, 24731, 1999, 1996, 2327, 2504, 14176, 1008, 5371, 1024, 6853, 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) 2013 - 2014, Freescale Semiconductor, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * o Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * o Neither the name of Freescale Semiconductor, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. */ #include "fsl_dma_driver.h" #if FSL_FEATURE_SOC_DMA_COUNT /******************************************************************************* * Code ******************************************************************************/ /* DMA IRQ handler with the same name in startup code*/ void DMA0_IRQHandler(void) { DMA_DRV_IRQhandler(0); } /* DMA IRQ handler with the same name in startup code*/ void DMA1_IRQHandler(void) { DMA_DRV_IRQhandler(1); } /* DMA IRQ handler with the same name in startup code*/ void DMA2_IRQHandler(void) { DMA_DRV_IRQhandler(2); } /* DMA IRQ handler with the same name in startup code*/ void DMA3_IRQHandler(void) { DMA_DRV_IRQhandler(3); } #endif /******************************************************************************* * EOF ******************************************************************************/
RT-Thread/rtthread_fsl
bsp/kinetis/platform/drivers/src/dma/fsl_dma_irq.c
C
lgpl-2.1
2,477
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2286, 1011, 2297, 1010, 2489, 15782, 2571, 20681, 1010, 4297, 1012, 1008, 2035, 2916, 9235, 1012, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302, 14080, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.uberfire.client.views.bs2.tab; import com.google.gwt.dom.client.Style; import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.user.client.Element; import com.google.gwtmockito.GwtMockitoTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.uberfire.client.views.bs2.maximize.MaximizeToggleButton; import org.uberfire.client.workbench.widgets.listbar.ResizeFlowPanel; import org.uberfire.mvp.Command; import static org.mockito.Matchers.any; import static org.mockito.Mockito.*; @RunWith(GwtMockitoTestRunner.class) public class MultiTabWorkbenchPanelViewTest { @InjectMocks private MultiTabWorkbenchPanelView view; @Mock private UberTabPanel uberTabPanel; @Mock private MaximizeToggleButton maximizeButton; @Mock private ResizeFlowPanel partViewContainer; @Before public void setup() { Element uberTabPanelElement = mock( Element.class ); Style uberTabPanelElementStyle = mock( Style.class ); when( uberTabPanel.getElement() ).thenReturn( uberTabPanelElement ); when( uberTabPanelElement.getStyle() ).thenReturn( uberTabPanelElementStyle ); } @Test public void setupWidget() { view.setupWidget(); //assert event handlers verify( uberTabPanel ).addSelectionHandler(any(SelectionHandler.class)); verify( uberTabPanel ).addOnFocusHandler( any( Command.class )); } }
baldimir/uberfire
uberfire-workbench/uberfire-workbench-client-views-bs2/src/test/java/org/uberfire/client/views/bs2/tab/MultiTabWorkbenchPanelViewTest.java
Java
apache-2.0
1,539
[ 30522, 7427, 8917, 1012, 19169, 10273, 1012, 7396, 1012, 5328, 1012, 18667, 2475, 1012, 21628, 1025, 12324, 4012, 1012, 8224, 1012, 1043, 26677, 1012, 14383, 1012, 7396, 1012, 2806, 1025, 12324, 4012, 1012, 8224, 1012, 1043, 26677, 1012, 27...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Copyright (C) 2012 - 2014 Xeiam LLC http://xeiam.com * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.xeiam.xchange.justcoin.service.polling; import java.io.IOException; import java.util.Collection; import java.util.HashSet; import java.util.Set; import si.mazi.rescu.RestProxyFactory; import com.xeiam.xchange.ExchangeSpecification; import com.xeiam.xchange.currency.CurrencyPair; import com.xeiam.xchange.justcoin.Justcoin; import com.xeiam.xchange.justcoin.JustcoinAdapters; import com.xeiam.xchange.justcoin.dto.marketdata.JustcoinTicker; import com.xeiam.xchange.service.BaseExchangeService; import com.xeiam.xchange.utils.AuthUtils; public class JustcoinBasePollingService<T extends Justcoin> extends BaseExchangeService { protected final T justcoin; private final Set<CurrencyPair> currencyPairs = new HashSet<CurrencyPair>(); /** * Constructor * * @param exchangeSpecification The {@link ExchangeSpecification} */ public JustcoinBasePollingService(Class<T> type, ExchangeSpecification exchangeSpecification) { super(exchangeSpecification); this.justcoin = RestProxyFactory.createProxy(type, exchangeSpecification.getSslUri()); } @Override public Collection<CurrencyPair> getExchangeSymbols() throws IOException { if (currencyPairs.isEmpty()) { for (final JustcoinTicker ticker : justcoin.getTickers()) { final CurrencyPair currencyPair = JustcoinAdapters.adaptCurrencyPair(ticker.getId()); currencyPairs.add(currencyPair); } } return currencyPairs; } protected String getBasicAuthentication() { return AuthUtils.getBasicAuth(exchangeSpecification.getUserName(), exchangeSpecification.getPassword()); } }
habibmasuro/XChange
xchange-justcoin/src/main/java/com/xeiam/xchange/justcoin/service/polling/JustcoinBasePollingService.java
Java
mit
2,758
[ 30522, 1013, 1008, 1008, 1008, 9385, 1006, 1039, 1007, 2262, 1011, 2297, 1060, 27958, 2213, 11775, 8299, 1024, 1013, 1013, 1060, 27958, 2213, 1012, 4012, 1008, 1008, 6656, 2003, 2182, 3762, 4379, 1010, 2489, 1997, 3715, 1010, 2000, 2151, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 /** * Manage Customers. * * @since 2.5.0 * @package WooCommerce/CLI * @category CLI * @author WooThemes */ class WC_CLI_Customer extends WC_CLI_Command { /** * Create a customer. * * ## OPTIONS * * <email> * : The email address of the customer to create. * * [--<field>=<value>] * : Associative args for the new customer. * * [--porcelain] * : Outputs just the new customer id. * * ## AVAILABLE FIELDS * * These fields are optionally available for create command: * * * username * * password * * first_name * * last_name * * Billing address fields: * * * billing_address.first_name * * billing_address.last_name * * billing_address.company * * billing_address.address_1 * * billing_address.address_2 * * billing_address.city * * billing_address.state * * billing_address.postcode * * billing_address.country * * billing_address.email * * billing_address.phone * * Shipping address fields: * * * shipping_address.first_name * * shipping_address.last_name * * shipping_address.company * * shipping_address.address_1 * * shipping_address.address_2 * * shipping_address.city * * shipping_address.state * * shipping_address.postcode * * shipping_address.country * * ## EXAMPLES * * wp wc customer create new-customer@example.com --first_name=Akeda * * @since 2.5.0 */ public function create( $args, $assoc_args ) { global $wpdb; try { $porcelain = isset( $assoc_args['porcelain'] ); unset( $assoc_args['porcelain'] ); $assoc_args['email'] = $args[0]; $data = apply_filters( 'woocommerce_cli_create_customer_data', $this->unflatten_array( $assoc_args ) ); // Sets the username. $data['username'] = ! empty( $data['username'] ) ? $data['username'] : ''; // Sets the password. $data['password'] = ! empty( $data['password'] ) ? $data['password'] : ''; // Attempts to create the new customer. $id = wc_create_new_customer( $data['email'], $data['username'], $data['password'] ); // Checks for an error in the customer creation. if ( is_wp_error( $id ) ) { throw new WC_CLI_Exception( $id->get_error_code(), $id->get_error_message() ); } // Added customer data. $this->update_customer_data( $id, $data ); do_action( 'woocommerce_cli_create_customer', $id, $data ); if ( $porcelain ) { WP_CLI::line( $id ); } else { WP_CLI::success( "Created customer $id." ); } } catch ( WC_CLI_Exception $e ) { WP_CLI::error( $e->getMessage() ); } } /** * Delete one or more customers. * * ## OPTIONS * * <customer>... * : The customer ID, email, or username to delete. * * ## EXAMPLES * * wp wc customer delete 123 * * wp wc customer delete $(wp wc customer list --format=ids) * * @since 2.5.0 */ public function delete( $args, $assoc_args ) { $exit_code = 0; foreach ( $args as $arg ) { try { $customer = $this->get_user( $arg ); do_action( 'woocommerce_cli_delete_customer', $customer['id'] ); $r = wp_delete_user( $customer['id'] ); if ( $r ) { WP_CLI::success( "Deleted customer {$customer['id']}." ); } else { $exit_code += 1; WP_CLI::warning( "Failed deleting customer {$customer['id']}." ); } } catch ( WC_CLI_Exception $e ) { WP_CLI::warning( $e->getMessage() ); } } exit( $exit_code ? 1 : 0 ); } /** * View customer downloads. * * ## OPTIONS * * <customer> * : The customer ID, email or username. * * [--field=<field>] * : Instead of returning the whole customer fields, returns the value of a single fields. * * [--fields=<fields>] * : Get a specific subset of the customer's fields. * * [--format=<format>] * : Accepted values: table, json, csv. Default: table. * * ## AVAILABLE FIELDS * * * download_id * * download_name * * access_expires * * ## EXAMPLES * * wp wc customer downloads 123 * * @since 2.5.0 */ public function downloads( $args, $assoc_args ) { try { $user = $this->get_user( $args[0] ); $downloads = array(); foreach ( wc_get_customer_available_downloads( $user['id'] ) as $key => $download ) { $downloads[ $key ] = $download; $downloads[ $key ]['access_expires'] = $this->format_datetime( $download['access_expires'] ); } $downloads = apply_filters( 'woocommerce_cli_customer_downloads', $downloads, $user, $assoc_args ); if ( empty( $assoc_args['fields'] ) ) { $assoc_args['fields'] = $this->get_customer_download_fields(); } $formatter = $this->get_formatter( $assoc_args ); $formatter->display_items( $downloads ); } catch ( WC_CLI_Exception $e ) { WP_CLI::error( $e->getMessage() ); } } /** * Get a customer. * * ## OPTIONS * * <customer> * : Customer ID, email, or username. * * [--field=<field>] * : Instead of returning the whole customer fields, returns the value of a single fields. * * [--fields=<fields>] * : Get a specific subset of the customer's fields. * * [--format=<format>] * : Accepted values: table, json, csv. Default: table. * * ## AVAILABLE FIELDS * * * id * * email * * first_name * * last_name * * created_at * * username * * last_order_id * * last_order_date * * orders_count * * total_spent * * avatar_url * * Billing address fields: * * * billing_address.first_name * * billing_address.last_name * * billing_address.company * * billing_address.address_1 * * billing_address.address_2 * * billing_address.city * * billing_address.state * * billing_address.postcode * * billing_address.country * * billing_address.email * * billing_address.phone * * Shipping address fields: * * * shipping_address.first_name * * shipping_address.last_name * * shipping_address.company * * shipping_address.address_1 * * shipping_address.address_2 * * shipping_address.city * * shipping_address.state * * shipping_address.postcode * * shipping_address.country * * Fields for filtering query result also available: * * * role Filter customers associated with certain role. * * q Filter customers with search query. * * created_at_min Filter customers whose registered after this date. * * created_at_max Filter customers whose registered before this date. * * limit The maximum returned number of results. * * offset Offset the returned results. * * order Accepted values: ASC and DESC. Default: DESC. * * orderby Sort retrieved customers by parameter. One or more options can be passed. * * ## EXAMPLES * * wp wc customer get 123 --field=email * * wp wc customer get customer-login --format=json * * @since 2.5.0 */ public function get( $args, $assoc_args ) { try { $user = $this->get_user( $args[0] ); if ( empty( $assoc_args['fields'] ) ) { $assoc_args['fields'] = array_keys( $user ); } $formatter = $this->get_formatter( $assoc_args ); $formatter->display_item( $user ); } catch ( WC_CLI_Exception $e ) { WP_CLI::error( $e->getMessage() ); } } /** * List customers. * * ## OPTIONS * * [--<field>=<value>] * : Filter customer based on customer property. * * [--field=<field>] * : Prints the value of a single field for each customer. * * [--fields=<fields>] * : Limit the output to specific customer fields. * * [--format=<format>] * : Acceptec values: table, csv, json, count, ids. Default: table. * * ## AVAILABLE FIELDS * * These fields will be displayed by default for each customer: * * * id * * email * * first_name * * last_name * * created_at * * These fields are optionally available: * * * username * * last_order_id * * last_order_date * * orders_count * * total_spent * * avatar_url * * Billing address fields: * * * billing_address.first_name * * billing_address.last_name * * billing_address.company * * billing_address.address_1 * * billing_address.address_2 * * billing_address.city * * billing_address.state * * billing_address.postcode * * billing_address.country * * billing_address.email * * billing_address.phone * * Shipping address fields: * * * shipping_address.first_name * * shipping_address.last_name * * shipping_address.company * * shipping_address.address_1 * * shipping_address.address_2 * * shipping_address.city * * shipping_address.state * * shipping_address.postcode * * shipping_address.country * * Fields for filtering query result also available: * * * role Filter customers associated with certain role. * * q Filter customers with search query. * * created_at_min Filter customers whose registered after this date. * * created_at_max Filter customers whose registered before this date. * * limit The maximum returned number of results. * * offset Offset the returned results. * * order Accepted values: ASC and DESC. Default: DESC. * * orderby Sort retrieved customers by parameter. One or more options can be passed. * * ## EXAMPLES * * wp wc customer list * * wp wc customer list --field=id * * wp wc customer list --fields=id,email,first_name --format=json * * @subcommand list * @since 2.5.0 */ public function list_( $__, $assoc_args ) { $query_args = $this->merge_wp_user_query_args( $this->get_list_query_args(), $assoc_args ); $formatter = $this->get_formatter( $assoc_args ); if ( 'ids' === $formatter->format ) { $query_args['fields'] = 'ids'; $query = new WP_User_Query( $query_args ); echo implode( ' ', $query->results ); } else { $query = new WP_User_Query( $query_args ); $items = $this->format_users_to_items( $query->results ); $formatter->display_items( $items ); } } /** * View customer orders. * * ## OPTIONS * * <customer> * : The customer ID, email or username. * * [--field=<field>] * : Instead of returning the whole customer fields, returns the value of a single fields. * * [--fields=<fields>] * : Get a specific subset of the customer's fields. * * [--format=<format>] * : Accepted values: table, json, csv. Default: table. * * ## AVAILABLE FIELDS * * For more fields, see: wp wc order list --help * * ## EXAMPLES * * wp wc customer orders 123 * * @since 2.5.0 */ public function orders( $args, $assoc_args ) { try { WP_CLI::run_command( array( 'wc', 'order', 'list' ), array( 'customer_id' => $args[0] ) ); } catch ( WC_CLI_Exception $e ) { WP_CLI::error( $e->getMessage() ); } } /** * Update one or more customers. * * ## OPTIONS * * <customer> * : Customer ID, email, or username. * * [--<field>=<value>] * : One or more fields to update. * * ## AVAILABLE FIELDS * * These fields are available for update command: * * * email * * password * * first_name * * last_name * * Billing address fields: * * * billing_address.first_name * * billing_address.last_name * * billing_address.company * * billing_address.address_1 * * billing_address.address_2 * * billing_address.city * * billing_address.state * * billing_address.postcode * * billing_address.country * * billing_address.email * * billing_address.phone * * Shipping address fields: * * * shipping_address.first_name * * shipping_address.last_name * * shipping_address.company * * shipping_address.address_1 * * shipping_address.address_2 * * shipping_address.city * * shipping_address.state * * shipping_address.postcode * * shipping_address.country * * ## EXAMPLES * * wp wc customer update customer-login --first_name=akeda --last_name=bagus * * wp wc customer update customer@example.com --password=new-password * * @since 2.5.0 */ public function update( $args, $assoc_args ) { try { $user = $this->get_user( $args[0] ); $data = $this->unflatten_array( $assoc_args ); $data = apply_filters( 'woocommerce_cli_update_customer_data', $data ); // Customer email. if ( isset( $data['email'] ) ) { wp_update_user( array( 'ID' => $user['id'], 'user_email' => sanitize_email( $data['email'] ) ) ); } // Customer password. if ( isset( $data['password'] ) ) { wp_update_user( array( 'ID' => $user['id'], 'user_pass' => wc_clean( $data['password'] ) ) ); } // Update customer data. $this->update_customer_data( $user['id'], $data ); do_action( 'woocommerce_cli_update_customer', $user['id'], $data ); WP_CLI::success( "Updated customer {$user['id']}." ); } catch ( WC_CLI_Exception $e ) { WP_CLI::error( $e->getMessage() ); } } /** * Get query args for list subcommand. * * @since 2.5.0 * @return array */ protected function get_list_query_args() { return array( 'role' => 'customer', 'orderby' => 'registered', ); } /** * Get default format fields that will be used in `list` and `get` subcommands. * * @since 2.5.0 * @return string */ protected function get_default_format_fields() { return 'id,email,first_name,last_name,created_at'; } /** * Format users from WP_User_Query result to items in which each item contain * common properties of item. * * @since 2.5.0 * @param array $users Array of user * @return array Items */ protected function format_users_to_items( $users ) { $items = array(); foreach ( $users as $user ) { try { $items[] = $this->get_user( $user->ID ); } catch ( WC_CLI_Exception $e ) { WP_CLI::warning( $e->getMessage() ); } } return $items; } /** * Get user from given user ID, email, or login * * @throws WC_CLI_Exception * * @since 2.5.0 * @param mixed $id_email_or_login * @return array|WP_Error */ protected function get_user( $id_email_or_login ) { global $wpdb; if ( is_numeric( $id_email_or_login ) ) { $user = get_user_by( 'id', $id_email_or_login ); } elseif ( is_email( $id_email_or_login ) ) { $user = get_user_by( 'email', $id_email_or_login ); } else { $user = get_user_by( 'login', $id_email_or_login ); } if ( ! $user ) { throw new WC_CLI_Exception( 'woocommerce_cli_invalid_customer', sprintf( __( 'Invalid customer "%s"', 'woocommerce' ), $id_email_or_login ) ); } // Get info about user's last order $last_order = $wpdb->get_row( "SELECT id, post_date_gmt FROM $wpdb->posts AS posts LEFT JOIN {$wpdb->postmeta} AS meta on posts.ID = meta.post_id WHERE meta.meta_key = '_customer_user' AND meta.meta_value = {$user->ID} AND posts.post_type = 'shop_order' AND posts.post_status IN ( '" . implode( "','", array_keys( wc_get_order_statuses() ) ) . "' ) ORDER BY posts.ID DESC " ); $customer = array( 'id' => $user->ID, 'created_at' => $this->format_datetime( $user->user_registered ), 'email' => $user->user_email, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'username' => $user->user_login, 'role' => $user->roles[0], 'last_order_id' => is_object( $last_order ) ? $last_order->get_id() : null, 'last_order_date' => is_object( $last_order ) ? $this->format_datetime( $last_order->post_date_gmt ) : null, 'orders_count' => wc_get_customer_order_count( $user->ID ), 'total_spent' => wc_format_decimal( wc_get_customer_total_spent( $user->ID ), 2 ), 'avatar_url' => $this->get_avatar_url( $user->customer_email ), 'billing_address' => array( 'first_name' => $user->billing_first_name, 'last_name' => $user->billing_last_name, 'company' => $user->billing_company, 'address_1' => $user->billing_address_1, 'address_2' => $user->billing_address_2, 'city' => $user->billing_city, 'state' => $user->billing_state, 'postcode' => $user->billing_postcode, 'country' => $user->billing_country, 'email' => $user->billing_email, 'phone' => $user->billing_phone, ), 'shipping_address' => array( 'first_name' => $user->shipping_first_name, 'last_name' => $user->shipping_last_name, 'company' => $user->shipping_company, 'address_1' => $user->shipping_address_1, 'address_2' => $user->shipping_address_2, 'city' => $user->shipping_city, 'state' => $user->shipping_state, 'postcode' => $user->shipping_postcode, 'country' => $user->shipping_country, ), ); // Allow dot notation for nested array so that user can specifies field // like 'billing_address.first_name'. return $this->flatten_array( $customer ); } /** * Wrapper for @see get_avatar() which doesn't simply return * the URL so we need to pluck it from the HTML img tag * * Kudos to https://github.com/WP-API/WP-API for offering a better solution * * @since 2.5.0 * @param string $email the customer's email * @return string the URL to the customer's avatar */ protected function get_avatar_url( $email ) { $avatar_html = get_avatar( $email ); // Get the URL of the avatar from the provided HTML preg_match( '/src=["|\'](.+)[\&|"|\']/U', $avatar_html, $matches ); if ( isset( $matches[1] ) && ! empty( $matches[1] ) ) { return esc_url_raw( $matches[1] ); } return null; } /** * Add/Update customer data. * * @since 2.5.0 * @param int $id The customer ID * @param array $data */ protected function update_customer_data( $id, $data ) { // Customer first name. if ( isset( $data['first_name'] ) ) { update_user_meta( $id, 'first_name', wc_clean( $data['first_name'] ) ); } // Customer last name. if ( isset( $data['last_name'] ) ) { update_user_meta( $id, 'last_name', wc_clean( $data['last_name'] ) ); } // Customer billing address. if ( isset( $data['billing_address'] ) ) { foreach ( $this->get_customer_billing_address_fields() as $address ) { if ( isset( $data['billing_address'][ $address ] ) ) { update_user_meta( $id, 'billing_' . $address, wc_clean( $data['billing_address'][ $address ] ) ); } } } // Customer shipping address. if ( isset( $data['shipping_address'] ) ) { foreach ( $this->get_customer_shipping_address_fields() as $address ) { if ( isset( $data['shipping_address'][ $address ] ) ) { update_user_meta( $id, 'shipping_' . $address, wc_clean( $data['shipping_address'][ $address ] ) ); } } } do_action( 'woocommerce_cli_update_customer_data', $id, $data ); } /** * Get customer billing address fields. * * @since 2.5.0 * @return array */ protected function get_customer_billing_address_fields() { return apply_filters( 'woocommerce_cli_customer_billing_address_fields', array( 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'country', 'email', 'phone', ) ); } /** * Get customer shipping address fields. * * @since 2.5.0 * @return array */ protected function get_customer_shipping_address_fields() { return apply_filters( 'woocommerce_cli_customer_shipping_address_fields', array( 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'country', ) ); } /** * Get customer download fields. * * @since 2.5.0 * @return array */ protected function get_customer_download_fields() { return apply_filters( 'woocommerce_cli_customer_download_fields', array( 'download_id', 'download_name', 'access_expires', ) ); } }
niravmehta/woocommerce
includes/cli/class-wc-cli-customer.php
PHP
gpl-3.0
19,732
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 6133, 6304, 1012, 1008, 1008, 1030, 2144, 1016, 1012, 1019, 1012, 1014, 1008, 1030, 7427, 15854, 9006, 5017, 3401, 1013, 18856, 2072, 1008, 1030, 4696, 18856, 2072, 1008, 1030, 3166, 15854, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE HTML> <html> <head> <title>Unit Test Runner</title> <meta http-equiv="REFRESH" content="0;url=../../qasht/runner.html?test=jazzHands/test/unit/module"> </HEAD> <BODY>Redirecting to test runner.</BODY> </HTML>
CosmicDynamo/jazzHands
test/testRunner.html
HTML
mit
227
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 3131, 3231, 5479, 1026, 1013, 2516, 1028, 1026, 18804, 8299, 1011, 1041, 15549, 2615, 1027, 1000, 25416, 21898, 1000, 4180, 1027, 1000, 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...
/* * Copyright (C) 2014 Archie L. Cobbs. All rights reserved. * * $Id$ */ package org.jsimpledb.util; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.jsimpledb.TestSupport; import org.jsimpledb.core.Database; import org.jsimpledb.core.ObjId; import org.jsimpledb.core.Transaction; import org.jsimpledb.kv.KVPair; import org.jsimpledb.kv.simple.SimpleKVDatabase; import org.jsimpledb.schema.SchemaModel; import org.testng.Assert; import org.testng.annotations.Test; public class XMLObjectSerializerTest extends TestSupport { @Test @SuppressWarnings("unchecked") public void testXMLObjectSerializer() throws Exception { final SimpleKVDatabase kvstore = new SimpleKVDatabase(); final Database db = new Database(kvstore); final SchemaModel schema1 = SchemaModel.fromXML(new ByteArrayInputStream(( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<Schema formatVersion=\"1\">\n" + " <ObjectType name=\"Foo\" storageId=\"1\">\n" + " <SimpleField name=\"i\" type=\"int\" storageId=\"2\"/>\n" + " <SimpleField name=\"z\" type=\"boolean\" storageId=\"3\"/>\n" + " <SimpleField name=\"b\" type=\"byte\" storageId=\"4\"/>\n" + " <SimpleField name=\"c\" type=\"char\" storageId=\"5\"/>\n" + " <SimpleField name=\"s\" type=\"short\" storageId=\"6\"/>\n" + " <SimpleField name=\"f\" type=\"float\" storageId=\"7\"/>\n" + " <SimpleField name=\"j\" type=\"long\" storageId=\"8\"/>\n" + " <SimpleField name=\"d\" type=\"double\" storageId=\"9\"/>\n" + " <SimpleField name=\"str\" type=\"java.lang.String\" storageId=\"10\"/>\n" + " <ReferenceField name=\"r\" storageId=\"11\"/>\n" + " <SimpleField name=\"v\" type=\"java.lang.Void\" storageId=\"12\"/>\n" + " <SimpleField name=\"date\" type=\"java.util.Date\" storageId=\"13\"/>\n" + " <ReferenceField name=\"r2\" storageId=\"14\"/>\n" + " </ObjectType>\n" + "</Schema>\n" ).getBytes("UTF-8"))); Transaction tx = db.createTransaction(schema1, 1, true); ObjId id1 = new ObjId("0100000000000001"); tx.create(id1, 1); tx.writeSimpleField(id1, 2, 123, false); tx.writeSimpleField(id1, 3, true, false); tx.writeSimpleField(id1, 4, (byte)-7, false); tx.writeSimpleField(id1, 5, '\n', false); tx.writeSimpleField(id1, 6, (short)0, false); // default value tx.writeSimpleField(id1, 7, 123.45f, false); tx.writeSimpleField(id1, 8, 99999999999L, false); tx.writeSimpleField(id1, 9, 123.45e37, false); tx.writeSimpleField(id1, 10, "hello dolly", false); tx.writeSimpleField(id1, 11, id1, false); tx.writeSimpleField(id1, 12, null, false); // default value tx.writeSimpleField(id1, 13, new Date(1399604568000L), false); tx.writeSimpleField(id1, 14, null, false); XMLObjectSerializer s1 = new XMLObjectSerializer(tx); final ByteArrayOutputStream buf = new ByteArrayOutputStream(); s1.write(buf, false, true); this.compareResult(tx, buf.toByteArray(), "test1.xml"); buf.reset(); s1.write(buf, true, true); this.compareResult(tx, buf.toByteArray(), "test2.xml"); tx.commit(); final SchemaModel schema2 = SchemaModel.fromXML(new ByteArrayInputStream(( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<Schema formatVersion=\"1\">\n" + " <ObjectType name=\"Foo\" storageId=\"20\">\n" + " <SetField name=\"set\" storageId=\"21\">\n" + " <SimpleField type=\"int\" storageId=\"22\"/>\n" + " </SetField>" + " <ListField name=\"list\" storageId=\"23\">\n" + " <SimpleField type=\"java.lang.Integer\" storageId=\"24\"/>\n" + " </ListField>" + " <MapField name=\"map\" storageId=\"25\">\n" + " <SimpleField type=\"int\" storageId=\"26\"/>\n" + " <SimpleField type=\"java.lang.String\" storageId=\"27\" indexed=\"true\"/>\n" + " </MapField>" + " <ListField name=\"list2\" storageId=\"28\">\n" + " <ReferenceField storageId=\"29\"/>\n" + " </ListField>" + " </ObjectType>\n" + "</Schema>\n" ).getBytes("UTF-8"))); tx = db.createTransaction(schema2, 2, true); ObjId id2 = new ObjId("1400000000000001"); tx.create(id2, 2); Set<Integer> set = (Set<Integer>)tx.readSetField(id2, 21, false); set.add(123); set.add(456); List<Integer> list = (List<Integer>)tx.readListField(id2, 23, false); list.add(789); list.add(null); list.add(101112); Map<Integer, String> map = (Map<Integer, String>)tx.readMapField(id2, 25, false); map.put(55, "fifty\nfive"); map.put(73, "seventy three"); map.put(99, null); XMLObjectSerializer s2 = new XMLObjectSerializer(tx); buf.reset(); s2.write(buf, false, true); this.compareResult(tx, buf.toByteArray(), "test3.xml"); buf.reset(); s2.write(buf, true, true); this.compareResult(tx, buf.toByteArray(), "test4.xml"); tx.commit(); } private void compareResult(Transaction tx, byte[] buf, String resource) throws Exception { // Read file String text = this.readResource(this.getClass().getResource(resource)).trim(); // Compare generated XML to expected this.log.info("verifying XML output with \"" + resource + "\""); Assert.assertEquals(new String(buf, "UTF-8"), text); // Parse XML back into a snapshot transaction final Transaction stx = tx.createSnapshotTransaction(); XMLObjectSerializer s = new XMLObjectSerializer(stx); s.read(new ByteArrayInputStream(text.getBytes("UTF-8"))); // Compare transaction KV stores final Iterator<KVPair> i1 = tx.getKVTransaction().getRange(null, null, false); final Iterator<KVPair> i2 = stx.getKVTransaction().getRange(null, null, false); while (i1.hasNext() && i2.hasNext()) { final KVPair p1 = i1.next(); final KVPair p2 = i2.next(); Assert.assertEquals(p1.toString(), p2.toString()); } Assert.assertTrue(!i1.hasNext()); Assert.assertTrue(!i2.hasNext()); } }
mmayorivera/jsimpledb
src/test/org/jsimpledb/util/XMLObjectSerializerTest.java
Java
apache-2.0
6,702
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2297, 13255, 1048, 1012, 17176, 2015, 1012, 2035, 2916, 9235, 1012, 1008, 1008, 1002, 8909, 1002, 1008, 1013, 7427, 8917, 1012, 1046, 5332, 23344, 18939, 1012, 21183, 4014, 1025, 12324, 9262,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.way.beans; import android.os.Parcel; import android.os.Parcelable; public class City implements Parcelable { private String province; private String city; private String name; private String pinyin; private String py; private String phoneCode; private String areaCode; private String postID; private long refreshTime; private int isLocation; private long pubTime; private String weatherInfoStr; public City() { } public City(String name, String postID, long refreshTime, int isLocation, long pubTime, String weatherInfoStr) { super(); this.name = name; this.postID = postID; this.refreshTime = refreshTime; this.isLocation = isLocation; this.pubTime = pubTime; this.weatherInfoStr = weatherInfoStr; } public City(String name, String postID) { super(); this.name = name; this.postID = postID; } public City(String province, String city, String name, String pinyin, String py, String phoneCode, String areaCode, String postID) { super(); this.province = province; this.city = city; this.name = name; this.pinyin = pinyin; this.py = py; this.phoneCode = phoneCode; this.areaCode = areaCode; this.postID = postID; } public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPinyin() { return pinyin; } public void setPinyin(String pinyin) { this.pinyin = pinyin; } public String getPy() { return py; } public void setPy(String py) { this.py = py; } public String getPhoneCode() { return phoneCode; } public void setPhoneCode(String phoneCode) { this.phoneCode = phoneCode; } public String getAreaCode() { return areaCode; } public void setAreaCode(String areaCode) { this.areaCode = areaCode; } public String getPostID() { return postID; } public void setPostID(String postID) { this.postID = postID; } public boolean getIsLocation() { return isLocation == 0 ? false : true; } public void setIsLocation(int isLocation) { this.isLocation = isLocation; } public long getRefreshTime() { return refreshTime; } public void setRefreshTime(long refreshTime) { this.refreshTime = refreshTime; } public long getPubTime() { return pubTime; } public void setPubTime(long pubTime) { this.pubTime = pubTime; } public String getWeatherInfoStr() { return weatherInfoStr; } public void setWeatherInfoStr(String weatherInfoStr) { this.weatherInfoStr = weatherInfoStr; } @Override public int hashCode() { int result = 17; result = 31 * result + postID != null ? postID.hashCode() : 0; return result; } @Override public boolean equals(Object o) { if (o == null) return false; if (o == this) return true; if (o instanceof City) { City item = (City) o; if (item.getPostID().equals(this.postID)) return true; } return false; } @Override public String toString() { return "City [province=" + province + ", city=" + city + ", name=" + name + ", pinyin=" + pinyin + ", py=" + py + ", phoneCode=" + phoneCode + ", areaCode=" + areaCode + ", postID=" + postID + ", refreshTime=" + refreshTime + ", isLocation=" + isLocation + "]"; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(province); dest.writeString(city); dest.writeString(name); dest.writeString(pinyin); dest.writeString(py); dest.writeString(phoneCode); dest.writeString(areaCode); dest.writeString(postID); dest.writeLong(refreshTime); dest.writeInt(isLocation); } public static final Parcelable.Creator<City> CREATOR = new Creator<City>() { @Override public City createFromParcel(Parcel source) { City city = new City(); city.province = source.readString(); city.city = source.readString(); city.name = source.readString(); city.pinyin = source.readString(); city.py = source.readString(); city.phoneCode = source.readString(); city.areaCode = source.readString(); city.postID = source.readString(); city.refreshTime = source.readLong(); city.isLocation = source.readInt(); return city; } @Override public City[] newArray(int size) { return new City[size]; } }; }
hnyzwtf/WayHoo
WayHoo/src/com/way/beans/City.java
Java
apache-2.0
4,503
[ 30522, 7427, 4012, 1012, 2126, 1012, 13435, 1025, 12324, 11924, 1012, 9808, 1012, 20463, 1025, 12324, 11924, 1012, 9808, 1012, 20463, 3085, 1025, 2270, 2465, 2103, 22164, 20463, 3085, 1063, 2797, 5164, 2874, 1025, 2797, 5164, 2103, 1025, 27...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. namespace VsChromium.Server.Threads { public interface ITaskQueueFactory { ITaskQueue CreateQueue(string description); } }
chromium/vs-chromium
src/Server/Threads/ITaskQueueFactory.cs
C#
bsd-3-clause
309
[ 30522, 1013, 1013, 9385, 2286, 1996, 10381, 21716, 5007, 6048, 1012, 2035, 2916, 9235, 1012, 1013, 1013, 2224, 1997, 2023, 3120, 3642, 2003, 9950, 2011, 1037, 18667, 2094, 1011, 2806, 6105, 2008, 2064, 2022, 1013, 1013, 2179, 1999, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* INVERSÃO. Escreva uma função que inverta a ordem das células de uma lista encadeada (a primeira passa a ser a última, a segunda passa a ser a penúltima etc.). Faça isso sem criar novas células; apenas altera os ponteiros. */ #include <stdio.h> #include <stdlib.h> typedef struct cell{ int conteudo; struct cell * proximo; }CELULA; void insere(CELULA * celula, int conteudo){ CELULA * nova = malloc(sizeof(CELULA)); nova -> conteudo = conteudo; nova -> proximo = celula -> proximo; celula -> proximo = nova; } void inverte(CELULA * celula){ CELULA * atual, * proximo, * temp; atual = celula; proximo = celula -> proximo; while(proximo != NULL){ temp = proximo -> proximo; proximo -> proximo = atual; atual = proximo; proximo = temp; } celula -> proximo -> proximo = NULL; celula -> proximo = atual; } void exibe(CELULA * celula){ CELULA * p = celula -> proximo; while(p != NULL){ printf(" %d ", p -> conteudo); p = p -> proximo; } printf("\n"); } void main(void){ CELULA * cabeca = malloc(sizeof(CELULA)); cabeca -> proximo = NULL; for(int i = 0; i < 10; i++) insere(cabeca, i * 10); printf("Antes de inverter\n"); exibe(cabeca); printf("Depois de inverter\n"); inverte(cabeca); exibe(cabeca); }
Gigers/data-struct
Revisão/primeiroBimestre/Listas encadeadas (Com cabeça)/src/problems/exe_19.c
C
bsd-2-clause
1,385
[ 30522, 1013, 1008, 1999, 14028, 7113, 1012, 9686, 16748, 3567, 8529, 2050, 4569, 20808, 10861, 1999, 16874, 2050, 1037, 2030, 3207, 2213, 8695, 8292, 7630, 8523, 2139, 8529, 2050, 2862, 2050, 4372, 21869, 8447, 1006, 1037, 3539, 7895, 3413,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 return [ 'ctrl' => [ 'type' => 'type', 'title' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler', 'label' => 'style_option', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'versioningWS' => true, 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l10n_parent', 'transOrigDiffSourceField' => 'l10n_diffsource', 'delete' => 'deleted', 'enablecolumns' => [ 'disabled' => 'hidden', 'starttime' => 'starttime', 'endtime' => 'endtime', ], 'searchFields' => 'style_option,string_value,int_value,float_value,bool_value', 'iconfile' => 'EXT:sd_googlemaps/Resources/Public/Icons/tx_sdgooglemaps_domain_model_styler.gif', '' ], 'interface' => [ 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, string_value, int_value, float_value, bool_value', ], 'types' => [ '0' => ['showitem' => 'type, sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], 'string' => ['showitem' => 'type, sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, string_value, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], 'int' => ['showitem' => 'type, sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, int_value, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], 'float' => ['showitem' => 'type, sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, float_value, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], 'bool' => ['showitem' => 'type, sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, bool_value, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ 'exclude' => true, 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'special' => 'languages', 'items' => [ [ 'LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1, 'flags-multiple' ] ], 'default' => 0, ], ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', 'exclude' => true, 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ ['', 0], ], 'foreign_table' => 'tx_sdgooglemaps_domain_model_styler', 'foreign_table_where' => 'AND tx_sdgooglemaps_domain_model_styler.pid=###CURRENT_PID### AND tx_sdgooglemaps_domain_model_styler.sys_language_uid IN (-1,0)', ], ], 'l10n_diffsource' => [ 'config' => [ 'type' => 'passthrough', ], ], 't3ver_label' => [ 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel', 'config' => [ 'type' => 'input', 'size' => 30, 'max' => 255, ], ], 'hidden' => [ 'exclude' => true, 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', 'config' => [ 'type' => 'check', 'items' => [ '1' => [ '0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled' ] ], ], ], 'starttime' => [ 'exclude' => true, 'l10n_mode' => 'mergeIfNotBlank', 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime', 'config' => [ 'type' => 'input', 'size' => 13, 'eval' => 'datetime', 'default' => 0, ], ], 'endtime' => [ 'exclude' => true, 'l10n_mode' => 'mergeIfNotBlank', 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime', 'config' => [ 'type' => 'input', 'size' => 13, 'eval' => 'datetime', 'default' => 0, 'range' => [ 'upper' => mktime(0, 0, 0, 1, 1, 2038) ], ], ], 'type' => [ 'exclude' => true, 'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.type', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'eval' => 'trim,required', 'items' => [ ['Default', ''], ['String', 'string'], ['Integer', 'int'], ['Float', 'float'], ['Boolean', 'bool'] ], ], ], 'style_option' => [ 'exclude' => true, 'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.style_option', 'config' => [ 'type' => 'select', 'eval' => 'trim,required', 'itemsProcFunc' => 'SD\SdGooglemaps\Hooks\ItemsProcFunc->user_styleOptions' ], ], 'string_value' => [ 'exclude' => true, 'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.string_value', 'config' => [ 'type' => 'input', 'size' => 30, 'eval' => 'trim,required' ], ], 'int_value' => [ 'exclude' => true, 'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.int_value', 'config' => [ 'type' => 'input', 'size' => 4, 'eval' => 'int,required' ] ], 'float_value' => [ 'exclude' => true, 'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.float_value', 'config' => [ 'type' => 'input', 'size' => 4, 'eval' => 'double2,required' ] ], 'bool_value' => [ 'exclude' => true, 'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.bool_value', 'config' => [ 'type' => 'check', 'items' => [ '1' => [ '0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled' ] ], 'default' => 0, ] ], ], ];
daviian/sd_googlemaps
Configuration/TCA/tx_sdgooglemaps_domain_model_styler.php
PHP
mit
5,995
[ 30522, 1026, 1029, 25718, 2709, 1031, 1005, 14931, 12190, 1005, 1027, 1028, 1031, 1005, 2828, 1005, 1027, 1028, 1005, 2828, 1005, 1010, 1005, 2516, 1005, 1027, 1028, 1005, 2222, 2140, 1024, 4654, 2102, 1024, 17371, 1035, 8224, 2863, 4523, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.jph.takephoto.model; import android.app.Activity; import androidx.fragment.app.Fragment; /** * Author: JPH * Date: 2016/8/11 17:01 */ public class TContextWrap { private Activity activity; private Fragment fragment; public static TContextWrap of(Activity activity){ return new TContextWrap(activity); } public static TContextWrap of(Fragment fragment){ return new TContextWrap(fragment); } private TContextWrap(Activity activity) { this.activity = activity; } private TContextWrap(Fragment fragment) { this.fragment = fragment; this.activity=fragment.getActivity(); } public Activity getActivity() { return activity; } public void setActivity(Activity activity) { this.activity = activity; } public Fragment getFragment() { return fragment; } public void setFragment(Fragment fragment) { this.fragment = fragment; } }
blackbbc/Tucao
takephoto_library/src/main/java/com/jph/takephoto/model/TContextWrap.java
Java
mit
985
[ 30522, 7427, 4012, 1012, 16545, 2232, 1012, 2202, 8458, 11439, 1012, 2944, 1025, 12324, 11924, 1012, 10439, 1012, 4023, 1025, 12324, 11924, 2595, 1012, 15778, 1012, 10439, 1012, 15778, 1025, 1013, 1008, 1008, 1008, 3166, 1024, 16545, 2232, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * This file is part of the Lockbox package. * * Copyright © 2014 Erin Millard * * For the full copyright and license information, please view the LICENSE file * that was distributed with this source code. */ namespace Eloquent\Lockbox\Password; use Eloquent\Lockbox\AbstractRawDecrypter; use Eloquent\Lockbox\Cipher\Factory\CipherFactoryInterface; use Eloquent\Lockbox\DecrypterInterface; use Eloquent\Lockbox\Password\Cipher\Factory\PasswordDecryptCipherFactory; /** * Decrypts raw data using passwords. */ class RawPasswordDecrypter extends AbstractRawDecrypter { /** * Get the static instance of this decrypter. * * @return DecrypterInterface The static decrypter. */ public static function instance() { if (null === self::$instance) { self::$instance = new self; } return self::$instance; } /** * Construct a new raw password decrypter. * * @param CipherFactoryInterface|null $cipherFactory The cipher factory to use. */ public function __construct(CipherFactoryInterface $cipherFactory = null) { if (null === $cipherFactory) { $cipherFactory = PasswordDecryptCipherFactory::instance(); } parent::__construct($cipherFactory); } private static $instance; }
eloquent/lockbox-php
src/Password/RawPasswordDecrypter.php
PHP
mit
1,335
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 5843, 8758, 7427, 1012, 1008, 1008, 9385, 1075, 2297, 11781, 4971, 4232, 1008, 1008, 2005, 1996, 2440, 9385, 1998, 6105, 2592, 1010, 3531, 3193, 1996, 6105, 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...
# Leopoldia belladonna (L.) M.Roem. SPECIES #### Status SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Amaryllidaceae/Amaryllis/Amaryllis belladonna/ Syn. Leopoldia belladonna/README.md
Markdown
apache-2.0
190
[ 30522, 1001, 12752, 2401, 12101, 5280, 2532, 1006, 1048, 1012, 1007, 1049, 1012, 20944, 2213, 1012, 2427, 1001, 1001, 1001, 1001, 3570, 10675, 1001, 1001, 1001, 1001, 2429, 2000, 1996, 10161, 1997, 2166, 1010, 3822, 2254, 2249, 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...
# Phyllanthus ciccoides Müll.Arg. SPECIES #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Phyllanthaceae/Phyllanthus/Phyllanthus ciccoides/README.md
Markdown
apache-2.0
190
[ 30522, 1001, 6887, 8516, 5802, 19877, 25022, 21408, 8621, 14163, 3363, 1012, 12098, 2290, 1012, 2427, 1001, 1001, 1001, 1001, 3570, 3970, 1001, 1001, 1001, 1001, 2429, 2000, 1996, 10161, 1997, 2166, 1010, 3822, 2254, 2249, 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...
#!/usr/bin/env python # encoding: utf-8 """ Copyright 2011, 2012 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ import os, time, logging, threading, Queue class Threadable: def __init__(self,name="tvod.util.Threadable"): self._exit = False self._name = name # properties def get_exit(self): return self._exit def set_exit(self,value): assert isinstance(value,bool) self._exit = value def get_name(self): return self._name exit = property(get_exit,set_exit) name = property(get_name) # methods def runloop(self): while not self.exit: self.dowork() time.sleep(0.5) def dowork(self): pass class WatchFolder(Threadable): def __init__(self,path,timedelta=10.0): assert os.path.isdir(path) assert timedelta > 0 Threadable.__init__(self,name="<WatchFolder %s>" % os.path.basename(path)) self._path = path self._files = dict() self._timedelta = timedelta self._scantime = None # properties def get_path(self): return self._path path = property(get_path) # methods def scan(self): # scan for new files new_files = dict([(f, None) for f in os.listdir(self._path)]) added_files = [f for f in new_files if (not f in self._files and self.valid_filename(f))] deleted_files = [f for f in self._files if (not f in new_files and self.valid_filename(f))] # report on changes if added_files: self.added(added_files) if deleted_files: self.deleted(deleted_files) # reset files self._files = new_files def dowork(self): if self._scantime==None or (time.time() - self._scantime) > self._timedelta: logging.debug("SCANNING") self.scan() self._scantime = time.time() # These are the messages which need to be overridden def valid_filename(self,filename): if filename.startswith('.') or filename.endswith('~'): return False return True def added(self,paths): pass def deleted(self,paths): pass class XMLWatchFolder(WatchFolder): def __init__(self,path,queue): assert isinstance(queue,Queue.Queue) WatchFolder.__init__(self,path) self.queue = queue def valid_filename(self,filename): if not WatchFolder.valid_filename(self,filename): return False (basename,extension) = os.path.splitext(filename) if extension.lower() != ".xml": return False return True def added(self,filenames): for f in filenames: path = os.path.join(self.path,f) if not (os.path.exists(path) and os.path.getsize(path)): logging.debug("Ignoring non-existent or empty file: %s" % path) continue if not os.path.isfile(path): continue logging.debug("ADDED: %s/%s" % (os.path.basename(self.path),f)) self.queue.put(WorkerItem(path)) def deleted(self,filenames): for f in filenames: logging.debug("DELETED: %s/%s" % (os.path.basename(self.path),f)) class Worker(Threadable): def __init__(self,queue,number=0): assert isinstance(queue,Queue.Queue) Threadable.__init__(self,name="<Worker %d>" % number) self._queue = queue # methods def dowork(self): try: item = self._queue.get(True,0.5) assert isinstance(item,WorkerItem) self.process(item) except Queue.Empty, e: pass def process(self,item): pass class WorkerItem: def __init__(self,path): assert path self._path = path # properties def get_path(self): return self._path path = property(get_path) # convert into a string def __str__(self): return "<WorkerItem %s>" % self._path
tectronics/tvod-integrate
lib/python/tvod/util.py
Python
apache-2.0
3,896
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 18750, 1001, 17181, 1024, 21183, 2546, 1011, 1022, 1000, 1000, 1000, 9385, 30524, 1012, 2035, 2916, 9235, 1012, 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...
require 'test_helper' class OpinionsControllerTest < ActionDispatch::IntegrationTest test "should get show" do get opinions_show_url assert_response :success end end
ancaciascaiu/Practice
consume-api-debate/test/controllers/opinions_controller_test.rb
Ruby
mit
180
[ 30522, 5478, 1005, 3231, 1035, 2393, 2121, 1005, 2465, 10740, 8663, 13181, 10820, 22199, 1026, 2895, 10521, 4502, 10649, 1024, 1024, 8346, 22199, 3231, 1000, 2323, 2131, 2265, 1000, 2079, 2131, 10740, 1035, 2265, 1035, 24471, 2140, 20865, 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...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Struct template modulus</title> <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> <link rel="up" href="../../proto/reference.html#header.boost.proto.traits_hpp" title="Header &lt;boost/proto/traits.hpp&gt;"> <link rel="prev" href="divides/impl.html" title="Struct template impl"> <link rel="next" href="modulus/impl.html" title="Struct template impl"> </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="divides/impl.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.traits_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="modulus/impl.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="refentry"> <a name="boost.proto.modulus"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Struct template modulus</span></h2> <p>boost::proto::modulus &#8212; A metafunction for generating modulus expression types, a grammar element for matching modulus expressions, and a <a class="link" href="../../PrimitiveTransform.html" title="Concept PrimitiveTransform">PrimitiveTransform</a> that dispatches to the <code class="computeroutput"><a class="link" href="pass_through.html" title="Struct template pass_through">proto::pass_through&lt;&gt;</a></code> transform.</p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../proto/reference.html#header.boost.proto.traits_hpp" title="Header &lt;boost/proto/traits.hpp&gt;">boost/proto/traits.hpp</a>&gt; </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> U<span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="modulus.html" title="Struct template modulus">modulus</a> <span class="special">:</span> <span class="keyword"></span> <a class="link" href="transform.html" title="Struct template transform">proto::transform</a><span class="special">&lt;</span> <span class="identifier">modulus</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="special">{</span> <span class="comment">// types</span> <span class="keyword">typedef</span> <a class="link" href="expr.html" title="Struct template expr">proto::expr</a><span class="special">&lt;</span> <a class="link" href="tag/modulus.html" title="Struct modulus">proto::tag::modulus</a><span class="special">,</span> <a class="link" href="listN.html" title="Struct template listN">proto::list2</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <a name="boost.proto.modulus.type"></a><span class="identifier">type</span><span class="special">;</span> <span class="keyword">typedef</span> <a class="link" href="basic_expr.html" title="Struct template basic_expr">proto::basic_expr</a><span class="special">&lt;</span> <a class="link" href="tag/modulus.html" title="Struct modulus">proto::tag::modulus</a><span class="special">,</span> <a class="link" href="listN.html" title="Struct template listN">proto::list2</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <a name="boost.proto.modulus.proto_grammar"></a><span class="identifier">proto_grammar</span><span class="special">;</span> <span class="comment">// member classes/structs/unions</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <a class="link" href="../../Expr.html" title="Concept Expr">Expr</a><span class="special">,</span> <span class="keyword">typename</span> State<span class="special">,</span> <span class="keyword">typename</span> Data<span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="modulus/impl.html" title="Struct template impl">impl</a> <span class="special">:</span> <span class="keyword"></span> <a class="link" href="pass_through.html" title="Struct template pass_through">proto::pass_through</a>&lt;modulus&gt;::template impl&lt;Expr, State, Data&gt; <span class="special">{</span> <span class="special">}</span><span class="special">;</span> <span class="special">}</span><span class="special">;</span></pre></div> <div class="refsect1"> <a name="idp476065072"></a><h2>Description</h2> </div> </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 &#169; 2008 Eric Niebler<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="divides/impl.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.traits_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="modulus/impl.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
cris-iisc/mpc-primitives
crislib/libscapi/lib/boost_1_64_0/doc/html/boost/proto/modulus.html
HTML
agpl-3.0
7,141
[ 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...
# -*- coding: utf-8 -*- """ Custom module logger """ import logging module_name = 'moflow' logger = logging.getLogger(module_name) logger.addHandler(logging.NullHandler()) # best practice to not show anything def use_basic_config(level=logging.INFO, format=logging.BASIC_FORMAT): """Add basic configuration and formatting to the logger By default, the logger should not be configured in any way. However users and developers may prefer to see the logger messages. """ logger.level = level if module_name not in [_.name for _ in logger.handlers]: formatter = logging.Formatter(format) handler = logging.StreamHandler() handler.name = module_name handler.setFormatter(formatter) logger.addHandler(handler)
mwtoews/moflow
moflow/_logger.py
Python
bsd-2-clause
773
[ 30522, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 1011, 1022, 1011, 1008, 1011, 1000, 1000, 1000, 7661, 11336, 8833, 4590, 1000, 1000, 1000, 12324, 15899, 11336, 1035, 2171, 1027, 1005, 9587, 12314, 1005, 8833, 4590, 1027, 15899, 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...
#!/bin/bash INSTANCE_ID=$(ec2-metadata -i | awk '{print $2}') TERMINATE_MESSAGE="Terminating EC2 instance <$INSTANCE_ID>" TERMINATING=$(aws autoscaling describe-scaling-activities \ --auto-scaling-group-name "$ClusterStack-scaling-group" \ --max-items 100 \ --region "$AWS_REGION" | \ jq --arg TERMINATE_MESSAGE "$TERMINATE_MESSAGE" \ '.Activities[] | select(.Description | test($TERMINATE_MESSAGE)) != []') if [ "$TERMINATING" = "true" ]; then systemctl stop airflow fi
villasv/turbine
scripts/airflow-terminate.sh
Shell
mit
502
[ 30522, 1001, 999, 1013, 8026, 1013, 24234, 6013, 1035, 8909, 1027, 1002, 1006, 14925, 2475, 1011, 27425, 1011, 1045, 1064, 22091, 2243, 1005, 1063, 6140, 1002, 1016, 1065, 1005, 1007, 20320, 1035, 4471, 1027, 1000, 23552, 14925, 2475, 6013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 WP_Basic_Bootstrap * @since WP_Basic_Bootstrap 1.0 */ /* Globals */ body { word-wrap: break-word; } /* Main column and sidebar layout */ .blog-main { padding-right: 25px; padding-left: 25px; } .blog-sidebar { padding: 0 30px; } .blog-sidebar, .blog-main-right, .blog-sidebar-right { float: right !important; padding-right: 25px; } .blog-main-left, .blog-sidebar-left { float: left !important; padding-left: 25px; } @media screen and (max-width: 767px) { .blog-sidebar-left, .blog-sidebar, .blog-sidebar-right { margin-left: 0 !important; margin-right: 0 !important; width: 100%; } } /* Sidebar modules */ .sidebar-module { margin: 0 0 15px; } /* Blog posts */ .blog-post { } .blog-post-title { margin-bottom: 5px; } .blog-post-meta { } .blog-post-content { margin-top: 20px; } .comment-meta { margin-bottom: 20px; } .blog-post-summary { margin-bottom: 20px; } .blog-post-summary .blog-post-meta:first-child { margin-bottom: 0; } .blog-post-summary .blog-post-title { margin-top: 5px; } .blog-post-summary .thumbnail { margin-right: 12px; } .comments-area .avatar { float: left; margin-right: 6px; } /* Header */ .blog-searchbox { margin: 20px; } /* Footer */ footer.blog-footer { padding: 40px 0; } /* Footer modules for boxing content */ .footer-module { margin: 0 0 15px; } @media screen and (min-width: 768px) { .copyright { padding-top: 10px; } } @media screen and (max-width: 767px) { .footer-module { margin-left: 0 !important; margin-right: 0 !important; width: 100%; } .footer-nav, .copyright { text-align: center; } } /* widgets */ .widget ul { line-height: 140%; margin: 1em 0 1.4em 0; padding: 0; } .widget li { line-height: 140%; border-top: 1px solid #ddd; clear: both; list-style: outside none none; margin: 0; padding: 6px 0; } .widget li > ul { margin: 6px 0 0 18px; } .widget li > ul li:last-child { margin-bottom: 0; padding-bottom: 0; } /* specifics */ .author-avatar.pull-left { margin: 0 20px 20px 20px; } .widget_author_block .author-avatar.pull-left { margin: 6px; } /* .blog-post-content img, img.size-post-thumbnail { max-width: 100% !important; max-height: 100% !important; width: auto !important; height: auto !important; } */ img.size-post-thumbnail { padding: auto; margin: 6px 0 12px; } cite.vcard { font-style: normal; } .read-more-wrapper { display: block; text-align: center; } /* pagination */ .pager li > a, .pager li > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; } @media screen and (max-width: 767px) { .pager li > a, .pager li > span { max-width: 200px; } }
e-picas/wp-basic-bootstrap
assets/css/blog.css
CSS
gpl-3.0
2,891
[ 30522, 1013, 1008, 1008, 1008, 1030, 7427, 1059, 2361, 1035, 3937, 1035, 6879, 6494, 2361, 1008, 1030, 2144, 1059, 2361, 1035, 3937, 1035, 6879, 6494, 2361, 1015, 1012, 1014, 1008, 1013, 1013, 1008, 3795, 2015, 1008, 1013, 2303, 1063, 277...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Copyright 2013 Agustín Miura <"agustin.miura@gmail.com"> * * 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 ar.com.imperium.common.security; import org.springframework.stereotype.Component; @Component("dummyHashService") public class DummyHashServiceImpl implements IHashService { @Override public String hashString(String input) throws Exception { return input; } }
agustinmiura/imperium
src/main/java/ar/com/imperium/common/security/DummyHashServiceImpl.java
Java
apache-2.0
925
[ 30522, 1013, 1008, 1008, 1008, 9385, 2286, 26889, 2771, 4648, 1026, 1000, 26889, 1012, 2771, 4648, 1030, 20917, 4014, 1012, 4012, 1000, 1028, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * This file is part of the overtrue/wechat. * * (c) overtrue <i@overtrue.me> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace EasyWeChat\OfficialAccount\DataCube; use Pimple\Container; use Pimple\ServiceProviderInterface; /** * Class ServiceProvider. * * @author overtrue <i@overtrue.me> */ class ServiceProvider implements ServiceProviderInterface { /** * {@inheritdoc}. */ public function register(Container $app) { $app['data_cube'] = function ($app) { return new Client($app); }; } }
allen05ren/wechat
src/OfficialAccount/DataCube/ServiceProvider.php
PHP
mit
642
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 2058, 16344, 5657, 1013, 2057, 7507, 2102, 1012, 1008, 1008, 1006, 1039, 1007, 2058, 16344, 5657, 1026, 1045, 1030, 2058, 16344, 5657, 1012, 2033, 1028, 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...
echo off SETLOCAL enabledelayedexpansion cd .. call setEnv.cmd echo on "%JAVA_HOME%\bin\java" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.account.GetAccountSettings %* ENDLOCAL
jonathanmcelroy/DataCommunicationsProgram456
twitter4j/bin/account/getAccountSettings.cmd
Batchfile
gpl-2.0
199
[ 30522, 9052, 2125, 2275, 4135, 9289, 9124, 10581, 20821, 10288, 9739, 10992, 3729, 1012, 1012, 2655, 2275, 2368, 2615, 1012, 4642, 2094, 9052, 2006, 1000, 1003, 9262, 1035, 2188, 1003, 1032, 8026, 1032, 9262, 1000, 1003, 2033, 2213, 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...
// Copyright Neil Groves 2009. Use, modification and // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // // For more information, see http://www.boost.org/libs/range/ // #ifndef BOOST_RANGE_DETAIL_RANGE_RETURN_HPP_INCLUDED #define BOOST_RANGE_DETAIL_RANGE_RETURN_HPP_INCLUDED #include <boost/range/begin.hpp> #include <boost/range/end.hpp> #include <boost/range/iterator_range.hpp> namespace pdalboost { enum range_return_value { // (*) indicates the most common values return_found, // only the found resulting iterator (*) return_next, // next(found) iterator return_prior, // prior(found) iterator return_begin_found, // [begin, found) range (*) return_begin_next, // [begin, next(found)) range return_begin_prior, // [begin, prior(found)) range return_found_end, // [found, end) range (*) return_next_end, // [next(found), end) range return_prior_end, // [prior(found), end) range return_begin_end // [begin, end) range }; template< class SinglePassRange, range_return_value > struct range_return { typedef pdalboost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type; static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type found, SinglePassRange& rng) { return type(found, pdalboost::end(rng)); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_found > { typedef BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type type; static type pack(type found, SinglePassRange&) { return found; } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_next > { typedef BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type type; static type pack(type found, SinglePassRange& rng) { return found == pdalboost::end(rng) ? found : pdalboost::next(found); } }; template< class BidirectionalRange > struct range_return< BidirectionalRange, return_prior > { typedef BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type type; static type pack(type found, BidirectionalRange& rng) { return found == pdalboost::begin(rng) ? found : pdalboost::prior(found); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_begin_found > { typedef pdalboost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type; static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type found, SinglePassRange& rng) { return type(pdalboost::begin(rng), found); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_begin_next > { typedef pdalboost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type; static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type found, SinglePassRange& rng) { return type( pdalboost::begin(rng), found == pdalboost::end(rng) ? found : pdalboost::next(found) ); } }; template< class BidirectionalRange > struct range_return< BidirectionalRange, return_begin_prior > { typedef pdalboost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type > type; static type pack(BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type found, BidirectionalRange& rng) { return type( pdalboost::begin(rng), found == pdalboost::begin(rng) ? found : pdalboost::prior(found) ); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_found_end > { typedef pdalboost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type; static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type found, SinglePassRange& rng) { return type(found, pdalboost::end(rng)); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_next_end > { typedef pdalboost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type; static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type found, SinglePassRange& rng) { return type( found == pdalboost::end(rng) ? found : pdalboost::next(found), pdalboost::end(rng) ); } }; template< class BidirectionalRange > struct range_return< BidirectionalRange, return_prior_end > { typedef pdalboost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type > type; static type pack(BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type found, BidirectionalRange& rng) { return type( found == pdalboost::begin(rng) ? found : pdalboost::prior(found), pdalboost::end(rng) ); } }; template< class SinglePassRange > struct range_return< SinglePassRange, return_begin_end > { typedef pdalboost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type; static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type, SinglePassRange& rng) { return type(pdalboost::begin(rng), pdalboost::end(rng)); } }; } #endif // include guard
lucadelu/PDAL
vendor/pdalboost/boost/range/detail/range_return.hpp
C++
bsd-3-clause
6,270
[ 30522, 1013, 1013, 9385, 6606, 21695, 2268, 1012, 2224, 1010, 14080, 1998, 1013, 1013, 4353, 2003, 3395, 2000, 1996, 12992, 4007, 6105, 1010, 2544, 1013, 1013, 1015, 1012, 1014, 1012, 1006, 2156, 10860, 5371, 6105, 1035, 1015, 1035, 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...
/** * View abstract class * * @author Mautilus s.r.o. * @class View * @abstract * @mixins Events * @mixins Deferrable */ function View() { Events.call(this); Deferrable.call(this); this.construct.apply(this, arguments); }; View.prototype.__proto__ = Events.prototype; View.prototype.__proto__.__proto__ = Deferrable.prototype; /** * Construct object * * @constructor * @param {String} [parent=null] Another View instance this view belongs to * @param {Object} [attributes={}] Object attrs */ View.prototype.construct = function(parent, attributes) { if (typeof attributes === 'undefined' && parent && !parent.construct) { // parent is not provided, but attributes are attributes = $.extend(true, {}, parent); parent = null; } /** * @property {Object} parent Parent snippet or scene */ this.parent = parent; this.reset(attributes); this.$el = this.create(); if (this.id) { this.$el.attr('id', this.id); } if (this.cls) { this.$el.addClass(this.cls); } this.init.apply(this, arguments); this.bindEvents(); }; /** * Destruct object * * @private */ View.prototype.desctruct = function() { this.deinit.apply(this, arguments); this.destroy(); }; /** * Set focus to the scene * * @template */ View.prototype.focus = function() { }; /** * Reset properties * * @param {Object} [attributes] Object attrs */ View.prototype.reset = function(attributes) { this.isVisible = false; this.isActive = false; if (attributes) { this.setAttributes(attributes); } }; /** * Set object properties, functions and attributes that start with '_' are not allowed * * @param {Object} attributes */ View.prototype.setAttributes = function(attributes) { for (var i in attributes) { if (typeof attributes[i] !== 'undefined' && typeof attributes[i] !== 'function' && typeof this[i] !== 'fucntion' && i.substr(0, 1) !== '_') { this[i] = attributes[i]; } } }; /** * Bind listeners to the `key` event and some others */ View.prototype.bindEvents = function() { if (this.parent) { this.parent.on('key', this._onKey, this); this.parent.on('click', this._onClick, this); this.parent.on('scroll', this._onScroll, this); this.parent.on('focus', this._onFocus, this); } else { Control.on('key', this._onKey, this); Mouse.on('click', this._onClick, this); Mouse.on('scroll', this._onScroll, this); Focus.on('focus', this._onFocus, this); } I18n.on('langchange', this._onLangChange, this); }; /** * Un-bind all default listeners */ View.prototype.unbindEvents = function() { if (this.parent) { this.parent.off('key', this._onKey, this); this.parent.off('click', this._onClick, this); this.parent.off('scroll', this._onScroll, this); this.parent.off('focus', this._onFocus, this); } else { Control.off('key', this._onKey, this); Mouse.off('click', this._onClick, this); Mouse.off('scroll', this._onScroll, this); Focus.off('focus', this._onFocus, this); } I18n.off('langchange', this._onLangChange, this); }; /** * Create scene's element, is called when scene is being constructed * * @template * @returns {Object} Element, jQuery collection */ View.prototype.create = function() { return $('<div />'); }; /** * Remove scene's elements when scene is hiding * * @template */ View.prototype.remove = function() { }; /** * Remove or hide scene's element, is called when scene is being destructed * * @template * @return {Boolean/Promise} Return FALSE when you don't want to hide this scene, Promise may be also returned */ View.prototype.destroy = function() { }; /** * Initialise scene * * @template */ View.prototype.init = function() { }; /** * De-initialise scene * * @template */ View.prototype.deinit = function() { }; /** * Activate and focus scene when its shown * * @template * @return {Boolean/Promise} Return FALSE when you don't want to show this scene, Promise may be also returned */ View.prototype.activate = function() { }; /** * Deactivate scene when its hidden * * @template * @return {Boolean} Return FALSE when you don't want to destroy this scene when its hidden */ View.prototype.deactivate = function() { }; /** * This method is called when and 'activate' method fails * * @template * @return {Boolean} If TRUE is returned, router will call goBack (default action) */ View.prototype.revert = function() { return true; }; /** * Render snippet * * @template * @return {Promise} */ View.prototype.render = function() { }; /** * Render snippet into specified target element * * @param {Object} target jQuery collection or HTMLElement */ View.prototype.renderTo = function(target) { var p; this.$el.appendTo(target); p = this.render(); if (p instanceof Promise) { p.done(function() { this.show(); }, this); } else { this.show(); } return p; }; /** * Display scene's element and set `this.isVisible` to TRUE */ View.prototype.show = function() { var args = arguments; return this.when(function(promise) { var activated; if (this.onBeforeShow() === false) { promise.reject(); return false; } this.$el.show(); this.isVisible = true; this.isActive = false; this.onShow(); this.trigger('show'); promise.fail(function() { this.hide(); }, this); activated = this.activate.apply(this, args); if (activated instanceof Promise) { activated.then(function(status) { this.isActive = status; if (status) { promise.resolve(); } else { promise.reject(); } }, this); } else if (activated !== false) { this.isActive = true; promise.resolve(); } else { this.isActive = false; promise.reject(); } }, this); }; /** * Fired before the view is being shown and before `activate` method * * @template * @return {Boolean} */ View.prototype.onBeforeShow = function() { }; /** * Fired when this view is displayed * * @template */ View.prototype.onShow = function() { }; /** * Hide scene's element and set `this.isVisible` to FALSE */ View.prototype.hide = function() { return this.when(function(promise) { var deactivated; promise.done(function() { this.onBeforeHide(); this.$el.hide(); this.isVisible = false; this.onHide(); this.trigger('hide'); }, this); deactivated = this.deactivate(); if (deactivated instanceof Promise) { deactivated.then(function(status) { if (status) { this.isActive = false; promise.resolve(); } else { promise.reject(); } }, this); } else if (deactivated !== false) { this.isActive = false; promise.resolve(); } else { promise.reject(); } }, this); }; /** * Fired before the view is being hidden but after `deactivate` method (no return value) * * @template */ View.prototype.onBeforeHide = function() { }; /** * Fired when this view is hidden * * @template */ View.prototype.onHide = function() { }; /** * Test if this scene has focus (or any snippet inside this scene) * * @returns {Boolean} */ View.prototype.hasFocus = function() { return Focus.isIn(this.$el); }; /** * @private */ View.prototype._onKey = function(keyCode, ev, stop) { if (!this.isVisible || !this.hasFocus()) { return; } if (this.trigger('beforekey', keyCode, ev) === false) { return false; } if (this.onKey(keyCode, ev, stop) === false) { return false; } if (Control.isArrow(keyCode) && this.navigate(Control.getArrow(keyCode), stop) === false) { return false; } if (keyCode === Control.key.ENTER && this.onEnter(Focus.focused, ev, stop) === false) { return false; } else if (keyCode === Control.key.RETURN && this.onReturn(Focus.focused, ev, stop) === false) { return false; } if (this.trigger('key', keyCode, ev) === false) { return false; } }; /** * Handles keyDown events * * @template * @param {Number} keyCode * @param {Event} event * @param {Function} stop * @returns {Boolean} */ View.prototype.onKey = function(keyCode, ev, stop) { }; /** * Handles ENTER event * * @template * @param {Object} $el Target element, jQuery collection * @param {Event} event * @returns {Boolean} */ View.prototype.onEnter = function($el, event) { }; /** * Handles RETURN event * * @template * @param {Object} $el Target element, jQuery collection * @param {Event} event * @returns {Boolean} */ View.prototype.onReturn = function($el, event) { }; /** * @private */ View.prototype._onClick = function($el, event) { if (!$el.belongsTo(this.$el)) { return; } if (this.onClick.apply(this, arguments) === false) { return false; } return this.trigger('click', $el, event); }; /** * Handles Click event * * @param {Object} $el Target element, jQuery collection * @param {Event} event Mouse event * @returns {Boolean} */ View.prototype.onClick = function($el, event) { }; /** * @private */ View.prototype._onScroll = function($el, delta, event) { if (!$el.belongsTo(this.$el)) { return; } if (this.onScroll.apply(this, arguments) === false) { return false; } return this.trigger('scroll', $el, delta, event); }; /** * Handles Scroll event when this scene is visible * * @param {Object} $el Target element, jQuery collection * @param {Number} delta, 1 or -1 * @param {Event} event Mouse event * @returns {Boolean} */ View.prototype.onScroll = function($el, delta, event) { }; /** * @private */ View.prototype._onFocus = function($el) { if (!$el.belongsTo(this.$el)) { return; } if (this.onFocus.apply(this, arguments) === false) { return false; } return this.trigger('focus', $el); }; /** * Handles Focus event * * @template * @param {Object} $el Target element, jQuery collection * @returns {Boolean} */ View.prototype.onFocus = function($el) { }; /** * @private */ View.prototype._onLangChange = function() { if (this.onLangChange.apply(this, arguments) === false) { return false; } this.trigger('langchange'); }; /** * When app language is changed * * @template * @returns {Boolean} */ View.prototype.onLangChange = function() { }; /** * Navigate in 4-way direction * * @template * @param {String} direction Possible values: 'left', 'right', 'up', 'down' * @param {Function} stop * @return {Boolean} Return FALSE to prevent event from bubeling */ View.prototype.navigate = function(direction, stop) { }; /** * Get all focusable elements inside this snippet. This takes currentyl focused * element and calculates new one. If the new sibling is not exits, new focus * is getting from the start / end of collection - cyclic. * * Is the same like getFocusable, but you can specify parent and also you can * walkthrough all elements in cyclic. * * @param {Number} direction left is equal to -1, right to 1 * @param {Object} parent jquery object. All focusable elements belongs only to this parent. * @returns {Object} jQuery collection */ View.prototype.getCircleFocusable = function(direction, parent) { var els = $('.focusable', parent || this.$el).not('.disabled').filter(':visible'), focusedIndex = Focus.focused ? els.index(Focus.focused) : -1; if (focusedIndex !== -1) { focusedIndex += direction; if (focusedIndex === -1) return els.eq(els.length - 1); else if (focusedIndex > els.length - 1) return els.eq(0); else return els.eq(focusedIndex); } }; /** * Get all focusable elements inside this scene * * @param {Number} [index] If specified, then returns only one element at the specified position * @param {Boolean} [fromCurrentlyFocused=false] If TRUE, than elements before focused element are cut off * @param {Object} [$el=this.$el] Limit search for just this specified element, jQuery collection * @param {String} [selector=.focusable] * @returns {Object} jQuery collection */ View.prototype.getFocusable = function(index, fromCurrentlyFocused, $el, selector) { var els, focusedIndex, _index = index; if (!selector) { selector = '.focusable'; } els = $(selector, $el || this.$el).filter(':visible').not('.disabled'); if (fromCurrentlyFocused) { if(typeof fromCurrentlyFocused === 'boolean'){ focusedIndex = Focus.focused ? els.index(Focus.focused) : -1; } else { focusedIndex = els.index(fromCurrentlyFocused); } if (typeof index !== 'undefined' && _index < 0) { els = els.slice(0, (focusedIndex >= 0 ? focusedIndex : 1)); //_index += els.length; } else { els = els.slice(focusedIndex >= 0 ? focusedIndex : 0); } } if (typeof _index !== 'undefined') { return els.eq(_index >> 0); } return els; }; /** * Convert View into string * * @returns {String} */ View.prototype.toString = function() { this.render(); return this.$el[0].outerHTML; };
wdoganowski/inio-tvapp
framework/view.js
JavaScript
bsd-3-clause
12,630
[ 30522, 1013, 1008, 1008, 1008, 3193, 10061, 2465, 1008, 1008, 1030, 3166, 5003, 21823, 7393, 1055, 1012, 1054, 1012, 1051, 1012, 1008, 1030, 2465, 3193, 1008, 1030, 10061, 1008, 1030, 4666, 7076, 2824, 1008, 1030, 4666, 7076, 13366, 2121, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2016-present Open Networking Laboratory * * 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. */ /** * Implementation of YANG node bgpVrfAf's children nodes. */ package org.onosproject.yang.gen.v1.ne.bgpcomm.rev20141225.nebgpcomm.bgpcomm.bgpvrfs.bgpvrf.bgpvrfafs.bgpvrfaf;
mengmoya/onos
apps/l3vpn/nel3vpn/nemgr/src/main/java/org/onosproject/yang/gen/v1/ne/bgpcomm/rev20141225/nebgpcomm/bgpcomm/bgpvrfs/bgpvrf/bgpvrfafs/bgpvrfaf/package-info.java
Java
apache-2.0
796
[ 30522, 1013, 1008, 1008, 9385, 2355, 1011, 2556, 2330, 14048, 5911, 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, 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...
using FluentNHibernate.Mapping; using NHibernateCocoon.Tests.Entities; namespace NHibernateCocoon.Tests.Maps { public class PlaylistTrackMap : ClassMap<PlaylistTrack> { public PlaylistTrackMap() { Table("PlaylistTrack"); Id(x => x.PlaylistId); Map(x => x.TrackId); } } }
davedonaldson/NHibernateCocoon
src/NHibernateCocoon.Tests/Maps/PlaylistTrackMap.cs
C#
mit
293
[ 30522, 2478, 19376, 25311, 20755, 12789, 2618, 1012, 12375, 1025, 2478, 18699, 20755, 12789, 26557, 24163, 2239, 1012, 5852, 1012, 11422, 1025, 3415, 15327, 18699, 20755, 12789, 26557, 24163, 2239, 1012, 5852, 1012, 7341, 1063, 2270, 2465, 23...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 /** * AbstractField class file */ namespace Graviton\DocumentBundle\DependencyInjection\Compiler\Utils; /** * Base document field * * @author List of contributors <https://github.com/libgraviton/graviton/graphs/contributors> * @license https://opensource.org/licenses/MIT MIT License * @link http://swisscom.ch */ class AbstractField { /** * @var string */ private $fieldName; /** * @var string */ private $exposedName; /** * @var bool */ private $readOnly; /** * @var bool */ private $required; /** * @var bool */ private $searchable; /** * @var bool */ private $recordOriginException; /** * Constructor * * @param string $fieldName Field name * @param string $exposedName Exposed name * @param bool $readOnly Read only * @param bool $required Is required * @param bool $searchable Is searchable * @param bool $recordOriginException Is an exception to record origin */ public function __construct( $fieldName, $exposedName, $readOnly, $required, $searchable, $recordOriginException ) { $this->fieldName = $fieldName; $this->exposedName = $exposedName; $this->readOnly = $readOnly; $this->required = $required; $this->searchable = $searchable; $this->recordOriginException = $recordOriginException; } /** * Get field name * * @return string */ public function getFieldName() { return $this->fieldName; } /** * Get exposed name * * @return string */ public function getExposedName() { return $this->exposedName; } /** * Is read only * * @return bool */ public function isReadOnly() { return $this->readOnly; } /** * Is required * * @return bool */ public function isRequired() { return $this->required; } /** * Is searchable * * @return boolean */ public function isSearchable() { return $this->searchable; } /** * @param boolean $searchable Is searchable * * @return void */ public function setSearchable($searchable) { $this->searchable = $searchable; } /** * get RecordOriginException * * @return boolean RecordOriginException */ public function isRecordOriginException() { return $this->recordOriginException; } /** * set RecordOriginException * * @param boolean $recordOriginException recordOriginException * * @return void */ public function setRecordOriginException($recordOriginException) { $this->recordOriginException = $recordOriginException; } }
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/AbstractField.php
PHP
mit
2,983
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 10061, 3790, 2465, 5371, 1008, 1013, 3415, 15327, 24665, 18891, 2669, 1032, 6254, 27265, 2571, 1032, 24394, 2378, 20614, 3258, 1032, 21624, 1032, 21183, 12146, 1025, 1013, 1008, 1008, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
call zig4.exe -r 03_caz_wgt/03_caz_wgt.dat 03_caz_wgt/03_caz_wgt.spp 03_caz_wgt/03_caz_wgt_out/03_caz_wgt.txt 0 0 1 0 --grid-output-formats=compressed-tif --image-output-formats=png
VUEG/priocomp
analyses/zonation/priocomp/03_caz_wgt.bat
Batchfile
mit
182
[ 30522, 2655, 1062, 8004, 2549, 1012, 4654, 2063, 1011, 1054, 6021, 1035, 6187, 2480, 1035, 1059, 13512, 1013, 6021, 1035, 6187, 2480, 1035, 1059, 13512, 1012, 23755, 6021, 1035, 6187, 2480, 1035, 1059, 13512, 1013, 6021, 1035, 6187, 2480, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Rangy - Serializer Tests</title> <script type="text/javascript" src="../external/log4javascript.js"></script> <script type="text/javascript" src="../external/jshashtable.js"></script> <script type="text/javascript"> //var appender = new log4javascript.InPageAppender(); var appender = new log4javascript.BrowserConsoleAppender(); //log4javascript.getRootLogger().addAppender(appender); var log = log4javascript.getRootLogger(); log4javascript.setShowStackTraces(true); //log4javascript.setEnabled(false); </script> <script type="text/javascript" src="xntest.js"></script> <script type="text/javascript" src="testutils.js"></script> <script type="text/javascript"> xn.test.enableStackTraces = true; </script> <script type="text/javascript" src="../src/core/core.js"></script> <script type="text/javascript" src="../src/core/dom.js"></script> <script type="text/javascript" src="../src/core/domrange.js"></script> <script type="text/javascript" src="../src/core/wrappedrange.js"></script> <script type="text/javascript" src="../src/core/wrappedselection.js"></script> <script type="text/javascript" src="../src/modules/rangy-serializer.js"></script> <script type="text/javascript" src="serializertests.js"></script> <link rel="stylesheet" type="text/css" href="tests.css"/> </head> <body> <div id="test"></div> <div id="messages"></div> </body> </html>
shuizhongyueming/rangy
test/serializertests.html
HTML
mit
1,857
[ 30522, 1026, 1029, 20950, 2544, 1027, 1000, 1015, 1012, 1014, 30524, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, 19817, 1013, 1060, 11039, 19968, 2487, 1013, 26718, 2094, 1013, 1060, 11039...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
Instructions for releasing this cookbook: - Update `metadata.rb` with new cookbook version version '1.0.0' - Ensure all tests pass $ rake $ rake integration - Update `CHANGELOG.md` with recent changes $ rake changelog[v0.1.0] # use version of most-recent release tag - Prepend contents of `changelog.tmp` to `CHANGELOG.md` - Replace `HEAD` with current version number (match `metadata.rb` version) - Replace `YYYY-MM-DD` with current date, if necessary - For each commit line item: - Remove `Fix #xx ` string (regex: `Fix #\d+\s`) - Replace `TYPE` with one of: `BREAK` - breaking changes `FIX` - bug fix `IMPROVE` - improvement of existing feature `NEW` - new feature - Remove `changelog.tmp` - Commit changes to `metadata.rb` and `CHANGELOG.md` $ git add metadata.rb CHANGELOG.md $ git commit -m 'Update changelog, bump version' - Ensure working directory is clean; add/stash changes, if necessary $ git add . && git stash - Switch chef configuration $ chefvm use chef.io - Publish cookbook $ rake publish
4-20ma/cookbook-docker-integration-test
RELEASE.md
Markdown
apache-2.0
1,192
[ 30522, 8128, 2005, 8287, 2023, 5660, 8654, 1024, 1011, 10651, 1036, 27425, 1012, 21144, 1036, 2007, 2047, 5660, 8654, 2544, 2544, 1005, 1015, 1012, 1014, 1012, 1014, 1005, 1011, 5676, 2035, 5852, 3413, 1002, 26008, 1002, 26008, 8346, 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...
from django.conf.urls.defaults import * import frontend.views as frontend_views import codewiki.views import codewiki.viewsuml from django.contrib.syndication.views import feed as feed_view from django.views.generic import date_based, list_detail from django.views.generic.simple import direct_to_template from django.contrib import admin import django.contrib.auth.views as auth_views from django.conf import settings from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect from django.contrib import admin admin.autodiscover() # Need to move this somewhere more useful and try to make it less hacky but # seems to be the easiest way unfortunately. from django.contrib.auth.models import User User._meta.ordering = ['username'] from frontend.feeds import LatestCodeObjects, LatestCodeObjectsBySearchTerm, LatestCodeObjectsByTag, LatestViewObjects, LatestScraperObjects feeds = { 'all_code_objects': LatestCodeObjects, 'all_scrapers': LatestScraperObjects, 'all_views': LatestViewObjects, 'latest_code_objects_by_search_term': LatestCodeObjectsBySearchTerm, 'latest_code_objects_by_tag': LatestCodeObjectsByTag, } urlpatterns = patterns('', url(r'^$', frontend_views.frontpage, name="frontpage"), # redirects from old version (would clashes if you happen to have a scraper whose name is list!) (r'^scrapers/list/$', lambda request: HttpResponseRedirect(reverse('scraper_list_wiki_type', args=['scraper']))), url(r'^', include('codewiki.urls')), url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name="logout"), url(r'^accounts/', include('registration.urls')), url(r'^accounts/resend_activation_email/', frontend_views.resend_activation_email, name="resend_activation_email"), url(r'^captcha/', include('captcha.urls')), url(r'^attachauth', codewiki.views.attachauth), # allows direct viewing of the django tables url(r'^admin/', include(admin.site.urls)), # favicon (r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/media/images/favicon.ico'}), # RSS feeds url(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}, name='feeds'), # API (r'^api/', include('api.urls', namespace='foo', app_name='api')), # Status url(r'^status/$', codewiki.viewsuml.status, name='status'), # Documentation (r'^docs/', include('documentation.urls')), # Robots.txt (r'^robots.txt$', direct_to_template, {'template': 'robots.txt', 'mimetype': 'text/plain'}), # pdf cropper technology (r'^cropper/', include('cropper.urls')), # froth (r'^froth/', include('froth.urls')), # static media server for the dev sites / local dev url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_DIR, 'show_indexes':True}), url(r'^media-admin/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ADMIN_DIR, 'show_indexes':True}), #Rest of the site url(r'^', include('frontend.urls')), # redirects from old version (r'^editor/$', lambda request: HttpResponseRedirect('/scrapers/new/python?template=tutorial_python_trivial')), (r'^scrapers/show/(?P<short_name>[\w_\-]+)/(?:data/|map-only/)?$', lambda request, short_name: HttpResponseRedirect(reverse('code_overview', args=['scraper', short_name]))), )
rossjones/ScraperWikiX
web/urls.py
Python
agpl-3.0
3,556
[ 30522, 2013, 6520, 23422, 1012, 9530, 2546, 1012, 24471, 4877, 1012, 30524, 9148, 3211, 1012, 5328, 12324, 3642, 9148, 3211, 1012, 5328, 2819, 2140, 2013, 6520, 23422, 1012, 9530, 18886, 2497, 1012, 26973, 1012, 5328, 12324, 5438, 2004, 543...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 Embratel class PhoneBill attr_reader :payables def initialize(path) @payables = CSVParser.parse(path) end def calls @calls ||= payables.select(&:call?) end def fees @fees ||= payables.select(&:fee?) end def total @total ||= payables.inject(0) { |sum, payable| sum += payable.cost.to_f } end end end
mpereira/embratel
lib/embratel/phone_bill.rb
Ruby
mit
374
[ 30522, 11336, 7861, 22008, 2140, 2465, 3042, 24457, 2012, 16344, 1035, 8068, 1024, 3477, 3085, 2015, 13366, 3988, 4697, 1006, 4130, 1007, 1030, 3477, 3085, 2015, 1027, 20116, 2615, 19362, 8043, 1012, 11968, 3366, 1006, 4130, 1007, 2203, 133...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * This file is part of the Elcodi package. * * Copyright (c) 2014-2015 Elcodi.com * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * Feel free to edit as you please, and have fun. * * @author Marc Morera <yuhu@mmoreram.com> * @author Aldo Chiecchia <zimage@tiscali.it> * @author Elcodi Team <tech@elcodi.com> */ namespace Elcodi\Admin\PluginBundle\Controller; use Mmoreram\ControllerExtraBundle\Annotation\JsonResponse; use RuntimeException; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\HttpFoundation\Request; use Elcodi\Admin\CoreBundle\Controller\Abstracts\AbstractAdminController; use Elcodi\Component\Plugin\Entity\Plugin; use Elcodi\Component\Plugin\Form\Type\PluginType; use Elcodi\Component\Plugin\PluginTypes; /** * Class Controller for Plugins * * @Route( * path = "/plugin", * ) */ class PluginController extends AbstractAdminController { /** * List plugins * * @param string $category Optional plugin category * * @return array Result * * @Route( * path = "s", * name = "admin_plugin_list", * methods = {"GET"} * ) * * @Route( * path = "s/{category}", * name = "admin_plugin_categorized_list", * methods = {"GET"} * ) * * @Template */ public function listAction($category = null) { $criteria = [ 'type' => PluginTypes::TYPE_PLUGIN, ]; if ($category !== null) { $criteria['category'] = $category; } $plugins = $this ->get('elcodi.repository.plugin') ->findBy( $criteria, [ 'category' => 'ASC' ] ); return [ 'plugins' => $plugins, 'category' => $category, ]; } /** * Configure plugin * * @param Request $request Request * @param string $pluginHash Plugin hash * * @return array Result * * @throws RuntimeException Plugin not available for configuration * * @Route( * path = "/{pluginHash}", * name = "admin_plugin_configure", * methods = {"GET", "POST"} * ) * @Template */ public function configureAction( Request $request, $pluginHash ) { /** * @var Plugin $plugin */ $plugin = $this ->get('elcodi.repository.plugin') ->findOneBy([ 'hash' => $pluginHash, ]); $form = $this ->createForm( new PluginType($plugin), $plugin->getFieldValues() ); if ($request->isMethod(Request::METHOD_POST)) { $form->handleRequest($request); $pluginValues = $form->getData(); $plugin->setFieldValues($pluginValues); $this ->get('elcodi.object_manager.plugin') ->flush($plugin); $this->addFlash( 'success', $this ->get('translator') ->trans('admin.plugin.saved') ); return $this ->redirectToRoute('admin_plugin_configure', [ 'pluginHash' => $plugin->getHash(), ]); } return [ 'form' => $form->createView(), 'plugin' => $plugin, ]; } /** * Enable/Disable plugin * * @param Request $request Request * @param string $pluginHash Plugin hash * * @return array Result * * @Route( * path = "/{pluginHash}/enable", * name = "admin_plugin_enable", * methods = {"POST"} * ) * @JsonResponse() */ public function enablePluginAction( Request $request, $pluginHash ) { /** * @var Plugin $plugin */ $plugin = $this ->get('elcodi.repository.plugin') ->findOneBy([ 'hash' => $pluginHash, ]); $enabled = (boolean) $request ->request ->get('value'); $plugin->setEnabled($enabled); $this ->get('elcodi.object_manager.plugin') ->flush($plugin); $this ->get('elcodi.manager.menu') ->removeFromCache('admin'); return [ 'status' => 200, 'response' => [ $this ->get('translator') ->trans('admin.plugin.saved'), ], ]; } /** * Check if, given a plugin hash, a configuration page is available * * @param Plugin $plugin Plugin * * @return boolean Is available */ protected function isPluginConfigurable(Plugin $plugin = null) { return ($plugin instanceof Plugin) && $plugin->hasFields(); } }
deliberryeng/bamboo
src/Elcodi/Admin/PluginBundle/Controller/PluginController.php
PHP
mit
5,157
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 3449, 3597, 4305, 7427, 1012, 1008, 1008, 9385, 1006, 1039, 1007, 2297, 1011, 2325, 3449, 3597, 4305, 1012, 4012, 1008, 1008, 2005, 1996, 2440, 9385, 1998, 61...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- title: '[转]shell 中单引号、双引号、反引号、反斜杠区别' categories: [Linux] tags: [Linux, shell] date: 2016-12-30 15:36:51 keywords: Linux, shell toc: true --- > `shell` 可以识别 `4` 种不同类型的引字符号:单引号字符 `'`,双引号字符 `"`,反斜杠字符 `\`,反引号字符 <code>\`</code> ,学习 `shell` 编程的朋友可以看下。 # 1. 单引号( `'` ) ```shell $ grep Susan phonebook Susan Goldberg 403-212-4921 Susan Topple 212-234-2343 ``` 如果我们想查找的是 `Susan Goldberg`,不能直接使用 `grep Susan Goldberg phonebook` 命令,`grep` 会把 `Goldberg` 和 `phonebook` 当作需要搜索的文件。 ```shell $ grep 'Susan Gold' phonebook Susan Goldberg 403-212-4921 ``` 当 `shell` 碰到第一个单引号时,它忽略掉其后直到右引号的所有特殊字符。 <!-- more --> # 2. 双引号( `"` ) 双引号作用与单引号类似,区别在于它没有那么严格。单引号告诉 `shell` 忽略所有特殊字符,而双引号只要求忽略大多数,具体说,括在双引号中的三种特殊字符不被忽略:`$`、`\`、<code>`</code>。即双引号会解释字符串的特别意思,而单引号直接使用字符串。如果使用双引号将字符串赋给变量并反馈它,实际上与直接反馈变量并无差别。如果要查询包含空格的字符串,经常会用到双引号。 ```shell $ x=* $ echo $x hello.sh menus.sh misc.sh phonebook tshift.sh $ echo '$x' $x $ echo "$x" * ``` 这个例子可以看出无引号,单引号和双引号之间的区别。在最后一种情况中,双引号告诉 `shell` 在引号内照样进行变量名替换,所以 `shell` 把 `$x` 替换为 `*`,因为双引号中不做文件名替换,所以就把 `*` 作为要显示的值传递给 `echo`。 对于第一种情况需要进一步说明,`shell` 在给变量赋值时不进行文件名替换(这从第三种情况中也能看出来),各步骤发生的精确次序如下: `shell` 扫描命令行,把 `x` 的值设为星号 `*`; `shell` 再次扫描命令行,碰到星号 `*`,把它替换成当前目录下的文件清单;`shell` 启动执行 `echo` 命令,把文件清单作为参数传递给 `echo`。 这个赋值的先后次序非常重要:`shell` 先作变量替换,然后作文件名替换,最后把这行处理为参数。 # 3. 反引号(<code>`</code>) 命令替换是指 `shell` 能够将一个命令的标准输出插在一个命令行中任何位置。`shell` 中有两种方法作命令替换:把 `shell` 命令用反引号或者 `$(...)` 结构括起来,其中 `$(...)` 格式受到 `POSIX` 标准支持,也利于嵌套。 ```shell $ echo The date and time is `date` The date and time is 2016年 12月 28日 星期三 16:15:44 CST $ echo The date and time is $(date) The date and time is 2016年 12月 28日 星期三 16:15:44 CST $ echo Your current working directory is $(pwd) Your current working directory is /home/howard/script ``` # 4. 反斜杠 backslash-escaped( `\` ) 反斜杠一般用作转义字符,或称逃脱字符。`Linux` 如果 `echo` 要让转义字符发生作用,就要使用 `-e` 选项,且转义字符要使用双引号。 ```shell echo -e "\n" ``` 反斜杠的另一种作用,就是当反斜杠用于一行的最后一个字符时,**`shell` 把行尾的反斜杠作为续行**,这种结构在分几行输入长命令时经常使用。 ---------- [原文地址][1] [1]: http://www.jb51.net/article/33495.htm
rtlove/rtlove.github.io
_posts/2016-12-30-转-shell-中单引号、双引号、反引号、反斜杠区别.md
Markdown
mit
3,546
[ 30522, 1011, 1011, 1011, 2516, 1024, 1005, 1031, 100, 1033, 5806, 1746, 100, 100, 100, 1635, 100, 100, 100, 1635, 100, 100, 100, 1635, 100, 100, 100, 1782, 100, 1005, 7236, 1024, 1031, 11603, 1033, 22073, 1024, 1031, 11603, 1010, 5806, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #include "config.h" #include "HTMLFormCollection.h" #include "HTMLFieldSetElement.h" #include "HTMLFormControlElement.h" #include "HTMLFormElement.h" #include "HTMLImageElement.h" #include "HTMLNames.h" namespace WebCore { using namespace HTMLNames; // Since the collections are to be "live", we have to do the // calculation every time if anything has changed. HTMLFormCollection::HTMLFormCollection(Element* base) : HTMLCollection(base, FormControls, OverridesItemAfter) { ASSERT(base->hasTagName(formTag) || base->hasTagName(fieldsetTag)); } PassRefPtr<HTMLFormCollection> HTMLFormCollection::create(Element* base) { return adoptRef(new HTMLFormCollection(base)); } HTMLFormCollection::~HTMLFormCollection() { } const Vector<FormAssociatedElement*>& HTMLFormCollection::formControlElements() const { ASSERT(base()); ASSERT(base()->hasTagName(formTag) || base()->hasTagName(fieldsetTag)); if (base()->hasTagName(formTag)) return static_cast<HTMLFormElement*>(base())->associatedElements(); return static_cast<HTMLFieldSetElement*>(base())->associatedElements(); } const Vector<HTMLImageElement*>& HTMLFormCollection::formImageElements() const { ASSERT(base()); ASSERT(base()->hasTagName(formTag)); return static_cast<HTMLFormElement*>(base())->imageElements(); } Element* HTMLFormCollection::virtualItemAfter(unsigned& offset, Element* previousItem) const { const Vector<FormAssociatedElement*>& elementsArray = formControlElements(); if (previousItem) offset++; while (offset < elementsArray.size()) { FormAssociatedElement* element = elementsArray[offset]; if (element->isEnumeratable()) return toHTMLElement(element); offset++; } return 0; } static HTMLElement* firstNamedItem(const Vector<FormAssociatedElement*>& elementsArray, const Vector<HTMLImageElement*>* imageElementsArray, const QualifiedName& attrName, const String& name) { ASSERT(attrName == idAttr || attrName == nameAttr); for (unsigned i = 0; i < elementsArray.size(); ++i) { HTMLElement* element = toHTMLElement(elementsArray[i]); if (elementsArray[i]->isEnumeratable() && element->fastGetAttribute(attrName) == name) return element; } if (!imageElementsArray) return 0; for (unsigned i = 0; i < imageElementsArray->size(); ++i) { HTMLImageElement* element = (*imageElementsArray)[i]; if (element->fastGetAttribute(attrName) == name) return element; } return 0; } Node* HTMLFormCollection::namedItem(const AtomicString& name) const { // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/nameditem.asp // This method first searches for an object with a matching id // attribute. If a match is not found, the method then searches for an // object with a matching name attribute, but only on those elements // that are allowed a name attribute. const Vector<HTMLImageElement*>* imagesElements = base()->hasTagName(fieldsetTag) ? 0 : &formImageElements(); if (HTMLElement* item = firstNamedItem(formControlElements(), imagesElements, idAttr, name)) return item; return firstNamedItem(formControlElements(), imagesElements, nameAttr, name); } void HTMLFormCollection::updateNameCache() const { if (hasNameCache()) return; HashSet<AtomicStringImpl*> foundInputElements; const Vector<FormAssociatedElement*>& elementsArray = formControlElements(); for (unsigned i = 0; i < elementsArray.size(); ++i) { FormAssociatedElement* associatedElement = elementsArray[i]; if (associatedElement->isEnumeratable()) { HTMLElement* element = toHTMLElement(associatedElement); const AtomicString& idAttrVal = element->getIdAttribute(); const AtomicString& nameAttrVal = element->getNameAttribute(); if (!idAttrVal.isEmpty()) { appendIdCache(idAttrVal, element); foundInputElements.add(idAttrVal.impl()); } if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal) { appendNameCache(nameAttrVal, element); foundInputElements.add(nameAttrVal.impl()); } } } if (base()->hasTagName(formTag)) { const Vector<HTMLImageElement*>& imageElementsArray = formImageElements(); for (unsigned i = 0; i < imageElementsArray.size(); ++i) { HTMLImageElement* element = imageElementsArray[i]; const AtomicString& idAttrVal = element->getIdAttribute(); const AtomicString& nameAttrVal = element->getNameAttribute(); if (!idAttrVal.isEmpty() && !foundInputElements.contains(idAttrVal.impl())) appendIdCache(idAttrVal, element); if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && !foundInputElements.contains(nameAttrVal.impl())) appendNameCache(nameAttrVal, element); } } setHasNameCache(); } }
yoavweiss/RespImg-WebCore
html/HTMLFormCollection.cpp
C++
bsd-2-clause
6,034
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2639, 16357, 14161, 14511, 1006, 14161, 14511, 1030, 1047, 3207, 1012, 8917, 1007, 1008, 1006, 1039, 1007, 2639, 14405, 3775, 12849, 21997, 2080, 1006, 12849, 21997, 2080, 1030, 1047, 3207, 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...
namespace Amazon.Lambda.CloudWatchEvents.BatchEvents { /// <summary> /// AWS Batch Event /// https://docs.aws.amazon.com/batch/latest/userguide/batch_cwe_events.html /// </summary> public class BatchJobStateChangeEvent : CloudWatchEvent<Job> { } }
thedevopsmachine/aws-lambda-dotnet
Libraries/src/Amazon.Lambda.CloudWatchEvents/BatchEvents/BatchJobStateChangeEvent.cs
C#
apache-2.0
287
[ 30522, 3415, 15327, 9733, 1012, 23375, 1012, 6112, 18866, 18697, 7666, 1012, 14108, 18697, 7666, 1063, 1013, 1013, 1013, 1026, 12654, 1028, 1013, 1013, 1013, 22091, 2015, 14108, 2724, 1013, 1013, 1013, 16770, 1024, 1013, 1013, 9986, 2015, 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...
using TestMonkeys.EntityTest.Framework; namespace UsageExample.PropertySetValidatorTests.TestObjects { public class TestObjectImproperGreaterThan { [ValidateActualGreaterThan(0)] public object GreaterThanValue { get; set; } } }
TestMonkeys/Assert
UsageExample/PropertySetValidatorTests/TestObjects/TestObjectImproperGreaterThan.cs
C#
apache-2.0
259
[ 30522, 2478, 3231, 8202, 14839, 2015, 1012, 9178, 22199, 1012, 7705, 1025, 3415, 15327, 8192, 10288, 16613, 2571, 1012, 3200, 13462, 10175, 8524, 25485, 4355, 2015, 1012, 3231, 16429, 20614, 2015, 1063, 2270, 2465, 3231, 16429, 20614, 5714, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.path from pipeline.conf import settings from pipeline.compilers import SubProcessCompiler class LessCompiler(SubProcessCompiler): output_extension = 'css' def match_file(self, filename): return filename.endswith('.less') def compile_file(self, content, path): command = '%s %s %s' % ( settings.PIPELINE_LESS_BINARY, settings.PIPELINE_LESS_ARGUMENTS, path ) cwd = os.path.dirname(path) content = self.execute_command(command, cwd=cwd) return content
pdr/django-pipeline
pipeline/compilers/less.py
Python
mit
560
[ 30522, 12324, 9808, 1012, 4130, 2013, 13117, 1012, 9530, 2546, 12324, 10906, 2013, 13117, 1012, 21624, 2015, 12324, 4942, 21572, 9623, 9363, 8737, 9463, 2099, 2465, 2625, 9006, 22090, 2099, 1006, 4942, 21572, 9623, 9363, 8737, 9463, 2099, 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...
# Change History ## @NEXT@ ## 1.0.2 (2014-04-07) - workaround for `express-yui` bug where `gallery-` prefix causes extended core to load as gallery module (https://github.com/yahoo/express-yui/issues/58) ## 1.0.1 (2014-04-04) - optional trailing slash for customComboBase - print combo url count only when required ## 1.0.0 (2014-03-21) - uses `core`, `gallery`, and `shifter` module groups for lossy compression - uses anonymous `fullpath` module group for everything else - deprecated `path` and `root` module groups - breaks compatibility with previous versions of yui-combo-middleware@1.0.0 ## 0.1.3 (2013-11-26) Changes: - Enable root config support for `path` module groups ## 0.1.2 (2013-10-17) Changes: - Fix "JSON is undefined" error Available: - [gallery][]: gallery-2013.10.17-22-20 ## 0.1.1 (2013-10-16) Changes: - Enable the fullpath prefix tree compression with the `fullpathCompression` config [gallery]: https://github.com/yui/yui3-gallery/tree/master/build/gallery-pathogen-encoder
inikoo/fact
libs/yui/yui3-gallery/src/gallery-pathogen-encoder/HISTORY.md
Markdown
mit
1,026
[ 30522, 1001, 2689, 2381, 1001, 1001, 1030, 2279, 1030, 1001, 1001, 1015, 1012, 1014, 1012, 1016, 1006, 2297, 1011, 5840, 1011, 5718, 1007, 1011, 2147, 24490, 2005, 1036, 4671, 1011, 9805, 2072, 1036, 11829, 2073, 1036, 3916, 1011, 1036, 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...
import argparse from collections import defaultdict def calculateJaccardIndex(x,z,neighbours): shared = neighbours[x].intersection(neighbours[z]) combined = neighbours[x].union(neighbours[z]) return len(shared)/float(len(combined)) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Calculate scores for a set of scores') parser.add_argument('--cooccurrenceFile',type=str,required=True,help='File containing cooccurrences') parser.add_argument('--occurrenceFile',type=str,required=True,help='File containing occurrences') parser.add_argument('--sentenceCount',type=str,required=True,help='File containing sentence count') parser.add_argument('--relationsToScore',type=str,required=True,help='File containing relations to score') parser.add_argument('--anniVectors',type=str,help='File containing the raw ANNI vector data') parser.add_argument('--anniVectorsIndex',type=str,help='File containing the index for the ANNI vector data') parser.add_argument('--outFile',type=str,required=True,help='File to output scores to') args = parser.parse_args() print "Loading relationsToScore" relationsToScore = [] entitiesToScore = set() with open(args.relationsToScore) as f: for line in f: split = map(int,line.strip().split()) x,y = split[:2] relationsToScore.append((x,y)) entitiesToScore.add(x) entitiesToScore.add(y) entitiesToScore = sorted(list(entitiesToScore)) print "Loaded relationsToScore" print "Loading cooccurrences..." neighbours = defaultdict(set) with open(args.cooccurrenceFile) as f: for line in f: x,y,count = map(int,line.strip().split()) neighbours[x].add(y) neighbours[y].add(x) print "Loaded cooccurrences" print "Scoring..." with open(args.outFile,'w') as outF: for i,(x,z) in enumerate(relationsToScore): if (i%10000) == 0: print i jaccardScore = calculateJaccardIndex(x,z,neighbours) outData = [x,z,jaccardScore] outLine = "\t".join(map(str,outData)) outF.write(outLine+"\n") print "Completed scoring" print "Output to %s" % args.outFile
jakelever/knowledgediscovery
analysis/separate/jaccard.py
Python
mit
2,061
[ 30522, 12324, 12098, 21600, 11650, 2063, 2013, 6407, 12324, 12398, 29201, 13366, 18422, 3900, 16665, 17080, 13629, 2595, 1006, 1060, 1010, 1062, 1010, 14754, 1007, 1024, 4207, 1027, 14754, 1031, 1060, 1033, 1012, 6840, 1006, 14754, 1031, 1062...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.mybatis.generator.internal.util; import java.lang.reflect.Array; /** * This class is from javapractices.com: * * http://www.javapractices.com/Topic28.cjp * * Collected methods which allow easy implementation of <code>hashCode</code>. * * Example use case: * * <pre> * public int hashCode() { * int result = HashCodeUtil.SEED; * // collect the contributions of various fields * result = HashCodeUtil.hash(result, fPrimitive); * result = HashCodeUtil.hash(result, fObject); * result = HashCodeUtil.hash(result, fArray); * return result; * } * </pre> */ public final class HashCodeUtil { /** * An initial value for a <code>hashCode</code>, to which is added * contributions from fields. Using a non-zero value decreases collisons of * <code>hashCode</code> values. */ public static final int SEED = 23; /** * booleans. */ public static int hash(int aSeed, boolean aBoolean) { return firstTerm(aSeed) + (aBoolean ? 1 : 0); } /** * chars. */ public static int hash(int aSeed, char aChar) { return firstTerm(aSeed) + aChar; } /** * ints. */ public static int hash(int aSeed, int aInt) { /* * Implementation Note Note that byte and short are handled by this * method, through implicit conversion. */ return firstTerm(aSeed) + aInt; } /** * longs. */ public static int hash(int aSeed, long aLong) { return firstTerm(aSeed) + (int) (aLong ^ (aLong >>> 32)); } /** * floats. */ public static int hash(int aSeed, float aFloat) { return hash(aSeed, Float.floatToIntBits(aFloat)); } /** * doubles. */ public static int hash(int aSeed, double aDouble) { return hash(aSeed, Double.doubleToLongBits(aDouble)); } /** * <code>aObject</code> is a possibly-null object field, and possibly an * array. * * If <code>aObject</code> is an array, then each element may be a primitive * or a possibly-null object. */ public static int hash(int aSeed, Object aObject) { int result = aSeed; if (aObject == null) { result = hash(result, 0); } else if (!isArray(aObject)) { result = hash(result, aObject.hashCode()); } else { int length = Array.getLength(aObject); for (int idx = 0; idx < length; ++idx) { Object item = Array.get(aObject, idx); // recursive call! result = hash(result, item); } } return result; } // / PRIVATE /// private static final int fODD_PRIME_NUMBER = 37; private static int firstTerm(int aSeed) { return fODD_PRIME_NUMBER * aSeed; } private static boolean isArray(Object aObject) { return aObject.getClass().isArray(); } }
fnyexx/mybator
src/main/java/org/mybatis/generator/internal/util/HashCodeUtil.java
Java
apache-2.0
2,726
[ 30522, 7427, 8917, 1012, 2026, 14479, 2483, 1012, 13103, 1012, 30524, 1012, 4012, 1013, 8476, 22407, 1012, 1039, 3501, 2361, 1008, 1008, 5067, 4725, 2029, 3499, 3733, 7375, 1997, 1026, 3642, 1028, 23325, 16044, 1026, 1013, 3642, 1028, 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 yaml from os import makedirs from os.path import join,dirname,realpath,isdir script_dir = dirname(realpath(__file__)) default_yml_filepath = join(script_dir,'defaults.yml') defaults = { "output_dir": 'output', "header_img_dir": 'imgs/headers/', "scaled_img_dir": 'imgs/scaled/', "original_img_dir": 'imgs/original/', "header_img_url": 'imgs/headers/', "scaled_img_url": 'imgs/scaled/', "original_img_url": 'imgs/original/', "template_dir": join(script_dir,'templates'), "max_article_img_width": 710, "max_avatar_width": 710, "database_file": "database.yml", "static_dir": join(script_dir,'static'), "copyright_msg": None, "extra_links": [], "import_to_discourse": False, "strapline": None, } config = dict() def getConfig(): if not config: raise RuntimeError('config not loaded yet') return config def loadConfig(yml_filepath): config.update(defaults) with open(yml_filepath) as f: patch = yaml.load(f.read()) config.update(patch) # make paths absolute config['header_img_dir'] = join(config['output_dir'],config['header_img_dir']) config['scaled_img_dir'] = join(config['output_dir'],config['scaled_img_dir']) config['original_img_dir'] = join(config['output_dir'],config['original_img_dir']) config['database_file'] = join(config['output_dir'],config['database_file']) def makeDirs(): if not config: raise RuntimeError('config not loaded yet') for key in ['header_img_dir','scaled_img_dir','original_img_dir']: path = config[key] if not isdir(path): makedirs(path)
naggie/dsblog
dsblog/environment.py
Python
mit
1,659
[ 30522, 12324, 8038, 19968, 2013, 9808, 12324, 2191, 4305, 2869, 2013, 9808, 1012, 4130, 12324, 3693, 1010, 16101, 18442, 1010, 2613, 15069, 1010, 2003, 4305, 2099, 5896, 1035, 16101, 1027, 16101, 18442, 1006, 2613, 15069, 1006, 1035, 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...
<html> <head> <title>BOOST_PP_LIST_FIRST_N_D</title> <link rel="stylesheet" type="text/css" href="../styles.css"> </head> <body> <div style="margin-left: 0px;"> The <b>BOOST_PP_LIST_FIRST_N_D</b> macro expands to a <i>list</i> of the first <i>count</i> elements of a <i>list</i>.&nbsp; It reenters <b>BOOST_PP_WHILE</b> with maximum efficiency. </div> <h4>Usage</h4> <div class="code"> <b>BOOST_PP_LIST_FIRST_N_D</b>(<i>d</i>, <i>count</i>, <i>list</i>) </div> <h4>Arguments</h4> <dl> <dt>d</dt> <dd> The next available <b>BOOST_PP_WHILE</b> iteration. </dd> <dt>count</dt> <dd> The number of elements to extract. </dd> <dt>list</dt> <dd> The <i>list</i> from which the elements are extracted. </dd> </dl> <h4>Remarks</h4> <div> This macro extracts <i>count</i> elements from the beginning of <i>list</i> and returns them as a <i>list</i> </div> <h4>See Also</h4> <ul> <li><a href="list_first_n.html">BOOST_PP_LIST_FIRST_N</a></li> </ul> <h4>Requirements</h4> <div> <b>Header:</b> &nbsp;<a href="../headers/list/first_n.html">&lt;boost/preprocessor/list/first_n.hpp&gt;</a> </div> <h4>Sample Code</h4> <div><pre> #include &lt;<a href="../headers/list/first_n.html">boost/preprocessor/list/first_n.hpp</a>&gt; #include &lt;<a href="../headers/list/fold_left.html">boost/preprocessor/list/fold_right.hpp</a>&gt; #define L1 (a, (b, (c, (d, <a href="nil.html">BOOST_PP_NIL</a>)))) #define L2 (L1, (L1, (L1, <a href="nil.html">BOOST_PP_NIL</a>))) #define OP(d, state, x) (<a href="list_first_n_d.html">BOOST_PP_LIST_FIRST_N_D</a>(d, 2, x), state) <a href="list_fold_right.html">BOOST_PP_LIST_FOLD_RIGHT</a>(OP, <a href="nil.html">BOOST_PP_NIL</a>, L2) /* expands to... ((a, (b, <a href="nil.html">BOOST_PP_NIL</a>)), ((a, (b, <a href="nil.html">BOOST_PP_NIL</a>)), ((a, (b, <a href="nil.html">BOOST_PP_NIL</a>)) , <a href="nil.html">BOOST_PP_NIL</a> ))) */ </pre></div> <hr size="1"> <div style="margin-left: 0px;"> <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i> </br><i>© Copyright Paul Mensonides 2002</i> </div> <div style="margin-left: 0px;"> <p><small>Distributed under the Boost Software License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at <a href= "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p> </div> </body> </html>
NixaSoftware/CVis
venv/bin/libs/preprocessor/doc/ref/list_first_n_d.html
HTML
apache-2.0
2,483
[ 30522, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 12992, 1035, 4903, 1035, 2862, 1035, 2034, 1035, 1050, 1035, 1040, 1026, 1013, 2516, 1028, 1026, 4957, 2128, 2140, 1027, 1000, 6782, 21030, 2102, 1000, 2828, 1027, 1000, 3793, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 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.camunda.bpm.engine.test.api.runtime.util; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.ExecutionListener; /** * @author: Johannes Heinemann */ public class IncrementCounterListener implements ExecutionListener { public static int counter = 0; @Override public void notify(DelegateExecution execution) throws Exception { counter++; } }
AlexMinsk/camunda-bpm-platform
engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/util/IncrementCounterListener.java
Java
apache-2.0
977
[ 30522, 1013, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2007, 1996, 6105, 1012, 1008, 2017, 2089, 6855, 1037, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
R CMD REMOVE --library=$PREFIX/lib/R/library/ canine2cdf
joachimwolff/bioconda-recipes
recipes/bioconductor-canine2cdf/pre-unlink.sh
Shell
mit
57
[ 30522, 1054, 4642, 2094, 6366, 1011, 1011, 3075, 1027, 1002, 17576, 1013, 5622, 2497, 1013, 1054, 1013, 3075, 1013, 28735, 2475, 19797, 2546, 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...
/* * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package com.sun.corba.se.spi.protocol; import org.omg.CORBA.portable.ServantObject; /** * @author Harold Carr */ public interface LocalClientRequestDispatcher { public boolean useLocalInvocation(org.omg.CORBA.Object self); public boolean is_local(org.omg.CORBA.Object self); /** * Returns a Java reference to the servant which should be used for this * request. servant_preinvoke() is invoked by a local stub. * If a ServantObject object is returned, then its servant field * has been set to an object of the expected type (Note: the object may * or may not be the actual servant instance). The local stub may cast * the servant field to the expected type, and then invoke the operation * directly. * * @param self The object reference which delegated to this delegate. * * @param operation a string containing the operation name. * The operation name corresponds to the operation name as it would be * encoded in a GIOP request. * * @param expectedType a Class object representing the expected type of the servant. * The expected type is the Class object associated with the operations * class of the stub's interface (e.g. A stub for an interface Foo, * would pass the Class object for the FooOperations interface). * * @return a ServantObject object. * The method may return a null value if it does not wish to support * this optimization (e.g. due to security, transactions, etc). * The method must return null if the servant is not of the expected type. */ public ServantObject servant_preinvoke(org.omg.CORBA.Object self, String operation, Class expectedType); public void servant_postinvoke(org.omg.CORBA.Object self, ServantObject servant); } // End of file.
shun634501730/java_source_cn
src_en/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcher.java
Java
apache-2.0
2,154
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2526, 1010, 2494, 1010, 14721, 1998, 1013, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 1008, 14721, 16350, 1013, 18777, 1012, 2224, 2003, 3395, 2000, 6105, 3408, 1012, 1008, 1008, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2013 Guidewire Software, Inc. */ package gw.lang.parser; public interface IStackProvider { int THIS_POS = 0; int SUPER_POS = 1; int START_POS = 2; /** * For compile-time assignment of stack indexes. */ public int getNextStackIndex(); /** * For compile-time assignment of stack indexes at a particular scope. */ public int getNextStackIndexForScope( IScope scope ); /** * For compile-time use. Returns true iff an isolated scope is visible. */ public boolean hasIsolatedScope(); }
gosu-lang/old-gosu-repo
gosu-core-api/src/main/java/gw/lang/parser/IStackProvider.java
Java
apache-2.0
538
[ 30522, 1013, 1008, 1008, 9385, 2286, 5009, 20357, 4007, 1010, 4297, 1012, 1008, 1013, 7427, 1043, 2860, 1012, 11374, 1012, 11968, 8043, 1025, 2270, 8278, 21541, 8684, 21572, 17258, 2121, 1063, 20014, 2023, 1035, 13433, 2015, 1027, 1014, 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...
/** * Provides live preview facilities for the event date format fields, akin * to (and using the same ajax mechanism as) the date format preview in WP's * general settings screen. */ jQuery( document ).ready( function( $ ) { // Whenever the input field for a date format changes, update the matching // live preview area $( ".live-date-preview" ).siblings( "input" ).change( function() { var $format_field = $( this ); var new_format = $format_field.val(); var $preview_field = $format_field.siblings( ".live-date-preview" ); /** * Update the preview field when we get our response back from WP. */ var show_update = function( preview_text ) { preview_text = $( "<div/>" ).html( preview_text ).text(); // Escaping! $preview_field.html( preview_text ); } // Before making the request, show the spinner (this should naturally be "wiped" // when the response is rendered) $preview_field.append( "<span class='spinner'></span>" ); $preview_field.find( ".spinner" ).css( "visibility", "visible" ); var request = { action: "date_format", date: new_format } $.post( ajaxurl, request, show_update, "text" ); } ); } );
pdpfsug/wp_raga10
wp_raga10/wp-content/plugins/the-events-calendar/vendor/tickets/common/src/resources/js/admin-date-preview.js
JavaScript
agpl-3.0
1,173
[ 30522, 1013, 1008, 1008, 1008, 3640, 2444, 19236, 4128, 2005, 1996, 2724, 3058, 4289, 4249, 1010, 17793, 1008, 2000, 1006, 1998, 2478, 1996, 2168, 18176, 7337, 2004, 1007, 1996, 3058, 4289, 19236, 1999, 1059, 2361, 1005, 1055, 1008, 2236, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- layout: post title: "Open Government is booting back up in DC!" post_author: "Sandra Moscoso" post_twitter: "@sandramoscoso" post_avatar: "sandra_moscoso.jpg" date: 2013-12-10 02:00:00 categories: blog --- <p> In October, Mayor Gray <a href="http://open.dc.gov">announced a new "Transparency and Open Government Initiative"</a> and opened a period for public comment on how to increase openness and transparency in government. For DC dogooders, this represents the beginning of a fresh opportunity to leverage information generated or captured by the city to advocate for local causes, improve government services, and work alongside government to solve social problems. </p> <p> The easiest way to do this is to respond to the request for comments on the online form released by the Transparency and Open Government Initiative. However, I also recommend copying and reaching out to Traci Hughes, the District's Director of the Office of Open Government. Charged by the Board of Ethics and Government Accountability (BEGA) "to bring greater transparency to District government operations", Ms. Hughes ensure's the City's compliance with Freedom of Information Act (FOIA) and the District's Open Meetings Act. Read - if you have a FOIA request, Ms. Hughes can help you navigate the process, as well as help the agency respond. Exciting! </p> <span class="blog-img-wrapper"> <img src="{{ site.baseurl }}/{{ site.img_dir }}/blog/images/bega-logo.jpg" /> </span> <p> You know who's really excited? Code for DC. So excited, that they organized a working session to think through and draft a response to the request for comment. Over thirty civic hackers showed up on a Wednesday night, including techies, policy wonks, and average folks. The group developed recommendations around data and formats, policy and participation, efficacy measures, and impediments. The work session kicked off with encouraging words from Ms. Hughes, framing her vision for an open, collaborative and innovative approach to the city's transparency initiative. </p> <p> This initiative has the potential to benefit DC advocates focused on transport, dc budget, dc code, blighted properties, potholes, bike lanes, affordable housing, education, you name it. Are you inspired to comment and know exactly what you'd recommend and need? Go for it! Under the section “What government information should be more readily available online or more easily searched?,” if you're asking for specific data, it's helpful to make the ask in way that states the problem you're trying to solve and the data you need to solve it. </p> <p> A wonky education example to support current issues is: <blockquote>I want to participate in the Deputy Mayor of Education's student assignment and school boundary review. In order to make recommendations, I want to understand the student population and mobility among the DCPS and charter schools in my neighborhood. I need the following data for 2009 through 2013, in a CSV format (and API, if possible): <ul> <li> Neighborhood residency info for students at school level (for ES, MS, HS), sorted by Ward </li> <li> Charter and DCPS at school level, with percentage in-bounds, percentage in Ward, sorted by Ward </li> <li> 4th and 5th grade attrition rates at every DCPS elementary school, by Ward </li> <li> ... </li> </ul> </blockquote> </p> <p> If you can't think of data you need right now, but want to respond, might I suggest that you take the above example and paste it into your response (ASAP)? Thousands of DC parents will thank you -- starting with me! </p> <p> Here’s an image if you need it (creative commons) http://flic.kr/p/dS3Y4a </p>
CodeForTucson/codefortucson-site
blog/_drafts/2013-12-10-dc-transparency-open-government-comment.html
HTML
gpl-2.0
3,686
[ 30522, 1011, 1011, 1011, 9621, 1024, 2695, 2516, 1024, 1000, 2330, 2231, 2003, 9573, 2075, 2067, 2039, 1999, 5887, 999, 1000, 2695, 1035, 3166, 1024, 1000, 12834, 9587, 9363, 6499, 1000, 2695, 1035, 10474, 1024, 1000, 1030, 12834, 15530, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
# Google VR SDK for Unity - Demo Scenes Copyright (c) 2016 Google Inc. All rights reserved. ## Headset Demo Scene File: **Assets/Gvr/DemoScenes/HeadsetDemo/DemoScene.unity** This demo is a simple scene that uses the headset with gaze input (without a controller). The "game" consists of locating the cube and clicking the viewer's trigger button. Compatible with a traditional Cardboard viewer. ## Controller Demo Scene File: **Assets/Gvr/DemoScenes/ControllerDemo/ControllerDemo.unity** This is a demo of how to use the controller. Running this scene on an actual phone requires an Android N build running on a supported VR device (for example, a Nexus 6P), and a controller or controller emulator. If you want to run the scene in the Unity Editor only, you only need a phone with the controller emulator installed. For instructions on how download and set up your controller emulator, see the information about controller support in [https://developers.google.com/vr](https://developers.google.com/vr). Summary: * The controller phone can be running any version of Android supported by the controller emulator app (Lollipop and above, at the time of this writing). * Install the controller emulator app on the controller phone. To run the scene in the Unity Editor: * Make sure you have the Android SDK installed, and that the ``adb`` command is in your PATH environment variable. * Connect your controller phone to your computer with a USB cable. * Verify that you are correctly set up by typing ``adb devices`` on a terminal. That should list your device. * Click Play on the Unity Editor. To run the scene on your headset phone: * You will need two phones, one for the headset and one to use as a controller emulator. * The headset phone must be running an Android N build. * Set up a WiFi hotspot on your controller phone, and have your headset phone connect to it (remove your SIM card if you want to avoid mobile data charges). * Make sure you've gone through the necessary setup steps to enable controller emulator support on your headset phone (in particular, verify that **Enable Controller Emulator** is enabled in **Google VR Services Settings**). * Launch the Controller Demo scene on the headset phone. How to play: * Point at cubes using your controller or controller emulator. * Hold the controller's touchpad as you move your controller to drag the cubes around the scene. * Repeat until happiness is achieved. Note: the controller can only be used on a supported VR-enabled Android device (at the time of this writing, the Nexus 6P) running a VR-enabled build of Android N (the latest Android N developer preview build). On any other device or platform (e.g. unsupported Android device, iOS, desktop, etc), the controller API will still be present, but will always report the controller as being disconnected.
WilliamQLiu/unity3d-apartment
Assets/GoogleVR/DemoScenes/README.md
Markdown
apache-2.0
2,992
[ 30522, 1001, 8224, 27830, 17371, 2243, 2005, 8499, 1011, 9703, 5019, 9385, 1006, 1039, 1007, 2355, 8224, 4297, 1012, 2035, 2916, 9235, 1012, 1001, 1001, 4641, 3388, 9703, 3496, 5371, 1024, 1008, 1008, 7045, 1013, 1043, 19716, 1013, 18267, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 './freeling' Freeling::Util.init_locale('default') FLDIR = '/usr/local/share/freeling'.freeze LANG = 'en'.freeze tokenizer = Freeling::Tokenizer.new("#{FLDIR}/#{LANG}/tokenizer.dat") splitter = Freeling::Splitter.new("#{FLDIR}/#{LANG}/splitter.dat") session = splitter.open_session maco_options = Freeling::Maco_options.new(LANG) maco_options.set_data_files( '', "#{FLDIR}/common/punct.dat", "#{FLDIR}/#{LANG}/dicc.src", "#{FLDIR}/#{LANG}/afixos.dat", '', "#{FLDIR}/#{LANG}/locucions.dat", "#{FLDIR}/#{LANG}/np.dat", "#{FLDIR}/#{LANG}/quantities.dat", "#{FLDIR}/#{LANG}/probabilitats.dat" ) morphological_analyzer = Freeling::Maco.new(maco_options) # activate mmorpho odules to be used in next call morphological_analyzer.set_active_options( false, # umap - User Map true, # num - Number Detection true, # pun - Punctuation Detection true, # dat - Dates Detection true, # dic - Dictionary Search (also splits words) true, # aff - Affix (?) false, # comp - Compounds (?) true, # rtk - Retokenization (?) true, # mw - Multiword Recognition true, # ner - Named Entity Recognition true, # qt - Quantity Recognition true # prb - Probability Assignment and Unknown Word Guesser ) # create tagger and sense anotator, tagger = Freeling::Hmm_tagger.new("#{FLDIR}/#{LANG}/tagger.dat", true, 2) sense_labeler = Freeling::Senses.new("#{FLDIR}/#{LANG}/senses.dat") while (input = gets) input.chomp tokens = tokenizer.tokenize(input) sentences = splitter.split(session, tokens, true) sentences = morphological_analyzer.analyze(sentences) sentences = tagger.analyze(sentences) sentences = sense_labeler.analyze(sentences) sentences.each do |sentence| sentence.each do |word| puts word.get_form + ' ' + word.get_lemma + ' ' + word.get_tag + ' ' + word.get_senses_string end puts ' ' end end splitter.close_session(session)
TALP-UPC/freeling
APIs/ruby/sample.rb
Ruby
agpl-3.0
1,925
[ 30522, 5478, 1005, 1012, 1013, 2489, 2989, 1005, 2489, 2989, 1024, 1024, 21183, 4014, 1012, 1999, 4183, 1035, 2334, 2063, 1006, 1005, 12398, 1005, 1007, 13109, 4305, 2099, 1027, 1005, 1013, 2149, 2099, 1013, 2334, 1013, 3745, 1013, 2489, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
const App = require('./spec/app'); module.exports = config => { const params = { basePath: '', frameworks: [ 'express-http-server', 'jasmine' ], files: [ 'lib/**/*.js' ], colors: true, singleRun: true, logLevel: config.LOG_WARN, browsers: [ 'Chrome', 'PhantomJS' ], concurrency: Infinity, reporters: [ 'spec', 'coverage' ], preprocessors: { 'lib/**/*.js': ['coverage'] }, coverageReporter: { dir: 'coverage/', reporters: [ { type: 'html', subdir: 'report' }, { type: 'lcovonly', subdir: './', file: 'coverage-front.info' }, { type: 'lcov', subdir: '.' } ] }, browserDisconnectTimeout: 15000, browserNoActivityTimeout: 120000, expressHttpServer: { port: 8092, appVisitor: App } }; if (process.env.TRAVIS) { params.browsers = [ 'PhantomJS' ]; } config.set(params); };
kylekatarnls/momentum
karma.conf.js
JavaScript
mit
1,377
[ 30522, 9530, 3367, 10439, 1027, 5478, 1006, 1005, 1012, 1013, 28699, 1013, 10439, 1005, 1007, 1025, 11336, 1012, 14338, 1027, 9530, 8873, 2290, 1027, 1028, 1063, 9530, 3367, 11498, 5244, 1027, 1063, 2918, 15069, 1024, 1005, 1005, 1010, 7705...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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) 2013 Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR # CONTRIBUTORS 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. """Gluster storage class. This class is very similar to FileStorage, given that Gluster when mounted behaves essentially like a regular file system. Unlike RBD, there are no special provisions for block device abstractions (yet). """ import logging import os import socket from ganeti import utils from ganeti import errors from ganeti import netutils from ganeti import constants from ganeti import ssconf from ganeti.utils import io from ganeti.storage import base from ganeti.storage.filestorage import FileDeviceHelper class GlusterVolume(object): """This class represents a Gluster volume. Volumes are uniquely identified by: - their IP address - their port - the volume name itself Two GlusterVolume objects x, y with same IP address, port and volume name are considered equal. """ def __init__(self, server_addr, port, volume, _run_cmd=utils.RunCmd, _mount_point=None): """Creates a Gluster volume object. @type server_addr: str @param server_addr: The address to connect to @type port: int @param port: The port to connect to (Gluster standard is 24007) @type volume: str @param volume: The gluster volume to use for storage. """ self.server_addr = server_addr server_ip = netutils.Hostname.GetIP(self.server_addr) self._server_ip = server_ip port = netutils.ValidatePortNumber(port) self._port = port self._volume = volume if _mount_point: # tests self.mount_point = _mount_point else: self.mount_point = ssconf.SimpleStore().GetGlusterStorageDir() self._run_cmd = _run_cmd @property def server_ip(self): return self._server_ip @property def port(self): return self._port @property def volume(self): return self._volume def __eq__(self, other): return (self.server_ip, self.port, self.volume) == \ (other.server_ip, other.port, other.volume) def __repr__(self): return """GlusterVolume("{ip}", {port}, "{volume}")""" \ .format(ip=self.server_ip, port=self.port, volume=self.volume) def __hash__(self): return (self.server_ip, self.port, self.volume).__hash__() def _IsMounted(self): """Checks if we are mounted or not. @rtype: bool @return: True if this volume is mounted. """ if not os.path.exists(self.mount_point): return False return os.path.ismount(self.mount_point) def _GuessMountFailReasons(self): """Try and give reasons why the mount might've failed. @rtype: str @return: A semicolon-separated list of problems found with the current setup suitable for display to the user. """ reasons = [] # Does the mount point exist? if not os.path.exists(self.mount_point): reasons.append("%r: does not exist" % self.mount_point) # Okay, it exists, but is it a directory? elif not os.path.isdir(self.mount_point): reasons.append("%r: not a directory" % self.mount_point) # If, for some unfortunate reason, this folder exists before mounting: # # /var/run/ganeti/gluster/gv0/10.0.0.1:30000:gv0/ # '--------- cwd ------------' # # and you _are_ trying to mount the gluster volume gv0 on 10.0.0.1:30000, # then the mount.glusterfs command parser gets confused and this command: # # mount -t glusterfs 10.0.0.1:30000:gv0 /var/run/ganeti/gluster/gv0 # '-- remote end --' '------ mountpoint -------' # # gets parsed instead like this: # # mount -t glusterfs 10.0.0.1:30000:gv0 /var/run/ganeti/gluster/gv0 # '-- mountpoint --' '----- syntax error ------' # # and if there _is_ a gluster server running locally at the default remote # end, localhost:24007, then this is not a network error and therefore... no # usage message gets printed out. All you get is a Byson parser error in the # gluster log files about an unexpected token in line 1, "". (That's stdin.) # # Not that we rely on that output in any way whatsoever... parser_confusing = io.PathJoin(self.mount_point, self._GetFUSEMountString()) if os.path.exists(parser_confusing): reasons.append("%r: please delete, rename or move." % parser_confusing) # Let's try something else: can we connect to the server? sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: sock.connect((self.server_ip, self.port)) sock.close() except socket.error as err: reasons.append("%s:%d: %s" % (self.server_ip, self.port, err.strerror)) reasons.append("try running 'gluster volume info %s' on %s to ensure" " it exists, it is started and it is using the tcp" " transport" % (self.volume, self.server_ip)) return "; ".join(reasons) def _GetFUSEMountString(self): """Return the string FUSE needs to mount this volume. @rtype: str """ return "-o server-port={port} {ip}:/{volume}" \ .format(port=self.port, ip=self.server_ip, volume=self.volume) def GetKVMMountString(self, path): """Return the string KVM needs to use this volume. @rtype: str """ ip = self.server_ip if netutils.IPAddress.GetAddressFamily(ip) == socket.AF_INET6: ip = "[%s]" % ip return "gluster://{ip}:{port}/{volume}/{path}" \ .format(ip=ip, port=self.port, volume=self.volume, path=path) def Mount(self): """Try and mount the volume. No-op if the volume is already mounted. @raises BlockDeviceError: if the mount was unsuccessful @rtype: context manager @return: A simple context manager that lets you use this volume for short lived operations like so:: with volume.mount(): # Do operations on volume # Volume is now unmounted """ class _GlusterVolumeContextManager(object): def __init__(self, volume): self.volume = volume def __enter__(self): # We're already mounted. return self def __exit__(self, *exception_information): self.volume.Unmount() return False # do not swallow exceptions. if self._IsMounted(): return _GlusterVolumeContextManager(self) command = ["mount", "-t", "glusterfs", self._GetFUSEMountString(), self.mount_point] io.Makedirs(self.mount_point) self._run_cmd(" ".join(command), # Why set cwd? Because it's an area we control. If, # for some unfortunate reason, this folder exists: # "/%s/" % _GetFUSEMountString() # ...then the gluster parser gets confused and treats # _GetFUSEMountString() as your mount point and # self.mount_point becomes a syntax error. cwd=self.mount_point) # mount.glusterfs exits with code 0 even after failure. # https://bugzilla.redhat.com/show_bug.cgi?id=1031973 if not self._IsMounted(): reasons = self._GuessMountFailReasons() if not reasons: reasons = "%r failed." % (" ".join(command)) base.ThrowError("%r: mount failure: %s", self.mount_point, reasons) return _GlusterVolumeContextManager(self) def Unmount(self): """Try and unmount the volume. Failures are logged but otherwise ignored. @raises BlockDeviceError: if the volume was not mounted to begin with. """ if not self._IsMounted(): base.ThrowError("%r: should be mounted but isn't.", self.mount_point) result = self._run_cmd(["umount", self.mount_point]) if result.failed: logging.warning("Failed to unmount %r from %r: %s", self, self.mount_point, result.fail_reason) class GlusterStorage(base.BlockDev): """File device using the Gluster backend. This class represents a file storage backend device stored on Gluster. Ganeti mounts and unmounts the Gluster devices automatically. The unique_id for the file device is a (file_driver, file_path) tuple. """ def __init__(self, unique_id, children, size, params, dyn_params, **kwargs): """Initalizes a file device backend. """ if children: base.ThrowError("Invalid setup for file device") try: self.driver, self.path = unique_id except ValueError: # wrong number of arguments raise ValueError("Invalid configuration data %s" % repr(unique_id)) server_addr = params[constants.GLUSTER_HOST] port = params[constants.GLUSTER_PORT] volume = params[constants.GLUSTER_VOLUME] self.volume = GlusterVolume(server_addr, port, volume) self.full_path = io.PathJoin(self.volume.mount_point, self.path) self.file = None super(GlusterStorage, self).__init__(unique_id, children, size, params, dyn_params, **kwargs) self.Attach() def Assemble(self): """Assemble the device. Checks whether the file device exists, raises BlockDeviceError otherwise. """ assert self.attached, "Gluster file assembled without being attached" self.file.Exists(assert_exists=True) def Shutdown(self): """Shutdown the device. """ self.file = None self.dev_path = None self.attached = False def Open(self, force=False, exclusive=True): """Make the device ready for I/O. This is a no-op for the file type. """ assert self.attached, "Gluster file opened without being attached" def Close(self): """Notifies that the device will no longer be used for I/O. This is a no-op for the file type. """ pass def Remove(self): """Remove the file backing the block device. @rtype: boolean @return: True if the removal was successful """ with self.volume.Mount(): self.file = FileDeviceHelper(self.full_path) if self.file.Remove(): self.file = None return True else: return False def Rename(self, new_id): """Renames the file. """ # TODO: implement rename for file-based storage base.ThrowError("Rename is not supported for Gluster storage") def Grow(self, amount, dryrun, backingstore, excl_stor): """Grow the file @param amount: the amount (in mebibytes) to grow with """ self.file.Grow(amount, dryrun, backingstore, excl_stor) def Attach(self, **kwargs): """Attach to an existing file. Check if this file already exists. @rtype: boolean @return: True if file exists """ try: self.volume.Mount() self.file = FileDeviceHelper(self.full_path) self.dev_path = self.full_path except Exception as err: self.volume.Unmount() raise err self.attached = self.file.Exists() return self.attached def GetActualSize(self): """Return the actual disk size. @note: the device needs to be active when this is called """ return self.file.Size() def GetUserspaceAccessUri(self, hypervisor): """Generate KVM userspace URIs to be used as `-drive file` settings. @see: L{BlockDev.GetUserspaceAccessUri} @see: https://github.com/qemu/qemu/commit/8d6d89cb63c57569864ecdeb84d3a1c2eb """ if hypervisor == constants.HT_KVM: return self.volume.GetKVMMountString(self.path) else: base.ThrowError("Hypervisor %s doesn't support Gluster userspace access" % hypervisor) @classmethod def Create(cls, unique_id, children, size, spindles, params, excl_stor, dyn_params, **kwargs): """Create a new file. @param size: the size of file in MiB @rtype: L{bdev.FileStorage} @return: an instance of FileStorage """ if excl_stor: raise errors.ProgrammerError("FileStorage device requested with" " exclusive_storage") if not isinstance(unique_id, (tuple, list)) or len(unique_id) != 2: raise ValueError("Invalid configuration data %s" % str(unique_id)) full_path = unique_id[1] server_addr = params[constants.GLUSTER_HOST] port = params[constants.GLUSTER_PORT] volume = params[constants.GLUSTER_VOLUME] volume_obj = GlusterVolume(server_addr, port, volume) full_path = io.PathJoin(volume_obj.mount_point, full_path) # Possible optimization: defer actual creation to first Attach, rather # than mounting and unmounting here, then remounting immediately after. with volume_obj.Mount(): FileDeviceHelper.CreateFile(full_path, size, create_folders=True) return GlusterStorage(unique_id, children, size, params, dyn_params, **kwargs)
andir/ganeti
lib/storage/gluster.py
Python
bsd-2-clause
14,117
[ 30522, 1001, 1001, 1001, 9385, 1006, 1039, 1007, 2286, 8224, 4297, 1012, 1001, 2035, 2916, 9235, 1012, 1001, 1001, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302, 1001, 14080, 1010, 2024, 7936, 3024, 2008, 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...
package simple; public class Computer { private CPU cpu; public Computer() { } public Computer(CPU c) { cpu = c; } public CPU getCpu() { return cpu; } public void setCpu(CPU cpu) { this.cpu = cpu; } public void print() { cpu.print(); } }
dodaro/ea2014
Lesson3/src/simple/Computer.java
Java
apache-2.0
268
[ 30522, 7427, 3722, 1025, 2270, 2465, 3274, 1063, 2797, 17368, 17368, 1025, 2270, 3274, 1006, 1007, 1063, 1065, 2270, 3274, 1006, 17368, 1039, 1007, 1063, 17368, 1027, 1039, 1025, 1065, 2270, 17368, 2131, 21906, 2226, 1006, 1007, 1063, 2709,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * This file is part of the Alice package. * * (c) Nelmio <hello@nelm.io> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Nelmio\Alice\FixtureBuilder\Denormalizer; use Nelmio\Alice\FixtureBuilder\BareFixtureSet; use Nelmio\Alice\FixtureBuilder\DenormalizerInterface; use Nelmio\Alice\NotCallableTrait; class FakeDenormalizer implements DenormalizerInterface { use NotCallableTrait; public function denormalize(array $data): BareFixtureSet { $this->__call(__METHOD__, func_get_args()); } }
nelmio/alice
fixtures/FixtureBuilder/Denormalizer/FakeDenormalizer.php
PHP
mit
655
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 5650, 7427, 1012, 1008, 1008, 1006, 1039, 1007, 11265, 13728, 3695, 1026, 7592, 1030, 11265, 13728, 1012, 22834, 1028, 1008, 1008, 2005, 1996, 2440, 9385, 1998,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright 2005-2006 Ferdinand Prantl <prantl@users.sourceforge.net> // Copyright 2001-2004 The Apache Software 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. // // See http://ant-eclipse.sourceforge.net for the most recent version // and more information. package prantl.ant.eclipse; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.util.Vector; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; /** * Provides the functionality generating the file <tt>.classpath</tt> for the supplied * task object. It is expected to be used within the class EclipseTask. * * @see EclipseTask * @since Ant-Eclipse 1.0 * @author Ferdinand Prantl &lt;prantl@users.sourceforge.net&gt; */ final class ClassPathGenerator { /** * Contains a ready-to write information about a binary classpath entry - element * kinds "lib" or "var". Fields of this class match attributes of the element * <tt>classpath</tt>. * * @see ClassPathGenerator#writeProcessedBinaryClassPathEntries(XmlWriter, String, * Vector) * @since Ant-Eclipse 1.0 * @author Ferdinand Prantl &lt;prantl@users.sourceforge.net&gt; */ static class ProcessedBinaryClassPathEntry { String kind; String path; boolean exported; String sourcepath; String javadoc_location; } private EclipseTask task; /** * Creates a new instance of the generating object. * * @param parent * The parent task. * @since Ant-Eclipse 1.0 */ ClassPathGenerator(EclipseTask parent) { task = parent; } /** * Generates the file <tt>.classpath</tt> using the supplied output object. * * @since Ant-Eclipse 1.0 */ void generate() { ClassPathElement classPath = task.getEclipse().getClassPath(); if (classPath == null) { task.log("There was no description of a classpath found.", Project.MSG_WARN); return; } EclipseOutput output = task.getOutput(); if (output.isClassPathUpToDate()) { task.log("The classpath definition is up-to-date.", Project.MSG_WARN); return; } task.log("Writing the classpath definition."); XmlWriter writer = null; try { writer = new XmlWriter(new OutputStreamWriter(new BufferedOutputStream(output .createClassPath()), "UTF-8")); writer.writeXmlDeclaration("UTF-8"); writer.openElement("classpath"); checkClassPathEntries(classPath); generateContainerClassPathEntry(writer); generateSourceClassPathEntries(writer); Vector entries = new Vector(); processVariableClassPathEntries(entries, classPath.getVariables()); processLibraryClassPathEntries(entries, classPath.getLibraries()); writeProcessedBinaryClassPathEntries(writer, entries); generateOutputClassPathEntry(writer); writer.closeElement("classpath"); } catch (UnsupportedEncodingException exception) { throw new BuildException("Encoder to UTF-8 is not supported.", exception); } catch (IOException exception) { throw new BuildException("Writing the classpath definition failed.", exception); } finally { if (writer != null) try { writer.close(); } catch (IOException exception1) { throw new BuildException("Closing the classpath definition failed.", exception1); } } } private void generateContainerClassPathEntry(XmlWriter writer) throws IOException { ClassPathEntryContainerElement container = task.getEclipse().getClassPath() .getContainer(); if (container == null) { task.log("No container found, a default one added.", Project.MSG_VERBOSE); container = new ClassPathEntryContainerElement(); } container.validate(); String path = container.getPath(); if (path.indexOf('/') < 0 && !path.startsWith("org.eclipse.jdt.launching.JRE_CONTAINER")) { task.log("Prepending the container class name to the container path \"" + path + "\".", Project.MSG_VERBOSE); path = "org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/" + path; } task.log("Adding container \"" + path + "\".", Project.MSG_VERBOSE); openClassPathEntry(writer, "con", path); writer.closeDegeneratedElement(); } private void generateSourceClassPathEntries(XmlWriter writer) throws IOException { Vector entries = task.getEclipse().getClassPath().getSources(); if (entries.size() == 0) { task .log("No source found, the current directory added.", Project.MSG_VERBOSE); entries.addElement(new ClassPathEntrySourceElement()); } for (int i = 0, size = entries.size(); i != size; ++i) { ClassPathEntrySourceElement entry = (ClassPathEntrySourceElement) entries .get(i); entry.validate(); String excluding = entry.getExcluding(); String output = entry.getOutput(); Path path = new Path(task.getProject()); Reference reference = entry.getPathRef(); String[] items = path.list(); if (reference != null) { path.setRefid(reference); items = path.list(); } else { String value = entry.getPath(); if (value.length() == 0) task.log("Using the current directory as a default source path.", Project.MSG_VERBOSE); items = new String[] { value }; } String baseDirectory = task.getProject().getBaseDir().getAbsolutePath(); for (int j = 0; j != items.length; ++j) { String item = cutBaseDirectory(items[j], baseDirectory); task.log("Adding sources from \"" + item + "\".", Project.MSG_VERBOSE); openClassPathEntry(writer, "src", item); if (excluding != null) writer.appendAttribute("excluding", excluding); if (output != null) writer.appendAttribute("output", output); writer.closeDegeneratedElement(); } } } private void processVariableClassPathEntries(Vector entries, Vector paths) { processBinaryClassPathEntries(entries, "var", paths); } private void processLibraryClassPathEntries(Vector entries, Vector paths) { processBinaryClassPathEntries(entries, "lib", paths); } private void processBinaryClassPathEntries(Vector entries, String kind, Vector binaries) { for (int i = 0, size = binaries.size(); i != size; ++i) { ClassPathEntryBinaryElement entry = (ClassPathEntryBinaryElement) binaries .get(i); entry.validate(); Path path = new Path(task.getProject()); Reference reference = entry.getPathRef(); if (reference != null) path.setRefid(reference); else { String value = entry.getPath(); path.setPath(value); } processBinaryClassPathEntries(entries, kind, entry.getExported(), entry .getSource(), entry.getJavadoc(), path.list()); } } private void processBinaryClassPathEntries(Vector entries, String kind, boolean exported, String source, String javadoc_location, String[] items) { String baseDirectory = task.getProject().getBaseDir().getAbsolutePath(); for (int j = 0; j != items.length; ++j) { String item = cutBaseDirectory(items[j], baseDirectory); ProcessedBinaryClassPathEntry element = getProcessedBinaryClassPathEntry( entries, item); if (element == null) { task.log("Processing binary dependency \"" + item + "\" of the kind \"" + kind + "\".", Project.MSG_VERBOSE); element = new ProcessedBinaryClassPathEntry(); element.kind = kind; element.path = item; element.exported = exported; element.sourcepath = source; element.javadoc_location = javadoc_location; entries.addElement(element); } else { task.log("Updating binary dependency \"" + item + "\" of the kind \"" + kind + "\".", Project.MSG_VERBOSE); element.kind = kind; element.path = item; element.exported = exported; element.sourcepath = source; element.javadoc_location = javadoc_location; } } } private void writeProcessedBinaryClassPathEntries(XmlWriter writer, Vector entries) throws IOException { for (int i = 0, size = entries.size(); i != size; ++i) { ProcessedBinaryClassPathEntry element = (ProcessedBinaryClassPathEntry) entries .get(i); task.log("Adding binary dependency \"" + element.path + "\" of the kind \"" + element.kind + "\".", Project.MSG_VERBOSE); openClassPathEntry(writer, element.kind, element.path); if (element.exported) writer.appendAttribute("exported", "true"); if (element.sourcepath != null) writer.appendAttribute("sourcepath", element.sourcepath); if (element.javadoc_location != null) { writer.closeOpeningTag(); writer.openElement("attributes"); writer.openOpeningTag("attribute"); writer.appendAttribute("value", element.javadoc_location); writer.appendAttribute("name", "javadoc_location"); writer.closeDegeneratedElement(); writer.closeElement("attributes"); writer.closeElement("classpathentry"); } else writer.closeDegeneratedElement(); } } private void generateOutputClassPathEntry(XmlWriter writer) throws IOException { ClassPathEntryOutputElement output = task.getEclipse().getClassPath().getOutput(); if (output == null) { task .log("No output found, the current directory added.", Project.MSG_VERBOSE); output = new ClassPathEntryOutputElement(); } output.validate(); String path = cutBaseDirectory(output.getPath(), task.getProject().getBaseDir() .getAbsolutePath()); task.log("Adding output into \"" + path + "\".", Project.MSG_VERBOSE); openClassPathEntry(writer, "output", path); writer.closeDegeneratedElement(); } private void openClassPathEntry(XmlWriter writer, String kind, String path) throws IOException { writer.openOpeningTag("classpathentry"); writer.appendAttribute("kind", kind); writer.appendAttribute("path", path); } private String cutBaseDirectory(String path, String base) { if (!path.startsWith(base)) return path; task.log("Cutting base directory \"" + base + "\" from the path \"" + path + "\".", Project.MSG_VERBOSE); return path.substring(base.length() + 1); } private void checkClassPathEntries(ClassPathElement classPath) { if (task.getEclipse().getMode().getIndex() == EclipseElement.Mode.ASPECTJ && getClassPathEntry(classPath.getVariables(), "ASPECTJRT_LIB") == null) { ClassPathEntryVariableElement variable = classPath.createVariable(); variable.setPath("ASPECTJRT_LIB"); variable.setSource("ASPECTJRT_SRC"); } } private static ClassPathEntryElement getClassPathEntry(Vector entries, String path) { for (int i = 0, size = entries.size(); i != size; ++i) { ClassPathEntryElement entry = (ClassPathEntryElement) entries.get(i); if (path.equals(entry.getPath())) return entry; } return null; } private static ProcessedBinaryClassPathEntry getProcessedBinaryClassPathEntry( Vector entries, String path) { for (int i = 0, size = entries.size(); i < size; ++i) { ProcessedBinaryClassPathEntry entry = (ProcessedBinaryClassPathEntry) entries .get(i); if (entry.path.equals(path)) return entry; } return null; } }
spidaman/ant-eclipse
src/prantl/ant/eclipse/ClassPathGenerator.java
Java
apache-2.0
14,121
[ 30522, 1013, 1013, 9385, 2384, 1011, 2294, 9684, 10975, 4630, 2140, 1026, 10975, 4630, 2140, 1030, 5198, 1012, 3120, 29278, 3351, 1012, 5658, 1028, 1013, 1013, 9385, 2541, 1011, 2432, 1996, 15895, 4007, 3192, 1013, 1013, 2035, 2916, 9235, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 <set> #include <map> #include <string> #include <vector> #include <queue> #include <stack> #include <cmath> #include <list> #include <cassert> #include <climits> #include <cstring> #include <cstdio> #include <cstdlib> #include <cctype> #include <fstream> #include <sstream> #include <iostream> #include <algorithm> #include <stdexcept> using namespace std; #define LL long long #define F first #define S second #define PB push_back #define PF push front #define MP make_pair #define REP(x, n) for(int x=0; x<(n); ++x) #define FOR(x, b, e) for(int x=b; x<=(e); ++x) #define FORD(x, b, e) for(int x=b; x>=(e); --x) #define VAR(v,n) __typeof(n) v=(n) #define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i) #define MOD(x, n) ((x)%(n)+(n))%(n) #define SZ(x) (int((x).size())) #define ALL(x) ((x).begin()),((x).end()) #define SORT(v) sort((v).begin(),(v).end()) #define UNIQUE(v) SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end()) LL GCD( LL a , LL b ) { while( b ) b ^= a ^= b ^= a %= b ; return a ; } LL LCM( LL a , LL b ) { return a * ( b / GCD( a , b ) ) ; } typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<LL> VLL; typedef vector<bool> VB; typedef vector<double> VD; typedef vector<string> VS; typedef pair<int, int> PII; typedef vector<PII> VPII; typedef pair<LL, LL> PLL; typedef vector<PLL> VPLL; typedef list<int> LI; const double EPS = 10e-9; const double INF = (1LL << 30); using namespace std; std::string int2str( int n ) { std::ostringstream result; result << n; return result.str(); } int str2int( const std::string& s ) { int result; std::istringstream ss( s ); ss >> result; if (!ss) throw std::invalid_argument( "StrToInt" ); return result; } int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif return 0; }
bolatov/contests
codeforces.ru/cf183/p4.cpp
C++
mit
1,861
[ 30522, 1001, 2421, 1026, 2275, 1028, 1001, 2421, 1026, 4949, 1028, 1001, 2421, 1026, 5164, 1028, 1001, 2421, 1026, 9207, 1028, 1001, 2421, 1026, 24240, 1028, 1001, 2421, 1026, 9991, 1028, 1001, 2421, 1026, 4642, 8988, 1028, 1001, 2421, 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...
#!/usr/bin/env ruby require "pathname" require_relative "testframework/testhelper" require_relative "testframework/testenvironment" require_relative "testframework/testdefinition" require_relative "testframework/testoperator" environment = TestEnvironment.new() definition = TestDefinition.new() pathname = Pathname.new(__FILE__).expand_path definition.name = pathname.basename.sub_ext("") definition.description = "different prefixes for id and id2 will be shown" definition.compiler_flags = [ "-DLOGGER_ENABLE" ] definition.library_directories = [ ] definition.libraries = [ ] definition.source_files = [ "./#{definition.name}.c" ] definition.executable = "./#{definition.name}" definition.arguments = [ ] definition.stdin = "" definition.stdout = "#{definition.name}.template_stdout" definition.stderr = "" definition.files = [ [ "", ""] ] definition.status = 0 definition.temporary_files = [ "#{definition.executable}" ] operator = TestOperator.new(environment, definition) operator.setup() if operator.buildTest() puts "#{definition.name} ... #{fail()} (build)" return_value = 1 else if operator.runTest() puts "#{definition.name} ... #{fail()} (behavior)" return_value = 1 else puts "#{definition.name} ... #{pass()}" return_value = 0 end end operator.cleanup() exit return_value
embear/logger
test/test014.rb
Ruby
mit
1,456
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 10090, 5478, 1000, 4130, 18442, 1000, 5478, 1035, 5816, 1000, 3231, 15643, 6198, 1013, 3231, 16001, 4842, 1000, 5478, 1035, 5816, 1000, 3231, 15643, 6198, 1013, 3231, 2368, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/python # -*- coding: UTF-8 -*- # # Copyright 2010 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Unit tests to cover CampaignTargetService.""" __author__ = 'api.sgrinberg@gmail.com (Stan Grinberg)' import os import sys sys.path.insert(0, os.path.join('..', '..', '..')) import unittest from adspygoogle.common import Utils from tests.adspygoogle.adwords import HTTP_PROXY from tests.adspygoogle.adwords import SERVER_V201109 from tests.adspygoogle.adwords import TEST_VERSION_V201109 from tests.adspygoogle.adwords import VERSION_V201109 from tests.adspygoogle.adwords import client class CampaignTargetServiceTestV201109(unittest.TestCase): """Unittest suite for CampaignTargetService using v201109.""" SERVER = SERVER_V201109 VERSION = VERSION_V201109 client.debug = False service = None campaign_id = '0' def setUp(self): """Prepare unittest.""" print self.id() if not self.__class__.service: self.__class__.service = client.GetCampaignTargetService( self.__class__.SERVER, self.__class__.VERSION, HTTP_PROXY) if self.__class__.campaign_id == '0': campaign_service = client.GetCampaignService( self.__class__.SERVER, self.__class__.VERSION, HTTP_PROXY) operations = [{ 'operator': 'ADD', 'operand': { 'name': 'Campaign #%s' % Utils.GetUniqueName(), 'status': 'PAUSED', 'biddingStrategy': { 'xsi_type': 'ManualCPC' }, 'budget': { 'period': 'DAILY', 'amount': { 'microAmount': '1000000' }, 'deliveryMethod': 'STANDARD' } } }] self.__class__.campaign_id = campaign_service.Mutate( operations)[0]['value'][0]['id'] def testGetAllTargets(self): """Test whether we can fetch all existing targets for given campaign.""" selector = { 'campaignIds': [self.__class__.campaign_id] } self.assert_(isinstance(self.__class__.service.Get(selector), tuple)) def testAddAdScheduleTarget(self): """Test whether we can add an ad schedule target to campaign.""" operations = [{ 'operator': 'SET', 'operand': { 'xsi_type': 'AdScheduleTargetList', 'campaignId': self.__class__.campaign_id, 'targets': [{ 'xsi_type': 'AdScheduleTarget', 'dayOfWeek': 'MONDAY', 'startHour': '8', 'startMinute': 'ZERO', 'endHour': '17', 'endMinute': 'ZERO', 'bidMultiplier': '1.0', }] } }] self.assert_(isinstance(self.__class__.service.Mutate(operations), tuple)) def makeTestSuiteV201109(): """Set up test suite using v201109. Returns: TestSuite test suite using v201109. """ suite = unittest.TestSuite() suite.addTests(unittest.makeSuite(CampaignTargetServiceTestV201109)) return suite if __name__ == '__main__': suites = [] if TEST_VERSION_V201109: suites.append(makeTestSuiteV201109()) if suites: alltests = unittest.TestSuite(suites) unittest.main(defaultTest='alltests')
nearlyfreeapps/python-googleadwords
tests/adspygoogle/adwords/campaign_target_service_unittest.py
Python
apache-2.0
3,781
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 18750, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 1011, 1022, 1011, 1008, 1011, 1001, 1001, 9385, 2230, 8224, 4297, 1012, 2035, 2916, 9235, 1012, 1001, 1001, 7000, 2104, 1996, 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) 1995 The University of Utah and * the Computer Systems Laboratory at the University of Utah (CSL). * All rights reserved. * * Permission to use, copy, modify and distribute this software is hereby * granted provided that (1) source code retains these copyright, permission, * and disclaimer notices, and (2) redistributions including binaries * reproduce the notices in supporting documentation, and (3) all advertising * materials mentioning features or use of this software display the following * acknowledgement: ``This product includes software developed by the * Computer Systems Laboratory at the University of Utah.'' * * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * CSL requests users of this software to return to csl-dist@cs.utah.edu any * improvements that they make and grant CSL redistribution rights. */ /* 15-410 mods by de0u 2008-09-02 */ #include <stdio.h> #include <console.h> int putchar(int c) { return ((unsigned char)putbyte(c)); }
alexoneill/geckOS
lib/stdio/putchar.c
C
mit
1,185
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2786, 1996, 2118, 1997, 6646, 1998, 1008, 1996, 3274, 3001, 5911, 2012, 1996, 2118, 1997, 6646, 30524, 1998, 5860, 19771, 5017, 14444, 1010, 1998, 1006, 1016, 1007, 25707, 2015, 2164, 8026, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 (1.8.0_112) on Tue Sep 12 14:31:26 MST 2017 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class org.wildfly.swarm.config.infinispan.cache_container.PersistenceThreadPool (BOM: * : All 2017.9.5 API)</title> <meta name="date" content="2017-09-12"> <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.wildfly.swarm.config.infinispan.cache_container.PersistenceThreadPool (BOM: * : All 2017.9.5 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">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 class="aboutLanguage">WildFly Swarm API, 2017.9.5</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?org/wildfly/swarm/config/infinispan/cache_container/class-use/PersistenceThreadPool.html" target="_top">Frames</a></li> <li><a href="PersistenceThreadPool.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;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.wildfly.swarm.config.infinispan.cache_container.PersistenceThreadPool" class="title">Uses of Class<br>org.wildfly.swarm.config.infinispan.cache_container.PersistenceThreadPool</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a></span><span class="tabEnd">&nbsp;</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.wildfly.swarm.config.infinispan">org.wildfly.swarm.config.infinispan</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config.infinispan.cache_container">org.wildfly.swarm.config.infinispan.cache_container</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.wildfly.swarm.config.infinispan"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a> in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/package-summary.html">org.wildfly.swarm.config.infinispan</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/package-summary.html">org.wildfly.swarm.config.infinispan</a> that return <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a></span><span class="tabEnd">&nbsp;</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><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a></code></td> <td class="colLast"><span class="typeNameLabel">CacheContainer.CacheContainerResources.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.CacheContainerResources.html#persistenceThreadPool--">persistenceThreadPool</a></span>()</code> <div class="block">Defines a thread pool used for interacting with the persistent store.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/package-summary.html">org.wildfly.swarm.config.infinispan</a> with parameters of type <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a></span><span class="tabEnd">&nbsp;</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><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.html" title="type parameter in CacheContainer">T</a></code></td> <td class="colLast"><span class="typeNameLabel">CacheContainer.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.html#persistenceThreadPool-org.wildfly.swarm.config.infinispan.cache_container.PersistenceThreadPool-">persistenceThreadPool</a></span>(<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a>&nbsp;value)</code> <div class="block">Defines a thread pool used for interacting with the persistent store.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.wildfly.swarm.config.infinispan.cache_container"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a> in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/package-summary.html">org.wildfly.swarm.config.infinispan.cache_container</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/package-summary.html">org.wildfly.swarm.config.infinispan.cache_container</a> with type parameters of type <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a>&lt;T extends <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a>&lt;T&gt;&gt;</span></code> <div class="block">Defines a thread pool used for interacting with the persistent store.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>interface&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPoolConsumer</a>&lt;T extends <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a>&lt;T&gt;&gt;</span></code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>interface&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPoolSupplier.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPoolSupplier</a>&lt;T extends <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a>&gt;</span></code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/package-summary.html">org.wildfly.swarm.config.infinispan.cache_container</a> that return <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a></span><span class="tabEnd">&nbsp;</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><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">PersistenceThreadPool</a></code></td> <td class="colLast"><span class="typeNameLabel">PersistenceThreadPoolSupplier.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPoolSupplier.html#get--">get</a></span>()</code> <div class="block">Constructed instance of PersistenceThreadPool resource</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/PersistenceThreadPool.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">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 class="aboutLanguage">WildFly Swarm API, 2017.9.5</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?org/wildfly/swarm/config/infinispan/cache_container/class-use/PersistenceThreadPool.html" target="_top">Frames</a></li> <li><a href="PersistenceThreadPool.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;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 &#169; 2017 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p> </body> </html>
wildfly-swarm/wildfly-swarm-javadocs
2017.9.5/apidocs/org/wildfly/swarm/config/infinispan/cache_container/class-use/PersistenceThreadPool.html
HTML
apache-2.0
14,144
[ 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...
/* * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy) * Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the Politecnico di Torino nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT * OWNER OR CONTRIBUTORS 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. * * @(#) $Header: /tcpdump/master/libpcap/pcap-stdinc.h,v 1.10.2.1 2008-10-06 15:38:39 gianluca Exp $ (LBL) */ #define SIZEOF_CHAR 1 #define SIZEOF_SHORT 2 #define SIZEOF_INT 4 #ifndef _MSC_EXTENSIONS #define SIZEOF_LONG_LONG 8 #endif /* * Avoids a compiler warning in case this was already defined * (someone defined _WINSOCKAPI_ when including 'windows.h', in order * to prevent it from including 'winsock.h') */ #ifdef _WINSOCKAPI_ #undef _WINSOCKAPI_ #endif #include <winsock2.h> #include <fcntl.h> #include "bittypes.h" #include <time.h> #include <io.h> #ifndef __MINGW32__ #include "IP6_misc.h" #endif #define caddr_t char* #if _MSC_VER < 1500 #define snprintf _snprintf #define vsnprintf _vsnprintf #define strdup _strdup #endif #define inline __inline #ifdef __MINGW32__ #include <stdint.h> #else /*__MINGW32__*/ /* MSVC compiler */ #ifndef _UINTPTR_T_DEFINED #ifdef _WIN64 typedef unsigned __int64 uintptr_t; #else typedef _W64 unsigned int uintptr_t; #endif #define _UINTPTR_T_DEFINED #endif #ifndef _INTPTR_T_DEFINED #ifdef _WIN64 typedef __int64 intptr_t; #else typedef _W64 int intptr_t; #endif #define _INTPTR_T_DEFINED #endif #endif /*__MINGW32__*/
armink/rt-thread
bsp/simulator/pcap/Include/pcap-stdinc.h
C
apache-2.0
2,865
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2526, 1011, 2384, 5658, 17058, 1010, 13205, 2278, 8713, 2080, 4487, 24737, 1006, 3304, 1007, 1008, 9385, 1006, 1039, 1007, 2384, 1011, 2268, 6187, 3401, 6786, 1010, 4297, 1012, 4482, 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...
<?php use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\LogicException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; /** * This class has been auto-generated * by the Symfony Dependency Injection Component. * * @final */ class Symfony_DI_PhpDumper_Test_JsonParameters extends Container { private $parameters = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); $this->services = $this->privates = []; $this->aliases = []; } public function compile(): void { throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled(): bool { return true; } public function getRemovedIds(): array { return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, ]; } /** * @return array|bool|float|int|string|null */ public function getParameter($name) { $name = (string) $name; if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } if (isset($this->loadedDynamicParameters[$name])) { return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } return $this->parameters[$name]; } public function hasParameter($name): bool { $name = (string) $name; return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } public function setParameter($name, $value): void { throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag(): ParameterBagInterface { if (null === $this->parameterBag) { $parameters = $this->parameters; foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } private $loadedDynamicParameters = [ 'hello' => false, 'hello-bar' => false, ]; private $dynamicParameters = []; private function getDynamicParameter(string $name) { switch ($name) { case 'hello': $value = $this->getEnv('json:foo'); break; case 'hello-bar': $value = $this->getEnv('json:bar'); break; default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } $this->loadedDynamicParameters[$name] = true; return $this->dynamicParameters[$name] = $value; } protected function getDefaultParameters(): array { return [ 'env(foo)' => '["foo","bar"]', 'env(bar)' => 'null', ]; } }
zerkms/symfony
src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_json_env.php
PHP
mit
3,718
[ 30522, 1026, 1029, 25718, 2224, 25353, 2213, 14876, 4890, 1032, 6922, 1032, 24394, 2378, 20614, 3258, 1032, 6685, 1032, 2128, 11101, 3085, 6914, 6906, 4263, 1025, 2224, 25353, 2213, 14876, 4890, 1032, 6922, 1032, 24394, 2378, 20614, 3258, 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...
#include "stdafx.h" #include "RFLinkBase.h" #include "../main/Logger.h" #include "../main/Helper.h" #include "../main/RFXtrx.h" #include "hardwaretypes.h" #include "../main/localtime_r.h" #include "../main/SQLHelper.h" #include "../main/mainworker.h" #include "../main/WebServer.h" #include "../webserver/cWebem.h" #include "../json/json.h" #ifdef _DEBUG #define ENABLE_LOGGING #endif struct _tRFLinkStringIntHelper { std::string szType; int gType; }; const _tRFLinkStringIntHelper rfswitches[] = { { "X10", sSwitchTypeX10 }, // p9 { "Kaku", sSwitchTypeARC }, // p3 { "AB400D", sSwitchTypeAB400D }, // p3 { "Waveman", sSwitchTypeWaveman }, // p- { "EMW200", sSwitchTypeEMW200 }, // p- { "Impuls", sSwitchTypeIMPULS }, // p3 { "RisingSun", sSwitchTypeRisingSun }, // p- { "Philips", sSwitchTypePhilips }, // p- { "Energenie", sSwitchTypeEnergenie }, // p- { "Energenie5", sSwitchTypeEnergenie5 }, // p- { "GDR2", sSwitchTypeGDR2 }, // p- { "NewKaku", sSwitchTypeAC }, // p4 { "HomeEasy", sSwitchTypeHEU }, // p15 { "Anslut", sSwitchTypeANSLUT }, // p17 { "Kambrook", sSwitchTypeKambrook }, // p8 { "Ikea Koppla", sSwitchTypeKoppla }, // p14 { "PT2262", sSwitchTypePT2262 }, // p3 { "Lightwave", sSwitchTypeLightwaveRF }, // p18 { "EMW100", sSwitchTypeEMW100 }, // p13 { "BSB", sSwitchTypeBBSB }, // p- { "MDRemote", sSwitchTypeMDREMOTE }, // p14 { "Conrad", sSwitchTypeRSL }, // p7 { "Livolo", sSwitchTypeLivolo }, // p- { "TRC02RGB", sSwitchTypeTRC02 }, // p10 { "Aoke", sSwitchTypeAoke }, // p- { "TRC022RGB", sSwitchTypeTRC02_2 }, // p- { "Eurodomest", sSwitchTypeEurodomest }, // p5 { "Livolo App", sSwitchTypeLivoloAppliance }, // p- { "Blyss", sSwitchTypeBlyss }, // p6 { "Byron", sSwitchTypeByronSX }, // p72 { "Byron MP", sSwitchTypeByronMP001 }, // p74 { "SelectPlus", sSwitchTypeSelectPlus }, // p70 { "Doorbell", sSwitchTypeSelectPlus3 }, // p73 { "FA20RF", sSwitchTypeFA20 }, // p80 { "Chuango", sSwitchTypeChuango }, // p62 { "Plieger", sSwitchTypePlieger }, // p71 { "SilverCrest", sSwitchTypeSilvercrest }, // p75 { "Mertik", sSwitchTypeMertik }, // p82 { "HomeConfort", sSwitchTypeHomeConfort }, // p11 { "Powerfix", sSwitchTypePowerfix }, // p13 { "TriState", sSwitchTypeTriState }, // p16 { "Deltronic", sSwitchTypeDeltronic }, // p73 { "FA500", sSwitchTypeFA500 }, // p12 { "HT12E", sSwitchTypeHT12E }, // p60 { "EV1527", sSwitchTypeEV1527 }, // p61 { "Elmes", sSwitchTypeElmes }, // p65 { "Aster", sSwitchTypeAster }, // p17 { "Sartano", sSwitchTypeSartano }, // p3 { "Europe", sSwitchTypeEurope }, // p18 { "Avidsen", sSwitchTypeAvidsen }, // p.. { "BofuMotor", sSwitchTypeBofu }, // p.. { "BrelMotor", sSwitchTypeBrel }, // p.. { "RTS", sSwitchTypeRTS }, // p.. { "ElroDB", sSwitchTypeElroDB }, // p.. { "Dooya", sSwitchTypeDooya }, // p.. { "Unitec", sSwitchTypeUnitec }, // p.. { "Maclean", sSwitchTypeMaclean }, // p.. { "R546", sSwitchTypeR546 }, // p.. { "Diya", sSwitchTypeDiya }, // p.. { "X10Secure", sSwitchTypeX10secu }, // p.. { "Atlantic", sSwitchTypeAtlantic }, // p.. { "SilvercrestDB", sSwitchTypeSilvercrestDB }, // p.. { "MedionDB", sSwitchTypeMedionDB }, // p.. { "VMC", sSwitchTypeVMC }, // p.. { "Keeloq", sSwitchTypeKeeloq }, // p.. { "CustomSwitch", sSwitchCustomSwitch }, // NA { "GeneralSwitch", sSwitchGeneralSwitch }, // NA { "Koch", sSwitchTypeKoch }, // NA { "Kingpin", sSwitchTypeKingpin }, // NA { "Funkbus", sSwitchTypeFunkbus }, // NA { "Nice", sSwitchTypeNice }, // NA { "Forest", sSwitchTypeForest }, // NA { "MC145026", sSwitchMC145026 }, // NA { "Lobeco", sSwitchLobeco }, // NA { "Friedland", sSwitchFriedland }, // NA { "BFT", sSwitchBFT }, // NA { "Novatys", sSwitchNovatys}, // NA { "Halemeier", sSwitchHalemeier}, { "Gaposa", sSwitchGaposa }, { "MiLightv1", sSwitchMiLightv1 }, { "MiLightv2", sSwitchMiLightv2 }, { "HT6P20", sSwitchHT6P20 }, { "Doitrand", sSwitchTypeDoitrand }, { "Warema", sSwitchTypeWarema }, { "Ansluta", sSwitchTypeAnsluta }, { "Livcol", sSwitchTypeLivcol }, { "Bosch", sSwitchTypeBosch }, { "Ningbo", sSwitchTypeNingbo }, { "Ditec", sSwitchTypeDitec }, { "Steffen", sSwitchTypeSteffen }, { "AlectoSA", sSwitchTypeAlectoSA }, { "GPIOset", sSwitchTypeGPIOset }, { "KonigSec", sSwitchTypeKonigSec }, { "RM174RF", sSwitchTypeRM174RF }, { "Liwin", sSwitchTypeLiwin }, { "YW_Secu", sSwitchTypeYW_Secu }, { "Mertik_GV60", sSwitchTypeMertik_GV60 }, { "Ningbo64", sSwitchTypeNingbo64 }, { "X2D", sSwitchTypeX2D }, { "HRCMotor", sSwitchTypeHRCMotor }, { "Velleman", sSwitchTypeVelleman }, { "RFCustom", sSwitchTypeRFCustom }, { "YW_Sensor", sSwitchTypeYW_Sensor }, { "LEGRANDCAD", sSwitchTypeLegrandcad }, { "SysfsGpio", sSwitchTypeSysfsGpio }, { "Hager", sSwitchTypeHager }, { "Faber", sSwitchTypeFaber }, { "Drayton", sSwitchTypeDrayton }, { "V2Phoenix", sSwitchTypeV2Phoenix }, { "", -1 } }; const _tRFLinkStringIntHelper rfswitchcommands[] = { { "ON", gswitch_sOn }, { "OFF", gswitch_sOff }, { "ALLON", gswitch_sGroupOn }, { "ALLOFF", gswitch_sGroupOff }, { "DIM", gswitch_sDim }, { "BRIGHT", gswitch_sBright }, { "UP", blinds_sOpen }, { "DOWN", blinds_sClose }, { "STOP", gswitch_sStop }, { "COLOR", gswitch_sColor }, { "DISCO+", gswitch_sDiscop }, { "DISCO-", gswitch_sDiscom }, { "", -1 } }; const _tRFLinkStringIntHelper rfblindcommands[] = { { "UP", blinds_sOpen }, { "DOWN", blinds_sClose }, { "STOP", blinds_sStop }, { "CONFIRM", blinds_sConfirm }, { "LIMIT", blinds_sLimit }, { "", -1 } }; int GetGeneralRFLinkFromString(const _tRFLinkStringIntHelper *pTable, const std::string &szType) { int ii = 0; while (pTable[ii].gType!=-1) { if (pTable[ii].szType == szType) return pTable[ii].gType; ii++; } return -1; } std::string GetGeneralRFLinkFromInt(const _tRFLinkStringIntHelper *pTable, const int gType) { int ii = 0; while (pTable[ii].gType!=-1) { if (pTable[ii].gType == gType) return pTable[ii].szType; ii++; } return ""; } CRFLinkBase::CRFLinkBase() { m_bTXokay = false; m_bRFDebug = false; memset(&m_rfbuffer,0,sizeof(m_rfbuffer)); m_rfbufferpos = 0; m_retrycntr = RFLINK_RETRY_DELAY; /* ParseLine("20;4F;LIVCOL;ID=1a2b3c4;SWITCH=00;RGBW=ec5a;CMD=ON;"); ParseLine("20;08;NewKaku;ID=31c42a;SWITCH=2;CMD=OFF;"); ParseLine("20;3A;NewKaku;ID=c142;SWITCH=1;CMD=ALLOFF;"); ParseLine("20;14;Oregon BTHR;ID=5a00;TEMP=00d1;HUM=29;BARO=0407;BAT=LOW;"); ParseLine("20;27;Cresta;ID=8001;RAIN=69e7;"); ParseLine("20;2D;UPM/Esic;ID=0001;TEMP=00cf;HUM=16;BAT=OK;"); ParseLine("20;31;Mebus;ID=c201;TEMP=00cf;"); ParseLine("20;32;Auriol;ID=008f;TEMP=00d3;BAT=OK;"); ParseLine("20;AF;SelectPlus;ID=1bb4;CHIME=01;"); ParseLine("20;04;Eurodomest;ID=03696b;SWITCH=07;CMD=ALLOFF;"); */ } CRFLinkBase::~CRFLinkBase() { } /* void CRFLinkBase::Add2SendQueue(const char* pData, const size_t length) { std::string sBytes; sBytes.insert(0,pData,length); boost::lock_guard<boost::mutex> l(m_sendMutex); m_sendqueue.push_back(sBytes); } */ void CRFLinkBase::ParseData(const char *data, size_t len) { size_t ii=0; while (ii<len) { const unsigned char c = data[ii]; if (c == '\r') { ii++; continue; } if (c == '\n' || m_rfbufferpos == sizeof(m_rfbuffer) - 1) { // discard newline, close string, parse line and clear it. m_rfbuffer[m_rfbufferpos] = '\0'; std::string sLine((char*)&m_rfbuffer); ParseLine(sLine); m_rfbufferpos = 0; } else { m_rfbuffer[m_rfbufferpos] = c; m_rfbufferpos++; } ii++; } } #define round(a) ( int ) ( a + .5 ) void GetSwitchType(const char* ID, const unsigned char unit, const unsigned char devType, const unsigned char subType, int &switchType) { switchType = 0; std::vector<std::vector<std::string> > result; result = m_sql.safe_query("SELECT SwitchType FROM DeviceStatus WHERE (DeviceID='%q' AND Unit=%d AND Type=%d AND SubType=%d)", ID, unit, devType, subType); if (result.size() != 0) { switchType = atoi(result[0][0].c_str()); } } bool CRFLinkBase::WriteToHardware(const char *pdata, const unsigned char length) { const _tGeneralSwitch *pSwitch = reinterpret_cast<const _tGeneralSwitch*>(pdata); if ((pSwitch->type != pTypeGeneralSwitch) && (pSwitch->type != pTypeColorSwitch)) return false; //only allowed to control regular switches and MiLight //_log.Log(LOG_ERROR, "RFLink: switch type: %d", pSwitch->subtype); std::string switchtype = GetGeneralRFLinkFromInt(rfswitches, pSwitch->subtype); if (switchtype.empty()) { _log.Log(LOG_ERROR, "RFLink: trying to send unknown switch type: %d", pSwitch->subtype); return false; } //_log.Log(LOG_ERROR, "RFLink: id: %d", pSwitch->id); //_log.Log(LOG_ERROR, "RFLink: subtype: %d", pSwitch->subtype); // get SwitchType from SQL table int m_SwitchType = 0; char szDeviceID[20]; sprintf(szDeviceID, "%08X", pSwitch->id); std::string ID = szDeviceID; GetSwitchType(ID.c_str(), pSwitch->unitcode, pSwitch->type, pSwitch->subtype, m_SwitchType); //_log.Log(LOG_ERROR, "RFLink: switch type: %d", m_SwitchType); //_log.Log(LOG_ERROR, "RFLink: switch cmd: %d", pSwitch->cmnd); if (pSwitch->type == pTypeGeneralSwitch) { std::string switchcmnd = GetGeneralRFLinkFromInt(rfswitchcommands, pSwitch->cmnd); if (pSwitch->cmnd != gswitch_sStop) { if ((m_SwitchType == STYPE_VenetianBlindsEU) || (m_SwitchType == STYPE_Blinds) || (m_SwitchType == STYPE_BlindsInverted)) { switchcmnd = GetGeneralRFLinkFromInt(rfblindcommands, pSwitch->cmnd); } else { if (m_SwitchType == STYPE_VenetianBlindsUS) { //if ((m_SwitchType == STYPE_VenetianBlindsUS) || (m_SwitchType == STYPE_BlindsInverted)) { switchcmnd = GetGeneralRFLinkFromInt(rfblindcommands, pSwitch->cmnd); if (pSwitch->cmnd == blinds_sOpen) switchcmnd = GetGeneralRFLinkFromInt(rfblindcommands, blinds_sClose); else if (pSwitch->cmnd == blinds_sClose) switchcmnd = GetGeneralRFLinkFromInt(rfblindcommands, blinds_sOpen); } } } //_log.Log(LOG_ERROR, "RFLink: switch command: %d", pSwitch->cmnd); // check setlevel command if (pSwitch->cmnd == gswitch_sSetLevel) { // Get device level to set float fvalue = (15.0f / 100.0f)*float(pSwitch->level); if (fvalue > 15.0f) fvalue = 15.0f; //99 is fully on int svalue = round(fvalue); //_log.Log(LOG_ERROR, "RFLink: level: %d", svalue); char buffer[50] = {0}; sprintf(buffer, "%d", svalue); switchcmnd = buffer; } if (switchcmnd.empty()) { _log.Log(LOG_ERROR, "RFLink: trying to send unknown switch command: %d", pSwitch->cmnd); return false; } //Build send string std::stringstream sstr; //10;NewKaku;00c142;1;ON; => protocol;address;button number;action (ON/OFF/ALLON/ALLOFF/15 -11-15 for dim level) sstr << "10;" << switchtype << ";" << std::hex << std::nouppercase << std::setw(6) << std::setfill('0') << pSwitch->id << ";" << std::hex << std::nouppercase << pSwitch->unitcode << ";" << switchcmnd; //#ifdef _DEBUG _log.Log(LOG_STATUS, "RFLink Sending: %s", sstr.str().c_str()); //#endif sstr << "\n"; m_bTXokay = false; // clear OK flag WriteInt(sstr.str()); time_t atime = mytime(NULL); time_t btime = mytime(NULL); // Wait for an OK response from RFLink to make sure the command was executed while (m_bTXokay == false) { if (difftime(btime,atime) > 4) { _log.Log(LOG_ERROR, "RFLink: TX time out..."); return false; } btime = mytime(NULL); } return true; } else { // RFLink Milight/Living Colours extension const _tColorSwitch *pLed = reinterpret_cast<const _tColorSwitch*>(pdata); /* _log.Log(LOG_ERROR, "RFLink: ledtype: %d", pLed->type); // type colorswitch _log.Log(LOG_ERROR, "RFLink: subtype: %d", pLed->subtype); // rgbw/rgb/white? _log.Log(LOG_ERROR, "RFLink: id: %d", pLed->id); // id _log.Log(LOG_ERROR, "RFLink: unit: %d", pLed->dunit); // unit 0=All, 1=Group1,2=Group2,3=Group3,4=Group4 _log.Log(LOG_ERROR, "RFLink: command: %d", pLed->command); // command _log.Log(LOG_ERROR, "RFLink: value: %d", pLed->value); // brightness/color value */ bool bSendOn = false; const int m_LEDType = pLed->type; std::string switchtype = GetGeneralRFLinkFromInt(rfswitches, (pSwitch->subtype == sTypeColor_LivCol) ? sSwitchTypeLivcol : sSwitchMiLightv1); std::string switchcmnd = GetGeneralRFLinkFromInt(rfswitchcommands, pLed->command); std::string switchcmnd2 = ""; unsigned int colorbright = 0; switch (pLed->command){ case Color_LedOn: switchcmnd = "ON"; break; case Color_LedOff: switchcmnd = "OFF"; break; case Color_SetColor: if (pLed->color.mode == ColorModeWhite) { //brightness (0-100) converted to 0x00-0xff int brightness = (unsigned char)pLed->value; brightness = (brightness * 255) / 100; brightness = brightness & 0xff; colorbright &= 0xff00; colorbright |= brightness; switchcmnd = "ALLON"; switchcmnd2 = "BRIGHT"; bSendOn = true; } else if (pLed->color.mode == ColorModeRGB) { //brightness (0-100) converted to 0x00-0xff int brightness = (unsigned char)pLed->value; brightness = (brightness * 255) / 100; brightness = brightness & 0xff; // Convert RGB to HSV float hsb[3]; rgb2hsb(pLed->color.r, pLed->color.g, pLed->color.b, hsb); int iHue = int(hsb[0]*255.0f); iHue = (iHue+0x20) & 0xFF; //Milight color offset correction colorbright = (((unsigned char) iHue) << 8) | brightness; switchcmnd = "COLOR"; switchcmnd2 = "BRIGHT"; bSendOn = true; } else { _log.Log(LOG_STATUS, "RFLink: SetRGBColour - Color mode %d is unhandled, if you have a suggestion for what it should do, please post on the Domoticz forum", pLed->color.mode); return false; } break; case Color_DiscoSpeedSlower: switchcmnd = "DISCO-"; bSendOn = true; break; case Color_DiscoSpeedFaster: switchcmnd = "DISCO+"; bSendOn = true; break; case Color_DiscoMode: switchcmnd = "MODE"; break; case Color_SetColorToWhite: switchcmnd = "ALLON"; bSendOn = true; break; case Color_SetBrightnessLevel: { //brightness (0-100) converted to 0x00-0xff int brightness = (unsigned char)pLed->value; brightness = (brightness * 255) / 100; brightness = brightness & 0xff; colorbright = colorbright & 0xff00; colorbright = colorbright + (unsigned char)brightness; switchcmnd = "BRIGHT"; bSendOn = true; } break; case Color_NightMode: switchcmnd = "ALLOFF"; bSendOn = true; break; // need work: case Color_SetBrightUp: switchcmnd = "BRIGHT"; bSendOn = true; break; case Color_SetBrightDown: switchcmnd = "BRIGHT"; bSendOn = true; break; case Color_DiscoSpeedFasterLong: switchcmnd = "DISCO+"; bSendOn = true; break; case Color_RGBDiscoNext: switchcmnd = "DISCO+"; bSendOn = true; break; case Color_RGBDiscoPrevious: switchcmnd = "DISCO-"; bSendOn = true; break; default: _log.Log(LOG_ERROR, "RFLink: trying to send unknown led switch command: %d", pLed->command); return false; } // --- Sending first an "ON command" needed if (bSendOn == true) { std::string tswitchcmnd = "ON"; //Build send string std::stringstream sstr; sstr << "10;" << switchtype << ";" << std::hex << std::nouppercase << std::setw(4) << std::setfill('0') << pLed->id << ";" << std::setw(2) << std::setfill('0') << int(pLed->dunit) << ";" << std::hex << std::nouppercase << std::setw(4) << colorbright << ";" << tswitchcmnd; _log.Log(LOG_STATUS, "RFLink Sending: %s", sstr.str().c_str()); sstr << "\n"; m_bTXokay = false; // clear OK flag WriteInt(sstr.str()); time_t atime = mytime(NULL); time_t btime = mytime(NULL); // Wait for an OK response from RFLink to make sure the command was executed while (m_bTXokay == false) { if (difftime(btime,atime) > 4) { _log.Log(LOG_ERROR, "RFLink: TX time out..."); return false; } btime = mytime(NULL); } } // --- //Build send string std::stringstream sstr; //10;MiLightv1;1234;01;5566;ON; => protocol;address;unit number;color&brightness;action (ON/OFF/ALLON/ALLOFF etc) sstr << "10;" << switchtype << ";" << std::hex << std::nouppercase << std::setw(4) << std::setfill('0') << pLed->id << ";" << std::setw(2) << std::setfill('0') << int(pLed->dunit) << ";" << std::hex << std::nouppercase << std::setw(4) << colorbright << ";" << switchcmnd; //#ifdef _DEBUG _log.Log(LOG_STATUS, "RFLink Sending: %s", sstr.str().c_str()); //#endif sstr << "\n"; m_bTXokay = false; // clear OK flag WriteInt(sstr.str()); time_t atime = mytime(NULL); time_t btime = mytime(NULL); // Wait for an OK response from RFLink to make sure the command was executed while (m_bTXokay == false) { sleep_milliseconds(10); if (difftime(btime,atime) > 4) { _log.Log(LOG_ERROR, "RFLink: TX time out..."); return false; } btime = mytime(NULL); } if (!switchcmnd2.empty()) { //Build send string sstr.str(""); sstr << "10;" << switchtype << ";" << std::hex << std::nouppercase << std::setw(4) << std::setfill('0') << pLed->id << ";" << std::setw(2) << std::setfill('0') << int(pLed->dunit) << ";" << std::hex << std::nouppercase << std::setw(4) << colorbright << ";" << switchcmnd2; //#ifdef _DEBUG _log.Log(LOG_STATUS, "RFLink Sending: %s", sstr.str().c_str()); //#endif sstr << "\n"; m_bTXokay = false; // clear OK flag WriteInt(sstr.str()); time_t atime = mytime(NULL); time_t btime = mytime(NULL); // Wait for an OK response from RFLink to make sure the command was executed while (m_bTXokay == false) { sleep_milliseconds(10); if (difftime(btime,atime) > 4) { _log.Log(LOG_ERROR, "RFLink: TX time out..."); return false; } btime = mytime(NULL); } } return true; } } bool CRFLinkBase::SendSwitchInt(const int ID, const int switchunit, const int BatteryLevel, const std::string &switchType, const std::string &switchcmd, const int level) { int intswitchtype = GetGeneralRFLinkFromString(rfswitches, switchType); if (intswitchtype == -1) { _log.Log(LOG_ERROR, "RFLink: Unhandled switch type: %s", switchType.c_str()); return false; } int cmnd = GetGeneralRFLinkFromString(rfswitchcommands, switchcmd); int svalue=level; if (cmnd==-1) { if (switchcmd.compare(0, 10, "SET_LEVEL=") == 0 ){ cmnd=gswitch_sSetLevel; std::string str2 = switchcmd.substr(10); svalue=atoi(str2.c_str()); _log.Log(LOG_STATUS, "RFLink: %d level: %d", cmnd, svalue); } } if (cmnd==-1) { _log.Log(LOG_ERROR, "RFLink: Unhandled switch command: %s", switchcmd.c_str()); return false; } _tGeneralSwitch gswitch; gswitch.subtype = intswitchtype; gswitch.id = ID; gswitch.unitcode = switchunit; gswitch.cmnd = cmnd; gswitch.level = svalue; //level; gswitch.battery_level = BatteryLevel; gswitch.rssi = 12; gswitch.seqnbr = 0; sDecodeRXMessage(this, (const unsigned char *)&gswitch, NULL, BatteryLevel); return true; } static std::string RFLinkGetStringValue(const std::string &svalue) { std::string ret = ""; size_t pos = svalue.find("="); if (pos == std::string::npos) return ret; return svalue.substr(pos+1); } static unsigned int RFLinkGetHexStringValue(const std::string &svalue) { unsigned int ret = -1; size_t pos = svalue.find("="); if (pos == std::string::npos) return ret; std::stringstream ss; ss << std::hex << svalue.substr(pos + 1); ss >> ret; return ret; } static unsigned int RFLinkGetIntStringValue(const std::string &svalue) { unsigned int ret = -1; size_t pos = svalue.find("="); if (pos == std::string::npos) return ret; std::stringstream ss; ss << std::dec << svalue.substr(pos + 1); ss >> ret; return ret; } static unsigned int RFLinkGetIntDecStringValue(const std::string &svalue) { unsigned int ret = -1; size_t pos = svalue.find("."); if (pos == std::string::npos) return ret; std::stringstream ss; ss << std::dec << svalue.substr(pos + 1); ss >> ret; return ret; } bool CRFLinkBase::ParseLine(const std::string &sLine) { m_LastReceivedTime = mytime(NULL); std::vector<std::string> results; StringSplit(sLine, ";", results); if (results.size() < 2) return false; //not needed bool bHideDebugLog = ( (sLine.find("PONG") != std::string::npos)|| (sLine.find("PING") != std::string::npos) ); int RFLink_ID = atoi(results[0].c_str()); if (RFLink_ID != 20) { return false; //only accept RFLink->Master messages } #ifdef ENABLE_LOGGING if (!bHideDebugLog) _log.Log(LOG_NORM, "RFLink: %s", sLine.c_str()); #endif if (m_bRFDebug == true) _log.Log(LOG_NORM, "RFLink: %s", sLine.c_str()); //std::string Sensor_ID = results[1]; if (results.size() >2) { //Status reply std::string Name_ID = results[2]; if ((Name_ID.find("Nodo RadioFrequencyLink") != std::string::npos) || (Name_ID.find("RFLink Gateway") != std::string::npos)) { _log.Log(LOG_STATUS, "RFLink: Controller Initialized!..."); WriteInt("10;VERSION;\n"); // 20;3C;VER=1.1;REV=37;BUILD=01; //Enable DEBUG //write("10;RFDEBUG=ON;\n"); //Enable Undecoded DEBUG //write("10;RFUDEBUG=ON;\n"); return true; } if (Name_ID.find("VER") != std::string::npos) { //_log.Log(LOG_STATUS, "RFLink: %s", sLine.c_str()); int versionlo = 0; int versionhi = 0; int revision = 0; int build = 0; if (results[2].find("VER") != std::string::npos) { versionhi = RFLinkGetIntStringValue(results[2]); versionlo = RFLinkGetIntDecStringValue(results[2]); } if (results[3].find("REV") != std::string::npos){ revision = RFLinkGetIntStringValue(results[3]); } if (results[4].find("BUILD") != std::string::npos) { build = RFLinkGetIntStringValue(results[4]); } _log.Log(LOG_STATUS, "RFLink Detected, Version: %d.%d Revision: %d Build: %d", versionhi, versionlo, revision, build); std::stringstream sstr; sstr << revision << "." << build; m_Version = sstr.str(); mytime(&m_LastHeartbeatReceive); // keep heartbeat happy mytime(&m_LastHeartbeat); // keep heartbeat happy m_LastReceivedTime = m_LastHeartbeat; m_bTXokay = true; // variable to indicate an OK was received return true; } if (Name_ID.find("PONG") != std::string::npos) { //_log.Log(LOG_STATUS, "RFLink: PONG received!..."); mytime(&m_LastHeartbeatReceive); // keep heartbeat happy mytime(&m_LastHeartbeat); // keep heartbeat happy m_LastReceivedTime = m_LastHeartbeat; m_bTXokay = true; // variable to indicate an OK was received return true; } if (Name_ID.find("OK") != std::string::npos) { //_log.Log(LOG_STATUS, "RFLink: OK received!..."); mytime(&m_LastHeartbeatReceive); // keep heartbeat happy mytime(&m_LastHeartbeat); // keep heartbeat happy m_LastReceivedTime = m_LastHeartbeat; m_bTXokay = true; // variable to indicate an OK was received return true; } else if (Name_ID.find("CMD UNKNOWN") != std::string::npos) { _log.Log(LOG_ERROR, "RFLink: Error/Unknown command received!..."); m_bTXokay = true; // variable to indicate an ERROR was received return true; } } if (results.size() < 4) return true; if (results[3].find("ID=") == std::string::npos) return false; //?? mytime(&m_LastHeartbeatReceive); // keep heartbeat happy mytime(&m_LastHeartbeat); // keep heartbeat happy //_log.Log(LOG_STATUS, "RFLink: t1=%d t2=%d", m_LastHeartbeat, m_LastHeartbeatReceive); m_LastReceivedTime = m_LastHeartbeat; std::stringstream ss; unsigned int ID; ss << std::hex << results[3].substr(3); ss >> ID; int Node_ID = (ID & 0xFF00) >> 8; int Child_ID = ID & 0xFF; bool bHaveTemp = false; float temp = 0; bool bHaveHum = false; int humidity = 0; bool bHaveHumStatus = false; int humstatus = 0; bool bHaveBaro = false; float baro = 0; int baroforecast = 0; bool bHaveRain = false; float raincounter = 0; bool bHaveLux = false; float lux = 0; bool bHaveUV = false; float uv = 0; bool bHaveWindDir = false; int windir = 0; bool bHaveWindSpeed = false; float windspeed = 0; bool bHaveWindGust = false; float windgust = 0; bool bHaveWindTemp = false; float windtemp = 0; bool bHaveWindChill = false; float windchill = 0; bool bHaveRGB = false; int rgb = 0; bool bHaveRGBW = false; int rgbw = 0; bool bHaveSound = false; int sound = 0; bool bHaveCO2 = false; int co2 = 0; bool bHaveBlind = false; int blind = 0; bool bHaveKWatt = false; float kwatt = 0; bool bHaveWatt = false; float watt = 0; bool bHaveDistance = false; float distance = 0; bool bHaveMeter = false; float meter = 0; bool bHaveVoltage = false; float voltage = 0; bool bHaveCurrent = false; float current = 0; bool bHaveCurrent2 = false; float current2 = 0; bool bHaveCurrent3 = false; float current3 = 0; bool bHaveWeight = false; float weight = 0; bool bHaveImpedance = false; float impedance = 0; bool bHaveSwitch = false; int switchunit = 0; bool bHaveSwitchCmd = false; std::string switchcmd = ""; int switchlevel = 0; int BatteryLevel = 255; std::string tmpstr; int iTemp; for (size_t ii = 4; ii < results.size(); ii++) { if (results[ii].find("TEMP") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveTemp = true; if ((iTemp & 0x8000) == 0x8000) { //negative temp iTemp = -(iTemp & 0xFFF); } temp = float(iTemp) / 10.0f; } else if (results[ii].find("HUM") != std::string::npos) { bHaveHum = true; humidity = RFLinkGetIntStringValue(results[ii]); } else if (results[ii].find("HSTATUS") != std::string::npos) { bHaveHumStatus = true; humstatus = RFLinkGetIntStringValue(results[ii]); } else if (results[ii].find("BARO") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveBaro = true; baro = float(iTemp); } else if (results[ii].find("BFORECAST") != std::string::npos) { baroforecast = RFLinkGetIntStringValue(results[ii]); } else if (results[ii].find("RAIN") != std::string::npos) { bHaveRain = true; iTemp = RFLinkGetHexStringValue(results[ii]); raincounter = float(iTemp) / 10.0f; } else if (results[ii].find("LUX") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveLux = true; lux = float(iTemp); } else if (results[ii].find("UV") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveUV = true; uv = float(iTemp) /10.0f; } else if (results[ii].find("BAT") != std::string::npos) { tmpstr = RFLinkGetStringValue(results[ii]); BatteryLevel = (tmpstr == "OK") ? 100 : 0; } else if (results[ii].find("WINDIR") != std::string::npos) { bHaveWindDir = true; windir = RFLinkGetIntStringValue(results[ii]); } else if (results[ii].find("WINSP") != std::string::npos) { bHaveWindSpeed = true; iTemp = RFLinkGetHexStringValue(results[ii]); // received value is km/u windspeed = (float(iTemp) * 0.0277778f); //convert to m/s } else if (results[ii].find("WINGS") != std::string::npos) { bHaveWindGust = true; iTemp = RFLinkGetHexStringValue(results[ii]); // received value is km/u windgust = (float(iTemp) * 0.0277778f); //convert to m/s } else if (results[ii].find("WINTMP") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveWindTemp = true; if ((iTemp & 0x8000) == 0x8000) { //negative temp iTemp = -(iTemp & 0xFFF); } windtemp = float(iTemp) / 10.0f; } else if (results[ii].find("WINCHL") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveWindChill = true; if ((iTemp & 0x8000) == 0x8000) { //negative temp iTemp = -(iTemp & 0xFFF); } windchill = float(iTemp) / 10.0f; } else if (results[ii].find("SOUND") != std::string::npos) { bHaveSound = true; sound = RFLinkGetIntStringValue(results[ii]); } else if (results[ii].find("CO2") != std::string::npos) { bHaveCO2 = true; co2 = RFLinkGetIntStringValue(results[ii]); } else if (results[ii].find("RGBW") != std::string::npos) { bHaveRGBW = true; rgbw = RFLinkGetHexStringValue(results[ii]); } else if (results[ii].find("RGB") != std::string::npos) { bHaveRGB = true; rgb = RFLinkGetIntStringValue(results[ii]); } else if (results[ii].find("BLIND") != std::string::npos) { bHaveBlind = true; blind = RFLinkGetIntStringValue(results[ii]); } else if (results[ii].find("KWATT") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveKWatt = true; kwatt = float(iTemp) / 1000.0f; } else if (results[ii].find("WATT") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveWatt = true; watt = float(iTemp) / 10.0f; } else if (results[ii].find("DIST") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveDistance = true; distance = float(iTemp) / 10.0f; } else if (results[ii].find("METER") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveMeter = true; meter = float(iTemp) / 10.0f; } else if (results[ii].find("VOLT") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveVoltage = true; voltage = float(iTemp) / 10.0f; } else if (results[ii].find("CURRENT") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveCurrent = true; current = float(iTemp) / 10.0f; } else if (results[ii].find("CURRENT2") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveCurrent2 = true; current2 = float(iTemp) / 10.0f; } else if (results[ii].find("CURRENT3") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveCurrent3 = true; current3 = float(iTemp) / 10.0f; } else if (results[ii].find("WEIGHT") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveWeight = true; weight = float(iTemp) *100; // weight in grams } else if (results[ii].find("IMPEDANCE") != std::string::npos) { iTemp = RFLinkGetHexStringValue(results[ii]); bHaveImpedance = true; impedance = float(iTemp) / 10.0f; } else if (results[ii].find("SWITCH") != std::string::npos) { bHaveSwitch = true; switchunit = RFLinkGetHexStringValue(results[ii]); } else if (results[ii].find("CMD") != std::string::npos) { bHaveSwitchCmd = true; switchcmd = RFLinkGetStringValue(results[ii]); } else if (results[ii].find("SMOKEALERT") != std::string::npos) { bHaveSwitch = true; switchunit = 1; bHaveSwitchCmd = true; switchcmd = RFLinkGetStringValue(results[ii]); } else if (results[ii].find("CHIME") != std::string::npos) { bHaveSwitch = true; switchunit = 2; bHaveSwitchCmd = true; switchcmd = "ON"; } } std::string tmp_Name = results[2]; if (bHaveTemp&&bHaveHum&&bHaveBaro) { SendTempHumBaroSensor(ID, BatteryLevel, temp, humidity, baro, baroforecast, tmp_Name); } else if (bHaveTemp&&bHaveHum) { SendTempHumSensor(ID, BatteryLevel, temp, humidity, tmp_Name); } else if (bHaveTemp) { SendTempSensor(ID, BatteryLevel, temp, tmp_Name); } else if (bHaveHum) { SendHumiditySensor(ID, BatteryLevel, humidity, tmp_Name); } else if (bHaveBaro) { SendBaroSensor(Node_ID, Child_ID, BatteryLevel, baro, baroforecast, tmp_Name); } if (bHaveLux) { SendLuxSensor(Node_ID, Child_ID, BatteryLevel, lux, tmp_Name); } if (bHaveUV) { SendUVSensor(Node_ID, Child_ID, BatteryLevel, uv, tmp_Name); } if (bHaveRain) { SendRainSensor(ID, BatteryLevel, float(raincounter), tmp_Name); } if (bHaveWindDir || bHaveWindSpeed || bHaveWindGust || bHaveWindChill) { bool bExists = false; int twindir = 0;float twindspeed = 0;float twindgust = 0;float twindtemp = 0;float twindchill = 0; GetWindSensorValue(ID, twindir, twindspeed, twindgust, twindtemp, twindchill, bHaveWindTemp, bExists); #ifdef _DEBUG if (bExists) { _log.Log(LOG_STATUS, "RFLink: id:%d wd %d ws %f wg: %f wt: %f wc: %f status:%d", ID, twindir, twindspeed, twindgust, twindtemp, twindchill, bExists); } #endif if (bHaveWindDir) twindir = round(float(windir)*22.5f); if (!bHaveWindSpeed) windspeed = twindspeed; if (!bHaveWindGust) windgust = twindgust; if (!bHaveWindTemp) windtemp = twindtemp; if (!bHaveWindChill) windchill = twindchill; SendWind(ID, BatteryLevel, twindir, windspeed, windgust, windtemp, windchill, bHaveWindTemp, tmp_Name); } if (bHaveCO2) { SendAirQualitySensor((ID & 0xFF00) >> 8, ID & 0xFF, BatteryLevel, co2, tmp_Name); } if (bHaveSound) { SendSoundSensor(ID, BatteryLevel, sound, tmp_Name); } if (bHaveBlind) { SendBlindSensor(Node_ID, Child_ID, BatteryLevel, blind, tmp_Name); } if (bHaveKWatt&bHaveWatt) { SendKwhMeterOldWay(Node_ID, Child_ID, BatteryLevel, watt / 100.0f, kwatt, tmp_Name); } else if (bHaveKWatt) { SendKwhMeterOldWay(Node_ID, Child_ID, BatteryLevel, watt / 100.0f, kwatt, tmp_Name); } else if (bHaveWatt) { SendKwhMeterOldWay(Node_ID, Child_ID, BatteryLevel, watt / 100.0f, kwatt, tmp_Name); } if (bHaveDistance) { SendDistanceSensor(Node_ID, Child_ID, BatteryLevel, distance, tmp_Name); } if (bHaveMeter) { SendMeterSensor(Node_ID, Child_ID, BatteryLevel, meter, tmp_Name); } if (bHaveVoltage) { SendVoltageSensor(Node_ID, Child_ID, BatteryLevel, voltage, tmp_Name); } if (bHaveCurrent && bHaveCurrent2 && bHaveCurrent3) { SendCurrentSensor(ID, BatteryLevel, current, current2, current3, tmp_Name); } else if (bHaveCurrent) { SendCurrentSensor(ID, BatteryLevel, current, 0, 0, tmp_Name); } if (bHaveWeight) { SendCustomSensor(Node_ID, Child_ID, BatteryLevel, weight, "Weight", "g"); } if (bHaveImpedance) { SendPercentageSensor(Node_ID, Child_ID, BatteryLevel, impedance, tmp_Name); } if (bHaveRGB) { //RRGGBB if (switchcmd == "ON") rgb = 0xffff; SendRGBWSwitch(ID, switchunit, BatteryLevel, rgb, false, tmp_Name); } else if (bHaveRGBW) { //RRGGBBWW //_log.Log(LOG_STATUS, "RFLink ID,unit,level,cmd: %x , %x, %x, %x", ID, switchunit, rgbw, switchcmd); if (switchcmd == "OFF") rgbw = 0; SendRGBWSwitch(ID, switchunit, BatteryLevel, rgbw, true, tmp_Name); } else if (bHaveSwitch && bHaveSwitchCmd) { std::string switchType = results[2]; SendSwitchInt(ID, switchunit, BatteryLevel, switchType, switchcmd, switchlevel); } return true; } //Webserver helpers namespace http { namespace server { void CWebServer::RType_CreateRFLinkDevice(WebEmSession & session, const request& req, Json::Value &root) { if (session.rights != 2) { session.reply_status = reply::forbidden; return; //Only admin user allowed } std::string idx = request::findValue(&req, "idx"); std::string scommand = request::findValue(&req, "command"); if (idx.empty() || scommand.empty()) { return; } #ifdef _DEBUG _log.Log(LOG_STATUS, "RFLink Custom Command: %s", scommand.c_str()); _log.Log(LOG_STATUS, "RFLink Custom Command idx: %s", idx.c_str()); #endif bool bCreated = false; // flag to know if the command was a success CRFLinkBase *pRFLINK = reinterpret_cast<CRFLinkBase*>(m_mainworker.GetHardware(atoi(idx.c_str()))); if (pRFLINK == NULL) return; if (scommand.substr(0, 14).compare("10;rfdebug=on;") == 0) { pRFLINK->m_bRFDebug = true; // enable debug _log.Log(LOG_STATUS, "User: %s initiated RFLink Enable Debug mode with command: %s", session.username.c_str(), scommand.c_str()); pRFLINK->WriteInt("10;RFDEBUG=ON;\n"); root["status"] = "OK"; root["title"] = "DebugON"; return; } if (scommand.substr(0, 15).compare("10;rfdebug=off;") == 0) { pRFLINK->m_bRFDebug = false; // disable debug _log.Log(LOG_STATUS, "User: %s initiated RFLink Disable Debug mode with command: %s", session.username.c_str(), scommand.c_str()); pRFLINK->WriteInt("10;RFDEBUG=OFF;\n"); root["status"] = "OK"; root["title"] = "DebugOFF"; return; } _log.Log(LOG_STATUS, "User: %s initiated a RFLink Device Create command: %s", session.username.c_str(), scommand.c_str()); scommand = "11;" + scommand; #ifdef _DEBUG _log.Log(LOG_STATUS, "User: %s initiated a RFLink Device Create command: %s", session.username.c_str(), scommand.c_str()); #endif scommand += "\r\n"; bCreated = true; pRFLINK->m_bTXokay = false; // clear OK flag pRFLINK->WriteInt(scommand.c_str()); time_t atime = mytime(NULL); time_t btime = mytime(NULL); // Wait for an OK response from RFLink to make sure the command was executed while (pRFLINK->m_bTXokay == false) { if (difftime(btime,atime) > 4) { _log.Log(LOG_ERROR, "RFLink: TX time out..."); bCreated = false; break; } btime = mytime(NULL); } #ifdef _DEBUG _log.Log(LOG_STATUS, "RFLink custom command done"); #endif if (bCreated) { root["status"] = "OK"; root["title"] = "CreateRFLinkDevice"; } } } }
eskibars/domoticz
hardware/RFLinkBase.cpp
C++
gpl-3.0
37,401
[ 30522, 1001, 2421, 1000, 2358, 2850, 2546, 2595, 1012, 1044, 1000, 1001, 2421, 1000, 21792, 13767, 15058, 1012, 1044, 1000, 1001, 2421, 1000, 1012, 1012, 1013, 2364, 1013, 8833, 4590, 1012, 1044, 1000, 1001, 2421, 1000, 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...
import { Injectable } from '@angular/core'; import { Http, Headers, RequestOptions, Response } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/throw'; import { Project } from '../models/project'; import { Info } from '../models/info'; @Injectable() export class ProjectService { headers: Headers; options: RequestOptions; constructor(private http: Http) { this.headers = new Headers({ 'Content-Type': 'application/json' }); this.options = new RequestOptions({ headers: this.headers }); } public GetInfo(infoKey: string): Observable<Info> { return this.http.get(`/api/projects/info/${infoKey}`, this.options) .map(response => response.json() as Info) .catch(error => Observable.throw(error)); } public GetAllProjects(): Observable<Project[]> { return this.http.get(`api/projects`, this.options) .map(response => response.json() as Project[]) .catch(error => Observable.throw(error)); } public GetProject(projectId: string): Observable<Project> { return this.http.get(`/api/projects/${projectId}`, this.options) .map(response => response.json() as Project) .catch(error => Observable.throw(error)); } public SaveProject(apiKey: string, project: Project): Observable<Project> { return this.http.post(`/api/projects`, project, new RequestOptions({ headers: new Headers({ 'Content-Type': 'application/json', 'apiKey': apiKey }) })) .map(response => response.json() as Project) .catch(error => Observable.throw(error)); } }
jbarszczewski/BeetrootPortfolio
ClientApp/app/services/project.service.ts
TypeScript
apache-2.0
1,734
[ 30522, 12324, 1063, 1999, 20614, 3085, 1065, 2013, 1005, 1030, 16108, 1013, 4563, 1005, 1025, 12324, 1063, 8299, 1010, 20346, 2015, 1010, 5227, 7361, 9285, 1010, 3433, 1065, 2013, 1005, 1030, 16108, 1013, 8299, 1005, 1025, 12324, 1063, 2788...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 foo = arr.map(v => ({ x: v.bar, y: v.bar * 2 })); var fn = () => ({}).key;
rmacklin/babel
packages/babel-generator/test/fixtures/parentheses/arrow-function-object-body/expected.js
JavaScript
mit
83
[ 30522, 13075, 29379, 1027, 12098, 2099, 1012, 4949, 1006, 1058, 1027, 1028, 1006, 1063, 1060, 1024, 1058, 1012, 3347, 1010, 1061, 1024, 1058, 1012, 3347, 1008, 1016, 1065, 1007, 1007, 1025, 13075, 1042, 2078, 1027, 1006, 1007, 1027, 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...
""" WSGI config for made_with_twd_project project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` setting. Usually you will have the standard Django WSGI application here, but it also might make sense to replace the whole Django WSGI application with a custom one that later delegates to the Django one. For example, you could introduce WSGI middleware here, or combine a Django application with an application of another framework. """ import os # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks # if running multiple sites in the same mod_wsgi process. To fix this, use # mod_wsgi daemon mode with each site in its own daemon process, or use # os.environ["DJANGO_SETTINGS_MODULE"] = "made_with_twd_project.settings" os.environ.setdefault("DJANGO_SETTINGS_MODULE", "made_with_twd_project.settings") # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. from django.core.wsgi import get_wsgi_application application = get_wsgi_application() # Apply WSGI middleware here. # from helloworld.wsgi import HelloWorldApplication # application = HelloWorldApplication(application)
leifos/tango_with_django
made_with_twd_project/made_with_twd_project/wsgi.py
Python
mit
1,464
[ 30522, 1000, 1000, 1000, 1059, 28745, 2072, 9530, 8873, 2290, 2005, 2081, 1035, 2007, 1035, 1056, 21724, 1035, 2622, 2622, 1012, 2023, 11336, 3397, 1996, 1059, 28745, 2072, 4646, 2109, 2011, 6520, 23422, 1005, 1055, 2458, 8241, 1998, 2151, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Sylius\Bundle\ResourceBundle\Doctrine; use Sylius\Component\Resource\Repository\RepositoryInterface; use Sylius\Component\Locale\Context\LocaleContextInterface; /** * @author Gonzalo Vilaseca <gvilaseca@reiss.co.uk> */ interface TranslatableEntityRepositoryInterface extends RepositoryInterface { /** * Sets the locale context * * @param LocaleContextInterface $localeContext * * @return TranslatableEntityRepositoryInterface */ public function setLocaleContext(LocaleContextInterface $localeContext); /** * Sets the translatable fields * * @param array $translatableFields * * @return TranslatableEntityRepositoryInterface */ public function setTranslatableFields(array $translatableFields); }
JaronKing/Sylius
src/Sylius/Bundle/ResourceBundle/Doctrine/TranslatableEntityRepositoryInterface.php
PHP
mit
1,006
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 25353, 15513, 7427, 1012, 1008, 1008, 1006, 1039, 1007, 22195, 2063, 18818, 24401, 15378, 20518, 7974, 5488, 1008, 1008, 2005, 1996, 2440, 9385, 1998, 6105, 259...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 React = require('react/addons'); var blacklist = require('blacklist'); var classNames = require('classnames'); module.exports = React.createClass({ displayName: 'FormLabel', propTypes: { className: React.PropTypes.string, htmlFor: React.PropTypes.string, id: React.PropTypes.string, style: React.PropTypes.object, verticalAlign: React.PropTypes.oneOf(['baseline', 'bottom', 'inherit', 'initial', 'middle', 'sub', 'super', 'text-bottom', 'text-top', 'top']) }, render() { // classes var className = classNames('form-label', this.props.className); // props var props = blacklist(this.props, 'htmlFor', 'id', 'className', 'style'); // style var style; if (this.props.verticalAlign) { style = { verticalAlign: this.props.verticalAlign }; } return ( <label className={className} htmlFor={this.props.htmlFor || this.props.id} style={style || this.props.style} {...props}> {this.props.children} </label> ); } });
VictorBjelkholm/elemental
src/components/FormLabel.js
JavaScript
mit
971
[ 30522, 13075, 10509, 1027, 5478, 1006, 1005, 10509, 1013, 5587, 5644, 1005, 1007, 1025, 13075, 2304, 9863, 1027, 5478, 1006, 1005, 2304, 9863, 1005, 1007, 1025, 13075, 2465, 18442, 2015, 1027, 5478, 1006, 1005, 2465, 18442, 2015, 1005, 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...
<?php /** * @file * Contains \Drupal\Console\Generator\Generator. */ namespace Drupal\Console\Generator; use Drupal\Console\Helper\HelperTrait; use Drupal\Console\Style\DrupalStyle; class Generator { use HelperTrait; /** * @var array */ private $files; /** * @var bool */ private $learning = false; /** * @var array */ private $helperSet; /** * @var DrupalStyle $io */ protected $io; /** * @param string $template * @param string $target * @param array $parameters * @param null $flag * * @return bool */ protected function renderFile($template, $target, $parameters, $flag = null) { if (!is_dir(dirname($target))) { mkdir(dirname($target), 0777, true); } if (file_put_contents($target, $this->getRenderHelper()->render($template, $parameters), $flag)) { $this->files[] = str_replace($this->getDrupalHelper()->getRoot().'/', '', $target); return true; } return false; } /** * @param $helperSet */ public function setHelperSet($helperSet) { $this->helperSet = $helperSet; } /** * @return array */ public function getHelperSet() { return $this->helperSet; } /** * @return array */ public function getFiles() { return $this->files; } /** * @param $learning */ public function setLearning($learning) { $this->learning = $learning; } /** * @return bool */ public function isLearning() { return $this->learning; } /** * @param DrupalStyle $io */ public function setIo($io) { $this->io = $io; } }
sgrichards/BrightonDrupal
vendor/drupal/console/src/Generator/Generator.php
PHP
gpl-2.0
1,821
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1030, 5371, 1008, 3397, 1032, 2852, 6279, 2389, 1032, 10122, 1032, 13103, 1032, 13103, 1012, 1008, 1013, 3415, 15327, 2852, 6279, 2389, 1032, 10122, 1032, 13103, 1025, 2224, 2852, 6279, 2389...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
//On page load // TODO - remove nonconflict stuff once prototype is gone for good var $j = jQuery.noConflict(); replace_ids = function(s){ var new_id = new Date().getTime(); return s.replace(/NEW_RECORD/g, new_id); } $j(function() { $j('a[id*=nested]').click(function() { var template = $j(this).attr('href').replace(/.*#/, ''); html = replace_ids(eval(template)); $j('#ul-' + $j(this).attr('id')).append(html); update_remove_links(); }); update_remove_links(); }) var update_remove_links = function() { $j('.remove').click(function() { $j(this).prevAll(':first').val(1); $j(this).parent().hide(); }); };
rafarubert/loja
vendor/spree/vendor/extensions/theme_default/public/javascripts/nested-attribute.js
JavaScript
bsd-3-clause
660
[ 30522, 1013, 1013, 2006, 3931, 7170, 1013, 1013, 28681, 2080, 1011, 6366, 2512, 8663, 29301, 4933, 2320, 8773, 2003, 2908, 2005, 2204, 13075, 1002, 1046, 1027, 1046, 4226, 2854, 1012, 2053, 8663, 29301, 1006, 1007, 1025, 5672, 1035, 8909, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
/* $Id: sp_respond.h,v 1.26 2015/04/23 18:28:09 jocornet Exp $ */ /* ** Copyright (C) 2014-2015 Cisco and/or its affiliates. All rights reserved. ** Copyright (C) 2002-2013 Sourcefire, Inc. ** Copyright (C) 1998-2002 Martin Roesch <roesch@sourcefire.com> ** Copyright (C) 1999,2000,2001 Christian Lademann <cal@zls.de> ** ** 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. You may not use, modify or ** distribute this program under any other version of the GNU General ** Public License. ** ** 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. */ #ifndef __SP_RESPOND_H__ #define __SP_RESPOND_H__ #ifdef ENABLE_RESPOND void SetupRespond(void); uint32_t RespondHash(void* d); int RespondCompare(void *l, void *r); #endif #endif
kunschikov/snort
src/detection-plugins/sp_respond.h
C
gpl-2.0
1,280
[ 30522, 1013, 1008, 1002, 8909, 1024, 11867, 1035, 6869, 1012, 1044, 1010, 1058, 1015, 1012, 2656, 2325, 1013, 5840, 1013, 2603, 2324, 1024, 2654, 1024, 5641, 8183, 27108, 7159, 4654, 2361, 1002, 1008, 1013, 1013, 1008, 1008, 1008, 9385, 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...
# $FreeBSD: soc2013/dpl/head/release/doc/de_DE.ISO8859-1/relnotes/pc98/Makefile 242271 2012-10-01 11:26:49Z gabor $ # $FreeBSDde: de-docproj/relnotes/de_DE.ISO8859-1/relnotes/pc98/Makefile,v 1.1 2002/07/08 18:41:46 ue Exp $ # basiert auf: 1.1 RELN_ROOT?= ${.CURDIR}/../../.. DOC?= article FORMATS?= html INSTALL_COMPRESSED?= gz INSTALL_ONLY_COMPRESSED?= JADEFLAGS+= -V %generate-article-toc% # SGML content SRCS+= article.xml SRCS+= ../common/relnotes.ent SRCS+= ../common/new.xml .include "${RELN_ROOT}/share/mk/doc.relnotes.mk" .include "${DOC_PREFIX}/share/mk/doc.project.mk"
dplbsd/zcaplib
head/release/doc/de_DE.ISO8859-1/relnotes/pc98/Makefile
Makefile
bsd-2-clause
584
[ 30522, 1001, 1002, 2489, 5910, 2094, 1024, 27084, 11387, 17134, 1013, 1040, 24759, 1013, 2132, 1013, 2713, 1013, 9986, 1013, 2139, 1035, 2139, 1012, 11163, 2620, 27531, 2683, 1011, 1015, 1013, 2128, 19666, 12184, 2015, 1013, 7473, 2683, 262...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 unittest from urlparse import urlparse from paegan.utils.asarandom import AsaRandom class AsaRandomTest(unittest.TestCase): def test_create_random_filename(self): temp_filename = AsaRandom.filename(prefix="superduper", suffix=".nc") path = urlparse(temp_filename).path name, ext = os.path.splitext(path) assert name.index("superduper") == 0 assert ext == ".nc"
asascience-open/paegan
tests/test_asarandom.py
Python
gpl-3.0
424
[ 30522, 12324, 9808, 12324, 3131, 22199, 2013, 24471, 14277, 11650, 2063, 12324, 24471, 14277, 11650, 2063, 2013, 6643, 20307, 1012, 21183, 12146, 1012, 17306, 13033, 5358, 12324, 17306, 13033, 5358, 2465, 17306, 30524, 1024, 8915, 8737, 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...
extern int Check_for_data(); extern int init_serv_socket(); extern int init_socket(); extern int read_msg(); extern int write_msg(); extern int broadcast_msg(); extern int close_join(); extern int close_serv(); extern int leave();
bmybbs/bmybbs
unused/games/mj/src/socket.h
C
gpl-2.0
233
[ 30522, 4654, 16451, 20014, 4638, 1035, 2005, 1035, 2951, 1006, 1007, 1025, 4654, 16451, 20014, 1999, 4183, 1035, 14262, 2615, 1035, 22278, 1006, 1007, 1025, 4654, 16451, 20014, 1999, 4183, 1035, 22278, 1006, 1007, 1025, 4654, 16451, 20014, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
/* Colorbox Core Style: The following CSS is consistent between example themes and should not be altered. */ #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} #cboxWrapper {max-width:none;} #cboxOverlay{position:fixed; width:100%; height:100%;} #cboxMiddleLeft, #cboxBottomLeft{clear:left;} #cboxContent{position:relative;} #cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} #cboxTitle{margin:0;} #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} .cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} .cboxIframe{width:100%; height:100%; display:block; border:0;} #colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} /* User Style: Change the following styles to modify the appearance of Colorbox. They are ordered & tabbed in a way that represents the nesting of the generated HTML. */ #colorbox{outline:0;} #cboxTopLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px 0;} #cboxTopRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px 0;} #cboxBottomLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px -29px;} #cboxBottomRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px -29px;} #cboxMiddleLeft{width:21px; background:url(images/controls.png) left top repeat-y;} #cboxMiddleRight{width:21px; background:url(images/controls.png) right top repeat-y;} #cboxTopCenter{height:21px; background:url(images/border.png) 0 0 repeat-x;} #cboxBottomCenter{height:21px; background:url(images/border.png) 0 -29px repeat-x;} #cboxContent{background:#fff; overflow:hidden;} .cboxIframe{background:#fff;} #cboxError{padding:50px; border:1px solid #ccc;} #cboxLoadedContent{margin-bottom:28px;} #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;} #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;} #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;} #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; } /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;} #cboxPrevious{position:absolute; bottom:0; left:0; background:url(images/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;} #cboxPrevious:hover{background-position:-75px -25px;} #cboxNext{position:absolute; bottom:0; left:27px; background:url(images/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;} #cboxNext:hover{background-position:-50px -25px;} #cboxClose{position:absolute; bottom:0; right:0; background:url(images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;} #cboxClose:hover{background-position:-25px -25px;} /* The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9. See: http://jacklmoore.com/notes/ie-transparency-problems/ */ .cboxIE #cboxTopLeft, .cboxIE #cboxTopCenter, .cboxIE #cboxTopRight, .cboxIE #cboxBottomLeft, .cboxIE #cboxBottomCenter, .cboxIE #cboxBottomRight, .cboxIE #cboxMiddleLeft, .cboxIE #cboxMiddleRight { filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); }
emelielindstrom/wordpress
wp-content/plugins/awesome-filterable-portfolio/css/colorbox.css
CSS
gpl-2.0
4,311
[ 30522, 1013, 1008, 3609, 8758, 4563, 2806, 1024, 1996, 2206, 20116, 2015, 2003, 8335, 2090, 2742, 6991, 1998, 2323, 2025, 2022, 8776, 1012, 1008, 1013, 1001, 3609, 8758, 1010, 1001, 17324, 11636, 7840, 8485, 1010, 1001, 17324, 11636, 13088,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 "muduo/net/TcpServer.h" #include "muduo/base/Atomic.h" #include "muduo/base/FileUtil.h" #include "muduo/base/Logging.h" #include "muduo/base/ProcessInfo.h" #include "muduo/base/Thread.h" #include "muduo/net/EventLoop.h" #include "muduo/net/InetAddress.h" #include <utility> #include <stdio.h> #include <unistd.h> using namespace muduo; using namespace muduo::net; int numThreads = 0; class EchoServer { public: EchoServer(EventLoop* loop, const InetAddress& listenAddr) : server_(loop, listenAddr, "EchoServer"), startTime_(Timestamp::now()) { server_.setConnectionCallback( std::bind(&EchoServer::onConnection, this, _1)); server_.setMessageCallback( std::bind(&EchoServer::onMessage, this, _1, _2, _3)); server_.setThreadNum(numThreads); loop->runEvery(5.0, std::bind(&EchoServer::printThroughput, this)); } void start() { LOG_INFO << "starting " << numThreads << " threads."; server_.start(); } private: void onConnection(const TcpConnectionPtr& conn) { LOG_TRACE << conn->peerAddress().toIpPort() << " -> " << conn->localAddress().toIpPort() << " is " << (conn->connected() ? "UP" : "DOWN"); conn->setTcpNoDelay(true); if (conn->connected()) { connections_.increment(); } else { connections_.decrement(); } } void onMessage(const TcpConnectionPtr& conn, Buffer* buf, Timestamp) { size_t len = buf->readableBytes(); transferredBytes_.addAndGet(len); receivedMessages_.incrementAndGet(); conn->send(buf); } void printThroughput() { Timestamp endTime = Timestamp::now(); double bytes = static_cast<double>(transferredBytes_.getAndSet(0)); int msgs = receivedMessages_.getAndSet(0); double bytesPerMsg = msgs > 0 ? bytes/msgs : 0; double time = timeDifference(endTime, startTime_); printf("%.3f MiB/s %.2f Kilo Msgs/s %.2f bytes per msg, ", bytes/time/1024/1024, static_cast<double>(msgs)/time/1000, bytesPerMsg); printConnection(); fflush(stdout); startTime_ = endTime; } void printConnection() { string procStatus = ProcessInfo::procStatus(); printf("%d conn, files %d , VmSize %ld KiB, RSS %ld KiB, ", connections_.get(), ProcessInfo::openedFiles(), getLong(procStatus, "VmSize:"), getLong(procStatus, "VmRSS:")); string meminfo; FileUtil::readFile("/proc/meminfo", 65536, &meminfo); long total_kb = getLong(meminfo, "MemTotal:"); long free_kb = getLong(meminfo, "MemFree:"); long buffers_kb = getLong(meminfo, "Buffers:"); long cached_kb = getLong(meminfo, "Cached:"); printf("system memory used %ld KiB\n", total_kb - free_kb - buffers_kb - cached_kb); } long getLong(const string& procStatus, const char* key) { long result = 0; size_t pos = procStatus.find(key); if (pos != string::npos) { result = ::atol(procStatus.c_str() + pos + strlen(key)); } return result; } TcpServer server_; AtomicInt32 connections_; AtomicInt32 receivedMessages_; AtomicInt64 transferredBytes_; Timestamp startTime_; }; int main(int argc, char* argv[]) { LOG_INFO << "pid = " << getpid() << ", tid = " << CurrentThread::tid() << ", max files = " << ProcessInfo::maxOpenFiles(); Logger::setLogLevel(Logger::WARN); if (argc > 1) { numThreads = atoi(argv[1]); } EventLoop loop; InetAddress listenAddr(2007); EchoServer server(&loop, listenAddr); server.start(); loop.loop(); }
westfly/muduo
examples/netty/echo/server2.cc
C++
bsd-3-clause
3,595
[ 30522, 1001, 2421, 1000, 8494, 19098, 1013, 5658, 1013, 22975, 29251, 2099, 6299, 1012, 1044, 1000, 1001, 2421, 1000, 8494, 19098, 1013, 2918, 1013, 9593, 1012, 1044, 1000, 1001, 2421, 1000, 8494, 19098, 1013, 2918, 1013, 5371, 21823, 2140,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 <cstdio> #include <cstdlib> #include <cstdarg> #include <cstring> #include "../../Port.h" #include "../../NLS.h" #include "../GBA.h" #include "../GBAGlobals.h" #include "../GBAinline.h" #include "../GBACheats.h" #include "GBACpu.h" #include "../GBAGfx.h" #include "../GBASound.h" #include "../EEprom.h" #include "../Flash.h" #include "../Sram.h" #include "../bios.h" #include "../elf.h" #include "../RTC.h" #include "../agbprint.h" #include "../../common/System.h" #include "../../common/SystemGlobals.h" #include "../../common/Util.h" #include "../../common/movie.h" #include "../../common/vbalua.h" #ifdef PROFILING #include "../prof/prof.h" #endif #ifdef __GNUC__ #define _stricmp strcasecmp #endif static inline void interp_rate() { /* empty for now */ } int32 SWITicks = 0; int32 IRQTicks = 0; u32 mastercode = 0; int32 layerEnableDelay = 0; bool8 busPrefetch = false; bool8 busPrefetchEnable = false; u32 busPrefetchCount = 0; u32 cpuPrefetch[2]; int32 cpuDmaTicksToUpdate = 0; int32 cpuDmaCount = 0; bool8 cpuDmaHack = 0; u32 cpuDmaLast = 0; int32 dummyAddress = 0; int32 gbaSaveType = 0; // used to remember the save type on reset bool8 intState = false; bool8 stopState = false; bool8 holdState = false; int32 holdType = 0; bool8 cpuSramEnabled = true; bool8 cpuFlashEnabled = true; bool8 cpuEEPROMEnabled = true; bool8 cpuEEPROMSensorEnabled = false; #ifdef SDL bool8 cpuBreakLoop = false; #endif // These don't seem to affect determinism int32 cpuNextEvent = 0; int32 cpuTotalTicks = 0; #ifdef PROFILING int profilingTicks = 0; int profilingTicksReload = 0; static profile_segment *profilSegment = NULL; #endif #ifdef BKPT_SUPPORT u8 freezeWorkRAM[0x40000]; u8 freezeInternalRAM[0x8000]; u8 freezeVRAM[0x18000]; u8 freezePRAM[0x400]; u8 freezeOAM[0x400]; bool debugger_last; #endif int32 lcdTicks = (useBios && !skipBios) ? 1008 : 208; u8 timerOnOffDelay = 0; u16 timer0Value = 0; bool8 timer0On = false; int32 timer0Ticks = 0; int32 timer0Reload = 0; int32 timer0ClockReload = 0; u16 timer1Value = 0; bool8 timer1On = false; int32 timer1Ticks = 0; int32 timer1Reload = 0; int32 timer1ClockReload = 0; u16 timer2Value = 0; bool8 timer2On = false; int32 timer2Ticks = 0; int32 timer2Reload = 0; int32 timer2ClockReload = 0; u16 timer3Value = 0; bool8 timer3On = false; int32 timer3Ticks = 0; int32 timer3Reload = 0; int32 timer3ClockReload = 0; u32 dma0Source = 0; u32 dma0Dest = 0; u32 dma1Source = 0; u32 dma1Dest = 0; u32 dma2Source = 0; u32 dma2Dest = 0; u32 dma3Source = 0; u32 dma3Dest = 0; void (*cpuSaveGameFunc)(u32, u8) = flashSaveDecide; void (*renderLine)() = mode0RenderLine; bool8 fxOn = false; bool8 windowOn = false; char buffer[1024]; FILE *out = NULL; const int32 TIMER_TICKS[4] = { 0, 6, 8, 10 }; extern bool8 cpuIsMultiBoot; extern const u32 objTilesAddress[3] = { 0x010000, 0x014000, 0x014000 }; const u8 gamepakRamWaitState[4] = { 4, 3, 2, 8 }; const u8 gamepakWaitState[4] = { 4, 3, 2, 8 }; const u8 gamepakWaitState0[2] = { 2, 1 }; const u8 gamepakWaitState1[2] = { 4, 1 }; const u8 gamepakWaitState2[2] = { 8, 1 }; const bool8 isInRom[16] = { false, false, false, false, false, false, false, false, true, true, true, true, true, true, false, false }; u8 memoryWait[16] = { 0, 0, 2, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 0 }; u8 memoryWait32[16] = { 0, 0, 5, 0, 0, 1, 1, 0, 7, 7, 9, 9, 13, 13, 4, 0 }; u8 memoryWaitSeq[16] = { 0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 4, 4, 8, 8, 4, 0 }; u8 memoryWaitSeq32[16] = { 0, 0, 5, 0, 0, 1, 1, 0, 5, 5, 9, 9, 17, 17, 4, 0 }; // The videoMemoryWait constants are used to add some waitstates // if the opcode access video memory data outside of vblank/hblank // It seems to happen on only one ticks for each pixel. // Not used for now (too problematic with current code). //const u8 videoMemoryWait[16] = // {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static int32 romSize = 0x2000000; u8 biosProtected[4]; u8 cpuBitsSet[256]; u8 cpuLowestBitSet[256]; #ifdef WORDS_BIGENDIAN bool8 cpuBiosSwapped = false; #endif u32 myROM[] = { 0xEA000006, 0xEA000093, 0xEA000006, 0x00000000, 0x00000000, 0x00000000, 0xEA000088, 0x00000000, 0xE3A00302, 0xE1A0F000, 0xE92D5800, 0xE55EC002, 0xE28FB03C, 0xE79BC10C, 0xE14FB000, 0xE92D0800, 0xE20BB080, 0xE38BB01F, 0xE129F00B, 0xE92D4004, 0xE1A0E00F, 0xE12FFF1C, 0xE8BD4004, 0xE3A0C0D3, 0xE129F00C, 0xE8BD0800, 0xE169F00B, 0xE8BD5800, 0xE1B0F00E, 0x0000009C, 0x0000009C, 0x0000009C, 0x0000009C, 0x000001F8, 0x000001F0, 0x000000AC, 0x000000A0, 0x000000FC, 0x00000168, 0xE12FFF1E, 0xE1A03000, 0xE1A00001, 0xE1A01003, 0xE2113102, 0x42611000, 0xE033C040, 0x22600000, 0xE1B02001, 0xE15200A0, 0x91A02082, 0x3AFFFFFC, 0xE1500002, 0xE0A33003, 0x20400002, 0xE1320001, 0x11A020A2, 0x1AFFFFF9, 0xE1A01000, 0xE1A00003, 0xE1B0C08C, 0x22600000, 0x42611000, 0xE12FFF1E, 0xE92D0010, 0xE1A0C000, 0xE3A01001, 0xE1500001, 0x81A000A0, 0x81A01081, 0x8AFFFFFB, 0xE1A0000C, 0xE1A04001, 0xE3A03000, 0xE1A02001, 0xE15200A0, 0x91A02082, 0x3AFFFFFC, 0xE1500002, 0xE0A33003, 0x20400002, 0xE1320001, 0x11A020A2, 0x1AFFFFF9, 0xE0811003, 0xE1B010A1, 0xE1510004, 0x3AFFFFEE, 0xE1A00004, 0xE8BD0010, 0xE12FFF1E, 0xE0010090, 0xE1A01741, 0xE2611000, 0xE3A030A9, 0xE0030391, 0xE1A03743, 0xE2833E39, 0xE0030391, 0xE1A03743, 0xE2833C09, 0xE283301C, 0xE0030391, 0xE1A03743, 0xE2833C0F, 0xE28330B6, 0xE0030391, 0xE1A03743, 0xE2833C16, 0xE28330AA, 0xE0030391, 0xE1A03743, 0xE2833A02, 0xE2833081, 0xE0030391, 0xE1A03743, 0xE2833C36, 0xE2833051, 0xE0030391, 0xE1A03743, 0xE2833CA2, 0xE28330F9, 0xE0000093, 0xE1A00840, 0xE12FFF1E, 0xE3A00001, 0xE3A01001, 0xE92D4010, 0xE3A03000, 0xE3A04001, 0xE3500000, 0x1B000004, 0xE5CC3301, 0xEB000002, 0x0AFFFFFC, 0xE8BD4010, 0xE12FFF1E, 0xE3A0C301, 0xE5CC3208, 0xE15C20B8, 0xE0110002, 0x10222000, 0x114C20B8, 0xE5CC4208, 0xE12FFF1E, 0xE92D500F, 0xE3A00301, 0xE1A0E00F, 0xE510F004, 0xE8BD500F, 0xE25EF004, 0xE59FD044, 0xE92D5000, 0xE14FC000, 0xE10FE000, 0xE92D5000, 0xE3A0C302, 0xE5DCE09C, 0xE35E00A5, 0x1A000004, 0x05DCE0B4, 0x021EE080, 0xE28FE004, 0x159FF018, 0x059FF018, 0xE59FD018, 0xE8BD5000, 0xE169F00C, 0xE8BD5000, 0xE25EF004, 0x03007FF0, 0x09FE2000, 0x09FFC000, 0x03007FE0 }; variable_desc saveGameStruct[] = { { &DISPCNT, sizeof(u16) }, { &DISPSTAT, sizeof(u16) }, { &VCOUNT, sizeof(u16) }, { &BG0CNT, sizeof(u16) }, { &BG1CNT, sizeof(u16) }, { &BG2CNT, sizeof(u16) }, { &BG3CNT, sizeof(u16) }, { &BG0HOFS, sizeof(u16) }, { &BG0VOFS, sizeof(u16) }, { &BG1HOFS, sizeof(u16) }, { &BG1VOFS, sizeof(u16) }, { &BG2HOFS, sizeof(u16) }, { &BG2VOFS, sizeof(u16) }, { &BG3HOFS, sizeof(u16) }, { &BG3VOFS, sizeof(u16) }, { &BG2PA, sizeof(u16) }, { &BG2PB, sizeof(u16) }, { &BG2PC, sizeof(u16) }, { &BG2PD, sizeof(u16) }, { &BG2X_L, sizeof(u16) }, { &BG2X_H, sizeof(u16) }, { &BG2Y_L, sizeof(u16) }, { &BG2Y_H, sizeof(u16) }, { &BG3PA, sizeof(u16) }, { &BG3PB, sizeof(u16) }, { &BG3PC, sizeof(u16) }, { &BG3PD, sizeof(u16) }, { &BG3X_L, sizeof(u16) }, { &BG3X_H, sizeof(u16) }, { &BG3Y_L, sizeof(u16) }, { &BG3Y_H, sizeof(u16) }, { &WIN0H, sizeof(u16) }, { &WIN1H, sizeof(u16) }, { &WIN0V, sizeof(u16) }, { &WIN1V, sizeof(u16) }, { &WININ, sizeof(u16) }, { &WINOUT, sizeof(u16) }, { &MOSAIC, sizeof(u16) }, { &BLDMOD, sizeof(u16) }, { &COLEV, sizeof(u16) }, { &COLY, sizeof(u16) }, { &DM0SAD_L, sizeof(u16) }, { &DM0SAD_H, sizeof(u16) }, { &DM0DAD_L, sizeof(u16) }, { &DM0DAD_H, sizeof(u16) }, { &DM0CNT_L, sizeof(u16) }, { &DM0CNT_H, sizeof(u16) }, { &DM1SAD_L, sizeof(u16) }, { &DM1SAD_H, sizeof(u16) }, { &DM1DAD_L, sizeof(u16) }, { &DM1DAD_H, sizeof(u16) }, { &DM1CNT_L, sizeof(u16) }, { &DM1CNT_H, sizeof(u16) }, { &DM2SAD_L, sizeof(u16) }, { &DM2SAD_H, sizeof(u16) }, { &DM2DAD_L, sizeof(u16) }, { &DM2DAD_H, sizeof(u16) }, { &DM2CNT_L, sizeof(u16) }, { &DM2CNT_H, sizeof(u16) }, { &DM3SAD_L, sizeof(u16) }, { &DM3SAD_H, sizeof(u16) }, { &DM3DAD_L, sizeof(u16) }, { &DM3DAD_H, sizeof(u16) }, { &DM3CNT_L, sizeof(u16) }, { &DM3CNT_H, sizeof(u16) }, { &TM0D, sizeof(u16) }, { &TM0CNT, sizeof(u16) }, { &TM1D, sizeof(u16) }, { &TM1CNT, sizeof(u16) }, { &TM2D, sizeof(u16) }, { &TM2CNT, sizeof(u16) }, { &TM3D, sizeof(u16) }, { &TM3CNT, sizeof(u16) }, { &P1, sizeof(u16) }, { &IE, sizeof(u16) }, { &IF, sizeof(u16) }, { &IME, sizeof(u16) }, { &holdState, sizeof(bool8) }, { &holdType, sizeof(int32) }, { &lcdTicks, sizeof(int32) }, { &timer0On, sizeof(bool8) }, { &timer0Ticks, sizeof(int32) }, { &timer0Reload, sizeof(int32) }, { &timer0ClockReload, sizeof(int32) }, { &timer1On, sizeof(bool8) }, { &timer1Ticks, sizeof(int32) }, { &timer1Reload, sizeof(int32) }, { &timer1ClockReload, sizeof(int32) }, { &timer2On, sizeof(bool8) }, { &timer2Ticks, sizeof(int32) }, { &timer2Reload, sizeof(int32) }, { &timer2ClockReload, sizeof(int32) }, { &timer3On, sizeof(bool8) }, { &timer3Ticks, sizeof(int32) }, { &timer3Reload, sizeof(int32) }, { &timer3ClockReload, sizeof(int32) }, { &dma0Source, sizeof(u32) }, { &dma0Dest, sizeof(u32) }, { &dma1Source, sizeof(u32) }, { &dma1Dest, sizeof(u32) }, { &dma2Source, sizeof(u32) }, { &dma2Dest, sizeof(u32) }, { &dma3Source, sizeof(u32) }, { &dma3Dest, sizeof(u32) }, { &fxOn, sizeof(bool8) }, { &windowOn, sizeof(bool8) }, { &N_FLAG, sizeof(bool8) }, { &C_FLAG, sizeof(bool8) }, { &Z_FLAG, sizeof(bool8) }, { &V_FLAG, sizeof(bool8) }, { &armState, sizeof(bool8) }, { &armIrqEnable, sizeof(bool8) }, { &armNextPC, sizeof(u32) }, { &armMode, sizeof(int32) }, { &saveType, sizeof(int32) }, { NULL, 0 } }; ///////////////////////////////////////////// #ifdef PROFILING void cpuProfil(profile_segment *seg) { profilSegment = seg; } void cpuEnableProfiling(int hz) { if (hz == 0) hz = 100; profilingTicks = profilingTicksReload = 16777216 / hz; profSetHertz(hz); } #endif inline int CPUUpdateTicks() { int cpuLoopTicks = lcdTicks; if (soundTicks < cpuLoopTicks) cpuLoopTicks = soundTicks; if (timer0On && (timer0Ticks < cpuLoopTicks)) { cpuLoopTicks = timer0Ticks; } if (timer1On && !(TM1CNT & 4) && (timer1Ticks < cpuLoopTicks)) { cpuLoopTicks = timer1Ticks; } if (timer2On && !(TM2CNT & 4) && (timer2Ticks < cpuLoopTicks)) { cpuLoopTicks = timer2Ticks; } if (timer3On && !(TM3CNT & 4) && (timer3Ticks < cpuLoopTicks)) { cpuLoopTicks = timer3Ticks; } #ifdef PROFILING if (profilingTicksReload != 0) { if (profilingTicks < cpuLoopTicks) { cpuLoopTicks = profilingTicks; } } #endif if (SWITicks) { if (SWITicks < cpuLoopTicks) cpuLoopTicks = SWITicks; } if (IRQTicks) { if (IRQTicks < cpuLoopTicks) cpuLoopTicks = IRQTicks; } return cpuLoopTicks; } void CPUUpdateWindow0() { int x00 = WIN0H >> 8; int x01 = WIN0H & 255; if (x00 <= x01) { for (int i = 0; i < 240; i++) { gfxInWin0[i] = (i >= x00 && i < x01); } } else { for (int i = 0; i < 240; i++) { gfxInWin0[i] = (i >= x00 || i < x01); } } } void CPUUpdateWindow1() { int x00 = WIN1H >> 8; int x01 = WIN1H & 255; if (x00 <= x01) { for (int i = 0; i < 240; i++) { gfxInWin1[i] = (i >= x00 && i < x01); } } else { for (int i = 0; i < 240; i++) { gfxInWin1[i] = (i >= x00 || i < x01); } } } #define CLEAR_ARRAY(a) \ { \ u32 *array = (a); \ for (int i = 0; i < 240; i++) { \ *array++ = 0x80000000; \ } \ } \ void CPUUpdateRenderBuffers(bool force) { if (!(layerEnable & 0x0100) || force) { CLEAR_ARRAY(line0); } if (!(layerEnable & 0x0200) || force) { CLEAR_ARRAY(line1); } if (!(layerEnable & 0x0400) || force) { CLEAR_ARRAY(line2); } if (!(layerEnable & 0x0800) || force) { CLEAR_ARRAY(line3); } } #undef CLEAR_ARRAY bool CPUWriteStateToStream(gzFile gzFile) { utilWriteInt(gzFile, SAVE_GAME_VERSION); utilGzWrite(gzFile, &rom[0xa0], 16); utilWriteInt(gzFile, useBios); utilGzWrite(gzFile, &reg[0], sizeof(reg)); utilWriteData(gzFile, saveGameStruct); // new to version 0.7.1 utilWriteInt(gzFile, stopState); // new to version 0.8 utilWriteInt(gzFile, intState); utilGzWrite(gzFile, internalRAM, 0x8000); utilGzWrite(gzFile, paletteRAM, 0x400); utilGzWrite(gzFile, workRAM, 0x40000); utilGzWrite(gzFile, vram, 0x20000); utilGzWrite(gzFile, oam, 0x400); utilGzWrite(gzFile, pix, 4 * 241 * 162); utilGzWrite(gzFile, ioMem, 0x400); eepromSaveGame(gzFile); flashSaveGame(gzFile); soundSaveGame(gzFile); cheatsSaveGame(gzFile); // version 1.5 rtcSaveGame(gzFile); // SAVE_GAME_VERSION_9 (new to re-recording version which is based on 1.72) { utilGzWrite(gzFile, &sensorX, sizeof(sensorX)); utilGzWrite(gzFile, &sensorY, sizeof(sensorY)); bool8 movieActive = VBAMovieIsActive(); utilGzWrite(gzFile, &movieActive, sizeof(movieActive)); if (movieActive) { uint8 *movie_freeze_buf = NULL; uint32 movie_freeze_size = 0; int code = VBAMovieFreeze(&movie_freeze_buf, &movie_freeze_size); if (movie_freeze_buf) { utilGzWrite(gzFile, &movie_freeze_size, sizeof(movie_freeze_size)); utilGzWrite(gzFile, movie_freeze_buf, movie_freeze_size); delete [] movie_freeze_buf; } else { if (code == MOVIE_UNRECORDED_INPUT) { systemMessage(0, N_("Cannot make a movie snapshot as long as there are unrecorded input changes.")); } else { systemMessage(0, N_("Failed to save movie snapshot.")); } return false; } } utilGzWrite(gzFile, &systemCounters.frameCount, sizeof(systemCounters.frameCount)); } // SAVE_GAME_VERSION_13 { utilGzWrite(gzFile, &systemCounters.lagCount, sizeof(systemCounters.lagCount)); utilGzWrite(gzFile, &systemCounters.lagged, sizeof(systemCounters.lagged)); utilGzWrite(gzFile, &systemCounters.laggedLast, sizeof(systemCounters.laggedLast)); } // SAVE_GAME_VERSION_14 { utilGzWrite(gzFile, memoryWait, 16 * sizeof(u8)); utilGzWrite(gzFile, memoryWait32, 16 * sizeof(u8)); utilGzWrite(gzFile, memoryWaitSeq, 16 * sizeof(u8)); utilGzWrite(gzFile, memoryWaitSeq32, 16 * sizeof(u8)); utilGzWrite(gzFile, &speedHack, sizeof(bool8)); // just in case it's ever used... } return true; } bool CPUWriteState(const char *file) { gzFile gzFile = utilGzOpen(file, "wb"); if (gzFile == NULL) { systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), file); return false; } bool res = CPUWriteStateToStream(gzFile); utilGzClose(gzFile); return res; } bool CPUWriteMemState(char *memory, int available) { gzFile gzFile = utilMemGzOpen(memory, available, "w"); if (gzFile == NULL) { return false; } bool res = CPUWriteStateToStream(gzFile); long pos = utilGzTell(gzFile) + 8; if (pos >= (available)) res = false; utilGzClose(gzFile); return res; } bool CPUReadStateFromStream(gzFile gzFile) { char tempBackupName[128]; if (tempSaveSafe) { sprintf(tempBackupName, "gbatempsave%d.sav", tempSaveID++); CPUWriteState(tempBackupName); } int version = utilReadInt(gzFile); if (version > SAVE_GAME_VERSION || version < SAVE_GAME_VERSION_1) { systemMessage(MSG_UNSUPPORTED_VBA_SGM, N_("Unsupported VisualBoyAdvance save game version %d"), version); goto failedLoad; } u8 romname[17]; utilGzRead(gzFile, romname, 16); if (memcmp(&rom[0xa0], romname, 16) != 0) { romname[16] = 0; for (int i = 0; i < 16; i++) if (romname[i] < 32) romname[i] = 32; systemMessage(MSG_CANNOT_LOAD_SGM, N_("Cannot load save game for %s"), romname); goto failedLoad; } bool8 ub = utilReadInt(gzFile) ? true : false; if (ub != useBios) { if (useBios) systemMessage(MSG_SAVE_GAME_NOT_USING_BIOS, N_("Save game is not using the BIOS files")); else systemMessage(MSG_SAVE_GAME_USING_BIOS, N_("Save game is using the BIOS file")); goto failedLoad; } utilGzRead(gzFile, &reg[0], sizeof(reg)); utilReadData(gzFile, saveGameStruct); if (version < SAVE_GAME_VERSION_3) stopState = false; else stopState = utilReadInt(gzFile) ? true : false; if (version < SAVE_GAME_VERSION_4) intState = false; else intState = utilReadInt(gzFile) ? true : false; utilGzRead(gzFile, internalRAM, 0x8000); utilGzRead(gzFile, paletteRAM, 0x400); utilGzRead(gzFile, workRAM, 0x40000); utilGzRead(gzFile, vram, 0x20000); utilGzRead(gzFile, oam, 0x400); if (version < SAVE_GAME_VERSION_6) utilGzRead(gzFile, pix, 4 * 240 * 160); else utilGzRead(gzFile, pix, 4 * 241 * 162); utilGzRead(gzFile, ioMem, 0x400); if (skipSaveGameBattery) { // skip eeprom data eepromReadGameSkip(gzFile, version); // skip flash data flashReadGameSkip(gzFile, version); } else { eepromReadGame(gzFile, version); flashReadGame(gzFile, version); } soundReadGame(gzFile, version); if (version > SAVE_GAME_VERSION_1) { if (skipSaveGameCheats) { // skip cheats list data cheatsReadGameSkip(gzFile, version); } else { cheatsReadGame(gzFile, version); } } if (version > SAVE_GAME_VERSION_6) { rtcReadGame(gzFile); } if (version <= SAVE_GAME_VERSION_7) { u32 temp; #define SWAP(a, b, c) \ temp = (a); \ (a) = (b) << 16 | (c); \ (b) = (temp) >> 16; \ (c) = (temp) & 0xFFFF; SWAP(dma0Source, DM0SAD_H, DM0SAD_L); SWAP(dma0Dest, DM0DAD_H, DM0DAD_L); SWAP(dma1Source, DM1SAD_H, DM1SAD_L); SWAP(dma1Dest, DM1DAD_H, DM1DAD_L); SWAP(dma2Source, DM2SAD_H, DM2SAD_L); SWAP(dma2Dest, DM2DAD_H, DM2DAD_L); SWAP(dma3Source, DM3SAD_H, DM3SAD_L); SWAP(dma3Dest, DM3DAD_H, DM3DAD_L); } #undef SWAP if (version <= SAVE_GAME_VERSION_8) { timer0ClockReload = TIMER_TICKS[TM0CNT & 3]; timer1ClockReload = TIMER_TICKS[TM1CNT & 3]; timer2ClockReload = TIMER_TICKS[TM2CNT & 3]; timer3ClockReload = TIMER_TICKS[TM3CNT & 3]; timer0Ticks = ((0x10000 - TM0D) << timer0ClockReload) - timer0Ticks; timer1Ticks = ((0x10000 - TM1D) << timer1ClockReload) - timer1Ticks; timer2Ticks = ((0x10000 - TM2D) << timer2ClockReload) - timer2Ticks; timer3Ticks = ((0x10000 - TM3D) << timer3ClockReload) - timer3Ticks; interp_rate(); } // set pointers! layerEnable = layerSettings & DISPCNT; CPUUpdateRender(); CPUUpdateRenderBuffers(true); CPUUpdateWindow0(); CPUUpdateWindow1(); gbaSaveType = 0; switch (saveType) { case 0: cpuSaveGameFunc = flashSaveDecide; break; case 1: cpuSaveGameFunc = sramWrite; gbaSaveType = 1; break; case 2: cpuSaveGameFunc = flashWrite; gbaSaveType = 2; break; case 3: break; case 5: gbaSaveType = 5; break; default: systemMessage(MSG_UNSUPPORTED_SAVE_TYPE, N_("Unsupported save type %d"), saveType); break; } if (eepromInUse) gbaSaveType = 3; systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; bool wasPlayingMovie = VBAMovieIsActive() && VBAMovieIsPlaying(); if (version >= SAVE_GAME_VERSION_9) // new to re-recording version: { utilGzRead(gzFile, &sensorX, sizeof(sensorX)); utilGzRead(gzFile, &sensorY, sizeof(sensorY)); bool8 movieSnapshot; utilGzRead(gzFile, &movieSnapshot, sizeof(movieSnapshot)); if (VBAMovieIsActive() && !movieSnapshot) { systemMessage(0, N_("Can't load a non-movie snapshot while a movie is active.")); goto failedLoad; } if (movieSnapshot) // even if a movie isn't active we still want to parse through this // because we have already got stuff added in this save format { uint32 movieInputDataSize = 0; utilGzRead(gzFile, &movieInputDataSize, sizeof(movieInputDataSize)); uint8 *local_movie_data = new uint8[movieInputDataSize]; int readBytes = utilGzRead(gzFile, local_movie_data, movieInputDataSize); if (readBytes != movieInputDataSize) { systemMessage(0, N_("Corrupt movie snapshot.")); delete [] local_movie_data; goto failedLoad; } int code = VBAMovieUnfreeze(local_movie_data, movieInputDataSize); delete [] local_movie_data; if (code != MOVIE_SUCCESS && VBAMovieIsActive()) { char errStr [1024]; strcpy(errStr, "Failed to load movie snapshot"); switch (code) { case MOVIE_NOT_FROM_THIS_MOVIE: strcat(errStr, ";\nSnapshot not from this movie"); break; case MOVIE_NOT_FROM_A_MOVIE: strcat(errStr, ";\nNot a movie snapshot"); break; // shouldn't get here... case MOVIE_UNVERIFIABLE_POST_END: sprintf(errStr, "%s;\nSnapshot unverifiable with movie after End Frame %u", errStr, VBAMovieGetLastErrorInfo()); break; case MOVIE_TIMELINE_INCONSISTENT_AT: sprintf(errStr, "%s;\nSnapshot inconsistent with movie at Frame %u", errStr, VBAMovieGetLastErrorInfo()); break; case MOVIE_WRONG_FORMAT: strcat(errStr, ";\nWrong format"); break; } strcat(errStr, "."); systemMessage(0, N_(errStr)); goto failedLoad; } } utilGzRead(gzFile, &systemCounters.frameCount, sizeof(systemCounters.frameCount)); } if (version < SAVE_GAME_VERSION_14) { if (version >= SAVE_GAME_VERSION_10) { utilGzSeek(gzFile, 16 * sizeof(int32) * 6, SEEK_CUR); } if (version >= SAVE_GAME_VERSION_11) { utilGzSeek(gzFile, sizeof(bool8) * 3, SEEK_CUR); } if (version >= SAVE_GAME_VERSION_12) { utilGzSeek(gzFile, sizeof(bool8) * 2, SEEK_CUR); } } if (version >= SAVE_GAME_VERSION_13) { utilGzRead(gzFile, &systemCounters.lagCount, sizeof(systemCounters.lagCount)); utilGzRead(gzFile, &systemCounters.lagged, sizeof(systemCounters.lagged)); utilGzRead(gzFile, &systemCounters.laggedLast, sizeof(systemCounters.laggedLast)); } if (version >= SAVE_GAME_VERSION_14) { utilGzRead(gzFile, memoryWait, 16 * sizeof(u8)); utilGzRead(gzFile, memoryWait32, 16 * sizeof(u8)); utilGzRead(gzFile, memoryWaitSeq, 16 * sizeof(u8)); utilGzRead(gzFile, memoryWaitSeq32, 16 * sizeof(u8)); utilGzRead(gzFile, &speedHack, sizeof(bool8)); // just in case it's ever used... } if (armState) { ARM_PREFETCH; } else { THUMB_PREFETCH; } CPUUpdateRegister(0x204, CPUReadHalfWordQuick(0x4000204)); systemSetJoypad(0, ~P1 & 0x3FF); VBAUpdateButtonPressDisplay(); VBAUpdateFrameCountDisplay(); systemRefreshScreen(); if (tempSaveSafe) { remove(tempBackupName); tempSaveAttempts = 0; } return true; failedLoad: if (tempSaveSafe) { tempSaveAttempts++; if (tempSaveAttempts < 3) // fail no more than 2 times in a row CPUReadState(tempBackupName); remove(tempBackupName); } if (wasPlayingMovie && VBAMovieIsRecording()) { VBAMovieSwitchToPlaying(); } return false; } bool CPUReadMemState(char *memory, int available) { gzFile gzFile = utilMemGzOpen(memory, available, "r"); tempSaveSafe = false; bool res = CPUReadStateFromStream(gzFile); tempSaveSafe = true; utilGzClose(gzFile); return res; } bool CPUReadState(const char *file) { gzFile gzFile = utilGzOpen(file, "rb"); if (gzFile == NULL) return false; bool res = CPUReadStateFromStream(gzFile); utilGzClose(gzFile); return res; } bool CPUExportEepromFile(const char *fileName) { if (eepromInUse) { FILE *file = fopen(fileName, "wb"); if (!file) { systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), fileName); return false; } for (int i = 0; i < eepromSize; ) { for (int j = 0; j < 8; j++) { if (fwrite(&eepromData[i + 7 - j], 1, 1, file) != 1) { fclose(file); return false; } } i += 8; } fclose(file); } return true; } bool CPUWriteBatteryToStream(gzFile gzFile) { if (!gzFile) return false; utilWriteInt(gzFile, SAVE_GAME_VERSION); // for simplicity, we put both types of battery files should be in the stream, even if one's empty eepromSaveGame(gzFile); flashSaveGame(gzFile); return true; } bool CPUWriteBatteryFile(const char *fileName) { if (gbaSaveType == 0) { if (eepromInUse) gbaSaveType = 3; else switch (saveType) { case 1: gbaSaveType = 1; break; case 2: gbaSaveType = 2; break; } } if ((gbaSaveType != 0) && (gbaSaveType != 5)) { FILE *file = fopen(fileName, "wb"); if (!file) { systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), fileName); return false; } // only save if Flash/Sram in use or EEprom in use if (gbaSaveType != 3) { if (gbaSaveType == 2) { if (fwrite(flashSaveMemory, 1, flashSize, file) != (size_t)flashSize) { fclose(file); return false; } } else { if (fwrite(flashSaveMemory, 1, 0x10000, file) != 0x10000) { fclose(file); return false; } } } else { if (fwrite(eepromData, 1, eepromSize, file) != (size_t)eepromSize) { fclose(file); return false; } } fclose(file); } return true; } bool CPUReadGSASnapshot(const char *fileName) { int i; FILE *file = fopen(fileName, "rb"); if (!file) { systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), fileName); return false; } // check file size to know what we should read fseek(file, 0, SEEK_END); // long size = ftell(file); fseek(file, 0x0, SEEK_SET); fread(&i, 1, 4, file); fseek(file, i, SEEK_CUR); // Skip SharkPortSave fseek(file, 4, SEEK_CUR); // skip some sort of flag fread(&i, 1, 4, file); // name length fseek(file, i, SEEK_CUR); // skip name fread(&i, 1, 4, file); // desc length fseek(file, i, SEEK_CUR); // skip desc fread(&i, 1, 4, file); // notes length fseek(file, i, SEEK_CUR); // skip notes int saveSize; fread(&saveSize, 1, 4, file); // read length saveSize -= 0x1c; // remove header size char buffer[17]; char buffer2[17]; fread(buffer, 1, 16, file); buffer[16] = 0; for (i = 0; i < 16; i++) if (buffer[i] < 32) buffer[i] = 32; memcpy(buffer2, &rom[0xa0], 16); buffer2[16] = 0; for (i = 0; i < 16; i++) if (buffer2[i] < 32) buffer2[i] = 32; if (memcmp(buffer, buffer2, 16)) { systemMessage(MSG_CANNOT_IMPORT_SNAPSHOT_FOR, N_("Cannot import snapshot for %s. Current game is %s"), buffer, buffer2); fclose(file); return false; } fseek(file, 12, SEEK_CUR); // skip some flags if (saveSize >= 65536) { if (fread(flashSaveMemory, 1, saveSize, file) != (size_t)saveSize) { fclose(file); return false; } } else { systemMessage(MSG_UNSUPPORTED_SNAPSHOT_FILE, N_("Unsupported snapshot file %s"), fileName); fclose(file); return false; } fclose(file); CPUReset(); return true; } bool CPUWriteGSASnapshot(const char *fileName, const char *title, const char *desc, const char *notes) { FILE *file = fopen(fileName, "wb"); if (!file) { systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), fileName); return false; } u8 buffer[17]; utilPutDword(buffer, 0x0d); // SharkPortSave length fwrite(buffer, 1, 4, file); fwrite("SharkPortSave", 1, 0x0d, file); utilPutDword(buffer, 0x000f0000); fwrite(buffer, 1, 4, file); // save type 0x000f0000 = GBA save utilPutDword(buffer, (u32)strlen(title)); fwrite(buffer, 1, 4, file); // title length fwrite(title, 1, strlen(title), file); utilPutDword(buffer, (u32)strlen(desc)); fwrite(buffer, 1, 4, file); // desc length fwrite(desc, 1, strlen(desc), file); utilPutDword(buffer, (u32)strlen(notes)); fwrite(buffer, 1, 4, file); // notes length fwrite(notes, 1, strlen(notes), file); int saveSize = 0x10000; if (gbaSaveType == 2) saveSize = flashSize; int totalSize = saveSize + 0x1c; utilPutDword(buffer, totalSize); // length of remainder of save - CRC fwrite(buffer, 1, 4, file); char *temp = new char[0x2001c]; memset(temp, 0, 28); memcpy(temp, &rom[0xa0], 16); // copy internal name temp[0x10] = rom[0xbe]; // reserved area (old checksum) temp[0x11] = rom[0xbf]; // reserved area (old checksum) temp[0x12] = rom[0xbd]; // complement check temp[0x13] = rom[0xb0]; // maker temp[0x14] = 1; // 1 save ? memcpy(&temp[0x1c], flashSaveMemory, saveSize); // copy save fwrite(temp, 1, totalSize, file); // write save + header u32 crc = 0; for (int i = 0; i < totalSize; i++) { crc += ((u32)temp[i] << (crc % 0x18)); } utilPutDword(buffer, crc); fwrite(buffer, 1, 4, file); // CRC? fclose(file); delete [] temp; return true; } bool CPUImportEepromFile(const char *fileName) { FILE *file = fopen(fileName, "rb"); if (!file) return false; // check file size to know what we should read fseek(file, 0, SEEK_END); long size = ftell(file); fseek(file, 0, SEEK_SET); if (size == 512 || size == 0x2000) { if (fread(eepromData, 1, size, file) != (size_t)size) { fclose(file); return false; } for (int i = 0; i < size; ) { u8 tmp = eepromData[i]; eepromData[i] = eepromData[7 - i]; eepromData[7 - i] = tmp; i++; tmp = eepromData[i]; eepromData[i] = eepromData[7 - i]; eepromData[7 - i] = tmp; i++; tmp = eepromData[i]; eepromData[i] = eepromData[7 - i]; eepromData[7 - i] = tmp; i++; tmp = eepromData[i]; eepromData[i] = eepromData[7 - i]; eepromData[7 - i] = tmp; i++; i += 4; } } else { fclose(file); return false; } fclose(file); return true; } bool CPUReadBatteryFromStream(gzFile gzFile) { if (!gzFile) return false; int version = utilReadInt(gzFile); // for simplicity, we put both types of battery files should be in the stream, even if one's empty eepromReadGame(gzFile, version); flashReadGame(gzFile, version); return true; } bool CPUReadBatteryFile(const char *fileName) { FILE *file = fopen(fileName, "rb"); if (!file) return false; // check file size to know what we should read fseek(file, 0, SEEK_END); long size = ftell(file); fseek(file, 0, SEEK_SET); systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; if (size == 512 || size == 0x2000) { if (fread(eepromData, 1, size, file) != (size_t)size) { fclose(file); return false; } } else { if (size == 0x20000) { if (fread(flashSaveMemory, 1, 0x20000, file) != 0x20000) { fclose(file); return false; } flashSetSize(0x20000); } else { if (fread(flashSaveMemory, 1, 0x10000, file) != 0x10000) { fclose(file); return false; } flashSetSize(0x10000); } } fclose(file); return true; } bool CPUWritePNGFile(const char *fileName) { return utilWritePNGFile(fileName, 240, 160, pix); } bool CPUWriteBMPFile(const char *fileName) { return utilWriteBMPFile(fileName, 240, 160, pix); } void CPUCleanUp() { #ifdef PROFILING if (profilingTicksReload) { profCleanup(); } #endif PIX_FREE(pix); pix = NULL; free(bios); bios = NULL; free(rom); rom = NULL; free(internalRAM); internalRAM = NULL; free(workRAM); workRAM = NULL; free(paletteRAM); paletteRAM = NULL; free(vram); vram = NULL; free(oam); oam = NULL; free(ioMem); ioMem = NULL; #if 0 eepromErase(); flashErase(); #endif #ifndef NO_DEBUGGER elfCleanUp(); #endif systemCleanUp(); systemRefreshScreen(); } int CPULoadRom(const char *szFile) { int size = 0x2000000; if (rom != NULL) { CPUCleanUp(); } systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; rom = (u8 *)malloc(0x2000000); if (rom == NULL) { systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "ROM"); return 0; } // FIXME: size+4 is so RAM search and watch are safe to read any byte in the allocated region as a 4-byte int workRAM = (u8 *)RAM_CALLOC(0x40000); if (workRAM == NULL) { systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "WRAM"); return 0; } u8 *whereToLoad = cpuIsMultiBoot ? workRAM : rom; #ifndef NO_DEBUGGER if (utilIsELF(szFile)) { FILE *f = fopen(szFile, "rb"); if (!f) { systemMessage(MSG_ERROR_OPENING_IMAGE, N_("Error opening image %s"), szFile); CPUCleanUp(); return 0; } bool res = elfRead(szFile, size, f); if (!res || size == 0) { CPUCleanUp(); elfCleanUp(); return 0; } } else #endif //NO_DEBUGGER if (szFile != NULL) { if (!utilLoad(szFile, utilIsGBAImage, whereToLoad, size)) { CPUCleanUp(); return 0; } } u16 *temp = (u16 *)(rom + ((size + 1) & ~1)); for (int i = (size + 1) & ~1; i < 0x2000000; i += 2) { WRITE16LE(temp, (i >> 1) & 0xFFFF); temp++; } pix = (u8 *)PIX_CALLOC(4 * 241 * 162); if (pix == NULL) { systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "PIX"); CPUCleanUp(); return 0; } bios = (u8 *)RAM_CALLOC(0x4000); if (bios == NULL) { systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "BIOS"); CPUCleanUp(); return 0; } internalRAM = (u8 *)RAM_CALLOC(0x8000); if (internalRAM == NULL) { systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "IRAM"); CPUCleanUp(); return 0; } paletteRAM = (u8 *)RAM_CALLOC(0x400); if (paletteRAM == NULL) { systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "PRAM"); CPUCleanUp(); return 0; } vram = (u8 *)RAM_CALLOC(0x20000); if (vram == NULL) { systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "VRAM"); CPUCleanUp(); return 0; } oam = (u8 *)RAM_CALLOC(0x400); if (oam == NULL) { systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "OAM"); CPUCleanUp(); return 0; } ioMem = (u8 *)RAM_CALLOC(0x400); if (ioMem == NULL) { systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "IO"); CPUCleanUp(); return 0; } flashInit(); eepromInit(); CPUUpdateRenderBuffers(true); romSize = size; return size; } void CPUDoMirroring(bool b) { u32 mirroredRomSize = (((romSize) >> 20) & 0x3F) << 20; u32 mirroredRomAddress = romSize; if ((mirroredRomSize <= 0x800000) && (b)) { mirroredRomAddress = mirroredRomSize; if (mirroredRomSize == 0) mirroredRomSize = 0x100000; while (mirroredRomAddress < 0x01000000) { memcpy((u16 *)(rom + mirroredRomAddress), (u16 *)(rom), mirroredRomSize); mirroredRomAddress += mirroredRomSize; } } } // Emulates the Cheat System (m) code void CPUMasterCodeCheck() { if (cheatsEnabled) { if ((mastercode) && (mastercode == armNextPC)) { u32 joy = 0; if (systemReadJoypads()) joy = systemGetJoypad(0, cpuEEPROMSensorEnabled); u32 ext = (joy >> 10); cpuTotalTicks += cheatsCheckKeys(P1 ^ 0x3FF, ext); } } } void CPUUpdateRender() { switch (DISPCNT & 7) { case 0: if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx) renderLine = mode0RenderLine; else if (fxOn && !windowOn && !(layerEnable & 0x8000)) renderLine = mode0RenderLineNoWindow; else renderLine = mode0RenderLineAll; break; case 1: if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx) renderLine = mode1RenderLine; else if (fxOn && !windowOn && !(layerEnable & 0x8000)) renderLine = mode1RenderLineNoWindow; else renderLine = mode1RenderLineAll; break; case 2: if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx) renderLine = mode2RenderLine; else if (fxOn && !windowOn && !(layerEnable & 0x8000)) renderLine = mode2RenderLineNoWindow; else renderLine = mode2RenderLineAll; break; case 3: if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx) renderLine = mode3RenderLine; else if (fxOn && !windowOn && !(layerEnable & 0x8000)) renderLine = mode3RenderLineNoWindow; else renderLine = mode3RenderLineAll; break; case 4: if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx) renderLine = mode4RenderLine; else if (fxOn && !windowOn && !(layerEnable & 0x8000)) renderLine = mode4RenderLineNoWindow; else renderLine = mode4RenderLineAll; break; case 5: if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx) renderLine = mode5RenderLine; else if (fxOn && !windowOn && !(layerEnable & 0x8000)) renderLine = mode5RenderLineNoWindow; else renderLine = mode5RenderLineAll; default: break; } } void CPUUpdateCPSR() { u32 CPSR = reg[16].I & 0x40; if (N_FLAG) CPSR |= 0x80000000; if (Z_FLAG) CPSR |= 0x40000000; if (C_FLAG) CPSR |= 0x20000000; if (V_FLAG) CPSR |= 0x10000000; if (!armState) CPSR |= 0x00000020; if (!armIrqEnable) CPSR |= 0x80; CPSR |= (armMode & 0x1F); reg[16].I = CPSR; } void CPUUpdateFlags(bool breakLoop) { u32 CPSR = reg[16].I; N_FLAG = (CPSR & 0x80000000) ? true : false; Z_FLAG = (CPSR & 0x40000000) ? true : false; C_FLAG = (CPSR & 0x20000000) ? true : false; V_FLAG = (CPSR & 0x10000000) ? true : false; armState = (CPSR & 0x20) ? false : true; armIrqEnable = (CPSR & 0x80) ? false : true; if (breakLoop) { if (armIrqEnable && (IF & IE) && (IME & 1)) cpuNextEvent = cpuTotalTicks; } } void CPUUpdateFlags() { CPUUpdateFlags(true); } #ifdef WORDS_BIGENDIAN static void CPUSwap(volatile u32 *a, volatile u32 *b) { volatile u32 c = *b; *b = *a; *a = c; } #else static void CPUSwap(u32 *a, u32 *b) { u32 c = *b; *b = *a; *a = c; } #endif void CPUSwitchMode(int mode, bool saveState, bool breakLoop) { // if(armMode == mode) // return; CPUUpdateCPSR(); switch (armMode) { case 0x10: case 0x1F: reg[R13_USR].I = reg[13].I; reg[R14_USR].I = reg[14].I; reg[17].I = reg[16].I; break; case 0x11: CPUSwap(&reg[R8_FIQ].I, &reg[8].I); CPUSwap(&reg[R9_FIQ].I, &reg[9].I); CPUSwap(&reg[R10_FIQ].I, &reg[10].I); CPUSwap(&reg[R11_FIQ].I, &reg[11].I); CPUSwap(&reg[R12_FIQ].I, &reg[12].I); reg[R13_FIQ].I = reg[13].I; reg[R14_FIQ].I = reg[14].I; reg[SPSR_FIQ].I = reg[17].I; break; case 0x12: reg[R13_IRQ].I = reg[13].I; reg[R14_IRQ].I = reg[14].I; reg[SPSR_IRQ].I = reg[17].I; break; case 0x13: reg[R13_SVC].I = reg[13].I; reg[R14_SVC].I = reg[14].I; reg[SPSR_SVC].I = reg[17].I; break; case 0x17: reg[R13_ABT].I = reg[13].I; reg[R14_ABT].I = reg[14].I; reg[SPSR_ABT].I = reg[17].I; break; case 0x1b: reg[R13_UND].I = reg[13].I; reg[R14_UND].I = reg[14].I; reg[SPSR_UND].I = reg[17].I; break; } u32 CPSR = reg[16].I; u32 SPSR = reg[17].I; switch (mode) { case 0x10: case 0x1F: reg[13].I = reg[R13_USR].I; reg[14].I = reg[R14_USR].I; reg[16].I = SPSR; break; case 0x11: CPUSwap(&reg[8].I, &reg[R8_FIQ].I); CPUSwap(&reg[9].I, &reg[R9_FIQ].I); CPUSwap(&reg[10].I, &reg[R10_FIQ].I); CPUSwap(&reg[11].I, &reg[R11_FIQ].I); CPUSwap(&reg[12].I, &reg[R12_FIQ].I); reg[13].I = reg[R13_FIQ].I; reg[14].I = reg[R14_FIQ].I; if (saveState) reg[17].I = CPSR; else reg[17].I = reg[SPSR_FIQ].I; break; case 0x12: reg[13].I = reg[R13_IRQ].I; reg[14].I = reg[R14_IRQ].I; reg[16].I = SPSR; if (saveState) reg[17].I = CPSR; else reg[17].I = reg[SPSR_IRQ].I; break; case 0x13: reg[13].I = reg[R13_SVC].I; reg[14].I = reg[R14_SVC].I; reg[16].I = SPSR; if (saveState) reg[17].I = CPSR; else reg[17].I = reg[SPSR_SVC].I; break; case 0x17: reg[13].I = reg[R13_ABT].I; reg[14].I = reg[R14_ABT].I; reg[16].I = SPSR; if (saveState) reg[17].I = CPSR; else reg[17].I = reg[SPSR_ABT].I; break; case 0x1b: reg[13].I = reg[R13_UND].I; reg[14].I = reg[R14_UND].I; reg[16].I = SPSR; if (saveState) reg[17].I = CPSR; else reg[17].I = reg[SPSR_UND].I; break; default: systemMessage(MSG_UNSUPPORTED_ARM_MODE, N_("Unsupported ARM mode %02x"), mode); break; } armMode = mode; CPUUpdateFlags(breakLoop); CPUUpdateCPSR(); } void CPUSwitchMode(int mode, bool saveState) { CPUSwitchMode(mode, saveState, true); } void CPUUndefinedException() { u32 PC = reg[15].I; bool savedArmState = armState; CPUSwitchMode(0x1b, true, false); reg[14].I = PC - (savedArmState ? 4 : 2); reg[15].I = 0x04; armState = true; armIrqEnable = false; armNextPC = 0x04; ARM_PREFETCH; reg[15].I += 4; } void CPUSoftwareInterrupt() { u32 PC = reg[15].I; bool savedArmState = armState; CPUSwitchMode(0x13, true, false); reg[14].I = PC - (savedArmState ? 4 : 2); reg[15].I = 0x08; armState = true; armIrqEnable = false; armNextPC = 0x08; ARM_PREFETCH; reg[15].I += 4; } void CPUSoftwareInterrupt(int comment) { static bool disableMessage = false; if (armState) comment >>= 16; #ifdef BKPT_SUPPORT if (comment == 0xff) { dbgOutput(NULL, reg[0].I); return; } #endif #ifdef PROFILING if (comment == 0xfe) { profStartup(reg[0].I, reg[1].I); return; } if (comment == 0xfd) { profControl(reg[0].I); return; } if (comment == 0xfc) { profCleanup(); return; } if (comment == 0xfb) { profCount(); return; } #endif if (comment == 0xfa) { agbPrintFlush(); return; } #ifdef SDL if (comment == 0xf9) { emulating = 0; cpuNextEvent = cpuTotalTicks; cpuBreakLoop = true; return; } #endif if (useBios) { #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_SWI) { log("SWI: %08x at %08x (0x%08x,0x%08x,0x%08x,VCOUNT = %2d)\n", comment, armState ? armNextPC - 4 : armNextPC - 2, reg[0].I, reg[1].I, reg[2].I, VCOUNT); } #endif CPUSoftwareInterrupt(); return; } // This would be correct, but it causes problems if uncommented // else { // biosProtected = 0xe3a02004; // } switch (comment) { case 0x00: BIOS_SoftReset(); ARM_PREFETCH; break; case 0x01: BIOS_RegisterRamReset(); break; case 0x02: #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_SWI) { log("Halt: (VCOUNT = %2d)\n", VCOUNT); } #endif holdState = true; holdType = -1; cpuNextEvent = cpuTotalTicks; break; case 0x03: #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_SWI) { log("Stop: (VCOUNT = %2d)\n", VCOUNT); } #endif holdState = true; holdType = -1; stopState = true; cpuNextEvent = cpuTotalTicks; break; case 0x04: #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_SWI) { log("IntrWait: 0x%08x,0x%08x (VCOUNT = %2d)\n", reg[0].I, reg[1].I, VCOUNT); } #endif CPUSoftwareInterrupt(); break; case 0x05: #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_SWI) { log("VBlankIntrWait: (VCOUNT = %2d)\n", VCOUNT); } #endif CPUSoftwareInterrupt(); break; case 0x06: CPUSoftwareInterrupt(); break; case 0x07: CPUSoftwareInterrupt(); break; case 0x08: BIOS_Sqrt(); break; case 0x09: BIOS_ArcTan(); break; case 0x0A: BIOS_ArcTan2(); break; case 0x0B: { int len = (reg[2].I & 0x1FFFFF) >> 1; if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + len) & 0xe000000) == 0)) { if ((reg[2].I >> 24) & 1) { if ((reg[2].I >> 26) & 1) SWITicks = (7 + memoryWait32[(reg[1].I >> 24) & 0xF]) * (len >> 1); else SWITicks = (8 + memoryWait[(reg[1].I >> 24) & 0xF]) * (len); } else { if ((reg[2].I >> 26) & 1) SWITicks = (10 + memoryWait32[(reg[0].I >> 24) & 0xF] + memoryWait32[(reg[1].I >> 24) & 0xF]) * (len >> 1); else SWITicks = (11 + memoryWait[(reg[0].I >> 24) & 0xF] + memoryWait[(reg[1].I >> 24) & 0xF]) * len; } } } BIOS_CpuSet(); break; case 0x0C: { int len = (reg[2].I & 0x1FFFFF) >> 5; if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + len) & 0xe000000) == 0)) { if ((reg[2].I >> 24) & 1) SWITicks = (6 + memoryWait32[(reg[1].I >> 24) & 0xF] + 7 * (memoryWaitSeq32[(reg[1].I >> 24) & 0xF] + 1)) * len; else SWITicks = (9 + memoryWait32[(reg[0].I >> 24) & 0xF] + memoryWait32[(reg[1].I >> 24) & 0xF] + 7 * (memoryWaitSeq32[(reg[0].I >> 24) & 0xF] + memoryWaitSeq32[(reg[1].I >> 24) & 0xF] + 2)) * len; } } BIOS_CpuFastSet(); break; case 0x0D: BIOS_GetBiosChecksum(); break; case 0x0E: BIOS_BgAffineSet(); break; case 0x0F: BIOS_ObjAffineSet(); break; case 0x10: { int len = CPUReadHalfWord(reg[2].I); if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + len) & 0xe000000) == 0)) SWITicks = (32 + memoryWait[(reg[0].I >> 24) & 0xF]) * len; } BIOS_BitUnPack(); break; case 0x11: { u32 len = CPUReadMemory(reg[0].I) >> 8; if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) SWITicks = (9 + memoryWait[(reg[1].I >> 24) & 0xF]) * len; } BIOS_LZ77UnCompWram(); break; case 0x12: { u32 len = CPUReadMemory(reg[0].I) >> 8; if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) SWITicks = (19 + memoryWait[(reg[1].I >> 24) & 0xF]) * len; } BIOS_LZ77UnCompVram(); break; case 0x13: { u32 len = CPUReadMemory(reg[0].I) >> 8; if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) SWITicks = (29 + (memoryWait[(reg[0].I >> 24) & 0xF] << 1)) * len; } BIOS_HuffUnComp(); break; case 0x14: { u32 len = CPUReadMemory(reg[0].I) >> 8; if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) SWITicks = (11 + memoryWait[(reg[0].I >> 24) & 0xF] + memoryWait[(reg[1].I >> 24) & 0xF]) * len; } BIOS_RLUnCompWram(); break; case 0x15: { u32 len = CPUReadMemory(reg[0].I) >> 9; if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) SWITicks = (34 + (memoryWait[(reg[0].I >> 24) & 0xF] << 1) + memoryWait[(reg[1].I >> 24) & 0xF]) * len; } BIOS_RLUnCompVram(); break; case 0x16: { u32 len = CPUReadMemory(reg[0].I) >> 8; if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) SWITicks = (13 + memoryWait[(reg[0].I >> 24) & 0xF] + memoryWait[(reg[1].I >> 24) & 0xF]) * len; } BIOS_Diff8bitUnFilterWram(); break; case 0x17: { u32 len = CPUReadMemory(reg[0].I) >> 9; if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) SWITicks = (39 + (memoryWait[(reg[0].I >> 24) & 0xF] << 1) + memoryWait[(reg[1].I >> 24) & 0xF]) * len; } BIOS_Diff8bitUnFilterVram(); break; case 0x18: { u32 len = CPUReadMemory(reg[0].I) >> 9; if (!(((reg[0].I & 0xe000000) == 0) || ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) SWITicks = (13 + memoryWait[(reg[0].I >> 24) & 0xF] + memoryWait[(reg[1].I >> 24) & 0xF]) * len; } BIOS_Diff16bitUnFilter(); break; case 0x19: #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_SWI) { log("SoundBiasSet: 0x%08x (VCOUNT = %2d)\n", reg[0].I, VCOUNT); } #endif if (reg[0].I) systemSoundPause(); else systemSoundResume(); break; case 0x1F: BIOS_MidiKey2Freq(); break; case 0x2A: BIOS_SndDriverJmpTableCopy(); // let it go, because we don't really emulate this function // FIXME (?) default: #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_SWI) { log("SWI: %08x at %08x (0x%08x,0x%08x,0x%08x,VCOUNT = %2d)\n", comment, armState ? armNextPC - 4 : armNextPC - 2, reg[0].I, reg[1].I, reg[2].I, VCOUNT); } #endif if (!disableMessage) { systemMessage(MSG_UNSUPPORTED_BIOS_FUNCTION, N_("Unsupported BIOS function %02x called from %08x. A BIOS file is needed in order to get correct behaviour."), comment, armMode ? armNextPC - 4 : armNextPC - 2); disableMessage = true; } break; } } void CPUCompareVCOUNT() { if (VCOUNT == (DISPSTAT >> 8)) { DISPSTAT |= 4; UPDATE_REG(0x04, DISPSTAT); if (DISPSTAT & 0x20) { IF |= 4; UPDATE_REG(0x202, IF); } } else { DISPSTAT &= 0xFFFB; UPDATE_REG(0x4, DISPSTAT); } if (layerEnableDelay > 0) { --layerEnableDelay; if (layerEnableDelay == 1) layerEnable = layerSettings & DISPCNT; } } static void doDMA(u32 &s, u32 &d, u32 si, u32 di, u32 c, int transfer32) { int sm = s >> 24; int dm = d >> 24; int sw = 0; int dw = 0; int sc = c; cpuDmaCount = c; // This is done to get the correct waitstates. if (sm > 15) sm = 15; if (dm > 15) dm = 15; //if ((sm>=0x05) && (sm<=0x07) || (dm>=0x05) && (dm <=0x07)) // blank = (((DISPSTAT | ((DISPSTAT>>1)&1))==1) ? true : false); if (transfer32) { s &= 0xFFFFFFFC; if (s < 0x02000000 && (reg[15].I >> 24)) { while (c != 0) { CPUWriteMemory(d, 0); d += di; c--; } } else { while (c != 0) { cpuDmaLast = CPUReadMemory(s); CPUWriteMemory(d, cpuDmaLast); d += di; s += si; c--; } } } else { s &= 0xFFFFFFFE; si = (int)si >> 1; di = (int)di >> 1; if (s < 0x02000000 && (reg[15].I >> 24)) { while (c != 0) { CPUWriteHalfWord(d, 0); d += di; c--; } } else { while (c != 0) { cpuDmaLast = CPUReadHalfWord(s); CPUWriteHalfWord(d, cpuDmaLast); cpuDmaLast |= (cpuDmaLast << 16); d += di; s += si; c--; } } } cpuDmaCount = 0; int totalTicks = 0; if (transfer32) { sw = 1 + memoryWaitSeq32[sm & 15]; dw = 1 + memoryWaitSeq32[dm & 15]; totalTicks = (sw + dw) * (sc - 1) + 6 + memoryWait32[sm & 15] + memoryWaitSeq32[dm & 15]; } else { sw = 1 + memoryWaitSeq[sm & 15]; dw = 1 + memoryWaitSeq[dm & 15]; totalTicks = (sw + dw) * (sc - 1) + 6 + memoryWait[sm & 15] + memoryWaitSeq[dm & 15]; } cpuDmaTicksToUpdate += totalTicks; } void CPUCheckDMA(int reason, int dmamask) { // DMA 0 if ((DM0CNT_H & 0x8000) && (dmamask & 1)) { if (((DM0CNT_H >> 12) & 3) == reason) { u32 sourceIncrement = 4; u32 destIncrement = 4; switch ((DM0CNT_H >> 7) & 3) { case 0: break; case 1: sourceIncrement = (u32) - 4; break; case 2: sourceIncrement = 0; break; } switch ((DM0CNT_H >> 5) & 3) { case 0: break; case 1: destIncrement = (u32) - 4; break; case 2: destIncrement = 0; break; } #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_DMA0) { int count = (DM0CNT_L ? DM0CNT_L : 0x4000) << 1; if (DM0CNT_H & 0x0400) count <<= 1; log("DMA0: s=%08x d=%08x c=%04x count=%08x\n", dma0Source, dma0Dest, DM0CNT_H, count); } #endif doDMA(dma0Source, dma0Dest, sourceIncrement, destIncrement, DM0CNT_L ? DM0CNT_L : 0x4000, DM0CNT_H & 0x0400); cpuDmaHack = true; if (DM0CNT_H & 0x4000) { IF |= 0x0100; UPDATE_REG(0x202, IF); cpuNextEvent = cpuTotalTicks; } if (((DM0CNT_H >> 5) & 3) == 3) { dma0Dest = DM0DAD_L | (DM0DAD_H << 16); } if (!(DM0CNT_H & 0x0200) || (reason == 0)) { DM0CNT_H &= 0x7FFF; UPDATE_REG(0xBA, DM0CNT_H); } } } // DMA 1 if ((DM1CNT_H & 0x8000) && (dmamask & 2)) { if (((DM1CNT_H >> 12) & 3) == reason) { u32 sourceIncrement = 4; u32 destIncrement = 4; switch ((DM1CNT_H >> 7) & 3) { case 0: break; case 1: sourceIncrement = (u32) - 4; break; case 2: sourceIncrement = 0; break; } switch ((DM1CNT_H >> 5) & 3) { case 0: break; case 1: destIncrement = (u32) - 4; break; case 2: destIncrement = 0; break; } if (reason == 3) { #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_DMA1) { log("DMA1: s=%08x d=%08x c=%04x count=%08x\n", dma1Source, dma1Dest, DM1CNT_H, 16); } #endif doDMA(dma1Source, dma1Dest, sourceIncrement, 0, 4, 0x0400); } else { #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_DMA1) { int count = (DM1CNT_L ? DM1CNT_L : 0x4000) << 1; if (DM1CNT_H & 0x0400) count <<= 1; log("DMA1: s=%08x d=%08x c=%04x count=%08x\n", dma1Source, dma1Dest, DM1CNT_H, count); } #endif doDMA(dma1Source, dma1Dest, sourceIncrement, destIncrement, DM1CNT_L ? DM1CNT_L : 0x4000, DM1CNT_H & 0x0400); } cpuDmaHack = true; if (DM1CNT_H & 0x4000) { IF |= 0x0200; UPDATE_REG(0x202, IF); cpuNextEvent = cpuTotalTicks; } if (((DM1CNT_H >> 5) & 3) == 3) { dma1Dest = DM1DAD_L | (DM1DAD_H << 16); } if (!(DM1CNT_H & 0x0200) || (reason == 0)) { DM1CNT_H &= 0x7FFF; UPDATE_REG(0xC6, DM1CNT_H); } } } // DMA 2 if ((DM2CNT_H & 0x8000) && (dmamask & 4)) { if (((DM2CNT_H >> 12) & 3) == reason) { u32 sourceIncrement = 4; u32 destIncrement = 4; switch ((DM2CNT_H >> 7) & 3) { case 0: break; case 1: sourceIncrement = (u32) - 4; break; case 2: sourceIncrement = 0; break; } switch ((DM2CNT_H >> 5) & 3) { case 0: break; case 1: destIncrement = (u32) - 4; break; case 2: destIncrement = 0; break; } if (reason == 3) { #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_DMA2) { int count = (4) << 2; log("DMA2: s=%08x d=%08x c=%04x count=%08x\n", dma2Source, dma2Dest, DM2CNT_H, count); } #endif doDMA(dma2Source, dma2Dest, sourceIncrement, 0, 4, 0x0400); } else { #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_DMA2) { int count = (DM2CNT_L ? DM2CNT_L : 0x4000) << 1; if (DM2CNT_H & 0x0400) count <<= 1; log("DMA2: s=%08x d=%08x c=%04x count=%08x\n", dma2Source, dma2Dest, DM2CNT_H, count); } #endif doDMA(dma2Source, dma2Dest, sourceIncrement, destIncrement, DM2CNT_L ? DM2CNT_L : 0x4000, DM2CNT_H & 0x0400); } cpuDmaHack = true; if (DM2CNT_H & 0x4000) { IF |= 0x0400; UPDATE_REG(0x202, IF); cpuNextEvent = cpuTotalTicks; } if (((DM2CNT_H >> 5) & 3) == 3) { dma2Dest = DM2DAD_L | (DM2DAD_H << 16); } if (!(DM2CNT_H & 0x0200) || (reason == 0)) { DM2CNT_H &= 0x7FFF; UPDATE_REG(0xD2, DM2CNT_H); } } } // DMA 3 if ((DM3CNT_H & 0x8000) && (dmamask & 8)) { if (((DM3CNT_H >> 12) & 3) == reason) { u32 sourceIncrement = 4; u32 destIncrement = 4; switch ((DM3CNT_H >> 7) & 3) { case 0: break; case 1: sourceIncrement = (u32) - 4; break; case 2: sourceIncrement = 0; break; } switch ((DM3CNT_H >> 5) & 3) { case 0: break; case 1: destIncrement = (u32) - 4; break; case 2: destIncrement = 0; break; } #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_DMA3) { int count = (DM3CNT_L ? DM3CNT_L : 0x10000) << 1; if (DM3CNT_H & 0x0400) count <<= 1; log("DMA3: s=%08x d=%08x c=%04x count=%08x\n", dma3Source, dma3Dest, DM3CNT_H, count); } #endif doDMA(dma3Source, dma3Dest, sourceIncrement, destIncrement, DM3CNT_L ? DM3CNT_L : 0x10000, DM3CNT_H & 0x0400); if (DM3CNT_H & 0x4000) { IF |= 0x0800; UPDATE_REG(0x202, IF); cpuNextEvent = cpuTotalTicks; } if (((DM3CNT_H >> 5) & 3) == 3) { dma3Dest = DM3DAD_L | (DM3DAD_H << 16); } if (!(DM3CNT_H & 0x0200) || (reason == 0)) { DM3CNT_H &= 0x7FFF; UPDATE_REG(0xDE, DM3CNT_H); } } } } void CPUUpdateRegister(u32 address, u16 value) { switch (address) { case 0x00: { if ((value & 7) > 5) { // display modes above 0-5 are prohibited DISPCNT = (value & 7); } bool change = (0 != ((DISPCNT ^ value) & 0x80)); bool changeBG = (0 != ((DISPCNT ^ value) & 0x0F00)); u16 changeBGon = ((~DISPCNT) & value) & 0x0F00; // these layers are being activated DISPCNT = (value & 0xFFF7); // bit 3 can only be accessed by the BIOS to enable GBC mode UPDATE_REG(0x00, DISPCNT); if (changeBGon) { layerEnableDelay = 4; layerEnable = layerSettings & value & (~changeBGon); } else { layerEnable = layerSettings & value; // CPUUpdateTicks(); // what does this do? } windowOn = (layerEnable & 0x6000) ? true : false; if (change && !((value & 0x80))) { if (!(DISPSTAT & 1)) { lcdTicks = 1008; // VCOUNT = 0; // UPDATE_REG(0x06, VCOUNT); DISPSTAT &= 0xFFFC; UPDATE_REG(0x04, DISPSTAT); CPUCompareVCOUNT(); } // (*renderLine)(); } CPUUpdateRender(); // we only care about changes in BG0-BG3 if (changeBG) { CPUUpdateRenderBuffers(false); } break; } case 0x04: DISPSTAT = (value & 0xFF38) | (DISPSTAT & 7); UPDATE_REG(0x04, DISPSTAT); break; case 0x06: // not writable break; case 0x08: BG0CNT = (value & 0xDFCF); UPDATE_REG(0x08, BG0CNT); break; case 0x0A: BG1CNT = (value & 0xDFCF); UPDATE_REG(0x0A, BG1CNT); break; case 0x0C: BG2CNT = (value & 0xFFCF); UPDATE_REG(0x0C, BG2CNT); break; case 0x0E: BG3CNT = (value & 0xFFCF); UPDATE_REG(0x0E, BG3CNT); break; case 0x10: BG0HOFS = value & 511; UPDATE_REG(0x10, BG0HOFS); break; case 0x12: BG0VOFS = value & 511; UPDATE_REG(0x12, BG0VOFS); break; case 0x14: BG1HOFS = value & 511; UPDATE_REG(0x14, BG1HOFS); break; case 0x16: BG1VOFS = value & 511; UPDATE_REG(0x16, BG1VOFS); break; case 0x18: BG2HOFS = value & 511; UPDATE_REG(0x18, BG2HOFS); break; case 0x1A: BG2VOFS = value & 511; UPDATE_REG(0x1A, BG2VOFS); break; case 0x1C: BG3HOFS = value & 511; UPDATE_REG(0x1C, BG3HOFS); break; case 0x1E: BG3VOFS = value & 511; UPDATE_REG(0x1E, BG3VOFS); break; case 0x20: BG2PA = value; UPDATE_REG(0x20, BG2PA); break; case 0x22: BG2PB = value; UPDATE_REG(0x22, BG2PB); break; case 0x24: BG2PC = value; UPDATE_REG(0x24, BG2PC); break; case 0x26: BG2PD = value; UPDATE_REG(0x26, BG2PD); break; case 0x28: BG2X_L = value; UPDATE_REG(0x28, BG2X_L); gfxBG2Changed |= 1; break; case 0x2A: BG2X_H = (value & 0xFFF); UPDATE_REG(0x2A, BG2X_H); gfxBG2Changed |= 1; break; case 0x2C: BG2Y_L = value; UPDATE_REG(0x2C, BG2Y_L); gfxBG2Changed |= 2; break; case 0x2E: BG2Y_H = value & 0xFFF; UPDATE_REG(0x2E, BG2Y_H); gfxBG2Changed |= 2; break; case 0x30: BG3PA = value; UPDATE_REG(0x30, BG3PA); break; case 0x32: BG3PB = value; UPDATE_REG(0x32, BG3PB); break; case 0x34: BG3PC = value; UPDATE_REG(0x34, BG3PC); break; case 0x36: BG3PD = value; UPDATE_REG(0x36, BG3PD); break; case 0x38: BG3X_L = value; UPDATE_REG(0x38, BG3X_L); gfxBG3Changed |= 1; break; case 0x3A: BG3X_H = value & 0xFFF; UPDATE_REG(0x3A, BG3X_H); gfxBG3Changed |= 1; break; case 0x3C: BG3Y_L = value; UPDATE_REG(0x3C, BG3Y_L); gfxBG3Changed |= 2; break; case 0x3E: BG3Y_H = value & 0xFFF; UPDATE_REG(0x3E, BG3Y_H); gfxBG3Changed |= 2; break; case 0x40: WIN0H = value; UPDATE_REG(0x40, WIN0H); CPUUpdateWindow0(); break; case 0x42: WIN1H = value; UPDATE_REG(0x42, WIN1H); CPUUpdateWindow1(); break; case 0x44: WIN0V = value; UPDATE_REG(0x44, WIN0V); break; case 0x46: WIN1V = value; UPDATE_REG(0x46, WIN1V); break; case 0x48: WININ = value & 0x3F3F; UPDATE_REG(0x48, WININ); break; case 0x4A: WINOUT = value & 0x3F3F; UPDATE_REG(0x4A, WINOUT); break; case 0x4C: MOSAIC = value; UPDATE_REG(0x4C, MOSAIC); break; case 0x50: BLDMOD = value & 0x3FFF; UPDATE_REG(0x50, BLDMOD); fxOn = ((BLDMOD >> 6) & 3) != 0; CPUUpdateRender(); break; case 0x52: COLEV = value & 0x1F1F; UPDATE_REG(0x52, COLEV); break; case 0x54: COLY = value & 0x1F; UPDATE_REG(0x54, COLY); break; case 0x60: case 0x62: case 0x64: case 0x68: case 0x6c: case 0x70: case 0x72: case 0x74: case 0x78: case 0x7c: case 0x80: case 0x84: soundEvent(address & 0xFF, (u8)(value & 0xFF)); soundEvent((address & 0xFF) + 1, (u8)(value >> 8)); break; case 0x82: case 0x88: case 0xa0: case 0xa2: case 0xa4: case 0xa6: case 0x90: case 0x92: case 0x94: case 0x96: case 0x98: case 0x9a: case 0x9c: case 0x9e: soundEvent(address & 0xFF, value); break; case 0xB0: DM0SAD_L = value; UPDATE_REG(0xB0, DM0SAD_L); break; case 0xB2: DM0SAD_H = value & 0x07FF; UPDATE_REG(0xB2, DM0SAD_H); break; case 0xB4: DM0DAD_L = value; UPDATE_REG(0xB4, DM0DAD_L); break; case 0xB6: DM0DAD_H = value & 0x07FF; UPDATE_REG(0xB6, DM0DAD_H); break; case 0xB8: DM0CNT_L = value & 0x3FFF; UPDATE_REG(0xB8, 0); break; case 0xBA: { bool start = ((DM0CNT_H ^ value) & 0x8000) ? true : false; value &= 0xF7E0; DM0CNT_H = value; UPDATE_REG(0xBA, DM0CNT_H); if (start && (value & 0x8000)) { dma0Source = DM0SAD_L | (DM0SAD_H << 16); dma0Dest = DM0DAD_L | (DM0DAD_H << 16); CPUCheckDMA(0, 1); } break; } case 0xBC: DM1SAD_L = value; UPDATE_REG(0xBC, DM1SAD_L); break; case 0xBE: DM1SAD_H = value & 0x0FFF; UPDATE_REG(0xBE, DM1SAD_H); break; case 0xC0: DM1DAD_L = value; UPDATE_REG(0xC0, DM1DAD_L); break; case 0xC2: DM1DAD_H = value & 0x07FF; UPDATE_REG(0xC2, DM1DAD_H); break; case 0xC4: DM1CNT_L = value & 0x3FFF; UPDATE_REG(0xC4, 0); break; case 0xC6: { bool start = ((DM1CNT_H ^ value) & 0x8000) ? true : false; value &= 0xF7E0; DM1CNT_H = value; UPDATE_REG(0xC6, DM1CNT_H); if (start && (value & 0x8000)) { dma1Source = DM1SAD_L | (DM1SAD_H << 16); dma1Dest = DM1DAD_L | (DM1DAD_H << 16); CPUCheckDMA(0, 2); } break; } case 0xC8: DM2SAD_L = value; UPDATE_REG(0xC8, DM2SAD_L); break; case 0xCA: DM2SAD_H = value & 0x0FFF; UPDATE_REG(0xCA, DM2SAD_H); break; case 0xCC: DM2DAD_L = value; UPDATE_REG(0xCC, DM2DAD_L); break; case 0xCE: DM2DAD_H = value & 0x07FF; UPDATE_REG(0xCE, DM2DAD_H); break; case 0xD0: DM2CNT_L = value & 0x3FFF; UPDATE_REG(0xD0, 0); break; case 0xD2: { bool start = ((DM2CNT_H ^ value) & 0x8000) ? true : false; value &= 0xF7E0; DM2CNT_H = value; UPDATE_REG(0xD2, DM2CNT_H); if (start && (value & 0x8000)) { dma2Source = DM2SAD_L | (DM2SAD_H << 16); dma2Dest = DM2DAD_L | (DM2DAD_H << 16); CPUCheckDMA(0, 4); } break; } case 0xD4: DM3SAD_L = value; UPDATE_REG(0xD4, DM3SAD_L); break; case 0xD6: DM3SAD_H = value & 0x0FFF; UPDATE_REG(0xD6, DM3SAD_H); break; case 0xD8: DM3DAD_L = value; UPDATE_REG(0xD8, DM3DAD_L); break; case 0xDA: DM3DAD_H = value & 0x0FFF; UPDATE_REG(0xDA, DM3DAD_H); break; case 0xDC: DM3CNT_L = value; UPDATE_REG(0xDC, 0); break; case 0xDE: { bool start = ((DM3CNT_H ^ value) & 0x8000) ? true : false; value &= 0xFFE0; DM3CNT_H = value; UPDATE_REG(0xDE, DM3CNT_H); if (start && (value & 0x8000)) { dma3Source = DM3SAD_L | (DM3SAD_H << 16); dma3Dest = DM3DAD_L | (DM3DAD_H << 16); CPUCheckDMA(0, 8); } break; } case 0x100: timer0Reload = value; interp_rate(); break; case 0x102: timer0Value = value; timerOnOffDelay |= 1; cpuNextEvent = cpuTotalTicks; break; case 0x104: timer1Reload = value; interp_rate(); break; case 0x106: timer1Value = value; timerOnOffDelay |= 2; cpuNextEvent = cpuTotalTicks; break; case 0x108: timer2Reload = value; break; case 0x10A: timer2Value = value; timerOnOffDelay |= 4; cpuNextEvent = cpuTotalTicks; break; case 0x10C: timer3Reload = value; break; case 0x10E: timer3Value = value; timerOnOffDelay |= 8; cpuNextEvent = cpuTotalTicks; break; case 0x128: if (value & 0x80) { value &= 0xff7f; if (value & 1 && (value & 0x4000)) { UPDATE_REG(0x12a, 0xFF); IF |= 0x80; UPDATE_REG(0x202, IF); value &= 0x7f7f; } } UPDATE_REG(0x128, value); break; case 0x130: P1 |= (value & 0x3FF); UPDATE_REG(0x130, P1); break; case 0x132: UPDATE_REG(0x132, value & 0xC3FF); break; case 0x200: IE = value & 0x3FFF; UPDATE_REG(0x200, IE); if ((IME & 1) && (IF & IE) && armIrqEnable) cpuNextEvent = cpuTotalTicks; break; case 0x202: IF ^= (value & IF); UPDATE_REG(0x202, IF); break; case 0x204: { memoryWait[0x0e] = memoryWaitSeq[0x0e] = gamepakRamWaitState[value & 3]; if (!speedHack) { memoryWait[0x08] = memoryWait[0x09] = gamepakWaitState[(value >> 2) & 3]; memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = gamepakWaitState0[(value >> 4) & 1]; memoryWait[0x0a] = memoryWait[0x0b] = gamepakWaitState[(value >> 5) & 3]; memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = gamepakWaitState1[(value >> 7) & 1]; memoryWait[0x0c] = memoryWait[0x0d] = gamepakWaitState[(value >> 8) & 3]; memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = gamepakWaitState2[(value >> 10) & 1]; } else { memoryWait[0x08] = memoryWait[0x09] = 3; memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = 1; memoryWait[0x0a] = memoryWait[0x0b] = 3; memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = 1; memoryWait[0x0c] = memoryWait[0x0d] = 3; memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = 1; } for (int i = 8; i < 15; i++) { memoryWait32[i] = memoryWait[i] + memoryWaitSeq[i] + 1; memoryWaitSeq32[i] = memoryWaitSeq[i] * 2 + 1; } if ((value & 0x4000) == 0x4000) { busPrefetchEnable = true; busPrefetch = false; busPrefetchCount = 0; } else { busPrefetchEnable = false; busPrefetch = false; busPrefetchCount = 0; } UPDATE_REG(0x204, value & 0x7FFF); } break; case 0x208: IME = value & 1; UPDATE_REG(0x208, IME); if ((IME & 1) && (IF & IE) && armIrqEnable) cpuNextEvent = cpuTotalTicks; break; case 0x300: if (value != 0) value &= 0xFFFE; UPDATE_REG(0x300, value); break; default: UPDATE_REG(address & 0x3FE, value); break; } } void applyTimer() { if (timerOnOffDelay & 1) { timer0ClockReload = TIMER_TICKS[timer0Value & 3]; if (!timer0On && (timer0Value & 0x80)) { // reload the counter TM0D = timer0Reload; timer0Ticks = (0x10000 - TM0D) << timer0ClockReload; UPDATE_REG(0x100, TM0D); } timer0On = timer0Value & 0x80 ? true : false; TM0CNT = timer0Value & 0xC7; interp_rate(); UPDATE_REG(0x102, TM0CNT); // CPUUpdateTicks(); } if (timerOnOffDelay & 2) { timer1ClockReload = TIMER_TICKS[timer1Value & 3]; if (!timer1On && (timer1Value & 0x80)) { // reload the counter TM1D = timer1Reload; timer1Ticks = (0x10000 - TM1D) << timer1ClockReload; UPDATE_REG(0x104, TM1D); } timer1On = timer1Value & 0x80 ? true : false; TM1CNT = timer1Value & 0xC7; interp_rate(); UPDATE_REG(0x106, TM1CNT); } if (timerOnOffDelay & 4) { timer2ClockReload = TIMER_TICKS[timer2Value & 3]; if (!timer2On && (timer2Value & 0x80)) { // reload the counter TM2D = timer2Reload; timer2Ticks = (0x10000 - TM2D) << timer2ClockReload; UPDATE_REG(0x108, TM2D); } timer2On = timer2Value & 0x80 ? true : false; TM2CNT = timer2Value & 0xC7; UPDATE_REG(0x10A, TM2CNT); } if (timerOnOffDelay & 8) { timer3ClockReload = TIMER_TICKS[timer3Value & 3]; if (!timer3On && (timer3Value & 0x80)) { // reload the counter TM3D = timer3Reload; timer3Ticks = (0x10000 - TM3D) << timer3ClockReload; UPDATE_REG(0x10C, TM3D); } timer3On = timer3Value & 0x80 ? true : false; TM3CNT = timer3Value & 0xC7; UPDATE_REG(0x10E, TM3CNT); } cpuNextEvent = CPUUpdateTicks(); timerOnOffDelay = 0; } void CPULoadInternalBios() { // load internal BIOS #ifdef WORDS_BIGENDIAN for (size_t i = 0; i < sizeof(myROM) / 4; ++i) { WRITE32LE(&bios[i], myROM[i]); } #else memcpy(bios, myROM, sizeof(myROM)); #endif } void CPUInit() { biosProtected[0] = 0x00; biosProtected[1] = 0xf0; biosProtected[2] = 0x29; biosProtected[3] = 0xe1; int i = 0; for (i = 0; i < 256; i++) { int cpuBitSetCount = 0; int j; for (j = 0; j < 8; j++) if (i & (1 << j)) cpuBitSetCount++; cpuBitsSet[i] = cpuBitSetCount; for (j = 0; j < 8; j++) if (i & (1 << j)) break; cpuLowestBitSet[i] = j; } for (i = 0; i < 0x400; i++) ioReadable[i] = true; for (i = 0x10; i < 0x48; i++) ioReadable[i] = false; for (i = 0x4c; i < 0x50; i++) ioReadable[i] = false; for (i = 0x54; i < 0x60; i++) ioReadable[i] = false; for (i = 0x8c; i < 0x90; i++) ioReadable[i] = false; for (i = 0xa0; i < 0xb8; i++) ioReadable[i] = false; for (i = 0xbc; i < 0xc4; i++) ioReadable[i] = false; for (i = 0xc8; i < 0xd0; i++) ioReadable[i] = false; for (i = 0xd4; i < 0xdc; i++) ioReadable[i] = false; for (i = 0xe0; i < 0x100; i++) ioReadable[i] = false; for (i = 0x110; i < 0x120; i++) ioReadable[i] = false; for (i = 0x12c; i < 0x130; i++) ioReadable[i] = false; for (i = 0x138; i < 0x140; i++) ioReadable[i] = false; for (i = 0x144; i < 0x150; i++) ioReadable[i] = false; for (i = 0x15c; i < 0x200; i++) ioReadable[i] = false; for (i = 0x20c; i < 0x300; i++) ioReadable[i] = false; for (i = 0x304; i < 0x400; i++) ioReadable[i] = false; if (romSize < 0x1fe2000) { *((u16 *)&rom[0x1fe209c]) = 0xdffa; // SWI 0xFA *((u16 *)&rom[0x1fe209e]) = 0x4770; // BX LR } else { agbPrintEnable(false); } gbaSaveType = 0; eepromInUse = 0; saveType = 0; } void CPUReset() { systemReset(); if (gbaSaveType == 0) { if (eepromInUse) gbaSaveType = 3; else switch (saveType) { case 1: gbaSaveType = 1; break; case 2: gbaSaveType = 2; break; } } // clean picture memset(pix, 0, 4 * 241 * 162); // clean registers memset(&reg[0], 0, sizeof(reg)); // clean OAM memset(oam, 0, 0x400); // clean palette memset(paletteRAM, 0, 0x400); // clean vram memset(vram, 0, 0x20000); // clean io memory memset(ioMem, 0, 0x400); DISPCNT = 0x0080; DISPSTAT = 0x0000; VCOUNT = (useBios && !skipBios) ? 0 : 0x007E; BG0CNT = 0x0000; BG1CNT = 0x0000; BG2CNT = 0x0000; BG3CNT = 0x0000; BG0HOFS = 0x0000; BG0VOFS = 0x0000; BG1HOFS = 0x0000; BG1VOFS = 0x0000; BG2HOFS = 0x0000; BG2VOFS = 0x0000; BG3HOFS = 0x0000; BG3VOFS = 0x0000; BG2PA = 0x0100; BG2PB = 0x0000; BG2PC = 0x0000; BG2PD = 0x0100; BG2X_L = 0x0000; BG2X_H = 0x0000; BG2Y_L = 0x0000; BG2Y_H = 0x0000; BG3PA = 0x0100; BG3PB = 0x0000; BG3PC = 0x0000; BG3PD = 0x0100; BG3X_L = 0x0000; BG3X_H = 0x0000; BG3Y_L = 0x0000; BG3Y_H = 0x0000; WIN0H = 0x0000; WIN1H = 0x0000; WIN0V = 0x0000; WIN1V = 0x0000; WININ = 0x0000; WINOUT = 0x0000; MOSAIC = 0x0000; BLDMOD = 0x0000; COLEV = 0x0000; COLY = 0x0000; DM0SAD_L = 0x0000; DM0SAD_H = 0x0000; DM0DAD_L = 0x0000; DM0DAD_H = 0x0000; DM0CNT_L = 0x0000; DM0CNT_H = 0x0000; DM1SAD_L = 0x0000; DM1SAD_H = 0x0000; DM1DAD_L = 0x0000; DM1DAD_H = 0x0000; DM1CNT_L = 0x0000; DM1CNT_H = 0x0000; DM2SAD_L = 0x0000; DM2SAD_H = 0x0000; DM2DAD_L = 0x0000; DM2DAD_H = 0x0000; DM2CNT_L = 0x0000; DM2CNT_H = 0x0000; DM3SAD_L = 0x0000; DM3SAD_H = 0x0000; DM3DAD_L = 0x0000; DM3DAD_H = 0x0000; DM3CNT_L = 0x0000; DM3CNT_H = 0x0000; TM0D = 0x0000; TM0CNT = 0x0000; TM1D = 0x0000; TM1CNT = 0x0000; TM2D = 0x0000; TM2CNT = 0x0000; TM3D = 0x0000; TM3CNT = 0x0000; P1 = 0x03FF; IE = 0x0000; IF = 0x0000; IME = 0x0000; armMode = 0x1F; armState = true; if (cpuIsMultiBoot) { reg[13].I = 0x03007F00; reg[15].I = 0x02000000; reg[16].I = 0x00000000; reg[R13_IRQ].I = 0x03007FA0; reg[R13_SVC].I = 0x03007FE0; armIrqEnable = true; } else { if (useBios && !skipBios) { reg[15].I = 0x00000000; armMode = 0x13; armIrqEnable = false; } else { reg[13].I = 0x03007F00; reg[15].I = 0x08000000; reg[16].I = 0x00000000; reg[R13_IRQ].I = 0x03007FA0; reg[R13_SVC].I = 0x03007FE0; armIrqEnable = true; } } C_FLAG = V_FLAG = N_FLAG = Z_FLAG = false; UPDATE_REG(0x00, DISPCNT); UPDATE_REG(0x06, VCOUNT); UPDATE_REG(0x20, BG2PA); UPDATE_REG(0x26, BG2PD); UPDATE_REG(0x30, BG3PA); UPDATE_REG(0x36, BG3PD); UPDATE_REG(0x130, P1); UPDATE_REG(0x88, 0x200); // disable FIQ reg[16].I |= 0x40; CPUUpdateCPSR(); armNextPC = reg[15].I; reg[15].I += 4; // reset internal state intState = false; stopState = false; holdState = false; holdType = 0; biosProtected[0] = 0x00; biosProtected[1] = 0xf0; biosProtected[2] = 0x29; biosProtected[3] = 0xe1; lcdTicks = (useBios && !skipBios) ? 1008 : 208; timer0On = false; timer0Ticks = 0; timer0Reload = 0; timer0ClockReload = 0; timer1On = false; timer1Ticks = 0; timer1Reload = 0; timer1ClockReload = 0; timer2On = false; timer2Ticks = 0; timer2Reload = 0; timer2ClockReload = 0; timer3On = false; timer3Ticks = 0; timer3Reload = 0; timer3ClockReload = 0; dma0Source = 0; dma0Dest = 0; dma1Source = 0; dma1Dest = 0; dma2Source = 0; dma2Dest = 0; dma3Source = 0; dma3Dest = 0; cpuSaveGameFunc = flashSaveDecide; renderLine = mode0RenderLine; fxOn = false; windowOn = false; saveType = 0; layerEnable = DISPCNT & layerSettings; CPUUpdateRenderBuffers(true); for (int i = 0; i < 256; i++) { memoryMap[i].address = (u8 *)&dummyAddress; memoryMap[i].mask = 0; } memoryMap[0].address = bios; memoryMap[0].mask = 0x3FFF; memoryMap[2].address = workRAM; memoryMap[2].mask = 0x3FFFF; memoryMap[3].address = internalRAM; memoryMap[3].mask = 0x7FFF; memoryMap[4].address = ioMem; memoryMap[4].mask = 0x3FF; memoryMap[5].address = paletteRAM; memoryMap[5].mask = 0x3FF; memoryMap[6].address = vram; memoryMap[6].mask = 0x1FFFF; memoryMap[7].address = oam; memoryMap[7].mask = 0x3FF; memoryMap[8].address = rom; memoryMap[8].mask = 0x1FFFFFF; memoryMap[9].address = rom; memoryMap[9].mask = 0x1FFFFFF; memoryMap[10].address = rom; memoryMap[10].mask = 0x1FFFFFF; memoryMap[12].address = rom; memoryMap[12].mask = 0x1FFFFFF; memoryMap[14].address = flashSaveMemory; memoryMap[14].mask = 0xFFFF; eepromReset(); flashReset(); rtcReset(); CPUUpdateWindow0(); CPUUpdateWindow1(); // make sure registers are correctly initialized if not using BIOS if (!useBios) { if (cpuIsMultiBoot) BIOS_RegisterRamReset(0xfe); else BIOS_RegisterRamReset(0xff); } else { if (cpuIsMultiBoot) BIOS_RegisterRamReset(0xfe); } switch (cpuSaveType) { case 0: // automatic cpuSramEnabled = true; cpuFlashEnabled = true; cpuEEPROMEnabled = true; cpuEEPROMSensorEnabled = false; saveType = gbaSaveType = 0; break; case 1: // EEPROM cpuSramEnabled = false; cpuFlashEnabled = false; cpuEEPROMEnabled = true; cpuEEPROMSensorEnabled = false; saveType = gbaSaveType = 3; // EEPROM usage is automatically detected break; case 2: // SRAM cpuSramEnabled = true; cpuFlashEnabled = false; cpuEEPROMEnabled = false; cpuEEPROMSensorEnabled = false; cpuSaveGameFunc = sramDelayedWrite; // to insure we detect the write saveType = gbaSaveType = 1; break; case 3: // FLASH cpuSramEnabled = false; cpuFlashEnabled = true; cpuEEPROMEnabled = false; cpuEEPROMSensorEnabled = false; cpuSaveGameFunc = flashDelayedWrite; // to insure we detect the write saveType = gbaSaveType = 2; break; case 4: // EEPROM+Sensor cpuSramEnabled = false; cpuFlashEnabled = false; cpuEEPROMEnabled = true; cpuEEPROMSensorEnabled = true; // EEPROM usage is automatically detected saveType = gbaSaveType = 3; break; case 5: // NONE cpuSramEnabled = false; cpuFlashEnabled = false; cpuEEPROMEnabled = false; cpuEEPROMSensorEnabled = false; // no save at all saveType = gbaSaveType = 5; break; } ARM_PREFETCH; cpuDmaHack = false; SWITicks = 0; IRQTicks = 0; soundReset(); systemRefreshScreen(); } void CPUInterrupt() { u32 PC = reg[15].I; bool savedState = armState; CPUSwitchMode(0x12, true, false); reg[14].I = PC; if (!savedState) reg[14].I += 2; reg[15].I = 0x18; armState = true; armIrqEnable = false; armNextPC = reg[15].I; reg[15].I += 4; ARM_PREFETCH; // if(!holdState) biosProtected[0] = 0x02; biosProtected[1] = 0xc0; biosProtected[2] = 0x5e; biosProtected[3] = 0xe5; } static inline void CPUDrawPixLine() { switch (systemColorDepth) { case 16: { u16 *dest = (u16 *)pix + 241 * (VCOUNT + 1); for (int x = 0; x < 240; ) { *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap16[lineMix[x++] & 0xFFFF]; } // for filters that read past the screen *dest++ = 0; break; } case 24: { u8 *dest = (u8 *)pix + 240 * VCOUNT * 3; for (int x = 0; x < 240; ) { *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; dest += 3; } break; } case 32: { u32 *dest = (u32 *)pix + 241 * (VCOUNT + 1); for (int x = 0; x < 240; ) { *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; } break; } } } static inline u32 CPUGetUserInput() { // update joystick information systemReadJoypads(); u32 joy = systemGetJoypad(0, cpuEEPROMSensorEnabled); P1 = 0x03FF ^ (joy & 0x3FF); UPDATE_REG(0x130, P1); // HACK: some special "buttons" extButtons = (joy >> 18); speedup = (extButtons & 1) != 0; return joy; } static inline void CPUBeforeEmulation() { if (newFrame) { CallRegisteredLuaFunctions(LUACALL_BEFOREEMULATION); u32 joy = CPUGetUserInput(); // this seems wrong, but there are cases where the game // can enter the stop state without requesting an IRQ from // the joypad. // FIXME: where is the right place??? u16 P1CNT = READ16LE(((u16 *)&ioMem[0x132])); if ((P1CNT & 0x4000) || stopState) { u16 p1 = (0x3FF ^ P1) & 0x3FF; if (P1CNT & 0x8000) { if (p1 == (P1CNT & 0x3FF)) { IF |= 0x1000; UPDATE_REG(0x202, IF); } } else { if (p1 & P1CNT) { IF |= 0x1000; UPDATE_REG(0x202, IF); } } } //if (cpuEEPROMSensorEnabled) //systemUpdateMotionSensor(0); VBAMovieResetIfRequested(); newFrame = false; } } static inline void CPUFrameBoundaryWork() { // HACK: some special "buttons" if (cheatsEnabled) cheatsCheckKeys(P1 ^ 0x3FF, extButtons); systemFrameBoundaryWork(); } void CPULoop(int _ticks) { CPUBeforeEmulation(); int32 ticks = _ticks; int32 clockTicks; int32 timerOverflow = 0; bool newVideoFrame = false; // variable used by the CPU core cpuTotalTicks = 0; cpuNextEvent = CPUUpdateTicks(); if (cpuNextEvent > ticks) cpuNextEvent = ticks; #ifdef SDL cpuBreakLoop = false; #endif for (;;) { #ifndef FINAL_VERSION if (systemDebug) { if (systemDebug >= 10 && !holdState) { CPUUpdateCPSR(); #ifdef BKPT_SUPPORT if (debugger_last) { sprintf( buffer, "R00=%08x R01=%08x R02=%08x R03=%08x R04=%08x R05=%08x R06=%08x R07=%08x R08=%08x R09=%08x R10=%08x R11=%08x R12=%08x R13=%08x R14=%08x R15=%08x R16=%08x R17=%08x\n", oldreg[0], oldreg[1], oldreg[2], oldreg[3], oldreg[4], oldreg[5], oldreg[6], oldreg[7], oldreg[8], oldreg[9], oldreg[10], oldreg[11], oldreg[12], oldreg[13], oldreg[14], oldreg[15], oldreg[16], oldreg[17]); } #endif sprintf( buffer, "R00=%08x R01=%08x R02=%08x R03=%08x R04=%08x R05=%08x R06=%08x R07=%08x R08=%08x" "R09=%08x R10=%08x R11=%08x R12=%08x R13=%08x R14=%08x R15=%08x R16=%08x R17=%08x\n", reg[0].I, reg[1].I, reg[2].I, reg[3].I, reg[4].I, reg[5].I, reg[6].I, reg[7].I, reg[8].I, reg[9].I, reg[10].I, reg[11].I, reg[12].I, reg[13].I, reg[14].I, reg[15].I, reg[16].I, reg[17].I); log(buffer); } else if (!holdState) { log("PC=%08x\n", armNextPC); } } #endif /* FINAL_VERSION */ if (!holdState && !SWITicks) { if (armState) { if (!armExecute()) return; } else { if (!thumbExecute()) return; } clockTicks = 0; } else clockTicks = CPUUpdateTicks(); cpuTotalTicks += clockTicks; if (cpuTotalTicks >= cpuNextEvent) { int32 remainingTicks = cpuTotalTicks - cpuNextEvent; if (SWITicks) { SWITicks -= clockTicks; if (SWITicks < 0) SWITicks = 0; } clockTicks = cpuNextEvent; cpuTotalTicks = 0; cpuDmaHack = false; updateLoop: if (IRQTicks) { IRQTicks -= clockTicks; if (IRQTicks < 0) IRQTicks = 0; } lcdTicks -= clockTicks; if (lcdTicks <= 0) { if (DISPSTAT & 1) // V-BLANK { // if in V-Blank mode, keep computing... if (DISPSTAT & 2) { lcdTicks += 1008; VCOUNT++; UPDATE_REG(0x06, VCOUNT); DISPSTAT &= 0xFFFD; UPDATE_REG(0x04, DISPSTAT); CPUCompareVCOUNT(); } else { lcdTicks += 224; DISPSTAT |= 2; UPDATE_REG(0x04, DISPSTAT); if (DISPSTAT & 16) { IF |= 2; UPDATE_REG(0x202, IF); } } if (VCOUNT >= 228) //Reaching last line { DISPSTAT &= 0xFFFC; UPDATE_REG(0x04, DISPSTAT); VCOUNT = 0; UPDATE_REG(0x06, VCOUNT); CPUCompareVCOUNT(); } } else { if (DISPSTAT & 2) { // if in H-Blank, leave it and move to drawing mode VCOUNT++; UPDATE_REG(0x06, VCOUNT); lcdTicks += 1008; DISPSTAT &= 0xFFFD; if (VCOUNT == 160) { DISPSTAT |= 1; DISPSTAT &= 0xFFFD; UPDATE_REG(0x04, DISPSTAT); if (DISPSTAT & 0x0008) { IF |= 1; UPDATE_REG(0x202, IF); } CPUCheckDMA(1, 0x0f); newVideoFrame = true; } UPDATE_REG(0x04, DISPSTAT); CPUCompareVCOUNT(); } else { if (systemFrameDrawingRequired()) { (*renderLine)(); CPUDrawPixLine(); } // entering H-Blank DISPSTAT |= 2; UPDATE_REG(0x04, DISPSTAT); lcdTicks += 224; CPUCheckDMA(2, 0x0f); if (DISPSTAT & 16) { IF |= 2; UPDATE_REG(0x202, IF); } } } } // we shouldn't be doing sound in stop state, but we lose synchronization // if sound is disabled, so in stop state, soundTick will just produce // mute sound soundTicks -= clockTicks; if (soundTicks <= 0) { soundTick(); soundTicks += soundTickStep; } if (!stopState) { if (timer0On) { timer0Ticks -= clockTicks; if (timer0Ticks <= 0) { timer0Ticks += (0x10000 - timer0Reload) << timer0ClockReload; timerOverflow |= 1; soundTimerOverflow(0); if (TM0CNT & 0x40) { IF |= 0x08; UPDATE_REG(0x202, IF); } } TM0D = 0xFFFF - (timer0Ticks >> timer0ClockReload) & 0xFFFF; UPDATE_REG(0x100, TM0D); } if (timer1On) { if (TM1CNT & 4) { if (timerOverflow & 1) { TM1D++; if (TM1D == 0) { TM1D += timer1Reload; timerOverflow |= 2; soundTimerOverflow(1); if (TM1CNT & 0x40) { IF |= 0x10; UPDATE_REG(0x202, IF); } } UPDATE_REG(0x104, TM1D); } } else { timer1Ticks -= clockTicks; if (timer1Ticks <= 0) { timer1Ticks += (0x10000 - timer1Reload) << timer1ClockReload; timerOverflow |= 2; soundTimerOverflow(1); if (TM1CNT & 0x40) { IF |= 0x10; UPDATE_REG(0x202, IF); } } TM1D = 0xFFFF - (timer1Ticks >> timer1ClockReload) & 0xFFFF; UPDATE_REG(0x104, TM1D); } } if (timer2On) { if (TM2CNT & 4) { if (timerOverflow & 2) { TM2D++; if (TM2D == 0) { TM2D += timer2Reload; timerOverflow |= 4; if (TM2CNT & 0x40) { IF |= 0x20; UPDATE_REG(0x202, IF); } } UPDATE_REG(0x108, TM2D); } } else { timer2Ticks -= clockTicks; if (timer2Ticks <= 0) { timer2Ticks += (0x10000 - timer2Reload) << timer2ClockReload; timerOverflow |= 4; if (TM2CNT & 0x40) { IF |= 0x20; UPDATE_REG(0x202, IF); } } TM2D = 0xFFFF - (timer2Ticks >> timer2ClockReload) & 0xFFFF; UPDATE_REG(0x108, TM2D); } } if (timer3On) { if (TM3CNT & 4) { if (timerOverflow & 4) { TM3D++; if (TM3D == 0) { TM3D += timer3Reload; if (TM3CNT & 0x40) { IF |= 0x40; UPDATE_REG(0x202, IF); } } UPDATE_REG(0x10C, TM3D); } } else { timer3Ticks -= clockTicks; if (timer3Ticks <= 0) { timer3Ticks += (0x10000 - timer3Reload) << timer3ClockReload; if (TM3CNT & 0x40) { IF |= 0x40; UPDATE_REG(0x202, IF); } } TM3D = 0xFFFF - (timer3Ticks >> timer3ClockReload) & 0xFFFF; UPDATE_REG(0x10C, TM3D); } } } timerOverflow = 0; #ifdef PROFILING profilingTicks -= clockTicks; if (profilingTicks <= 0) { profilingTicks += profilingTicksReload; if (profilSegment) { profile_segment *seg = profilSegment; do { u16 *b = (u16 *)seg->sbuf; int pc = ((reg[15].I - seg->s_lowpc) * seg->s_scale) / 0x10000; if (pc >= 0 && pc < seg->ssiz) { b[pc]++; break; } seg = seg->next; } while (seg); } } #endif if (newVideoFrame) { newVideoFrame = false; CPUFrameBoundaryWork(); } ticks -= clockTicks; cpuNextEvent = CPUUpdateTicks(); if (cpuDmaTicksToUpdate > 0) { if (cpuDmaTicksToUpdate > cpuNextEvent) clockTicks = cpuNextEvent; else clockTicks = cpuDmaTicksToUpdate; cpuDmaTicksToUpdate -= clockTicks; cpuDmaHack = true; goto updateLoop; // this is evil } if (IF && (IME & 1) && armIrqEnable) { int res = IF & IE; if (stopState) res &= 0x3080; if (res) { if (intState) { if (!IRQTicks) { CPUInterrupt(); intState = false; holdState = false; stopState = false; holdType = 0; } } else { if (!holdState) { intState = true; IRQTicks = 7; if (cpuNextEvent > IRQTicks) cpuNextEvent = IRQTicks; } else { CPUInterrupt(); holdState = false; stopState = false; holdType = 0; } } // Stops the SWI Ticks emulation if an IRQ is executed //(to avoid problems with nested IRQ/SWI) if (SWITicks) SWITicks = 0; } } if (remainingTicks > 0) { if (remainingTicks > cpuNextEvent) clockTicks = cpuNextEvent; else clockTicks = remainingTicks; remainingTicks -= clockTicks; goto updateLoop; // this is evil, too } if (timerOnOffDelay) applyTimer(); //if (cpuNextEvent > ticks) // FIXME: can be negative and slow down // cpuNextEvent = ticks; #ifdef SDL if (newFrame || useOldFrameTiming && ticks <= 0 || cpuBreakLoop) #else if (newFrame || useOldFrameTiming && ticks <= 0) #endif { break; } } } } struct EmulatedSystem GBASystem = { // emuMain CPULoop, // emuReset CPUReset, // emuCleanUp CPUCleanUp, // emuReadBattery CPUReadBatteryFile, // emuWriteBattery CPUWriteBatteryFile, // emuReadBatteryFromStream CPUReadBatteryFromStream, // emuWriteBatteryToStream CPUWriteBatteryToStream, // emuReadState CPUReadState, // emuWriteState CPUWriteState, // emuReadStateFromStream CPUReadStateFromStream, // emuWriteStateToStream CPUWriteStateToStream, // emuReadMemState CPUReadMemState, // emuWriteMemState CPUWriteMemState, // emuWritePNG CPUWritePNGFile, // emuWriteBMP CPUWriteBMPFile, // emuUpdateCPSR CPUUpdateCPSR, // emuHasDebugger true, // emuCount #ifdef FINAL_VERSION 250000, #else 5000, #endif };
TASVideos/vba-rerecording
src/gba/V8/GBA.cpp
C++
gpl-2.0
91,319
[ 30522, 1001, 2421, 1026, 20116, 2102, 20617, 1028, 1001, 2421, 1026, 20116, 2102, 19422, 12322, 1028, 1001, 2421, 1026, 20116, 2102, 7662, 2290, 1028, 1001, 2421, 1026, 20116, 18886, 3070, 1028, 1001, 2421, 1000, 1012, 1012, 1013, 1012, 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 (c) 2010-2015 Darkstar Dev Teams This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ This file is part of DarkStar-server source code. =========================================================================== */ #include "../../common/socket.h" #include "char_sync.h" #include "../entities/charentity.h" CCharSyncPacket::CCharSyncPacket(CCharEntity* PChar) { this->type = 0x67; this->size = 0x14; WBUFB(data,(0x04)) = 0x02; WBUFB(data,(0x05)) = 0x09; WBUFW(data,(0x06)) = PChar->targid; WBUFL(data,(0x08)) = PChar->id; WBUFB(data,(0x10)) = PChar->StatusEffectContainer->HasStatusEffect(EFFECT_LEVEL_SYNC) ? 4 : 0; // 0x02 - Campaign Battle, 0x04 - Level Sync WBUFB(data,(0x25)) = PChar->jobs.job[PChar->GetMJob()]; // реальный уровень персонажа (при ограничении уровня отличается от m_mlvl) }
n0xus/darkstar
src/map/packets/char_sync.cpp
C++
gpl-3.0
1,592
[ 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...
class ZshLovers < Formula desc "Tips, tricks, and examples for zsh" homepage "https://grml.org/zsh/#zshlovers" url "https://deb.grml.org/pool/main/z/zsh-lovers/zsh-lovers_0.9.1_all.deb" sha256 "011b7931a555c77e98aa9cdd16b3c4670c0e0e3b5355e5fd60188885a6678de8" livecheck do url "https://deb.grml.org/pool/main/z/zsh-lovers/" regex(/href=.*?zsh-lovers[._-]v?(\d+(?:\.\d+)+)[._-]all/i) end bottle do sha256 cellar: :any_skip_relocation, all: "a9a640ed5452e086874d853453e15cbd2e347a5a86d867db12a5245980f6aa54" end def install system "tar", "xf", "zsh-lovers_#{version}_all.deb" system "tar", "xf", "data.tar.xz" system "gunzip", *Dir["usr/**/*.gz"] prefix.install_metafiles "usr/share/doc/zsh-lovers" prefix.install "usr/share" end test do system "man", "zsh-lovers" end end
sjackman/homebrew-core
Formula/zsh-lovers.rb
Ruby
bsd-2-clause
835
[ 30522, 2465, 1062, 4095, 14301, 2545, 1026, 5675, 4078, 2278, 1000, 10247, 1010, 12225, 1010, 1998, 4973, 2005, 1062, 4095, 1000, 2188, 13704, 1000, 16770, 1024, 1013, 1013, 24665, 19968, 1012, 8917, 1013, 1062, 4095, 1013, 1001, 1062, 4095...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
// // Resource.h // Chilli Source // Created by Ian Copland on 07/07/2014. // // The MIT License (MIT) // // Copyright (c) 2014 Tag Games Limited // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef _CHILLISOURCE_CORE_RESOURCE_H_ #define _CHILLISOURCE_CORE_RESOURCE_H_ #include <ChilliSource/ChilliSource.h> #include <ChilliSource/Core/Resource/IResourceOptions.h> #include <ChilliSource/Core/Resource/Resource.h> #include <ChilliSource/Core/Resource/ResourcePool.h> #include <ChilliSource/Core/Resource/ResourceProvider.h> #endif
fjpavm/ChilliSource
Source/ChilliSource/Core/Resource.h
C
mit
1,586
[ 30522, 1013, 1013, 1013, 1013, 7692, 1012, 1044, 1013, 1013, 10720, 2072, 3120, 1013, 1013, 2580, 2011, 4775, 8872, 3122, 2006, 5718, 1013, 5718, 1013, 2297, 1012, 1013, 1013, 1013, 1013, 1996, 10210, 6105, 1006, 10210, 1007, 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...
/* * Generated by MTK SP DrvGen Version 10.03.0 for MT6589_NP. Copyright MediaTek Inc. (C) 2012. * Tue Jul 09 16:27:05 2013 * Do Not Modify the File. */ #ifndef __CUST_AUXADC_TOOL_H #define __CUST_AUXADC_TOOL_H #define AUXADC_TEMPERATURE_CHANNEL 3 #endif //_CUST_AUXADC_TOOL_H
luckasfb/android_kernel_iocean_x7
mediatek/custom/vanzo89_wet_jb2/kernel/dct/dct_k7w/cust_adc.h
C
gpl-2.0
292
[ 30522, 1013, 1008, 1008, 7013, 2011, 11047, 2243, 11867, 2852, 2615, 6914, 2544, 2184, 1012, 6021, 1012, 1014, 2005, 11047, 26187, 2620, 2683, 1035, 27937, 1012, 9385, 2865, 23125, 4297, 1012, 1006, 1039, 1007, 2262, 1012, 1008, 10722, 2063...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 /** * Description * @author Jeff Tickle <jtickle at tux dot appstate dot edu> */ PHPWS_Core::initModClass('sdr', 'CommandMenu.php'); class BrowseOrganizationsMenu extends CommandMenu { protected function setupCommands() { $browse = CommandFactory::getCommand('ClubDirectory'); $this->addCommand('Club Directory', $browse); $create = CommandFactory::getCommand('CreateOrganization'); $this->addCommand('Create New', $create); $apply = CommandFactory::getCommand('ClubRegistrationFormCommand'); $this->addCommand('Register an Organization', $apply); } } ?>
AppStateESS/clubconnect
class/BrowseOrganizationsMenu.php
PHP
gpl-3.0
630
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 6412, 1008, 1030, 3166, 5076, 16356, 2571, 1026, 1046, 26348, 2571, 2012, 10722, 2595, 11089, 18726, 12259, 11089, 3968, 2226, 1028, 1008, 1013, 25718, 9333, 1035, 4563, 1024, 1024, 1999, 41...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...