code stringlengths 4 991k | repo_name stringlengths 6 116 | path stringlengths 4 249 | language stringclasses 30 values | license stringclasses 15 values | size int64 4 991k | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
MyRaspberry-Utilities
====================
Bash Scripts for Raspberry 24/7
| tbhCiro/MyRasperry-Utilities | README.md | Markdown | gpl-2.0 | 76 | [
30522,
23020,
13102,
9766,
1011,
16548,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
24234,
14546,
2005,
20710,
2361,
9766,
2484,
1013,
1021,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Visual Leak Detector [](https://ci.appveyor.com/project/KindDragon/vld/branch/master) <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N3QTYHP9LH6UY&lc=GB&item_name=Visual%20Leak%20Detector&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted" target="_blank"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a>
## Introduction
Visual C++ provides built-in memory leak detection, but its capabilities are minimal at best. This memory leak detector was created as a free alternative to the built-in memory leak detector provided with Visual C++. Here are some of Visual Leak Detector's features, none of which exist in the built-in detector:
* Provides a complete stack trace for each leaked block, including source file and line number information when available.
* Detects most, if not all, types of in-process memory leaks including COM-based leaks, and pure Win32 heap-based leaks.
* Selected modules (DLLs or even the main EXE) can be excluded from leak detection.
* Provides complete data dumps (in hex and ASCII) of leaked blocks.
* Customizable memory leak report: can be saved to a file or sent to the debugger and can include a variable level of detail.
Other after-market leak detectors for Visual C++ are already available. But most of the really popular ones, like Purify and BoundsChecker, are very expensive. A few free alternatives exist, but they're often too intrusive, restrictive, or unreliable. Visual Leak Detector is currently the only freely available memory leak detector for Visual C++ that provides all of the above professional-level features packaged neatly in an easy-to-use library.
Visual Leak Detector is [licensed][3] free of charge as a service to the Windows developer community. If you find it to be useful and would like to just say "Thanks!", or you think it stinks and would like to say "This thing sucks!", please feel free to [drop us a note][1]. Or, if you'd prefer, you can [contribute a small donation][2]. Both are very appreciated.
## Documentation
Read the documentation at [https://github.com/KindDragon/vld/wiki](https://github.com/KindDragon/vld/wiki)
## Contributing
We encourage developers who've added their own features, or fixed bugs they've found, to contribute to the project. The full version-controlled source tree is available publicly via Git at the URL below. Feel free to clone from this URL and submit patches for consideration for inclusion in future versions. You can also issue pull requests for changes that you've made and would like to share.
* [Source code](https://github.com/KindDragon/vld)
Copyright © 2005-2017 VLD Team
[1]: https://github.com/KindDragon/vld/wiki
[2]: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N3QTYHP9LH6UY&lc=GB&item_name=Visual%20Leak%20Detector¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
[3]: https://github.com/KindDragon/vld/blob/master/COPYING.txt
| KindDragon/vld | README.md | Markdown | lgpl-2.1 | 3,163 | [
30522,
1001,
5107,
17271,
19034,
1031,
999,
1031,
3857,
3570,
1033,
1006,
16770,
1024,
1013,
1013,
25022,
1012,
10439,
12417,
2953,
1012,
4012,
1013,
17928,
1013,
3934,
1013,
3570,
1013,
1014,
2243,
2615,
6199,
2620,
4609,
16048,
2063,
1791... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
$.ajax({
async: false,
url: "http://api.visalus.com/ITReporting/SalesAnalytics/GetDataBySP/?SPName=usp_PROMO_ViCrunch3FF_JSON&?",
type: 'GET',
dataType: 'jsonp',
success: function (data) {
var result = JSON.stringify(data);
//alert(result);
var obj = jQuery.parseJSON(result);
var output="<table class='standings-table' width='100%'><tr class='head'><td align='center'>Rank</td><td>Name</td><td>Location</td><td align='center'>VIP Tier</td></tr>";
for (var i in obj) {
output+="<tr><td align='center'>" + obj[i].Rank + "</td><td>" + obj[i].Name + "</td><td>" + obj[i].Location + "</td><td align='center'>" + obj[i].VIPtier + "</td></tr>";
}
output+="</table>";
document.getElementById("crunchtime").innerHTML = output;
},
error: function (e) {
alert('fail');
}
});
| tsmulugeta/vi.com | js/crunchtime.js | JavaScript | gpl-2.0 | 1,074 | [
30522,
1002,
1012,
18176,
1006,
1063,
2004,
6038,
2278,
1024,
6270,
1010,
24471,
2140,
1024,
1000,
8299,
1024,
1013,
1013,
17928,
1012,
9425,
7393,
1012,
4012,
1013,
2009,
2890,
6442,
2075,
1013,
4341,
27953,
21252,
2015,
1013,
2131,
2850,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<fieldset class="col-sm-12 bordure">
<legend class="legende">{{ 'Dishprice' | translate }}</legend>
<div ng-include src="'partials/message-include.html'"></div>
<table class="table table-striped">
<thead>
<tr>
<th>{{ 'dishprice.uid' | translate }}</th>
<th>{{ 'dishprice.corpid' | translate }}</th>
<th>{{ 'dishprice.storetype' | translate }}</th>
<th>{{ 'dishprice.targetvalue' | translate }}</th>
<th>{{ 'dishprice.price' | translate }}</th>
<th>{{ 'dishprice.createdate' | translate }}</th>
<th>{{ 'dishprice.modifydate' | translate }}</th>
<th>{{ 'dishprice.createuser' | translate }}</th>
<th>{{ 'dishprice.modifyuser' | translate }}</th>
<th>{{ 'dishprice.status' | translate }}</th>
<th>{{ 'dishprice.platform' | translate }}</th>
<th><a class="btn btn-info" href='#/dishprice/new'>{{ 'create' | translate }}</a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="dishprice in dishprices">
<td>{{dishprice.uid}}</td>
<td>{{dishprice.corpid | number }}</td>
<td>{{dishprice.storetype | number }}</td>
<td>{{dishprice.targetvalue | number }}</td>
<td>{{dishprice.price | number }}</td>
<td>{{dishprice.createdate | date:'shortDate'}}</td>
<td>{{dishprice.modifydate | date:'shortDate'}}</td>
<td>{{dishprice.createuser}}</td>
<td>{{dishprice.modifyuser}}</td>
<td>{{dishprice.status | number }}</td>
<td>{{dishprice.platform}}</td>
<td><a class="btn btn-info" href="#/dishprice/{{dishprice.uid}}">{{ 'edit' | translate }}</a></td>
</tr>
</tbody>
</table>
</fieldset>
| cytochromewangdong/HippoStart | src/main/webapp/app/partials/dishprice/dishprice_list.html | HTML | mit | 1,667 | [
30522,
1026,
4249,
3388,
2465,
1027,
1000,
8902,
1011,
15488,
1011,
2260,
8945,
4103,
5397,
1000,
1028,
1026,
5722,
2465,
1027,
1000,
5722,
2063,
1000,
1028,
1063,
1063,
1005,
9841,
18098,
6610,
1005,
1064,
17637,
1065,
1065,
1026,
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... |
html, body, #wrapper {
margin: 0;
padding: 0;
height: 100%;
}
body {
background: rgb(251,243,225);
font-family: HelveticaNeue, "Helvetica Neue", Helvetica, sans-serif;
line-height: 1.5;
-webkit-text-size-adjust: none;
min-height: 416px;
}
body > #wrapper {height: auto; min-height: 100%;}
a:link, a:visited {
color: #dc7e56;
text-decoration: none;
}
a:hover, a:focus, a:active {
color: #76b43a;
text-decoration: none;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/* Menu
-----------------------------------------------------------------------------*/
.menu, .menu li {
margin: 0;
padding: 0;
list-style-type: none;
}
/* Header
-----------------------------------------------------------------------------*/
#header {
background: url(../images/mobile/header.png) repeat-x top;
border-bottom: 1px solid rgb(125,72,48);
height: 60px;
position: relative;
margin-bottom: 30px;
}
#header h1 {
background: url(../images/mobile/h1.png) no-repeat top;
margin: 0;
padding: 0;
margin-left: -75px;
width: 150px;
height: 43px;
position: absolute;
top: 12px;
left: 50%;
text-indent: -9999em;
}
#header .button {
position: absolute;
top: 13px;
padding: 0;
max-width: 60px;
height: 31px;
font-size: 15px;
line-height: 29px;
color: #fff;
text-shadow: 0px -1px 0px rgb(55,26,14);
}
#header .logout {
right: 10px;
border-width: 0 10px 0 10px;
-webkit-border-image: url(../images/mobile/button.png) 0 10 0 10;
}
#header .back-button {
left: 10px;
border-width: 0 10px 0 15px;
-webkit-border-image: url(../images/mobile/back-button.png) 0 10 0 15;
}
#header .next-button {
right: 10px;
border-width: 0 15px 0 10px;
-webkit-border-image: url(../images/mobile/next-button.png) 0 15 0 10;
}
/* Container
-----------------------------------------------------------------------------*/
#container {
padding: 0 10px 20px;
}
.section {
background: #fff;
padding: 10px;
-webkit-border-radius: 6px;
}
.section.account {
padding: 10px 5px;
}
.angle-left {
background: #fff;
-webkit-border-top-left-radius: 0;
}
/* Form
-----------------------------------------------------------------------------*/
.login {
margin-bottom: 25px;
}
.login label {
display: block;
}
.login .text {
width: 94%;
}
.field {
margin: 0 0 4px;
}
.expense .field {
margin: 0 0 10px;
}
label {
color: #666;
}
.expense label {
display: inline-block;
width: 70px;
}
select {
font-size: 15px;
width: 165px;
}
.text {
background: rgb(251,255,237) url(../images/mobile/shadow.png) repeat-x top;
border: 1px solid #ccc;
height: 28px;
line-height: 28px;
-webkit-border-radius: 4px;
font-size: 16px;
}
.submit {
background: url(../images/mobile/submit.png) repeat-x top;
border: 1px solid rgb(137,68,40);
width: 100%;
height: 36px;
line-height: 36px;
-webkit-border-radius: 4px;
color: #fff;
font-size: 18px;
font-weight: bold;
text-shadow: 0px -1px 0px rgb(109,56,33);
margin-top: 10px;
}
.submit:active {
background: url(../images/mobile/submit.png) repeat-x bottom;
}
/* Help
-----------------------------------------------------------------------------*/
.help {
margin: 0;
font-size: 18px;
font-weight: bold;
text-align: center;
}
.help a {
display: inline-block;
background: url(../images/mobile/icon-help.png) no-repeat top;
padding-top: 35px;
}
/* List
-----------------------------------------------------------------------------*/
h3 {
margin: 0;
}
.list li {
margin-bottom: 2px;
}
.list li a {
display: block;
background: #fff url(../images/mobile/arrow.png) right center no-repeat;
padding: 8px 10px;
-webkit-border-radius: 6px;
color: #333;
}
.list li a:active {
background: #f4fdc7 url(../images/mobile/arrow.png) right center no-repeat;
}
/* Expense
-----------------------------------------------------------------------------*/
.hd {
position: relative;
}
.hd span {
position: absolute;
top: 4px;
right: 0;
color: #999;
font-size: 15px;
}
/* Calendar
-----------------------------------------------------------------------------*/
table.calendar, .calendar td, .calendar th {
border: 0;
padding: 0;
}
table.calendar {
border-collapse: separate;
border: 1px solid #bdae8a;
border-width: 0px 0px 1px 1px;
margin: 10px auto;
font-size: 15px;
}
.calendar td, .calendar th {
width: 45px;
height: 44px;
text-align: center;
vertical-align: middle;
background: url(../images/mobile/cells.png);
color: #333;
position: relative;
}
.calendar th {
height: 24px;
font-weight: bold;
font-size: 12px;
color: #988a68;
}
.calendar td:hover, .calendar th:hover {
background-position: 0px -44px;
color: #222;
}
.calendar td.date_has_event {
background-position: 90px 0px;
color: white;
}
.calendar td.date_has_event:hover {
background-position: 90px -44px;
}
.calendar td.padding {
background: url(../images/mobile/calpad.png);
}
.calendar td.today {
background-position: 45px 0px;
color: white;
}
.calendar td.today:hover {
background-position: 45px -44px;
}
.calendar .events {
position: relative;
}
.calendar .events ul {
text-align: left;
position: absolute;
display: none;
z-index: 1000;
padding: 15px;
background: #E7ECF2 url(../images/mobile/popup.png) no-repeat;
color: white;
border: 1px solid white;
font-size: 15px;
width: 200px;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
list-style: none;
color: #444444;
-webkit-box-shadow: 0px 8px 8px #333;
}
.calendar .events li {
padding-bottom: 5px;
}
.calendar .events li span {
display: block;
font-size: 12px;
text-align: justify;
color: #555;
}
.calendar .events li span.title {
font-weight: bold;
color: #222;
}
/* Report
-----------------------------------------------------------------------------*/
#date {
background: rgb(189,174,138);
border-bottom: 1px solid rgb(158,143,105);
padding: 7px 10px;
margin: -30px 0 20px;
}
#date .text {
width: 28%;
height: 24px;
line-height: 24px;
}
#date span {
display: inline-block;
width: 8%;
text-align: center;
font-weight: bold;
color: rgb(246,236,212);
text-shadow: 0px -1px 0px rgb(161,144,102);
}
.tabs li {
float: left;
margin-right: 3px;
}
.tabs li a {
float: left;
display: block;
background: #e1835a;
padding: 0 8px;
height: 32px;
line-height: 32px;
color: #fff;
-webkit-border-top-right-radius: 6px;
-webkit-border-top-left-radius: 6px;
}
.tabs li.current a {
background: #fff;
color: #000;
}
.section table {
width: 100%;
}
.section table, .section td, section th {
border: 0;
padding: 0;
}
.section td {
padding: 2px 6px;
}
tr:nth-child(2n+1) {
background-color: #fff;
}
tr:nth-child(2n) {
background-color: #f0f8ff;
}
.section th {
background-color: #d9ecbd;
text-align: left;
padding: 0 6px;
border-bottom: 1px solid #c3d8a5;
}
.section .amount {
text-align: right;
}
/* Footer
-----------------------------------------------------------------------------*/
/*
#footer {
position: relative;
margin-top: -30px;
height: 30px;
font-size: 12px;
text-align: center;
}
*/
#footer {
height: 30px;
font-size: 12px;
text-align: center;
}
#footer a {
color: rgb(179,164,128);
padding: 0 5px;
}
#footer a:hover {
color: rgb(161,127,46);
}
| weijen/expense | public/stylesheets/mobile.css | CSS | mit | 7,741 | [
30522,
16129,
1010,
2303,
1010,
1001,
10236,
4842,
1063,
7785,
1024,
1014,
1025,
11687,
4667,
1024,
1014,
1025,
4578,
1024,
2531,
1003,
1025,
1065,
2303,
1063,
4281,
1024,
1054,
18259,
1006,
22582,
1010,
22884,
1010,
14993,
1007,
1025,
1548... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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 io.undertow.protocols.ssl;
import org.xnio.ChannelListener;
import org.xnio.ChannelListeners;
import org.xnio.Option;
import org.xnio.Options;
import io.undertow.connector.ByteBufferPool;
import org.xnio.SslClientAuthMode;
import org.xnio.StreamConnection;
import org.xnio.ssl.SslConnection;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLSession;
import java.io.IOException;
import java.net.SocketAddress;
import java.util.Set;
import java.util.concurrent.Executor;
/**
* @author Stuart Douglas
*/
class UndertowSslConnection extends SslConnection {
private static final Set<Option<?>> SUPPORTED_OPTIONS = Option.setBuilder().add(Options.SECURE, Options.SSL_CLIENT_AUTH_MODE).create();
private final StreamConnection delegate;
private final SslConduit sslConduit;
private final ChannelListener.SimpleSetter<SslConnection> handshakeSetter = new ChannelListener.SimpleSetter<>();
private final SSLEngine engine;
/**
* Construct a new instance.
*
* @param delegate the underlying connection
*/
UndertowSslConnection(StreamConnection delegate, SSLEngine engine, ByteBufferPool bufferPool, Executor delegatedTaskExecutor) {
super(delegate.getIoThread());
this.delegate = delegate;
this.engine = engine;
sslConduit = new SslConduit(this, delegate, engine, delegatedTaskExecutor, bufferPool, new HandshakeCallback());
setSourceConduit(sslConduit);
setSinkConduit(sslConduit);
}
@Override
public void startHandshake() throws IOException {
sslConduit.startHandshake();
}
@Override
public SSLSession getSslSession() {
return sslConduit.getSslSession();
}
@Override
public ChannelListener.Setter<? extends SslConnection> getHandshakeSetter() {
return handshakeSetter;
}
@Override
protected void notifyWriteClosed() {
sslConduit.notifyWriteClosed();
}
@Override
protected void notifyReadClosed() {
sslConduit.notifyReadClosed();
}
@Override
public SocketAddress getPeerAddress() {
return delegate.getPeerAddress();
}
@Override
public SocketAddress getLocalAddress() {
return delegate.getLocalAddress();
}
public SSLEngine getSSLEngine() {
return sslConduit.getSSLEngine();
}
SslConduit getSslConduit() {
return sslConduit;
}
/** {@inheritDoc} */
@Override
public <T> T setOption(final Option<T> option, final T value) throws IllegalArgumentException, IOException {
if (option == Options.SSL_CLIENT_AUTH_MODE) {
try {
return option.cast(engine.getNeedClientAuth() ? SslClientAuthMode.REQUIRED : engine.getWantClientAuth() ? SslClientAuthMode.REQUESTED : SslClientAuthMode.NOT_REQUESTED);
} finally {
engine.setWantClientAuth(false);
engine.setNeedClientAuth(false);
if (value == SslClientAuthMode.REQUESTED) {
engine.setWantClientAuth(true);
} else if (value == SslClientAuthMode.REQUIRED) {
engine.setNeedClientAuth(true);
}
}
} else if (option == Options.SECURE) {
throw new IllegalArgumentException();
} else {
return delegate.setOption(option, value);
}
}
/** {@inheritDoc} */
@Override
public <T> T getOption(final Option<T> option) throws IOException {
if (option == Options.SSL_CLIENT_AUTH_MODE) {
return option.cast(engine.getNeedClientAuth() ? SslClientAuthMode.REQUIRED : engine.getWantClientAuth() ? SslClientAuthMode.REQUESTED : SslClientAuthMode.NOT_REQUESTED);
} else {
return option == Options.SECURE ? (T)Boolean.TRUE : delegate.getOption(option);
}
}
/** {@inheritDoc} */
@Override
public boolean supportsOption(final Option<?> option) {
return SUPPORTED_OPTIONS.contains(option) || delegate.supportsOption(option);
}
@Override
protected boolean readClosed() {
return super.readClosed();
}
@Override
protected boolean writeClosed() {
return super.writeClosed();
}
protected void closeAction() {
sslConduit.close();
}
private final class HandshakeCallback implements Runnable {
@Override
public void run() {
final ChannelListener<? super SslConnection> listener = handshakeSetter.get();
if (listener == null) {
return;
}
ChannelListeners.<SslConnection>invokeChannelListener(UndertowSslConnection.this, listener);
}
}
}
| rhusar/undertow | core/src/main/java/io/undertow/protocols/ssl/UndertowSslConnection.java | Java | apache-2.0 | 5,435 | [
30522,
1013,
1008,
1008,
1046,
15853,
2015,
1010,
2188,
1997,
2658,
2330,
3120,
1012,
1008,
9385,
2297,
2417,
6045,
1010,
4297,
1012,
1010,
1998,
3265,
16884,
1008,
2004,
5393,
2011,
1996,
1030,
3166,
22073,
1012,
1008,
1008,
7000,
2104,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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) 2016 BreizhCamp
* [http://breizhcamp.org]
*
* This file is part of CFP.io.
*
* CFP.io is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.cfp.multitenant;
import io.cfp.multitenant.TenantFilter;
import org.junit.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest;
import static org.junit.Assert.*;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
*/
public class TenantFilterTest {
private MockHttpServletRequest request = new MockHttpServletRequest();
private TenantFilter filter = new TenantFilter();
@Test
public void should_retrieve_tenant_from_Origin() {
request.setPathInfo("/some/api");
request.addHeader(HttpHeaders.ORIGIN, "https://test.cfp.io" );
assertEquals("test", filter.extractTenant(request));
}
@Test
public void should_retrieve_tenant_from_Referer() {
request.setPathInfo("/some/api");
request.addHeader(HttpHeaders.REFERER, "https://test.cfp.io/" );
assertEquals("test", filter.extractTenant(request));
}
@Test
public void should_retrieve_tenant_from_XTenant_header() {
request.setPathInfo("/some/api");
request.addHeader(TenantFilter.TENANT_HEADER, "test" );
assertEquals("test", filter.extractTenant(request));
}
@Test
public void should_retrieve_tenant_from_Host() {
request.setServerName("test.cfp.io");
assertEquals("test", filter.extractTenant(request));
}
}
| cfpio/callForPapers | src/test/java/io/cfp/multitenant/TenantFilterTest.java | Java | agpl-3.0 | 2,165 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2355,
7987,
7416,
27922,
26468,
1008,
1031,
8299,
1024,
1013,
1013,
7987,
7416,
27922,
26468,
1012,
8917,
1033,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
12935,
2361,
1012,
22834,
1012,
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 (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>
#include <string>
#include <utility>
#include <boost/optional.hpp>
#include <thrift/compiler/ast/t_throws.h>
#include <thrift/compiler/ast/t_type.h>
namespace apache {
namespace thrift {
namespace compiler {
/**
* A sink contains the types for stream of responses and a final response.
*
* Exceptions throw during the stream or instead of the final response can also
* be specified.
*/
class t_sink : public t_templated_type {
public:
explicit t_sink(t_type_ref sink_type, t_type_ref final_response_type)
: sink_type_(std::move(sink_type)),
final_response_type_(std::move(final_response_type)) {}
const t_type_ref& sink_type() const { return sink_type_; }
const t_type_ref& final_response_type() const { return final_response_type_; }
// Returns nullptr when throws clause is absent.
t_throws* sink_exceptions() { return sink_exceptions_.get(); }
const t_throws* sink_exceptions() const { return sink_exceptions_.get(); }
// Use nullptr to indicate an absent throws clause.
void set_sink_exceptions(std::unique_ptr<t_throws> sink_exceptions) {
sink_exceptions_ = std::move(sink_exceptions);
}
// Returns nullptr when throws clause is absent.
t_throws* final_response_exceptions() {
return final_response_exceptions_.get();
}
const t_throws* final_response_exceptions() const {
return final_response_exceptions_.get();
}
// Use nullptr to indicate an absent throws clause.
void set_final_response_exceptions(
std::unique_ptr<t_throws> final_response_exceptions) {
final_response_exceptions_ = std::move(final_response_exceptions);
}
void set_first_response_type(boost::optional<t_type_ref> first_response) {
first_response_type_ = std::move(first_response);
}
const boost::optional<t_type_ref>& first_response_type() const {
return first_response_type_;
}
std::string get_full_name() const override {
std::string result = "sink<" + sink_type_->get_full_name() + ", " +
final_response_type_->get_full_name() + ">";
if (first_response_type_ != boost::none) {
result += ", " + first_response_type_->deref().get_full_name();
}
return result;
}
private:
t_type_ref sink_type_;
std::unique_ptr<t_throws> sink_exceptions_;
t_type_ref final_response_type_;
std::unique_ptr<t_throws> final_response_exceptions_;
boost::optional<t_type_ref> first_response_type_;
public:
// TODO(afuller): Delete everything below here. It is only provided for
// backwards compatibility.
explicit t_sink(
const t_type* sink_type,
std::unique_ptr<t_throws> sink_exceptions,
const t_type* final_response_type,
std::unique_ptr<t_throws> final_response_exceptions)
: t_sink(
t_type_ref::from_req_ptr(sink_type),
t_type_ref::from_req_ptr(final_response_type)) {
set_sink_exceptions(std::move(sink_exceptions));
set_final_response_exceptions(std::move(final_response_exceptions));
}
void set_first_response(const t_type* first_response) {
set_first_response_type(t_type_ref::from_ptr(first_response));
}
bool sink_has_first_response() const {
return first_response_type_ != boost::none;
}
t_throws* get_final_response_xceptions() const {
return final_response_exceptions_.get();
}
t_throws* get_sink_xceptions() const { return sink_exceptions_.get(); }
const t_type* get_sink_type() const { return sink_type().get_type(); }
const t_type* get_first_response_type() const {
return first_response_type_ == boost::none
? nullptr
: first_response_type_->get_type();
}
const t_type* get_final_response_type() const {
return final_response_type().get_type();
}
bool is_sink() const override { return true; }
type get_type_value() const override { return type::t_sink; }
};
} // namespace compiler
} // namespace thrift
} // namespace apache
| facebook/fbthrift | thrift/compiler/ast/t_sink.h | C | apache-2.0 | 4,540 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
18804,
7248,
1010,
4297,
1012,
1998,
18460,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 handler
import (
"encoding/base64"
"encoding/pem"
"github.com/amdonov/lite-idp/config"
"io/ioutil"
"log"
"net/http"
"text/template"
)
type metadataHandler struct {
template *template.Template
Configuration *config.Configuration
Certificate string
}
func NewMetadataHandler(config *config.Configuration) (http.Handler, error) {
handler := &metadataHandler{Configuration: config}
data, err := ioutil.ReadFile(config.Certificate)
if err != nil {
return nil, err
}
cert, _ := pem.Decode(data)
handler.Certificate = base64.StdEncoding.EncodeToString(cert.Bytes)
handler.template = template.New("metadata")
handler.template.Parse(`<?xml version="1.0" encoding="UTF-8"?>
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
entityID="{{ .Configuration.EntityId }}">
<IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<KeyDescriptor>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
{{ .Certificate }}
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</KeyDescriptor>
<ArtifactResolutionService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
Location="{{ .Configuration.BaseURL }}{{ .Configuration.Services.ArtifactResolution }}" index="1"/>
<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName</NameIDFormat>
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="{{ .Configuration.BaseURL }}{{ .Configuration.Services.Authentication }}"/>
</IDPSSODescriptor>
<AttributeAuthorityDescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<KeyDescriptor>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
{{ .Certificate }}
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</KeyDescriptor>
<AttributeService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
Location="{{ .Configuration.BaseURL }}{{ .Configuration.Services.AttributeQuery }}"/>
<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName</NameIDFormat>
</AttributeAuthorityDescriptor>
</EntityDescriptor>`)
return handler, nil
}
func (handler *metadataHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
err := handler.template.Execute(writer, handler)
if err != nil {
log.Printf("Failed to render metadata, %s\n", err.Error())
}
}
| goosetav/lite-idp | handler/metadata.go | GO | apache-2.0 | 2,775 | [
30522,
7427,
28213,
12324,
1006,
1000,
17181,
1013,
2918,
21084,
1000,
1000,
17181,
1013,
21877,
2213,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
2572,
5280,
4492,
1013,
5507,
2063,
1011,
8909,
2361,
1013,
9530,
8873,
2290,
1000,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE" sourcelanguage="en">
<context>
<name>AboutPage</name>
<message>
<location filename="../qml/AboutPage.qml" line="31"/>
<location filename="../../bb10/assets/AboutPage.qml" line="18"/>
<source>About</source>
<translation>Über Zimpedia</translation>
</message>
<message>
<location filename="../qml/AboutPage.qml" line="51"/>
<location filename="../../bb10/assets/AboutPage.qml" line="84"/>
<source>Offline reader for Wikipedia and other Wiki projects</source>
<translation>Offline Reader für die Wikipedia und andere Wiki-Projekte</translation>
</message>
<message>
<location filename="../qml/AboutPage.qml" line="56"/>
<location filename="../../bb10/assets/AboutPage.qml" line="93"/>
<source>Website</source>
<translation>Webseite</translation>
</message>
<message>
<location filename="../qml/AboutPage.qml" line="61"/>
<location filename="../../bb10/assets/AboutPage.qml" line="41"/>
<source>Changelog</source>
<translation>Changelog</translation>
</message>
<message>
<location filename="../qml/AboutPage.qml" line="83"/>
<location filename="../../bb10/assets/AboutPage.qml" line="113"/>
<source>Copyright & license</source>
<translation>Copyright und Lizenz</translation>
</message>
<message>
<location filename="../qml/AboutPage.qml" line="95"/>
<location filename="../../bb10/assets/AboutPage.qml" line="125"/>
<source>This software is distributed under the terms of the Mozilla Public License v.2.0</source>
<translation>Diese Software wird unter den Bestimmungen der Mozilla Public License v.2.0 vertrieben</translation>
</message>
<message>
<location filename="../qml/AboutPage.qml" line="105"/>
<location filename="../../bb10/assets/AboutPage.qml" line="133"/>
<source>Third party components copyrights</source>
<translation>Copyright-Bestandteile von Dritten</translation>
</message>
<message>
<location filename="../qml/AboutPage.qml" line="47"/>
<location filename="../../bb10/assets/AboutPage.qml" line="78"/>
<source>Version %1</source>
<translation>Version %1</translation>
</message>
</context>
<context>
<name>BookmarkEditPage</name>
<message>
<location filename="../qml/BookmarkEditPage.qml" line="45"/>
<location filename="../../bb10/assets/BookmarkEditPage.qml" line="53"/>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
<location filename="../qml/BookmarkEditPage.qml" line="54"/>
<location filename="../qml/BookmarkEditPage.qml" line="55"/>
<location filename="../../bb10/assets/BookmarkEditPage.qml" line="97"/>
<source>Title</source>
<translation>Titel</translation>
</message>
<message>
<location filename="../qml/BookmarkEditPage.qml" line="81"/>
<source>Change</source>
<translation>Ändern</translation>
</message>
<message>
<location filename="../qml/BookmarkEditPage.qml" line="119"/>
<location filename="../../bb10/assets/BookmarkEditPage.qml" line="106"/>
<source>ZIM file is missing</source>
<translation>ZIM Datei nicht gefunden</translation>
</message>
<message>
<location filename="../qml/BookmarkEditPage.qml" line="181"/>
<location filename="../../bb10/assets/BookmarkEditPage.qml" line="36"/>
<source>Something went wrong and bookmark can't be updated</source>
<translation>Der Vorgang schlug fehl; Das Lesezeichen konnte nicht aktualisiert werden</translation>
</message>
<message>
<location filename="../qml/BookmarkEditPage.qml" line="154"/>
<location filename="../../bb10/assets/BookmarkEditPage.qml" line="42"/>
<source>Copy URL</source>
<translation>URL kopieren</translation>
</message>
<message>
<location filename="../qml/BookmarkEditPage.qml" line="156"/>
<location filename="../../bb10/assets/BookmarkEditPage.qml" line="45"/>
<source>URL was copied to the clipboard</source>
<translation>URL wurde in die Zwischenablage kopiert</translation>
</message>
<message>
<location filename="../../bb10/assets/BookmarkEditPage.qml" line="61"/>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
<message>
<location filename="../../bb10/assets/BookmarkEditPage.qml" line="66"/>
<source>Edit bookmark</source>
<translation>Lesezeichen bearbeiten</translation>
</message>
<message>
<location filename="../qml/BookmarkEditPage.qml" line="128"/>
<location filename="../../bb10/assets/BookmarkEditPage.qml" line="124"/>
<source>URL</source>
<translation>URL</translation>
</message>
</context>
<context>
<name>BookmarkFileChoose</name>
<message>
<location filename="../qml/BookmarkFileChoose.qml" line="37"/>
<source>Choose ZIM file</source>
<translation>Wähle eine ZIM Datei</translation>
</message>
<message>
<location filename="../qml/BookmarkFileChoose.qml" line="106"/>
<location filename="../../bb10/assets/BookmarkFileChoose.qml" line="124"/>
<source>No files were found</source>
<translation>Es wurden keine Dateien gefunden</translation>
</message>
<message>
<location filename="../qml/BookmarkFileChoose.qml" line="111"/>
<location filename="../../bb10/assets/BookmarkFileChoose.qml" line="69"/>
<source>Refresh</source>
<translation>Aktualisieren</translation>
</message>
<message>
<location filename="../../bb10/assets/BookmarkFileChoose.qml" line="47"/>
<source>Change ZIM file</source>
<translation>Wechsle die ZIM Datei</translation>
</message>
</context>
<context>
<name>BookmarksPage</name>
<message>
<location filename="../qml/BookmarksPage.qml" line="30"/>
<location filename="../../bb10/assets/BookmarksPage.qml" line="57"/>
<source>Bookmarks</source>
<translation>Lesezeichen</translation>
</message>
<message>
<location filename="../qml/BookmarksPage.qml" line="40"/>
<location filename="../../bb10/assets/BookmarksPage.qml" line="86"/>
<source>Edit</source>
<translation>Bearbeiten</translation>
</message>
<message>
<location filename="../qml/BookmarksPage.qml" line="55"/>
<location filename="../../bb10/assets/BookmarksPage.qml" line="105"/>
<source>Delete</source>
<translation>Löschen</translation>
</message>
<message>
<location filename="../qml/BookmarksPage.qml" line="107"/>
<location filename="../../bb10/assets/BookmarksPage.qml" line="77"/>
<source>ZIM file is missing</source>
<translation>ZIM Datei nicht gefunden</translation>
</message>
<message>
<location filename="../qml/BookmarksPage.qml" line="116"/>
<location filename="../../bb10/assets/BookmarksPage.qml" line="126"/>
<source>Bookmark's ZIM file is missing</source>
<translation>ZIM Datei nicht gefunden</translation>
</message>
<message>
<location filename="../qml/BookmarksPage.qml" line="122"/>
<location filename="../../bb10/assets/BookmarksPage.qml" line="134"/>
<source>No bookmarks</source>
<translation>Keine Lesezeichen</translation>
</message>
</context>
<context>
<name>ChangelogPage</name>
<message>
<location filename="../qml/ChangelogPage.qml" line="33"/>
<location filename="../../bb10/assets/ChangelogPage.qml" line="19"/>
<source>Changelog</source>
<translation>Changelog</translation>
</message>
<message>
<location filename="../qml/ChangelogPage.qml" line="37"/>
<location filename="../../bb10/assets/ChangelogPage.qml" line="44"/>
<source>Version %1</source>
<translation>Version %1</translation>
</message>
</context>
<context>
<name>FilesPage</name>
<message>
<location filename="../qml/FilesPage.qml" line="32"/>
<location filename="../../bb10/assets/FilesPage.qml" line="43"/>
<source>Choose ZIM file</source>
<translation>Wähle eine ZIM Datei</translation>
</message>
<message>
<location filename="../qml/FilesPage.qml" line="53"/>
<location filename="../../bb10/assets/FilesPage.qml" line="119"/>
<source>Show details</source>
<translation>Zeige Details</translation>
</message>
<message>
<location filename="../qml/FilesPage.qml" line="119"/>
<location filename="../../bb10/assets/FilesPage.qml" line="152"/>
<location filename="../../bb10/assets/FilesPage.qml" line="154"/>
<source>No files were found</source>
<translation>Es wurden keine Dateien gefunden</translation>
</message>
<message>
<location filename="../qml/FilesPage.qml" line="124"/>
<location filename="../../bb10/assets/FilesPage.qml" line="153"/>
<source>The ZIM is an open file format that stores wiki content for offline usage. The collection of nice wikis can be downloaded from <a href='http://www.kiwix.org/wiki/Content_in_all_languages'>this page</a>. If you already have some ZIM files, put them to any folder you like under your home directory or SD card.</source>
<translation>ZIM ist ein Dateiformat, welches Wiki Inhalte für die Offline-Nutzung enthält. Eine Auswahl von tollen Wikis kann hier heruntergeladen werden: <a href='http://www.kiwix.org/wiki/Content_in_all_languages'>Kiwix.org</a>. Solltest Du schon einige ZIM Dateien haben, speichere sie in einem beliebigen Ordner Deines Home-Verzeichnisses oder der SD-Karte.</translation>
</message>
<message>
<location filename="../qml/FilesPage.qml" line="134"/>
<source>About</source>
<translation>Über Zimpedia</translation>
</message>
<message>
<location filename="../qml/FilesPage.qml" line="140"/>
<source>Settings</source>
<translation>Einstellungen</translation>
</message>
<message>
<location filename="../qml/FilesPage.qml" line="146"/>
<location filename="../../bb10/assets/FilesPage.qml" line="65"/>
<source>Bookmarks</source>
<translation>Lesezeichen</translation>
</message>
<message>
<location filename="../qml/FilesPage.qml" line="153"/>
<location filename="../../bb10/assets/FilesPage.qml" line="79"/>
<source>Refresh</source>
<translation>Aktualisieren</translation>
</message>
</context>
<context>
<name>SearchPage</name>
<message>
<location filename="../qml/SearchPage.qml" line="65"/>
<location filename="../../bb10/assets/SearchPage.qml" line="121"/>
<source>Open in built-in viewer</source>
<translation>Öffne im internen Betrachter</translation>
</message>
<message>
<location filename="../qml/SearchPage.qml" line="65"/>
<location filename="../../bb10/assets/SearchPage.qml" line="134"/>
<source>Open in browser</source>
<translation>Öffne im Browser</translation>
</message>
<message>
<location filename="../qml/SearchPage.qml" line="77"/>
<location filename="../../bb10/assets/SearchPage.qml" line="144"/>
<source>Add to bookmarks</source>
<translation>Füge zu Lesezeichen hinzu</translation>
</message>
<message>
<location filename="../qml/SearchPage.qml" line="98"/>
<location filename="../../bb10/assets/SearchPage.qml" line="178"/>
<source>Find article, by typing in the search field</source>
<translation>Finde Artikel über die Eingabe im Suchfeld</translation>
</message>
<message>
<location filename="../qml/SearchPage.qml" line="104"/>
<source>About</source>
<translation>Über Zimpedia</translation>
</message>
<message>
<location filename="../qml/SearchPage.qml" line="109"/>
<source>Settings</source>
<translation>Einstellungen</translation>
</message>
<message>
<location filename="../qml/SearchPage.qml" line="114"/>
<location filename="../../bb10/assets/SearchPage.qml" line="85"/>
<source>Change ZIM file</source>
<translation>Wechsle die ZIM Datei</translation>
</message>
<message>
<location filename="../qml/SearchPage.qml" line="119"/>
<location filename="../../bb10/assets/SearchPage.qml" line="71"/>
<source>Bookmarks</source>
<translation>Lesezeichen</translation>
</message>
<message>
<location filename="../qml/SearchPage.qml" line="125"/>
<location filename="../../bb10/assets/SearchPage.qml" line="50"/>
<source>Open main page</source>
<translation>Öffne Hauptseite</translation>
</message>
<message>
<location filename="../qml/SearchPage.qml" line="36"/>
<source>Search</source>
<translation>Suche</translation>
</message>
<message>
<location filename="../../bb10/assets/SearchPage.qml" line="39"/>
<source>Enter search entry</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsPage</name>
<message>
<location filename="../qml/SettingsPage.qml" line="45"/>
<location filename="../../bb10/assets/SettingsPage.qml" line="21"/>
<source>Settings</source>
<translation>Einstellungen</translation>
</message>
<message>
<location filename="../qml/SettingsPage.qml" line="49"/>
<source>UI</source>
<translation>Oberfläche</translation>
</message>
<message>
<location filename="../qml/SettingsPage.qml" line="54"/>
<location filename="../../bb10/assets/SettingsPage.qml" line="52"/>
<source>Default viewer</source>
<translation>Standard Betrachter</translation>
</message>
<message>
<location filename="../qml/SettingsPage.qml" line="58"/>
<location filename="../../bb10/assets/SettingsPage.qml" line="59"/>
<source>Built-in viewer</source>
<translation>interner Betrachter</translation>
</message>
<message>
<location filename="../qml/SettingsPage.qml" line="59"/>
<location filename="../../bb10/assets/SettingsPage.qml" line="65"/>
<source>Browser</source>
<translation>Browser</translation>
</message>
<message>
<location filename="../qml/SettingsPage.qml" line="66"/>
<location filename="../../bb10/assets/SettingsPage.qml" line="53"/>
<source>Wiki pages can be opened in the built-in web viewer or in an external browser.</source>
<translation>Wiki-Seiten können im internen Betrachter oder einem externen Browser geöffnet werden.</translation>
</message>
<message>
<location filename="../qml/SettingsPage.qml" line="72"/>
<location filename="../../bb10/assets/SettingsPage.qml" line="81"/>
<source>Viewer font size level</source>
<translation>Schriftgröße</translation>
</message>
</context>
<context>
<name>WebViewPage</name>
<message>
<location filename="../qml/WebViewPage.qml" line="44"/>
<location filename="../qml/WebViewPage.qml" line="261"/>
<source>Launching an external browser...</source>
<translation>Starte externen Browser...</translation>
</message>
<message>
<location filename="../qml/WebViewPage.qml" line="162"/>
<location filename="../../bb10/assets/WebViewPage.qml" line="50"/>
<location filename="../../bb10/assets/WebViewPage.qml" line="282"/>
<source>Loading page content...</source>
<translation>Lade Inhalte...</translation>
</message>
<message>
<location filename="../qml/WebViewPage.qml" line="170"/>
<location filename="../../bb10/assets/WebViewPage.qml" line="288"/>
<source>Failed to load page content</source>
<translation>Laden der Seite gescheitert</translation>
</message>
<message>
<location filename="../qml/WebViewPage.qml" line="226"/>
<source>Back</source>
<translation>Zurück</translation>
</message>
<message>
<location filename="../qml/WebViewPage.qml" line="233"/>
<source>Toggle Night View</source>
<translation>Nachtansicht</translation>
</message>
<message>
<location filename="../qml/WebViewPage.qml" line="244"/>
<location filename="../../bb10/assets/WebViewPage.qml" line="151"/>
<source>Add to bookmarks</source>
<translation>Füge zu Lesezeichen hinzu</translation>
</message>
<message>
<location filename="../qml/WebViewPage.qml" line="257"/>
<source>Browser</source>
<translation>Browser</translation>
</message>
<message>
<location filename="../qml/WebViewPage.qml" line="268"/>
<location filename="../../bb10/assets/WebViewPage.qml" line="196"/>
<source>Decrease font</source>
<translation>Schrift verkleinern</translation>
</message>
<message>
<location filename="../qml/WebViewPage.qml" line="277"/>
<location filename="../../bb10/assets/WebViewPage.qml" line="185"/>
<source>Increase font</source>
<translation>Schrift vergrößeren</translation>
</message>
<message>
<location filename="../qml/WebViewPage.qml" line="286"/>
<source>Hide toolbar</source>
<translation>Verstecke Werkzeugleiste</translation>
</message>
<message>
<location filename="../../bb10/assets/WebViewPage.qml" line="174"/>
<source>Open in browser</source>
<translation>Öffne im Browser</translation>
</message>
</context>
<context>
<name>ZimInfoPage</name>
<message>
<location filename="../qml/ZimInfoPage.qml" line="45"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="52"/>
<source>Details</source>
<translation>Details</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="65"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="74"/>
<source>Name</source>
<translation>Name</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="70"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="79"/>
<source>Title</source>
<translation>Titel</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="75"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="84"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="80"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="89"/>
<source>Creator</source>
<translation>Urheber</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="85"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="94"/>
<source>Publisher</source>
<translation>Herausgeber</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="90"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="99"/>
<source>Description</source>
<translation>Beschreibung</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="95"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="104"/>
<source>Language</source>
<translation>Sprache</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="100"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="109"/>
<source>Tags</source>
<translation>Tags</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="105"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="114"/>
<source>Source</source>
<translation>Quelle</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="110"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="119"/>
<source>Article count</source>
<translation>Anzahl Artikel</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="115"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="124"/>
<source>Filename</source>
<translation>Dateiname</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="120"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="129"/>
<source>Directory</source>
<translation>Verzeichnis</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="125"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="134"/>
<source>Size</source>
<translation>Größe</translation>
</message>
<message>
<location filename="../qml/ZimInfoPage.qml" line="130"/>
<location filename="../../bb10/assets/ZimInfoPage.qml" line="139"/>
<source>Checksum</source>
<translation>Prüfsumme</translation>
</message>
</context>
<context>
<name>ZimServer</name>
<message>
<location filename="../src/zimserver.cpp" line="526"/>
<source>Main page</source>
<translation>Hauptseite</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../qml/main.qml" line="44"/>
<location filename="../../bb10/assets/main.qml" line="137"/>
<source>Launching an external browser...</source>
<translation>Starte externen Browser...</translation>
</message>
<message>
<location filename="../qml/main.qml" line="56"/>
<location filename="../../bb10/assets/main.qml" line="86"/>
<source>Bookmark has been added</source>
<translation>Lesezeichen wurde hinzugefügt</translation>
</message>
<message>
<location filename="../qml/main.qml" line="57"/>
<location filename="../../bb10/assets/main.qml" line="87"/>
<source>Bookmark already exists</source>
<translation>Das Lesezeichen existiert bereits</translation>
</message>
<message>
<location filename="../qml/main.qml" line="59"/>
<location filename="../../bb10/assets/main.qml" line="88"/>
<source>Bookmark has been updated</source>
<translation>Lesezeichen aktualisiert</translation>
</message>
<message>
<location filename="../../bb10/assets/main.qml" line="70"/>
<source>Preparing ZIM file...</source>
<translation>bereite Zim Datei vor...</translation>
</message>
<message>
<location filename="../../bb10/assets/main.qml" line="148"/>
<source>About</source>
<translation>Über Zimpedia</translation>
</message>
</context>
</TS>
| mkiol/Zimpedia | bb10/translations/Zimpedia_de.ts | TypeScript | mpl-2.0 | 23,740 | [
30522,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
17181,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1029,
1028,
1026,
999,
9986,
13874,
24529,
1028,
1026,
24529,
2544,
1027,
1000,
1016,
1012,
1015,
1000,
2653,
1027,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package net.stickycode.configuration.value;
import net.stickycode.configuration.ConfigurationValue;
public class SystemValue
implements ConfigurationValue {
private String value;
public SystemValue(String value) {
this.value = value;
}
@Override
public String get() {
return value;
}
@Override
public boolean hasPrecedence(ConfigurationValue v) {
if (ApplicationValue.class.isAssignableFrom(v.getClass()))
return false;
if (SystemValue.class.isAssignableFrom(v.getClass()))
return false;
return true;
}
@Override
public String toString() {
return getClass().getSimpleName() + "{" + value + "}";
}
}
| walterDurin/stickycode | net.stickycode.configuration/sticky-configuration/src/main/java/net/stickycode/configuration/value/SystemValue.java | Java | apache-2.0 | 672 | [
30522,
7427,
5658,
1012,
15875,
16044,
1012,
9563,
1012,
3643,
1025,
12324,
5658,
1012,
15875,
16044,
1012,
9563,
1012,
9563,
10175,
5657,
1025,
2270,
2465,
2291,
10175,
5657,
22164,
9563,
10175,
5657,
1063,
2797,
5164,
3643,
1025,
2270,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.lattilad.bestboard.webview;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.Toast;
import org.lattilad.bestboard.Ignition;
import org.lattilad.bestboard.R;
import org.lattilad.bestboard.debug.Debug;
import org.lattilad.bestboard.scribe.Scribe;
import java.io.File;
/**
* Simple webview to show html text
* https://developer.chrome.com/multidevice/webview/gettingstarted
*
* WebView should be retained between activity starts BUT!
* WebView contains the context, so simple fragment retention will leak.
* Activity should be retained.
* http://www.devahead.com/blog/2012/01/preserving-the-state-of-an-android-webview-on-screen-orientation-change/
*/
public class WebViewActivity extends Activity
{
// Retained layout elements
private WebView webView;
private boolean searchBarEnabled = false;
private String retainedSearchText = "";
// Changing layout elements
private FrameLayout webViewFrame;
private ProgressBar progressBar;
private RelativeLayout searchBar;
private EditText searchText;
// Extra of Intents
static final public String ASSET = "ASSET";
static final public String FILE = "FILE";
static final public String WORK = "WORK";
static final public String WEB = "WEB";
static final public String SEARCH = "SEARCH";
protected void initContentView( )
{
Scribe.locus(Debug.WEBVIEW);
setContentView(R.layout.web_view_activity);
webViewFrame = (FrameLayout)findViewById(R.id.webViewFrame);
progressBar = (ProgressBar) findViewById(R.id.progressBar); // default max value = 100
progressBar.setVisibility( View.GONE );
// Cannot be sure, if page is loaded, so no progress bar is shown after config change
searchBar = (RelativeLayout) findViewById(R.id.searchBar);
searchText = (EditText) findViewById(R.id.search);
// Initialize the WebView at new starts
if (webView == null)
{
// Create the webview
webView = new WebView(this);
webView.setLayoutParams(
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setDefaultTextEncodingName("utf-8");
// Load the starting page
String string = null;
Uri uri;
// extra: ASSET
if ( ( string = getIntent().getStringExtra(ASSET) ) != null )
{
string = "file:///android_asset/" + string;
}
// extra: FILE
else if ( ( string = getIntent().getStringExtra(FILE) ) != null &&
Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED ))
{
string = Uri.fromFile( new File( Environment.getExternalStorageDirectory(), string ) ).toString();
}
// extra: WEB
else if ( ( string = getIntent().getStringExtra(WEB) ) != null )
{
if (!string.startsWith("https://") && !string.startsWith("http://"))
{
string = "http://" + string;
}
}
// data: uri
else if ( ( uri = getIntent().getData() ) != null )
{
string = uri.toString();
}
// THIS IS HERE ALSO FOR THE DEFAULT HELP !!
// extra: WORK or default help
else if ( Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED ))
{
if ( (string = getIntent().getStringExtra(WORK) ) == null )
string = "help.html";
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
String directoryName =
sharedPrefs.getString( getString( R.string.descriptor_directory_key ),
getString( R.string.descriptor_directory_default ));
File directoryFile = new File( Environment.getExternalStorageDirectory(), directoryName );
string = Uri.fromFile( new File( directoryFile, string ) ).toString();
}
// END FOR DEFAULT HELP !!
if ( string != null )
{
webView.loadUrl(string);
}
else
{
String customHtml = "<html><body>No uri can be found!</body></html>";
webView.loadData(customHtml, "text/html", "UTF-8");
}
// extra: SEARCH
if ( ( string = getIntent().getStringExtra(SEARCH) ) != null && !string.equals("") )
{
retainedSearchText = string;
searchBarEnabled = true;
}
}
// Attach the WebView to its placeholder
webViewFrame.addView(webView);
findViewById(R.id.back).setOnClickListener(
new View.OnClickListener()
{
@Override
public void onClick(View v)
{
webView.findNext(false); // goBack();
}
});
findViewById(R.id.forth).setOnClickListener(
new View.OnClickListener()
{
@Override
public void onClick(View v)
{
webView.findNext(true); // goForward();
}
});
webView.setWebChromeClient(
new WebChromeClient()
{
public void onProgressChanged(WebView view, int progress)
{
progressBar.setProgress(progress); // default max value = 100
}
});
webView.setWebViewClient(
new WebViewClient()
{
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
Toast.makeText(WebViewActivity.this, description, Toast.LENGTH_SHORT).show();
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon)
{
Scribe.locus(Debug.WEBVIEW);
progressBar.setVisibility(View.VISIBLE);
}
// http://stackoverflow.com/a/32720167
@Override
public void onPageFinished(WebView view, String url)
{
Scribe.locus(Debug.WEBVIEW);
progressBar.setVisibility(View.GONE);
String searchText = WebViewActivity.this.searchText.getText().toString();
if (!searchText.equals(""))
{
webView.findAllAsync(searchText);
}
}
});
searchText.addTextChangedListener(
new TextWatcher()
{
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
webView.findAllAsync(s.toString());
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after)
{
}
@Override
public void afterTextChanged(Editable s)
{
}
});
searchBar.setVisibility(searchBarEnabled ? View.VISIBLE : View.GONE);
searchText.setText( retainedSearchText );
}
protected void onCreate(Bundle savedInstanceState)
{
Scribe.locus(Debug.WEBVIEW);
// Ignition is needed at every entry points - ?? Egy köztes activity maybe ??
Ignition.start( this );
super.onCreate(savedInstanceState);
initContentView();
}
@Override
public void onConfigurationChanged(Configuration newConfig)
{
Scribe.locus(Debug.WEBVIEW);
if (webView != null) webViewFrame.removeView(webView);
retainedSearchText = searchText.getText().toString();
super.onConfigurationChanged(newConfig);
initContentView();
}
@Override
protected void onSaveInstanceState(Bundle outState)
{
Scribe.locus(Debug.WEBVIEW);
super.onSaveInstanceState(outState);
// Save the state of the WebView
webView.saveState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState)
{
Scribe.locus(Debug.WEBVIEW);
super.onRestoreInstanceState(savedInstanceState);
// Restore the state of the WebView
webView.restoreState(savedInstanceState);
}
/**
* BACK functions like BACK on the toolbar, but at the last step this BACK can exit
*/
@Override
public void onBackPressed()
{
if(webView.canGoBack() )
{
webView.goBack();
}
else
{
super.onBackPressed();
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if ( keyCode == KeyEvent.KEYCODE_MENU )
{
if (searchBarEnabled)
{
searchBarEnabled = false;
searchBar.setVisibility(View.GONE);
}
else
{
searchBarEnabled = true;
searchBar.setVisibility(View.VISIBLE);
}
return true;
}
return super.onKeyDown(keyCode, event);
}
}
| Palmodroid/BestBoard | app/src/main/java/org/lattilad/bestboard/webview/WebViewActivity.java | Java | mit | 10,964 | [
30522,
7427,
8917,
1012,
2474,
6916,
27266,
1012,
2190,
6277,
1012,
4773,
8584,
1025,
12324,
11924,
1012,
10439,
1012,
4023,
1025,
12324,
11924,
1012,
4180,
1012,
4207,
28139,
25523,
2015,
1025,
12324,
11924,
1012,
4180,
1012,
24501,
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... |
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 The Voxel Plugineering Team
*
* 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.voxelplugineering.voxelsniper.brush.effect.morphological;
import com.voxelplugineering.voxelsniper.util.math.Maths;
import com.voxelplugineering.voxelsniper.world.World;
import com.voxelplugineering.voxelsniper.world.material.MaterialState;
import com.google.common.collect.Maps;
import java.util.Map;
import java.util.Optional;
/**
* A {@link FilterOperation} for a linear blend effect.
*/
public class LinearBlendMaterialOperation implements FilterOperation
{
private int count;
private double maxDistance;
private Map<MaterialState, Double> mats;
/**
* Creates a new {@link LinearBlendMaterialOperation}.
*/
public LinearBlendMaterialOperation()
{
this.reset();
}
@Override
public String getName()
{
return "blend";
}
@Override
public boolean checkPosition(int x, int y, int z, int dx, int dy, int dz, World w, MaterialState m)
{
if (!(dx == 0 && dy == 0 && dz == 0))
{
// TODO: Use world bounds instead of hardcoded magical values from
// Minecraft.
int clampedY = Maths.clamp(y + dy, 0, 255);
MaterialState mat = w.getBlock(x + dx, clampedY, z + dz).get().getMaterial();
if (this.mats.containsKey(mat))
{
this.mats.put(mat, this.mats.get(mat) + Math.sqrt(dx * dx + dy * dy + dz * dz));
} else
{
this.mats.put(mat, Math.sqrt(dx * dx + dy * dy + dz * dz));
}
this.count++;
this.maxDistance = (Math.sqrt(dx * dx + dy * dy + dz * dz) > this.maxDistance) ? Math.sqrt(dx * dx + dy * dy + dz * dz)
: this.maxDistance;
}
return false;
}
@Override
public Optional<MaterialState> getResult()
{
// Select the material which occurred the most.
double n = 0;
MaterialState winner = null;
for (Map.Entry<MaterialState, Double> e : this.mats.entrySet())
{
if (this.count * this.maxDistance - e.getValue() > n)
{
winner = e.getKey();
n = e.getValue();
}
}
// If multiple materials occurred the most, the tie check will become
// true.
boolean tie = false;
for (Map.Entry<MaterialState, Double> e : this.mats.entrySet())
{
if (e.getValue() == n && !e.getKey().equals(winner))
{
tie = true;
break;
}
}
// If a tie is found, no change is made.
if (!tie)
{
return Optional.of(winner);
}
return Optional.of(null);
}
@Override
public void reset()
{
this.mats = Maps.newHashMapWithExpectedSize(10);
this.count = 0;
this.maxDistance = 0;
}
}
| TVPT/VoxelGunsmith | src/main/java/com/voxelplugineering/voxelsniper/brush/effect/morphological/LinearBlendMaterialOperation.java | Java | mit | 4,052 | [
30522,
1013,
1008,
1008,
1996,
10210,
6105,
1006,
10210,
1007,
1008,
1008,
9385,
1006,
1039,
1007,
2297,
1996,
29450,
2884,
13354,
3170,
7999,
2136,
1008,
1008,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps.h>
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
0xce, 0x00, 0x00, 0x03, 0xb6, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xbd, 0x96, 0x7f, 0x68, 0x95,
0x55, 0x18, 0xc7, 0xbf, 0xe7, 0xde, 0x6d, 0x77, 0x8e, 0x61, 0x33, 0xa1, 0x56, 0x62, 0xb1, 0xfc,
0x91, 0xc9, 0x6c, 0x8d, 0x8a, 0x7e, 0xfc, 0x95, 0x10, 0x15, 0xa6, 0x99, 0x91, 0xab, 0x1c, 0xb5,
0xe8, 0x07, 0x37, 0x8b, 0x4a, 0x6c, 0x26, 0x34, 0x64, 0x8c, 0x8d, 0xcc, 0xb4, 0x41, 0x65, 0x51,
0xfe, 0xb1, 0x4a, 0xa8, 0x60, 0x19, 0x0c, 0xb4, 0x08, 0x11, 0x32, 0xcd, 0xa8, 0x88, 0x58, 0x05,
0x26, 0x06, 0x6b, 0xa5, 0x33, 0x67, 0xe2, 0xb5, 0x6c, 0xf7, 0xbe, 0xe7, 0x9c, 0xe7, 0x47, 0x7f,
0xdc, 0xf7, 0xbd, 0xbb, 0xbb, 0xdc, 0xed, 0x5e, 0x4d, 0x7a, 0xe1, 0xe1, 0x3d, 0xef, 0x79, 0x0e,
0xcf, 0xe7, 0x3c, 0xdf, 0xf7, 0x39, 0xcf, 0xfb, 0x1a, 0x55, 0xc5, 0xff, 0x71, 0xc5, 0x0a, 0x27,
0xd2, 0x3d, 0xed, 0x7d, 0x99, 0xee, 0x75, 0x6b, 0xd0, 0xf5, 0x54, 0xed, 0x7f, 0x8a, 0x9c, 0x4c,
0x56, 0xe6, 0x3f, 0x9a, 0xfc, 0x8c, 0xd2, 0x3d, 0xcf, 0x25, 0x8d, 0x9a, 0xb7, 0xc2, 0xc7, 0xd3,
0x50, 0x7d, 0x1b, 0x71, 0x7d, 0x7d, 0x5a, 0x47, 0xef, 0x48, 0x39, 0xb1, 0x4f, 0x24, 0x1f, 0x9e,
0xa3, 0x4a, 0xcf, 0x42, 0x68, 0x99, 0x8a, 0x4c, 0x03, 0xcb, 0xfa, 0xfa, 0xed, 0x1f, 0x6f, 0x87,
0xaa, 0xe6, 0x40, 0x41, 0xcf, 0xba, 0x06, 0x55, 0xfd, 0x11, 0x40, 0x2d, 0x00, 0xa8, 0x48, 0xd6,
0x58, 0xbc, 0xa8, 0xbe, 0x38, 0xfd, 0x97, 0xd1, 0x6e, 0xf4, 0xf7, 0x73, 0x31, 0xc0, 0x1f, 0xc9,
0x55, 0x0b, 0x0c, 0xc9, 0x0b, 0x2a, 0xbc, 0x4a, 0x59, 0xe2, 0x2a, 0x0c, 0x25, 0x1d, 0x54, 0xe6,
0x4d, 0xb3, 0x4d, 0xcd, 0x47, 0xe8, 0xef, 0xe7, 0x1c, 0x28, 0xdd, 0xb5, 0xf6, 0x3a, 0xa8, 0x6e,
0x14, 0x96, 0x5b, 0xb3, 0x00, 0xce, 0x87, 0x41, 0x59, 0xf6, 0x83, 0xd1, 0x7a, 0xe1, 0x1b, 0x7d,
0x47, 0x22, 0xc0, 0x48, 0xdb, 0xfd, 0xf3, 0x0d, 0xa8, 0x5b, 0x45, 0xee, 0x55, 0xe6, 0x58, 0xb8,
0x36, 0x50, 0xd6, 0x0d, 0x97, 0x37, 0xdd, 0xd0, 0x8b, 0xce, 0x4e, 0x29, 0x2a, 0x1d, 0x00, 0xa4,
0xd6, 0x26, 0x17, 0x19, 0xa3, 0x6b, 0x98, 0xb9, 0x15, 0xcc, 0x89, 0x08, 0x24, 0x59, 0xf8, 0x29,
0x15, 0x7e, 0xf4, 0x92, 0x77, 0x76, 0x0c, 0x8c, 0x3c, 0x78, 0x77, 0x52, 0x49, 0x7a, 0x55, 0xa4,
0x46, 0x38, 0xda, 0x10, 0x1f, 0x50, 0xd2, 0x47, 0xae, 0xf8, 0x64, 0xcf, 0xe1, 0xc2, 0xac, 0xcd,
0x64, 0x55, 0x37, 0xba, 0xfa, 0xa1, 0x8b, 0x8c, 0xf7, 0x2f, 0x8b, 0x70, 0xdb, 0x38, 0x48, 0xa0,
0xc2, 0x0a, 0x96, 0x9f, 0x44, 0xe4, 0x6a, 0x65, 0x8e, 0xe6, 0x49, 0x45, 0x9e, 0x9f, 0x7b, 0xe3,
0x17, 0xaf, 0xa2, 0x53, 0xa5, 0x58, 0x3c, 0x53, 0xaa, 0xbc, 0x47, 0x1e, 0x58, 0x7e, 0xa7, 0x08,
0x6f, 0x13, 0x96, 0x4b, 0x27, 0x48, 0xca, 0x51, 0xa6, 0x9c, 0x11, 0x92, 0x96, 0x05, 0x9f, 0x7f,
0xb5, 0x6b, 0xaa, 0x38, 0xa6, 0x9c, 0x73, 0x34, 0xbc, 0x62, 0x71, 0x1d, 0x7b, 0xf4, 0x29, 0xeb,
0x8a, 0x09, 0x20, 0x91, 0x8c, 0x08, 0xdf, 0xb6, 0x70, 0xff, 0x77, 0x5f, 0x96, 0x8a, 0x51, 0x51,
0x4e, 0xd9, 0xba, 0xb4, 0xad, 0x57, 0xc2, 0x4d, 0x3a, 0xfe, 0x2e, 0x22, 0x58, 0xb5, 0x7a, 0x9d,
0x59, 0x4e, 0x8c, 0x92, 0x19, 0x0d, 0x2e, 0x6e, 0xae, 0xab, 0x72, 0xf1, 0x6f, 0x55, 0x65, 0x5e,
0x21, 0x28, 0x2c, 0x82, 0xd3, 0x31, 0xa1, 0xe6, 0x6b, 0x7e, 0xfe, 0x75, 0xf8, 0xac, 0x3a, 0xc3,
0xc4, 0x6d, 0x98, 0x58, 0x7c, 0x4c, 0x3e, 0x24, 0x6b, 0xe7, 0x51, 0x26, 0x00, 0x05, 0x01, 0x28,
0x13, 0xc0, 0x67, 0x82, 0x1d, 0xde, 0x3a, 0xf2, 0xce, 0xc3, 0x79, 0xaa, 0x4b, 0x33, 0xfa, 0x0f,
0x36, 0x36, 0x56, 0x9d, 0x33, 0xe8, 0x87, 0xa6, 0x2b, 0x37, 0x72, 0x26, 0xb8, 0x23, 0x0b, 0xb1,
0xf0, 0xd6, 0xc1, 0x7b, 0xff, 0xd9, 0xb5, 0x87, 0x86, 0x5a, 0x9c, 0xa7, 0x27, 0x1d, 0x11, 0x1c,
0x11, 0x9c, 0xf7, 0xd7, 0x8f, 0x8e, 0xa5, 0xba, 0xcf, 0x49, 0xba, 0xef, 0xaf, 0x9a, 0xb3, 0x54,
0x80, 0x9d, 0x22, 0x0a, 0xd1, 0xac, 0xa9, 0xea, 0x3f, 0x46, 0xe2, 0x8d, 0x37, 0x0f, 0x0d, 0xfd,
0x06, 0x00, 0x7b, 0x2e, 0x9b, 0xb5, 0x59, 0xa1, 0xed, 0xa1, 0xcf, 0x0b, 0xb8, 0x71, 0xc9, 0xd1,
0x3f, 0x0f, 0x97, 0x9d, 0xd1, 0xde, 0x86, 0x86, 0x6a, 0xcb, 0xfc, 0x9a, 0x8d, 0x76, 0x9c, 0xdb,
0x39, 0x75, 0x44, 0x10, 0x00, 0x38, 0x70, 0xe4, 0xd8, 0x7a, 0xef, 0x69, 0xa7, 0x23, 0x86, 0x25,
0xae, 0xb4, 0x4e, 0x5f, 0x39, 0x2b, 0xe9, 0x62, 0x71, 0x6e, 0x77, 0xc4, 0x0d, 0x61, 0x00, 0x58,
0x62, 0x38, 0xe2, 0x6f, 0xf6, 0xfd, 0x7e, 0x6c, 0x6b, 0xfe, 0xba, 0x4e, 0x55, 0xb1, 0x1a, 0x7b,
0xcc, 0x11, 0x9d, 0x72, 0x44, 0x70, 0x4c, 0x4b, 0x3f, 0x98, 0x79, 0xc1, 0xed, 0x65, 0x49, 0xb7,
0x7b, 0xee, 0xac, 0xd9, 0x31, 0xaf, 0x87, 0x44, 0xb5, 0x46, 0x15, 0x88, 0xa4, 0x33, 0x31, 0x6d,
0x5e, 0x72, 0xf4, 0xc4, 0x60, 0xb1, 0x20, 0xef, 0xcf, 0x98, 0xde, 0x06, 0xc5, 0xbb, 0xa1, 0xc4,
0x07, 0x87, 0xcf, 0x8c, 0x35, 0x75, 0xaa, 0xd2, 0x94, 0x19, 0x49, 0xc0, 0x5b, 0x1c, 0x71, 0x8d,
0x23, 0x86, 0xf5, 0x04, 0x4b, 0x04, 0x4f, 0xf4, 0xe9, 0x64, 0x10, 0x00, 0x68, 0x4d, 0xfd, 0xfd,
0x9e, 0x25, 0xde, 0x6d, 0x89, 0x60, 0x3d, 0x2d, 0xac, 0x4f, 0x24, 0x56, 0x97, 0x94, 0xce, 0x12,
0x8d, 0xba, 0xac, 0x54, 0xe3, 0xe6, 0x65, 0x53, 0xc9, 0x43, 0xcd, 0x92, 0x74, 0xc4, 0x63, 0x59,
0xb9, 0xa9, 0xa3, 0xcb, 0x98, 0xaa, 0x29, 0x41, 0xcb, 0x8f, 0x9f, 0x7c, 0xc6, 0xb2, 0x7f, 0xda,
0x12, 0x71, 0x58, 0x0c, 0x5f, 0xb7, 0xa4, 0x52, 0xfb, 0x4a, 0x81, 0x9e, 0xc8, 0x64, 0x86, 0x2d,
0xf9, 0x0d, 0x8e, 0x08, 0x9e, 0xf9, 0xe2, 0x5a, 0x60, 0x65, 0xc9, 0x62, 0xb8, 0xef, 0xe4, 0x5f,
0x5b, 0x3d, 0xd3, 0x32, 0x47, 0x74, 0x26, 0x20, 0x79, 0xa9, 0xdc, 0xaf, 0x77, 0x85, 0xe0, 0x4d,
0x05, 0x8e, 0x03, 0x80, 0x01, 0x16, 0x4d, 0x70, 0x6a, 0xf6, 0x0c, 0x14, 0xb5, 0x6d, 0x89, 0xc4,
0x7c, 0x0d, 0x0b, 0xa6, 0x5c, 0xdb, 0x0c, 0x3c, 0xbe, 0x05, 0xb8, 0xa7, 0x70, 0x3e, 0x57, 0x75,
0x03, 0xc6, 0xd4, 0x45, 0xf0, 0x4a, 0xc0, 0x00, 0x40, 0x3a, 0xbc, 0x87, 0xdd, 0xd7, 0x14, 0xfa,
0x01, 0x20, 0x13, 0x8e, 0xf3, 0xfd, 0xf1, 0xbc, 0xf1, 0x5d, 0xaa, 0xa3, 0xb9, 0xee, 0xbd, 0xd7,
0x98, 0x6a, 0x03, 0xa4, 0x22, 0x67, 0x54, 0x97, 0x93, 0x35, 0xaf, 0xfc, 0x1f, 0x87, 0x62, 0x6b,
0xf2, 0x0e, 0x8c, 0x05, 0x50, 0x5d, 0xba, 0xa9, 0x9e, 0xc7, 0xab, 0x02, 0x00, 0x6e, 0x51, 0x0d,
0x06, 0x8c, 0x99, 0x71, 0xbe, 0x83, 0xfb, 0xbc, 0xe4, 0xfe, 0x05, 0x6f, 0xa9, 0x1e, 0xe7, 0x5c,
0x0f, 0xb4, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE auto_delete_track_xpm[1] = {{ png, sizeof( png ), "auto_delete_track_xpm" }};
//EOF
| johnbeard/kicad-git | bitmaps_png/cpp_26/auto_delete_track.cpp | C++ | gpl-2.0 | 6,399 | [
30522,
1013,
1008,
2079,
2025,
19933,
2023,
5371,
1010,
2009,
2001,
8073,
7013,
2011,
1996,
1008,
1052,
3070,
2475,
21906,
2361,
4642,
13808,
5896,
1010,
2478,
1037,
1008,
1012,
1052,
3070,
5371,
2004,
7953,
1012,
1008,
1013,
1001,
2421,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 75py
*
* 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.nagopy.android.xposed.utilities.setting;
import android.content.res.XModuleResources;
import android.graphics.Color;
import android.graphics.Typeface;
import com.nagopy.android.xposed.annotation.XIntDefaultValue;
import com.nagopy.android.xposed.annotation.XSettings;
import com.nagopy.android.xposed.annotation.XSettingsHint;
import com.nagopy.android.xposed.annotation.XStringDefaultValue;
import com.nagopy.android.xposed.utilities.util.Const;
@XSettings(modulePackageName = Const.PACKAGE_NAME)
class ModNotificationExpandedClockSettings {
@XSettingsHint(ignore = true)
public XModuleResources moduleResources;
/** モジュールを有効にするかどうか */
public Boolean masterModNotificationExpandedClockEnable;
/** 文字サイズ */
@XIntDefaultValue(100)
public int notificationExpandedClockTimeTextSize;
/** 文字色 */
@XIntDefaultValue(Color.WHITE)
public int notificationExpandedClockTimeTextColor;
/** フォーマット */
@XStringDefaultValue("HH:mm:ss")
public String notificationExpandedClockTimeFormat;
/** 英語表記にするかどうか */
public Boolean notificationExpandedClockTimeForceEnglish;
// ----------------------------------------------
// ----------------------------------------------
// ----------------------------------------------
/** フォントファミリー */
@XStringDefaultValue("DEFAULT")
public String notificationExpandedClockTimeTypefaceKbn;
public String notificationExpandedClockTimeTypefaceName;
@XIntDefaultValue(Typeface.NORMAL)
public Integer notificationExpandedClockTimeTypefaceStyle;
// ----------------------------------------------
// ----------------------------------------------
// ----------------------------------------------
/** デフォルトの文字サイズ */
@XSettingsHint(ignore = true)
public float defaultTimeTextSize;
/** デフォルトの文字色 */
@XSettingsHint(ignore = true)
public int defaultTimeTextColor;
/** デフォルトのフォント */
@XSettingsHint(ignore = true)
public Typeface defaultTimeTypeface;
/** 文字サイズ */
@XIntDefaultValue(100)
public int notificationExpandedClockDateTextSize;
/** 文字色 */
@XIntDefaultValue(Color.WHITE)
public int notificationExpandedClockDateTextColor;
/** フォーマット */
@XStringDefaultValue("yyyy/MM/dd(E)")
public String notificationExpandedClockDateFormat;
/** 英語表記にするかどうか */
public Boolean notificationExpandedClockDateForceEnglish;
// ----------------------------------------------
// ----------------------------------------------
// ----------------------------------------------
/** フォントファミリー */
@XStringDefaultValue("DEFAULT")
public String notificationExpandedClockDateTypefaceKbn;
public String notificationExpandedClockDateTypefaceName;
@XIntDefaultValue(Typeface.NORMAL)
public Integer notificationExpandedClockDateTypefaceStyle;
// ----------------------------------------------
// ----------------------------------------------
// ----------------------------------------------
/** デフォルトの文字サイズ */
@XSettingsHint(ignore = true)
public float defaultDateTextSize;
/** デフォルトの文字色 */
@XSettingsHint(ignore = true)
public int defaultDateTextColor;
/** デフォルトのフォント */
@XSettingsHint(ignore = true)
public Typeface defaultDateTypeface;
}
| 75py/XUtilities | src/com/nagopy/android/xposed/utilities/setting/ModNotificationExpandedClockSettings.java | Java | apache-2.0 | 4,205 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2286,
4293,
7685,
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,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from __future__ import print_function
from __future__ import division
# python bpzchisq2run.py ACS-Subaru
# PRODUCES ACS-Subaru_bpz.cat
# ADDS A FEW THINGS TO THE BPZ CATALOG
# INCLUDING chisq2 AND LABEL HEADERS
# ~/p/bpzchisq2run.py NOW INCLUDED!
# ~/Tonetti/colorpro/bpzfinalize7a.py
# ~/UDF/Elmegreen/phot8/bpzfinalize7.py
# ~/UDF/bpzfinalize7a.py, 7, 5, 4, 23_djh, 23, 3
# NOW TAKING BPZ OUTPUT w/ 3 REDSHIFT PEAKS
# ALSO USING NEW i-band CATALOG istel.cat -- w/ CORRECT IDs
# python bpzfinalize.py bvizjh_cut_sexseg2_allobjs_newres_offset3_djh_Burst_1M
from builtins import range
from past.utils import old_div
from coetools import *
sum = add.reduce # Just to make sure
##################
# add nf, jhgood, stellarity, x, y
inbpz = capfile(sys.argv[1], 'bpz')
inroot = inbpz[:-4]
infile = loadfile(inbpz)
for line in infile:
if line[:7] == '##INPUT':
incat = line[8:]
break
for line in infile:
if line[:9] == '##N_PEAKS':
npeaks = string.atoi(line[10])
break
#inchisq2 = inroot + '.chisq2'
#outbpz = inroot + '_b.bpz'
outbpz = inroot + '_bpz.cat'
if npeaks == 1:
labels = string.split(
'id zb zbmin zbmax tb odds zml tml chisq')
elif npeaks == 3:
labels = string.split(
'id zb zbmin zbmax tb odds zb2 zb2min zb2max tb2 odds2 zb3 zb3min zb3max tb3 odds3 zml tml chisq')
else:
print('N_PEAKS = %d!?' % npeaks)
sys.exit(1)
labelnicks = {'Z_S': 'zspec', 'M_0': 'M0'}
read = 0
ilabel = 0
for iline in range(len(infile)):
line = infile[iline]
if line[:2] == '##':
if read:
break
else:
read = 1
if read == 1:
ilabel += 1
label = string.split(line)[-1]
if ilabel >= 10:
labels.append(labelnicks.get(label, label))
mybpz = loadvarswithclass(inbpz, labels=labels)
mycat = loadvarswithclass(incat)
#icat = loadvarswithclass('/home/coe/UDF/istel.cat')
#icat = icat.takeids(mycat.id)
#bpzchisq2 = loadvarswithclass(inchisq2)
#################################
# CHISQ2, nfdet, nfobs
if os.path.exists(inroot + '.flux_comparison'):
data = loaddata(inroot + '.flux_comparison+')
#nf = 6
nf = old_div((len(data) - 5), 3)
# id M0 zb tb*3
id = data[0]
ft = data[5:5 + nf] # FLUX (from spectrum for that TYPE)
fo = data[5 + nf:5 + 2 * nf] # FLUX (OBSERVED)
efo = data[5 + 2 * nf:5 + 3 * nf] # FLUX_ERROR (OBSERVED)
# chisq 2
eft = old_div(ft, 15.)
eft = max(eft) # for each galaxy, take max eft among filters
ef = sqrt(efo**2 + eft**2) # (6, 18981) + (18981) done correctly
dfosq = (old_div((ft - fo), ef))**2
dfosqsum = sum(dfosq)
detected = greater(fo, 0)
nfdet = sum(detected)
observed = less(efo, 1)
nfobs = sum(observed)
# DEGREES OF FREEDOM
dof = clip2(nfobs - 3., 1, None) # 3 params (z, t, a)
chisq2clip = old_div(dfosqsum, dof)
sedfrac = divsafe(max(fo - efo), max(ft), -1) # SEDzero
chisq2 = chisq2clip[:]
chisq2 = where(less(sedfrac, 1e-10), 900., chisq2)
chisq2 = where(equal(nfobs, 1), 990., chisq2)
chisq2 = where(equal(nfobs, 0), 999., chisq2)
#################################
#print 'BPZ tb N_PEAKS BUG FIX'
#mybpz.tb = mybpz.tb + 0.667
#mybpz.tb2 = where(greater(mybpz.tb2, 0), mybpz.tb2 + 0.667, -1.)
#mybpz.tb3 = where(greater(mybpz.tb3, 0), mybpz.tb3 + 0.667, -1.)
mybpz.add('chisq2', chisq2)
mybpz.add('nfdet', nfdet)
mybpz.add('nfobs', nfobs)
#mybpz.add('jhgood', jhgood)
if 'stel' in mycat.labels:
mybpz.add('stel', mycat.stel)
elif 'stellarity' in mycat.labels:
mybpz.add('stel', mycat.stellarity)
if 'maxsigisoaper' in mycat.labels:
mybpz.add('sig', mycat.maxsigisoaper)
if 'sig' in mycat.labels:
mybpz.assign('sig', mycat.maxsigisoaper)
#mybpz.add('x', mycat.x)
#mybpz.add('y', mycat.y)
if 'zspec' not in mybpz.labels:
if 'zspec' in mycat.labels:
mybpz.add('zspec', mycat.zspec)
print(mycat.zspec)
if 'zqual' in mycat.labels:
mybpz.add('zqual', mycat.zqual)
print(mybpz.labels)
mybpz.save(outbpz, maxy=None)
##################
# det
# 0 < mag < 99
# dmag > 0
# fo > 0
# efo -> 1.6e-8, e.g.
# undet
# mag = 99
# dmag = -m_1sigma
# fo = 0
# efo = 0 -> 5e13, e.g.
# unobs
# mag = -99
# dmag = 0
# fo = 0
# efo = inf (1e108)
## # original chisq usually matches this:
## dfosq = ((ft - fo) / efo) ** 2
## dfosqsum = sum(dfosq)
## observed = less(efo, 1)
## nfobs = sum(observed)
## chisq = dfosqsum / (nfobs - 1.)
| boada/planckClusters | MOSAICpipe/bpz-1.99.3/bpzfinalize.py | Python | mit | 4,563 | [
30522,
2013,
1035,
1035,
2925,
1035,
1035,
12324,
6140,
1035,
3853,
2013,
1035,
1035,
2925,
1035,
1035,
12324,
2407,
1001,
18750,
17531,
2480,
5428,
2015,
4160,
2475,
15532,
1012,
1052,
2100,
9353,
2015,
1011,
4942,
15728,
1001,
7137,
9353,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_17) on Thu Oct 24 15:10:37 CEST 2013 -->
<title>RmcpConstants</title>
<meta name="date" content="2013-10-24">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="RmcpConstants";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/RmcpConstants.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/veraxsystems/vxipmi/coding/rmcp/RmcpClassOfMessage.html" title="enum in com.veraxsystems.vxipmi.coding.rmcp"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../com/veraxsystems/vxipmi/coding/rmcp/RmcpDecoder.html" title="class in com.veraxsystems.vxipmi.coding.rmcp"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/veraxsystems/vxipmi/coding/rmcp/RmcpConstants.html" target="_top">Frames</a></li>
<li><a href="RmcpConstants.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#methods_inherited_from_class_java.lang.Object">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.veraxsystems.vxipmi.coding.rmcp</div>
<h2 title="Class RmcpConstants" class="title">Class RmcpConstants</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.veraxsystems.vxipmi.coding.rmcp.RmcpConstants</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public final class <span class="strong">RmcpConstants</span>
extends java.lang.Object</pre>
<div class="block">Set of constants.
Byte constants are encoded as pseudo unsigned bytes.
RMCPConstants doesn't use <a href="../../../../../com/veraxsystems/vxipmi/common/TypeConverter.html" title="class in com.veraxsystems.vxipmi.common"><code>TypeConverter</code></a> because
fields need to be runtime constants.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../com/veraxsystems/vxipmi/common/TypeConverter.html#byteToInt(byte)"><code>TypeConverter.byteToInt(byte)</code></a>,
<a href="../../../../../com/veraxsystems/vxipmi/common/TypeConverter.html#intToByte(int)"><code>TypeConverter.intToByte(int)</code></a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/veraxsystems/vxipmi/coding/rmcp/RmcpConstants.html#ASFIANA">ASFIANA</a></strong></code>
<div class="block">IANA Enterprise Number = ASF IANA</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static byte</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/veraxsystems/vxipmi/coding/rmcp/RmcpConstants.html#PRESENCE_PING">PRESENCE_PING</a></strong></code>
<div class="block">ASF Message type = Presence Ping</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static byte</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/veraxsystems/vxipmi/coding/rmcp/RmcpConstants.html#RMCP_V1_0">RMCP_V1_0</a></strong></code>
<div class="block">RMCP version 1.0</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="RMCP_V1_0">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>RMCP_V1_0</h4>
<pre>public static final byte RMCP_V1_0</pre>
<div class="block">RMCP version 1.0</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#com.veraxsystems.vxipmi.coding.rmcp.RmcpConstants.RMCP_V1_0">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="ASFIANA">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ASFIANA</h4>
<pre>public static final int ASFIANA</pre>
<div class="block">IANA Enterprise Number = ASF IANA</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#com.veraxsystems.vxipmi.coding.rmcp.RmcpConstants.ASFIANA">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="PRESENCE_PING">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>PRESENCE_PING</h4>
<pre>public static final byte PRESENCE_PING</pre>
<div class="block">ASF Message type = Presence Ping</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#com.veraxsystems.vxipmi.coding.rmcp.RmcpConstants.PRESENCE_PING">Constant Field Values</a></dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/RmcpConstants.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/veraxsystems/vxipmi/coding/rmcp/RmcpClassOfMessage.html" title="enum in com.veraxsystems.vxipmi.coding.rmcp"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../com/veraxsystems/vxipmi/coding/rmcp/RmcpDecoder.html" title="class in com.veraxsystems.vxipmi.coding.rmcp"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/veraxsystems/vxipmi/coding/rmcp/RmcpConstants.html" target="_top">Frames</a></li>
<li><a href="RmcpConstants.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#methods_inherited_from_class_java.lang.Object">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| zhoujinl/jIPMI | doc/com/veraxsystems/vxipmi/coding/rmcp/RmcpConstants.html | HTML | gpl-3.0 | 10,212 | [
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... |
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2013 EMC Corp.
//
// @filename:
// CMDIdCast.cpp
//
// @doc:
// Implementation of mdids for cast functions
//---------------------------------------------------------------------------
#include "naucrates/md/CMDIdCast.h"
#include "naucrates/dxl/xml/CXMLSerializer.h"
using namespace gpos;
using namespace gpmd;
//---------------------------------------------------------------------------
// @function:
// CMDIdCast::CMDIdCast
//
// @doc:
// Ctor
//
//---------------------------------------------------------------------------
CMDIdCast::CMDIdCast
(
CMDIdGPDB *pmdidSrc,
CMDIdGPDB *pmdidDest
)
:
m_pmdidSrc(pmdidSrc),
m_pmdidDest(pmdidDest),
m_str(m_wszBuffer, GPOS_ARRAY_SIZE(m_wszBuffer))
{
GPOS_ASSERT(pmdidSrc->FValid());
GPOS_ASSERT(pmdidDest->FValid());
// serialize mdid into static string
Serialize();
}
//---------------------------------------------------------------------------
// @function:
// CMDIdCast::~CMDIdCast
//
// @doc:
// Dtor
//
//---------------------------------------------------------------------------
CMDIdCast::~CMDIdCast()
{
m_pmdidSrc->Release();
m_pmdidDest->Release();
}
//---------------------------------------------------------------------------
// @function:
// CMDIdCast::Serialize
//
// @doc:
// Serialize mdid into static string
//
//---------------------------------------------------------------------------
void
CMDIdCast::Serialize()
{
// serialize mdid as SystemType.mdidSrc.mdidDest
m_str.AppendFormat
(
GPOS_WSZ_LIT("%d.%d.%d.%d;%d.%d.%d"),
Emdidt(),
m_pmdidSrc->OidObjectId(),
m_pmdidSrc->UlVersionMajor(),
m_pmdidSrc->UlVersionMinor(),
m_pmdidDest->OidObjectId(),
m_pmdidDest->UlVersionMajor(),
m_pmdidDest->UlVersionMinor()
);
}
//---------------------------------------------------------------------------
// @function:
// CMDIdCast::Wsz
//
// @doc:
// Returns the string representation of the mdid
//
//---------------------------------------------------------------------------
const WCHAR *
CMDIdCast::Wsz() const
{
return m_str.Wsz();
}
//---------------------------------------------------------------------------
// @function:
// CMDIdCast::PmdidSrc
//
// @doc:
// Returns the source type id
//
//---------------------------------------------------------------------------
IMDId *
CMDIdCast::PmdidSrc() const
{
return m_pmdidSrc;
}
//---------------------------------------------------------------------------
// @function:
// CMDIdCast::PmdidDest
//
// @doc:
// Returns the destination type id
//
//---------------------------------------------------------------------------
IMDId *
CMDIdCast::PmdidDest() const
{
return m_pmdidDest;
}
//---------------------------------------------------------------------------
// @function:
// CMDIdCast::FEquals
//
// @doc:
// Checks if the mdids are equal
//
//---------------------------------------------------------------------------
BOOL
CMDIdCast::FEquals
(
const IMDId *pmdid
)
const
{
if (NULL == pmdid || EmdidCastFunc != pmdid->Emdidt())
{
return false;
}
const CMDIdCast *pmdidCastFunc = CMDIdCast::PmdidConvert(pmdid);
return m_pmdidSrc->FEquals(pmdidCastFunc->PmdidSrc()) &&
m_pmdidDest->FEquals(pmdidCastFunc->PmdidDest());
}
//---------------------------------------------------------------------------
// @function:
// CMDIdCast::Serialize
//
// @doc:
// Serializes the mdid as the value of the given attribute
//
//---------------------------------------------------------------------------
void
CMDIdCast::Serialize
(
CXMLSerializer * pxmlser,
const CWStringConst *pstrAttribute
)
const
{
pxmlser->AddAttribute(pstrAttribute, &m_str);
}
//---------------------------------------------------------------------------
// @function:
// CMDIdCast::OsPrint
//
// @doc:
// Debug print of the id in the provided stream
//
//---------------------------------------------------------------------------
IOstream &
CMDIdCast::OsPrint
(
IOstream &os
)
const
{
os << "(" << m_str.Wsz() << ")";
return os;
}
// EOF
| PengJi/gporca-comments | libnaucrates/src/md/CMDIdCast.cpp | C++ | apache-2.0 | 4,157 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
30524,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
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... |
(function(){
var languageNav = $('.js-language-nav');
languageNav.on('click', function(){
languageNav.toggleClass('active');
});
//close opened stuff
$(document).on('click', function(e) {
if (!$(e.target).closest('.js-language-nav').length) {
languageNav.removeClass('active');
}
});
})(); | eeriks/velo.lv | velo/static/template/velo-2016/html/js/components/_components.language-nav.js | JavaScript | gpl-3.0 | 354 | [
30522,
1006,
3853,
1006,
1007,
1063,
13075,
2653,
2532,
2615,
1027,
1002,
1006,
1005,
1012,
1046,
2015,
1011,
2653,
1011,
6583,
2615,
1005,
1007,
1025,
2653,
2532,
2615,
1012,
2006,
1006,
1005,
11562,
1005,
1010,
3853,
1006,
1007,
1063,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <Instrument.h> // the base class for this instrument
#include <vector>
using std::vector;
class PHASER : public Instrument {
public:
PHASER();
virtual ~PHASER();
virtual int init(double *, int);
virtual int configure();
virtual int run();
private:
void doupdate();
float *_in;
int _nargs, _inchan, _branch;
float _amp, _wetdry, _pan, _lfofreq, _reverbtime;
int _insamps;
int _numfilters;
Ooscili *lfo;
Oallpassi *allpassptr; // temporary pointer to initialize vector
vector<Oallpassi*> _filtervector; // array of allpass filters
};
| CLOUDS-Interactive-Documentary/RTCmix | insts/std/PHASER/PHASER.h | C | gpl-2.0 | 573 | [
30522,
1001,
2421,
1026,
6602,
1012,
1044,
1028,
1013,
1013,
1996,
2918,
2465,
2005,
2023,
6602,
1001,
2421,
1026,
9207,
1028,
2478,
2358,
2094,
1024,
1024,
9207,
1025,
2465,
4403,
2099,
1024,
2270,
6602,
1063,
2270,
1024,
4403,
2099,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../../../">
<title data-ice="title">js/echo/store/proxy/memory.js | API Document</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
</head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./">Home</a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<a data-ice="repoURL" href="https://github.com/flessard/ECHO-Framework" class="repo-url-github">Repository</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
</header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">components/button</div><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/button/index.js~Button.html">Button</a></span></span></li>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">components/grid</div><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/grid/grid.js~Grid.html">Grid</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/grid/row.js~Row.html">Row</a></span></span></li>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">components/icon</div><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/icon/index.js~Icon.html">Icon</a></span></span></li>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">components/input</div><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/input/text.js~TextInput.html">TextInput</a></span></span></li>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">components/tab</div><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/tab/panel.js~Panel.html">Panel</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/tab/tab.js~Tab.html">Tab</a></span></span></li>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">components/toolbar</div><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/toolbar/bar.js~Bar.html">Bar</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/toolbar/button.js~ToolbarButton.html">ToolbarButton</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/toolbar/flex.js~ToolbarFlex.html">ToolbarFlex</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/components/toolbar/spacer.js~ToolbarSpacer.html">ToolbarSpacer</a></span></span></li>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">echo</div><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/echo/request.js~Request.html">Request</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-console">console</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-alertBox">alertBox</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-messageBox">messageBox</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-warningBox">warningBox</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-id">id</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-docUrl">docUrl</a></span></span></li>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">echo/components</div><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/echo/components/abstract.js~AbstractComponent.html">AbstractComponent</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/echo/components/input.js~AbstractInput.html">AbstractInput</a></span></span></li>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">echo/store</div><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/js/echo/store/abstract.js~AbstractStore.html">AbstractStore</a></span></span></li>
<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">utils</div><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isArray">isArray</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isDefined">isDefined</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isExist">isExist</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isFunction">isFunction</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isObject">isObject</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isString">isString</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-noop">noop</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-ucfirst">ucfirst</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">js/echo/store/proxy/memory.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">/**
* Created by macx on 2016-07-28.
*/
</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(0.4.7)</span></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
| flessard/ECHO-Framework | public/esdoc/file/js/echo/store/proxy/memory.js.html | HTML | gpl-2.0 | 7,816 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
2918,
2951,
1011,
3256,
1027,
1000,
2918,
3126,
2140,
1000,
17850,
12879,
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... |
import { TestBed } from '@angular/core/testing';
import { provideMockActions } from '@ngrx/effects/testing';
import { Action, combineReducers, StoreModule } from '@ngrx/store';
import { ReplaySubject } from 'rxjs';
import { fastTestSetup } from '../../../../test/helpers';
import { MenuService, SharedModule } from '../../shared';
import { SelectNoteAction } from '../note-collection';
import { NoteItemDummy } from '../note-collection/dummies';
import { noteReducerMap } from '../note.reducer';
import { NoteContentDummy } from './dummies';
import { ChangeViewModeAction, LoadNoteContentAction, LoadNoteContentCompleteAction } from './note-editor.actions';
import { NoteEditorEffects } from './note-editor.effects';
import { NoteEditorViewModes } from './note-editor.state';
import { NoteSnippetListManager } from './note-snippet-list-manager';
describe('browser.note.noteEditor.NoteEditorEffects', () => {
let effects: NoteEditorEffects;
let actions: ReplaySubject<Action>;
let snippetListManager: NoteSnippetListManager;
let menu: MenuService;
const noteItemDummy = new NoteItemDummy();
const noteContentDummy = new NoteContentDummy();
fastTestSetup();
beforeAll(() => {
actions = new ReplaySubject<Action>(1);
snippetListManager = jasmine.createSpyObj('snippetListManager', [
'removeAllSnippets',
'addAllSnippetsFromContent',
]);
TestBed
.configureTestingModule({
imports: [
SharedModule,
StoreModule.forRoot({
note: combineReducers(noteReducerMap),
}),
],
providers: [
{ provide: NoteSnippetListManager, useValue: snippetListManager },
NoteEditorEffects,
provideMockActions(() => actions),
],
});
});
beforeEach(() => {
effects = TestBed.get(NoteEditorEffects);
menu = TestBed.get(MenuService);
});
describe('loadNoteContentWhenNoteSelected', () => {
it('should return \'LOAD_NOTE_CONTENT\' action.', () => {
const callback = jasmine.createSpy('callback');
const subscription = effects.loadNoteContentWhenNoteSelected.subscribe(callback);
const note = noteItemDummy.create();
actions.next(new SelectNoteAction({ note }));
expect(callback).toHaveBeenCalledWith(new LoadNoteContentAction({ note: note }));
subscription.unsubscribe();
});
});
describe('afterNoteContentLoaded', () => {
it('should call \'removeAllSnippets\' and \'addAllSnippetsFromContent\' from note snippet '
+ 'list manager for side effects.', () => {
const callback = jasmine.createSpy('callback');
const subscription = effects.afterNoteContentLoaded.subscribe(callback);
const note = noteItemDummy.create();
const content = noteContentDummy.createFromNote(note);
actions.next(new LoadNoteContentCompleteAction({ note, content }));
expect(snippetListManager.removeAllSnippets).toHaveBeenCalled();
expect(snippetListManager.addAllSnippetsFromContent).toHaveBeenCalledWith(content);
subscription.unsubscribe();
});
});
describe('updateNoteViewMenuState', () => {
it('should call menu \'updateNoteEditorViewMenuState\'.', () => {
const callback = jasmine.createSpy('callback');
const subscription = effects.updateNoteViewMenuState.subscribe(callback);
spyOn(menu, 'updateNoteEditorViewMenuState');
actions.next(new ChangeViewModeAction({ viewMode: NoteEditorViewModes.SHOW_BOTH }));
expect(menu.updateNoteEditorViewMenuState).toHaveBeenCalledWith('note-view-show-both');
actions.next(new ChangeViewModeAction({ viewMode: NoteEditorViewModes.EDITOR_ONLY }));
expect(menu.updateNoteEditorViewMenuState).toHaveBeenCalledWith('note-view-editor-only');
actions.next(new ChangeViewModeAction({ viewMode: NoteEditorViewModes.PREVIEW_ONLY }));
expect(menu.updateNoteEditorViewMenuState).toHaveBeenCalledWith('note-view-preview-only');
subscription.unsubscribe();
});
});
});
| seokju-na/geeks-diary | src/browser/note/note-editor/note-editor.effects.spec.ts | TypeScript | mit | 4,380 | [
30522,
12324,
1063,
3231,
8270,
1065,
2013,
1005,
1030,
16108,
1013,
4563,
1013,
5604,
1005,
1025,
12324,
1063,
3073,
5302,
3600,
18908,
8496,
1065,
2013,
1005,
1030,
12835,
2099,
2595,
1013,
3896,
1013,
5604,
1005,
1025,
12324,
1063,
2895,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Parcel example
## How to use
Download the example [or clone the repo](https://github.com/mui-org/material-ui):
```bash
curl https://codeload.github.com/mui-org/material-ui/tar.gz/v1-beta | tar -xz --strip=2 material-ui-1-beta/examples/parcel
cd parcel
```
Install it and run:
```bash
npm install
npm run start
```
## The idea behind the example
[Parcel](https://github.com/parcel-bundler/parcel) is a Blazing fast, zero configuration web application bundler.
| cherniavskii/material-ui | examples/parcel/README.md | Markdown | mit | 469 | [
30522,
1001,
20463,
2742,
1001,
1001,
2129,
2000,
2224,
8816,
1996,
2742,
1031,
2030,
17598,
1996,
16360,
2080,
1033,
1006,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
14163,
2072,
1011,
8917,
1013,
3430,
1011,
21318,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
echo. coverage to run coverage check of the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% 2> nul
if errorlevel 9009 goto sphinx_python
goto sphinx_ok
:sphinx_python
set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
:sphinx_ok
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\rsas.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\rsas.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "coverage" (
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
if errorlevel 1 exit /b 1
echo.
echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
:end
| charman2/rsas | docs/make.bat | Batchfile | mit | 7,240 | [
30522,
1030,
9052,
2125,
2128,
2213,
3094,
5371,
2005,
27311,
12653,
2065,
1000,
1003,
27311,
8569,
4014,
2094,
1003,
1000,
1027,
1027,
1000,
1000,
1006,
2275,
27311,
8569,
4014,
2094,
1027,
27311,
1011,
3857,
1007,
2275,
3857,
4305,
2099,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
date: "2015-10-07T00:00:00Z"
link: http://musicemojis.tumblr.com/
remoteImage: true
title: Music Emojis
category: Inspiration
---
_A showcase of musicians in the minimal style of emojis!_
By [Bruno Leo Ribeiro](http://www.brunoleoribeiro.com/#kauko-home)
| tholman/inspiring-online | content/posts/2015-09-12-music-emojis.md | Markdown | gpl-3.0 | 261 | [
30522,
1011,
1011,
1011,
3058,
1024,
1000,
2325,
1011,
2184,
1011,
5718,
2102,
8889,
1024,
4002,
1024,
4002,
2480,
1000,
4957,
1024,
8299,
1024,
1013,
1013,
2189,
6633,
29147,
2483,
1012,
10722,
14905,
20974,
1012,
4012,
1013,
6556,
9581,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 <stdio.h>
#include "list.h"
#define N 10
link reverse(link);
int main(void) {
int i;
link head, x;
// Population
head = new_link(0);
x = head;
for (i = 1; i < N; ++i) {
x = insert_after(x, new_link(i));
}
// Reversal
head = reverse(head);
// Traversal
x = head;
do {
printf("%i\n", x->item);
x = x->next;
} while (x != head);
return 0;
}
link reverse(link x) {
link t;
link y = x;
link r = NULL;
do {
t = y->next;
y->next = r;
r = y;
y = t;
} while (y != x);
x->next = r;
return r;
}
| bartobri/data-structures-c | linked-lists/circular-reversal/main.c | C | mit | 546 | [
30522,
1001,
2421,
1026,
2358,
20617,
1012,
1044,
1028,
1001,
2421,
1000,
2862,
1012,
1044,
1000,
1001,
9375,
1050,
2184,
4957,
7901,
1006,
4957,
1007,
1025,
20014,
2364,
1006,
11675,
1007,
1063,
20014,
1045,
1025,
4957,
2132,
1010,
1060,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* gedit-theatrics-utils.h
* This file is part of gedit
*
* Copyright (C) 2010 - Ignacio Casal Quinteiro
*
* Based on Mike Krüger <mkrueger@novell.com> work.
*
* gedit is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* gedit 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 gedit; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef __GEDIT_THEATRICS_UTILS_H__
#define __GEDIT_THEATRICS_UTILS_H__
#include <glib.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
void gedit_theatrics_utils_draw_round_rectangle (cairo_t *cr,
gboolean top_left_round,
gboolean top_right_round,
gboolean bottom_left_round,
gboolean bottom_right_round,
gdouble x,
gdouble y,
gdouble r,
gdouble w,
gdouble h);
G_END_DECLS
#endif /* __GEDIT_THEATRICS_UTILS_H__ */
/* ex:set ts=8 noet: */
| dtrebbien/gedit | gedit/theatrics/gedit-theatrics-utils.h | C | gpl-2.0 | 1,391 | [
30522,
1013,
1008,
1008,
16216,
23194,
1011,
1996,
4017,
7277,
2015,
1011,
21183,
12146,
1012,
1044,
1008,
2023,
5371,
2003,
2112,
1997,
16216,
23194,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
1011,
22988,
14124,
2140,
21864,
10111,
9711,
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... |
/**
* A special placeholder value used to specify "gaps" within curried functions,
* allowing partial application of any combination of arguments,
* regardless of their positions.
*
* If `g` is a curried ternary function and `_` is `R.__`, the following are equivalent:
*
* - `g(1, 2, 3)`
* - `g(_, 2, 3)(1)`
* - `g(_, _, 3)(1)(2)`
* - `g(_, _, 3)(1, 2)`
* - `g(_, 2, _)(1, 3)`
* - `g(_, 2)(1)(3)`
* - `g(_, 2)(1, 3)`
* - `g(_, 2)(_, 3)(1)`
*
* @constant
* @memberOf R
* @category Function
* @example
*
* var greet = R.replace('{name}', R.__, 'Hello, {name}!');
* greet('Alice'); //=> 'Hello, Alice!'
*/
module.exports = {'@@functional/placeholder': true};
| concertcoder/leaky-ionic-app | www/lib/ramda/src/__.js | JavaScript | mit | 706 | [
30522,
1013,
1008,
1008,
1008,
1037,
2569,
2173,
14528,
3643,
2109,
2000,
20648,
1000,
16680,
1000,
2306,
20667,
2094,
4972,
1010,
1008,
4352,
7704,
4646,
1997,
2151,
5257,
1997,
9918,
1010,
1008,
7539,
1997,
2037,
4460,
1012,
1008,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- test-case-name: txdav.common.datastore.upgrade.sql.test -*-
# #
# Copyright (c) 2011-2015 Apple 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.
# #
from twext.enterprise.dal.syntax import Update
from twisted.internet.defer import inlineCallbacks
from txdav.base.propertystore.base import PropertyName
from txdav.common.datastore.sql_tables import _ABO_KIND_GROUP, schema
from txdav.common.datastore.upgrade.sql.upgrades.util import updateAddressBookDataVersion, \
doToEachHomeNotAtVersion, removeProperty, cleanPropertyStore, \
logUpgradeStatus
from txdav.xml import element
"""
AddressBook Data upgrade from database version 1 to 2
"""
UPGRADE_TO_VERSION = 2
@inlineCallbacks
def doUpgrade(sqlStore):
"""
fill in members tables and increment data version
"""
yield populateMemberTables(sqlStore)
yield removeResourceType(sqlStore)
# bump data version
yield updateAddressBookDataVersion(sqlStore, UPGRADE_TO_VERSION)
@inlineCallbacks
def populateMemberTables(sqlStore):
"""
Set the group kind and and members tables
"""
@inlineCallbacks
def doIt(txn, homeResourceID):
"""
KIND is set to person by schema upgrade.
To upgrade MEMBERS and FOREIGN_MEMBERS:
1. Set group KIND (avoids assert)
2. Write groups. Write logic will fill in MEMBERS and FOREIGN_MEMBERS
(Remember that all members resource IDs must already be in the address book).
"""
home = yield txn.addressbookHomeWithResourceID(homeResourceID)
abObjectResources = yield home.addressbook().objectResources()
for abObject in abObjectResources:
component = yield abObject.component()
lcResourceKind = component.resourceKind().lower() if component.resourceKind() else component.resourceKind()
if lcResourceKind == "group":
# update kind
abo = schema.ADDRESSBOOK_OBJECT
yield Update(
{abo.KIND: _ABO_KIND_GROUP},
Where=abo.RESOURCE_ID == abObject._resourceID,
).on(txn)
abObject._kind = _ABO_KIND_GROUP
# update rest
yield abObject.setComponent(component)
logUpgradeStatus("Starting Addressbook Populate Members")
# Do this to each calendar home not already at version 2
yield doToEachHomeNotAtVersion(sqlStore, schema.ADDRESSBOOK_HOME, UPGRADE_TO_VERSION, doIt, "Populate Members")
@inlineCallbacks
def removeResourceType(sqlStore):
logUpgradeStatus("Starting Addressbook Remove Resource Type")
sqlTxn = sqlStore.newTransaction(label="addressbook_upgrade_from_1_to_2.removeResourceType")
yield removeProperty(sqlTxn, PropertyName.fromElement(element.ResourceType))
yield sqlTxn.commit()
yield cleanPropertyStore()
logUpgradeStatus("End Addressbook Remove Resource Type")
| red-hood/calendarserver | txdav/common/datastore/upgrade/sql/upgrades/addressbook_upgrade_from_1_to_2.py | Python | apache-2.0 | 3,445 | [
30522,
1001,
1011,
1008,
1011,
3231,
1011,
2553,
1011,
2171,
1024,
19067,
29045,
1012,
2691,
1012,
2951,
23809,
2063,
1012,
12200,
1012,
29296,
1012,
3231,
1011,
1008,
1011,
1001,
1001,
1001,
9385,
1006,
1039,
1007,
2249,
1011,
2325,
6207,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 Functionality\NavbarBundle\Form\Type\NavbarLinkType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class NavbarLinkNavbarLinkRefType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$readOnly = $options['readOnly'];
$builder
->add('routePath', 'text', array('read_only' => $readOnly));
->add('navbarLinkRefOptions', 'collection', array(
'type'=> new NavbarLinkNavbarLinkRefOptionType(),
'options' => $options,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'read_only' => $readOnly,
))
;
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Functionality\NavbarBundle\Entity\NavbarLinkRef',
'readOnly' => false,
));
}
public function getName()
{
return 'NavbarLink_NavbarLinkRef';
}
} | Namzar/BasicBlog | src/Functionality/NavbarBundle/Form/Type/NavbarLinkType/NavbarLinkNavbarLinkRefType.php | PHP | mit | 1,027 | [
30522,
1026,
1029,
25718,
3415,
15327,
15380,
1032,
6583,
26493,
2906,
27265,
2571,
1032,
2433,
1032,
2828,
1032,
6583,
26493,
2906,
13767,
13874,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
2433,
1032,
10061,
13874,
1025,
2224,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 -*-
// Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com>
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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 <COPYRIGHT HOLDER> 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.
import { expect } from 'chai';
import { parse } from '../third_party/esprima';
import { analyze } from '..';
describe('ES6 block scope', function() {
it('let is materialized in ES6 block scope#1', function() {
const ast = parse(`
{
let i = 20;
i;
}
`);
const scopeManager = analyze(ast, {ecmaVersion: 6});
expect(scopeManager.scopes).to.have.length(2); // Program and BlcokStatement scope.
let scope = scopeManager.scopes[0];
expect(scope.type).to.be.equal('global');
expect(scope.variables).to.have.length(0); // No variable in Program scope.
scope = scopeManager.scopes[1];
expect(scope.type).to.be.equal('block');
expect(scope.variables).to.have.length(1); // `i` in block scope.
expect(scope.variables[0].name).to.be.equal('i');
expect(scope.references).to.have.length(2);
expect(scope.references[0].identifier.name).to.be.equal('i');
expect(scope.references[1].identifier.name).to.be.equal('i');
});
it('let is materialized in ES6 block scope#2', function() {
const ast = parse(`
{
let i = 20;
var i = 20;
i;
}
`);
const scopeManager = analyze(ast, {ecmaVersion: 6});
expect(scopeManager.scopes).to.have.length(2); // Program and BlcokStatement scope.
let scope = scopeManager.scopes[0];
expect(scope.type).to.be.equal('global');
expect(scope.variables).to.have.length(1); // No variable in Program scope.
expect(scope.variables[0].name).to.be.equal('i');
scope = scopeManager.scopes[1];
expect(scope.type).to.be.equal('block');
expect(scope.variables).to.have.length(1); // `i` in block scope.
expect(scope.variables[0].name).to.be.equal('i');
expect(scope.references).to.have.length(3);
expect(scope.references[0].identifier.name).to.be.equal('i');
expect(scope.references[1].identifier.name).to.be.equal('i');
expect(scope.references[2].identifier.name).to.be.equal('i');
});
it('function delaration is materialized in ES6 block scope', function() {
const ast = parse(`
{
function test() {
}
test();
}
`);
const scopeManager = analyze(ast, {ecmaVersion: 6});
expect(scopeManager.scopes).to.have.length(3);
let scope = scopeManager.scopes[0];
expect(scope.type).to.be.equal('global');
expect(scope.variables).to.have.length(0);
scope = scopeManager.scopes[1];
expect(scope.type).to.be.equal('block');
expect(scope.variables).to.have.length(1);
expect(scope.variables[0].name).to.be.equal('test');
expect(scope.references).to.have.length(1);
expect(scope.references[0].identifier.name).to.be.equal('test');
scope = scopeManager.scopes[2];
expect(scope.type).to.be.equal('function');
expect(scope.variables).to.have.length(1);
expect(scope.variables[0].name).to.be.equal('arguments');
expect(scope.references).to.have.length(0);
});
it('let is not hoistable#1', function() {
const ast = parse(`
var i = 42; (1)
{
i; // (2) ReferenceError at runtime.
let i = 20; // (2)
i; // (2)
}
`);
const scopeManager = analyze(ast, {ecmaVersion: 6});
expect(scopeManager.scopes).to.have.length(2);
const globalScope = scopeManager.scopes[0];
expect(globalScope.type).to.be.equal('global');
expect(globalScope.variables).to.have.length(1);
expect(globalScope.variables[0].name).to.be.equal('i');
expect(globalScope.references).to.have.length(1);
const scope = scopeManager.scopes[1];
expect(scope.type).to.be.equal('block');
expect(scope.variables).to.have.length(1);
expect(scope.variables[0].name).to.be.equal('i');
expect(scope.references).to.have.length(3);
expect(scope.references[0].resolved).to.be.equal(scope.variables[0]);
expect(scope.references[1].resolved).to.be.equal(scope.variables[0]);
expect(scope.references[2].resolved).to.be.equal(scope.variables[0]);
});
it('let is not hoistable#2', function() {
const ast = parse(`
(function () {
var i = 42; // (1)
i; // (1)
{
i; // (3)
{
i; // (2)
let i = 20; // (2)
i; // (2)
}
let i = 30; // (3)
i; // (3)
}
i; // (1)
}());
`);
const scopeManager = analyze(ast, {ecmaVersion: 6});
expect(scopeManager.scopes).to.have.length(4);
const globalScope = scopeManager.scopes[0];
expect(globalScope.type).to.be.equal('global');
expect(globalScope.variables).to.have.length(0);
expect(globalScope.references).to.have.length(0);
let scope = scopeManager.scopes[1];
expect(scope.type).to.be.equal('function');
expect(scope.variables).to.have.length(2);
expect(scope.variables[0].name).to.be.equal('arguments');
expect(scope.variables[1].name).to.be.equal('i');
const v1 = scope.variables[1];
expect(scope.references).to.have.length(3);
expect(scope.references[0].resolved).to.be.equal(v1);
expect(scope.references[1].resolved).to.be.equal(v1);
expect(scope.references[2].resolved).to.be.equal(v1);
scope = scopeManager.scopes[2];
expect(scope.type).to.be.equal('block');
expect(scope.variables).to.have.length(1);
expect(scope.variables[0].name).to.be.equal('i');
const v3 = scope.variables[0];
expect(scope.references).to.have.length(3);
expect(scope.references[0].resolved).to.be.equal(v3);
expect(scope.references[1].resolved).to.be.equal(v3);
expect(scope.references[2].resolved).to.be.equal(v3);
scope = scopeManager.scopes[3];
expect(scope.type).to.be.equal('block');
expect(scope.variables).to.have.length(1);
expect(scope.variables[0].name).to.be.equal('i');
const v2 = scope.variables[0];
expect(scope.references).to.have.length(3);
expect(scope.references[0].resolved).to.be.equal(v2);
expect(scope.references[1].resolved).to.be.equal(v2);
expect(scope.references[2].resolved).to.be.equal(v2);
});
});
// vim: set sw=4 ts=4 et tw=80 :
| mysticatea/escope | test/es6-block-scope.js | JavaScript | bsd-2-clause | 8,227 | [
30522,
1013,
1013,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1013,
1013,
9385,
1006,
1039,
1007,
2297,
9805,
16867,
14278,
1026,
28981,
5794,
2063,
1012,
5572,
1030,
20917,
4014,
1012,
4012,
1028,
1013,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2013 47 Degrees, LLC
* http://47deg.com
* hello@47deg.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 com.xinxin.everyxday.widget.swipelistview;
/**
* Listener to get callback notifications for the SwipeListView
*/
public interface SwipeListViewListener {
/**
* Called when open animation finishes
* @param position of the view in the list
* @param toRight Open to right
*/
void onOpened(int position, boolean toRight);
/**
* Called when close animation finishes
* @param position of the view in the list
* @param fromRight Close from right
*/
void onClosed(int position, boolean fromRight);
/**
* Called when the list changed
*/
void onListChanged();
/**
* Called when user is moving an item
* @param position of the view in the list
* @param x Current position X
*/
void onMove(int position, float x);
/**
* Start open item
* @param position of the view in the list
* @param action current action
* @param right to right
*/
void onStartOpen(int position, int action, boolean right);
/**
* Start close item
* @param position of the view in the list
* @param right
*/
void onStartClose(int position, boolean right);
/**
* Called when user clicks on the front view
* @param position of the view in the list
*/
void onClickFrontView(int position);
/**
* Called when user clicks on the back view
* @param position of the view in the list
*/
void onClickBackView(int position);
/**
* Called when user dismisses items
* @param reverseSortedPositions Items dismissed
*/
void onDismiss(int[] reverseSortedPositions);
/**
* Used when user want to change swipe list mode on some rows. Return SWIPE_MODE_DEFAULT
* if you don't want to change swipe list mode
* @param position position that you want to change
* @return type
*/
int onChangeSwipeMode(int position);
/**
* Called when user choice item
* @param position of the view in the list that choice
* @param selected if item is selected or not
*/
void onChoiceChanged(int position, boolean selected);
/**
* User start choice items
*/
void onChoiceStarted();
/**
* User end choice items
*/
void onChoiceEnded();
/**
* User is in first item of list
*/
void onFirstListItem();
/**
* User is in last item of list
*/
void onLastListItem();
}
| x251089003/EveryXDay | EveryXDay/src/main/java/com/xinxin/everyxday/widget/swipelistview/SwipeListViewListener.java | Java | apache-2.0 | 3,114 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2286,
4700,
5445,
1010,
11775,
1008,
8299,
1024,
1013,
1013,
4700,
3207,
2290,
1012,
4012,
1008,
7592,
1030,
4700,
3207,
2290,
1012,
4012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
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... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>tools — Translate Toolkit 1.11.0 documentation</title>
<link rel="stylesheet" href="../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.11.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/bootstrap.js"></script>
<script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
<link rel="top" title="Translate Toolkit 1.11.0 documentation" href="../index.html" />
<link rel="up" title="API" href="index.html" />
<link rel="prev" title="storage" href="storage.html" />
</head>
<body>
<div id="navbar" class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="../index.html">Translate Toolkit</a>
<span class="navbar-text pull-left"><b>1.11.0</b></span>
<ul class="nav">
<li class="divider-vertical"></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"><ul class="simple">
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../features.html">Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../commands/index.html">Converters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../commands/index.html#tools">Tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../commands/index.html#scripts">Scripts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../guides/index.html">Use Cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="../formats/index.html">Supported formats</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../developers/styleguide.html">Translate Styleguide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../developers/styleguide.html#documentation">Documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../developers/building.html">Building</a></li>
<li class="toctree-l1"><a class="reference internal" href="../developers/testing.html">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../developers/contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../developers/developers.html">Translate Toolkit Developers Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../developers/releasing.html">Making a Translate Toolkit Release</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="../releases/index.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../history.html">History of the Translate Toolkit</a></li>
<li class="toctree-l1"><a class="reference internal" href="../license.html">License</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="index.html">API</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"><ul>
<li><a class="reference internal" href="#">tools</a><ul>
<li><a class="reference internal" href="#module-translate.tools.build_tmdb">build_tmdb</a></li>
<li><a class="reference internal" href="#module-translate.tools.phppo2pypo">phppo2pypo</a></li>
<li><a class="reference internal" href="#module-translate.tools.poclean">poclean</a></li>
<li><a class="reference internal" href="#module-translate.tools.pocompile">pocompile</a></li>
<li><a class="reference internal" href="#module-translate.tools.poconflicts">poconflicts</a></li>
<li><a class="reference internal" href="#module-translate.tools.pocount">pocount</a></li>
<li><a class="reference internal" href="#module-translate.tools.podebug">podebug</a></li>
<li><a class="reference internal" href="#module-translate.tools.pogrep">pogrep</a></li>
<li><a class="reference internal" href="#module-translate.tools.pomerge">pomerge</a></li>
<li><a class="reference internal" href="#module-translate.tools.porestructure">porestructure</a></li>
<li><a class="reference internal" href="#module-translate.tools.posegment">posegment</a></li>
<li><a class="reference internal" href="#module-translate.tools.poswap">poswap</a></li>
<li><a class="reference internal" href="#module-translate.tools.poterminology">poterminology</a></li>
<li><a class="reference internal" href="#module-translate.tools.pretranslate">pretranslate</a></li>
<li><a class="reference internal" href="#module-translate.tools.pydiff">pydiff</a></li>
<li><a class="reference internal" href="#module-translate.tools.pypo2phppo">pypo2phppo</a></li>
</ul>
</li>
</ul>
</ul>
</li>
<li><a href="storage.html"
title="previous chapter">« storage</a></li>
</ul>
<ul class="nav pull-right">
<form class="navbar-search pull-right" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</ul>
</div>
</div>
</div>
</div>
<div class="container content">
<div class="section" id="module-translate.tools">
<span id="tools"></span><h1>tools<a class="headerlink" href="#module-translate.tools" title="Permalink to this headline">¶</a></h1>
<p>Code to perform various operations, mostly on po files.</p>
<div class="section" id="module-translate.tools.build_tmdb">
<span id="build-tmdb"></span><h2>build_tmdb<a class="headerlink" href="#module-translate.tools.build_tmdb" title="Permalink to this headline">¶</a></h2>
<p>Import units from translations files into tmdb.</p>
</div>
<div class="section" id="module-translate.tools.phppo2pypo">
<span id="phppo2pypo"></span><h2>phppo2pypo<a class="headerlink" href="#module-translate.tools.phppo2pypo" title="Permalink to this headline">¶</a></h2>
<p>Convert PHP format .po files to Python format .po files.</p>
<dl class="function">
<dt id="translate.tools.phppo2pypo.convertphp2py">
<tt class="descclassname">translate.tools.phppo2pypo.</tt><tt class="descname">convertphp2py</tt><big>(</big><em>inputfile</em>, <em>outputfile</em>, <em>template=None</em><big>)</big><a class="headerlink" href="#translate.tools.phppo2pypo.convertphp2py" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts from PHP .po format to Python .po format</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>inputfile</strong> – file handle of the source</li>
<li><strong>outputfile</strong> – file handle to write to</li>
<li><strong>template</strong> – unused</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="translate.tools.phppo2pypo.main">
<tt class="descclassname">translate.tools.phppo2pypo.</tt><tt class="descname">main</tt><big>(</big><em>argv=None</em><big>)</big><a class="headerlink" href="#translate.tools.phppo2pypo.main" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts PHP .po files to Python .po files.</p>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.poclean">
<span id="poclean"></span><h2>poclean<a class="headerlink" href="#module-translate.tools.poclean" title="Permalink to this headline">¶</a></h2>
<p>Produces a clean file from an unclean file (Trados/Wordfast) by stripping
out the tw4win indicators.</p>
<p>This does not convert an RTF file to PO/XLIFF, but produces the target file
with only the target text in from a text version of the RTF.</p>
<dl class="function">
<dt id="translate.tools.poclean.cleanfile">
<tt class="descclassname">translate.tools.poclean.</tt><tt class="descname">cleanfile</tt><big>(</big><em>thefile</em><big>)</big><a class="headerlink" href="#translate.tools.poclean.cleanfile" title="Permalink to this definition">¶</a></dt>
<dd><p>cleans the given file</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.poclean.cleanunit">
<tt class="descclassname">translate.tools.poclean.</tt><tt class="descname">cleanunit</tt><big>(</big><em>unit</em><big>)</big><a class="headerlink" href="#translate.tools.poclean.cleanunit" title="Permalink to this definition">¶</a></dt>
<dd><p>cleans the targets in the given unit</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.poclean.runclean">
<tt class="descclassname">translate.tools.poclean.</tt><tt class="descname">runclean</tt><big>(</big><em>inputfile</em>, <em>outputfile</em>, <em>templatefile</em><big>)</big><a class="headerlink" href="#translate.tools.poclean.runclean" title="Permalink to this definition">¶</a></dt>
<dd><p>reads in inputfile, cleans, writes to outputfile</p>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.pocompile">
<span id="pocompile"></span><h2>pocompile<a class="headerlink" href="#module-translate.tools.pocompile" title="Permalink to this headline">¶</a></h2>
<p>Compile XLIFF and Gettext PO localization files into Gettext MO (Machine Object) files.</p>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pocompile.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pocompile.html</a>
for examples and usage instructions.</p>
<dl class="function">
<dt id="translate.tools.pocompile.convertmo">
<tt class="descclassname">translate.tools.pocompile.</tt><tt class="descname">convertmo</tt><big>(</big><em>inputfile</em>, <em>outputfile</em>, <em>templatefile</em>, <em>includefuzzy=False</em><big>)</big><a class="headerlink" href="#translate.tools.pocompile.convertmo" title="Permalink to this definition">¶</a></dt>
<dd><p>reads in a base class derived inputfile, converts using pocompile, writes to outputfile</p>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.poconflicts">
<span id="poconflicts"></span><h2>poconflicts<a class="headerlink" href="#module-translate.tools.poconflicts" title="Permalink to this headline">¶</a></h2>
<p>Conflict finder for Gettext PO localization files.</p>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/poconflicts.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/poconflicts.html</a>
for examples and usage instructions.</p>
<dl class="class">
<dt id="translate.tools.poconflicts.ConflictOptionParser">
<em class="property">class </em><tt class="descclassname">translate.tools.poconflicts.</tt><tt class="descname">ConflictOptionParser</tt><big>(</big><em>formats</em>, <em>usetemplates=False</em>, <em>allowmissingtemplate=False</em>, <em>description=None</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser" title="Permalink to this definition">¶</a></dt>
<dd><p>a specialized Option Parser for the conflict tool...</p>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.add_option">
<tt class="descname">add_option</tt><big>(</big><em>Option</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.add_option" title="Permalink to this definition">¶</a></dt>
<dd><p>add_option(opt_str, ..., kwarg=val, ...)</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.buildconflictmap">
<tt class="descname">buildconflictmap</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.buildconflictmap" title="Permalink to this definition">¶</a></dt>
<dd><p>work out which strings are conflicting</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.check_values">
<tt class="descname">check_values</tt><big>(</big><em>values : Values, args : [string]</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.check_values" title="Permalink to this definition">¶</a></dt>
<dd><p>-> (values : Values, args : [string])</p>
<p>Check that the supplied option values and leftover arguments are
valid. Returns the option values and leftover arguments
(possibly adjusted, possibly completely new – whatever you
like). Default implementation just returns the passed-in
values; subclasses may override as desired.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.checkoutputsubdir">
<tt class="descname">checkoutputsubdir</tt><big>(</big><em>options</em>, <em>subdir</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.checkoutputsubdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks to see if subdir under options.output needs to be created,
creates if neccessary.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.clean">
<tt class="descname">clean</tt><big>(</big><em>string</em>, <em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.clean" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the cleaned string that contains the text to be matched</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.define_option">
<tt class="descname">define_option</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.define_option" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines the given option, replacing an existing one of the same short
name if neccessary...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.destroy">
<tt class="descname">destroy</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.destroy" title="Permalink to this definition">¶</a></dt>
<dd><p>Declare that you are done with this OptionParser. This cleans up
reference cycles so the OptionParser (and all objects referenced by
it) can be garbage-collected promptly. After calling destroy(), the
OptionParser is unusable.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.disable_interspersed_args">
<tt class="descname">disable_interspersed_args</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.disable_interspersed_args" title="Permalink to this definition">¶</a></dt>
<dd><p>Set parsing to stop on the first non-option. Use this if
you have a command processor which runs another command that
has options of its own and you want to make sure these options
don’t get confused.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.enable_interspersed_args">
<tt class="descname">enable_interspersed_args</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.enable_interspersed_args" title="Permalink to this definition">¶</a></dt>
<dd><p>Set parsing to not stop on the first non-option, allowing
interspersing switches with command arguments. This is the
default behavior. See also disable_interspersed_args() and the
class documentation description of the attribute
allow_interspersed_args.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.error">
<tt class="descname">error</tt><big>(</big><em>msg : string</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.error" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a usage message incorporating ‘msg’ to stderr and exit.
If you override this in a subclass, it should not return – it
should either exit or raise an exception.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.finalizetempoutputfile">
<tt class="descname">finalizetempoutputfile</tt><big>(</big><em>options</em>, <em>outputfile</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.finalizetempoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the temp outputfile to its final destination.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.flatten">
<tt class="descname">flatten</tt><big>(</big><em>text</em>, <em>joinchar</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.flatten" title="Permalink to this definition">¶</a></dt>
<dd><p>flattens text to just be words</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.format_manpage">
<tt class="descname">format_manpage</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.format_manpage" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a formatted manpage</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.getformathelp">
<tt class="descname">getformathelp</tt><big>(</big><em>formats</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.getformathelp" title="Permalink to this definition">¶</a></dt>
<dd><p>Make a nice help string for describing formats...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.getfullinputpath">
<tt class="descname">getfullinputpath</tt><big>(</big><em>options</em>, <em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.getfullinputpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to an input file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.getfulloutputpath">
<tt class="descname">getfulloutputpath</tt><big>(</big><em>options</em>, <em>outputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.getfulloutputpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to an output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.getfulltemplatepath">
<tt class="descname">getfulltemplatepath</tt><big>(</big><em>options</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.getfulltemplatepath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to a template file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.getoutputname">
<tt class="descname">getoutputname</tt><big>(</big><em>options</em>, <em>inputname</em>, <em>outputformat</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.getoutputname" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets an output filename based on the input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.getoutputoptions">
<tt class="descname">getoutputoptions</tt><big>(</big><em>options</em>, <em>inputpath</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.getoutputoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Works out which output format and processor method to use...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.getpassthroughoptions">
<tt class="descname">getpassthroughoptions</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.getpassthroughoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the options required to pass to the filtermethod...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.gettemplatename">
<tt class="descname">gettemplatename</tt><big>(</big><em>options</em>, <em>inputname</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.gettemplatename" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets an output filename based on the input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.getusageman">
<tt class="descname">getusageman</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.getusageman" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the usage string for the given option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.getusagestring">
<tt class="descname">getusagestring</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.getusagestring" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the usage string for the given option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.initprogressbar">
<tt class="descname">initprogressbar</tt><big>(</big><em>allfiles</em>, <em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.initprogressbar" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets up a progress bar appropriate to the options and files.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.isexcluded">
<tt class="descname">isexcluded</tt><big>(</big><em>options</em>, <em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.isexcluded" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if this path has been excluded.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.isrecursive">
<tt class="descname">isrecursive</tt><big>(</big><em>fileoption</em>, <em>filepurpose='input'</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.isrecursive" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if fileoption is a recursive file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.isvalidinputname">
<tt class="descname">isvalidinputname</tt><big>(</big><em>options</em>, <em>inputname</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.isvalidinputname" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if this is a valid input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.mkdir">
<tt class="descname">mkdir</tt><big>(</big><em>parent</em>, <em>subdir</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.mkdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Makes a subdirectory (recursively if neccessary).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.openinputfile">
<tt class="descname">openinputfile</tt><big>(</big><em>options</em>, <em>fullinputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.openinputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the input file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.openoutputfile">
<tt class="descname">openoutputfile</tt><big>(</big><em>options</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.openoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.opentemplatefile">
<tt class="descname">opentemplatefile</tt><big>(</big><em>options</em>, <em>fulltemplatepath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.opentemplatefile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the template file (if required).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.opentempoutputfile">
<tt class="descname">opentempoutputfile</tt><big>(</big><em>options</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.opentempoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens a temporary output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.outputconflicts">
<tt class="descname">outputconflicts</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.outputconflicts" title="Permalink to this definition">¶</a></dt>
<dd><p>saves the result of the conflict match</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.parse_args">
<tt class="descname">parse_args</tt><big>(</big><em>args=None</em>, <em>values=None</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.parse_args" title="Permalink to this definition">¶</a></dt>
<dd><p>parses the command line options, handling implicit input/output args</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.print_help">
<tt class="descname">print_help</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.print_help" title="Permalink to this definition">¶</a></dt>
<dd><p>Print an extended help message, listing all options and any
help text provided with them, to ‘file’ (default stdout).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.print_manpage">
<tt class="descname">print_manpage</tt><big>(</big><em>file=None</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.print_manpage" title="Permalink to this definition">¶</a></dt>
<dd><p>outputs a manpage for the program using the help information</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.print_usage">
<tt class="descname">print_usage</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.print_usage" title="Permalink to this definition">¶</a></dt>
<dd><p>Print the usage message for the current program (self.usage) to
‘file’ (default stdout). Any occurrence of the string “%prog” in
self.usage is replaced with the name of the current program
(basename of sys.argv[0]). Does nothing if self.usage is empty
or not defined.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.print_version">
<tt class="descname">print_version</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.print_version" title="Permalink to this definition">¶</a></dt>
<dd><p>Print the version message for this program (self.version) to
‘file’ (default stdout). As with print_usage(), any occurrence
of “%prog” in self.version is replaced by the current program’s
name. Does nothing if self.version is empty or undefined.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.processfile">
<tt class="descname">processfile</tt><big>(</big><em>fileprocessor</em>, <em>options</em>, <em>fullinputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.processfile" title="Permalink to this definition">¶</a></dt>
<dd><p>process an individual file</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.recurseinputfilelist">
<tt class="descname">recurseinputfilelist</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.recurseinputfilelist" title="Permalink to this definition">¶</a></dt>
<dd><p>Use a list of files, and find a common base directory for them.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.recurseinputfiles">
<tt class="descname">recurseinputfiles</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.recurseinputfiles" title="Permalink to this definition">¶</a></dt>
<dd><p>Recurse through directories and return files to be processed.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.recursiveprocess">
<tt class="descname">recursiveprocess</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.recursiveprocess" title="Permalink to this definition">¶</a></dt>
<dd><p>recurse through directories and process files</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.reportprogress">
<tt class="descname">reportprogress</tt><big>(</big><em>filename</em>, <em>success</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.reportprogress" title="Permalink to this definition">¶</a></dt>
<dd><p>Shows that we are progressing...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.run">
<tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.run" title="Permalink to this definition">¶</a></dt>
<dd><p>parses the arguments, and runs recursiveprocess with the resulting options</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.set_usage">
<tt class="descname">set_usage</tt><big>(</big><em>usage=None</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.set_usage" title="Permalink to this definition">¶</a></dt>
<dd><p>sets the usage string - if usage not given, uses getusagestring for each option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.seterrorleveloptions">
<tt class="descname">seterrorleveloptions</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.seterrorleveloptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the errorlevel options.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.setformats">
<tt class="descname">setformats</tt><big>(</big><em>formats</em>, <em>usetemplates</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.setformats" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the format options using the given format dictionary.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>formats</strong> (<em>Dictionary</em>) – <p>The dictionary <em>keys</em> should be:</p>
<ul class="simple">
<li>Single strings (or 1-tuples) containing an
input format (if not <em>usetemplates</em>)</li>
<li>Tuples containing an input format and
template format (if <em>usetemplates</em>)</li>
<li>Formats can be <em>None</em> to indicate what to do
with standard input</li>
</ul>
<p>The dictionary <em>values</em> should be tuples of
outputformat (string) and processor method.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.setmanpageoption">
<tt class="descname">setmanpageoption</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.setmanpageoption" title="Permalink to this definition">¶</a></dt>
<dd><p>creates a manpage option that allows the optionparser to generate a
manpage</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.setprogressoptions">
<tt class="descname">setprogressoptions</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.setprogressoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the progress options.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.splitext">
<tt class="descname">splitext</tt><big>(</big><em>pathname</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.splitext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits <em>pathname</em> into name and ext, and removes the extsep.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pathname</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – A file path</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">root, ext</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">tuple</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.splitinputext">
<tt class="descname">splitinputext</tt><big>(</big><em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.splitinputext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits an <em>inputpath</em> into name and extension.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.splittemplateext">
<tt class="descname">splittemplateext</tt><big>(</big><em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.splittemplateext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits a <em>templatepath</em> into name and extension.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.templateexists">
<tt class="descname">templateexists</tt><big>(</big><em>options</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.templateexists" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns whether the given template exists...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poconflicts.ConflictOptionParser.warning">
<tt class="descname">warning</tt><big>(</big><em>msg</em>, <em>options=None</em>, <em>exc_info=None</em><big>)</big><a class="headerlink" href="#translate.tools.poconflicts.ConflictOptionParser.warning" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a warning message incorporating ‘msg’ to stderr and exit.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.pocount">
<span id="pocount"></span><h2>pocount<a class="headerlink" href="#module-translate.tools.pocount" title="Permalink to this headline">¶</a></h2>
<p>Count strings and words for supported localization files.</p>
<p>These include: XLIFF, TMX, Gettex PO and MO, Qt .ts and .qm, Wordfast TM, etc</p>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pocount.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pocount.html</a>
for examples and usage instructions.</p>
<dl class="function">
<dt id="translate.tools.pocount.calcstats_old">
<tt class="descclassname">translate.tools.pocount.</tt><tt class="descname">calcstats_old</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#translate.tools.pocount.calcstats_old" title="Permalink to this definition">¶</a></dt>
<dd><p>This is the previous implementation of calcstats() and is left for
comparison and debuging purposes.</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pocount.summarize">
<tt class="descclassname">translate.tools.pocount.</tt><tt class="descname">summarize</tt><big>(</big><em>title</em>, <em>stats</em>, <em>style=0</em>, <em>indent=8</em>, <em>incomplete_only=False</em><big>)</big><a class="headerlink" href="#translate.tools.pocount.summarize" title="Permalink to this definition">¶</a></dt>
<dd><p>Print summary for a .po file in specified format.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>title</strong> – name of .po file</li>
<li><strong>stats</strong> – array with translation statistics for the file specified</li>
<li><strong>indent</strong> – indentation of the 2nd column (length of longest filename)</li>
<li><strong>incomplete_only</strong> (<em>Boolean</em>) – omit fully translated files</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">Boolean</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">1 if counting incomplete files (incomplete_only=True) and the
file is completely translated, 0 otherwise</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.podebug">
<span id="podebug"></span><h2>podebug<a class="headerlink" href="#module-translate.tools.podebug" title="Permalink to this headline">¶</a></h2>
<p>Insert debug messages into XLIFF and Gettext PO localization files.</p>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/podebug.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/podebug.html</a>
for examples and usage instructions.</p>
<dl class="function">
<dt id="translate.tools.podebug.convertpo">
<tt class="descclassname">translate.tools.podebug.</tt><tt class="descname">convertpo</tt><big>(</big><em>inputfile</em>, <em>outputfile</em>, <em>templatefile</em>, <em>format=None</em>, <em>rewritestyle=None</em>, <em>ignoreoption=None</em><big>)</big><a class="headerlink" href="#translate.tools.podebug.convertpo" title="Permalink to this definition">¶</a></dt>
<dd><p>Reads in inputfile, changes it to have debug strings, writes to outputfile.</p>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.pogrep">
<span id="pogrep"></span><h2>pogrep<a class="headerlink" href="#module-translate.tools.pogrep" title="Permalink to this headline">¶</a></h2>
<p>Grep XLIFF, Gettext PO and TMX localization files.</p>
<p>Matches are output to snippet files of the same type which can then be reviewed
and later merged using <a class="reference internal" href="../commands/pomerge.html"><em>pomerge</em></a>.</p>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pogrep.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pogrep.html</a>
for examples and usage instructions.</p>
<dl class="class">
<dt id="translate.tools.pogrep.GrepMatch">
<em class="property">class </em><tt class="descclassname">translate.tools.pogrep.</tt><tt class="descname">GrepMatch</tt><big>(</big><em>unit</em>, <em>part='target'</em>, <em>part_n=0</em>, <em>start=0</em>, <em>end=0</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepMatch" title="Permalink to this definition">¶</a></dt>
<dd><p>Just a small data structure that represents a search match.</p>
</dd></dl>
<dl class="class">
<dt id="translate.tools.pogrep.GrepOptionParser">
<em class="property">class </em><tt class="descclassname">translate.tools.pogrep.</tt><tt class="descname">GrepOptionParser</tt><big>(</big><em>formats</em>, <em>usetemplates=False</em>, <em>allowmissingtemplate=False</em>, <em>description=None</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser" title="Permalink to this definition">¶</a></dt>
<dd><p>a specialized Option Parser for the grep tool...</p>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.add_option">
<tt class="descname">add_option</tt><big>(</big><em>Option</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.add_option" title="Permalink to this definition">¶</a></dt>
<dd><p>add_option(opt_str, ..., kwarg=val, ...)</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.check_values">
<tt class="descname">check_values</tt><big>(</big><em>values : Values, args : [string]</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.check_values" title="Permalink to this definition">¶</a></dt>
<dd><p>-> (values : Values, args : [string])</p>
<p>Check that the supplied option values and leftover arguments are
valid. Returns the option values and leftover arguments
(possibly adjusted, possibly completely new – whatever you
like). Default implementation just returns the passed-in
values; subclasses may override as desired.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.checkoutputsubdir">
<tt class="descname">checkoutputsubdir</tt><big>(</big><em>options</em>, <em>subdir</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.checkoutputsubdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks to see if subdir under options.output needs to be created,
creates if neccessary.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.define_option">
<tt class="descname">define_option</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.define_option" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines the given option, replacing an existing one of the same short
name if neccessary...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.destroy">
<tt class="descname">destroy</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.destroy" title="Permalink to this definition">¶</a></dt>
<dd><p>Declare that you are done with this OptionParser. This cleans up
reference cycles so the OptionParser (and all objects referenced by
it) can be garbage-collected promptly. After calling destroy(), the
OptionParser is unusable.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.disable_interspersed_args">
<tt class="descname">disable_interspersed_args</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.disable_interspersed_args" title="Permalink to this definition">¶</a></dt>
<dd><p>Set parsing to stop on the first non-option. Use this if
you have a command processor which runs another command that
has options of its own and you want to make sure these options
don’t get confused.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.enable_interspersed_args">
<tt class="descname">enable_interspersed_args</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.enable_interspersed_args" title="Permalink to this definition">¶</a></dt>
<dd><p>Set parsing to not stop on the first non-option, allowing
interspersing switches with command arguments. This is the
default behavior. See also disable_interspersed_args() and the
class documentation description of the attribute
allow_interspersed_args.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.error">
<tt class="descname">error</tt><big>(</big><em>msg : string</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.error" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a usage message incorporating ‘msg’ to stderr and exit.
If you override this in a subclass, it should not return – it
should either exit or raise an exception.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.finalizetempoutputfile">
<tt class="descname">finalizetempoutputfile</tt><big>(</big><em>options</em>, <em>outputfile</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.finalizetempoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the temp outputfile to its final destination.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.format_manpage">
<tt class="descname">format_manpage</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.format_manpage" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a formatted manpage</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.getformathelp">
<tt class="descname">getformathelp</tt><big>(</big><em>formats</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.getformathelp" title="Permalink to this definition">¶</a></dt>
<dd><p>Make a nice help string for describing formats...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.getfullinputpath">
<tt class="descname">getfullinputpath</tt><big>(</big><em>options</em>, <em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.getfullinputpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to an input file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.getfulloutputpath">
<tt class="descname">getfulloutputpath</tt><big>(</big><em>options</em>, <em>outputpath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.getfulloutputpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to an output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.getfulltemplatepath">
<tt class="descname">getfulltemplatepath</tt><big>(</big><em>options</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.getfulltemplatepath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to a template file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.getoutputname">
<tt class="descname">getoutputname</tt><big>(</big><em>options</em>, <em>inputname</em>, <em>outputformat</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.getoutputname" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets an output filename based on the input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.getoutputoptions">
<tt class="descname">getoutputoptions</tt><big>(</big><em>options</em>, <em>inputpath</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.getoutputoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Works out which output format and processor method to use...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.getpassthroughoptions">
<tt class="descname">getpassthroughoptions</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.getpassthroughoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the options required to pass to the filtermethod...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.gettemplatename">
<tt class="descname">gettemplatename</tt><big>(</big><em>options</em>, <em>inputname</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.gettemplatename" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets an output filename based on the input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.getusageman">
<tt class="descname">getusageman</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.getusageman" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the usage string for the given option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.getusagestring">
<tt class="descname">getusagestring</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.getusagestring" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the usage string for the given option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.initprogressbar">
<tt class="descname">initprogressbar</tt><big>(</big><em>allfiles</em>, <em>options</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.initprogressbar" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets up a progress bar appropriate to the options and files.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.isexcluded">
<tt class="descname">isexcluded</tt><big>(</big><em>options</em>, <em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.isexcluded" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if this path has been excluded.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.isrecursive">
<tt class="descname">isrecursive</tt><big>(</big><em>fileoption</em>, <em>filepurpose='input'</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.isrecursive" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if fileoption is a recursive file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.isvalidinputname">
<tt class="descname">isvalidinputname</tt><big>(</big><em>options</em>, <em>inputname</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.isvalidinputname" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if this is a valid input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.mkdir">
<tt class="descname">mkdir</tt><big>(</big><em>parent</em>, <em>subdir</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.mkdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Makes a subdirectory (recursively if neccessary).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.openinputfile">
<tt class="descname">openinputfile</tt><big>(</big><em>options</em>, <em>fullinputpath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.openinputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the input file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.openoutputfile">
<tt class="descname">openoutputfile</tt><big>(</big><em>options</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.openoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.opentemplatefile">
<tt class="descname">opentemplatefile</tt><big>(</big><em>options</em>, <em>fulltemplatepath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.opentemplatefile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the template file (if required).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.opentempoutputfile">
<tt class="descname">opentempoutputfile</tt><big>(</big><em>options</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.opentempoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens a temporary output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.parse_args">
<tt class="descname">parse_args</tt><big>(</big><em>args=None</em>, <em>values=None</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.parse_args" title="Permalink to this definition">¶</a></dt>
<dd><p>parses the command line options, handling implicit input/output args</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.print_help">
<tt class="descname">print_help</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.print_help" title="Permalink to this definition">¶</a></dt>
<dd><p>Print an extended help message, listing all options and any
help text provided with them, to ‘file’ (default stdout).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.print_manpage">
<tt class="descname">print_manpage</tt><big>(</big><em>file=None</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.print_manpage" title="Permalink to this definition">¶</a></dt>
<dd><p>outputs a manpage for the program using the help information</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.print_usage">
<tt class="descname">print_usage</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.print_usage" title="Permalink to this definition">¶</a></dt>
<dd><p>Print the usage message for the current program (self.usage) to
‘file’ (default stdout). Any occurrence of the string “%prog” in
self.usage is replaced with the name of the current program
(basename of sys.argv[0]). Does nothing if self.usage is empty
or not defined.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.print_version">
<tt class="descname">print_version</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.print_version" title="Permalink to this definition">¶</a></dt>
<dd><p>Print the version message for this program (self.version) to
‘file’ (default stdout). As with print_usage(), any occurrence
of “%prog” in self.version is replaced by the current program’s
name. Does nothing if self.version is empty or undefined.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.processfile">
<tt class="descname">processfile</tt><big>(</big><em>fileprocessor</em>, <em>options</em>, <em>fullinputpath</em>, <em>fulloutputpath</em>, <em>fulltemplatepath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.processfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Process an individual file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.recurseinputfilelist">
<tt class="descname">recurseinputfilelist</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.recurseinputfilelist" title="Permalink to this definition">¶</a></dt>
<dd><p>Use a list of files, and find a common base directory for them.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.recurseinputfiles">
<tt class="descname">recurseinputfiles</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.recurseinputfiles" title="Permalink to this definition">¶</a></dt>
<dd><p>Recurse through directories and return files to be processed.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.recursiveprocess">
<tt class="descname">recursiveprocess</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.recursiveprocess" title="Permalink to this definition">¶</a></dt>
<dd><p>Recurse through directories and process files.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.reportprogress">
<tt class="descname">reportprogress</tt><big>(</big><em>filename</em>, <em>success</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.reportprogress" title="Permalink to this definition">¶</a></dt>
<dd><p>Shows that we are progressing...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.run">
<tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.run" title="Permalink to this definition">¶</a></dt>
<dd><p>parses the arguments, and runs recursiveprocess with the resulting options</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.set_usage">
<tt class="descname">set_usage</tt><big>(</big><em>usage=None</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.set_usage" title="Permalink to this definition">¶</a></dt>
<dd><p>sets the usage string - if usage not given, uses getusagestring for each option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.seterrorleveloptions">
<tt class="descname">seterrorleveloptions</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.seterrorleveloptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the errorlevel options.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.setformats">
<tt class="descname">setformats</tt><big>(</big><em>formats</em>, <em>usetemplates</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.setformats" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the format options using the given format dictionary.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>formats</strong> (<em>Dictionary</em>) – <p>The dictionary <em>keys</em> should be:</p>
<ul class="simple">
<li>Single strings (or 1-tuples) containing an
input format (if not <em>usetemplates</em>)</li>
<li>Tuples containing an input format and
template format (if <em>usetemplates</em>)</li>
<li>Formats can be <em>None</em> to indicate what to do
with standard input</li>
</ul>
<p>The dictionary <em>values</em> should be tuples of
outputformat (string) and processor method.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.setmanpageoption">
<tt class="descname">setmanpageoption</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.setmanpageoption" title="Permalink to this definition">¶</a></dt>
<dd><p>creates a manpage option that allows the optionparser to generate a
manpage</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.setprogressoptions">
<tt class="descname">setprogressoptions</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.setprogressoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the progress options.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.splitext">
<tt class="descname">splitext</tt><big>(</big><em>pathname</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.splitext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits <em>pathname</em> into name and ext, and removes the extsep.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pathname</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – A file path</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">root, ext</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">tuple</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.splitinputext">
<tt class="descname">splitinputext</tt><big>(</big><em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.splitinputext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits an <em>inputpath</em> into name and extension.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.splittemplateext">
<tt class="descname">splittemplateext</tt><big>(</big><em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.splittemplateext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits a <em>templatepath</em> into name and extension.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.templateexists">
<tt class="descname">templateexists</tt><big>(</big><em>options</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.templateexists" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns whether the given template exists...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pogrep.GrepOptionParser.warning">
<tt class="descname">warning</tt><big>(</big><em>msg</em>, <em>options=None</em>, <em>exc_info=None</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.GrepOptionParser.warning" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a warning message incorporating ‘msg’ to stderr and exit.</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pogrep.find_matches">
<tt class="descclassname">translate.tools.pogrep.</tt><tt class="descname">find_matches</tt><big>(</big><em>unit</em>, <em>part</em>, <em>strings</em>, <em>re_search</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.find_matches" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the GrepFilter objects where re_search matches in strings.</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pogrep.real_index">
<tt class="descclassname">translate.tools.pogrep.</tt><tt class="descname">real_index</tt><big>(</big><em>string</em>, <em>nfc_index</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.real_index" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate the real index in the unnormalized string that corresponds to
the index nfc_index in the normalized string.</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pogrep.rungrep">
<tt class="descclassname">translate.tools.pogrep.</tt><tt class="descname">rungrep</tt><big>(</big><em>inputfile</em>, <em>outputfile</em>, <em>templatefile</em>, <em>checkfilter</em><big>)</big><a class="headerlink" href="#translate.tools.pogrep.rungrep" title="Permalink to this definition">¶</a></dt>
<dd><p>reads in inputfile, filters using checkfilter, writes to outputfile</p>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.pomerge">
<span id="pomerge"></span><h2>pomerge<a class="headerlink" href="#module-translate.tools.pomerge" title="Permalink to this headline">¶</a></h2>
<p>Merges XLIFF and Gettext PO localization files.</p>
<p>Snippet file produced by e.g. <a class="reference internal" href="../commands/pogrep.html"><em>pogrep</em></a> and updated by a
translator can be merged back into the original files.</p>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pomerge.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pomerge.html</a>
for examples and usage instructions.</p>
<dl class="function">
<dt id="translate.tools.pomerge.mergestores">
<tt class="descclassname">translate.tools.pomerge.</tt><tt class="descname">mergestores</tt><big>(</big><em>store1</em>, <em>store2</em>, <em>mergeblanks</em>, <em>mergefuzzy</em>, <em>mergecomments</em><big>)</big><a class="headerlink" href="#translate.tools.pomerge.mergestores" title="Permalink to this definition">¶</a></dt>
<dd><p>Take any new translations in store2 and write them into store1.</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pomerge.str2bool">
<tt class="descclassname">translate.tools.pomerge.</tt><tt class="descname">str2bool</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.pomerge.str2bool" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a string value to boolean</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>option</strong> (<em>String</em>) – yes, true, 1, no, false, 0</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">Boolean</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.porestructure">
<span id="porestructure"></span><h2>porestructure<a class="headerlink" href="#module-translate.tools.porestructure" title="Permalink to this headline">¶</a></h2>
<p>Restructure Gettxt PO files produced by
<a class="reference internal" href="../commands/poconflicts.html"><em>poconflicts</em></a> into the original directory tree
for merging using <a class="reference internal" href="../commands/pomerge.html"><em>pomerge</em></a>.</p>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pomerge.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pomerge.html</a>
for examples and usage instructions.</p>
<dl class="class">
<dt id="translate.tools.porestructure.SplitOptionParser">
<em class="property">class </em><tt class="descclassname">translate.tools.porestructure.</tt><tt class="descname">SplitOptionParser</tt><big>(</big><em>formats</em>, <em>usetemplates=False</em>, <em>allowmissingtemplate=False</em>, <em>description=None</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser" title="Permalink to this definition">¶</a></dt>
<dd><p>a specialized Option Parser for posplit</p>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.add_option">
<tt class="descname">add_option</tt><big>(</big><em>Option</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.add_option" title="Permalink to this definition">¶</a></dt>
<dd><p>add_option(opt_str, ..., kwarg=val, ...)</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.check_values">
<tt class="descname">check_values</tt><big>(</big><em>values : Values, args : [string]</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.check_values" title="Permalink to this definition">¶</a></dt>
<dd><p>-> (values : Values, args : [string])</p>
<p>Check that the supplied option values and leftover arguments are
valid. Returns the option values and leftover arguments
(possibly adjusted, possibly completely new – whatever you
like). Default implementation just returns the passed-in
values; subclasses may override as desired.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.checkoutputsubdir">
<tt class="descname">checkoutputsubdir</tt><big>(</big><em>options</em>, <em>subdir</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.checkoutputsubdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks to see if subdir under options.output needs to be created,
creates if neccessary.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.define_option">
<tt class="descname">define_option</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.define_option" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines the given option, replacing an existing one of the same short
name if neccessary...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.destroy">
<tt class="descname">destroy</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.destroy" title="Permalink to this definition">¶</a></dt>
<dd><p>Declare that you are done with this OptionParser. This cleans up
reference cycles so the OptionParser (and all objects referenced by
it) can be garbage-collected promptly. After calling destroy(), the
OptionParser is unusable.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.disable_interspersed_args">
<tt class="descname">disable_interspersed_args</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.disable_interspersed_args" title="Permalink to this definition">¶</a></dt>
<dd><p>Set parsing to stop on the first non-option. Use this if
you have a command processor which runs another command that
has options of its own and you want to make sure these options
don’t get confused.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.enable_interspersed_args">
<tt class="descname">enable_interspersed_args</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.enable_interspersed_args" title="Permalink to this definition">¶</a></dt>
<dd><p>Set parsing to not stop on the first non-option, allowing
interspersing switches with command arguments. This is the
default behavior. See also disable_interspersed_args() and the
class documentation description of the attribute
allow_interspersed_args.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.error">
<tt class="descname">error</tt><big>(</big><em>msg : string</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.error" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a usage message incorporating ‘msg’ to stderr and exit.
If you override this in a subclass, it should not return – it
should either exit or raise an exception.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.finalizetempoutputfile">
<tt class="descname">finalizetempoutputfile</tt><big>(</big><em>options</em>, <em>outputfile</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.finalizetempoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the temp outputfile to its final destination.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.format_manpage">
<tt class="descname">format_manpage</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.format_manpage" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a formatted manpage</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.getformathelp">
<tt class="descname">getformathelp</tt><big>(</big><em>formats</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.getformathelp" title="Permalink to this definition">¶</a></dt>
<dd><p>Make a nice help string for describing formats...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.getfullinputpath">
<tt class="descname">getfullinputpath</tt><big>(</big><em>options</em>, <em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.getfullinputpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to an input file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.getfulloutputpath">
<tt class="descname">getfulloutputpath</tt><big>(</big><em>options</em>, <em>outputpath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.getfulloutputpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to an output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.getfulltemplatepath">
<tt class="descname">getfulltemplatepath</tt><big>(</big><em>options</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.getfulltemplatepath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to a template file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.getoutputname">
<tt class="descname">getoutputname</tt><big>(</big><em>options</em>, <em>inputname</em>, <em>outputformat</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.getoutputname" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets an output filename based on the input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.getoutputoptions">
<tt class="descname">getoutputoptions</tt><big>(</big><em>options</em>, <em>inputpath</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.getoutputoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Works out which output format and processor method to use...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.getpassthroughoptions">
<tt class="descname">getpassthroughoptions</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.getpassthroughoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the options required to pass to the filtermethod...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.gettemplatename">
<tt class="descname">gettemplatename</tt><big>(</big><em>options</em>, <em>inputname</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.gettemplatename" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets an output filename based on the input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.getusageman">
<tt class="descname">getusageman</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.getusageman" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the usage string for the given option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.getusagestring">
<tt class="descname">getusagestring</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.getusagestring" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the usage string for the given option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.initprogressbar">
<tt class="descname">initprogressbar</tt><big>(</big><em>allfiles</em>, <em>options</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.initprogressbar" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets up a progress bar appropriate to the options and files.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.isexcluded">
<tt class="descname">isexcluded</tt><big>(</big><em>options</em>, <em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.isexcluded" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if this path has been excluded.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.isrecursive">
<tt class="descname">isrecursive</tt><big>(</big><em>fileoption</em>, <em>filepurpose='input'</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.isrecursive" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if fileoption is a recursive file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.isvalidinputname">
<tt class="descname">isvalidinputname</tt><big>(</big><em>options</em>, <em>inputname</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.isvalidinputname" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if this is a valid input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.mkdir">
<tt class="descname">mkdir</tt><big>(</big><em>parent</em>, <em>subdir</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.mkdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Makes a subdirectory (recursively if neccessary).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.openinputfile">
<tt class="descname">openinputfile</tt><big>(</big><em>options</em>, <em>fullinputpath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.openinputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the input file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.openoutputfile">
<tt class="descname">openoutputfile</tt><big>(</big><em>options</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.openoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.opentemplatefile">
<tt class="descname">opentemplatefile</tt><big>(</big><em>options</em>, <em>fulltemplatepath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.opentemplatefile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the template file (if required).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.opentempoutputfile">
<tt class="descname">opentempoutputfile</tt><big>(</big><em>options</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.opentempoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens a temporary output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.parse_args">
<tt class="descname">parse_args</tt><big>(</big><em>args=None</em>, <em>values=None</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.parse_args" title="Permalink to this definition">¶</a></dt>
<dd><p>parses the command line options, handling implicit input/output args</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.print_help">
<tt class="descname">print_help</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.print_help" title="Permalink to this definition">¶</a></dt>
<dd><p>Print an extended help message, listing all options and any
help text provided with them, to ‘file’ (default stdout).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.print_manpage">
<tt class="descname">print_manpage</tt><big>(</big><em>file=None</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.print_manpage" title="Permalink to this definition">¶</a></dt>
<dd><p>outputs a manpage for the program using the help information</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.print_usage">
<tt class="descname">print_usage</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.print_usage" title="Permalink to this definition">¶</a></dt>
<dd><p>Print the usage message for the current program (self.usage) to
‘file’ (default stdout). Any occurrence of the string “%prog” in
self.usage is replaced with the name of the current program
(basename of sys.argv[0]). Does nothing if self.usage is empty
or not defined.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.print_version">
<tt class="descname">print_version</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.print_version" title="Permalink to this definition">¶</a></dt>
<dd><p>Print the version message for this program (self.version) to
‘file’ (default stdout). As with print_usage(), any occurrence
of “%prog” in self.version is replaced by the current program’s
name. Does nothing if self.version is empty or undefined.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.processfile">
<tt class="descname">processfile</tt><big>(</big><em>options</em>, <em>fullinputpath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.processfile" title="Permalink to this definition">¶</a></dt>
<dd><p>process an individual file</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.recurseinputfilelist">
<tt class="descname">recurseinputfilelist</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.recurseinputfilelist" title="Permalink to this definition">¶</a></dt>
<dd><p>Use a list of files, and find a common base directory for them.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.recurseinputfiles">
<tt class="descname">recurseinputfiles</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.recurseinputfiles" title="Permalink to this definition">¶</a></dt>
<dd><p>Recurse through directories and return files to be processed.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.recursiveprocess">
<tt class="descname">recursiveprocess</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.recursiveprocess" title="Permalink to this definition">¶</a></dt>
<dd><p>recurse through directories and process files</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.reportprogress">
<tt class="descname">reportprogress</tt><big>(</big><em>filename</em>, <em>success</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.reportprogress" title="Permalink to this definition">¶</a></dt>
<dd><p>Shows that we are progressing...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.run">
<tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.run" title="Permalink to this definition">¶</a></dt>
<dd><p>Parses the arguments, and runs recursiveprocess with the resulting
options...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.set_usage">
<tt class="descname">set_usage</tt><big>(</big><em>usage=None</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.set_usage" title="Permalink to this definition">¶</a></dt>
<dd><p>sets the usage string - if usage not given, uses getusagestring for each option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.seterrorleveloptions">
<tt class="descname">seterrorleveloptions</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.seterrorleveloptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the errorlevel options.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.setformats">
<tt class="descname">setformats</tt><big>(</big><em>formats</em>, <em>usetemplates</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.setformats" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the format options using the given format dictionary.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>formats</strong> (<em>Dictionary</em>) – <p>The dictionary <em>keys</em> should be:</p>
<ul class="simple">
<li>Single strings (or 1-tuples) containing an
input format (if not <em>usetemplates</em>)</li>
<li>Tuples containing an input format and
template format (if <em>usetemplates</em>)</li>
<li>Formats can be <em>None</em> to indicate what to do
with standard input</li>
</ul>
<p>The dictionary <em>values</em> should be tuples of
outputformat (string) and processor method.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.setmanpageoption">
<tt class="descname">setmanpageoption</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.setmanpageoption" title="Permalink to this definition">¶</a></dt>
<dd><p>creates a manpage option that allows the optionparser to generate a
manpage</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.setprogressoptions">
<tt class="descname">setprogressoptions</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.setprogressoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the progress options.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.splitext">
<tt class="descname">splitext</tt><big>(</big><em>pathname</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.splitext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits <em>pathname</em> into name and ext, and removes the extsep.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pathname</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – A file path</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">root, ext</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">tuple</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.splitinputext">
<tt class="descname">splitinputext</tt><big>(</big><em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.splitinputext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits an <em>inputpath</em> into name and extension.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.splittemplateext">
<tt class="descname">splittemplateext</tt><big>(</big><em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.splittemplateext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits a <em>templatepath</em> into name and extension.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.templateexists">
<tt class="descname">templateexists</tt><big>(</big><em>options</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.templateexists" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns whether the given template exists...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.porestructure.SplitOptionParser.warning">
<tt class="descname">warning</tt><big>(</big><em>msg</em>, <em>options=None</em>, <em>exc_info=None</em><big>)</big><a class="headerlink" href="#translate.tools.porestructure.SplitOptionParser.warning" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a warning message incorporating ‘msg’ to stderr and exit.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.posegment">
<span id="posegment"></span><h2>posegment<a class="headerlink" href="#module-translate.tools.posegment" title="Permalink to this headline">¶</a></h2>
<p>Segment Gettext PO, XLIFF and TMX localization files at the sentence level.</p>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/posegment.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/posegment.html</a>
for examples and usage instructions.</p>
<dl class="function">
<dt id="translate.tools.posegment.segmentfile">
<tt class="descclassname">translate.tools.posegment.</tt><tt class="descname">segmentfile</tt><big>(</big><em>inputfile</em>, <em>outputfile</em>, <em>templatefile</em>, <em>sourcelanguage='en'</em>, <em>targetlanguage=None</em>, <em>stripspaces=True</em>, <em>onlyaligned=False</em><big>)</big><a class="headerlink" href="#translate.tools.posegment.segmentfile" title="Permalink to this definition">¶</a></dt>
<dd><p>reads in inputfile, segments it then, writes to outputfile</p>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.poswap">
<span id="poswap"></span><h2>poswap<a class="headerlink" href="#module-translate.tools.poswap" title="Permalink to this headline">¶</a></h2>
<p>Builds a new translation file with the target of the input language as
source language.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Ensure that the two po files correspond 100% to the same pot file before using
this.</p>
</div>
<p>To translate Kurdish (ku) through French:</p>
<div class="highlight-python"><div class="highlight"><pre>po2swap -i fr/ -t ku -o fr-ku
</pre></div>
</div>
<p>To convert the fr-ku files back to en-ku:</p>
<div class="highlight-python"><div class="highlight"><pre>po2swap --reverse -i fr/ -t fr-ku -o en-ku
</pre></div>
</div>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/poswap.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/poswap.html</a>
for examples and usage instructions.</p>
<dl class="function">
<dt id="translate.tools.poswap.convertpo">
<tt class="descclassname">translate.tools.poswap.</tt><tt class="descname">convertpo</tt><big>(</big><em>inputpofile</em>, <em>outputpotfile</em>, <em>template</em>, <em>reverse=False</em><big>)</big><a class="headerlink" href="#translate.tools.poswap.convertpo" title="Permalink to this definition">¶</a></dt>
<dd><p>reads in inputpofile, removes the header, writes to outputpotfile.</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.poswap.swapdir">
<tt class="descclassname">translate.tools.poswap.</tt><tt class="descname">swapdir</tt><big>(</big><em>store</em><big>)</big><a class="headerlink" href="#translate.tools.poswap.swapdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Swap the source and target of each unit.</p>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.poterminology">
<span id="poterminology"></span><h2>poterminology<a class="headerlink" href="#module-translate.tools.poterminology" title="Permalink to this headline">¶</a></h2>
<p>Create a terminology file by reading a set of .po or .pot files to produce a pootle-terminology.pot.</p>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/poterminology.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/poterminology.html</a>
for examples and usage instructions.</p>
<dl class="class">
<dt id="translate.tools.poterminology.TerminologyOptionParser">
<em class="property">class </em><tt class="descclassname">translate.tools.poterminology.</tt><tt class="descname">TerminologyOptionParser</tt><big>(</big><em>formats</em>, <em>usetemplates=False</em>, <em>allowmissingtemplate=False</em>, <em>description=None</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser" title="Permalink to this definition">¶</a></dt>
<dd><p>a specialized Option Parser for the terminology tool...</p>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.add_option">
<tt class="descname">add_option</tt><big>(</big><em>Option</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.add_option" title="Permalink to this definition">¶</a></dt>
<dd><p>add_option(opt_str, ..., kwarg=val, ...)</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.check_values">
<tt class="descname">check_values</tt><big>(</big><em>values : Values, args : [string]</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.check_values" title="Permalink to this definition">¶</a></dt>
<dd><p>-> (values : Values, args : [string])</p>
<p>Check that the supplied option values and leftover arguments are
valid. Returns the option values and leftover arguments
(possibly adjusted, possibly completely new – whatever you
like). Default implementation just returns the passed-in
values; subclasses may override as desired.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.checkoutputsubdir">
<tt class="descname">checkoutputsubdir</tt><big>(</big><em>options</em>, <em>subdir</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.checkoutputsubdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks to see if subdir under options.output needs to be created,
creates if neccessary.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.define_option">
<tt class="descname">define_option</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.define_option" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines the given option, replacing an existing one of the same short
name if neccessary...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.destroy">
<tt class="descname">destroy</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.destroy" title="Permalink to this definition">¶</a></dt>
<dd><p>Declare that you are done with this OptionParser. This cleans up
reference cycles so the OptionParser (and all objects referenced by
it) can be garbage-collected promptly. After calling destroy(), the
OptionParser is unusable.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.disable_interspersed_args">
<tt class="descname">disable_interspersed_args</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.disable_interspersed_args" title="Permalink to this definition">¶</a></dt>
<dd><p>Set parsing to stop on the first non-option. Use this if
you have a command processor which runs another command that
has options of its own and you want to make sure these options
don’t get confused.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.enable_interspersed_args">
<tt class="descname">enable_interspersed_args</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.enable_interspersed_args" title="Permalink to this definition">¶</a></dt>
<dd><p>Set parsing to not stop on the first non-option, allowing
interspersing switches with command arguments. This is the
default behavior. See also disable_interspersed_args() and the
class documentation description of the attribute
allow_interspersed_args.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.error">
<tt class="descname">error</tt><big>(</big><em>msg : string</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.error" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a usage message incorporating ‘msg’ to stderr and exit.
If you override this in a subclass, it should not return – it
should either exit or raise an exception.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.finalizetempoutputfile">
<tt class="descname">finalizetempoutputfile</tt><big>(</big><em>options</em>, <em>outputfile</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.finalizetempoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the temp outputfile to its final destination.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.format_manpage">
<tt class="descname">format_manpage</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.format_manpage" title="Permalink to this definition">¶</a></dt>
<dd><p>returns a formatted manpage</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.getformathelp">
<tt class="descname">getformathelp</tt><big>(</big><em>formats</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.getformathelp" title="Permalink to this definition">¶</a></dt>
<dd><p>Make a nice help string for describing formats...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.getfullinputpath">
<tt class="descname">getfullinputpath</tt><big>(</big><em>options</em>, <em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.getfullinputpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to an input file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.getfulloutputpath">
<tt class="descname">getfulloutputpath</tt><big>(</big><em>options</em>, <em>outputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.getfulloutputpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to an output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.getfulltemplatepath">
<tt class="descname">getfulltemplatepath</tt><big>(</big><em>options</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.getfulltemplatepath" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the absolute path to a template file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.getoutputname">
<tt class="descname">getoutputname</tt><big>(</big><em>options</em>, <em>inputname</em>, <em>outputformat</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.getoutputname" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets an output filename based on the input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.getoutputoptions">
<tt class="descname">getoutputoptions</tt><big>(</big><em>options</em>, <em>inputpath</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.getoutputoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Works out which output format and processor method to use...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.getpassthroughoptions">
<tt class="descname">getpassthroughoptions</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.getpassthroughoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the options required to pass to the filtermethod...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.gettemplatename">
<tt class="descname">gettemplatename</tt><big>(</big><em>options</em>, <em>inputname</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.gettemplatename" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets an output filename based on the input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.getusageman">
<tt class="descname">getusageman</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.getusageman" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the usage string for the given option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.getusagestring">
<tt class="descname">getusagestring</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.getusagestring" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the usage string for the given option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.initprogressbar">
<tt class="descname">initprogressbar</tt><big>(</big><em>allfiles</em>, <em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.initprogressbar" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets up a progress bar appropriate to the options and files.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.isexcluded">
<tt class="descname">isexcluded</tt><big>(</big><em>options</em>, <em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.isexcluded" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if this path has been excluded.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.isrecursive">
<tt class="descname">isrecursive</tt><big>(</big><em>fileoption</em>, <em>filepurpose='input'</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.isrecursive" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if fileoption is a recursive file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.isvalidinputname">
<tt class="descname">isvalidinputname</tt><big>(</big><em>options</em>, <em>inputname</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.isvalidinputname" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if this is a valid input filename.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.mkdir">
<tt class="descname">mkdir</tt><big>(</big><em>parent</em>, <em>subdir</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.mkdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Makes a subdirectory (recursively if neccessary).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.openinputfile">
<tt class="descname">openinputfile</tt><big>(</big><em>options</em>, <em>fullinputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.openinputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the input file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.openoutputfile">
<tt class="descname">openoutputfile</tt><big>(</big><em>options</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.openoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.opentemplatefile">
<tt class="descname">opentemplatefile</tt><big>(</big><em>options</em>, <em>fulltemplatepath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.opentemplatefile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens the template file (if required).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.opentempoutputfile">
<tt class="descname">opentempoutputfile</tt><big>(</big><em>options</em>, <em>fulloutputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.opentempoutputfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens a temporary output file.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.outputterminology">
<tt class="descname">outputterminology</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.outputterminology" title="Permalink to this definition">¶</a></dt>
<dd><p>saves the generated terminology glossary</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.parse_args">
<tt class="descname">parse_args</tt><big>(</big><em>args=None</em>, <em>values=None</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.parse_args" title="Permalink to this definition">¶</a></dt>
<dd><p>parses the command line options, handling implicit input/output args</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.print_help">
<tt class="descname">print_help</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.print_help" title="Permalink to this definition">¶</a></dt>
<dd><p>Print an extended help message, listing all options and any
help text provided with them, to ‘file’ (default stdout).</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.print_manpage">
<tt class="descname">print_manpage</tt><big>(</big><em>file=None</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.print_manpage" title="Permalink to this definition">¶</a></dt>
<dd><p>outputs a manpage for the program using the help information</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.print_usage">
<tt class="descname">print_usage</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.print_usage" title="Permalink to this definition">¶</a></dt>
<dd><p>Print the usage message for the current program (self.usage) to
‘file’ (default stdout). Any occurrence of the string “%prog” in
self.usage is replaced with the name of the current program
(basename of sys.argv[0]). Does nothing if self.usage is empty
or not defined.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.print_version">
<tt class="descname">print_version</tt><big>(</big><em>file : file = stdout</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.print_version" title="Permalink to this definition">¶</a></dt>
<dd><p>Print the version message for this program (self.version) to
‘file’ (default stdout). As with print_usage(), any occurrence
of “%prog” in self.version is replaced by the current program’s
name. Does nothing if self.version is empty or undefined.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.processfile">
<tt class="descname">processfile</tt><big>(</big><em>fileprocessor</em>, <em>options</em>, <em>fullinputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.processfile" title="Permalink to this definition">¶</a></dt>
<dd><p>process an individual file</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.recurseinputfilelist">
<tt class="descname">recurseinputfilelist</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.recurseinputfilelist" title="Permalink to this definition">¶</a></dt>
<dd><p>Use a list of files, and find a common base directory for them.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.recurseinputfiles">
<tt class="descname">recurseinputfiles</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.recurseinputfiles" title="Permalink to this definition">¶</a></dt>
<dd><p>Recurse through directories and return files to be processed.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.recursiveprocess">
<tt class="descname">recursiveprocess</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.recursiveprocess" title="Permalink to this definition">¶</a></dt>
<dd><p>recurse through directories and process files</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.reportprogress">
<tt class="descname">reportprogress</tt><big>(</big><em>filename</em>, <em>success</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.reportprogress" title="Permalink to this definition">¶</a></dt>
<dd><p>Shows that we are progressing...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.run">
<tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.run" title="Permalink to this definition">¶</a></dt>
<dd><p>parses the arguments, and runs recursiveprocess with the resulting options</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.set_usage">
<tt class="descname">set_usage</tt><big>(</big><em>usage=None</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.set_usage" title="Permalink to this definition">¶</a></dt>
<dd><p>sets the usage string - if usage not given, uses getusagestring for each option</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.seterrorleveloptions">
<tt class="descname">seterrorleveloptions</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.seterrorleveloptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the errorlevel options.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.setformats">
<tt class="descname">setformats</tt><big>(</big><em>formats</em>, <em>usetemplates</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.setformats" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the format options using the given format dictionary.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>formats</strong> (<em>Dictionary</em>) – <p>The dictionary <em>keys</em> should be:</p>
<ul class="simple">
<li>Single strings (or 1-tuples) containing an
input format (if not <em>usetemplates</em>)</li>
<li>Tuples containing an input format and
template format (if <em>usetemplates</em>)</li>
<li>Formats can be <em>None</em> to indicate what to do
with standard input</li>
</ul>
<p>The dictionary <em>values</em> should be tuples of
outputformat (string) and processor method.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.setmanpageoption">
<tt class="descname">setmanpageoption</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.setmanpageoption" title="Permalink to this definition">¶</a></dt>
<dd><p>creates a manpage option that allows the optionparser to generate a
manpage</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.setprogressoptions">
<tt class="descname">setprogressoptions</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.setprogressoptions" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the progress options.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.splitext">
<tt class="descname">splitext</tt><big>(</big><em>pathname</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.splitext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits <em>pathname</em> into name and ext, and removes the extsep.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pathname</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – A file path</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">root, ext</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">tuple</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.splitinputext">
<tt class="descname">splitinputext</tt><big>(</big><em>inputpath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.splitinputext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits an <em>inputpath</em> into name and extension.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.splittemplateext">
<tt class="descname">splittemplateext</tt><big>(</big><em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.splittemplateext" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits a <em>templatepath</em> into name and extension.</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.templateexists">
<tt class="descname">templateexists</tt><big>(</big><em>options</em>, <em>templatepath</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.templateexists" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns whether the given template exists...</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.poterminology.TerminologyOptionParser.warning">
<tt class="descname">warning</tt><big>(</big><em>msg</em>, <em>options=None</em>, <em>exc_info=None</em><big>)</big><a class="headerlink" href="#translate.tools.poterminology.TerminologyOptionParser.warning" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a warning message incorporating ‘msg’ to stderr and exit.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.pretranslate">
<span id="pretranslate"></span><h2>pretranslate<a class="headerlink" href="#module-translate.tools.pretranslate" title="Permalink to this headline">¶</a></h2>
<p>Fill localization files with suggested translations based on
translation memory and existing translations.</p>
<p>See: <a class="reference external" href="http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pretranslate.html">http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pretranslate.html</a>
for examples and usage instructions.</p>
<dl class="function">
<dt id="translate.tools.pretranslate.match_fuzzy">
<tt class="descclassname">translate.tools.pretranslate.</tt><tt class="descname">match_fuzzy</tt><big>(</big><em>input_unit</em>, <em>matchers</em><big>)</big><a class="headerlink" href="#translate.tools.pretranslate.match_fuzzy" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a fuzzy match from a queue of matchers.</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pretranslate.match_source">
<tt class="descclassname">translate.tools.pretranslate.</tt><tt class="descname">match_source</tt><big>(</big><em>input_unit</em>, <em>template_store</em><big>)</big><a class="headerlink" href="#translate.tools.pretranslate.match_source" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a matching unit from a template. matching based on unit id</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pretranslate.match_template_id">
<tt class="descclassname">translate.tools.pretranslate.</tt><tt class="descname">match_template_id</tt><big>(</big><em>input_unit</em>, <em>template_store</em><big>)</big><a class="headerlink" href="#translate.tools.pretranslate.match_template_id" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a matching unit from a template. matching based on unit id</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pretranslate.match_template_location">
<tt class="descclassname">translate.tools.pretranslate.</tt><tt class="descname">match_template_location</tt><big>(</big><em>input_unit</em>, <em>template_store</em><big>)</big><a class="headerlink" href="#translate.tools.pretranslate.match_template_location" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a matching unit from a template. matching based on locations</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pretranslate.memory">
<tt class="descclassname">translate.tools.pretranslate.</tt><tt class="descname">memory</tt><big>(</big><em>tmfiles</em>, <em>max_candidates=1</em>, <em>min_similarity=75</em>, <em>max_length=1000</em><big>)</big><a class="headerlink" href="#translate.tools.pretranslate.memory" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the TM store to use. Only initialises on first call.</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pretranslate.pretranslate_file">
<tt class="descclassname">translate.tools.pretranslate.</tt><tt class="descname">pretranslate_file</tt><big>(</big><em>input_file</em>, <em>output_file</em>, <em>template_file</em>, <em>tm=None</em>, <em>min_similarity=75</em>, <em>fuzzymatching=True</em><big>)</big><a class="headerlink" href="#translate.tools.pretranslate.pretranslate_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Pretranslate any factory supported file with old translations and
translation memory.</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pretranslate.pretranslate_store">
<tt class="descclassname">translate.tools.pretranslate.</tt><tt class="descname">pretranslate_store</tt><big>(</big><em>input_store</em>, <em>template_store</em>, <em>tm=None</em>, <em>min_similarity=75</em>, <em>fuzzymatching=True</em><big>)</big><a class="headerlink" href="#translate.tools.pretranslate.pretranslate_store" title="Permalink to this definition">¶</a></dt>
<dd><p>Do the actual pretranslation of a whole store.</p>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pretranslate.pretranslate_unit">
<tt class="descclassname">translate.tools.pretranslate.</tt><tt class="descname">pretranslate_unit</tt><big>(</big><em>input_unit</em>, <em>template_store</em>, <em>matchers=None</em>, <em>mark_reused=False</em>, <em>merge_on='id'</em><big>)</big><a class="headerlink" href="#translate.tools.pretranslate.pretranslate_unit" title="Permalink to this definition">¶</a></dt>
<dd><p>Pretranslate a unit or return unchanged if no translation was found.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>input_unit</strong> – Unit that will be pretranslated.</li>
<li><strong>template_store</strong> – Fill input unit with units matching in this store.</li>
<li><strong>matchers</strong> – List of fuzzy <a class="reference internal" href="search.html#translate.search.match.matcher" title="translate.search.match.matcher"><tt class="xref py py-class docutils literal"><span class="pre">matcher</span></tt></a>
objects.</li>
<li><strong>mark_reused</strong> – Whether to mark old translations as reused or not.</li>
<li><strong>merge_on</strong> – Where will the merge matching happen on.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.pydiff">
<span id="pydiff"></span><h2>pydiff<a class="headerlink" href="#module-translate.tools.pydiff" title="Permalink to this headline">¶</a></h2>
<p>diff tool like GNU diff, but lets you have special options
that are useful in dealing with PO files</p>
<dl class="class">
<dt id="translate.tools.pydiff.DirDiffer">
<em class="property">class </em><tt class="descclassname">translate.tools.pydiff.</tt><tt class="descname">DirDiffer</tt><big>(</big><em>fromdir</em>, <em>todir</em>, <em>options</em><big>)</big><a class="headerlink" href="#translate.tools.pydiff.DirDiffer" title="Permalink to this definition">¶</a></dt>
<dd><p>generates diffs between directories</p>
<dl class="method">
<dt id="translate.tools.pydiff.DirDiffer.isexcluded">
<tt class="descname">isexcluded</tt><big>(</big><em>difffile</em><big>)</big><a class="headerlink" href="#translate.tools.pydiff.DirDiffer.isexcluded" title="Permalink to this definition">¶</a></dt>
<dd><p>checks if the given filename has been excluded from the diff</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pydiff.DirDiffer.writediff">
<tt class="descname">writediff</tt><big>(</big><em>outfile</em><big>)</big><a class="headerlink" href="#translate.tools.pydiff.DirDiffer.writediff" title="Permalink to this definition">¶</a></dt>
<dd><p>writes the actual diff to the given file</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="translate.tools.pydiff.FileDiffer">
<em class="property">class </em><tt class="descclassname">translate.tools.pydiff.</tt><tt class="descname">FileDiffer</tt><big>(</big><em>fromfile</em>, <em>tofile</em>, <em>options</em><big>)</big><a class="headerlink" href="#translate.tools.pydiff.FileDiffer" title="Permalink to this definition">¶</a></dt>
<dd><p>generates diffs between files</p>
<dl class="method">
<dt id="translate.tools.pydiff.FileDiffer.get_from_lines">
<tt class="descname">get_from_lines</tt><big>(</big><em>group</em><big>)</big><a class="headerlink" href="#translate.tools.pydiff.FileDiffer.get_from_lines" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the lines referred to by group, from the fromfile</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pydiff.FileDiffer.get_to_lines">
<tt class="descname">get_to_lines</tt><big>(</big><em>group</em><big>)</big><a class="headerlink" href="#translate.tools.pydiff.FileDiffer.get_to_lines" title="Permalink to this definition">¶</a></dt>
<dd><p>returns the lines referred to by group, from the tofile</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pydiff.FileDiffer.unified_diff">
<tt class="descname">unified_diff</tt><big>(</big><em>group</em><big>)</big><a class="headerlink" href="#translate.tools.pydiff.FileDiffer.unified_diff" title="Permalink to this definition">¶</a></dt>
<dd><p>takes the group of opcodes and generates a unified diff line
by line</p>
</dd></dl>
<dl class="method">
<dt id="translate.tools.pydiff.FileDiffer.writediff">
<tt class="descname">writediff</tt><big>(</big><em>outfile</em><big>)</big><a class="headerlink" href="#translate.tools.pydiff.FileDiffer.writediff" title="Permalink to this definition">¶</a></dt>
<dd><p>writes the actual diff to the given file</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pydiff.main">
<tt class="descclassname">translate.tools.pydiff.</tt><tt class="descname">main</tt><big>(</big><big>)</big><a class="headerlink" href="#translate.tools.pydiff.main" title="Permalink to this definition">¶</a></dt>
<dd><p>main program for pydiff</p>
</dd></dl>
</div>
<div class="section" id="module-translate.tools.pypo2phppo">
<span id="pypo2phppo"></span><h2>pypo2phppo<a class="headerlink" href="#module-translate.tools.pypo2phppo" title="Permalink to this headline">¶</a></h2>
<p>Convert Python format .po files to PHP format .po files.</p>
<dl class="function">
<dt id="translate.tools.pypo2phppo.convertpy2php">
<tt class="descclassname">translate.tools.pypo2phppo.</tt><tt class="descname">convertpy2php</tt><big>(</big><em>inputfile</em>, <em>outputfile</em>, <em>template=None</em><big>)</big><a class="headerlink" href="#translate.tools.pypo2phppo.convertpy2php" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts from Python .po to PHP .po</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>inputfile</strong> – file handle of the source</li>
<li><strong>outputfile</strong> – file handle to write to</li>
<li><strong>template</strong> – unused</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="translate.tools.pypo2phppo.main">
<tt class="descclassname">translate.tools.pypo2phppo.</tt><tt class="descname">main</tt><big>(</big><em>argv=None</em><big>)</big><a class="headerlink" href="#translate.tools.pypo2phppo.main" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts from Python .po to PHP .po</p>
</dd></dl>
</div>
</div>
</div>
<hr>
<footer class="footer">
<div class="container">
<p class="pull-right"><a href="#">Back to top ↑</a></p>
<ul class="unstyled muted">
<li><small>
© 2012, Translate.org.za.<br/>
</small></li>
<li><small>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2.1.
</small></li>
</ul>
</div>
</footer>
</body>
</html> | staranjeet/fjord | vendor/packages/translate-toolkit/docs/_build/html/api/tools.html | HTML | bsd-3-clause | 131,436 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
30524,
8917,
1013,
19817,
1013,
1060,
11039,
19968,
2487,
1013,
26718,
2094,
1013,
1060,
11039,
19968,
2487,
1011,
17459,
1012,
26718,
2094,
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... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.geode.distributed.internal.membership;
import org.apache.geode.distributed.internal.DMStats;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.LocatorStats;
import org.apache.geode.distributed.internal.membership.gms.NetLocator;
import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
import org.apache.geode.internal.security.SecurityService;
import java.io.File;
import java.net.InetAddress;
/**
* This is the SPI for a provider of membership services.
*
* @see org.apache.geode.distributed.internal.membership.NetMember
*/
public interface MemberServices {
/**
* Return a new NetMember, possibly for a different host
*
* @param i the name of the host for the specified NetMember, the current host (hopefully) if
* there are any problems.
* @param port the membership port
* @param splitBrainEnabled whether the member has this feature enabled
* @param canBeCoordinator whether the member can be membership coordinator
* @param payload the payload to be associated with the resulting object
* @param version TODO
* @return the new NetMember
*/
public abstract NetMember newNetMember(InetAddress i, int port, boolean splitBrainEnabled,
boolean canBeCoordinator, MemberAttributes payload, short version);
/**
* Return a new NetMember representing current host
*
* @param i an InetAddress referring to the current host
* @param port the membership port being used
*
* @return the new NetMember
*/
public abstract NetMember newNetMember(InetAddress i, int port);
/**
* Return a new NetMember representing current host
*
* @param s a String referring to the current host
* @param p the membership port being used
* @return the new member
*/
public abstract NetMember newNetMember(String s, int p);
/**
* Create a new MembershipManager
*
* @param listener the listener to notify for callbacks
* @param transport holds configuration information that can be used by the manager to configure
* itself
* @param stats a gemfire statistics collection object for communications stats
*
* @return a MembershipManager
*/
public abstract MembershipManager newMembershipManager(DistributedMembershipListener listener,
DistributionConfig config, RemoteTransportConfig transport, DMStats stats,
SecurityService securityService);
/**
* currently this is a test method but it ought to be used by InternalLocator to create the peer
* location TcpHandler
*/
public abstract NetLocator newLocatorHandler(InetAddress bindAddress, File stateFile,
String locatorString, boolean usePreferredCoordinators,
boolean networkPartitionDetectionEnabled, LocatorStats stats, String securityUDPDHAlgo);
}
| pivotal-amurmann/geode | geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberServices.java | Java | apache-2.0 | 3,644 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
12130,
6105,
1008,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
2023,
2147,
2005,
3176,
2592,
4953,
1008,
9385,
6095,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Test async injectors
*/
import { memoryHistory } from 'react-router';
import { put } from 'redux-saga/effects';
import { fromJS } from 'immutable';
import configureStore from 'store';
import {
injectAsyncReducer,
injectAsyncSagas,
getAsyncInjectors,
} from '../asyncInjectors';
// Fixtures
const initialState = fromJS({ reduced: 'soon' });
const reducer = (state = initialState, action) => {
switch (action.type) {
case 'TEST':
return state.set('reduced', action.payload);
default:
return state;
}
};
function* testSaga() {
yield put({ type: 'TEST', payload: 'yup' });
}
const sagas = [
testSaga,
];
describe('asyncInjectors', () => {
let store;
describe('getAsyncInjectors', () => {
beforeAll(() => {
store = configureStore({}, memoryHistory);
});
it('given a store, should return all async injectors', () => {
const { injectReducer, injectSagas } = getAsyncInjectors(store);
injectReducer('test', reducer);
injectSagas(sagas);
const actual = store.getState().get('test');
const expected = initialState.merge({ reduced: 'yup' });
expect(actual.toJS()).toEqual(expected.toJS());
});
it('should throw if passed invalid store shape', () => {
let result = false;
Reflect.deleteProperty(store, 'dispatch');
try {
getAsyncInjectors(store);
} catch (err) {
result = err.name === 'Invariant Violation';
}
expect(result).toEqual(true);
});
});
describe('helpers', () => {
beforeAll(() => {
store = configureStore({}, memoryHistory);
});
describe('injectAsyncReducer', () => {
it('given a store, it should provide a function to inject a reducer', () => {
const injectReducer = injectAsyncReducer(store);
injectReducer('test', reducer);
const actual = store.getState().get('test');
const expected = initialState;
expect(actual.toJS()).toEqual(expected.toJS());
});
it('should not assign reducer if already existing', () => {
const injectReducer = injectAsyncReducer(store);
injectReducer('test', reducer);
injectReducer('test', () => {});
expect(store.asyncReducers.test.toString()).toEqual(reducer.toString());
});
it('should throw if passed invalid name', () => {
let result = false;
const injectReducer = injectAsyncReducer(store);
try {
injectReducer('', reducer);
} catch (err) {
result = err.name === 'Invariant Violation';
}
try {
injectReducer(999, reducer);
} catch (err) {
result = err.name === 'Invariant Violation';
}
expect(result).toEqual(true);
});
it('should throw if passed invalid reducer', () => {
let result = false;
const injectReducer = injectAsyncReducer(store);
try {
injectReducer('bad', 'nope');
} catch (err) {
result = err.name === 'Invariant Violation';
}
try {
injectReducer('coolio', 12345);
} catch (err) {
result = err.name === 'Invariant Violation';
}
expect(result).toEqual(true);
});
});
describe('injectAsyncSagas', () => {
it('given a store, it should provide a function to inject a saga', () => {
const injectSagas = injectAsyncSagas(store);
injectSagas(sagas);
const actual = store.getState().get('test');
const expected = initialState.merge({ reduced: 'yup' });
expect(actual.toJS()).toEqual(expected.toJS());
});
it('should throw if passed invalid saga', () => {
let result = false;
const injectSagas = injectAsyncSagas(store);
try {
injectSagas({ testSaga });
} catch (err) {
result = err.name === 'Invariant Violation';
}
try {
injectSagas(testSaga);
} catch (err) {
result = err.name === 'Invariant Violation';
}
expect(result).toEqual(true);
});
});
});
});
| HachiJiang/FamilyFinanceSite | app/utils/tests/asyncInjectors.test.js | JavaScript | mit | 4,871 | [
30522,
1013,
1008,
1008,
1008,
3231,
2004,
6038,
2278,
1999,
20614,
5668,
1008,
1013,
12324,
1063,
3638,
24158,
7062,
1065,
2013,
1005,
10509,
1011,
2799,
2099,
1005,
1025,
12324,
1063,
2404,
1065,
2013,
1005,
2417,
5602,
1011,
12312,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.docuware.dev.settings.common;
import java.net.URI;
import com.docuware.dev.Extensions.*;
import java.util.concurrent.CompletableFuture;
import java.util.*;
import com.docuware.dev.schema._public.services.Link;
import javax.xml.bind.annotation.XmlRegistry;
@XmlRegistry
public class ObjectFactory {
public ObjectFactory() {
}
public DWRectangle createDWRectangle() {
return new DWRectangle();
}
public KeyValuePair createKeyValuePair() {
return new KeyValuePair();
}
public KeyValuePairs createKeyValuePairs() {
return new KeyValuePairs();
}
public DWPoint createDWPoint() {
return new DWPoint();
}
public DWSize createDWSize() {
return new DWSize();
}
}
| DocuWare/PlatformJavaClient | src/com/docuware/dev/settings/common/ObjectFactory.java | Java | mit | 814 | [
30522,
7427,
4012,
1012,
9986,
25974,
12069,
1012,
16475,
1012,
10906,
1012,
2691,
1025,
12324,
9262,
1012,
5658,
1012,
24471,
2072,
1025,
12324,
4012,
1012,
9986,
25974,
12069,
1012,
16475,
1012,
14305,
1012,
1008,
1025,
12324,
9262,
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... |
.head_title {
text-align: center;
font-size: 20px;
color:#002529;
font-weight: 400;
position:relative;
}
.head_title:after{content: ''; position: absolute;left: 0;top:30px; background:#cacaca; width: 100%;height: 1px;
-webkit-transform: scaleY(0.5);transform: scaleY(0.5);-webkit-transform-origin: 0 0;transform-origin: 0 0; }
.weui-search-bar,.weui-search-bar__form{background-color:#fff;}
.weui-search-bar__label{text-align: left;margin:0 10px;}
.weui-search-bar:before{border-top:none;}
.weui-search-bar:after{border-bottom:none;}
.swiper-container {
width: 100%;
height: 100%;
}
.swiper-container img{width:100%;height:100%;}
.btn_libao{margin:10px 36px; height: auto; overflow: hidden;}
.btn_libao img{width:100%; height:100%; max-width: 100%; }
.bar_square{margin:10px 0; }
.bar_square:before, .bar_square:after,.bar_square .weui-grid:before{border:none;}
.bar_square .weui-grid__icon{width:45px;height: 50px;}
.bar_square .weui-footer, .weui-grid__label{font-size:16px;}
.song_left{ width:50%; padding-right:5px;}
.song_left img{width:100%; max-width: 100%;}
.song_right{width:50%;}
.song_right img{width:100%; max-width: 100%;}
.demos-title {
text-align: center;
font-size:30px;
color: #2b2b2b;
font-weight: 400;
margin: 0 15%;
}
.demos-sub-title {
text-align: center;
color: #2b2b2b;
font-size: 14px;
}
.demos-header {
position:relative;
margin:25px 0;
}
.demos_right_ico{position:absolute; right:25px;top:30px;}
.demos_right_ico:after{
content: " ";
display: inline-block;
height: 12px;
width: 12px;
border-width: 2px 2px 0 0;
border-color: #c8c8cd;
border-style: solid;
-webkit-transform: matrix(.71,.71,-.71,.71,0,0);
transform: matrix(.71,.71,-.71,.71,0,0);
position: relative;
position: absolute;
right: 2px;
}
.flavor{padding-bottom:5px;}
.flavor .weui-grid__icon{width:100%;height: 100%;}
/*热卖精选*/
.hot_buy{margin:20px 0 80px; height: auto; overflow: hidden; padding:0 2%;}
.hot_buy li{float: left; list-style: none; width:48%;margin:0 1%; text-align: center; margin-bottom:20px;}
.hot_buy img{width:100%;height:100%;}
.hot_buy .p1{color: #222222; font-size:16px; font-weight: bolder;}
.hot_buy .p2{color: #494949; font-size:14px;}
.hot_buy .p3{color: #f4392d; font-size:16px;}
.weui-tabbar{position:fixed;}
.weui-tabbar__item .weui-tabbar__label{color:#252525;}
.weui-tabbar__item.active .weui-tabbar__label{color:#ff2d2d;}
.active i{color:#ff2d2d;}
/**新品上市*/
.news_list li{
box-sizing: border-box;
border:1px solid #eaeaea;
text-align:left;
height: auto;
overflow: hidden;
}
.news_list li p{padding:0 5px;line-height: 26px;}
.news_list li .p2{color: #666666;}
.news_list li .p3 span{color:#b8b8b8; text-decoration: line-through; padding-left:15px;}
.news_list li .p4{font-size:12px; color:#b8b8b8; padding:5px 5px;}
/**类型*/
.type-tab{border-top:1px solid #eee;}
.type_left{float: left;width:30%;position:inherit;display: block; background:#fff;}
.type_left .weui-navbar__item{width:100%;height: auto;overflow: hidden;}
.type_left .weui-navbar__item:after{border-right:none;}
.type_left:after{border-bottom:none;}
.type_right{float:left; width:70%; border-left: 1px solid #eee;min-height: 500px;}
.weui-navbar+.type_right{padding-top:0;}
.type_right .rqtj_list .p_title{font-size:13px; color: #636363;}
.type_right .rqtj_list .p_price{font-size:13px; color:red; text-align: center;}
.pinpai_list li{
list-style: none;
width:31%;
box-sizing: border-box;
padding:0 5px;
border:1px solid #eee;
border-radius: 2px;
}
.pinpai_list li .p_title{text-align: center; font-size:13px; color: #636363;margin-bottom:5px;}
.type_renqun{width:80%;margin:0 10%;}
.type_renqun li{list-style: none; width:100%;}
.type_renqun li img{width:100%;height: 100%;}
.type_right .hot_buy{margin:0 0 80px;}
.type_right .p_biaoti{text-align: center; margin:15px 0; color: #adadad;font-size:13px;}
.type_right .p_biaoti span{color: #eaeaea;}
/**个人中心*/
.nav_info{
background-color:#ec3e36; height:120px;width:100%;
}
.nav_info img{width:50px;height: 50px; border-radius: 50%; border:2px solid #fff; float: left; margin:20px ;}
.nav_info p{color: #fff; font-size: 18px; padding-top:40px;}
.cells_setall{padding-bottom:10px;font-size:16px;}
.cells_setall:before{border:none;}
.weui-cells:after{bottom:1px;}
.user_navlist{text-align: center; color:#938e8e;margin:15px 0}
.user_navlist i{color:#938e8e}
.div_gray{width:100%;height:10px; background: #eeeeee;}
.user_list p{color: #444;}
.user_list:before{border:none;}
/*three.html 详细信息*/
.three_pageinfo{padding:10px;}
.three_pageinfo .p1{color: #373b41;font-size:18px;}
.three_pageinfo .p1 span{background: #66d8d6;display:inline-block;font-size:14px; padding:1px 5px;border-radius: 5px; margin-left: 10px; color:#fff;}
.three_pageinfo .p2{color: #b8b8b8;font-size:16px;margin-top:5px;}
.three_pageinfo .p3{color: #f44236;font-size:18px;font-weight: bolder; margin-top:10px;}
.three_pageinfo .p3 span{display: inline-block;text-decoration: line-through;color: #b8b8b8;margin-left:15px;}
.three_pageinfo .p4{color: #f44236;font-size:16px;border-top:1px solid #eee;margin-top:10px;padding:5px 0;}
.three_guige{margin:10px 0;}
.three_guige p{color:#b8b8b8;font-size:14px;}
.three_guige p span{color:#000000;font-size:14px;margin-left:15px;}
.three_guige:before,.three_guige:after{border:None;}
.three_guige .weui-cell_access .weui-cell__ft:after{border-color:#000000;width:10px;height: 10px;border-width: 1px 1px 0 0;}
.evaluate .weui-cell__bd{color:#b8b8b8}
.evaluate .weui-cell__bd span{display: inline-block;margin-left: 10px; color:#373b41}
.evaluate .weui-cell__bd label{color:red;}
.three_imglist{margin:10px 0 80px; padding:0 10px;}
.three_imglist p{color:#b8b8b8;margin:5px 0;}
.three_imglist img{width:100%;height: 100%;}
.placeholder {
margin: 5px 10px;
padding: 0 20px;
text-align: center;
color: #cfcfcf;
}
.buy_button{display: block; background: #ff3939}
.buy_button .weui-tabbar__item .weui-tabbar__label{color:#fff;font-size:16px;padding-top:10px;}
.buy_wintop{margin:20px 0; height: auto;overflow: hidden;}
.buy_wintop img{float: left; width:50px; height: 50px;margin-left:20px;}
.buy_wintop .div_right{float: left;font-size:14px;margin-left:15px;}
.buy_wintop .p2{color:#f44236;font-size:12px;font-weight: bolder;}
.buy_wintop .p3{color:#b8b8b8;font-size:12px;}
.buy_winmiddle{padding:10px 20px;width:100%;height: auto; overflow: hidden;color: #000;}
.buy_winmiddle span{display: inline-block;margin:10px 5px 0; border-radius: 3px; border:1px solid #666; width:40%;text-align: center;}
.buy_winmiddle .active{border:1px solid #f44236;color: #f44236;}
.buy_bottom p{float: left;}
.weui-actionsheet__title{height: auto;overflow: hidden; text-align: left;padding: 0;}
.weui-actionsheet__action{display: none;}
.gw_num{float:left; margin-left:43%;border: 1px solid #dbdbdb; line-height: 26px;overflow: hidden;}
.gw_num em{display: block;height: 26px;width: 26px;float:left;color: #7A7979;border-right: 1px solid #dbdbdb;text-align: center;cursor: pointer;}
.gw_num .num{display: block;float: left;text-align: center;width: 52px;font-style: normal;font-size: 14px;line-height: 26px;border: 0;}
.gw_num em.add{float: right;border-right:0;border-left: 1px solid #dbdbdb;}
| lanyanjing-2016/lanyanjing-2016.github.io | items/weui-master/css/main.css | CSS | gpl-2.0 | 7,305 | [
30522,
1012,
2132,
1035,
2516,
1063,
3793,
1011,
25705,
1024,
2415,
1025,
15489,
1011,
2946,
1024,
2322,
2361,
2595,
1025,
3609,
1024,
1001,
4002,
17788,
24594,
1025,
15489,
1011,
3635,
1024,
4278,
1025,
2597,
1024,
5816,
1025,
1065,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.composite.uncovered.image.destination-in</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/canvas/resources/canvas-tests.js"></script>
<h1>2d.composite.uncovered.image.destination-in</h1>
<p class="desc">drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p>
<script>
var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
throw reason;
});
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
ctx.fillRect(0, 0, 100, 50);
ctx.globalCompositeOperation = 'destination-in';
var promise = new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open("GET", '/images/yellow.png');
xhr.responseType = 'blob';
xhr.send();
xhr.onload = function() {
resolve(xhr.response);
};
});
promise.then(function(response) {
createImageBitmap(response).then(bitmap => {
ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10);
_assertPixelApprox(offscreenCanvas, 15,15, 0,0,0,0, "15,15", "0,0,0,0", 5);
_assertPixelApprox(offscreenCanvas, 50,25, 0,0,0,0, "50,25", "0,0,0,0", 5);
}, t_fail);
}).then(t_pass, t_fail);
});
</script>
| nwjs/chromium.src | third_party/blink/web_tests/external/wpt/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-in.html | HTML | bsd-3-clause | 1,641 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
999,
1011,
1011,
2079,
2025,
10086,
999,
2023,
3231,
2038,
2042,
7013,
2011,
1013,
16129,
1013,
10683,
1013,
5906,
1013,
30524,
1000,
1028,
1026,
1013,
5896,
1028,
1026,
5896,
5034,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Zepto v1.1.4 - zepto event ajax form ie - zeptojs.com/license */
var Zepto = (function() {
var undefined, key, $, classList, emptyArray = [], slice = emptyArray.slice, filter = emptyArray.filter,
document = window.document,
elementDisplay = {}, classCache = {},
cssNumber = { 'column-count': 1, 'columns': 1, 'font-weight': 1, 'line-height': 1,'opacity': 1, 'z-index': 1, 'zoom': 1 },
fragmentRE = /^\s*<(\w+|!)[^>]*>/,
singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rootNodeRE = /^(?:body|html)$/i,
capitalRE = /([A-Z])/g,
// special attributes that should be get/set via method calls
methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'],
adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ],
table = document.createElement('table'),
tableRow = document.createElement('tr'),
containers = {
'tr': document.createElement('tbody'),
'tbody': table, 'thead': table, 'tfoot': table,
'td': tableRow, 'th': tableRow,
'*': document.createElement('div')
},
readyRE = /complete|loaded|interactive/,
simpleSelectorRE = /^[\w-]*$/,
class2type = {},
toString = class2type.toString,
zepto = {},
camelize, uniq,
tempParent = document.createElement('div'),
propMap = {
'tabindex': 'tabIndex',
'readonly': 'readOnly',
'for': 'htmlFor',
'class': 'className',
'maxlength': 'maxLength',
'cellspacing': 'cellSpacing',
'cellpadding': 'cellPadding',
'rowspan': 'rowSpan',
'colspan': 'colSpan',
'usemap': 'useMap',
'frameborder': 'frameBorder',
'contenteditable': 'contentEditable'
},
isArray = Array.isArray ||
function(object){ return object instanceof Array }
zepto.matches = function(element, selector) {
if (!selector || !element || element.nodeType !== 1) return false
var matchesSelector = element.webkitMatchesSelector || element.mozMatchesSelector ||
element.oMatchesSelector || element.matchesSelector
if (matchesSelector) return matchesSelector.call(element, selector)
// fall back to performing a selector:
var match, parent = element.parentNode, temp = !parent
if (temp) (parent = tempParent).appendChild(element)
match = ~zepto.qsa(parent, selector).indexOf(element)
temp && tempParent.removeChild(element)
return match
}
function type(obj) {
return obj == null ? String(obj) :
class2type[toString.call(obj)] || "object"
}
function isFunction(value) { return type(value) == "function" }
function isWindow(obj) { return obj != null && obj == obj.window }
function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE }
function isObject(obj) { return type(obj) == "object" }
function isPlainObject(obj) {
return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype
}
function likeArray(obj) { return typeof obj.length == 'number' }
function compact(array) { return filter.call(array, function(item){ return item != null }) }
function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array }
camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) }
function dasherize(str) {
return str.replace(/::/g, '/')
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
.replace(/([a-z\d])([A-Z])/g, '$1_$2')
.replace(/_/g, '-')
.toLowerCase()
}
uniq = function(array){ return filter.call(array, function(item, idx){ return array.indexOf(item) == idx }) }
function classRE(name) {
return name in classCache ?
classCache[name] : (classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)'))
}
function maybeAddPx(name, value) {
return (typeof value == "number" && !cssNumber[dasherize(name)]) ? value + "px" : value
}
function defaultDisplay(nodeName) {
var element, display
if (!elementDisplay[nodeName]) {
element = document.createElement(nodeName)
document.body.appendChild(element)
display = getComputedStyle(element, '').getPropertyValue("display")
element.parentNode.removeChild(element)
display == "none" && (display = "block")
elementDisplay[nodeName] = display
}
return elementDisplay[nodeName]
}
function children(element) {
return 'children' in element ?
slice.call(element.children) :
$.map(element.childNodes, function(node){ if (node.nodeType == 1) return node })
}
// `$.zepto.fragment` takes a html string and an optional tag name
// to generate DOM nodes nodes from the given html string.
// The generated DOM nodes are returned as an array.
// This function can be overriden in plugins for example to make
// it compatible with browsers that don't support the DOM fully.
zepto.fragment = function(html, name, properties) {
var dom, nodes, container
// A special case optimization for a single tag
if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1))
if (!dom) {
if (html.replace) html = html.replace(tagExpanderRE, "<$1></$2>")
if (name === undefined) name = fragmentRE.test(html) && RegExp.$1
if (!(name in containers)) name = '*'
container = containers[name]
container.innerHTML = '' + html
dom = $.each(slice.call(container.childNodes), function(){
container.removeChild(this)
})
}
if (isPlainObject(properties)) {
nodes = $(dom)
$.each(properties, function(key, value) {
if (methodAttributes.indexOf(key) > -1) nodes[key](value)
else nodes.attr(key, value)
})
}
return dom
}
// `$.zepto.Z` swaps out the prototype of the given `dom` array
// of nodes with `$.fn` and thus supplying all the Zepto functions
// to the array. Note that `__proto__` is not supported on Internet
// Explorer. This method can be overriden in plugins.
zepto.Z = function(dom, selector) {
dom = dom || []
dom.__proto__ = $.fn
dom.selector = selector || ''
return dom
}
// `$.zepto.isZ` should return `true` if the given object is a Zepto
// collection. This method can be overriden in plugins.
zepto.isZ = function(object) {
return object instanceof zepto.Z
}
// `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and
// takes a CSS selector and an optional context (and handles various
// special cases).
// This method can be overriden in plugins.
zepto.init = function(selector, context) {
var dom
// If nothing given, return an empty Zepto collection
if (!selector) return zepto.Z()
// Optimize for string selectors
else if (typeof selector == 'string') {
selector = selector.trim()
// If it's a html fragment, create nodes from it
// Note: In both Chrome 21 and Firefox 15, DOM error 12
// is thrown if the fragment doesn't begin with <
if (selector[0] == '<' && fragmentRE.test(selector))
dom = zepto.fragment(selector, RegExp.$1, context), selector = null
// If there's a context, create a collection on that context first, and select
// nodes from there
else if (context !== undefined) return $(context).find(selector)
// If it's a CSS selector, use it to select nodes.
else dom = zepto.qsa(document, selector)
}
// If a function is given, call it when the DOM is ready
else if (isFunction(selector)) return $(document).ready(selector)
// If a Zepto collection is given, just return it
else if (zepto.isZ(selector)) return selector
else {
// normalize array if an array of nodes is given
if (isArray(selector)) dom = compact(selector)
// Wrap DOM nodes.
else if (isObject(selector))
dom = [selector], selector = null
// If it's a html fragment, create nodes from it
else if (fragmentRE.test(selector))
dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null
// If there's a context, create a collection on that context first, and select
// nodes from there
else if (context !== undefined) return $(context).find(selector)
// And last but no least, if it's a CSS selector, use it to select nodes.
else dom = zepto.qsa(document, selector)
}
// create a new Zepto collection from the nodes found
return zepto.Z(dom, selector)
}
// `$` will be the base `Zepto` object. When calling this
// function just call `$.zepto.init, which makes the implementation
// details of selecting nodes and creating Zepto collections
// patchable in plugins.
$ = function(selector, context){
return zepto.init(selector, context)
}
function extend(target, source, deep) {
for (key in source)
if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
if (isPlainObject(source[key]) && !isPlainObject(target[key]))
target[key] = {}
if (isArray(source[key]) && !isArray(target[key]))
target[key] = []
extend(target[key], source[key], deep)
}
else if (source[key] !== undefined) target[key] = source[key]
}
// Copy all but undefined properties from one or more
// objects to the `target` object.
$.extend = function(target){
var deep, args = slice.call(arguments, 1)
if (typeof target == 'boolean') {
deep = target
target = args.shift()
}
args.forEach(function(arg){ extend(target, arg, deep) })
return target
}
// `$.zepto.qsa` is Zepto's CSS selector implementation which
// uses `document.querySelectorAll` and optimizes for some special cases, like `#id`.
// This method can be overriden in plugins.
zepto.qsa = function(element, selector){
var found,
maybeID = selector[0] == '#',
maybeClass = !maybeID && selector[0] == '.',
nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked
isSimple = simpleSelectorRE.test(nameOnly)
return (isDocument(element) && isSimple && maybeID) ?
( (found = element.getElementById(nameOnly)) ? [found] : [] ) :
(element.nodeType !== 1 && element.nodeType !== 9) ? [] :
slice.call(
isSimple && !maybeID ?
maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class
element.getElementsByTagName(selector) : // Or a tag
element.querySelectorAll(selector) // Or it's not simple, and we need to query all
)
}
function filtered(nodes, selector) {
return selector == null ? $(nodes) : $(nodes).filter(selector)
}
$.contains = document.documentElement.contains ?
function(parent, node) {
return parent !== node && parent.contains(node)
} :
function(parent, node) {
while (node && (node = node.parentNode))
if (node === parent) return true
return false
}
function funcArg(context, arg, idx, payload) {
return isFunction(arg) ? arg.call(context, idx, payload) : arg
}
function setAttribute(node, name, value) {
value == null ? node.removeAttribute(name) : node.setAttribute(name, value)
}
// access className property while respecting SVGAnimatedString
function className(node, value){
var klass = node.className,
svg = klass && klass.baseVal !== undefined
if (value === undefined) return svg ? klass.baseVal : klass
svg ? (klass.baseVal = value) : (node.className = value)
}
// "true" => true
// "false" => false
// "null" => null
// "42" => 42
// "42.5" => 42.5
// "08" => "08"
// JSON => parse if valid
// String => self
function deserializeValue(value) {
var num
try {
return value ?
value == "true" ||
( value == "false" ? false :
value == "null" ? null :
!/^0/.test(value) && !isNaN(num = Number(value)) ? num :
/^[\[\{]/.test(value) ? $.parseJSON(value) :
value )
: value
} catch(e) {
return value
}
}
$.type = type
$.isFunction = isFunction
$.isWindow = isWindow
$.isArray = isArray
$.isPlainObject = isPlainObject
$.isEmptyObject = function(obj) {
var name
for (name in obj) return false
return true
}
$.inArray = function(elem, array, i){
return emptyArray.indexOf.call(array, elem, i)
}
$.camelCase = camelize
$.trim = function(str) {
return str == null ? "" : String.prototype.trim.call(str)
}
// plugin compatibility
$.uuid = 0
$.support = { }
$.expr = { }
$.map = function(elements, callback){
var value, values = [], i, key
if (likeArray(elements))
for (i = 0; i < elements.length; i++) {
value = callback(elements[i], i)
if (value != null) values.push(value)
}
else
for (key in elements) {
value = callback(elements[key], key)
if (value != null) values.push(value)
}
return flatten(values)
}
$.each = function(elements, callback){
var i, key
if (likeArray(elements)) {
for (i = 0; i < elements.length; i++)
if (callback.call(elements[i], i, elements[i]) === false) return elements
} else {
for (key in elements)
if (callback.call(elements[key], key, elements[key]) === false) return elements
}
return elements
}
$.grep = function(elements, callback){
return filter.call(elements, callback)
}
if (window.JSON) $.parseJSON = JSON.parse
// Populate the class2type map
$.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase()
})
// Define methods that will be available on all
// Zepto collections
$.fn = {
// Because a collection acts like an array
// copy over these useful array functions.
forEach: emptyArray.forEach,
reduce: emptyArray.reduce,
push: emptyArray.push,
sort: emptyArray.sort,
indexOf: emptyArray.indexOf,
concat: emptyArray.concat,
// `map` and `slice` in the jQuery API work differently
// from their array counterparts
map: function(fn){
return $($.map(this, function(el, i){ return fn.call(el, i, el) }))
},
slice: function(){
return $(slice.apply(this, arguments))
},
ready: function(callback){
// need to check if document.body exists for IE as that browser reports
// document ready when it hasn't yet created the body element
if (readyRE.test(document.readyState) && document.body) callback($)
else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false)
return this
},
get: function(idx){
return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length]
},
toArray: function(){ return this.get() },
size: function(){
return this.length
},
remove: function(){
return this.each(function(){
if (this.parentNode != null)
this.parentNode.removeChild(this)
})
},
each: function(callback){
emptyArray.every.call(this, function(el, idx){
return callback.call(el, idx, el) !== false
})
return this
},
filter: function(selector){
if (isFunction(selector)) return this.not(this.not(selector))
return $(filter.call(this, function(element){
return zepto.matches(element, selector)
}))
},
add: function(selector,context){
return $(uniq(this.concat($(selector,context))))
},
is: function(selector){
return this.length > 0 && zepto.matches(this[0], selector)
},
not: function(selector){
var nodes=[]
if (isFunction(selector) && selector.call !== undefined)
this.each(function(idx){
if (!selector.call(this,idx)) nodes.push(this)
})
else {
var excludes = typeof selector == 'string' ? this.filter(selector) :
(likeArray(selector) && isFunction(selector.item)) ? slice.call(selector) : $(selector)
this.forEach(function(el){
if (excludes.indexOf(el) < 0) nodes.push(el)
})
}
return $(nodes)
},
has: function(selector){
return this.filter(function(){
return isObject(selector) ?
$.contains(this, selector) :
$(this).find(selector).size()
})
},
eq: function(idx){
return idx === -1 ? this.slice(idx) : this.slice(idx, + idx + 1)
},
first: function(){
var el = this[0]
return el && !isObject(el) ? el : $(el)
},
last: function(){
var el = this[this.length - 1]
return el && !isObject(el) ? el : $(el)
},
find: function(selector){
var result, $this = this
if (!selector) result = []
else if (typeof selector == 'object')
result = $(selector).filter(function(){
var node = this
return emptyArray.some.call($this, function(parent){
return $.contains(parent, node)
})
})
else if (this.length == 1) result = $(zepto.qsa(this[0], selector))
else result = this.map(function(){ return zepto.qsa(this, selector) })
return result
},
closest: function(selector, context){
var node = this[0], collection = false
if (typeof selector == 'object') collection = $(selector)
while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector)))
node = node !== context && !isDocument(node) && node.parentNode
return $(node)
},
parents: function(selector){
var ancestors = [], nodes = this
while (nodes.length > 0)
nodes = $.map(nodes, function(node){
if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {
ancestors.push(node)
return node
}
})
return filtered(ancestors, selector)
},
parent: function(selector){
return filtered(uniq(this.pluck('parentNode')), selector)
},
children: function(selector){
return filtered(this.map(function(){ return children(this) }), selector)
},
contents: function() {
return this.map(function() { return slice.call(this.childNodes) })
},
siblings: function(selector){
return filtered(this.map(function(i, el){
return filter.call(children(el.parentNode), function(child){ return child!==el })
}), selector)
},
empty: function(){
return this.each(function(){ this.innerHTML = '' })
},
// `pluck` is borrowed from Prototype.js
pluck: function(property){
return $.map(this, function(el){ return el[property] })
},
show: function(){
return this.each(function(){
this.style.display == "none" && (this.style.display = '')
if (getComputedStyle(this, '').getPropertyValue("display") == "none")
this.style.display = defaultDisplay(this.nodeName)
})
},
replaceWith: function(newContent){
return this.before(newContent).remove()
},
wrap: function(structure){
var func = isFunction(structure)
if (this[0] && !func)
var dom = $(structure).get(0),
clone = dom.parentNode || this.length > 1
return this.each(function(index){
$(this).wrapAll(
func ? structure.call(this, index) :
clone ? dom.cloneNode(true) : dom
)
})
},
wrapAll: function(structure){
if (this[0]) {
$(this[0]).before(structure = $(structure))
var children
// drill down to the inmost element
while ((children = structure.children()).length) structure = children.first()
$(structure).append(this)
}
return this
},
wrapInner: function(structure){
var func = isFunction(structure)
return this.each(function(index){
var self = $(this), contents = self.contents(),
dom = func ? structure.call(this, index) : structure
contents.length ? contents.wrapAll(dom) : self.append(dom)
})
},
unwrap: function(){
this.parent().each(function(){
$(this).replaceWith($(this).children())
})
return this
},
clone: function(){
return this.map(function(){ return this.cloneNode(true) })
},
hide: function(){
return this.css("display", "none")
},
toggle: function(setting){
return this.each(function(){
var el = $(this)
;(setting === undefined ? el.css("display") == "none" : setting) ? el.show() : el.hide()
})
},
prev: function(selector){ return $(this.pluck('previousElementSibling')).filter(selector || '*') },
next: function(selector){ return $(this.pluck('nextElementSibling')).filter(selector || '*') },
html: function(html){
return 0 in arguments ?
this.each(function(idx){
var originHtml = this.innerHTML
$(this).empty().append( funcArg(this, html, idx, originHtml) )
}) :
(0 in this ? this[0].innerHTML : null)
},
text: function(text){
return 0 in arguments ?
this.each(function(idx){
var newText = funcArg(this, text, idx, this.textContent)
this.textContent = newText == null ? '' : ''+newText
}) :
(0 in this ? this[0].textContent : null)
},
attr: function(name, value){
var result
return (typeof name == 'string' && !(1 in arguments)) ?
(!this.length || this[0].nodeType !== 1 ? undefined :
(!(result = this[0].getAttribute(name)) && name in this[0]) ? this[0][name] : result
) :
this.each(function(idx){
if (this.nodeType !== 1) return
if (isObject(name)) for (key in name) setAttribute(this, key, name[key])
else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name)))
})
},
removeAttr: function(name){
return this.each(function(){ this.nodeType === 1 && setAttribute(this, name) })
},
prop: function(name, value){
name = propMap[name] || name
return (1 in arguments) ?
this.each(function(idx){
this[name] = funcArg(this, value, idx, this[name])
}) :
(this[0] && this[0][name])
},
data: function(name, value){
var attrName = 'data-' + name.replace(capitalRE, '-$1').toLowerCase()
var data = (1 in arguments) ?
this.attr(attrName, value) :
this.attr(attrName)
return data !== null ? deserializeValue(data) : undefined
},
val: function(value){
return 0 in arguments ?
this.each(function(idx){
this.value = funcArg(this, value, idx, this.value)
}) :
(this[0] && (this[0].multiple ?
$(this[0]).find('option').filter(function(){ return this.selected }).pluck('value') :
this[0].value)
)
},
offset: function(coordinates){
if (coordinates) return this.each(function(index){
var $this = $(this),
coords = funcArg(this, coordinates, index, $this.offset()),
parentOffset = $this.offsetParent().offset(),
props = {
top: coords.top - parentOffset.top,
left: coords.left - parentOffset.left
}
if ($this.css('position') == 'static') props['position'] = 'relative'
$this.css(props)
})
if (!this.length) return null
var obj = this[0].getBoundingClientRect()
return {
left: obj.left + window.pageXOffset,
top: obj.top + window.pageYOffset,
width: Math.round(obj.width),
height: Math.round(obj.height)
}
},
css: function(property, value){
if (arguments.length < 2) {
var element = this[0], computedStyle = getComputedStyle(element, '')
if(!element) return
if (typeof property == 'string')
return element.style[camelize(property)] || computedStyle.getPropertyValue(property)
else if (isArray(property)) {
var props = {}
$.each(isArray(property) ? property: [property], function(_, prop){
props[prop] = (element.style[camelize(prop)] || computedStyle.getPropertyValue(prop))
})
return props
}
}
var css = ''
if (type(property) == 'string') {
if (!value && value !== 0)
this.each(function(){ this.style.removeProperty(dasherize(property)) })
else
css = dasherize(property) + ":" + maybeAddPx(property, value)
} else {
for (key in property)
if (!property[key] && property[key] !== 0)
this.each(function(){ this.style.removeProperty(dasherize(key)) })
else
css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';'
}
return this.each(function(){ this.style.cssText += ';' + css })
},
index: function(element){
return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0])
},
hasClass: function(name){
if (!name) return false
return emptyArray.some.call(this, function(el){
return this.test(className(el))
}, classRE(name))
},
addClass: function(name){
if (!name) return this
return this.each(function(idx){
classList = []
var cls = className(this), newName = funcArg(this, name, idx, cls)
newName.split(/\s+/g).forEach(function(klass){
if (!$(this).hasClass(klass)) classList.push(klass)
}, this)
classList.length && className(this, cls + (cls ? " " : "") + classList.join(" "))
})
},
removeClass: function(name){
return this.each(function(idx){
if (name === undefined) return className(this, '')
classList = className(this)
funcArg(this, name, idx, classList).split(/\s+/g).forEach(function(klass){
classList = classList.replace(classRE(klass), " ")
})
className(this, classList.trim())
})
},
toggleClass: function(name, when){
if (!name) return this
return this.each(function(idx){
var $this = $(this), names = funcArg(this, name, idx, className(this))
names.split(/\s+/g).forEach(function(klass){
(when === undefined ? !$this.hasClass(klass) : when) ?
$this.addClass(klass) : $this.removeClass(klass)
})
})
},
scrollTop: function(value){
if (!this.length) return
var hasScrollTop = 'scrollTop' in this[0]
if (value === undefined) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset
return this.each(hasScrollTop ?
function(){ this.scrollTop = value } :
function(){ this.scrollTo(this.scrollX, value) })
},
scrollLeft: function(value){
if (!this.length) return
var hasScrollLeft = 'scrollLeft' in this[0]
if (value === undefined) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset
return this.each(hasScrollLeft ?
function(){ this.scrollLeft = value } :
function(){ this.scrollTo(value, this.scrollY) })
},
position: function() {
if (!this.length) return
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset()
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( $(elem).css('margin-top') ) || 0
offset.left -= parseFloat( $(elem).css('margin-left') ) || 0
// Add offsetParent borders
parentOffset.top += parseFloat( $(offsetParent[0]).css('border-top-width') ) || 0
parentOffset.left += parseFloat( $(offsetParent[0]).css('border-left-width') ) || 0
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
}
},
offsetParent: function() {
return this.map(function(){
var parent = this.offsetParent || document.body
while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css("position") == "static")
parent = parent.offsetParent
return parent
})
}
}
// for now
$.fn.detach = $.fn.remove
// Generate the `width` and `height` functions
;['width', 'height'].forEach(function(dimension){
var dimensionProperty =
dimension.replace(/./, function(m){ return m[0].toUpperCase() })
$.fn[dimension] = function(value){
var offset, el = this[0]
if (value === undefined) return isWindow(el) ? el['inner' + dimensionProperty] :
isDocument(el) ? el.documentElement['scroll' + dimensionProperty] :
(offset = this.offset()) && offset[dimension]
else return this.each(function(idx){
el = $(this)
el.css(dimension, funcArg(this, value, idx, el[dimension]()))
})
}
})
function traverseNode(node, fun) {
fun(node)
for (var i = 0, len = node.childNodes.length; i < len; i++)
traverseNode(node.childNodes[i], fun)
}
// Generate the `after`, `prepend`, `before`, `append`,
// `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods.
adjacencyOperators.forEach(function(operator, operatorIndex) {
var inside = operatorIndex % 2 //=> prepend, append
$.fn[operator] = function(){
// arguments can be nodes, arrays of nodes, Zepto objects and HTML strings
var argType, nodes = $.map(arguments, function(arg) {
argType = type(arg)
return argType == "object" || argType == "array" || arg == null ?
arg : zepto.fragment(arg)
}),
parent, copyByClone = this.length > 1
if (nodes.length < 1) return this
return this.each(function(_, target){
parent = inside ? target : target.parentNode
// convert all methods to a "before" operation
target = operatorIndex == 0 ? target.nextSibling :
operatorIndex == 1 ? target.firstChild :
operatorIndex == 2 ? target :
null
var parentInDocument = $.contains(document.documentElement, parent)
nodes.forEach(function(node){
if (copyByClone) node = node.cloneNode(true)
else if (!parent) return $(node).remove()
parent.insertBefore(node, target)
if (parentInDocument) traverseNode(node, function(el){
if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' &&
(!el.type || el.type === 'text/javascript') && !el.src)
window['eval'].call(window, el.innerHTML)
})
})
})
}
// after => insertAfter
// prepend => prependTo
// before => insertBefore
// append => appendTo
$.fn[inside ? operator+'To' : 'insert'+(operatorIndex ? 'Before' : 'After')] = function(html){
$(html)[operator](this)
return this
}
})
zepto.Z.prototype = $.fn
// Export internal API functions in the `$.zepto` namespace
zepto.uniq = uniq
zepto.deserializeValue = deserializeValue
$.zepto = zepto
return $
})()
window.Zepto = Zepto
window.$ === undefined && (window.$ = Zepto)
;(function($){
var _zid = 1, undefined,
slice = Array.prototype.slice,
isFunction = $.isFunction,
isString = function(obj){ return typeof obj == 'string' },
handlers = {},
specialEvents={},
focusinSupported = 'onfocusin' in window,
focus = { focus: 'focusin', blur: 'focusout' },
hover = { mouseenter: 'mouseover', mouseleave: 'mouseout' }
specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents'
function zid(element) {
return element._zid || (element._zid = _zid++)
}
function findHandlers(element, event, fn, selector) {
event = parse(event)
if (event.ns) var matcher = matcherFor(event.ns)
return (handlers[zid(element)] || []).filter(function(handler) {
return handler
&& (!event.e || handler.e == event.e)
&& (!event.ns || matcher.test(handler.ns))
&& (!fn || zid(handler.fn) === zid(fn))
&& (!selector || handler.sel == selector)
})
}
function parse(event) {
var parts = ('' + event).split('.')
return {e: parts[0], ns: parts.slice(1).sort().join(' ')}
}
function matcherFor(ns) {
return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)')
}
function eventCapture(handler, captureSetting) {
return handler.del &&
(!focusinSupported && (handler.e in focus)) ||
!!captureSetting
}
function realEvent(type) {
return hover[type] || (focusinSupported && focus[type]) || type
}
function add(element, events, fn, data, selector, delegator, capture){
var id = zid(element), set = (handlers[id] || (handlers[id] = []))
events.split(/\s/).forEach(function(event){
if (event == 'ready') return $(document).ready(fn)
var handler = parse(event)
handler.fn = fn
handler.sel = selector
// emulate mouseenter, mouseleave
if (handler.e in hover) fn = function(e){
var related = e.relatedTarget
if (!related || (related !== this && !$.contains(this, related)))
return handler.fn.apply(this, arguments)
}
handler.del = delegator
var callback = delegator || fn
handler.proxy = function(e){
e = compatible(e)
if (e.isImmediatePropagationStopped()) return
e.data = data
var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args))
if (result === false) e.preventDefault(), e.stopPropagation()
return result
}
handler.i = set.length
set.push(handler)
if ('addEventListener' in element)
element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))
})
}
function remove(element, events, fn, selector, capture){
var id = zid(element)
;(events || '').split(/\s/).forEach(function(event){
findHandlers(element, event, fn, selector).forEach(function(handler){
delete handlers[id][handler.i]
if ('removeEventListener' in element)
element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))
})
})
}
$.event = { add: add, remove: remove }
$.proxy = function(fn, context) {
var args = (2 in arguments) && slice.call(arguments, 2)
if (isFunction(fn)) {
var proxyFn = function(){ return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments) }
proxyFn._zid = zid(fn)
return proxyFn
} else if (isString(context)) {
if (args) {
args.unshift(fn[context], fn)
return $.proxy.apply(null, args)
} else {
return $.proxy(fn[context], fn)
}
} else {
throw new TypeError("expected function")
}
}
$.fn.bind = function(event, data, callback){
return this.on(event, data, callback)
}
$.fn.unbind = function(event, callback){
return this.off(event, callback)
}
$.fn.one = function(event, selector, data, callback){
return this.on(event, selector, data, callback, 1)
}
var returnTrue = function(){return true},
returnFalse = function(){return false},
ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$)/,
eventMethods = {
preventDefault: 'isDefaultPrevented',
stopImmediatePropagation: 'isImmediatePropagationStopped',
stopPropagation: 'isPropagationStopped'
}
function compatible(event, source) {
if (source || !event.isDefaultPrevented) {
source || (source = event)
$.each(eventMethods, function(name, predicate) {
var sourceMethod = source[name]
event[name] = function(){
this[predicate] = returnTrue
return sourceMethod && sourceMethod.apply(source, arguments)
}
event[predicate] = returnFalse
})
if (source.defaultPrevented !== undefined ? source.defaultPrevented :
'returnValue' in source ? source.returnValue === false :
source.getPreventDefault && source.getPreventDefault())
event.isDefaultPrevented = returnTrue
}
return event
}
function createProxy(event) {
var key, proxy = { originalEvent: event }
for (key in event)
if (!ignoreProperties.test(key) && event[key] !== undefined) proxy[key] = event[key]
return compatible(proxy, event)
}
$.fn.delegate = function(selector, event, callback){
return this.on(event, selector, callback)
}
$.fn.undelegate = function(selector, event, callback){
return this.off(event, selector, callback)
}
$.fn.live = function(event, callback){
$(document.body).delegate(this.selector, event, callback)
return this
}
$.fn.die = function(event, callback){
$(document.body).undelegate(this.selector, event, callback)
return this
}
$.fn.on = function(event, selector, data, callback, one){
var autoRemove, delegator, $this = this
if (event && !isString(event)) {
$.each(event, function(type, fn){
$this.on(type, selector, data, fn, one)
})
return $this
}
if (!isString(selector) && !isFunction(callback) && callback !== false)
callback = data, data = selector, selector = undefined
if (isFunction(data) || data === false)
callback = data, data = undefined
if (callback === false) callback = returnFalse
return $this.each(function(_, element){
if (one) autoRemove = function(e){
remove(element, e.type, callback)
return callback.apply(this, arguments)
}
if (selector) delegator = function(e){
var evt, match = $(e.target).closest(selector, element).get(0)
if (match && match !== element) {
evt = $.extend(createProxy(e), {currentTarget: match, liveFired: element})
return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1)))
}
}
add(element, event, callback, data, selector, delegator || autoRemove)
})
}
$.fn.off = function(event, selector, callback){
var $this = this
if (event && !isString(event)) {
$.each(event, function(type, fn){
$this.off(type, selector, fn)
})
return $this
}
if (!isString(selector) && !isFunction(callback) && callback !== false)
callback = selector, selector = undefined
if (callback === false) callback = returnFalse
return $this.each(function(){
remove(this, event, callback, selector)
})
}
$.fn.trigger = function(event, args){
event = (isString(event) || $.isPlainObject(event)) ? $.Event(event) : compatible(event)
event._args = args
return this.each(function(){
// items in the collection might not be DOM elements
if('dispatchEvent' in this) this.dispatchEvent(event)
else $(this).triggerHandler(event, args)
})
}
// triggers event handlers on current element just as if an event occurred,
// doesn't trigger an actual event, doesn't bubble
$.fn.triggerHandler = function(event, args){
var e, result
this.each(function(i, element){
e = createProxy(isString(event) ? $.Event(event) : event)
e._args = args
e.target = element
$.each(findHandlers(element, event.type || event), function(i, handler){
result = handler.proxy(e)
if (e.isImmediatePropagationStopped()) return false
})
})
return result
}
// shortcut methods for `.bind(event, fn)` for each event type
;('focusin focusout load resize scroll unload click dblclick '+
'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave '+
'change select keydown keypress keyup error').split(' ').forEach(function(event) {
$.fn[event] = function(callback) {
return callback ?
this.bind(event, callback) :
this.trigger(event)
}
})
;['focus', 'blur'].forEach(function(name) {
$.fn[name] = function(callback) {
if (callback) this.bind(name, callback)
else this.each(function(){
try { this[name]() }
catch(e) {}
})
return this
}
})
$.Event = function(type, props) {
if (!isString(type)) props = type, type = props.type
var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true
if (props) for (var name in props) (name == 'bubbles') ? (bubbles = !!props[name]) : (event[name] = props[name])
event.initEvent(type, bubbles, true)
return compatible(event)
}
})(Zepto)
;(function($){
var jsonpID = 0,
document = window.document,
key,
name,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
scriptTypeRE = /^(?:text|application)\/javascript/i,
xmlTypeRE = /^(?:text|application)\/xml/i,
jsonType = 'application/json',
htmlType = 'text/html',
blankRE = /^\s*$/
// trigger a custom event and return false if it was cancelled
function triggerAndReturn(context, eventName, data) {
var event = $.Event(eventName)
$(context).trigger(event, data)
return !event.isDefaultPrevented()
}
// trigger an Ajax "global" event
function triggerGlobal(settings, context, eventName, data) {
if (settings.global) return triggerAndReturn(context || document, eventName, data)
}
// Number of active Ajax requests
$.active = 0
function ajaxStart(settings) {
if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart')
}
function ajaxStop(settings) {
if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop')
}
// triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable
function ajaxBeforeSend(xhr, settings) {
var context = settings.context
if (settings.beforeSend.call(context, xhr, settings) === false ||
triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false)
return false
triggerGlobal(settings, context, 'ajaxSend', [xhr, settings])
}
function ajaxSuccess(data, xhr, settings, deferred) {
var context = settings.context, status = 'success'
settings.success.call(context, data, status, xhr)
if (deferred) deferred.resolveWith(context, [data, status, xhr])
triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data])
ajaxComplete(status, xhr, settings)
}
// type: "timeout", "error", "abort", "parsererror"
function ajaxError(error, type, xhr, settings, deferred) {
var context = settings.context
settings.error.call(context, xhr, type, error)
if (deferred) deferred.rejectWith(context, [xhr, type, error])
triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type])
ajaxComplete(type, xhr, settings)
}
// status: "success", "notmodified", "error", "timeout", "abort", "parsererror"
function ajaxComplete(status, xhr, settings) {
var context = settings.context
settings.complete.call(context, xhr, status)
triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings])
ajaxStop(settings)
}
// Empty function, used as default callback
function empty() {}
$.ajaxJSONP = function(options, deferred){
if (!('type' in options)) return $.ajax(options)
var _callbackName = options.jsonpCallback,
callbackName = ($.isFunction(_callbackName) ?
_callbackName() : _callbackName) || ('jsonp' + (++jsonpID)),
script = document.createElement('script'),
originalCallback = window[callbackName],
responseData,
abort = function(errorType) {
$(script).triggerHandler('error', errorType || 'abort')
},
xhr = { abort: abort }, abortTimeout
if (deferred) deferred.promise(xhr)
$(script).on('load error', function(e, errorType){
clearTimeout(abortTimeout)
$(script).off().remove()
if (e.type == 'error' || !responseData) {
ajaxError(null, errorType || 'error', xhr, options, deferred)
} else {
ajaxSuccess(responseData[0], xhr, options, deferred)
}
window[callbackName] = originalCallback
if (responseData && $.isFunction(originalCallback))
originalCallback(responseData[0])
originalCallback = responseData = undefined
})
if (ajaxBeforeSend(xhr, options) === false) {
abort('abort')
return xhr
}
window[callbackName] = function(){
responseData = arguments
}
script.src = options.url.replace(/\?(.+)=\?/, '?$1=' + callbackName)
document.head.appendChild(script)
if (options.timeout > 0) abortTimeout = setTimeout(function(){
abort('timeout')
}, options.timeout)
return xhr
}
$.ajaxSettings = {
// Default type of request
type: 'GET',
// Callback that is executed before request
beforeSend: empty,
// Callback that is executed if the request succeeds
success: empty,
// Callback that is executed the the server drops error
error: empty,
// Callback that is executed on request complete (both: error and success)
complete: empty,
// The context for the callbacks
context: null,
// Whether to trigger "global" Ajax events
global: true,
// Transport
xhr: function () {
return new window.XMLHttpRequest()
},
// MIME types mapping
// IIS returns Javascript as "application/x-javascript"
accepts: {
script: 'text/javascript, application/javascript, application/x-javascript',
json: jsonType,
xml: 'application/xml, text/xml',
html: htmlType,
text: 'text/plain'
},
// Whether the request is to another domain
crossDomain: false,
// Default timeout
timeout: 0,
// Whether data should be serialized to string
processData: true,
// Whether the browser should be allowed to cache GET responses
cache: true
}
function mimeToDataType(mime) {
if (mime) mime = mime.split(';', 2)[0]
return mime && ( mime == htmlType ? 'html' :
mime == jsonType ? 'json' :
scriptTypeRE.test(mime) ? 'script' :
xmlTypeRE.test(mime) && 'xml' ) || 'text'
}
function appendQuery(url, query) {
if (query == '') return url
return (url + '&' + query).replace(/[&?]{1,2}/, '?')
}
// serialize payload and append it to the URL for GET requests
function serializeData(options) {
if (options.processData && options.data && $.type(options.data) != "string")
options.data = $.param(options.data, options.traditional)
if (options.data && (!options.type || options.type.toUpperCase() == 'GET'))
options.url = appendQuery(options.url, options.data), options.data = undefined
}
$.ajax = function(options){
var settings = $.extend({}, options || {}),
deferred = $.Deferred && $.Deferred()
for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key]
ajaxStart(settings)
if (!settings.crossDomain) settings.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(settings.url) &&
RegExp.$2 != window.location.host
if (!settings.url) settings.url = window.location.toString()
serializeData(settings)
var dataType = settings.dataType, hasPlaceholder = /\?.+=\?/.test(settings.url)
if (hasPlaceholder) dataType = 'jsonp'
if (settings.cache === false || (
(!options || options.cache !== true) &&
('script' == dataType || 'jsonp' == dataType)
))
settings.url = appendQuery(settings.url, '_=' + Date.now())
if ('jsonp' == dataType) {
if (!hasPlaceholder)
settings.url = appendQuery(settings.url,
settings.jsonp ? (settings.jsonp + '=?') : settings.jsonp === false ? '' : 'callback=?')
return $.ajaxJSONP(settings, deferred)
}
var mime = settings.accepts[dataType],
headers = { },
setHeader = function(name, value) { headers[name.toLowerCase()] = [name, value] },
protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol,
xhr = settings.xhr(),
nativeSetHeader = xhr.setRequestHeader,
abortTimeout
if (deferred) deferred.promise(xhr)
if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest')
setHeader('Accept', mime || '*/*')
if (mime = settings.mimeType || mime) {
if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0]
xhr.overrideMimeType && xhr.overrideMimeType(mime)
}
if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET'))
setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded')
if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name])
xhr.setRequestHeader = setHeader
xhr.onreadystatechange = function(){
if (xhr.readyState == 4) {
xhr.onreadystatechange = empty
clearTimeout(abortTimeout)
var result, error = false
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) {
dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'))
result = xhr.responseText
try {
// http://perfectionkills.com/global-eval-what-are-the-options/
if (dataType == 'script') (1,eval)(result)
else if (dataType == 'xml') result = xhr.responseXML
else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result)
} catch (e) { error = e }
if (error) ajaxError(error, 'parsererror', xhr, settings, deferred)
else ajaxSuccess(result, xhr, settings, deferred)
} else {
ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred)
}
}
}
if (ajaxBeforeSend(xhr, settings) === false) {
xhr.abort()
ajaxError(null, 'abort', xhr, settings, deferred)
return xhr
}
if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name]
var async = 'async' in settings ? settings.async : true
xhr.open(settings.type, settings.url, async, settings.username, settings.password)
for (name in headers) nativeSetHeader.apply(xhr, headers[name])
if (settings.timeout > 0) abortTimeout = setTimeout(function(){
xhr.onreadystatechange = empty
xhr.abort()
ajaxError(null, 'timeout', xhr, settings, deferred)
}, settings.timeout)
// avoid sending empty string (#319)
xhr.send(settings.data ? settings.data : null)
return xhr
}
// handle optional data/success arguments
function parseArguments(url, data, success, dataType) {
if ($.isFunction(data)) dataType = success, success = data, data = undefined
if (!$.isFunction(success)) dataType = success, success = undefined
return {
url: url
, data: data
, success: success
, dataType: dataType
}
}
$.get = function(/* url, data, success, dataType */){
return $.ajax(parseArguments.apply(null, arguments))
}
$.post = function(/* url, data, success, dataType */){
var options = parseArguments.apply(null, arguments)
options.type = 'POST'
return $.ajax(options)
}
$.getJSON = function(/* url, data, success */){
var options = parseArguments.apply(null, arguments)
options.dataType = 'json'
return $.ajax(options)
}
$.fn.load = function(url, data, success){
if (!this.length) return this
var self = this, parts = url.split(/\s/), selector,
options = parseArguments(url, data, success),
callback = options.success
if (parts.length > 1) options.url = parts[0], selector = parts[1]
options.success = function(response){
self.html(selector ?
$('<div>').html(response.replace(rscript, "")).find(selector)
: response)
callback && callback.apply(self, arguments)
}
$.ajax(options)
return this
}
var escape = encodeURIComponent
function serialize(params, obj, traditional, scope){
var type, array = $.isArray(obj), hash = $.isPlainObject(obj)
$.each(obj, function(key, value) {
type = $.type(value)
if (scope) key = traditional ? scope :
scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']'
// handle data in serializeArray() format
if (!scope && array) params.add(value.name, value.value)
// recurse into nested objects
else if (type == "array" || (!traditional && type == "object"))
serialize(params, value, traditional, key)
else params.add(key, value)
})
}
$.param = function(obj, traditional){
var params = []
params.add = function(k, v){ this.push(escape(k) + '=' + escape(v)) }
serialize(params, obj, traditional)
return params.join('&').replace(/%20/g, '+')
}
})(Zepto)
;(function($){
$.fn.serializeArray = function() {
var result = [], el
$([].slice.call(this.get(0).elements)).each(function(){
el = $(this)
var type = el.attr('type')
if (this.nodeName.toLowerCase() != 'fieldset' &&
!this.disabled && type != 'submit' && type != 'reset' && type != 'button' &&
((type != 'radio' && type != 'checkbox') || this.checked))
result.push({
name: el.attr('name'),
value: el.val()
})
})
return result
}
$.fn.serialize = function(){
var result = []
this.serializeArray().forEach(function(elm){
result.push(encodeURIComponent(elm.name) + '=' + encodeURIComponent(elm.value))
})
return result.join('&')
}
$.fn.submit = function(callback) {
if (callback) this.bind('submit', callback)
else if (this.length) {
var event = $.Event('submit')
this.eq(0).trigger(event)
if (!event.isDefaultPrevented()) this.get(0).submit()
}
return this
}
})(Zepto)
;(function($){
// __proto__ doesn't exist on IE<11, so redefine
// the Z function to use object extension instead
if (!('__proto__' in {})) {
$.extend($.zepto, {
Z: function(dom, selector){
dom = dom || []
$.extend(dom, $.fn)
dom.selector = selector || ''
dom.__Z = true
return dom
},
// this is a kludge but works
isZ: function(object){
return $.type(object) === 'array' && '__Z' in object
}
})
}
// getComputedStyle shouldn't freak out when called
// without a valid element as argument
try {
getComputedStyle(undefined)
} catch(e) {
var nativeGetComputedStyle = getComputedStyle;
window.getComputedStyle = function(element){
try {
return nativeGetComputedStyle(element)
} catch(e) {
return null
}
}
}
})(Zepto)
// Zepto.js
// (c) 2010-2014 Thomas Fuchs
// Zepto.js may be freely distributed under the MIT license.
;(function($){
var touch = {},
touchTimeout, tapTimeout, swipeTimeout, longTapTimeout,
longTapDelay = 750,
gesture
function swipeDirection(x1, x2, y1, y2) {
return Math.abs(x1 - x2) >=
Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down')
}
function longTap() {
longTapTimeout = null
if (touch.last) {
touch.el.trigger('longTap')
touch = {}
}
}
function cancelLongTap() {
if (longTapTimeout) clearTimeout(longTapTimeout)
longTapTimeout = null
}
function cancelAll() {
if (touchTimeout) clearTimeout(touchTimeout)
if (tapTimeout) clearTimeout(tapTimeout)
if (swipeTimeout) clearTimeout(swipeTimeout)
if (longTapTimeout) clearTimeout(longTapTimeout)
touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null
touch = {}
}
function isPrimaryTouch(event){
return (event.pointerType == 'touch' ||
event.pointerType == event.MSPOINTER_TYPE_TOUCH)
&& event.isPrimary
}
function isPointerEventType(e, type){
return (e.type == 'pointer'+type ||
e.type.toLowerCase() == 'mspointer'+type)
}
$(document).ready(function(){
var now, delta, deltaX = 0, deltaY = 0, firstTouch, _isPointerType
if ('MSGesture' in window) {
gesture = new MSGesture()
gesture.target = document.body
}
$(document)
.bind('MSGestureEnd', function(e){
var swipeDirectionFromVelocity =
e.velocityX > 1 ? 'Right' : e.velocityX < -1 ? 'Left' : e.velocityY > 1 ? 'Down' : e.velocityY < -1 ? 'Up' : null;
if (swipeDirectionFromVelocity) {
touch.el.trigger('swipe')
touch.el.trigger('swipe'+ swipeDirectionFromVelocity)
}
})
.on('touchstart MSPointerDown pointerdown', function(e){
if((_isPointerType = isPointerEventType(e, 'down')) &&
!isPrimaryTouch(e)) return
firstTouch = _isPointerType ? e : e.touches[0]
if (e.touches && e.touches.length === 1 && touch.x2) {
// Clear out touch movement data if we have it sticking around
// This can occur if touchcancel doesn't fire due to preventDefault, etc.
touch.x2 = undefined
touch.y2 = undefined
}
now = Date.now()
delta = now - (touch.last || now)
touch.el = $('tagName' in firstTouch.target ?
firstTouch.target : firstTouch.target.parentNode)
touchTimeout && clearTimeout(touchTimeout)
touch.x1 = firstTouch.pageX
touch.y1 = firstTouch.pageY
if (delta > 0 && delta <= 250) touch.isDoubleTap = true
touch.last = now
longTapTimeout = setTimeout(longTap, longTapDelay)
// adds the current touch contact for IE gesture recognition
if (gesture && _isPointerType) gesture.addPointer(e.pointerId);
})
.on('touchmove MSPointerMove pointermove', function(e){
if((_isPointerType = isPointerEventType(e, 'move')) &&
!isPrimaryTouch(e)) return
firstTouch = _isPointerType ? e : e.touches[0]
cancelLongTap()
touch.x2 = firstTouch.pageX
touch.y2 = firstTouch.pageY
deltaX += Math.abs(touch.x1 - touch.x2)
deltaY += Math.abs(touch.y1 - touch.y2)
})
.on('touchend MSPointerUp pointerup', function(e){
if((_isPointerType = isPointerEventType(e, 'up')) &&
!isPrimaryTouch(e)) return
cancelLongTap()
// swipe
if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) ||
(touch.y2 && Math.abs(touch.y1 - touch.y2) > 30))
swipeTimeout = setTimeout(function() {
touch.el.trigger('swipe')
touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)))
touch = {}
}, 0)
// normal tap
else if ('last' in touch)
// don't fire tap when delta position changed by more than 30 pixels,
// for instance when moving to a point and back to origin
if (deltaX < 30 && deltaY < 30) {
// delay by one tick so we can cancel the 'tap' event if 'scroll' fires
// ('tap' fires before 'scroll')
tapTimeout = setTimeout(function() {
// trigger universal 'tap' with the option to cancelTouch()
// (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
var event = $.Event('tap')
event.cancelTouch = cancelAll
touch.el.trigger(event)
// trigger double tap immediately
if (touch.isDoubleTap) {
if (touch.el) touch.el.trigger('doubleTap')
touch = {}
}
// trigger single tap after 250ms of inactivity
else {
touchTimeout = setTimeout(function(){
touchTimeout = null
if (touch.el) touch.el.trigger('singleTap')
touch = {}
}, 250)
}
}, 0)
} else {
touch = {}
}
deltaX = deltaY = 0
})
// when the browser window loses focus,
// for example when a modal dialog is shown,
// cancel all ongoing events
.on('touchcancel MSPointerCancel pointercancel', cancelAll)
// scrolling the window indicates intention of the user
// to scroll, not tap or swipe, so cancel all ongoing events
$(window).on('scroll', cancelAll)
})
;['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown',
'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
$.fn[eventName] = function(callback){ return this.on(eventName, callback) }
})
})(Zepto) | picacure/_sandBox | photoGallery/flux/js/zepto.js | JavaScript | mit | 62,392 | [
30522,
1013,
1008,
27838,
13876,
2080,
1058,
2487,
1012,
1015,
1012,
1018,
1011,
27838,
13876,
2080,
2724,
18176,
2433,
29464,
1011,
27838,
13876,
29147,
2015,
1012,
4012,
1013,
6105,
1008,
1013,
13075,
27838,
13876,
2080,
1027,
1006,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* \file NETGeographicLib\PolyPanel.cs
* \brief NETGeographicLib.PolygonArea example
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* https://geographiclib.sourceforge.io/
**********************************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NETGeographicLib;
namespace Projections
{
public partial class PolyPanel : UserControl
{
PolygonArea m_poly = null;
public PolyPanel()
{
InitializeComponent();
m_poly = new PolygonArea(false);
m_majorRadiusTextBox.Text = m_poly.EquatorialRadius.ToString();
m_flatteningTextBox.Text = m_poly.Flattening.ToString();
m_lengthTextBox.Text = m_areaTextBox.Text = m_numPointsTextBox.Text = "0";
m_currLatTextBox.Text = m_currLonTextBox.Text = "";
}
private void OnSet(object sender, EventArgs e)
{
try
{
double a = Double.Parse(m_majorRadiusTextBox.Text);
double f = Double.Parse(m_flatteningTextBox.Text);
m_poly = new PolygonArea(new Geodesic(a, f), m_polylineCheckBox.Checked);
m_lengthTextBox.Text = m_areaTextBox.Text = m_numPointsTextBox.Text = "0";
m_currLatTextBox.Text = m_currLonTextBox.Text = "";
m_edgeButton.Enabled = false;
}
catch (Exception xcpt)
{
MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void OnAddPoint(object sender, EventArgs e)
{
try
{
double lat = Double.Parse(m_latitudeTextBox.Text);
double lon = Double.Parse(m_longitudeTextBox.Text);
double length, area;
m_poly.AddPoint(lat, lon);
m_edgeButton.Enabled = true;
m_currLatTextBox.Text = m_latitudeTextBox.Text;
m_currLonTextBox.Text = m_longitudeTextBox.Text;
m_numPointsTextBox.Text = m_poly.Compute(false, false, out length, out area).ToString();
m_lengthTextBox.Text = length.ToString();
if ( !m_polylineCheckBox.Checked )
m_areaTextBox.Text = area.ToString();
}
catch (Exception xcpt)
{
MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void OnAddEdge(object sender, EventArgs e)
{
try
{
double azi = Double.Parse(m_azimuthTextBox.Text);
double dist = Double.Parse(m_distanceTextBox.Text);
m_poly.AddEdge(azi, dist);
double lat, lon, length, area;
m_poly.CurrentPoint(out lat, out lon);
m_currLatTextBox.Text = lat.ToString();
m_currLonTextBox.Text = lon.ToString();
m_numPointsTextBox.Text = m_poly.Compute(false, false, out length, out area).ToString();
m_lengthTextBox.Text = length.ToString();
if (!m_polylineCheckBox.Checked)
m_areaTextBox.Text = area.ToString();
}
catch (Exception xcpt)
{
MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void OnClear(object sender, EventArgs e)
{
m_poly.Clear();
m_edgeButton.Enabled = false;
m_lengthTextBox.Text = m_areaTextBox.Text = m_numPointsTextBox.Text = "0";
m_currLatTextBox.Text = m_currLonTextBox.Text = "";
}
private void OnValidate(object sender, EventArgs e)
{
try
{
double lat, lon, perim, area;
PolygonArea pa = new PolygonArea(new Geodesic(50000.0, 0.001), true);
pa = new PolygonArea(false);
pa.AddPoint(32.0, -86.0);
pa.AddEdge(20.0, 10000.0);
pa.AddEdge(-45.0, 10000.0);
pa.CurrentPoint(out lat, out lon);
pa.Compute(false, false, out perim, out area);
pa.TestEdge(-70.0, 5000.0, false, false, out perim, out area);
pa.TestPoint(31.0, -86.5, false, false, out perim, out area);
PolygonAreaExact p2 = new PolygonAreaExact(new GeodesicExact(), false);
p2.AddPoint(32.0, -86.0);
p2.AddEdge(20.0, 10000.0);
p2.AddEdge(-45.0, 10000.0);
p2.CurrentPoint(out lat, out lon);
p2.Compute(false, false, out perim, out area);
p2.TestEdge(-70.0, 5000.0, false, false, out perim, out area);
p2.TestPoint(31.0, -86.5, false, false, out perim, out area);
PolygonAreaRhumb p3 = new PolygonAreaRhumb(Rhumb.WGS84(), false);
p3.AddPoint(32.0, -86.0);
p3.AddEdge(20.0, 10000.0);
p3.AddEdge(-45.0, 10000.0);
p3.CurrentPoint(out lat, out lon);
p3.Compute(false, false, out perim, out area);
p3.TestEdge(-70.0, 5000.0, false, false, out perim, out area);
p3.TestPoint(31.0, -86.5, false, false, out perim, out area);
MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception xcpt)
{
MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
| geographiclib/geographiclib | dotnet/Projections/PolyPanel.cs | C# | mit | 6,048 | [
30522,
1013,
1008,
1008,
1008,
1032,
5371,
5658,
3351,
13705,
29521,
1032,
26572,
9739,
2884,
1012,
20116,
1008,
1032,
4766,
5658,
3351,
13705,
29521,
1012,
26572,
7446,
12069,
2050,
2742,
1008,
1008,
5658,
3351,
13705,
29521,
2003,
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... |
<html>
<head>
<style>
canvas#imageCanvas {
position: absolute;
left: 100px;
top: 100px;
}
canvas#coverCanvas {
position: absolute;
left: 500px;
top: 100px;
}
canvas#fftCanvas {
position: absolute;
left: 900px;
top: 100px;
}
</style>
</head>
<body>
<canvas id="imageCanvas" width="300" height="300"></canvas>
<canvas id="coverCanvas" width="300" height="300"></canvas>
<canvas id="fftCanvas" width="1000" height="300"></canvas>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="client.js"></script>
<script>
var IMAGE_URL = 'http://uncovered-proxy.herokuapp.com/image/6885bc64100c07ec425b6902eeb88c6c0fde6f89';
var imageCanvas = document.getElementById("imageCanvas");
var coverCanvas = document.getElementById("coverCanvas");
var imageContext = imageCanvas.getContext('2d');
var coverContext = coverCanvas.getContext('2d');
var fftContext = fftCanvas.getContext('2d');
var width = parseInt($(imageCanvas).attr('width'))
var height = parseInt($(imageCanvas).attr('height'))
// load image from data url
var imageObj = new Image();
imageObj.onload = function() {
imageContext.drawImage(this, 0, 0, width, height);
var imgData = imageContext.getImageData(0, 0, width, height);
var maxColors = 16;
var cmap = quantize.quantize(imgData.data, maxColors);
var newImgData = coverContext.createImageData(width, height);
for (var i = 0; i < imgData.data.length; i += 4) {
var pixel = cmap.map([imgData.data[i], imgData.data[i+1], imgData.data[i+2]]);
newImgData.data[i] = pixel[0];
newImgData.data[i + 1] = pixel[1];
newImgData.data[i + 2] = pixel[2];
newImgData.data[i + 3] = 255;
};
coverContext.putImageData(newImgData, 0, 0);
coverContext.fillStyle = "#FF0000";
coverContext.fillRect(50,250,8, 8);
var xblocks = Math.floor(width / 8);
var yblocks = Math.floor(height / 8);
var numblocks = xblocks * yblocks;
var blocks = [
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks),
new Float64Array(yblocks * xblocks)
]
for (var by = 0; by < yblocks; ++by) {
for (var bx = 0; bx < xblocks; ++bx) {
var re = [];
var im = [];
for (var y = 0; y < 8; y++) {
i = (y + by * 8) * width;
outi = y * 8;
for (var x = 0; x < 8; x++) {
var start = (i << 2) + ((x + bx * 8) << 2);
if (start < imgData.data.length) {
var R = imgData.data[start];
var G = imgData.data[start + 1];
var B = imgData.data[start + 2];
var luminance = (0.2126*R + 0.7152*G + 0.0722*B);
re[outi + x] = luminance
} else {
re[outi + x] = 0.0;
}
im[outi + x] = 0.0;
}
}
fft.init(8);
fft.fft2d(re, im);
var powrad = {}
var totpow = 0.0;
for (var y = 0; y < 8; y++) {
i = y * 8;
for (var x = 0; x < 8; x++) {
var pow = Math.sqrt(re[i + x] * re[i + x] + im[i + x] * im[i + x]);
totpow += pow;
var radius = Math.round(Math.sqrt(x*x + y*y));
if (radius in powrad) {
var val = powrad[radius];
powrad[radius] = {pow: val.pow + pow, cnt: val.cnt + 1};
} else {
powrad[radius] = {pow: pow, cnt: 1};
}
}
}
for (k in powrad) {
var blk = blocks[k];
var val = totpow > 0 ? (powrad[k].pow / powrad[k].cnt) / totpow : 0.0;
blk[by * xblocks + bx] = val;
}
}
}
for (k in blocks) {
var blk = blocks[k];
var max = Math.max.apply(null, blk);
var img = fftContext.createImageData(xblocks, yblocks);
for (var by = 0; by < yblocks; ++by) {
for (var bx = 0; bx < xblocks; ++bx) {
var ix = by * xblocks + bx;
var pxval = Math.floor(255.0 * blk[ix] / max);
img.data[ix * 4] = pxval;
img.data[ix * 4 + 1] = pxval;
img.data[ix * 4 + 2] = pxval;
img.data[ix * 4 + 3] = 255;
}
}
fftContext.putImageData(img, k * yblocks, 0);
}
console.log(blocks);
};
imageObj.crossOrigin="Anonymous";
imageObj.src = IMAGE_URL;
</script>
</body>
</html>
| wowhack/uncovered-service | public/graphics.html | HTML | mit | 4,574 | [
30522,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2806,
1028,
10683,
1001,
3746,
9336,
12044,
1063,
2597,
1024,
7619,
1025,
2187,
1024,
2531,
2361,
2595,
1025,
2327,
1024,
2531,
2361,
2595,
1025,
1065,
10683,
1001,
3104,
9336,
12044,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#PBS -S /bin/bash
#PBS -N mnakao_job
#PBS -A XMPTCA
#PBS -q tcaq-q1
#PBS -l select=1:ncpus=1:host=tcag-0001-eth0+1:ncpus=1:host=tcag-0002-eth0+1:ncpus=1:host=tcag-0003-eth0+1:ncpus=1:host=tcag-0004-eth0+1:ncpus=1:host=tcag-0005-eth0+1:ncpus=1:host=tcag-0006-eth0+1:ncpus=1:host=tcag-0007-eth0+1:ncpus=1:host=tcag-0008-eth0
#PBS -l walltime=00:01:00
. /opt/Modules/default/init/bash
#---------------
# select=NODES:ncpus=CORES:mpiprocs=PROCS:ompthreads=THREADS:mem=MEMORY
# NODES : num of nodes
# CORES : num of cores per node
# PROCS : num of procs per node
# THREADS : num of threads per process
#----------------
NP=8
module purge
module load cuda/6.5.14 mvapich2-gdr/2.0_gnu_cuda-6.5
export LD_LIBRARY_PATH=/work/XMPTCA/mnakao/omni-compiler/PEACH2:$LD_LIBRARY_PATH
cd $PBS_O_WORKDIR
OPT="MV2_GPUDIRECT_LIMIT=4194304 MV2_ENABLE_AFFINITY=0 MV2_SHOW_CPU_BINDING=1 numactl --cpunodebind=0 --localalloc"
for i in $(seq 1 10)
do
mpirun_rsh -np $NP -hostfile $PBS_NODEFILE $OPT ./L
done
| omni-compiler/omni-compiler | samples/XACC/HIMENO-C/Global-view/job_scripts/HA-PACS/TCA/tcaq-q1-4x2nodes.sh | Shell | lgpl-3.0 | 989 | [
30522,
1001,
13683,
1011,
1055,
1013,
8026,
1013,
24234,
1001,
13683,
1011,
1050,
24098,
11905,
2080,
1035,
3105,
1001,
13683,
1011,
1037,
1060,
27718,
3540,
1001,
13683,
1011,
1053,
22975,
20784,
1011,
1053,
2487,
1001,
13683,
1011,
1048,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.rocketmq.common;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.StringContains.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**
* CountDownLatch2 Unit Test
*
* @see CountDownLatch2
*/
public class CountDownLatch2Test {
/**
* test constructor with invalid init param
*
* @see CountDownLatch2#CountDownLatch2(int)
*/
@Test
public void testConstructorError() {
int count = -1;
try {
CountDownLatch2 latch = new CountDownLatch2(count);
} catch (IllegalArgumentException e) {
assertThat(e.getMessage(), is("count < 0"));
}
}
/**
* test constructor with valid init param
*
* @see CountDownLatch2#CountDownLatch2(int)
*/
@Test
public void testConstructor() {
int count = 10;
CountDownLatch2 latch = new CountDownLatch2(count);
assertEquals("Expected equal", count, latch.getCount());
assertThat("Expected contain", latch.toString(), containsString("[Count = " + count + "]"));
}
/**
* test await timeout
*
* @see CountDownLatch2#await(long, TimeUnit)
*/
@Test
public void testAwaitTimeout() throws InterruptedException {
int count = 1;
CountDownLatch2 latch = new CountDownLatch2(count);
boolean await = latch.await(10, TimeUnit.MILLISECONDS);
assertFalse("Expected false", await);
latch.countDown();
boolean await2 = latch.await(10, TimeUnit.MILLISECONDS);
assertTrue("Expected true", await2);
}
/**
* test reset
*
* @see CountDownLatch2#countDown()
*/
@Test(timeout = 1000)
public void testCountDownAndGetCount() throws InterruptedException {
int count = 2;
CountDownLatch2 latch = new CountDownLatch2(count);
assertEquals("Expected equal", count, latch.getCount());
latch.countDown();
assertEquals("Expected equal", count - 1, latch.getCount());
latch.countDown();
latch.await();
assertEquals("Expected equal", 0, latch.getCount());
}
/**
* test reset
*
* @see CountDownLatch2#reset()
*/
@Test
public void testReset() throws InterruptedException {
int count = 2;
CountDownLatch2 latch = new CountDownLatch2(count);
latch.countDown();
assertEquals("Expected equal", count - 1, latch.getCount());
latch.reset();
assertEquals("Expected equal", count, latch.getCount());
latch.countDown();
latch.countDown();
latch.await();
assertEquals("Expected equal", 0, latch.getCount());
// coverage Sync#tryReleaseShared, c==0
latch.countDown();
assertEquals("Expected equal", 0, latch.getCount());
}
}
| Vansee/RocketMQ | common/src/test/java/org/apache/rocketmq/common/CountDownLatch2Test.java | Java | apache-2.0 | 3,851 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require("../pc.v0");
require("util").puts(JSON.stringify({
"name": "pc",
"version": pc.version,
"description": "property creation for reusable d3.js code.",
"keywords": ["d3", "visualization"],
"homepage": "http://milroc.github.com/pc/",
"author": {"name": "Miles McCrocklin", "url": "http://www.milesmccrocklin.com" },
"repository": {"type": "git", "url": "http://github.com/milroc/pc.git"},
"devDependencies": {
"uglify-js": "1.2.6",
"vows": "0.6.0"
}
}, null, 2)); | milroc/pc.js | src/package.js | JavaScript | bsd-3-clause | 485 | [
30522,
5478,
1006,
1000,
1012,
1012,
1013,
7473,
1012,
1058,
2692,
1000,
1007,
1025,
5478,
1006,
1000,
21183,
4014,
1000,
1007,
1012,
8509,
1006,
1046,
3385,
1012,
5164,
8757,
1006,
1063,
1000,
2171,
1000,
1024,
1000,
7473,
1000,
1010,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
include_once("helper.php");
if ( isset($_POST['user']) && !empty($_POST['user']) ) {
$username = $_POST['user'];
if ( isset($_POST['source']) && isset($_POST['relations']) ) {
$triples = make_triples($_POST['source'], $_POST['relations']);
add_relations($username, $triples);
}
}
// $triples[] = ' usewod:'.$derid.' prov:atTime "'.time()->format(DateTime::ISO8601).'"^^xsd:dateTime ';
function make_triples($source, $relations) {
$triples = array();
$s = "";
if (array_key_exists('id', $source) ) {
$s = $source['id'];
}
if ( array_key_exists('type', $source) ) {
if ( $source['type']=='p' ) {
if ( array_key_exists('pub', $relations) ) {
foreach ( $relations['pub'] as $rel ) {
if ( !empty($rel['objects']) ) {
$derid = uniqid("prov/");
array_push($triples,' usewod:'.$derid.' a prov:Derivation, usewod:Citation ');
foreach ($rel['objects'] as $object) {
if (array_key_exists('id', $object) ) {
$o = $object['id'];
array_push($triples,' usewod:'.$derid.' prov:entity <'.$o.'> ');
}
}
array_push($triples,' <'.$s.'> prov:qualifiedDerivation usewod:'.$derid.' ');
}
}
}
if ( array_key_exists('ds', $relations) ) {
foreach ( $relations['ds'] as $rel ) {
if ( !empty($rel['objects']) ) {
$derid = uniqid("prov/");
array_push($triples,' usewod:'.$derid.' a prov:Derivation ');
switch ($rel['label']) {
case 'mentions':
array_push($triples,' usewod:'.$derid.' a usewod:Mention ');
break;
case 'describes':
array_push($triples,' usewod:'.$derid.' a usewod:Description ');
break;
case 'evaluates':
array_push($triples,' usewod:'.$derid.' a usewod:Evaluation ');
break;
case 'analyses':
array_push($triples,' usewod:'.$derid.' a usewod:Analysis ');
break;
case 'compares':
array_push($triples,' usewod:'.$derid.' a usewod:Comparison ');
break;
}
foreach ($rel['objects'] as $object) {
if (array_key_exists('id', $object) ) {
$o = $object['id'];
array_push($triples,' usewod:'.$derid.' prov:entity <'.$o.'> ');
}
}
array_push($triples,' <'.$s.'> prov:qualifiedDerivation usewod:'.$derid.' ');
}
}
}
} else if ($source['type']=='d') {
if (array_key_exists('pub', $relations) ) {
foreach ( $relations['pub'] as $rel ) {
if ( !empty($rel['objects']) ) {
foreach ($rel['objects'] as $object) {
if (array_key_exists('id', $object) ) {
$o = $object['id'];
$derid = uniqid("prov/");
array_push($triples,' usewod:'.$derid.' a prov:Derivation ');
switch ($rel['label']) {
case 'mentioned in':
array_push($triples,' usewod:'.$derid.' a usewod:Mention ');
break;
case 'described in':
array_push($triples,' usewod:'.$derid.' a usewod:Description ');
break;
case 'evaluated in':
array_push($triples,' usewod:'.$derid.' a usewod:Evaluation ');
break;
case 'analysed in':
array_push($triples,' usewod:'.$derid.' a usewod:Analysis ');
break;
case 'compared in':
array_push($triples,' usewod:'.$derid.' a usewod:Comparison ');
break;
}
array_push($triples,' usewod:'.$derid.' prov:entity <'.$s.'> ');
array_push($triples,' <'.$o.'> prov:qualifiedDerivation usewod:'.$derid.' ');
}
}
}
}
}
if (array_key_exists('ds', $relations) ) {
foreach ( $relations['ds'] as $rel ) {
if ( !empty($rel['objects']) ) {
foreach ($rel['objects'] as $object) {
if (array_key_exists('id', $object) ) {
$o = $object['id'];
$derid = uniqid("prov/");
array_push($triples,' usewod:'.$derid.' a prov:Derivation ');
switch ($rel['label']) {
case 'extends':
array_push($triples,' usewod:'.$derid.' a usewod:Extension ');
break;
case 'includes':
array_push($triples,' usewod:'.$derid.' a usewod:Inclusion ');
break;
case 'overlaps':
array_push($triples,' usewod:'.$derid.' a usewod:Overlap ');
break;
case 'transformation of':
array_push($triples,' usewod:'.$derid.' a usewod:Transformation ');
break;
case 'generalisation of':
array_push($triples,' usewod:'.$derid.' a usewod:Generalisation ');
break;
}
array_push($triples,' usewod:'.$derid.' prov:entity <'.$s.'> ');
array_push($triples,' <'.$o.'> prov:qualifiedDerivation usewod:'.$derid.' ');
}
}
}
}
}
}
}
return $triples;
}
function add_relations($username, $triples)
{
global $store;
$gid = uniqid("graph/");
$insert_q = prefix().'INSERT INTO usewod:'.$gid.' { '. implode(" . ", $triples) .'}';
$rs = $store->query($insert_q);
if ($errs = $store->getErrors())
{
echo "{ 'error' : 'Error in add_relations', 'returned':".var_dump($errs)." }";
return;
}
add_graph_info($gid, $username);
$rez = array("query" => $insert_q, "result" => $rs, "graph" => "usewod:".$gid);
echo json_encode($rez);
}
?> | aprilush/usewod-prov | addrelations.php | PHP | gpl-3.0 | 6,111 | [
30522,
1026,
1029,
25718,
2421,
1035,
2320,
1006,
1000,
2393,
2121,
1012,
25718,
1000,
1007,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
1035,
2695,
1031,
1005,
5310,
1005,
1033,
1007,
1004,
1004,
999,
4064,
1006,
1002,
1035,
2695,
1031,
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... |
package com.jetbrains.python.refactoring;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiManager;
import com.intellij.testFramework.PlatformTestUtil;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.python.refactoring.convert.PyConvertPackageToModuleAction;
/**
* @author Mikhail Golubev
*/
public class PyConvertPackageToModuleTest extends PyTestCase {
// PY-4387
public void testSimple() throws Exception {
final String rootBeforePath = getTestName(true) + "/before";
final String rootAfterPath = getTestName(true) + "/after";
final VirtualFile copiedDirectory = myFixture.copyDirectoryToProject(rootBeforePath, "");
final VirtualFile directory = assertInstanceOf(myFixture.findFileInTempDir("a"), VirtualFile.class);
final PsiDirectory packageToConvert = PsiManager.getInstance(myFixture.getProject()).findDirectory(directory);
assertNotNull(packageToConvert);
new PyConvertPackageToModuleAction().createModuleFromPackage(packageToConvert);
PlatformTestUtil.assertDirectoriesEqual(copiedDirectory, getVirtualFileByName(getTestDataPath() +rootAfterPath));
}
@Override
protected String getTestDataPath() {
return super.getTestDataPath() + "/refactoring/convertPackageToModule/";
}
}
| akosyakov/intellij-community | python/testSrc/com/jetbrains/python/refactoring/PyConvertPackageToModuleTest.java | Java | apache-2.0 | 1,324 | [
30522,
7427,
4012,
1012,
6892,
10024,
7076,
1012,
18750,
1012,
25416,
18908,
28741,
2290,
1025,
12324,
4012,
1012,
13420,
3669,
3501,
1012,
2330,
9331,
2072,
1012,
1058,
10343,
1012,
7484,
8873,
2571,
1025,
12324,
4012,
1012,
13420,
3669,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 Site\Bundle\BlogBundle\DataFixtures;
use Site\Bundle\BlogBundle\Entity\Post,
Doctrine\Common\DataFixtures\FixtureInterface,
Doctrine\Common\DataFixtures\AbstractFixture,
Doctrine\Common\Persistence\ObjectManager,
Symfony\Component\Yaml\Yaml,
Doctrine\Common\Collections\ArrayCollection;
class LoadPostData extends AbstractFixture implements FixtureInterface
{
/**
* Load data fixtures with the passed EntityManager
*
* @param ObjectManager $manager
*/
public function load(ObjectManager $manager)
{
$posts = Yaml::parse($this->getYmlFile());
print_r($posts);
foreach ($posts['posts'] as $post) {
$postObject = new Post();
$postObject->setTitle($post['title']);
$postObject->setText($post['text']);
$postObject->setAuthorId($post['authorId']);
$postObject->setLikes(0);
$postObject->setViews(0);
$postObject->setDate(new \DateTime('now'));
//foreach ($post['categories'] as $reference) {
//$postObject->addCategory($this->getReferencesFromArray($post['categories']));
//}
// $this->setTags($post['categories']);
$manager->persist($postObject);
}
$manager->flush();
}
/**
* Get the order of this fixture
*
* @return integer
*/
public function getOrder()
{
return 2;
}
protected function getYmlFile()
{
return __DIR__ . '/Data/posts.yml';
}
} | Serhio1/techpulse.net | src/Site/Bundle/BlogBundle/DataFixtures/ORM/LoadPostData.php | PHP | mit | 1,590 | [
30522,
1026,
1029,
25718,
3415,
15327,
2609,
1032,
14012,
1032,
9927,
27265,
2571,
1032,
2951,
8873,
18413,
14900,
1025,
2224,
2609,
1032,
14012,
1032,
9927,
27265,
2571,
1032,
9178,
1032,
2695,
1010,
8998,
1032,
2691,
1032,
2951,
8873,
184... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model frontend\models\StartLinks */
$this->title = 'Update Start Links: ' . $model->start_link_id;
$this->params['breadcrumbs'][] = ['label' => 'Start Links', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->start_link_id, 'url' => ['view', 'id' => $model->start_link_id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="start-links-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
| vrublevskiyvitaliy/grabber | frontend/views/start-links/update.php | PHP | bsd-3-clause | 575 | [
30522,
1026,
1029,
25718,
2224,
12316,
2072,
1032,
2393,
2545,
1032,
16129,
1025,
1013,
1008,
1030,
13075,
1002,
2023,
12316,
2072,
1032,
4773,
1032,
3193,
1008,
1013,
1013,
1008,
1030,
13075,
1002,
2944,
2392,
10497,
1032,
4275,
1032,
2707... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_151) on Thu Feb 08 09:04:07 MST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface org.wildfly.swarm.config.JGroupsSupplier (BOM: * : All 2018.2.0 API)</title>
<meta name="date" content="2018-02-08">
<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 Interface org.wildfly.swarm.config.JGroupsSupplier (BOM: * : All 2018.2.0 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/JGroupsSupplier.html" title="interface in org.wildfly.swarm.config">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, 2018.2.0</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/class-use/JGroupsSupplier.html" target="_top">Frames</a></li>
<li><a href="JGroupsSupplier.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Interface org.wildfly.swarm.config.JGroupsSupplier" class="title">Uses of Interface<br>org.wildfly.swarm.config.JGroupsSupplier</h2>
</div>
<div class="classUseContainer">No usage of org.wildfly.swarm.config.JGroupsSupplier</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/JGroupsSupplier.html" title="interface in org.wildfly.swarm.config">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, 2018.2.0</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/class-use/JGroupsSupplier.html" target="_top">Frames</a></li>
<li><a href="JGroupsSupplier.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2018 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| wildfly-swarm/wildfly-swarm-javadocs | 2018.2.0/apidocs/org/wildfly/swarm/config/class-use/JGroupsSupplier.html | HTML | apache-2.0 | 4,835 | [
30522,
1026,
999,
9986,
30524,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
19817,
1013,
16129,
2549,
1013,
6065,
1012,
26718,
2094,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Ophrys argentea Vell. 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/Orchidaceae/Aspidogyne/Aspidogyne argentea/ Syn. Ophrys argentea/README.md | Markdown | apache-2.0 | 178 | [
30522,
1001,
6728,
8093,
7274,
23157,
5243,
2310,
3363,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
10675,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 http = require('supertest');
var shared = require('../shared');
var server = require('../app');
var app;
describe('v2 user#page', function () {
before(function (done) {
server(function (data) {
app = data;
done();
});
});
it('should show user index', function (done) {
var req = http(app);
req.get('/user/page/' + shared.user.username)
.expect(200, function (err, res) {
var texts = [
'注册时间',
'仍然很懒',
'最近创建的话题',
'无话题',
'最近参与的话题',
'无话题'
];
texts.forEach(function (text) {
res.text.should.containEql(text);
});
done(err);
});
});
});
| calidion/server.xiv.im | test/v2/user/page.js | JavaScript | gpl-3.0 | 751 | [
30522,
13075,
8299,
1027,
5478,
1006,
1005,
3565,
22199,
1005,
1007,
1025,
13075,
4207,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
4207,
1005,
1007,
1025,
13075,
8241,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
10439,
1005,
1007,
1025,
13075,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 JeraPushGenerator < Rails::Generators::NamedBase
desc "This generator creates an initializer file at config/initializers"
source_root File.expand_path("../templates", __FILE__)
MissingModel = Class.new(Thor::Error)
def initializer_file
template 'jera_push.rb', 'config/initializers/jera_push.rb'
inject_into_file 'config/initializers/assets.rb', "\nRails.application.config.assets.precompile += %w( jera_push/jera_push.css jera_push/jera_push.js )", after: '# Precompile additional assets.'
end
def locale_file
copy_file '../../../../config/locale/jera_push.pt-BR.yml', 'config/locales/jera_push.pt-BR.yml'
end
def generate_migrations
unless model_exists?
raise MissingModel,
"\n\tModel \"#{file_name.titlecase}\" doesn't exists. Please, create your Model and try again."
end
inject_into_file model_path, "\n\thas_many :devices, as: :pushable, class_name: 'JeraPush::Device'", after: '< ActiveRecord::Base'
inject_into_file model_path, "\n\thas_many :devices, as: :pushable, class_name: 'JeraPush::Device'", after: '< ApplicationRecord'
case self.behavior
when :invoke
generate "active_record:jera_push", file_name
when :revoke
Rails::Generators.invoke "active_record:jera_push", [file_name], behavior: :revoke
end
end
private
def model_exists?
File.exist?(File.join(destination_root, model_path))
end
def model_path
@model_path ||= File.join("app", "models", "#{file_path}.rb")
end
end
| jera/jera-push | lib/generators/jera_push/jera_push_generator.rb | Ruby | mit | 1,499 | [
30522,
2465,
15333,
2527,
12207,
25619,
24454,
8844,
1026,
15168,
1024,
1024,
16937,
1024,
1024,
2315,
15058,
4078,
2278,
1000,
2023,
13103,
9005,
2019,
3988,
17629,
5371,
2012,
9530,
8873,
2290,
1013,
3988,
17629,
2015,
1000,
3120,
1035,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 numpy as np
import keras as ks
import matplotlib.pyplot as plt
from keras.datasets import boston_housing
from keras import models
from keras import layers
from keras.utils.np_utils import to_categorical
(train_data, train_targets), (test_data, test_targets) = boston_housing.load_data()
mean = train_data.mean(axis = 0)
train_data -= mean
std = train_data.std(axis=0)
train_data /= std
test_data -= mean
test_data /= std
def build_model():
model = models.Sequential()
model.add(layers.Dense(64, activation='relu', input_shape=(train_data.shape[1],)))
model.add(layers.Dense(64, activation='relu'))
model.add(layers.Dense(1))
model.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])
return model
k = 4
num_val_samples = len(train_data) // k
num_epochs = 500
all_scores = []
all_mae_histories = []
for i in range(k):
print('processing fold #', i)
val_data = train_data[i * num_val_samples : (i+1) * num_val_samples]
val_targets = train_targets[i * num_val_samples : (i+1) * num_val_samples]
partial_train_data = np.concatenate([train_data[: i * num_val_samples], train_data[(i+1) * num_val_samples:]], axis=0)
partial_train_targets = np.concatenate([train_targets[: i * num_val_samples], train_targets[(i+1) * num_val_samples:]], axis=0)
model = build_model()
history = model.fit(partial_train_data, partial_train_targets, epochs=num_epochs, batch_size=1, verbose=0)
val_mse, val_mae = model.evaluate(val_data, val_targets, verbose=0)
all_mae_histories.append(history.history['mean_absolute_error'])
all_scores.append(val_mae)
print(all_scores)
average_mae_history = [np.mean([x[i] for x in all_mae_histories]) for i in range(num_epochs)]
# plt.plot(range(1, len(average_mae_history) + 1), average_mae_history)
plt.plot(average_mae_history[10:])
plt.xlabel('Epochs')
plt.ylabel('Validation MAE')
plt.show() | FiveEye/ml-notebook | dlp/ch3_3_boston_housing.py | Python | mit | 1,900 | [
30522,
12324,
16371,
8737,
2100,
2004,
27937,
12324,
17710,
8180,
2004,
29535,
12324,
13523,
24759,
4140,
29521,
1012,
1052,
22571,
10994,
2004,
20228,
2102,
2013,
17710,
8180,
1012,
2951,
13462,
2015,
12324,
3731,
1035,
3847,
2013,
17710,
81... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 ng-controller="MainCtrl">
<div class="row">
<div class="col-lg-12 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div ng-show="strViewingUser != null">{{strViewingUser}}</div>
<div ng-show="bSendFriendRequest"><input type="button" value="Request Friend" ng-click="sendFriendRequest()"></div>
<div ng-show="bFriendRequestSent"><input type="button" value="Your Request has been sent" disabled="disabled"></div>
<div ng-show="bResponseFriendRequest"><input type="button" value="Response to Friend Request" ng-click="sendFriendResponse()"></div>
<div ng-show="bRequestFollowRequest"><input type="button" value="Follow" ng-click="confirmFollow()"></div>
<div ng-show="bBeFriend"><input type="button" value="Your Friend" disabled="disabled"></div>
</rd-widget-body>
</rd-widget>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon green pull-left">
<i class="fa fa-users"></i>
</div>
<div class="title">{{stats.users?(stats.users):"0" }}</div>
<div class="comment">Users</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-6 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon orange pull-left">
<i class="fa fa-sitemap"></i>
</div>
<div class="title">{{stats.documents ? stats.documents : "0"}}</div>
<div class="comment">Documents</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon red pull-left">
<i class="fa fa-tasks"></i>
</div>
<div class="title">{{stats.relations.VIEW ? stats.relations.VIEW : "0"}}</div>
<div class="comment">Views</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon blue pull-left">
<i class="fa fa-support"></i>
</div>
<div class="title">{{stats.relations.DOWNLOAD ? stats.relations.DOWNLOAD : "0"}}</div>
<div class="comment">Downloads</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon blue pull-left">
<i class="fa fa-support"></i>
</div>
<div class="title">{{stats.relations.LIKE ? stats.relations.LIKE : "0"}}</div>
<div class="comment">Likes</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon blue pull-left">
<i class="fa fa-support"></i>
</div>
<div class="title">{{stats.relations.READ ? stats.relations.READ : "0"}}</div>
<div class="comment">Reading</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon blue pull-left">
<i class="fa fa-support"></i>
</div>
<div class="title">{{stats.relations.SHARE ? stats.relations.SHARE : "0"}}</div>
<div class="comment">Shared</div>
</rd-widget-body>
</rd-widget>
</div>
</div>
<div class="row">
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon orange pull-left">
<i class="fa fa-sitemap"></i>
</div>
<div class="title">{{currentUser.uploadedDocs.length ? currentUser.uploadedDocs.length : "0"}}</div>
<div class="comment">My Uploaded Documents</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon red pull-left">
<i class="fa fa-tasks"></i>
</div>
<div class="title">{{currentUser.viewedDocs.length ? currentUser.viewedDocs.length : "0"}}</div>
<div class="comment">My Document Views</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon blue pull-left">
<i class="fa fa-support"></i>
</div>
<div class="title">{{currentUser.downloadedDocs.length ? currentUser.downloadedDocs.length : "0"}}</div>
<div class="comment">My Document Downloads</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon blue pull-left">
<i class="fa fa-support"></i>
</div>
<div class="title">{{currentUser.likes.length ? currentUser.likes.length : "0"}}</div>
<div class="comment">My Liked Documents</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon blue pull-left">
<i class="fa fa-support"></i>
</div>
<div class="title">{{currentUser.reads.length ? currentUser.reads.length : "0"}}</div>
<div class="comment">My Reading Documents</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-2 col-md-6 col-xs-12">
<rd-widget>
<rd-widget-body>
<div class="widget-icon blue pull-left">
<i class="fa fa-support"></i>
</div>
<div class="title">{{currentUser.sharedTransactions.length ? currentUser.sharedTransactions.length : "0"}}</div>
<div class="comment">My Shared Documents</div>
</rd-widget-body>
</rd-widget>
</div>
</div>
<div class="row">
<div class="col-lg-4">
<rd-widget>
<rd-widget-header icon="fa-tasks" title="Friends">
</rd-widget-header>
<rd-widget-body classes="medium no-padding">
<div class="table-responsive">
<table class="table" ng-if="currentUser.friends != null">
<thead>
<tr>
<td>User Name</td>
<td>Email</td>
</tr>
<tr><td align="right" colspan="2">
<dir-pagination-controls pagination-id="flist"></dir-pagination-controls>
</td></tr>
</thead>
<tfoot>
<tr><td align="right" colspan="2">
<dir-pagination-controls pagination-id="flist"></dir-pagination-controls>
</td></tr>
</tfoot>
<tbody>
<tr dir-paginate="friend in currentUser.friends | itemsPerPage: 5 track by $index" pagination-id="flist" class="hoverme">
<td><a href="#/controlpanel/{{friend._id}}">{{friend.username}}</a></td>
<td>{{friend.email}}</td>
</tr>
</tbody>
</table>
</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-4">
<rd-widget>
<rd-widget-header icon="fa-tasks" title="Followers">
</rd-widget-header>
<rd-widget-body classes="medium no-padding">
<div class="table-responsive">
<table class="table" ng-if="currentUser.followers != null">
<thead>
<tr>
<td>User Name</td>
<td>Email</td>
</tr>
<tr><td align="right" colspan="2">
<dir-pagination-controls pagination-id="followerlist"></dir-pagination-controls>
</td></tr>
</thead>
<tfoot>
<tr><td align="right" colspan="2">
<dir-pagination-controls pagination-id="followerlist"></dir-pagination-controls>
</td></tr>
</tfoot>
<tbody>
<tr dir-paginate="follower in currentUser.followers | itemsPerPage: 5 track by $index" pagination-id="followerlist" class="hoverme">
<td><a href="#/controlpanel/{{follower._id}}">{{follower.username}}</a></td>
<td>{{follower.email}}</td>
</tr>
</tbody>
</table>
</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-4">
<rd-widget>
<rd-widget-header icon="fa-tasks" title="Followees">
</rd-widget-header>
<rd-widget-body classes="medium no-padding">
<div class="table-responsive">
<table class="table" ng-if="currentUser.followees != null">
<thead>
<tr>
<td>User Name</td>
<td>Email</td>
</tr>
<tr><td align="right" colspan="2">
<dir-pagination-controls pagination-id="followeelist"></dir-pagination-controls>
</td></tr>
</thead>
<tfoot>
<tr><td align="right" colspan="2">
<dir-pagination-controls pagination-id="followeelist"></dir-pagination-controls>
</td></tr>
</tfoot>
<tbody>
<tr dir-paginate="followee in currentUser.followees | itemsPerPage: 5 track by $index" pagination-id="followeelist" class="hoverme">
<td><a href="#/controlpanel/{{followee._id}}">{{followee.username}}</a></td>
<td>{{followee.email}}</td>
</tr>
</tbody>
</table>
</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-12" ng-if="userReadDocs != null && userReadDocs.length > 0">
<rd-widget>
<rd-widget-header icon="fa-tasks" title="Reading Documents">
</rd-widget-header>
<rd-widget-body classes="medium no-padding">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<td>Title</td>
<td>Authors</td>
<td>Category</td>
<td colspan="5">Actions</td>
</tr>
<tr><td align="right" colspan="8">
<dir-pagination-controls pagination-id="ddoc"></dir-pagination-controls>
</td></tr>
</thead>
<tfoot>
<tr><td align="right" colspan="8">
<dir-pagination-controls pagination-id="ddoc"></dir-pagination-controls>
</td></tr>
</tfoot>
<tbody>
<tr dir-paginate="doc in userReadDocs | itemsPerPage: pageSize track by $index" pagination-id="ddoc" class="hoverme">
<td>{{doc.title}}</td>
<td>{{doc.authors}}</td>
<td>{{doc.category}}</td>
<td><span class="text-success"><a href="{{getServerDocumentPath(doc.uploadedPath, false)}}" target="_blank" ng-click="userInteract(doc._id, 'view')">{{doc.fileName}}</a></span></td>
<td><span class="text-success"><a href="{{getServerDocumentPath(doc.uploadedPath, true)}}" target="_blank" download="{{doc.fileName}}" ng-click="userInteract(doc._id, 'download')">Download</a></span></td>
<td><span class="text-success" ng-show="doc.liked_by.indexOf(myid) === -1"><a href="" ng-click="userInteract(doc._id, 'like')">Like</a></span>
<span class="text-success" ng-show="doc.liked_by.indexOf(myid) !== -1"><a href="" ng-click="userInteract(doc._id, 'unlike')">Unlike</a></span>
</td>
<td><span class="text-success" ng-show="doc.read_by.indexOf(myid) !== -1"><a href="" ng-click="userInteract(doc._id, 'stopread')">Stop Reading</a></span></td>
<td><span class="text-success"><a href="" ng-click="openShare(doc._id)">Share</a></span></td>
</tr>
</tbody>
</table>
</div>
</rd-widget-body>
</rd-widget>
</div>
<div class="col-lg-12" ng-if="recommendDocs != null && recommendDocs.length > 0">
<rd-widget>
<rd-widget-header icon="fa-users" title="Top Suggested Books">
<!-- <input type="text" placeholder="Search" class="form-control input-sm"> -->
</rd-widget-header>
<rd-widget-body classes="medium no-padding">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<td>Title</td>
<td>Authors</td>
<td>Category</td>
<td colspan="5">Actions</td>
</tr>
<tr><td align="right" colspan="8">
<dir-pagination-controls pagination-id="rdoc"></dir-pagination-controls>
</td></tr>
</thead>
<tfoot>
<tr><td align="right" colspan="8">
<dir-pagination-controls pagination-id="rdoc"></dir-pagination-controls>
</td></tr>
</tfoot>
<tbody>
<tr dir-paginate="redoc in recommendDocs | itemsPerPage: 10 track by $index" pagination-id="rdoc" class="hoverme">
<td>{{redoc.title}}</td>
<td>{{redoc.authors}}</td>
<td>{{redoc.category}}</td>
<td><span class="text-success"><a href="{{getServerDocumentPath(redoc.uploadedPath, false)}}" target="_blank" ng-click="userInteract(redoc._id, 'view')">{{redoc.fileName}}</a></span></td>
<td><span class="text-success"><a href="{{getServerDocumentPath(redoc.uploadedPath, true)}}" target="_blank" download="{{redoc.fileName}}" ng-click="userInteract(redoc._id, 'download')">Download</a></span></td>
<td><span class="text-success" ng-show="redoc.liked_by.indexOf(myid) === -1"><a href="" ng-click="userInteract(redoc._id, 'like')">Like</a></span>
<span class="text-success" ng-show="redoc.liked_by.indexOf(myid) !== -1"><a href="" ng-click="userInteract(redoc._id, 'unlike')">Unlike</a></span>
</td>
<td><span class="text-success" ng-show="redoc.read_by.indexOf(myid) !== -1"><a href="" ng-click="userInteract(redoc._id, 'stopread')">Stop Reading</a></span></td>
<td><span class="text-success"><a href="" ng-click="openShare(redoc._id)">Share</a></span></td>
</tr>
</tbody>
</table>
</div>
</rd-widget-body>
<rd-widget>
</rd-widget></rd-widget>
</div>
</div>
<script type="text/ng-template" id="firstDialog">
<div class="ngdialog-message">
<span>You would like to share this document to who :</span>
<div>
<form>
<input ng-model="shareText" type="text" placeholder="Recommend text to your friends" class="form-control" autofocus>
</br>
<ul>
<li ng-repeat="friend in friends"><input type="checkbox" checklist-model="selectedFriends" checklist-value="friend" checklist-comparator="compareFn"> {{friend.username}} - {{friend.email}}</li>
</ul>
</br>
</form>
</div>
<div class="mt">People, whom you selected, are able to interact with the document you shared.</div>
</div>
<div class="ngdialog-buttons mt">
<button type="button" class="ngdialog-button ngdialog-button-primary" ng-click="submit()">Share</button>
<button type="button" class="ngdialog-button" ng-click="uncheckAll()">Uncheck All</button>
<button type="button" class="ngdialog-button" ng-click="checkAll()">Check All</button>
</div>
</script>
</div> | tranduong/documentlib-client | dist/templates/overall/controlpanel.html | HTML | mit | 14,501 | [
30522,
1026,
4487,
2615,
12835,
1011,
11486,
1027,
1000,
2364,
6593,
12190,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
5216,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
8902,
1011,
1048,
2290,
1011,
2260,
8902,
1011,
9108,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.eevolution.mrp.spi.impl;
/*
* #%L
* de.metas.adempiere.libero.libero
* %%
* Copyright (C) 2015 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.adempiere.ad.modelvalidator.DocTimingType;
import org.adempiere.ad.modelvalidator.ModelChangeType;
import org.adempiere.model.InterfaceWrapperHelper;
import org.adempiere.util.Check;
import org.adempiere.util.lang.IMutable;
import org.adempiere.util.lang.Mutable;
import org.eevolution.exceptions.LiberoException;
import org.eevolution.mrp.api.IMRPCreateSupplyRequest;
import org.eevolution.mrp.api.IMRPDemandToSupplyAllocation;
import org.eevolution.mrp.api.IMRPExecutor;
import org.eevolution.mrp.spi.IMRPSupplyProducer;
import de.metas.material.planning.IMaterialPlanningContext;
public class CompositeMRPSupplyProducer implements IMRPSupplyProducer
{
private final List<IMRPSupplyProducer> producers = new ArrayList<IMRPSupplyProducer>();
private final List<IMRPSupplyProducer> producersRO = Collections.unmodifiableList(producers);
public void addMRPSupplyProducer(final IMRPSupplyProducer supplyProducer)
{
if (producers.contains(supplyProducer))
{
return;
}
producers.add(supplyProducer);
}
public List<IMRPSupplyProducer> getAllSupplyProducers()
{
return producersRO;
}
public List<IMRPSupplyProducer> getSupplyProducers(final String tableName)
{
Check.assumeNotEmpty(tableName, LiberoException.class, "tableName not null");
List<IMRPSupplyProducer> result = null;
for (final IMRPSupplyProducer producer : producers)
{
final Set<String> sourceTableNames = producer.getSourceTableNames();
if (!sourceTableNames.contains(tableName))
{
continue;
}
if (result == null)
{
result = new ArrayList<IMRPSupplyProducer>();
}
result.add(producer);
}
if (result == null)
{
return Collections.emptyList();
}
else
{
return result;
}
}
@Override
public Set<String> getSourceTableNames()
{
final Set<String> sourceTableNames = new LinkedHashSet<String>(); // keep the order
for (final IMRPSupplyProducer producer : producers)
{
sourceTableNames.addAll(producer.getSourceTableNames());
}
return sourceTableNames;
}
@Override
public boolean applies(final IMaterialPlanningContext mrpContext, final IMutable<String> notAppliesReason)
{
final StringBuilder notAppliesReasonBuf = new StringBuilder();
for (final IMRPSupplyProducer producer : producers)
{
final IMutable<String> notAppliesReasonProducer = new Mutable<String>();
if (producer.applies(mrpContext, notAppliesReasonProducer))
{
return true;
}
appendNotAppliesReason(notAppliesReasonBuf, notAppliesReasonProducer);
}
notAppliesReason.setValue(notAppliesReasonBuf.toString());
return false;
}
private final void appendNotAppliesReason(final StringBuilder notAppliesReasonBuf, final IMutable<String> notAppliesReason)
{
if (Check.isEmpty(notAppliesReason.getValue(), true))
{
return;
}
if (notAppliesReasonBuf.length() > 0)
{
notAppliesReasonBuf.append("; ");
}
notAppliesReasonBuf.append(notAppliesReason.getValue());
}
@Override
public void onRecordChange(final Object model, final ModelChangeType changeType)
{
for (final IMRPSupplyProducer producer : producers)
{
producer.onRecordChange(model, changeType);
}
}
@Override
public void onDocumentChange(final Object model, final DocTimingType timing)
{
for (final IMRPSupplyProducer producer : producers)
{
producer.onDocumentChange(model, timing);
}
}
@Override
public boolean isRecreatedMRPRecordsSupported(final String tableName)
{
for (final IMRPSupplyProducer producer : producers)
{
if (producer.isRecreatedMRPRecordsSupported(tableName))
{
return true;
}
}
return false;
}
@Override
public void recreateMRPRecords(final Object model)
{
Check.assumeNotNull(model, "model not null");
final String tableName = InterfaceWrapperHelper.getModelTableName(model);
for (final IMRPSupplyProducer producer : producers)
{
// skip producer if it does not support our tableName
if (!producer.isRecreatedMRPRecordsSupported(tableName))
{
continue;
}
producer.recreateMRPRecords(model);
}
}
@Override
public void createSupply(final IMRPCreateSupplyRequest request)
{
for (final IMRPSupplyProducer producer : producers)
{
producer.createSupply(request);
}
}
public IMRPSupplyProducer getSupplyProducers(final IMaterialPlanningContext mrpContext)
{
final StringBuilder notAppliesReasonBuf = new StringBuilder();
for (final IMRPSupplyProducer producer : producers)
{
final IMutable<String> notAppliesReasonProducer = new Mutable<String>();
if (producer.applies(mrpContext, notAppliesReasonProducer))
{
return producer;
}
appendNotAppliesReason(notAppliesReasonBuf, notAppliesReasonProducer);
}
throw new IllegalStateException("No MRP supply producer found for " + mrpContext + " because: " + notAppliesReasonBuf.toString());
}
@Override
public void cleanup(final IMaterialPlanningContext mrpContext, final IMRPExecutor executor)
{
for (final IMRPSupplyProducer producer : producers)
{
producer.cleanup(mrpContext, executor);
}
}
@Override
public void onQtyOnHandReservation(final IMaterialPlanningContext mrpContext,
final IMRPExecutor mrpExecutor,
final IMRPDemandToSupplyAllocation mrpDemandToSupplyAllocation)
{
for (final IMRPSupplyProducer producer : producers)
{
producer.onQtyOnHandReservation(mrpContext, mrpExecutor, mrpDemandToSupplyAllocation);
}
}
@Override
public Class<?> getDocumentClass()
{
throw new UnsupportedOperationException();
}
}
| klst-com/metasfresh | de.metas.adempiere.libero.libero/src/main/java/org/eevolution/mrp/spi/impl/CompositeMRPSupplyProducer.java | Java | gpl-2.0 | 6,451 | [
30522,
7427,
8917,
1012,
25212,
6767,
7630,
3508,
1012,
2720,
2361,
1012,
11867,
2072,
1012,
17727,
2140,
1025,
1013,
1008,
1008,
1001,
1003,
1048,
1008,
2139,
1012,
18804,
2015,
1012,
4748,
6633,
14756,
2890,
1012,
5622,
5677,
2080,
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... |
#
# Makefile for misc devices that really don't fit anywhere else.
#
obj-$(CONFIG_IBM_ASM) += ibmasm/
obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o
obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o
obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o
obj-$(CONFIG_INTEL_MID_PTI) += pti.o
obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
obj-$(CONFIG_BMP085) += bmp085.o
obj-$(CONFIG_ICS932S401) += ics932s401.o
obj-$(CONFIG_LKDTM) += lkdtm.o
obj-$(CONFIG_TIFM_CORE) += tifm_core.o
obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
obj-$(CONFIG_PHANTOM) += phantom.o
obj-$(CONFIG_SENSORS_BH1780) += bh1780gli.o
obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o
obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o
obj-$(CONFIG_ANDROID_PMEM) += pmem.o
obj-$(CONFIG_SGI_IOC4) += ioc4.o
obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
obj-$(CONFIG_KGDB_TESTS) += kgdbts.o
obj-$(CONFIG_SGI_XP) += sgi-xp/
obj-$(CONFIG_SGI_GRU) += sgi-gru/
obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o
obj-$(CONFIG_HP_ILO) += hpilo.o
obj-$(CONFIG_APDS9802ALS) += apds9802als.o
obj-$(CONFIG_ISL29003) += isl29003.o
obj-$(CONFIG_ISL29020) += isl29020.o
obj-$(CONFIG_USB_HSIC_SMSC_HUB) += smsc_hub.o
obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
obj-$(CONFIG_EP93XX_PWM) += ep93xx_pwm.o
obj-$(CONFIG_DS1682) += ds1682.o
obj-$(CONFIG_TI_DAC7512) += ti_dac7512.o
obj-$(CONFIG_UID_STAT) += uid_stat.o
obj-$(CONFIG_C2PORT) += c2port/
obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/
obj-$(CONFIG_HMC6352) += hmc6352.o
obj-y += eeprom/
obj-y += cb710/
obj-$(CONFIG_SPEAR13XX_PCIE_GADGET) += spear13xx_pcie_gadget.o
obj-$(CONFIG_VMWARE_BALLOON) += vmw_balloon.o
obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o
obj-$(CONFIG_PCH_PHUB) += pch_phub.o
obj-y += ti-st/
obj-$(CONFIG_AB8500_PWM) += ab8500-pwm.o
obj-y += lis3lv02d/
obj-y += carma/
obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/
obj-$(CONFIG_MAX8997_MUIC) += max8997-muic.o
obj-$(CONFIG_WL127X_RFKILL) += wl127x-rfkill.o
obj-$(CONFIG_SENSORS_AK8975) += akm8975.o
obj-$(CONFIG_WL127X_RFKILL) += wl127x-rfkill.o
obj-$(CONFIG_APANIC) += apanic.o
obj-$(CONFIG_SENSORS_AK8975) += akm8975.o
obj-$(CONFIG_TSIF) += msm_tsif.o
msm_tsif-objs := tsif.o
obj-$(CONFIG_TSIF_CHRDEV) += tsif_chrdev.o
obj-$(CONFIG_TSPP) += tspp.o
obj-$(CONFIG_HAPTIC_ISA1200) += isa1200.o
obj-$(CONFIG_PMIC8058_PWM) += pmic8058-pwm.o
obj-$(CONFIG_PMIC8XXX_VIBRATOR) += pm8xxx-vibrator.o
obj-$(CONFIG_PMIC8XXX_NFC) += pm8xxx-nfc.o
obj-$(CONFIG_PMIC8XXX_UPL) += pm8xxx-upl.o
obj-$(CONFIG_ANDROID_VIBRATOR) += android_vibrator.o
obj-$(CONFIG_MSM_MEMORY_LOW_POWER_MODE_SUSPEND_DEEP_POWER_DOWN) \
+= msm_migrate_pages.o
obj-$(CONFIG_PMIC8058_XOADC) += pmic8058-xoadc.o
obj-$(CONFIG_QSEECOM) += qseecom.o
obj-$(CONFIG_QFP_FUSE) += qfp_fuse.o
obj-$(CONFIG_QSEECOM) += tzic.o
obj-y += tspdrv/
obj-$(CONFIG_BCM2079X_NFC_I2C) += bcm2079x-i2c.o
obj-$(CONFIG_SEC_MISC) += sec_param.o sec_misc.o
ifdef CONFIG_MACH_MELIUS
obj-$(CONFIG_MFD_MAX77693) += max77693-muic_melius.o
endif
ifdef CONFIG_MACH_JF
obj-$(CONFIG_MFD_MAX77693) += max77693-muic.o
endif
obj-$(CONFIG_SAMSUNG_JACK) += sec_jack.o
obj-$(CONFIG_BU52031NVX) += pm8xxx-cradle.o
obj-$(CONFIG_SLIMPORT_ANX7808) += slimport_anx7808/
obj-$(CONFIG_2MIC_ES305) += a2220.o
obj-$(CONFIG_SEC_TORCH_FLASH) += sec_torch.o
obj-$(CONFIG_TIMA_LOG) += tima_debug_log.o
obj-$(CONFIG_GAMMA_CONTROL) += gamma_control.o
| friedrich420/S4-TW-AEL-Kernel-v4Plus | drivers/misc/Makefile | Makefile | gpl-2.0 | 3,481 | [
30522,
1001,
1001,
2191,
8873,
2571,
2005,
28616,
2278,
5733,
2008,
2428,
2123,
1005,
1056,
4906,
5973,
2842,
1012,
1001,
27885,
3501,
1011,
1002,
1006,
9530,
8873,
2290,
1035,
9980,
1035,
2004,
2213,
1007,
1009,
1027,
9980,
3022,
2213,
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... |
package org.optaplanner.examples.projectjobscheduling;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
public static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
ProjectJobSchedulingPerformanceTest test = new ProjectJobSchedulingPerformanceTest();
test.setBundleContext(bundleContext);
test.setUp();
test.createSolutionDao();
test.createSolverConfigResource();
test.solveAll();
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}
| martenscs/optaplanner-osgi | org.optaplanner.examples.projectjobscheduling/src/org/optaplanner/examples/projectjobscheduling/Activator.java | Java | apache-2.0 | 981 | [
30522,
7427,
8917,
1012,
23569,
9331,
5802,
3678,
1012,
4973,
1012,
2622,
5558,
5910,
7690,
18639,
2290,
1025,
12324,
8917,
1012,
9808,
5856,
1012,
7705,
1012,
14012,
18908,
11444,
4263,
1025,
12324,
8917,
1012,
9808,
5856,
1012,
7705,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
require_once('milestone_services.php');
class block_milestone extends block_base {
/**#@+
* Modes
*/
const MODE_OPERATIONS_MENU = 1;
const MODE_MILESTONE_TARGET_NEXT = 2;
/**#@-*/
/**
* @return void
*/
public function init() {
$this->title = get_string('milestone', 'block_milestone');
}
/**
* @return true
*/
public function instance_allow_multiple() {
return true;
}
/**
* @return stdClass
* @throws Exception
*/
public function get_content() {
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass;
$mode = self::MODE_OPERATIONS_MENU;
if (!empty($this->config->mode)) {
$mode = $this->config->mode;
}
switch ($mode) {
case self::MODE_OPERATIONS_MENU:
$this->content->text = $this->get_content_operations_menu();
break;
case self::MODE_MILESTONE_TARGET_NEXT:
$this->content->text = $this->get_content_milestone_target_next();
break;
default:
throw new Exception("Invalid mode '{$mode}'");
}
return $this->content;
}
/**
* @return string
*/
protected function get_content_milestone_target_next() {
global $COURSE, $USER;
$out = '';
$milestoneservices = new milestone_services();
$milestone = $milestoneservices->get_milestone_target_next($COURSE->id);
if ($milestone) {
$out .= '<div>Target for ' . userdate($milestone->datewhen, '%D') . ":<br>" .
html_writer::link(
course_get_url($COURSE->id, $milestone->section),
"Section {$milestone->section}: " . s($milestone->name)
) . '</div>';
}
$usercourseprogress = $milestoneservices->get_user_course_progress($USER->id, $COURSE->id);
$out .= <<<HTML
<div class="user-course-progress">
Course Progress:<br>
<div class="user-course-progress-bar">
<div class="progress" style="width: {$usercourseprogress}%;"></div>
</div>
</div>
HTML;
return $out;
}
/**
* @return string
*/
protected function get_content_operations_menu() {
global $COURSE;
return html_writer::link(
new moodle_url(
'/blocks/milestone/index.php',
array(
'courseid' => $COURSE->id,
)
),
get_string('milestone:viewcalendar', 'block_milestone')
);
}
}
| ket-ed/ket-moodle | blocks/milestone/block_milestone.php | PHP | gpl-3.0 | 2,775 | [
30522,
1026,
1029,
25718,
5478,
1035,
2320,
1006,
1005,
19199,
1035,
2578,
1012,
25718,
1005,
1007,
1025,
2465,
3796,
1035,
19199,
8908,
3796,
1035,
2918,
1063,
1013,
1008,
1008,
1001,
1030,
1009,
1008,
11583,
1008,
1013,
9530,
3367,
5549,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 2000-2009 JetBrains s.r.o.
*
* 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.intellij.openapi.project.impl.convertors;
import org.jdom.Element;
import java.util.Iterator;
class Util {
@SuppressWarnings({"HardCodedStringLiteral"})
static Element findComponent(Element root, String className) {
for (Iterator iterator = root.getChildren("component").iterator(); iterator.hasNext();) {
Element element = (Element)iterator.next();
String className1 = element.getAttributeValue("class");
if (className1 != null && className1.equals(className)) {
return element;
}
}
return null;
}
} | android-ia/platform_tools_idea | java/idea-ui/src/com/intellij/openapi/project/impl/convertors/Util.java | Java | apache-2.0 | 1,166 | [
30522,
1013,
1008,
1008,
9385,
2456,
1011,
2268,
6892,
10024,
7076,
1055,
1012,
1054,
1012,
1051,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#if !defined(AFX_ADDMODULE_H__1CBFA526_190C_11D3_9504_0000C01DBEF9__INCLUDED_)
#define AFX_ADDMODULE_H__1CBFA526_190C_11D3_9504_0000C01DBEF9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// AddModule.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CAddModule dialog
class CAddModule : public CDialog
{
// Construction
public:
CAddModule(CWnd* pParent = NULL); // standard constructor
void AddMachineName(const char *name, void *modinfo);
// Dialog Data
//{{AFX_DATA(CAddModule)
enum { IDD = IDD_DIALOG1 };
CComboBox m_combo1;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAddModule)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CAddModule)
virtual void OnOK();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ADDMODULE_H__1CBFA526_190C_11D3_9504_0000C01DBEF9__INCLUDED_)
| a1k0n/gsynth | gui-mfc/AddModule.h | C | gpl-2.0 | 1,220 | [
30522,
1001,
2065,
999,
4225,
1006,
21358,
2595,
1035,
5587,
5302,
8566,
2571,
1035,
1044,
1035,
1035,
1015,
27421,
7011,
25746,
2575,
1035,
11827,
2278,
1035,
2340,
2094,
2509,
1035,
20317,
2549,
1035,
2199,
2692,
2278,
24096,
18939,
12879... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 2015 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.
#ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_EVENT_ROUTER_H_
#define CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_EVENT_ROUTER_H_
#include <vector>
#include "base/memory/singleton.h"
#include "chrome/common/extensions/api/automation_internal.h"
#include "content/public/browser/ax_event_notification_details.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/common/extension.h"
class Profile;
namespace content {
class BrowserContext;
} // namespace content
struct ExtensionMsg_AccessibilityEventParams;
namespace extensions {
struct AutomationListener;
class AutomationEventRouter : public content::NotificationObserver {
public:
static AutomationEventRouter* GetInstance();
// Indicates that the listener at |listener_process_id|, |listener_routing_id|
// wants to receive automation events from the accessibility tree indicated
// by |source_ax_tree_id|. Automation events are forwarded from now on
// until the listener process dies.
void RegisterListenerForOneTree(const ExtensionId& extension_id,
int listener_process_id,
int listener_routing_id,
int source_ax_tree_id);
// Indicates that the listener at |listener_process_id|, |listener_routing_id|
// wants to receive automation events from all accessibility trees because
// it has Desktop permission.
void RegisterListenerWithDesktopPermission(const ExtensionId& extension_id,
int listener_process_id,
int listener_routing_id);
void DispatchAccessibilityEvent(
const ExtensionMsg_AccessibilityEventParams& params);
// Notify all automation extensions that an accessibility tree was
// destroyed. If |browser_context| is null,
void DispatchTreeDestroyedEvent(
int tree_id,
content::BrowserContext* browser_context);
private:
struct AutomationListener {
AutomationListener();
~AutomationListener();
ExtensionId extension_id;
int routing_id;
int process_id;
bool desktop;
std::set<int> tree_ids;
bool is_active_profile;
};
AutomationEventRouter();
~AutomationEventRouter() override;
void Register(
const ExtensionId& extension_id,
int listener_process_id,
int listener_routing_id,
int source_ax_tree_id,
bool desktop);
// content::NotificationObserver interface.
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// Called when the user switches profiles or when a listener is added
// or removed. The purpose is to ensure that multiple instances of the
// same extension running in different profiles don't interfere with one
// another, so in that case only the one associated with the active profile
// is marked as active.
//
// This is needed on Chrome OS because ChromeVox loads into the login profile
// in addition to the active profile. If a similar fix is needed on other
// platforms, we'd need an equivalent of SessionStateObserver that works
// everywhere.
void UpdateActiveProfile();
content::NotificationRegistrar registrar_;
std::vector<AutomationListener> listeners_;
Profile* active_profile_;
friend struct base::DefaultSingletonTraits<AutomationEventRouter>;
DISALLOW_COPY_AND_ASSIGN(AutomationEventRouter);
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_EVENT_ROUTER_H_
| Workday/OpenFrame | chrome/browser/extensions/api/automation_internal/automation_event_router.h | C | bsd-3-clause | 3,874 | [
30522,
1013,
1013,
9385,
2325,
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... |
<img data-src="{% include image-url.html path=include.path %}" alt="{{ include.alt }}" class="lazyload{% if include.class %} {{ include.class }}{% endif %}"{% if include.style %} style="{{ include.style }}"{% endif %}>
| kaushik88/kaushik88.github.io | _includes/image.html | HTML | mit | 219 | [
30522,
1026,
10047,
2290,
2951,
1011,
5034,
2278,
1027,
1000,
1063,
1003,
2421,
3746,
1011,
24471,
2140,
1012,
16129,
4130,
1027,
2421,
1012,
4130,
1003,
1065,
1000,
12456,
1027,
1000,
1063,
1063,
2421,
30524,
1012,
2806,
1065,
1065,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package http
import (
"go-common/app/admin/main/cache/model"
bm "go-common/library/net/http/blademaster"
)
// @params OverlordReq
// @router get /x/admin/cache/overlord/clusters
// @response OverlordResp
func overlordClusters(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
ctx.JSON(srv.OverlordClusters(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/ops/names
// @response EmpResp
func overlordOpsClusterNames(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
ctx.JSON(srv.OpsClusterNames(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/ops/nodes
// @response EmpResp
func overlordOpsNodes(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
ctx.JSON(srv.OpsClusterNodes(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/import/ops/cluster
// @response EmpResp
func overlordImportCluster(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
ctx.JSON(srv.ImportOpsCluster(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/new/ops/node
// @response EmpResp
func overlordClusterNewNode(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
ctx.JSON(srv.ImportOpsNode(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/replace/ops/node
// @response EmpResp
func overlordClusterReplaceNode(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
ctx.JSON(srv.ReplaceOpsNode(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/cluster/del
// @response EmpResp
func overlordDelCluster(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
ctx.JSON(srv.DelOverlordCluster(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/node/del
// @response EmpResp
func overlordDelNode(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
ctx.JSON(srv.DelOverlordNode(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/app/clusters
// @response OverlordResp
func overlordAppClusters(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
req.Cookie = ctx.Request.Header.Get("Cookie")
ctx.JSON(srv.OverlordAppClusters(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/app/can/bind/clusters
// @response OverlordResp
func overlordAppNeedClusters(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
ctx.JSON(srv.OverlordAppCanBindClusters(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/app/cluster/bind
// @response OverlordResp
func overlordAppClusterBind(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
req.Cookie = ctx.Request.Header.Get("Cookie")
ctx.JSON(srv.OverlordAppClusterBind(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/app/cluster/del
// @response OverlordResp
func overlordAppClusterDel(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
req.Cookie = ctx.Request.Header.Get("Cookie")
ctx.JSON(srv.OverlordAppClusterDel(ctx, req))
}
// @params OverlordReq
// @router get /x/admin/cache/overlord/app/appids
// @response OverlordResp
func overlordAppAppIDs(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
req.Cookie = ctx.Request.Header.Get("Cookie")
ctx.JSON(srv.OverlordAppAppIDs(ctx, req))
}
func overlordToml(ctx *bm.Context) {
req := new(model.OverlordReq)
if err := ctx.Bind(req); err != nil {
return
}
resp, err := srv.OverlordToml(ctx, req)
if err != nil {
ctx.Status(500)
return
}
ctx.Writer.Write(resp)
}
| LQJJ/demo | 126-go-common-master/app/admin/main/cache/http/overlord.go | GO | apache-2.0 | 4,073 | [
30522,
7427,
8299,
12324,
1006,
1000,
2175,
1011,
2691,
1013,
10439,
1013,
4748,
10020,
1013,
2364,
1013,
17053,
1013,
2944,
1000,
1038,
2213,
1000,
2175,
1011,
2691,
1013,
3075,
1013,
5658,
1013,
8299,
1013,
6085,
8706,
1000,
1007,
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... |
"""
Created by Emille Ishida in May, 2015.
Class to implement calculations on data matrix.
"""
import os
import sys
import matplotlib.pylab as plt
import numpy as np
from multiprocessing import Pool
from snclass.treat_lc import LC
from snclass.util import read_user_input, read_snana_lc, translate_snid
from snclass.functions import core_cross_val, screen
##############################################
class DataMatrix(object):
"""
Data matrix class.
Methods:
- build: Build data matrix according to user input file specifications.
- reduce_dimension: Perform dimensionality reduction.
- cross_val: Perform cross-validation.
Attributes:
- user_choices: dict, user input choices
- snid: vector, list of objects identifiers
- datam: array, data matrix for training
- redshift: vector, redshift for training data
- sntype: vector, classification of training data
- low_dim_matrix: array, data matrix in KernelPC space
- transf_test: function, project argument into KernelPC space
- final: vector, optimize parameter values
"""
def __init__(self, input_file=None):
"""
Read user input file.
input: input_file -> str
name of user input file
"""
self.datam = None
self.snid = []
self.redshift = None
self.sntype = None
self.low_dim_matrix = None
self.transf_test = None
self.final = None
self.test_projection = []
if input_file is not None:
self.user_choices = read_user_input(input_file)
def check_file(self, filename, epoch=True, ref_filter=None):
"""
Construct one line of the data matrix.
input: filename, str
file of raw data for 1 supernova
epoch, bool - optional
If true, check if SN satisfies epoch cuts
Default is True
ref_filter, str - optional
Reference filter for peak MJD calculation
Default is None
"""
screen('Fitting ' + filename, self.user_choices)
# translate identifier
self.user_choices['path_to_lc'] = [translate_snid(filename, self.user_choices['photon_flag'][0])[0]]
# read light curve raw data
raw = read_snana_lc(self.user_choices)
# initiate light curve object
lc_obj = LC(raw, self.user_choices)
# load GP fit
lc_obj.load_fit_GP(self.user_choices['samples_dir'][0] + filename)
# normalize
lc_obj.normalize(ref_filter=ref_filter)
# shift to peak mjd
lc_obj.mjd_shift()
if epoch:
# check epoch requirements
lc_obj.check_epoch()
else:
lc_obj.epoch_cuts = True
if lc_obj.epoch_cuts:
# build data matrix lines
lc_obj.build_steps()
# store
obj_line = []
for fil in self.user_choices['filters']:
for item in lc_obj.flux_for_matrix[fil]:
obj_line.append(item)
rflag = self.user_choices['redshift_flag'][0]
redshift = raw[rflag][0]
obj_class = raw[self.user_choices['type_flag'][0]][0]
self.snid.append(raw['SNID:'][0])
return obj_line, redshift, obj_class
else:
screen('... Failed to pass epoch cuts!', self.user_choices)
screen('\n', self.user_choices)
return None
def store_training(self, file_out):
"""
Store complete training matrix.
input: file_out, str
output file name
"""
# write to file
if file_out is not None:
op1 = open(file_out, 'w')
op1.write('SNID type z LC...\n')
for i in xrange(len(self.datam)):
op1.write(str(self.snid[i]) + ' ' + str(self.sntype[i]) +
' ' + str(self.redshift[i]) + ' ')
for j in xrange(len(self.datam[i])):
op1.write(str(self.datam[i][j]) + ' ')
op1.write('\n')
op1.close()
def build(self, file_out=None, check_epoch=True, ref_filter=None):
"""
Build data matrix according to user input file specifications.
input: file_out -> str, optional
file to store data matrix (str). Default is None
check_epoch -> bool, optional
If True check if SN satisfies epoch cuts
Default is True
ref_filter -> str, optional
Reference filter for MJD calculation
Default is None
"""
# list all files in sample directory
file_list = os.listdir(self.user_choices['samples_dir'][0])
datam = []
redshift = []
sntype = []
for obj in file_list:
if 'mean' in obj:
sn_char = self.check_file(obj, epoch=check_epoch,
ref_filter=ref_filter)
if sn_char is not None:
datam.append(sn_char[0])
redshift.append(sn_char[1])
sntype.append(sn_char[2])
self.datam = np.array(datam)
self.redshift = np.array(redshift)
self.sntype = np.array(sntype)
# store results
self.store_training(file_out)
def reduce_dimension(self):
"""Perform dimensionality reduction with user defined function."""
# define dimensionality reduction function
func = self.user_choices['dim_reduction_func']
# reduce dimensionality
self.low_dim_matrix = func(self.datam, self.user_choices)
# define transformation function
self.transf_test = func(self.datam, self.user_choices, transform=True)
def cross_val(self):
"""Optimize the hyperparameters for RBF kernel and ncomp."""
# correct type parameters if necessary
types_func = self.user_choices['transform_types_func']
if types_func is not None:
self.sntype = types_func(self.sntype, self.user_choices['Ia_flag'][0])
# initialize parameters
data = self.datam
types = self.sntype
choices = self.user_choices
nparticles = self.user_choices['n_cross_val_particles']
parameters = []
for i in xrange(nparticles):
pars = {}
pars['data'] = data
pars['types'] = types
pars['user_choices'] = choices
parameters.append(pars)
if int(self.user_choices['n_proc'][0]) > 0:
cv_func = self.user_choices['cross_validation_func']
pool = Pool(processes=int(self.user_choices['n_proc'][0]))
my_pool = pool.map_async(cv_func, parameters)
try:
results = my_pool.get(0xFFFF)
except KeyboardInterrupt:
print 'Interruputed by the user!'
sys.exit()
pool.close()
pool.join()
results = np.array(results)
else:
number = self.user_choices['n_cross_val_particles']
results = np.array([core_cross_val(pars)
for pars in parameters])
flist = list(results[:,len(results[0])-1])
max_success = max(flist)
indx_max = flist.index(max_success)
self.final = {}
for i in xrange(len(self.user_choices['cross_val_par'])):
par_list = self.user_choices['cross_val_par']
self.final[par_list[i]] = results[indx_max][i]
def final_configuration(self):
"""Determine final configuraton based on cross-validation results."""
#update optimized hyper-parameters
for par in self.user_choices['cross_val_par']:
indx = self.user_choices['cross_val_par'].index(par)
self.user_choices[par] = self.final[par]
#update low dimensional matrix
self.reduce_dimension()
def plot(self, pcs, file_out, show=False, test=None):
"""
Plot 2-dimensional scatter of data matrix in kPCA space.
input: pcs, vector of int
kernel PCs to be used as horizontal and vertical axis
file_out, str
file name to store final plot
show, bool, optional
if True show plot in screen
Default is False
test, dict, optional
keywords: data, type
if not None plot the projection of 1 photometric object
Default is None
"""
#define vectors to plot
xdata = self.low_dim_matrix[:,pcs[0]]
ydata = self.low_dim_matrix[:,pcs[1]]
if '0' in self.sntype:
snIa = self.sntype == '0'
nonIa = self.sntype != '0'
else:
snIa = self.sntype == 'Ia'
snIbc = self.sntype == 'Ibc'
snII = self.sntype == 'II'
plt.figure(figsize=(10,10))
if '0' in self.sntype:
plt.scatter(xdata[nonIa], ydata[nonIa], color='purple', marker='s',
label='spec non-Ia')
plt.scatter(xdata[snIa], ydata[snIa], color='blue', marker='o',
label='spec Ia')
else:
plt.scatter(xdata[snII], ydata[snII], color='purple', marker='s',
label='spec II')
plt.scatter(xdata[snIbc], ydata[snIbc], color='green', marker='^',
s=30, label='spec Ibc')
plt.scatter(xdata[snIa], ydata[snIa], color='blue', marker='o',
label='spec Ia')
if test is not None:
if len(test.samples_for_matrix) > 0:
plt.title('prob_Ia = ' + str(round(test['prob_Ia'], 2)))
if test.raw['SIM_NON1a:'][0] == '0':
sntype = 'Ia'
else:
sntype = 'nonIa'
plt.scatter([test.test_proj[0][pcs[0]]], [test.test_proj[0][pcs[1]]],
marker='*', color='red', s=75,
label='photo ' + sntype)
plt.xlabel('kPC' + str(pcs[0] + 1), fontsize=14)
plt.ylabel('kPC' + str(pcs[1] + 1), fontsize=14)
plt.legend(fontsize=12)
if show:
plt.show()
if file_out is not None:
plt.savefig(file_out)
plt.close()
def main():
"""Print documentation."""
print __doc__
if __name__ == '__main__':
main()
| emilleishida/snclass | snclass/matrix.py | Python | gpl-3.0 | 10,669 | [
30522,
1000,
1000,
1000,
2580,
2011,
16243,
2571,
2003,
27511,
2050,
1999,
2089,
1010,
2325,
1012,
2465,
2000,
10408,
16268,
2006,
2951,
8185,
1012,
1000,
1000,
1000,
12324,
9808,
12324,
25353,
2015,
12324,
13523,
24759,
4140,
29521,
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 2010 ZXing authors
*
* 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.google.zxing.aztec;
import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DetectorResult;
public final class AztecDetectorResult extends DetectorResult {
private final boolean compact;
private final int nbDatablocks;
private final int nbLayers;
public AztecDetectorResult(BitMatrix bits, ResultPoint[] points, boolean compact, int nbDatablocks, int nbLayers) {
super(bits, points);
this.compact = compact;
this.nbDatablocks = nbDatablocks;
this.nbLayers = nbLayers;
}
public int getNbLayers() {
return nbLayers;
}
public int getNbDatablocks() {
return nbDatablocks;
}
public boolean isCompact() {
return compact;
}
}
| talent518/zxing | src/com/google/zxing/aztec/AztecDetectorResult.java | Java | apache-2.0 | 1,317 | [
30522,
1013,
1008,
1008,
9385,
2230,
1062,
19612,
6048,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/bin/sh
#
# Copyright (c) 2006 Brian C Gernhardt
#
test_description='Format-patch numbering options'
. ./test-lib.sh
test_expect_success setup '
echo A > file &&
git add file &&
git commit -m First &&
echo B >> file &&
git commit -a -m Second &&
echo C >> file &&
git commit -a -m Third
'
# Each of these gets used multiple times.
test_num_no_numbered() {
cnt=$(grep "^Subject: \[PATCH\]" $1 | wc -l) &&
test $cnt = $2
}
test_single_no_numbered() {
test_num_no_numbered $1 1
}
test_no_numbered() {
test_num_no_numbered $1 2
}
test_single_numbered() {
grep "^Subject: \[PATCH 1/1\]" $1
}
test_numbered() {
grep "^Subject: \[PATCH 1/2\]" $1 &&
grep "^Subject: \[PATCH 2/2\]" $1
}
test_expect_success 'single patch defaults to no numbers' '
git format-patch --stdout HEAD~1 >patch0.single &&
test_single_no_numbered patch0.single
'
test_expect_success 'multiple patch defaults to numbered' '
git format-patch --stdout HEAD~2 >patch0.multiple &&
test_numbered patch0.multiple
'
test_expect_success 'Use --numbered' '
git format-patch --numbered --stdout HEAD~1 >patch1 &&
test_single_numbered patch1
'
test_expect_success 'format.numbered = true' '
git config format.numbered true &&
git format-patch --stdout HEAD~2 >patch2 &&
test_numbered patch2
'
test_expect_success 'format.numbered && single patch' '
git format-patch --stdout HEAD^ > patch3 &&
test_single_numbered patch3
'
test_expect_success 'format.numbered && --no-numbered' '
git format-patch --no-numbered --stdout HEAD~2 >patch4 &&
test_no_numbered patch4
'
test_expect_success 'format.numbered && --keep-subject' '
git format-patch --keep-subject --stdout HEAD^ >patch4a &&
grep "^Subject: Third" patch4a
'
test_expect_success 'format.numbered = auto' '
git config format.numbered auto &&
git format-patch --stdout HEAD~2 > patch5 &&
test_numbered patch5
'
test_expect_success 'format.numbered = auto && single patch' '
git format-patch --stdout HEAD^ > patch6 &&
test_single_no_numbered patch6
'
test_expect_success 'format.numbered = auto && --no-numbered' '
git format-patch --no-numbered --stdout HEAD~2 > patch7 &&
test_no_numbered patch7
'
test_expect_success '--start-number && --numbered' '
git format-patch --start-number 3 --numbered --stdout HEAD~1 > patch8 &&
grep "^Subject: \[PATCH 3/3\]" patch8
'
test_done
| overtherain/scriptfile | tool-kit/git-2.1.2/t/t4021-format-patch-numbered.sh | Shell | mit | 2,367 | [
30522,
1001,
999,
1013,
8026,
1013,
14021,
1001,
1001,
9385,
1006,
1039,
1007,
2294,
4422,
1039,
16216,
6826,
13778,
1001,
3231,
1035,
6412,
1027,
1005,
4289,
1011,
8983,
15200,
7047,
1005,
1012,
1012,
1013,
3231,
1011,
5622,
2497,
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... |
# Tecoma avellanedae Speg. SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Lamiales/Bignoniaceae/Tecoma/Tecoma avellanedae/README.md | Markdown | apache-2.0 | 174 | [
30522,
1001,
8915,
9006,
2050,
13642,
19036,
11960,
2063,
11867,
13910,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
2248,
3269,
3415,
5950,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
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... |
using System;
using System.Runtime.InteropServices;
using Duality;
using Duality.Drawing;
using Duality.Resources;
namespace DynamicLighting
{
[StructLayout(LayoutKind.Sequential)]
public struct VertexC1P3T2A4 : IVertexData
{
public static readonly VertexDeclaration Declaration = VertexDeclaration.Get<VertexC1P3T2A4>();
[VertexElement(VertexElementRole.Color)]
public ColorRgba Color;
[VertexElement(VertexElementRole.Position)]
public Vector3 Pos;
[VertexElement(VertexElementRole.TexCoord)]
public Vector2 TexCoord;
public Vector4 Attrib;
// Add Vector3 for lighting world position, see note in Light.cs
Vector3 IVertexData.Pos
{
get { return this.Pos; }
set { this.Pos = value; }
}
ColorRgba IVertexData.Color
{
get { return this.Color; }
set { this.Color = value; }
}
VertexDeclaration IVertexData.Declaration
{
get { return Declaration; }
}
}
}
| RockyTV/duality | Samples/DynamicLighting/Core/VertexC1P3T2A4.cs | C# | mit | 914 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
6970,
11923,
2121,
7903,
2229,
1025,
2478,
7037,
3012,
1025,
2478,
7037,
3012,
1012,
5059,
1025,
2478,
7037,
3012,
1012,
4219,
1025,
3415,
15327,
8790,
7138,
2075,
1063,
1031,
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... |
\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage[T1, T2A]{fontenc}
\usepackage[russian]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\setlength\parindent{0pt}
\usepackage[parfill]{parskip}
\pagenumbering{gobble}
\DeclareMathOperator{\rank}{rank}
\begin{document}
Непрерывная функция $f(x)$ такова, что $f(0)=f(2)$. Докажите, что для какого-то $x \in [0,2]$ имеет место равенство $f(x)=f(x-1)$.
\end{document}
| efiminem/supershad | source/03-06-2017/2/problem.tex | TeX | mit | 499 | [
30522,
1032,
6254,
26266,
1063,
3720,
1065,
1032,
2224,
23947,
4270,
1031,
21183,
2546,
2620,
2595,
1033,
1063,
7953,
2368,
2278,
1065,
1032,
2224,
23947,
4270,
1031,
1056,
2487,
1010,
1056,
2475,
2050,
1033,
1063,
15489,
2368,
2278,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package io.github.jonestimd.subset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* This class finds subsets of a collection that match some criteria. The criteria are specified by an implementation
* of {@link SubsetPredicate}. The {@code static} factory methods can be used to create an instance of this class based
* on the category (uniform sign or mixed sign) of the collection.
*
* <p>The subsets are searched by adding and removing items to a working subset and notifying the predicate. When an
* item is added to the working subset,the predicate returns a {@link SubsetPredicateResult} indicating if the current
* subset matches the criteria. When an item is removed from the working subset, the predicate is notified so that
* it can update its state. For subsets that do not meet the criteria, the predicate can return one of 3 values,
* to indicate how the search should proceed. The first 2 values should be used for uniform sign collections and
* the last value should be used for mixed sign collections.
* <ul>
* <li>{@link SubsetPredicateResult#TOO_FEW} - items should be added to the subset to move toward the goal</li>
* <li>{@link SubsetPredicateResult#TOO_MANY} - items should be removed from the subset to move toward the goal</li>
* <li>{@link SubsetPredicateResult#NO_MATCH} - it is unknown if items should be added or removed</li>
* </ul>
*
* <p><strong>Note:</strong> This class is not thread safe and each instance should only be accessed by a single thread.
*/
public abstract class SubsetSearch<T> {
private SubsetPredicate<T> criteria;
private List<List<T>> matches = new ArrayList<>();
private CombinationVisitor<T> accumulator = new CombinationVisitor<T>() {
public boolean itemAdded(List<T> subset, T item) {
SubsetPredicateResult result = criteria.apply(item);
if (result == SubsetPredicateResult.MATCH) {
matches.add(subset);
}
return ! isEndNode(result);
}
public void itemRemoved(T item) {
criteria.remove(item);
}
};
protected SubsetSearch(SubsetPredicate<T> criteria) {
this.criteria = criteria;
}
/**
* Perform the search for subsets matching the criteria.
* @return the matching subsets
*/
public List<List<T>> findSubSets(Collection<T> items) {
return findSubSets(new ArrayList<>(items));
}
/**
* Perform the search for subsets matching the criteria.
* @return the matching subsets
*/
public List<List<T>> findSubSets(List<T> items) {
criteria.reset();
matches.clear();
Combinations.visitCombinations(items, accumulator);
return matches;
}
/**
* @return true if the result indicates that supersets of the current set will not match.
*/
protected abstract boolean isEndNode(SubsetPredicateResult result);
/**
* Create a {@link SubsetSearch} for use on a collection having uniform sign (e.g. all positive or negative numbers with no zeros).
* The returned instance will not consider supersets of a subset for which the predicate returns
* {@link SubsetPredicateResult#MATCH} or {@link SubsetPredicateResult#TOO_MANY}.
*/
public static <T> SubsetSearch<T> uniformSign(SubsetPredicate<T> criteria) {
return new SubsetSearch<T>(criteria) {
protected boolean isEndNode(SubsetPredicateResult result) {
return result == SubsetPredicateResult.MATCH || result == SubsetPredicateResult.TOO_MANY;
}
};
}
/**
* Create a {@link SubsetSearch} for use on a collection having mixed sign (e.g. a mix of positive numbers,
* negative numbers and zeros). The returned instance will consider all possible subsets.
*/
public static <T> SubsetSearch<T> mixedSign(SubsetPredicate<T> criteria) {
return new SubsetSearch<T>(criteria) {
protected boolean isEndNode(SubsetPredicateResult result) {
return false;
}
};
}
} | jonestimd/subsets | src/main/java/io/github/jonestimd/subset/SubsetSearch.java | Java | unlicense | 4,137 | [
30522,
7427,
22834,
1012,
21025,
2705,
12083,
1012,
3557,
3775,
26876,
1012,
16745,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
3074,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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>
Jenkins 對 LDAP 的查詢之一,目的在根據使用者名稱找到使用者資料。
<p>
這個欄位設定要用什麼查詢字串來找出使用者資料。
查詢字串幾乎都是 <a href="http://www.ietf.org/rfc/rfc2798.txt">RFC 2798</a> 定義設為
<code>"uid={0}"</code>,所以大部分情況下您應該什麼就不要填,用預設值就好。
<p>
如果您的 LDAP 伺服器沒有 UID 或是沒有有意義的 UID 值,可以用 <code>"mail={0}"</code>,讓使用者以他們的電子郵件信箱登入。
<p>
如果您想設定不同的 LDAP 查詢字串,可以使用 "{0}" 表示使用者輸入的使用者名稱字串。
</div> | 0814jimmy/jenkins | war/src/main/webapp/help/security/ldap/userSearchFilter_zh_TW.html | HTML | mit | 698 | [
30522,
1026,
4487,
2615,
1028,
11098,
100,
25510,
9331,
1916,
100,
100,
1749,
1740,
1989,
1918,
1916,
100,
100,
100,
100,
100,
100,
1795,
100,
100,
100,
100,
100,
100,
100,
100,
1636,
1026,
1052,
1028,
100,
100,
100,
100,
100,
1822,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Filling issues and contributing to gonuts.io
============================================
First of all, thank you for your interest in making packaging better! There are number of ways you can help:
* reporting bugs;
* proposing features;
* contributing code bug fixes and new features;
* contributing documentation fixes (there is probably a ton of grammar errors :/) and improvements.
The following sections describes those scenarios. Golden rule: communicate first, code later.
Reporting bugs
--------------
1. Enable debug output: set "Debug" to "true" in `~/.nut.json`.
2. Make sure bug is reproducible with latest released version: `go get -u github.com/AlekSi/nut/...`.
3. Search for [existing bug report](https://github.com/AlekSi/nut/issues).
4. Create a new issue if needed. Please do not assign any label.
5. Include output of:
(cd $GOPATH/src/github.com/AlekSi/nut && git describe --tags)
go env
6. Include any other information you think may help.
Proposing features
------------------
Please add your comments to [existing feature requests](https://github.com/AlekSi/gonuts.io/issues?labels=feature), but do not create new without proposing them in [mailing list](https://groups.google.com/group/gonuts-io) first.
Contributing changes
--------------------
1. Read all previous sections first.
2. You can make small changes right in the web interface. Spot a typo? Fix it! :)
3. For bigger changes make a fork on GitHub and clone it into `$GOPATH/src/github.com/AlekSi/gonuts.io`.
4. Run `make prepare` to install remote packages and `make run` to run local server.
5. Create a topic branch.
6. Make your changes.
7. Publish your topic branch.
8. Make a pull request.
| AlekSi/gonuts.io | CONTRIBUTING.md | Markdown | bsd-3-clause | 1,696 | [
30522,
8110,
3314,
1998,
8020,
2000,
2175,
24072,
2015,
1012,
22834,
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,
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... |
package com.aspose.spreadsheeteditor;
import java.util.logging.Logger;
import javax.enterprise.context.ApplicationScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Named;
import org.primefaces.context.RequestContext;
/**
*
* @author Saqib Masood
*/
@Named(value = "msg")
@ApplicationScoped
public class MessageService {
private static final Logger LOGGER = Logger.getLogger(MessageService.class.getName());
public void sendMessage(String summary, String details) {
LOGGER.info(String.format("%s: %s", summary, details));
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(summary, details));
}
public void sendMessageDialog(String summary, String details) {
LOGGER.info(String.format("%s: %s", summary, details));
RequestContext.getCurrentInstance().showMessageInDialog(new FacesMessage(summary, details));
}
}
| fahadadeel/Aspose.Cells-for-Java | Showcases/Html5_Spreadsheet_Editor_by_Aspose.Cells_for_Java/src/main/java/com/aspose/spreadsheeteditor/MessageService.java | Java | mit | 952 | [
30522,
7427,
4012,
1012,
2004,
20688,
1012,
20861,
21030,
3064,
15660,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
15899,
1012,
8833,
4590,
1025,
12324,
9262,
2595,
1012,
6960,
1012,
6123,
1012,
5097,
16186,
2094,
1025,
12324,
9262,
2595,
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... |
title: 【Ruby】Block/Proc/lambda的区别
date: 2016-03-14 12:38:56
tags: ["Ruby"]
categories: ["程序开发"]
---
在Ruby语言中,Block 与 Proc 是不同的概念。而 Proc 和 lambda 虽然都是 Proc 对象,在进行处理时会有若干差别。
### Block 和 Proc.new
Block 是代码块,而 Proc 是对象。参数列别中最多只能有一个 Block ,但是可以有多个 Proc 或 Lambda。
Block 是指通过 do~end 或 {} 来进行传递的参数,通常与 yield 来搭配进行使用。
例如:
```
def method_block
yield
end
method_block { p "block" }
#=> "block"
```
将 Block 进行对象化就是 Proc.new 。
Proc 对象一般通过 call 方法来进行调用:
```
def method_block(&block)
block.call
end
method_block { p "block" }
#=> "block"
```
Proc.new 使用参数的情况:
```
proc = Proc.new{ |a| p a * 2 }
proc.call(2)
#=> 4
```
<!-- more -->
### Proc.new 和 lambda
lambda 函数是用于生成 Proc 对象的函数,与 Proc.new 一样通过 call 来进行调用。
```
def method_lambda
lambda1 = lambda{ p "lambda" }
lambda1.call
end
method_lambda
#=> "lambda"
```
但与 Proc.new 相比,两者有两点不通
#### 参数数目
lambda 会检查参数的个数,如果参数个数与规定参数个数不同的情况下,lambda 会报错。而 Proc.new 则不会进行参数检查。
Proc.new的情况:
```
proc = Proc.new{ |a,b,c| p "#{a},#{b},#{c}" }
proc.call(2, 4)
#=> 2,4,nil
```
lambda的情况下:
```
lambda1 = lambda{ |a,b,c| p "#{a},#{b},#{c}" }
lambda1.call(2, 4)
#=> wrong number of arguments (2 for 3) (ArgumentError)
```
#### return 与 break 等关键字的执行
Proc.new的情况下:
```
def method_proc
proc = Proc.new { return p "proc" }
proc.call
p "method_proc"
end
#=>"proc"
```
lambda的情况下:
```
def method_lambda
lambda1 = lambda{ return p "lambda" }
lambda1.call
p "method_lambda"
end
method_lambda
#=>"lambda"
# "method_lambda"
```
在 `Proc.new` 的情况下, `return` 会从函数自身 method_proc 中跳出。而 `lambda` 则会回到 `method_lambda` 中。
| AchillesSatan/MyBlog | source/_posts/2016031401.md | Markdown | gpl-2.0 | 2,122 | [
30522,
2516,
1024,
100,
10090,
100,
3796,
1013,
4013,
2278,
1013,
23375,
1916,
1782,
100,
3058,
1024,
2355,
1011,
6021,
1011,
2403,
2260,
1024,
4229,
1024,
5179,
22073,
1024,
1031,
1000,
10090,
1000,
1033,
7236,
1024,
1031,
1000,
100,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
;idta.asm sets up all the intterupt entry points
extern default_handler
extern idt_ftoi
;error interrupt entry point, we need to only push the error code details to stack
%macro error_interrupt 1
global interrupt_handler_%1
interrupt_handler_%1:
push dword %1
jmp common_handler
%endmacro
;regular interrupt entry point, need to push interrupt number and other data
%macro regular_interrupt 1
global interrupt_handler_%1
interrupt_handler_%1:
push dword 0
push dword %1
jmp common_handler
%endmacro
;common handler for all interrupts, saves all necessary stack data and calls our c intterupt handler
common_handler:
push dword ds
push dword es
push dword fs
push dword gs
pusha
call default_handler
popa
pop dword gs
pop dword fs
pop dword es
pop dword ds
add esp, 8
iret
regular_interrupt 0
regular_interrupt 1
regular_interrupt 2
regular_interrupt 3
regular_interrupt 4
regular_interrupt 5
regular_interrupt 6
regular_interrupt 7
error_interrupt 8
regular_interrupt 9
error_interrupt 10
error_interrupt 11
error_interrupt 12
error_interrupt 13
error_interrupt 14
regular_interrupt 15
regular_interrupt 16
error_interrupt 17
%assign i 18
%rep 12
regular_interrupt i
%assign i i+1
%endrep
error_interrupt 30
%assign i 31
%rep 225
regular_interrupt i
%assign i i+1
%endrep
;interrupt setup, adds all of out interrupt handlers to the idt
global idtsetup
idtsetup:
%assign i 0
%rep 256
push interrupt_handler_%[i]
push i
call idt_ftoi
add esp, 8
%assign i i+1
%endrep
ret
| MalcolmLorber/kernel | src/idta.asm | Assembly | mit | 1,579 | [
30522,
1025,
8909,
2696,
1012,
2004,
2213,
4520,
2039,
2035,
1996,
20014,
3334,
29441,
4443,
2685,
4654,
16451,
12398,
1035,
28213,
4654,
16451,
8909,
2102,
1035,
3027,
10448,
1025,
7561,
17938,
4443,
2391,
1010,
2057,
2342,
2000,
2069,
524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 CSS
*/
.chartWrap {
margin: 0;
padding: 0;
overflow: hidden;
}
/********************
Box shadow and border radius styling
*/
.nvtooltip.with-3d-shadow, .with-3d-shadow .nvtooltip {
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
/********************
* TOOLTIP CSS
*/
.nvtooltip {
position: absolute;
background-color: rgba(255,255,255,1.0);
padding: 1px;
border: 1px solid rgba(0,0,0,.2);
z-index: 10000;
font-family: Arial;
font-size: 13px;
text-align: left;
pointer-events: none;
white-space: nowrap;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/*Give tooltips that old fade in transition by
putting a "with-transitions" class on the container div.
*/
.nvtooltip.with-transitions, .with-transitions .nvtooltip {
transition: opacity 250ms linear;
-moz-transition: opacity 250ms linear;
-webkit-transition: opacity 250ms linear;
transition-delay: 250ms;
-moz-transition-delay: 250ms;
-webkit-transition-delay: 250ms;
}
.nvtooltip.x-nvtooltip,
.nvtooltip.y-nvtooltip {
padding: 8px;
}
.nvtooltip h3 {
margin: 0;
padding: 4px 14px;
line-height: 18px;
font-weight: normal;
background-color: rgba(247,247,247,0.75);
text-align: center;
border-bottom: 1px solid #ebebeb;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.nvtooltip p {
margin: 0;
padding: 5px 14px;
text-align: center;
}
.nvtooltip span {
display: inline-block;
margin: 2px 0;
}
.nvtooltip table {
margin: 6px;
border-spacing:0;
}
.nvtooltip table td {
padding: 2px 9px 2px 0;
vertical-align: middle;
}
.nvtooltip table td.key {
font-weight:normal;
}
.nvtooltip table td.value {
text-align: right;
font-weight: bold;
}
.nvtooltip table tr.highlight td {
padding: 1px 9px 1px 0;
border-bottom-style: solid;
border-bottom-width: 1px;
border-top-style: solid;
border-top-width: 1px;
}
.nvtooltip table td.legend-color-guide div {
width: 8px;
height: 8px;
vertical-align: middle;
}
.nvtooltip .footer {
padding: 3px;
text-align: center;
}
.nvtooltip-pending-removal {
position: absolute;
pointer-events: none;
}
/********************
* SVG CSS
*/
svg {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
/* Trying to get SVG to act like a greedy block in all browsers */
display: block;
width:100%;
height:100%;
}
svg text {
font: normal 12px Arial;
fill:#888; /* yup, fill not stroke */
}
svg .title {
font: bold 14px Arial;
}
.nvd3 .nv-background {
fill: white;
fill-opacity: 0;
/*
pointer-events: none;
*/
}
.nvd3.nv-noData {
font-size: 18px;
font-weight: bold;
}
/**********
* Brush
*/
.nv-brush .extent {
fill-opacity: .125;
shape-rendering: crispEdges;
}
/**********
* Legend
*/
.nvd3 .nv-legend .nv-series {
cursor: pointer;
}
.nvd3 .nv-legend .disabled circle {
fill-opacity: 0;
}
/**********
* Axes
*/
.nvd3 .nv-axis {
pointer-events:none;
}
.nvd3 .nv-axis path {
fill: none;
stroke: #888;
stroke-opacity: .75;
shape-rendering: crispEdges;
}
.nvd3 .nv-axis path.domain {
stroke-opacity: .75;
}
.nvd3 .nv-axis.nv-x path.domain {
stroke-opacity: 0;
}
.nvd3 .nv-axis line {
fill: none;
stroke: #888;
stroke-opacity: .25;
shape-rendering: crispEdges;
}
.nvd3 .nv-axis .zero line,
/*this selector may not be necessary*/ .nvd3 .nv-axis line.zero {
stroke-opacity: .75;
}
.nvd3 .nv-axis .nv-axisMaxMin text {
font-weight: bold;
}
.nvd3 .x .nv-axis .nv-axisMaxMin text,
.nvd3 .x2 .nv-axis .nv-axisMaxMin text,
.nvd3 .x3 .nv-axis .nv-axisMaxMin text {
text-anchor: middle
}
/**********
* Brush
*/
.nv-brush .resize path {
fill: #eee;
stroke: #666;
}
/**********
* Bars
*/
.nvd3 .nv-bars .negative rect {
zfill: brown;
}
.nvd3 .nv-bars rect {
zfill: steelblue;
fill-opacity: .75;
transition: fill-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear;
}
.nvd3 .nv-bars rect.hover {
fill-opacity: 1;
}
.nvd3 .nv-bars .hover rect {
fill: lightblue;
}
.nvd3 .nv-bars text {
fill: rgba(0,0,0,0);
}
.nvd3 .nv-bars .hover text {
fill: rgba(0,0,0,1);
}
/**********
* Bars
*/
.nvd3 .nv-multibar .nv-groups rect,
.nvd3 .nv-multibarHorizontal .nv-groups rect,
.nvd3 .nv-discretebar .nv-groups rect {
stroke-opacity: 0;
transition: fill-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear;
}
.nvd3 .nv-multibar .nv-groups rect:hover,
.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,
.nvd3 .nv-discretebar .nv-groups rect:hover {
fill-opacity: 1;
}
.nvd3 .nv-discretebar .nv-groups text,
.nvd3 .nv-multibarHorizontal .nv-groups text {
font-weight: bold;
fill: rgba(0,0,0,1);
stroke: rgba(0,0,0,0);
}
/***********
* Pie Chart
*/
.nvd3.nv-pie path {
stroke-opacity: 0;
transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
}
.nvd3.nv-pie .nv-slice text {
stroke: #000;
stroke-width: 0;
}
.nvd3.nv-pie path {
stroke: #fff;
stroke-width: 1px;
stroke-opacity: 1;
}
.nvd3.nv-pie .hover path {
fill-opacity: .7;
}
.nvd3.nv-pie .nv-label {
pointer-events: none;
}
.nvd3.nv-pie .nv-label rect {
fill-opacity: 0;
stroke-opacity: 0;
}
/**********
* Lines
*/
.nvd3 .nv-groups path.nv-line {
fill: none;
stroke-width: 1.5px;
/*
stroke-linecap: round;
shape-rendering: geometricPrecision;
transition: stroke-width 250ms linear;
-moz-transition: stroke-width 250ms linear;
-webkit-transition: stroke-width 250ms linear;
transition-delay: 250ms
-moz-transition-delay: 250ms;
-webkit-transition-delay: 250ms;
*/
}
.nvd3 .nv-groups path.nv-line.nv-thin-line {
stroke-width: 1px;
}
.nvd3 .nv-groups path.nv-area {
stroke: none;
/*
stroke-linecap: round;
shape-rendering: geometricPrecision;
stroke-width: 2.5px;
transition: stroke-width 250ms linear;
-moz-transition: stroke-width 250ms linear;
-webkit-transition: stroke-width 250ms linear;
transition-delay: 250ms
-moz-transition-delay: 250ms;
-webkit-transition-delay: 250ms;
*/
}
.nvd3 .nv-line.hover path {
stroke-width: 6px;
}
/*
.nvd3.scatter .groups .point {
fill-opacity: 0.1;
stroke-opacity: 0.1;
}
*/
.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point {
fill-opacity: 0;
stroke-opacity: 0;
}
.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point {
fill-opacity: .5 !important;
stroke-opacity: .5 !important;
}
.with-transitions .nvd3 .nv-groups .nv-point {
transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
-moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
}
.nvd3.nv-scatter .nv-groups .nv-point.hover,
.nvd3 .nv-groups .nv-point.hover {
stroke-width: 7px;
fill-opacity: .95 !important;
stroke-opacity: .95 !important;
}
.nvd3 .nv-point-paths path {
stroke: #aaa;
stroke-opacity: 0;
fill: #eee;
fill-opacity: 0;
}
.nvd3 .nv-indexLine {
cursor: ew-resize;
}
/**********
* Distribution
*/
.nvd3 .nv-distribution {
pointer-events: none;
}
/**********
* Scatter
*/
/* **Attempting to remove this for useVoronoi(false), need to see if it's required anywhere
.nvd3 .nv-groups .nv-point {
pointer-events: none;
}
*/
.nvd3 .nv-groups .nv-point.hover {
stroke-width: 20px;
stroke-opacity: .5;
}
.nvd3 .nv-scatter .nv-point.hover {
fill-opacity: 1;
}
/*
.nv-group.hover .nv-point {
fill-opacity: 1;
}
*/
/**********
* Stacked Area
*/
.nvd3.nv-stackedarea path.nv-area {
fill-opacity: .7;
/*
stroke-opacity: .65;
fill-opacity: 1;
*/
stroke-opacity: 0;
transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
/*
transition-delay: 500ms;
-moz-transition-delay: 500ms;
-webkit-transition-delay: 500ms;
*/
}
.nvd3.nv-stackedarea path.nv-area.hover {
fill-opacity: .9;
/*
stroke-opacity: .85;
*/
}
/*
.d3stackedarea .groups path {
stroke-opacity: 0;
}
*/
.nvd3.nv-stackedarea .nv-groups .nv-point {
stroke-opacity: 0;
fill-opacity: 0;
}
/*
.nvd3.nv-stackedarea .nv-groups .nv-point.hover {
stroke-width: 20px;
stroke-opacity: .75;
fill-opacity: 1;
}*/
/**********
* Line Plus Bar
*/
.nvd3.nv-linePlusBar .nv-bar rect {
fill-opacity: .75;
}
.nvd3.nv-linePlusBar .nv-bar rect:hover {
fill-opacity: 1;
}
/**********
* Bullet
*/
.nvd3.nv-bullet { font: 10px sans-serif; }
.nvd3.nv-bullet .nv-measure { fill-opacity: .8; }
.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; }
.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; }
.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; }
.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; }
.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; }
.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; }
.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; }
.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; }
.nvd3.nv-bullet .nv-subtitle { fill: #999; }
.nvd3.nv-bullet .nv-range {
fill: #bababa;
fill-opacity: .4;
}
.nvd3.nv-bullet .nv-range:hover {
fill-opacity: .7;
}
/**********
* Sparkline
*/
.nvd3.nv-sparkline path {
fill: none;
}
.nvd3.nv-sparklineplus g.nv-hoverValue {
pointer-events: none;
}
.nvd3.nv-sparklineplus .nv-hoverValue line {
stroke: #333;
stroke-width: 1.5px;
}
.nvd3.nv-sparklineplus,
.nvd3.nv-sparklineplus g {
pointer-events: all;
}
.nvd3 .nv-hoverArea {
fill-opacity: 0;
stroke-opacity: 0;
}
.nvd3.nv-sparklineplus .nv-xValue,
.nvd3.nv-sparklineplus .nv-yValue {
/*
stroke: #666;
*/
stroke-width: 0;
font-size: .9em;
font-weight: normal;
}
.nvd3.nv-sparklineplus .nv-yValue {
stroke: #f66;
}
.nvd3.nv-sparklineplus .nv-maxValue {
stroke: #2ca02c;
fill: #2ca02c;
}
.nvd3.nv-sparklineplus .nv-minValue {
stroke: #d62728;
fill: #d62728;
}
.nvd3.nv-sparklineplus .nv-currentValue {
/*
stroke: #444;
fill: #000;
*/
font-weight: bold;
font-size: 1.1em;
}
/**********
* historical stock
*/
.nvd3.nv-ohlcBar .nv-ticks .nv-tick {
stroke-width: 2px;
}
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover {
stroke-width: 4px;
}
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive {
stroke: #2ca02c;
}
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative {
stroke: #d62728;
}
.nvd3.nv-historicalStockChart .nv-axis .nv-axislabel {
font-weight: bold;
}
.nvd3.nv-historicalStockChart .nv-dragTarget {
fill-opacity: 0;
stroke: none;
cursor: move;
}
.nvd3 .nv-brush .extent {
/*
cursor: ew-resize !important;
*/
fill-opacity: 0 !important;
}
.nvd3 .nv-brushBackground rect {
stroke: #000;
stroke-width: .4;
fill: #fff;
fill-opacity: .7;
}
/**********
* Indented Tree
*/
/**
* TODO: the following 3 selectors are based on classes used in the example. I should either make them standard and leave them here, or move to a CSS file not included in the library
*/
.nvd3.nv-indentedtree .name {
margin-left: 5px;
}
.nvd3.nv-indentedtree .clickable {
color: #08C;
cursor: pointer;
}
.nvd3.nv-indentedtree span.clickable:hover {
color: #005580;
text-decoration: underline;
}
.nvd3.nv-indentedtree .nv-childrenCount {
display: inline-block;
margin-left: 5px;
}
.nvd3.nv-indentedtree .nv-treeicon {
cursor: pointer;
/*
cursor: n-resize;
*/
}
.nvd3.nv-indentedtree .nv-treeicon.nv-folded {
cursor: pointer;
/*
cursor: s-resize;
*/
}
/**********
* Parallel Coordinates
*/
.nvd3 .background path {
fill: none;
stroke: #ccc;
stroke-opacity: .4;
shape-rendering: crispEdges;
}
.nvd3 .foreground path {
fill: none;
stroke: steelblue;
stroke-opacity: .7;
}
.nvd3 .brush .extent {
fill-opacity: .3;
stroke: #fff;
shape-rendering: crispEdges;
}
.nvd3 .axis line, .axis path {
fill: none;
stroke: #888;
shape-rendering: crispEdges;
}
.nvd3 .axis text {
fill: #888;
text-shadow: 0 1px 0 #fff;
}
/****
Interactive Layer
*/
.nvd3 .nv-interactiveGuideLine {
pointer-events:none;
}
.nvd3 line.nv-guideline {
stroke: #ccc;
} | Ekus/HomeDashboard | HomeDashboard.Web/css/nv.d3.css | CSS | gpl-2.0 | 12,912 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
16129,
20116,
2015,
1008,
1013,
1012,
3673,
13088,
9331,
1063,
7785,
1024,
1014,
1025,
11687,
4667,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 'active_record/migration'
module CanvasPartman
class Migration < ActiveRecord::Migration
class << self
# @attr [CanvasPartman::Partitioned] base_class
# The partitioned ActiveRecord::Base model _class_ we're modifying
attr_accessor :base_class
end
def with_each_partition(&block)
find_partition_tables.each(&block)
end
# Bind the migration to apply only on a certain partition table. Routines
# like #with_each_partition will yield only the specified table instead.
#
# @param [String] table_name
# Name of the **existing** partition table.
def restrict_to_partition(table_name)
@partition_scope = table_name
yield
ensure
@partition_scope = nil
end
def self.connection
(base_class || ActiveRecord::Base).connection
end
private
def partition_manager
@partition_manager ||= PartitionManager.new(self.class.base_class)
end
def find_partition_tables
return [ @partition_scope ] if @partition_scope
partition_manager.partition_tables
end
end
end
| Rvor/canvas-lms | gems/canvas_partman/lib/canvas_partman/migration.rb | Ruby | agpl-3.0 | 1,106 | [
30522,
5478,
1005,
3161,
1035,
2501,
1013,
9230,
1005,
11336,
10683,
19362,
22942,
2465,
9230,
1026,
3161,
2890,
27108,
2094,
1024,
1024,
9230,
2465,
1026,
1026,
2969,
1001,
1030,
2012,
16344,
1031,
10683,
19362,
22942,
1024,
1024,
13571,
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... |
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Spark for Social Science</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta name="description" content="Spark for Social Science">
<meta name="generator" content="bookdown 0.3 and GitBook 2.6.7">
<meta property="og:title" content="Spark for Social Science" />
<meta property="og:type" content="book" />
<meta name="github-repo" content="urbaninstitute/spark-social-science-manual" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Spark for Social Science" />
<meta name="author" content="Research Programming, The Urban Institute">
<meta name="date" content="2017-01-27">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="next" href="intro.html">
<script src="libs/jquery-2.2.3/jquery.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">
<div class="book-summary">
<nav role="navigation">
<ul class="summary">
<li><a href="./">Spark Social Science Manual</a></li>
<li class="divider"></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i>About Spark Social Science</a></li>
<li class="chapter" data-level="1" data-path="intro.html"><a href="intro.html"><i class="fa fa-check"></i><b>1</b> - Introduction</a></li>
<li class="chapter" data-level="2" data-path="getting-started-with-spark.html"><a href="getting-started-with-spark.html"><i class="fa fa-check"></i><b>2</b> - Getting Started with Spark</a></li>
<li class="chapter" data-level="3" data-path="understanding-spark.html"><a href="understanding-spark.html"><i class="fa fa-check"></i><b>3</b> - Understanding Spark</a></li>
<li class="chapter" data-level="4" data-path="sorting-distributed-data.html"><a href="sorting-distributed-data.html"><i class="fa fa-check"></i><b>4</b> - Sorting Distributed Data</a></li>
<li class="chapter" data-level="5" data-path="data-visualization.html"><a href="data-visualization.html"><i class="fa fa-check"></i><b>5</b> - Data Visualization</a></li>
<li class="chapter" data-level="6" data-path="econometrics-and-large-scale-data.html"><a href="econometrics-and-large-scale-data.html"><i class="fa fa-check"></i><b>6</b> - Econometrics and Large-scale Data</a></li>
<li class="chapter" data-level="7" data-path="appendix.html"><a href="appendix.html"><i class="fa fa-check"></i><b>7</b> - Appendix</a></li>
<li class="chapter" data-level="8" data-path="glossary-of-terms.html"><a href="glossary-of-terms.html"><i class="fa fa-check"></i><b>8</b> - Glossary of Terms</a></li>
<li class="divider"></li>
<li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i><a href="./">Spark for Social Science</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<section class="normal" id="section-">
<div id="header">
<h1 class="title">Spark for Social Science</h1>
<h4 class="author"><em>Research Programming, The Urban Institute</em></h4>
<h4 class="date"><em>January 27, 2017</em></h4>
</div>
<div id="about-spark-social-science" class="section level1 unnumbered">
<h1>About Spark Social Science</h1>
<div class="figure">
<img src="images/urban.png" />
</div>
<p>The Spark Social Science is an endeavor by the <a href="http://www.urban.org/">Urban Institute</a> to expand access and understanding of modern big data capabilities to social scientists and public policy reseachers.</p>
<p>There are four GitHub repositories associated with this project:<br />
- <a href="https://github.com/UrbanInstitute/spark-social-science">Spark Social Science</a> – will walk you through the technical process of launching Spark in Amazon Web Services.<br />
- <a href="https://github.com/UrbanInstitute/sparkr-tutorials">SparkR-Tutorials</a> – contains a comprehensive introduction to working with Spark using R.<br />
- <a href="https://github.com/UrbanInstitute/pyspark-tutorials">PySpark-Tutorials</a> – contains a comprehensive introdution to working with Spark using Python.<br />
- <a href="https://github.com/UrbanInstitute/spark-social-science-manual">Spark Social for Science</a> – the GitHub Repository for this book.</p>
<p>This work is generously funded by the <a href="https://www.sloan.org">Alfred P. Sloan Foundation</a>.</p>
<div class="figure">
<img src="images/sloan.png" />
</div>
<hr />
<p>This work is licensed under the <a href="https://github.com/UrbanInstitute/spark-social-science-manual/blob/master/License.md">Gnu General Public License, Version 3, 29 June 2007</a>.</p>
</div>
</section>
</div>
</div>
</div>
<a href="intro.html" class="navigation navigation-next navigation-unique" aria-label="Next page""><i class="fa fa-angle-right"></i></a>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/lunr.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script>
require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": false,
"facebook": true,
"twitter": true,
"google": false,
"weibo": false,
"instapper": false,
"vk": false,
"all": ["facebook", "google", "twitter", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": "https://github.com/rstudio/bookdown-demo/edit/master/index.Rmd",
"text": "Edit"
},
"download": null,
"toc": {
"collapse": "subsection"
}
});
});
</script>
</body>
</html>
| UrbanInstitute/spark-social-science-manual | docs/index.html | HTML | gpl-3.0 | 6,793 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
1060,
1011,
25423,
1011,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _1_sort__opaque_Node_1;
struct _IO_FILE;
struct timeval;
extern void signal(int sig , void *func ) ;
extern float strtof(char const *str , char const *endptr ) ;
typedef unsigned long size_t;
typedef struct _IO_FILE FILE;
extern __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1), __leaf__)) atoi)(char const *__nptr ) __attribute__((__pure__)) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
typedef struct _1_sort__opaque_Node_1 *_1_sort__opaque_List_1;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
struct _1_sort__opaque_Node_1 {
int data ;
struct _1_sort__opaque_Node_1 *next ;
};
struct _1_sort__opaque_Node_1 *_1_sort__opaque_list2_1 = (struct _1_sort__opaque_Node_1 *)0;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const * __restrict __format , ...) ;
int main(int argc , char **argv ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
void sort(int *mlist , int size ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
struct _1_sort__opaque_Node_1 *_1_sort__opaque_list1_1 = (struct _1_sort__opaque_Node_1 *)0;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern __attribute__((__nothrow__)) void *( __attribute__((__leaf__)) malloc)(size_t __size ) __attribute__((__malloc__)) ;
extern int scanf(char const *format , ...) ;
void sort(int *mlist , int size )
{
int i ;
int j ;
int tmp ;
int i6 ;
int r7 ;
struct _1_sort__opaque_Node_1 *p8 ;
int _1_sort__BEGIN_0 ;
int _1_sort__END_0 ;
int _1_sort__BARRIER_1 ;
unsigned long _2_sort_next ;
{
{ /* __blockattribute__(__ATOMIC__)*/
_1_sort__BEGIN_0 = 1;
i6 = 0;
while (i6 < 2) {
r7 = rand();
p8 = (struct _1_sort__opaque_Node_1 *)malloc(sizeof(struct _1_sort__opaque_Node_1 ));
if (p8 != (struct _1_sort__opaque_Node_1 *)0UL) {
p8->data = r7;
if (_1_sort__opaque_list1_1 != (struct _1_sort__opaque_Node_1 *)0UL) {
p8->next = _1_sort__opaque_list1_1->next;
_1_sort__opaque_list1_1->next = p8;
} else {
p8->next = p8;
_1_sort__opaque_list1_1 = p8;
}
} else {
}
i6 ++;
}
_1_sort__opaque_list2_1 = _1_sort__opaque_list1_1;
_1_sort__END_0 = 1;
}
_1_sort__BARRIER_1 = 1;
_2_sort_next = 12 * ! (_1_sort__opaque_list2_1 == (struct _1_sort__opaque_Node_1 *)0UL);
while (1) {
switch (_2_sort_next) {
case 0: ;
return;
break;
case 10: ;
if (i < size - 1) {
_2_sort_next = 8 + (_1_sort__opaque_list1_1 == (struct _1_sort__opaque_Node_1 *)0UL);
} else {
_2_sort_next = (unsigned long )(_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1) + (unsigned long )(_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1);
}
break;
case 12:
i = 0;
_2_sort_next = 10 - ! (_1_sort__opaque_list2_1 != (struct _1_sort__opaque_Node_1 *)0UL);
break;
case 4: ;
if (*(mlist + j) > *(mlist + (j + 1))) {
_2_sort_next = ((unsigned long )(_1_sort__opaque_list2_1 != (struct _1_sort__opaque_Node_1 *)0UL) - (unsigned long )(_1_sort__opaque_list2_1 == (struct _1_sort__opaque_Node_1 *)0UL)) + ((unsigned long )(! ((unsigned long )(_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1))) + 1);
} else {
_2_sort_next = (unsigned long )(! ((unsigned long )(_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1))) + 1;
}
break;
case 14:
*(mlist + j) = *(mlist + (j + 1));
_2_sort_next = _1_sort__opaque_list1_1 != (struct _1_sort__opaque_Node_1 *)0UL ? 13 : 5;
break;
case 2:
j ++;
_2_sort_next = 6 - (_1_sort__opaque_list1_1 == (struct _1_sort__opaque_Node_1 *)0UL);
break;
case 13:
*(mlist + (j + 1)) = tmp;
_2_sort_next = ((unsigned long )(_1_sort__opaque_list1_1 == (struct _1_sort__opaque_Node_1 *)0UL) + (unsigned long )(_1_sort__opaque_list1_1 == _1_sort__opaque_list2_1)) + 1;
break;
case 8:
j = 0;
_2_sort_next = _1_sort__opaque_list1_1 != _1_sort__opaque_list2_1 ? 2 : 6;
break;
case 6: ;
if (j < (size - 1) - i) {
_2_sort_next = 4 + ((_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1) + (_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1));
} else {
_2_sort_next = (unsigned long )(! ((unsigned long )(_1_sort__opaque_list2_1 == (struct _1_sort__opaque_Node_1 *)0UL)));
}
break;
case 1:
i ++;
_2_sort_next = 10 - ((_1_sort__opaque_list1_1 != (struct _1_sort__opaque_Node_1 *)0UL) - (_1_sort__opaque_list1_1 != (struct _1_sort__opaque_Node_1 *)0UL));
break;
case 3:
tmp = *(mlist + j);
_2_sort_next = 14 - ((_1_sort__opaque_list1_1 == (struct _1_sort__opaque_Node_1 *)0UL) + (_1_sort__opaque_list1_1 == (struct _1_sort__opaque_Node_1 *)0UL));
break;
}
}
}
}
void megaInit(void)
{
{
}
}
int main(int argc , char **argv )
{
int size_of_list ;
int tmp ;
int *list ;
void *tmp___0 ;
int i ;
int i___0 ;
{
megaInit();
tmp = atoi((char const *)*(argv + 1));
size_of_list = tmp;
tmp___0 = malloc((unsigned long )size_of_list * sizeof(int ));
list = (int *)tmp___0;
i = 0;
while (i < size_of_list) {
*(list + i) = atoi((char const *)*(argv + (2 + i)));
i ++;
}
sort(list, size_of_list);
i___0 = 0;
while (i___0 < size_of_list) {
printf((char const */* __restrict */)"%d", *(list + i___0));
i___0 ++;
}
printf((char const */* __restrict */)"\n");
return (0);
}
}
| melbcat/relative-pattern | experiments/bublesort_obf.c | C | gpl-2.0 | 6,107 | [
30522,
1013,
1008,
7013,
2011,
25022,
2140,
1058,
1012,
1015,
1012,
1021,
1012,
1014,
1008,
1013,
1013,
1008,
6140,
1035,
25022,
2140,
1035,
7953,
2003,
6270,
1008,
1013,
2358,
6820,
6593,
1035,
1015,
1035,
4066,
1035,
1035,
28670,
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 xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="provider" content="www.cnepub.com"/>
<meta name="builder" content="epubBuilder present by www.cnepub.com"/>
<meta name="right" content="该文档由epubBuilder生成。epubBuilder为掌上书苑(www.cnepub.com)提供的epub制作工具,仅供个人交流与学习使用。在未获得掌上书苑的商业授权前,不得用于任何商业用途。"/>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
<title>第三十九章</title>
</head>
<body>
<div>
<h3>第三十九章</h3>
<p>1岩间野羊生羔、尔知其时乎、麀鹿产子、尔悉其期乎、</p>
<p>2岂能计其月数、知其孳生之时乎、</p>
<p>3卷曲生子、劬劳诞育、</p>
<p>4其子渐壮、长于原野、去而不返、</p>
<p>5谁令野驴任意游行、谁为迅驴解其絷维、</p>
<p>6我使旷野为其室家、卤地为其居所、</p>
<p>7彼轻忽邑中之喧哗、不听驱者之叱咤、</p>
<p>8诸山为其牧场、遍觅青草、</p>
<p>9野牛岂役于尔、抑安处尔槽乎、</p>
<p>10尔能在陇亩中、系之以索乎、彼岂从尔耙于谷乎、</p>
<p>11尔岂因其力大、而恃之乎、抑以尔劳委之乎、</p>
<p>12尔岂赖其运谷于家、积禾于场乎、</p>
<p>13鸵鸟昂然展翼、惟其毛羽不慈、</p>
<p>14盖遗其卵于地、暖之于沙、</p>
<p>15不念人足或践之、野兽或躏之、</p>
<p>16忍心待雏、若非己有、虽则徒劳、亦无惧也、</p>
<p>17盖上帝去其慧心、不赋以灵明、</p>
<p>18及其高展、则轻视马与乘者、</p>
<p>19马力尔赐之乎、其项奋扬之鬣、尔被之乎、</p>
<p>20其跃如蝗、尔令之乎、咆哮之威、甚可畏也、</p>
<p>21跑地于谷、自喜有力、出迓兵械、</p>
<p>22遇有可畏、轻视而不惧、不因锋刃而却退、</p>
<p>23其上箭弢、与光明之戈矛、震震有声、</p>
<p>24彼乃猛烈忿怒、气吞土地、一闻角声、则不耐立、</p>
<p>25角响则嘶、远嗅战气、乐闻将帅之雷霆、士卒之鼓噪、</p>
<p>26鹰隼飞翔、振翮南往、岂由尔智乎、</p>
<p>27雕鹗腾空、营巢高岭、岂因尔命乎、</p>
<p>28巢于巉岩、峰巅巩固之处、</p>
<p>29自彼窥食、其目远观、</p>
<p>30其雏吮血、尸之所在、彼亦在焉、</p>
</div>
</body>
</html>
| yighu/wenli | OPS/chapter559.html | HTML | apache-2.0 | 2,477 | [
30522,
1026,
16129,
20950,
3619,
1027,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
2639,
1013,
1060,
11039,
19968,
1000,
20950,
1024,
11374,
1027,
1000,
1062,
2232,
1011,
27166,
1000,
1028,
1026,
2132,
1028,
1026... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-16" http-equiv="Content-Type" />
<title _locid="PortabilityAnalysis0">.NET Portability Report</title>
<style>
/* Body style, for the entire document */
body {
background: #F3F3F4;
color: #1E1E1F;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
padding: 0;
margin: 0;
}
/* Header1 style, used for the main title */
h1 {
padding: 10px 0px 10px 10px;
font-size: 21pt;
background-color: #E2E2E2;
border-bottom: 1px #C1C1C2 solid;
color: #201F20;
margin: 0;
font-weight: normal;
}
/* Header2 style, used for "Overview" and other sections */
h2 {
font-size: 18pt;
font-weight: normal;
padding: 15px 0 5px 0;
margin: 0;
}
/* Header3 style, used for sub-sections, such as project name */
h3 {
font-weight: normal;
font-size: 15pt;
margin: 0;
padding: 15px 0 5px 0;
background-color: transparent;
}
h4 {
font-weight: normal;
font-size: 12pt;
margin: 0;
padding: 0 0 0 0;
background-color: transparent;
}
/* Color all hyperlinks one color */
a {
color: #1382CE;
}
/* Paragraph text (for longer informational messages) */
p {
font-size: 10pt;
}
/* Table styles */
table {
border-spacing: 0 0;
border-collapse: collapse;
font-size: 10pt;
}
table th {
background: #E7E7E8;
text-align: left;
text-decoration: none;
font-weight: normal;
padding: 3px 6px 3px 6px;
}
table td {
vertical-align: top;
padding: 3px 6px 5px 5px;
margin: 0px;
border: 1px solid #E7E7E8;
background: #F7F7F8;
}
.NoBreakingChanges {
color: darkgreen;
font-weight:bold;
}
.FewBreakingChanges {
color: orange;
font-weight:bold;
}
.ManyBreakingChanges {
color: red;
font-weight:bold;
}
.BreakDetails {
margin-left: 30px;
}
.CompatMessage {
font-style: italic;
font-size: 10pt;
}
.GoodMessage {
color: darkgreen;
}
/* Local link is a style for hyperlinks that link to file:/// content, there are lots so color them as 'normal' text until the user mouse overs */
.localLink {
color: #1E1E1F;
background: #EEEEED;
text-decoration: none;
}
.localLink:hover {
color: #1382CE;
background: #FFFF99;
text-decoration: none;
}
/* Center text, used in the over views cells that contain message level counts */
.textCentered {
text-align: center;
}
/* The message cells in message tables should take up all avaliable space */
.messageCell {
width: 100%;
}
/* Padding around the content after the h1 */
#content {
padding: 0px 12px 12px 12px;
}
/* The overview table expands to width, with a max width of 97% */
#overview table {
width: auto;
max-width: 75%;
}
/* The messages tables are always 97% width */
#messages table {
width: 97%;
}
/* All Icons */
.IconSuccessEncoded, .IconInfoEncoded, .IconWarningEncoded, .IconErrorEncoded {
min-width: 18px;
min-height: 18px;
background-repeat: no-repeat;
background-position: center;
}
/* Success icon encoded */
.IconSuccessEncoded {
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */
/* [---XsltValidateInternal-Base64EncodedImage:IconSuccess#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABPElEQVR4Xp1Tv0vDUBi8FqeA4NpBcBLcWnQSApncOnTo4FSnjP0DsnXpH5CxiwbHDg4Zuj4oOEXiJgiC4FDcCkLWmIMc1Pfw+eMgQ77v3Xf3Pe51YKGqqisAEwCR1TIAsiAIblSo6xrdHeJR85Xle3mdmCQKb0PsfqyxxzM8K15HZADl/H5+sHpZwYfxyRjTs+kWwKBx8yoHd2mRiuzF8mkJniWH/13u3Fjrs/EdhsdDFHGB/DLXEJBDLh1MWPAhPo1BLB4WX5yQywHR+m3tVe/t97D52CB/ziG0nIgD/qDuYg8WuCcVZ2YGwlJ3YDugkpR/VNcAEx6GEKhERSr71FuO4YCM4XBdwKvecjIlkSnsO0Hyp/GxSeJAdzBKzpOtnPwyyiPdAZhpZptT04tU+zk7s8czeges//s5C5+CwqrR4/gw+AAAAABJRU5ErkJggg==);
}
/* Information icon encoded */
.IconInfoEncoded {
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */
/* [---XsltValidateInternal-Base64EncodedImage:IconInformation#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABHElEQVR4Xs2TsUoDQRRF7wwoziokjZUKadInhdhukR9YP8DMX1hYW+QvdsXa/QHBbcXC7W0CamWTQnclFutceIQJwwaWNLlwm5k5d94M76mmaeCrrmsLYOocY12FcxZFUeozCqKqqgYA8uevv1H6VuPxcwlfk5N92KHBxfFeCSAxxswlYAW/Xr989x/mv9gkhtyMDhcAxgzRsp7flj8B/HF1RsMXq+NZMkopaHe7lbKxQUEIGbKsYNoGn969060hZBkQex/W8oRQwsQaW2o3Ago2SVcJUzAgY3N0lTCZZm+zPS8HB51gMmS1DEYyOz9acKO1D8JWTlafKIMxdhvlfdyT94Vv5h7P8Ky7nQzACmhvKq3zk3PjW9asz9D/1oigecsioooAAAAASUVORK5CYII=);
}
/* Warning icon encoded */
.IconWarningEncoded {
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */
/* [---XsltValidateInternal-Base64EncodedImage:IconWarning#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAx0lEQVR4XpWSMQ7CMAxFf4xAyBMLCxMrO8dhaBcuwdCJS3RJBw7SA/QGTCxdWJgiQYWKXJWKIXHIlyw5lqr34tQgEOdcBsCOx5yZK3hCCKdYXneQkh4pEfqzLfu+wVDSyyzFoJjfz9NB+pAF+eizx2Vruts0k15mPgvS6GYvpVtQhB61IB/dk6AF6fS4Ben0uIX5odtFe8Q/eW1KvFeH4e8khT6+gm5B+t3juyDt7n0jpe+CANTd+oTUjN/U3yVaABnSUjFz/gFq44JaVSCXeQAAAABJRU5ErkJggg==);
}
/* Error icon encoded */
.IconErrorEncoded {
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */
/* [---XsltValidateInternal-Base64EncodedImage:IconError#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABQElEQVR4XqWTvUoEQRCE6wYPZUA80AfwAQz23uCMjA7MDRQEIzPBVEyNTQUFIw00vcQTTMzuAh/AxEQQT8HF/3G/oGGnEUGuoNnd6qoZuqltyKEsyzVJq5I6rnUp6SjGeGhESikzzlc1eL7opfuVbrqbU1Zw9NCgtQMaZpY0eNnaaL2fHusvTK5vKu7sjSS1Y4y3QUA6K3e3Mau5UFDyMP7tYF9o8cAHZv68vipoIJg971PZIZ5HiwdvYGGvFVFHmGmZ2MxwmQYPXubPl9Up0tfoMQGetXd6mRbvhBw+boZ6WF7Mbv1+GsHRk0fQmPAH1GfmZirbCfDJ61tw3Px8/8pZsPAG4jlVhcPgZ7adwNWBB68lkRQWFiTgFlbnLY3DGGM7izIJIyT/jjIvEJw6fdJTc6krDzh6aMwMP9bvDH4ADSsa9uSWVJkAAAAASUVORK5CYII=);
}
</style>
</head>
<body>
<h1 _locid="PortabilityReport">.NET Portability Report</h1>
<div id="content">
<div id="submissionId" style="font-size:8pt;">
<p>
<i>
Submission Id
b3046a13-df0f-43e2-b660-d4209db51739
</i>
</p>
</div>
<h2 _locid="SummaryTitle">
<a name="Portability Summary"></a>Portability Summary
</h2>
<div id="summary">
<table>
<tbody>
<tr>
<th>Assembly</th>
<th>ASP.NET 5,Version=v1.0</th>
<th>Windows,Version=v8.1</th>
<th>.NET Framework,Version=v4.6</th>
<th>Windows Phone,Version=v8.1</th>
</tr>
<tr>
<td><strong><a href="#Roniz.WCF.P2P.Sync">Roniz.WCF.P2P.Sync</a></strong></td>
<td class="text-center">85.46 %</td>
<td class="text-center">85.02 %</td>
<td class="text-center">100.00 %</td>
<td class="text-center">72.69 %</td>
</tr>
</tbody>
</table>
</div>
<div id="details">
<a name="Roniz.WCF.P2P.Sync"><h3>Roniz.WCF.P2P.Sync</h3></a>
<table>
<tbody>
<tr>
<th>Target type</th>
<th>ASP.NET 5,Version=v1.0</th>
<th>Windows,Version=v8.1</th>
<th>.NET Framework,Version=v4.6</th>
<th>Windows Phone,Version=v8.1</th>
<th>Recommended changes</th>
</tr>
<tr>
<td>System.ComponentModel.Component</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Remove usage</td>
</tr>
<tr>
<td style="padding-left:2em">Dispose</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Remove usage</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.Configuration.ApplicationSettingsBase</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">#ctor</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.Configuration.SettingsBase</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">Synchronized(System.Configuration.SettingsBase)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.Diagnostics.Contracts.Internal.ContractHelper</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">RaiseContractFailedEvent(System.Diagnostics.Contracts.ContractFailureKind,System.String,System.String,System.Exception)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.Runtime.ConstrainedExecution.Cer</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.Runtime.ConstrainedExecution.Consistency</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.Runtime.ConstrainedExecution.ReliabilityContractAttribute</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Remove usage</td>
</tr>
<tr>
<td style="padding-left:2em">#ctor(System.Runtime.ConstrainedExecution.Consistency,System.Runtime.ConstrainedExecution.Cer)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Remove usage</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.ChannelFactory`1</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">CreateChannel</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.Channels.CommunicationObject</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">add_Closed(System.EventHandler)</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">add_Closing(System.EventHandler)</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">add_Faulted(System.EventHandler)</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">add_Opened(System.EventHandler)</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">add_Opening(System.EventHandler)</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">BeginOpen(System.AsyncCallback,System.Object)</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">Close</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">EndOpen(System.IAsyncResult)</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.Channels.IChannel</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.Channels.Message</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.CommunicationState</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.DuplexChannelFactory`1</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">#ctor(System.Object,System.String)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.IClientChannel</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.ICommunicationObject</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">Abort</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">Close</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">get_State</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.MessageBodyMemberAttribute</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">#ctor</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.MessageContractAttribute</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">#ctor</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.OperationContractAttribute</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">#ctor</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.PeerMessageOrigination</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.PeerMessagePropagation</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.PeerMessagePropagationFilter</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">#ctor</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.PeerNode</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">add_Offline(System.EventHandler)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">add_Online(System.EventHandler)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">get_IsOnline</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">set_MessagePropagationFilter(System.ServiceModel.PeerMessagePropagationFilter)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.ServiceModel.ServiceContractAttribute</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">#ctor</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.Timers.ElapsedEventArgs</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Use System.Threading.Timer instead</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.Timers.ElapsedEventHandler</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Use System.Threading.TimerCallback(</td>
</tr>
<tr>
<td style="padding-left:2em">#ctor(System.Object,System.IntPtr)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Use System.Threading.TimerCallback(</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.Timers.Timer</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Use System.Threading.Timer</td>
</tr>
<tr>
<td style="padding-left:2em">#ctor(System.Double)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Use System.Threading.Timer</td>
</tr>
<tr>
<td style="padding-left:2em">add_Elapsed(System.Timers.ElapsedEventHandler)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Use System.Threading.Timer</td>
</tr>
<tr>
<td style="padding-left:2em">get_Enabled</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Use System.Threading.Timer</td>
</tr>
<tr>
<td style="padding-left:2em">set_AutoReset(System.Boolean)</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Use System.Threading.Timer</td>
</tr>
<tr>
<td style="padding-left:2em">Start</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Use System.Threading.Timer</td>
</tr>
<tr>
<td style="padding-left:2em">Stop</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>Use System.Threading.Timer</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>System.Type</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>.GetTypeInfo().Assembly</td>
</tr>
<tr>
<td style="padding-left:2em">get_Assembly</td>
<td class="IconErrorEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td>.GetTypeInfo().Assembly</td>
</tr>
<tr>
<td style="padding-left:2em">GetConstructor(System.Type[])</td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p>
<a href="#Portability Summary">Back to Summary</a>
</p>
</div>
</div>
</body>
</html> | kuhlenh/port-to-core | Reports/ne/networkingutilities.server.1.0.0.8/Roniz.WCF.P2P.Sync-NET40.html | HTML | mit | 48,479 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
20950,
3619,
1024,
5796,
2595,
14540,
1027,
1000,
24471,
2078,
1024,
8040,
28433,
2015,
1011,
7513,
1011,
4012,
1024,
1060,
14540,
2102,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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
/**
* Onxshop index / dispatcher
*
* An entry point for all actions except thumbnails and download handlers (share/*.php scripts),
* see htaccess for more details.
*
* Copyright (c) 2008-2012 Laposa Ltd (http://laposa.co.uk)
* Licensed under the New BSD License. See the file LICENSE.txt for details.
*/
/**
* Include global configuration
*/
require_once('../conf/global.php');
/**
* Set version
*/
define("ONXSHOP_VERSION", trim(file_get_contents(ONXSHOP_DIR . 'ONXSHOP_VERSION')));
/**
* Include bootstrap file
*/
require_once(ONXSHOP_DIR . 'bootstrap.php');
| 1nv4d3r5/onxshop | index.php | PHP | bsd-3-clause | 588 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
2006,
2595,
22231,
2361,
5950,
1013,
18365,
2121,
1008,
1008,
2019,
4443,
2391,
2005,
2035,
4506,
3272,
7639,
25464,
2015,
1998,
8816,
28213,
2015,
1006,
3745,
1013,
1008,
1012,
25718,
14546... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// yas_processing_cast_module.cpp
//
#include "yas_processing_cast_module.h"
using namespace yas;
using namespace yas::proc;
void yas::connect(proc::module_ptr const &module, proc::cast::input const &input, proc::channel_index_t const &ch_idx) {
module->connect_input(proc::to_connector_index(input), ch_idx);
}
void yas::connect(proc::module_ptr const &module, proc::cast::output const &output,
proc::channel_index_t const &ch_idx) {
module->connect_output(proc::to_connector_index(output), ch_idx);
}
std::string yas::to_string(proc::cast::input const &input) {
using namespace yas::proc::cast;
switch (input) {
case input::value:
return "value";
}
throw "input not found.";
}
std::string yas::to_string(proc::cast::output const &output) {
using namespace yas::proc::cast;
switch (output) {
case output::value:
return "value";
}
throw "output not found.";
}
std::ostream &operator<<(std::ostream &os, yas::proc::cast::input const &value) {
os << to_string(value);
return os;
}
std::ostream &operator<<(std::ostream &os, yas::proc::cast::output const &value) {
os << to_string(value);
return os;
}
| objective-audio/processing | processing/module/maker/yas_processing_cast_module.cpp | C++ | mit | 1,229 | [
30522,
1013,
1013,
1013,
1013,
8038,
2015,
1035,
6364,
1035,
3459,
1035,
11336,
1012,
18133,
2361,
1013,
1013,
1001,
2421,
1000,
8038,
2015,
1035,
6364,
1035,
3459,
1035,
11336,
1012,
1044,
1000,
2478,
3415,
15327,
8038,
2015,
1025,
2478,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from flask import Flask, request
import nltk
import json
from nltk_contrib import timex
import time
import sys
import getopt
USAGE = """
nltk-rest --port -p <port> -v units -u [--help -h]
Expose NLTK over REST as a server using Python Flask. Submit content to the
`/nltk` endpoint in the REST body request.
-h, --help Prints this message.
-p, --port Sets the port for the REST server, default is 8881.
-u, --units Enable parser to extract measurements from text
"""
Verbose = 0
Port = 8881 #default port
Units = 0
def echo2(*s): sys.stderr.write('server.py [NLTK]: ' + ' '.join(map(str, s)) + '\n')
app = Flask(__name__)
@app.route('/')
def status():
msg = '''
<html><head><title>NLTK REST Server</title></head><body><h3>NLTK REST server</h3>
<p>This app exposes the Python <a href="http://nltk.org/">Natural Language Toolkit (NLTK)</a>
as a REST server.</p>
<h2>Status: Running</h2>
<p>More apps from the <a href="//irds.usc.edu/">USC Information Retrieval & Data Science Group</a>.</p>
'''
return msg
@app.route('/nltk', methods=["PUT", "POST"])
def namedEntityRecognizer():
echo2("Performing NER on incoming stream")
content = request.stream.read()
if Verbose:
echo2("Incoming content is "+content)
start = time.time()
date_time = timex.tag(content)
tokenized = nltk.word_tokenize(content.decode("utf-8"))
tagged = nltk.pos_tag(tokenized)
namedEnt = nltk.ne_chunk(tagged, binary=True)
names = extract_entity_names(namedEnt, 'NE')
names.extend(date_time)
result = {"result" : "success", "names" : names}
if Units:
grammar = '''unit: {<CD><NNS>?<NN.*>?},
unit: {<CD><JJ>?<NN.*>}
'''
parser = nltk.RegexpParser(grammar)
units = extract_entity_names(parser.parse(tagged),'unit')
result['units'] = units
jsonDoc = json.dumps(result, sort_keys=True, indent=4, separators=(',', ': '))
end = time.time()
print "NER took "+str(end - start)+" seconds"
return jsonDoc
# Based on example from:
# https://gist.github.com/onyxfish/322906
def extract_entity_names(t, label):
entity_names = []
if hasattr(t, 'label') and t.label:
if t.label() == label:
entity_names.append(' '.join([child[0] for child in t]))
else:
for child in t:
entity_names.extend(extract_entity_names(child, label))
return entity_names
def main(argv=None):
"""Run NLTK REST server from command line according to USAGE."""
global Verbose
global Units
if argv is None:
argv = sys.argv
try:
opts, argv = getopt.getopt(argv[1:], 'hp:vu',
['help', 'port=', 'verbose', 'units'])
except getopt.GetoptError, (msg, bad_opt):
die("%s error: Bad option: %s, %s" % (argv[0], bad_opt, msg))
port = Port
for opt, val in opts:
if opt in ('-h', '--help'): echo2(USAGE); sys.exit()
elif opt in ('--port'): port = int(val)
elif opt in ('-v', '--verbose'): Verbose = 1
elif opt in ('-u', '--units'): Units = 1
else: die(USAGE)
app.run(debug=Verbose, port=port)
if __name__ == '__main__':
main(sys.argv)
| chrismattmann/NLTKRest | nltkrest/nltkrest/server.py | Python | apache-2.0 | 4,079 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1001,
17181,
1024,
21183,
2546,
1011,
1022,
1001,
1001,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1001,
12130,
6105,
10540,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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
/*
* $Id: SizeSelector.php 526 2009-08-11 12:11:17Z mrook $
*
* 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.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
/**
* Selector that filters files based on their size.
*
* @author Hans Lellelid <hans@xmpl.org> (Phing)
* @author Bruce Atherton <bruce@callenish.com> (Ant)
* @package phing.types.selectors
*/
class SizeSelector extends BaseExtendSelector {
private $size = -1;
private $multiplier = 1;
private $sizelimit = -1;
private $cmp = 2;
const SIZE_KEY = "value";
const UNITS_KEY = "units";
const WHEN_KEY = "when";
private static $sizeComparisons = array("less", "more", "equal");
private static $byteUnits = array("K", "k", "kilo", "KILO",
"Ki", "KI", "ki", "kibi", "KIBI",
"M", "m", "mega", "MEGA",
"Mi", "MI", "mi", "mebi", "MEBI",
"G", "g", "giga", "GIGA",
"Gi", "GI", "gi", "gibi", "GIBI",
"T", "t", "tera", "TERA",
/* You wish! */ "Ti", "TI", "ti", "tebi", "TEBI"
);
public function toString() {
$buf = "{sizeselector value: ";
$buf .= $this->sizelimit;
$buf .= "compare: ";
if ($this->cmp === 0) {
$buf .= "less";
} elseif ($this->cmp === 1) {
$buf .= "more";
} else {
$buf .= "equal";
}
$buf .= "}";
return $buf;
}
/**
* A size selector needs to know what size to base its selecting on.
* This will be further modified by the multiplier to get an
* actual size limit.
*
* @param size the size to select against expressed in units
*/
public function setValue($size) {
$this->size = $size;
if (($this->multiplier !== 0) && ($this->size > -1)) {
$this->sizelimit = $size * $this->multiplier;
}
}
/**
* Sets the units to use for the comparison. This is a little
* complicated because common usage has created standards that
* play havoc with capitalization rules. Thus, some people will
* use "K" for indicating 1000's, when the SI standard calls for
* "k". Others have tried to introduce "K" as a multiple of 1024,
* but that falls down when you reach "M", since "m" is already
* defined as 0.001.
* <p>
* To get around this complexity, a number of standards bodies
* have proposed the 2^10 standard, and at least one has adopted
* it. But we are still left with a populace that isn't clear on
* how capitalization should work.
* <p>
* We therefore ignore capitalization as much as possible.
* Completely mixed case is not possible, but all upper and lower
* forms are accepted for all long and short forms. Since we have
* no need to work with the 0.001 case, this practice works here.
* <p>
* This function translates all the long and short forms that a
* unit prefix can occur in and translates them into a single
* multiplier.
*
* @param $units The units to compare the size to.
* @return void
*/
public function setUnits($units) {
$i = array_search($units, self::$byteUnits, true);
if ($i === false) $i = -1; // make it java-like
$this->multiplier = 0;
if (($i > -1) && ($i < 4)) {
$this->multiplier = 1000;
} elseif (($i > 3) && ($i < 9)) {
$this->multiplier = 1024;
} elseif (($i > 8) && ($i < 13)) {
$this->multiplier = 1000000;
} elseif (($i > 12) && ($i < 18)) {
$this->multiplier = 1048576;
} elseif (($i > 17) && ($i < 22)) {
$this->multiplier = 1000000000;
} elseif (($i > 21) && ($i < 27)) {
$this->multiplier = 1073741824;
} elseif (($i > 26) && ($i < 31)) {
$this->multiplier = 1000000000000;
} elseif (($i > 30) && ($i < 36)) {
$this->multiplier = 1099511627776;
}
if (($this->multiplier > 0) && ($this->size > -1)) {
$this->sizelimit = $this->size * $this->multiplier;
}
}
/**
* This specifies when the file should be selected, whether it be
* when the file matches a particular size, when it is smaller,
* or whether it is larger.
*
* @param cmp The comparison to perform, an EnumeratedAttribute
*/
public function setWhen($cmp) {
$c = array_search($cmp, self::$sizeComparisons, true);
if ($c !== false) {
$this->cmp = $c;
}
}
/**
* When using this as a custom selector, this method will be called.
* It translates each parameter into the appropriate setXXX() call.
*
* @param parameters the complete set of parameters for this selector
*/
public function setParameters($parameters) {
parent::setParameters($parameters);
if ($parameters !== null) {
for ($i = 0, $size=count($parameters); $i < $size; $i++) {
$paramname = $parameters[$i]->getName();
switch(strtolower($paramname)) {
case self::SIZE_KEY:
try {
$this->setValue($parameters[$i]->getValue());
} catch (Exception $nfe) {
$this->setError("Invalid size setting "
. $parameters[$i]->getValue());
}
break;
case self::UNITS_KEY:
$this->setUnits($parameters[$i]->getValue());
break;
case self::WHEN_KEY:
$this->setWhen($parameters[$i]->getValue());
break;
default:
$this->setError("Invalid parameter " . $paramname);
}
}
}
}
/**
* <p>Checks to make sure all settings are kosher. In this case, it
* means that the size attribute has been set (to a positive value),
* that the multiplier has a valid setting, and that the size limit
* is valid. Since the latter is a calculated value, this can only
* fail due to a programming error.
* </p>
* <p>If a problem is detected, the setError() method is called.
* </p>
*/
public function verifySettings() {
if ($this->size < 0) {
$this->setError("The value attribute is required, and must be positive");
} elseif ($this->multiplier < 1) {
$this->setError("Invalid Units supplied, must be K,Ki,M,Mi,G,Gi,T,or Ti");
} elseif ($this->sizelimit < 0) {
$this->setError("Internal error: Code is not setting sizelimit correctly");
}
}
/**
* The heart of the matter. This is where the selector gets to decide
* on the inclusion of a file in a particular fileset.
*
* @param basedir A PhingFile object for the base directory
* @param filename The name of the file to check
* @param file A PhingFile object for this filename
* @return whether the file should be selected or not
*/
public function isSelected(PhingFile $basedir, $filename, PhingFile $file) {
$this->validate();
// Directory size never selected for
if ($file->isDirectory()) {
return true;
}
if ($this->cmp === 0) {
return ($file->length() < $this->sizelimit);
} elseif ($this->cmp === 1) {
return ($file->length() > $this->sizelimit);
} else {
return ($file->length() === $this->sizelimit);
}
}
}
| ArcherCraftStore/ArcherVMPeridot | php/pear/phing/types/selectors/SizeSelector.php | PHP | apache-2.0 | 8,816 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1002,
8909,
1024,
10826,
12260,
16761,
1012,
25718,
4720,
2575,
2268,
1011,
5511,
1011,
2340,
2260,
1024,
2340,
1024,
2459,
2480,
2720,
14659,
1002,
1008,
1008,
2023,
4007,
2003,
3024,
2011,
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... |
Bitrix 16.5 Business Demo = 1e67873c11e83e6bcc02d85d9da11bcc
| gohdan/DFC | known_files/hashes/bitrix/modules/mobileapp/templates_app/simple/menu.php | PHP | gpl-3.0 | 61 | [
30522,
2978,
17682,
2385,
1012,
1019,
2449,
9703,
1027,
1015,
2063,
2575,
2581,
2620,
2581,
2509,
2278,
14526,
2063,
2620,
2509,
2063,
2575,
9818,
2278,
2692,
2475,
2094,
27531,
2094,
2683,
2850,
14526,
9818,
2278,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_45) on Sun Oct 19 12:45:40 AST 2014 -->
<title>StringTable</title>
<meta name="date" content="2014-10-19">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="StringTable";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/StringTable.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../edu/icom4029/cool/core/IntTable.html" title="class in edu.icom4029.cool.core"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../edu/icom4029/cool/core/Utilities.html" title="class in edu.icom4029.cool.core"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?edu/icom4029/cool/core/StringTable.html" target="_top">Frames</a></li>
<li><a href="StringTable.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#fields_inherited_from_class_edu.icom4029.cool.core.AbstractTable">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">edu.icom4029.cool.core</div>
<h2 title="Class StringTable" class="title">Class StringTable</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../edu/icom4029/cool/core/AbstractTable.html" title="class in edu.icom4029.cool.core">edu.icom4029.cool.core.AbstractTable</a></li>
<li>
<ul class="inheritance">
<li>edu.icom4029.cool.core.StringTable</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">StringTable</span>
extends <a href="../../../../edu/icom4029/cool/core/AbstractTable.html" title="class in edu.icom4029.cool.core">AbstractTable</a></pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields_inherited_from_class_edu.icom4029.cool.core.AbstractTable">
<!-- -->
</a>
<h3>Fields inherited from class edu.icom4029.cool.core.<a href="../../../../edu/icom4029/cool/core/AbstractTable.html" title="class in edu.icom4029.cool.core">AbstractTable</a></h3>
<code><a href="../../../../edu/icom4029/cool/core/AbstractTable.html#idtable">idtable</a>, <a href="../../../../edu/icom4029/cool/core/AbstractTable.html#inttable">inttable</a>, <a href="../../../../edu/icom4029/cool/core/AbstractTable.html#stringtable">stringtable</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../edu/icom4029/cool/core/StringTable.html#StringTable()">StringTable</a></strong>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../edu/icom4029/cool/core/StringTable.html#codeStringTable(int, java.io.PrintStream)">codeStringTable</a></strong>(int stringclasstag,
java.io.PrintStream s)</code>
<div class="block">Generates code for all string constants in the string table.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_edu.icom4029.cool.core.AbstractTable">
<!-- -->
</a>
<h3>Methods inherited from class edu.icom4029.cool.core.<a href="../../../../edu/icom4029/cool/core/AbstractTable.html" title="class in edu.icom4029.cool.core">AbstractTable</a></h3>
<code><a href="../../../../edu/icom4029/cool/core/AbstractTable.html#addInt(int)">addInt</a>, <a href="../../../../edu/icom4029/cool/core/AbstractTable.html#addString(java.lang.String)">addString</a>, <a href="../../../../edu/icom4029/cool/core/AbstractTable.html#addString(java.lang.String, int)">addString</a>, <a href="../../../../edu/icom4029/cool/core/AbstractTable.html#getSymbols()">getSymbols</a>, <a href="../../../../edu/icom4029/cool/core/AbstractTable.html#lookup(int)">lookup</a>, <a href="../../../../edu/icom4029/cool/core/AbstractTable.html#lookup(java.lang.String)">lookup</a>, <a href="../../../../edu/icom4029/cool/core/AbstractTable.html#toString()">toString</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="StringTable()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>StringTable</h4>
<pre>public StringTable()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="codeStringTable(int, java.io.PrintStream)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>codeStringTable</h4>
<pre>public void codeStringTable(int stringclasstag,
java.io.PrintStream s)</pre>
<div class="block">Generates code for all string constants in the string table.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>stringclasstag</code> - the class tag for String</dd><dd><code>s</code> - the output stream</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/StringTable.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../edu/icom4029/cool/core/IntTable.html" title="class in edu.icom4029.cool.core"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../edu/icom4029/cool/core/Utilities.html" title="class in edu.icom4029.cool.core"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?edu/icom4029/cool/core/StringTable.html" target="_top">Frames</a></li>
<li><a href="StringTable.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#fields_inherited_from_class_edu.icom4029.cool.core.AbstractTable">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| currysensei/cool-compiler | doc/edu/icom4029/cool/core/StringTable.html | HTML | mit | 10,950 | [
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... |
import settings from './../settings'
import {findDistance, limitPositions, chooseOne, randomInt, getAvgPostion} from './general'
module.exports = {
applyLimbForces: (Eves) => {
for(var i = 0; i < Eves.length; i++) {
var eve = Eves[i];
for(var j = 0; j < eve.limbs.length; j++) {
var limb = eve.limbs[j];
var b0 = eve.bodyParts[limb.connections[0]];
var b1 = eve.bodyParts[limb.connections[1]];
var displacement, force;
limb.currentLength = findDistance(b0.pos, b1.pos)
if(limb.growing) {
displacement = limb.maxLength - limb.currentLength;
force = displacement * 0.1 - 1.5;
if(limb.currentLength >= limb.maxLength) {
limb.growing = false;
}
} else {
displacement = limb.initialLength - limb.currentLength;
force = displacement * 0.1 + 1.5;
if(limb.currentLength <= limb.initialLength) {
limb.growing = true;
}
}
var xPosDiff = b1.pos.x - b0.pos.x;
var yPosDiff = b1.pos.y - b0.pos.y;
if(xPosDiff === 0) {
var theta = Math.PI;
} else {
var theta = Math.atan(yPosDiff / xPosDiff);
}
if (xPosDiff >= 0) {
force *= -1;
}
var movementFactor = 1;
if(limb.growing) {
movementFactor = 0.5;
}
var dVx0 = force / b0.mass * Math.cos(theta);
var dVy0 = force / b0.mass * Math.sin(theta);
var dVx1 = -force / b1.mass * Math.cos(theta) * movementFactor;
var dVy1 = -force / b1.mass * Math.sin(theta) * movementFactor;
b0.vel.x = Math.min( 20, Math.max( b0.vel.x + dVx0, -20 ));
b0.vel.y = Math.min( 20, Math.max( b0.vel.y + dVy0, -20 ));
b1.vel.x = Math.min( 20, Math.max( b1.vel.x + dVx1, -20 ));
b1.vel.y = Math.min( 20, Math.max( b1.vel.y + dVy1, -20 ));
}
}
},
updateBodyPartPositions: (Eves) => {
for(var i = 0; i < Eves.length; i++) {
var eve = Eves[i];
for(var j = 0; j < eve.bodyParts.length; j++) {
var bodyPart = eve.bodyParts[j];
bodyPart.pos.x += bodyPart.vel.x;
//check if offscreen
if(bodyPart.pos.x <= bodyPart.mass || bodyPart.pos.x >= settings.width - bodyPart.mass) {
bodyPart.pos.x = limitPositions(bodyPart.pos.x, 1, bodyPart.mass)[0];
bodyPart.vel.x = -1 * bodyPart.vel.x;
}
bodyPart.pos.y += bodyPart.vel.y;
if(bodyPart.pos.y <= bodyPart.mass || bodyPart.pos.y >= settings.height - bodyPart.mass) {
bodyPart.pos.y = limitPositions(1, bodyPart.pos.y, bodyPart.mass)[1];
bodyPart.vel.y = -1 * bodyPart.vel.y;
}
//check if offscreen
//NEEEDS TO GO ON CLIENT ONLY??
// d3.select('#' + eve.id + 'b' + j)
// .attr('cx', bodyPart.pos.x).attr('cy', bodyPart.pos.y);
//
}
for(var k = 0; k < eve.limbs.length; k++) {
var b0 = eve.bodyParts[eve.limbs[k].connections[0]];
var b1 = eve.bodyParts[eve.limbs[k].connections[1]];
//NEEDS TO GO ON CLIENT ONLY??
// d3.select('#' + eve.id + 'l' + k)
// .attr('x1', b0.pos.x).attr('y1', b0.pos.y)
// .attr('x2', b1.pos.x).attr('y2', b1.pos.y);
//
}
}
}
} | iandeboisblanc/evolution | server/helpers/movement.js | JavaScript | cc0-1.0 | 3,327 | [
30522,
12324,
10906,
2013,
1005,
1012,
1013,
1012,
1012,
1013,
10906,
1005,
12324,
1063,
2424,
10521,
26897,
1010,
5787,
26994,
2015,
1010,
5454,
5643,
1010,
6721,
18447,
1010,
2131,
11431,
21600,
14122,
3258,
1065,
2013,
1005,
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... |
//#############################################################################
//# #
//# Copyright (C) <2015> <IMS MAXIMS> #
//# #
//# This program is free software: you can redistribute it and/or modify #
//# it under the terms of the GNU Affero General Public License as #
//# published by the Free Software Foundation, either version 3 of the #
//# License, 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 Affero General Public License for more details. #
//# #
//# You should have received a copy of the GNU Affero General Public License #
//# along with this program. If not, see <http://www.gnu.org/licenses/>. #
//# #
//# IMS MAXIMS provides absolutely NO GUARANTEE OF THE CLINICAL SAFTEY of #
//# this program. Users of this software do so entirely at their own risk. #
//# IMS MAXIMS only ensures the Clinical Safety of unaltered run-time #
//# software that it builds, deploys and maintains. #
//# #
//#############################################################################
//#EOH
// This code was generated by Barbara Worwood using IMS Development Environment (version 1.80 build 5589.25814)
// Copyright (C) 1995-2015 IMS MAXIMS. All rights reserved.
// WARNING: DO NOT MODIFY the content of this file
package ims.naes.forms.actiondialog;
public abstract class BaseLogic extends Handlers
{
public final Class getDomainInterface() throws ClassNotFoundException
{
return ims.naes.domain.ActionDialog.class;
}
public final void setContext(ims.framework.UIEngine engine, GenForm form, ims.naes.domain.ActionDialog domain)
{
setContext(engine, form);
this.domain = domain;
}
protected final void oncmbStatusValueSet(Object value)
{
java.util.ArrayList listOfValues = this.form.cmbStatus().getValues();
if(value == null)
{
if(listOfValues != null && listOfValues.size() > 0)
{
for(int x = 0; x < listOfValues.size(); x++)
{
ims.naes.vo.lookups.NaesActionStatus existingInstance = (ims.naes.vo.lookups.NaesActionStatus)listOfValues.get(x);
if(!existingInstance.isActive())
{
bindcmbStatusLookup();
return;
}
}
}
}
else if(value instanceof ims.naes.vo.lookups.NaesActionStatus)
{
ims.naes.vo.lookups.NaesActionStatus instance = (ims.naes.vo.lookups.NaesActionStatus)value;
if(listOfValues != null)
{
if(listOfValues.size() == 0)
bindcmbStatusLookup();
for(int x = 0; x < listOfValues.size(); x++)
{
ims.naes.vo.lookups.NaesActionStatus existingInstance = (ims.naes.vo.lookups.NaesActionStatus)listOfValues.get(x);
if(existingInstance.equals(instance))
return;
}
}
this.form.cmbStatus().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
}
}
protected final void bindcmbStatusLookup()
{
this.form.cmbStatus().clear();
ims.naes.vo.lookups.NaesActionStatusCollection lookupCollection = ims.naes.vo.lookups.LookupHelper.getNaesActionStatus(this.domain.getLookupService());
for(int x = 0; x < lookupCollection.size(); x++)
{
this.form.cmbStatus().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
}
}
protected final void setcmbStatusLookupValue(int id)
{
ims.naes.vo.lookups.NaesActionStatus instance = ims.naes.vo.lookups.LookupHelper.getNaesActionStatusInstance(this.domain.getLookupService(), id);
if(instance != null)
this.form.cmbStatus().setValue(instance);
}
protected final void defaultcmbStatusLookupValue()
{
this.form.cmbStatus().setValue((ims.naes.vo.lookups.NaesActionStatus)domain.getLookupService().getDefaultInstance(ims.naes.vo.lookups.NaesActionStatus.class, engine.getFormName().getID(), ims.naes.vo.lookups.NaesActionStatus.TYPE_ID));
}
protected final void oncmbActionValueSet(Object value)
{
java.util.ArrayList listOfValues = this.form.cmbAction().getValues();
if(value == null)
{
if(listOfValues != null && listOfValues.size() > 0)
{
for(int x = 0; x < listOfValues.size(); x++)
{
ims.naes.vo.lookups.Action existingInstance = (ims.naes.vo.lookups.Action)listOfValues.get(x);
if(!existingInstance.isActive())
{
bindcmbActionLookup();
return;
}
}
}
}
else if(value instanceof ims.naes.vo.lookups.Action)
{
ims.naes.vo.lookups.Action instance = (ims.naes.vo.lookups.Action)value;
if(listOfValues != null)
{
if(listOfValues.size() == 0)
bindcmbActionLookup();
for(int x = 0; x < listOfValues.size(); x++)
{
ims.naes.vo.lookups.Action existingInstance = (ims.naes.vo.lookups.Action)listOfValues.get(x);
if(existingInstance.equals(instance))
return;
}
}
this.form.cmbAction().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
}
}
protected final void bindcmbActionLookup()
{
this.form.cmbAction().clear();
ims.naes.vo.lookups.ActionCollection lookupCollection = ims.naes.vo.lookups.LookupHelper.getAction(this.domain.getLookupService());
for(int x = 0; x < lookupCollection.size(); x++)
{
this.form.cmbAction().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
}
}
protected final void setcmbActionLookupValue(int id)
{
ims.naes.vo.lookups.Action instance = ims.naes.vo.lookups.LookupHelper.getActionInstance(this.domain.getLookupService(), id);
if(instance != null)
this.form.cmbAction().setValue(instance);
}
protected final void defaultcmbActionLookupValue()
{
this.form.cmbAction().setValue((ims.naes.vo.lookups.Action)domain.getLookupService().getDefaultInstance(ims.naes.vo.lookups.Action.class, engine.getFormName().getID(), ims.naes.vo.lookups.Action.TYPE_ID));
}
public final void free()
{
super.free();
domain = null;
}
protected ims.naes.domain.ActionDialog domain;
}
| FreudianNM/openMAXIMS | Source Library/openmaxims_workspace/NAES/src/ims/naes/forms/actiondialog/BaseLogic.java | Java | agpl-3.0 | 6,913 | [
30522,
1013,
1013,
1001,
1001,
1001,
1001,
30524,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
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... |
# file-renamer
a simple file renaming application that can be either used to quickly rename many files to the have the same filename (plus a running number) or use regular expressions to find and replace parts of the filenames. It should be straightforward enough to use, but here are quick instruction.
1. open up the application
2. click on "Select files"
3. select all the files you wish to rename
either choose to rename every file the same filename plus a running number (for example "cat_1.jpg,cat_2.jpg,cat_3.jpg and so on) or to find and replace words or characters in the filenames using regular expressions
4. click on "start"
5. wait for your files to be renamed
Be sure to let me know of any issues you might have with the application.
| Paattis/file-renamer | README.md | Markdown | mit | 750 | [
30522,
1001,
5371,
1011,
14916,
14074,
2099,
1037,
3722,
5371,
24944,
4646,
2008,
2064,
2022,
2593,
2109,
2000,
2855,
14916,
14074,
2116,
6764,
2000,
1996,
2031,
1996,
2168,
5371,
18442,
1006,
4606,
1037,
2770,
2193,
1007,
2030,
2224,
3180,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @author 54chen(陈臻) [chenzhen@xiaomi.com czhttp@gmail.com]
* @since 2012-5-19 下午02:27:24
*/
package com.chen.controllers;
import com.chen.model.Chen;
import net.paoding.rose.web.Invocation;
import net.paoding.rose.web.paramresolver.ParamMetaData;
import net.paoding.rose.web.paramresolver.ParamResolver;
public class ChenBeanResolver implements ParamResolver {
@Override
public Object resolve(Invocation inv, ParamMetaData metaData) throws Exception {
for (String paramName : metaData.getParamNames()) {
if (paramName != null) {
Chen chen = new Chen();
String value1 = inv.getParameter("chen1");
String value2 = inv.getParameter("chen2");
chen.setChen1(value1);
chen.setChen2(value2);
return chen;
}
}
return null;
}
@Override
public boolean supports(ParamMetaData metaData) {
return Chen.class == metaData.getParamType();
}
}
| xiaowen118/test | src/main/java/com/chen/controllers/ChenBeanResolver.java | Java | apache-2.0 | 1,026 | [
30522,
1013,
1008,
1008,
1008,
1030,
3166,
5139,
8661,
1006,
100,
100,
1007,
1031,
8802,
27922,
2368,
1030,
19523,
4328,
1012,
4012,
1039,
27922,
4779,
2361,
1030,
20917,
4014,
1012,
4012,
1033,
1008,
1030,
2144,
2262,
1011,
1019,
1011,
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... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>gaia: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.5.0~camlp4 / gaia - 1.11</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
gaia
<small>
1.11
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-03-05 14:29:34 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-05 14:29:34 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp4 4.02+7 Camlp4 is a system for writing extensible parsers for programming languages
conf-findutils 1 Virtual package relying on findutils
conf-which 1 Virtual package relying on which
coq 8.5.0~camlp4 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlbuild 0 Build system distributed with the OCaml compiler since OCaml 3.10.0
# opam file:
opam-version: "2.0"
maintainer: "palmskog@gmail.com"
homepage: "https://github.com/coq-community/gaia"
dev-repo: "git+https://github.com/coq-community/gaia.git"
bug-reports: "https://github.com/coq-community/gaia/issues"
license: "MIT"
synopsis: "Implementation of books from Bourbaki's Elements of Mathematics in Coq"
description: """
Implementation of books from N. Bourbaki's Elements of Mathematics
in Coq using the Mathematical Components library, including set theory
and number theory."""
build: [make "-j%{jobs}%"]
install: [make "install"]
depends: [
"coq" {>= "8.10" & < "8.13~"}
"coq-mathcomp-ssreflect" {>= "1.11.0" & < "1.12~"}
"coq-mathcomp-algebra"
]
tags: [
"category:Mathematics/Logic/Set theory"
"keyword:Bourbaki"
"keyword:set theory"
"date:2020-09-09"
"logpath:gaia"
]
authors: [
"José Grimm"
"Alban Quadrat"
"Carlos Simpson"
]
url {
src: "https://github.com/coq-community/gaia/archive/v1.11.tar.gz"
checksum: "sha512=b7458fdfcddab546c75a66a741896f0e9bf45b8e79b98b9072a07427a8cbe025eca928d2a7f2bffe3c274feb88dda833a32ea311a762ba1d6ea8ed1120a7664f"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-gaia.1.11 coq.8.5.0~camlp4</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.0~camlp4).
The following dependencies couldn't be met:
- coq-gaia -> coq >= 8.10 -> ocaml >= 4.05.0
base of this switch (use `--unlock-base' to force)
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-gaia.1.11</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.02.3-2.0.6/released/8.5.0~camlp4/gaia/1.11.html | HTML | mit | 7,362 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# Author:: Dan Crosta (<dcrosta@late.am>)
# Copyright:: Copyright (c) 2012 OpsCode, Inc.
# License:: Apache License, Version 2.0
#
# 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.
#
require 'spec_helper'
describe Chef::Provider::Group::Groupmod do
before do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@new_resource = Chef::Resource::Group.new("wheel")
@new_resource.gid 123
@new_resource.members %w{lobster rage fist}
@new_resource.append false
@provider = Chef::Provider::Group::Groupmod.new(@new_resource, @run_context)
end
describe "manage_group" do
describe "when determining the current group state" do
it "should raise an error if the required binary /usr/sbin/group doesn't exist" do
File.should_receive(:exists?).with("/usr/sbin/group").and_return(false)
lambda { @provider.load_current_resource }.should raise_error(Chef::Exceptions::Group)
end
it "should raise an error if the required binary /usr/sbin/user doesn't exist" do
File.should_receive(:exists?).with("/usr/sbin/group").and_return(true)
File.should_receive(:exists?).with("/usr/sbin/user").and_return(false)
lambda { @provider.load_current_resource }.should raise_error(Chef::Exceptions::Group)
end
it "shouldn't raise an error if the required binaries exist" do
File.stub(:exists?).and_return(true)
lambda { @provider.load_current_resource }.should_not raise_error
end
end
describe "after the group's current state is known" do
before do
@current_resource = @new_resource.dup
@provider.current_resource = @current_resource
end
describe "when no group members are specified and append is not set" do
before do
@new_resource.append(false)
@new_resource.members([])
end
it "logs a message and sets group's members to 'none', then removes existing group members" do
Chef::Log.should_receive(:debug).with("group[wheel] setting group members to: none")
@provider.should_receive(:shell_out!).with("group mod -n wheel_bak wheel")
@provider.should_receive(:shell_out!).with("group add -g '123' -o wheel")
@provider.should_receive(:shell_out!).with("group del wheel_bak")
@provider.manage_group
end
end
describe "when no group members are specified and append is set" do
before do
@new_resource.append(true)
@new_resource.members([])
end
it "logs a message and does not modify group membership" do
Chef::Log.should_receive(:debug).with("group[wheel] not changing group members, the group has no members to add")
@provider.should_not_receive(:shell_out!)
@provider.manage_group
end
end
describe "when removing some group members" do
before do
@new_resource.append(false)
@new_resource.members(%w{ lobster })
end
it "updates group membership correctly" do
Chef::Log.stub(:debug)
@provider.should_receive(:shell_out!).with("group mod -n wheel_bak wheel")
@provider.should_receive(:shell_out!).with("user mod -G wheel lobster")
@provider.should_receive(:shell_out!).with("group add -g '123' -o wheel")
@provider.should_receive(:shell_out!).with("group del wheel_bak")
@provider.manage_group
end
end
end
end
describe "create_group" do
describe "when creating a new group" do
before do
@current_resource = Chef::Resource::Group.new("wheel")
@provider.current_resource = @current_resource
end
it "should run a group add command and some user mod commands" do
@provider.should_receive(:shell_out!).with("group add -g '123' wheel")
@provider.should_receive(:shell_out!).with("user mod -G wheel lobster")
@provider.should_receive(:shell_out!).with("user mod -G wheel rage")
@provider.should_receive(:shell_out!).with("user mod -G wheel fist")
@provider.create_group
end
end
end
describe "remove_group" do
describe "when removing an existing group" do
before do
@current_resource = @new_resource.dup
@provider.current_resource = @current_resource
end
it "should run a group del command" do
@provider.should_receive(:shell_out!).with("group del wheel")
@provider.remove_group
end
end
end
end
| sysbot/chef | spec/unit/provider/group/groupmod_spec.rb | Ruby | apache-2.0 | 5,123 | [
30522,
1001,
1001,
3166,
1024,
1024,
4907,
13675,
28696,
1006,
1026,
5887,
7352,
2696,
1030,
2397,
1012,
2572,
1028,
1007,
1001,
9385,
1024,
1024,
9385,
1006,
1039,
1007,
2262,
23092,
16044,
1010,
4297,
1012,
1001,
6105,
1024,
1024,
15895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 example;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.junit.Test;
import com.piedra.excel.annotation.ExcelExport;
import com.piedra.excel.util.ExcelExportor;
/**
* @Description: Excel导出工具 例子程序
* @Creator:linwb 2014-12-19
*/
public class ExcelExportorExample {
public static void main(String[] args) {
new ExcelExportorExample().testSingleHeader();
new ExcelExportorExample().testMulHeaders();
}
/**
* @Description: 测试单表头
* @History
* 1. 2014-12-19 linwb 创建方法
*/
@Test
public void testSingleHeader(){
OutputStream out = null;
try {
out = new FileOutputStream(new File("C://EXCEL-EXPORT-TEST.xls"));
List<ExcelRow> stus = new ArrayList<ExcelRow>();
for(int i=0; i<11120; i++){
stus.add(new ExcelRow());
}
new ExcelExportor<ExcelRow>().exportExcel("测试单表头", stus, out);
System.out.println("excel导出成功!");
} catch (Exception e) {
e.printStackTrace();
} finally {
if(out!=null){
try {
out.close();
} catch (IOException e) {
//Ignore..
} finally{
out = null;
}
}
}
}
/**
* @Description: 测试多表头
* @History
* 1. 2014-12-19 linwb 创建方法
*/
@Test
public void testMulHeaders(){
OutputStream out = null;
try {
out = new FileOutputStream(new File("C://EXCEL-EXPORT-TEST-MULTIHEADER.xls"));
List<ExcelRowForMultiHeaders> stus = new ArrayList<ExcelRowForMultiHeaders>();
for(int i=0; i<1120; i++){
stus.add(new ExcelRowForMultiHeaders());
}
new ExcelExportor<ExcelRowForMultiHeaders>().exportExcel("测试多表头", stus, out);
System.out.println("excel导出成功!");
} catch (Exception e) {
e.printStackTrace();
} finally {
if(out!=null){
try {
out.close();
} catch (IOException e) {
//Ignore..
} finally{
out = null;
}
}
}
}
}
/**
* @Description: Excel的一行对应的JavaBean类
* @Creator:linwb 2014-12-19
*/
class ExcelRow {
@ExcelExport(header="姓名",colWidth=50)
private String name="AAAAAAAAAAASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS";
@ExcelExport(header="年龄")
private int age=80;
/** 这个属性没别注解,那么将不会出现在导出的excel文件中*/
private String clazz="SSSSSSSSS";
@ExcelExport(header="国家")
private String country="RRRRRRR";
@ExcelExport(header="城市")
private String city="EEEEEEEEE";
@ExcelExport(header="城镇")
private String town="WWWWWWW";
/** 这个属性没别注解,那么将不会出现在导出的excel文件中*/
private String common="DDDDDDDD";
/** 如果colWidth <= 0 那么取默认的 15 */
@ExcelExport(header="出生日期",colWidth=-1)
private Date birth = new Date();
public ExcelRow(){
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getClazz() {
return clazz;
}
public void setClazz(String clazz) {
this.clazz = clazz;
}
public String getCommon() {
return common;
}
public void setCommon(String common) {
this.common = common;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getTown() {
return town;
}
public void setTown(String town) {
this.town = town;
}
}
/**
* @Description: Excel的一行对应的JavaBean类
* @Creator:linwb 2014-12-19
*/
class ExcelRowForMultiHeaders {
@ExcelExport(header="姓名",colspan="1",rowspan="3")
private String name="无名氏";
@ExcelExport(header="省份,国家",colspan="1,5",rowspan="1,2")
private String province="福建省";
@ExcelExport(header="城市",colspan="1",rowspan="1")
private String city="福建省";
@ExcelExport(header="城镇",colspan="1",rowspan="1")
private String town="不知何处";
@ExcelExport(header="年龄,年龄和备注",colspan="1,2",rowspan="1,1")
private int age=80;
@ExcelExport(header="备注?",colspan="1",rowspan="1")
private String common="我是备注,我是备注";
@ExcelExport(header="我的生日",colspan="1",rowspan="3",datePattern="yyyy-MM-dd HH:mm:ss")
private Date birth = new Date();
/** 这个属性没别注解,那么将不会出现在导出的excel文件中*/
private String clazz="我不会出现的,除非你给我 @ExcelExport 注解标记";
public ExcelRowForMultiHeaders(){
}
public String getClazz() {
return clazz;
}
public void setClazz(String clazz) {
this.clazz = clazz;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getCommon() {
return common;
}
public void setCommon(String common) {
this.common = common;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
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 getTown() {
return town;
}
public void setTown(String town) {
this.town = town;
}
}
| webinglin/excelExportor | src/test/java/example/ExcelExportorExample.java | Java | gpl-3.0 | 6,820 | [
30522,
7427,
2742,
1025,
12324,
9262,
1012,
22834,
1012,
5371,
1025,
12324,
9262,
1012,
22834,
1012,
5371,
5833,
18780,
21422,
1025,
12324,
9262,
1012,
22834,
1012,
22834,
10288,
24422,
1025,
12324,
9262,
1012,
22834,
1012,
27852,
25379,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* FameCMS
*
* Codeigniter CMS + Angular
*
* @package FameCMS (Mini-Developer version)
* @author Faizal Amry (Famry)
* @copyright 2015 Faizal Amry
* @link http:/famecms.com
* @license MIT
* @version 1.0
==============================================================
* CI Smarty
*
* Smarty templating for Codeigniter
*
* @package CI Smarty
* @author Dwayne Charrington
* @copyright 2015 Dwayne Charrington and Github contributors
* @link http://ilikekillnerds.com
* @license MIT
* @version 3.0
*/
class Setting_model extends CI_Model {
public function __construct()
{
parent::__construct();
$this->load->helper('phpass');
}
public function getDataSetting($table_name) {
$this->db->select('A.id_site AS id_site,A.site_title AS site_title,A.site_tagline AS site_tagline,A.site_email AS site_email,
A.site_phone AS site_phone,A.site_address AS site_address,
B.limit_registration AS limit_registration,B.limit_by AS limit_by,B.limit_number AS limit_number,
C.custom_logo AS custom_logo,C.custom_logo_url AS custom_logo_url,C.custom_favicon AS custom_favicon,
C.custom_favicon_url AS custom_favicon_url,C.register_admin AS register_admin,C.forget_password AS forget_password,
C.maintenance_mode AS maintenance_mode');
$this->db->from('fame_setting_general AS A');
$this->db->where('A.id_site','1');
$this->db->join('fame_setting_socnet AS B', 'B.id_site = A.id_site');
$this->db->join('fame_setting_custom AS C', 'C.id_site = A.id_site');
$query=$this->db->get();
foreach ($query->result() as $row)
{
return $row->$table_name;
}
}
public function getGeneralSetting()
{
$this->db->select('id_site AS id_site,site_title AS sitename,site_tagline AS tagline,site_email AS email,
site_phone AS phone,site_address AS address');
$this->db->from('fame_setting_general');
$this->db->where('id_site','1');
$query=$this->db->get();
$result = $query->result();
return $result;
}
public function getCustomSetting()
{
$this->db->select('id_option,id_site,
custom_logo,custom_logo_url,custom_favicon,custom_favicon_url,
register_admin,forget_password,maintenance_mode');
$this->db->from('fame_setting_custom');
$this->db->where('id_site','1');
$query=$this->db->get();
$result = $query->result();
return $result;
}
public function update_profile($f_name,$l_name,$username,$picture)
{
if($picture){
define('UPLOAD_DIR', 'public/img/thumb/');
$img = str_replace('data:image/png;base64,', '', $picture);
$img = str_replace(' ', '+', $img);
$dataimg = base64_decode($img);
$fileimg = UPLOAD_DIR . uniqid() . '.jpg';
$success = file_put_contents($fileimg, $dataimg);
//print $success ? $file : 'Unable to save the file.';
if ($success){
$data=array(
'first_name'=>$f_name,
'last_name'=>$l_name,
'profil_pic_url'=>$fileimg
);
} else {
return false;
}
} else {
$data=array(
'first_name'=>$f_name,
'last_name'=>$l_name
);
}
$this->db->where('user_name',$username);
$updateData = $this->db->update('fame_user',$data);
if ($updateData){
return true;
} else {
return false;
}
}
public function update_general_setting($sitename,$tagline,$email,$phone,$address){
$data=array(
'site_title'=>$sitename,
'site_tagline'=>$tagline,
'site_email'=>$email,
'site_phone'=>$phone,
'site_address'=>$address,
);
$this->db->where('id_site','1');
$update = $this->db->update('fame_setting_general',$data);
if ($update){
return true;
} else {
return false;
}
}
public function update_socnet_setting($register_limit,$limit_by,$limit_num){
$data=array(
'limit_registration'=>$register_limit,
'limit_by'=>$limit_by,
'limit_number'=>$limit_num,
);
$this->db->where('id_site','1');
$update = $this->db->update('fame_setting_socnet',$data);
if ($update){
return true;
} else {
return false;
}
}
public function update_custom_setting($custom_logo,$custom_logo_url,$custom_favicon,$custom_favicon_url,$register_admin,$forget_password,$maintenance_mode){
$data=array(
'custom_logo'=>$custom_logo,
'custom_logo_url'=>$custom_logo_url,
'custom_favicon'=>$custom_favicon,
'custom_favicon_url'=>$custom_favicon_url,
'register_admin'=>$register_admin,
'forget_password'=>$forget_password,
'maintenance_mode'=>$maintenance_mode
);
$this->db->where('id_site','1');
$update = $this->db->update('fame_setting_custom',$data);
if ($update){
return true;
} else {
return false;
}
}
} | famry/fameCMSv2 | famecms/modules/administrator_2/models/setting/Setting_model.php | PHP | mit | 4,749 | [
30522,
1026,
1029,
25718,
2065,
1006,
999,
4225,
1006,
1005,
2918,
15069,
1005,
1007,
1007,
6164,
1006,
1005,
2053,
3622,
5896,
3229,
3039,
1005,
1007,
1025,
1013,
1008,
1008,
1008,
4476,
27487,
2015,
1008,
1008,
3642,
23773,
21646,
4642,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 2021 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. -->
<style include="md-select cr-input-style">
.entry-view {
margin-inline-start: 40px;
}
h2 {
color: var(--cr-text-color-primary);
font-size: 20px;
font-weight: normal;
margin-bottom: 18px;
margin-top: 72px;
}
.support-tool-title {
color: var(--cr-title-text-color);
font-size: 14px;
margin-bottom: 10px;
margin-top: 10px;
}
#support-case-id {
height: 32px;
width: 248px;
}
.md-select {
height: 32px;
margin-bottom: 30px;
width: 248px;
}
#description {
/*TODO(b/222669536): Style the description better when UX reviewer of mocks
gives their input.*/
background-color: var(--cr-input-background-color);
border: none;
border-radius: var(--cr-input-border-radius, 4px);
caret-color: var(--cr-input-focus-color);
color: var(--cr-input-color);
display: block;
font-family: inherit;
height: 120px;
margin-top: 8px;
outline: none;
padding-bottom: 8px;
padding-inline-start: 10px;
padding-top: 8px;
resize: none;
width: 520px;
}
</style>
<div class="entry-view">
<h2>Collect diagnostics data for support</h2>
<div class="support-tool-title">Support Case ID</div>
<cr-input id="support-case-id" value="{{caseId_}}"
spellcheck="false" maxlength="20">
</cr-input>
<div class="support-tool-title">Email</div>
<select class="md-select" value="{{selectedEmail_::change}}">
<option value=""></option>
<template is="dom-repeat" items="[[emails_]]">
<option value="[[item]]">[[item]]</option>
</template>
</select>
<div class="support-tool-title">Describe the issue</div>
<textarea id="description" value="{{issueDescription_::input}}"
spellcheck="true"
placeholder="Provide a clear desciption of the issue and steps to reproduce the issue (if possible)">
</textarea>
</div> | chromium/chromium | chrome/browser/resources/support_tool/support_tool.html | HTML | bsd-3-clause | 2,042 | [
30522,
1026,
999,
1011,
1011,
9385,
25682,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
2179,
1999,
1996,
6105,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* IzPack - Copyright 2001-2010 Julien Ponge, All Rights Reserved.
*
* http://izpack.org/
* http://izpack.codehaus.org/
*
* Copyright 2005,2009 Ivan SZKIBA
* Copyright 2010,2011 Rene Krell
*
* 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.izforge.izpack.util.config;
import java.io.File;
import java.util.List;
public abstract class ConfigFileTask extends SingleConfigurableTask
{
protected File oldFile;
protected File newFile;
protected File toFile;
protected boolean cleanup;
/**
* Use this to prepend a comment to the configuration file's header
*/
private List<String> comment;
/**
* Location of the configuration file to be patched to; optional. If not set, any empty
* reference file is assumed, instead.
*/
public void setNewFile(File file)
{
this.newFile = file;
}
/**
* Location of the configuration file to be patched from; optional. If not set, attributes
* defining preservations of entries and values are ignored.
*/
public void setOldFile(File file)
{
this.oldFile = file;
}
/**
* Location of the resulting output file; required.
*/
public void setToFile(File file)
{
this.toFile = file;
}
/**
* Whether to delete the patchfile after the operation
* @param cleanup True, if the patchfile should be deleted after the operation
*/
public void setCleanup(boolean cleanup)
{
this.cleanup = cleanup;
}
/**
* optional header comment for the file
*/
public void setComment(List<String> hdr)
{
comment = hdr;
}
protected List<String> getComment()
{
return this.comment;
}
@Override
protected void checkAttributes() throws Exception
{
if (this.toFile == null) { throw new Exception("The \"file\" attribute must be set"); }
}
}
| rsharipov/izpack | izpack-util/src/main/java/com/izforge/izpack/util/config/ConfigFileTask.java | Java | apache-2.0 | 2,446 | [
30522,
1013,
1008,
1008,
1045,
2480,
23947,
1011,
9385,
2541,
1011,
2230,
19290,
13433,
15465,
1010,
2035,
2916,
9235,
1012,
1008,
1008,
8299,
1024,
1013,
1013,
1045,
2480,
23947,
1012,
8917,
1013,
1008,
8299,
1024,
1013,
1013,
1045,
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... |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package modules;
import java.io.BufferedReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import java.util.Properties;
import util.PropUtil;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.util.Enumeration;
/**
*
* @author cristi
*/
public class MeterKamstrup extends Module {
@Override
public void Initialize() {
pDataSet = mmManager.getSharedData(PropUtil.GetString(pAttributes, "pDataSet", sName));
// PropUtil.LoadFromFile(pAssociation, PropUtil.GetString(pAttributes, "pAssociation", ""));
sPrefix = PropUtil.GetString(pAttributes, "sPrefix", "");
// lPeriod = PropUtil.GetInt(pAttributes, "lPeriod", 1000);
sCmdLine = PropUtil.GetString(pAttributes, "sCmdLine", "");
sStartPath = PropUtil.GetString(pAttributes, "sStartPath", "");
iTimeOut = PropUtil.GetInt(pAttributes, "iTimeOut", 30000);
iPause = PropUtil.GetInt(pAttributes, "iPause", 30000);
iDebug = PropUtil.GetInt(pAttributes, "iDebug", 0);
lPeriod = PropUtil.GetLong(pAttributes, "lPeriod", 5000);
}
// Properties pAssociation = new Properties();
//
Properties pDataSet = null;
String sPrefix = "";
Thread tLoop = null;
Thread tWachDog = null;
int iTimeOut = 30000;
int iPause = 30000;
long lLastRead = 0;
int iDebug = 0;
long lPeriod = 0;
@Override
public void Start() {
try {
sdfDate.setTimeZone(TimeZone.getDefault());
tLoop = new Thread(new Runnable() {
@Override
public void run() {
Loop();
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
tLoop.start();
if (tWachDog == null) {
tWachDog = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
Thread.sleep(1000);
if (System.currentTimeMillis() - lLastRead > iTimeOut) {
ReStartProc();
}
} catch (Exception e) {
}
}
}
});
tWachDog.start();
}
} catch (Exception e) {
// Log(Name + "-Open-" + e.getMessage() + "-" + e.getCause());
}
}
BufferedReader br = null;
String sLine = "";
String[] ssLineVars = null;
String sDate = "";
String sTime = "";
private final SimpleDateFormat sdfDate = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
public void Loop() {
while (bStop == 0) {
try {
Thread.sleep(10);
try {
sLine = br.readLine();
} catch (Exception ex) {
ReStartProc();
continue;
}
if ((iDebug == 1) && (sLine!=null)) {
System.out.println(sLine);
}
lLastRead = System.currentTimeMillis();
if ((sLine == null) || (sLine.length() < 1)) {
ReStartProc();
continue;
}
while (sLine.contains(" ")) {
sLine = sLine.replaceAll(" ", " ");
}
sLine = sLine.replaceAll(" ", "\t");
ssLineVars = sLine.split("\t");
if (ssLineVars.length < 2) {
continue;
}
if ((ssLineVars[0].length() < 1) || (ssLineVars[1].length() < 1) || ("None".equals(ssLineVars[1]))) {
continue;
}
if ("Date".equals(ssLineVars[0])) {
sDate = ssLineVars[1];
if (sTime.length() > 0) {
pDataSet.put(sPrefix + "Date", sDate + " " + sTime);
pDataSet.put(sPrefix + "Date" + "-ts", sdfDate.format(new Date()));
}
} else if ("Time".equals(ssLineVars[0])) {
sTime = ssLineVars[1];
} else {
pDataSet.put(sPrefix + ssLineVars[0], ssLineVars[1]);
pDataSet.put(sPrefix + ssLineVars[0] + "-ts",
sdfDate.format(new Date()));
}
} catch (Exception e) {
if (iDebug == 1) {
System.out.println(e.getMessage());
}
}
}
}
public int Pause = 0;
public int memPause = 0;
public int bStop = 0;
public int Debug = 0;
public long lIniSysTimeMs = 0;
public long lMemSysTimeMs = 0;
public long ldt = 0;
public double ddt = 0.0;
public long lDelay = 0;
private String[] ssCmdLines;
private String sCmdLine;
private String sStartPath;
private Process proc = null;
ProcessBuilder pb = null;
public void ReStartProc() {
try {
if (lPeriod > 0) {
lDelay = lPeriod - (System.currentTimeMillis() % lPeriod);
Thread.sleep(lDelay);
} else {
Thread.sleep(10);
}
if (proc != null) {
if (isRunning(proc)) {
try {
br.close();
} catch (Exception ex2) {
System.out.println(ex2.getMessage());
}
proc.destroy();
Thread.sleep(iPause);
}
}
ssCmdLines = sCmdLine.split(" ");
pb = new ProcessBuilder(ssCmdLines);
if (sStartPath.length() > 1) {
pb.directory(new File(sStartPath));
}
pb.redirectErrorStream(true);
proc = pb.start();
br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
public static boolean isRunning(Process process) {
try {
if (process == null) {
return false;
}
process.exitValue();
return false;
} catch (Exception e) {
return true;
}
}
}
| SMXCore/SMXCore_NG | src/modules/MeterKamstrup.java | Java | gpl-3.0 | 7,242 | [
30522,
1013,
1008,
1008,
2000,
2689,
2023,
6105,
20346,
1010,
5454,
6105,
20346,
2015,
1999,
2622,
5144,
1012,
1008,
2000,
2689,
2023,
23561,
5371,
1010,
5454,
5906,
1064,
23561,
2015,
1008,
1998,
2330,
1996,
23561,
1999,
1996,
3559,
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) 2013-2015, Tomas Podermanski
This file is part of libnf.net project.
Libnf 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.
Libnf 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 libnf. If not, see <http://www.gnu.org/licenses/>.
*/
#define NEED_PACKRECORD 1
#define _LIBNF_C_ 1
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/resource.h>
#include <netinet/in.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include "nffile.h"
#include "nfx.h"
#include "nfnet.h"
#include "bookkeeper.h"
#include "nfxstat.h"
#include "nf_common.h"
#include "rbtree.h"
#include "nftree.h"
#include "nfprof.h"
#include "nfdump.h"
#include "nflowcache.h"
#include "nfstat.h"
#include "nfexport.h"
#include "ipconv.h"
#include "flist.h"
#include "util.h"
#include "libnf_internal.h"
#include "libnf.h"
#include "fields.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <errno.h>
#ifdef LNF_THREADS
#include <pthread.h>
#endif
#include "nfdump_inline.c"
#include "nffile_inline.c"
/*! \brief Brief text
* Some TEXT libnf bla bla
*/
/* Global Variables */
extern extension_descriptor_t extension_descriptor[];
char error_str[LNF_MAX_STRING];
pthread_mutex_t lnf_nfdump_filter_mutex; /* mutex for operations open/close file, filter init */
#define FLOW_RECORD_NEXT(x) x = (common_record_t *)((pointer_addr_t)x + x->size)
/* text description of the fields */
lnf_field_t lnf_fields[] = {
// pod: =====================
{LNF_FLD_FIRST, LNF_AGGR_MIN, LNF_SORT_ASC, "first",
"Timestamp of the first packet seen (in miliseconds)"},
{LNF_FLD_LAST, LNF_AGGR_MAX, LNF_SORT_ASC, "last",
"Timestamp of the last packet seen (in miliseconds)"},
{LNF_FLD_RECEIVED, LNF_AGGR_MAX, LNF_SORT_ASC, "received",
"Timestamp regarding when the packet was received by collector"},
// pod:
// pod: Statistical items
// pod: =====================
{LNF_FLD_DOCTETS, LNF_AGGR_SUM, LNF_SORT_DESC, "bytes",
"The number of bytes"},
{LNF_FLD_DPKTS, LNF_AGGR_SUM, LNF_SORT_DESC, "pkts",
"The number of packets"},
{LNF_FLD_OUT_BYTES, LNF_AGGR_SUM, LNF_SORT_DESC, "outbytes",
"The number of output bytes"},
{LNF_FLD_OUT_PKTS, LNF_AGGR_SUM, LNF_SORT_DESC, "outpkts",
"The number of output packets"},
{LNF_FLD_AGGR_FLOWS, LNF_AGGR_SUM, LNF_SORT_DESC, "flows",
"The number of flows (aggregated)"},
// pod:
// pod: Layer 4 information
// pod: =====================
{LNF_FLD_SRCPORT, LNF_AGGR_KEY, LNF_SORT_ASC, "srcport",
"Source port"},
{LNF_FLD_DSTPORT, LNF_AGGR_KEY, LNF_SORT_ASC, "dstport",
"Destination port"},
{LNF_FLD_TCP_FLAGS, LNF_AGGR_OR, LNF_SORT_ASC, "tcpflags",
"TCP flags"},
// pod:
// pod: Layer 3 information
// pod: =====================
{LNF_FLD_SRCADDR, LNF_AGGR_KEY, LNF_SORT_ASC, "srcip",
"Source IP address"},
{LNF_FLD_DSTADDR, LNF_AGGR_KEY, LNF_SORT_ASC, "dstip",
"Destination IP address"},
{LNF_FLD_IP_NEXTHOP, LNF_AGGR_KEY, LNF_SORT_ASC, "nexthop",
"IP next hop"},
{LNF_FLD_SRC_MASK, LNF_AGGR_KEY, LNF_SORT_ASC, "srcmask",
"Source mask"},
{LNF_FLD_DST_MASK, LNF_AGGR_KEY, LNF_SORT_ASC, "dstmask",
"Destination mask"},
{LNF_FLD_TOS, LNF_AGGR_KEY, LNF_SORT_ASC, "tos",
"Source type of service"},
{LNF_FLD_DST_TOS, LNF_AGGR_KEY, LNF_SORT_ASC, "dsttos",
"Destination type of service"},
{LNF_FLD_SRCAS, LNF_AGGR_KEY, LNF_SORT_ASC, "srcas",
"Source AS number"},
{LNF_FLD_DSTAS, LNF_AGGR_KEY, LNF_SORT_ASC, "dstas",
"Destination AS number"},
{LNF_FLD_BGPNEXTADJACENTAS, LNF_AGGR_KEY, LNF_SORT_ASC, "nextas",
"BGP Next AS"},
{LNF_FLD_BGPPREVADJACENTAS, LNF_AGGR_KEY, LNF_SORT_ASC, "prevas",
"BGP Previous AS"},
{LNF_FLD_BGP_NEXTHOP, LNF_AGGR_KEY, LNF_SORT_ASC, "bgpnexthop",
"BGP next hop"},
{LNF_FLD_PROT, LNF_AGGR_KEY, LNF_SORT_ASC, "proto",
"IP protocol"},
// pod:
// pod: Layer 2 information
// pod: =====================
{LNF_FLD_SRC_VLAN, LNF_AGGR_KEY, LNF_SORT_ASC, "srcvlan",
"Source vlan label"},
{LNF_FLD_DST_VLAN, LNF_AGGR_KEY, LNF_SORT_ASC, "dstvlan",
"Destination vlan label"},
{LNF_FLD_IN_SRC_MAC, LNF_AGGR_KEY, LNF_SORT_ASC, "insrcmac",
"In source MAC address"},
{LNF_FLD_OUT_SRC_MAC, LNF_AGGR_KEY, LNF_SORT_ASC, "outsrcmac",
"Out destination MAC address"},
{LNF_FLD_IN_DST_MAC, LNF_AGGR_KEY, LNF_SORT_ASC, "indstmac",
"In destination MAC address"},
{LNF_FLD_OUT_DST_MAC, LNF_AGGR_KEY, LNF_SORT_ASC, "outdstmac",
"Out source MAC address"},
// pod:
// pod: MPLS information
// pod: =====================
{LNF_FLD_MPLS_LABEL, LNF_AGGR_KEY, LNF_SORT_NONE, "mpls",
"MPLS labels"},
// pod:
// pod: Layer 1 information
// pod: =====================
{LNF_FLD_INPUT, LNF_AGGR_KEY, LNF_SORT_ASC, "inif",
"SNMP input interface number"},
{LNF_FLD_OUTPUT, LNF_AGGR_KEY, LNF_SORT_ASC, "outif",
"SNMP output interface number"},
{LNF_FLD_DIR, LNF_AGGR_KEY, LNF_SORT_ASC, "dir",
"Flow directions ingress/egress"},
{LNF_FLD_FWD_STATUS, LNF_AGGR_KEY, LNF_SORT_ASC, "fwd",
"Forwarding status"},
// pod:
// pod: Exporter information
// pod: =====================
{LNF_FLD_IP_ROUTER, LNF_AGGR_KEY, LNF_SORT_ASC, "router",
"Exporting router IP"},
{LNF_FLD_ENGINE_TYPE, LNF_AGGR_KEY, LNF_SORT_ASC, "systype",
"Type of exporter"},
{LNF_FLD_ENGINE_ID, LNF_AGGR_KEY, LNF_SORT_ASC, "sysid",
"Internal SysID of exporter"},
// pod:
// pod: NSEL fields, see: http://www.cisco.com/en/US/docs/security/asa/asa81/netflow/netflow.html
// pod: =====================
{LNF_FLD_EVENT_TIME, LNF_AGGR_MIN, LNF_SORT_ASC, "eventtime",
"NSEL The time that the flow was created"},
{LNF_FLD_CONN_ID, LNF_AGGR_KEY, LNF_SORT_ASC, "connid",
"NSEL An identifier of a unique flow for the device"},
{LNF_FLD_ICMP_CODE, LNF_AGGR_KEY, LNF_SORT_ASC, "icmpcode",
"NSEL ICMP code value"},
{LNF_FLD_ICMP_TYPE, LNF_AGGR_KEY, LNF_SORT_ASC, "icmptype",
"NSEL ICMP type value"},
{LNF_FLD_FW_XEVENT, LNF_AGGR_KEY, LNF_SORT_ASC, "xevent",
"NSEL Extended event code"},
{LNF_FLD_XLATE_SRC_IP, LNF_AGGR_KEY, LNF_SORT_ASC, "xsrcip",
"NSEL Mapped source IPv4 address"},
{LNF_FLD_XLATE_DST_IP, LNF_AGGR_KEY, LNF_SORT_ASC, "xdstip",
"NSEL Mapped destination IPv4 address"},
{LNF_FLD_XLATE_SRC_PORT, LNF_AGGR_KEY, LNF_SORT_ASC, "xsrcport",
"NSEL Mapped source port"},
{LNF_FLD_XLATE_DST_PORT, LNF_AGGR_KEY, LNF_SORT_ASC, "xdstport",
"NSEL Mapped destination port"},
// pod: NSEL The input ACL that permitted or denied the flow
{LNF_FLD_INGRESS_ACL_ID, LNF_AGGR_KEY, LNF_SORT_ASC, "iacl",
"Hash value or ID of the ACL name"},
{LNF_FLD_INGRESS_ACE_ID, LNF_AGGR_KEY, LNF_SORT_ASC, "iace",
"Hash value or ID of the ACL name"},
{LNF_FLD_INGRESS_XACE_ID, LNF_AGGR_KEY, LNF_SORT_ASC, "ixace",
"Hash value or ID of an extended ACE configuration"},
// pod: NSEL The output ACL that permitted or denied a flow
{LNF_FLD_EGRESS_ACL_ID, LNF_AGGR_KEY, LNF_SORT_ASC, "eacl",
"Hash value or ID of the ACL name"},
{LNF_FLD_EGRESS_ACE_ID, LNF_AGGR_KEY, LNF_SORT_ASC, "eace",
"Hash value or ID of the ACL name"},
{LNF_FLD_EGRESS_XACE_ID, LNF_AGGR_KEY, LNF_SORT_ASC, "exace",
"Hash value or ID of an extended ACE configuration"},
{LNF_FLD_USERNAME, LNF_AGGR_KEY, LNF_SORT_ASC, "username",
"NSEL username"},
// pod:
// pod: NEL (NetFlow Event Logging) fields
// pod: =====================
{LNF_FLD_INGRESS_VRFID, LNF_AGGR_KEY, LNF_SORT_ASC, "ingressvrfid",
"NEL NAT ingress vrf id"},
{LNF_FLD_EVENT_FLAG, LNF_AGGR_KEY, LNF_SORT_ASC, "eventflag",
"NAT event flag (always set to 1 by nfdump)"},
{LNF_FLD_EGRESS_VRFID, LNF_AGGR_KEY, LNF_SORT_ASC, "egressvrfid",
"NAT egress VRF ID"},
{LNF_FLD_BLOCK_START, LNF_AGGR_KEY, LNF_SORT_ASC, "blockstart",
"NAT pool block start"},
// pod:
// pod: NEL Port Block Allocation (added 2014-04-19)
// pod: =====================
{LNF_FLD_BLOCK_END, LNF_AGGR_KEY, LNF_SORT_ASC, "blockend",
"NAT pool block end"},
{LNF_FLD_BLOCK_STEP, LNF_AGGR_KEY, LNF_SORT_ASC, "blockstep",
"NAT pool block step"},
{LNF_FLD_BLOCK_SIZE, LNF_AGGR_KEY, LNF_SORT_ASC, "blocksize",
"NAT pool block size"},
// pod:
// pod: Extra/special fields
// pod: =====================
{LNF_FLD_CLIENT_NW_DELAY_USEC, LNF_AGGR_KEY, LNF_SORT_ASC, "cl",
"nprobe latency client_nw_delay_usec"},
{LNF_FLD_SERVER_NW_DELAY_USEC, LNF_AGGR_KEY, LNF_SORT_ASC, "sl",
"nprobe latency server_nw_delay_usec"},
{LNF_FLD_APPL_LATENCY_USEC, LNF_AGGR_KEY, LNF_SORT_ASC, "al",
"nprobe latency appl_latency_usec"},
{LNF_FLD_ZERO_, 0, 0, NULL,
NULL}
};
/* open existing nfdump file and prepare for reading records */
/* only simple wrapper to nfdump function */
int lnf_open(lnf_file_t **lnf_filep, const char * filename, unsigned int flags, const char * ident) {
int i;
lnf_file_t *lnf_file;
int comp;
lnf_file = malloc(sizeof(lnf_file_t));
if (lnf_file == NULL) {
return LNF_ERR_NOMEM;
}
lnf_file->flags = flags;
/* open file in either read only or write only mode */
#ifdef LNF_THREADS
pthread_mutex_lock(&lnf_nfdump_filter_mutex);
#endif
if (flags & LNF_APPEND) {
lnf_file->nffile = AppendFile((char *)filename);
} else if (flags & LNF_WRITE) {
if (flags & LNF_COMP_LZO) {
comp = 1;
} else if (flags & LNF_COMP_BZ2) {
comp = 2;
} else {
comp = 0;
}
lnf_file->nffile = OpenNewFile((char *)filename, NULL, comp,
flags & LNF_ANON, (char *)ident);
} else {
/* set file name in LOOP mode */
if (flags & LNF_READ_LOOP) {
if (filename == NULL) {
free(lnf_file);
return LNF_ERR_OTHER;;
}
lnf_file->filename = malloc(strlen(filename) + 1);
if (lnf_file->filename == NULL) {
free(lnf_file);
return LNF_ERR_OTHER;;
}
strcpy(lnf_file->filename, filename);
}
lnf_file->nffile = OpenFile((char *)filename, NULL);
}
#ifdef LNF_THREADS
pthread_mutex_unlock(&lnf_nfdump_filter_mutex);
#endif
if (lnf_file->nffile == NULL) {
free(lnf_file);
return LNF_ERR_OTHER;;
}
lnf_file->blk_record_remains = 0;
lnf_file->processed_blocks = 0;
lnf_file->processed_bytes = 0;
lnf_file->skipped_blocks = 0;
#ifdef LNF_THREADS
pthread_mutex_lock(&lnf_nfdump_filter_mutex);
#endif
lnf_file->extension_map_list = InitExtensionMaps(NEEDS_EXTENSION_LIST);
lnf_file->v1convert_buffer = NULL;
lnf_file->lnf_map_list = NULL;
lnf_file->exporters = NULL;
lnf_file->samplers = NULL;
lnf_file->num_exporters = 0;
i = 1;
lnf_file->max_num_extensions = 0;
while ( extension_descriptor[i++].id )
lnf_file->max_num_extensions++;
#ifdef LNF_THREADS
pthread_mutex_unlock(&lnf_nfdump_filter_mutex);
#endif
*lnf_filep = lnf_file;
return LNF_OK;
}
/* fill info structure */
int lnf_info(lnf_file_t *lnf_file, int info, void *data, size_t size) {
file_header_t *h;
stat_record_t *s;
size_t reqsize = 0;
char buf[LNF_INFO_BUFSIZE];
/* for NULL lnf_mem */
switch (info) {
case LNF_INFO_VERSION:
strcpy(buf, VERSION);
reqsize = strlen(VERSION) + 1;
break;
case LNF_INFO_NFDUMP_VERSION:
strcpy(buf, NFDUMP_VERSION);
reqsize = strlen(NFDUMP_VERSION) + 1;
break;
}
/* the requested item was one of the above */
if ( reqsize != 0 ) {
if ( reqsize <= size ) {
memcpy(data, buf, reqsize);
return LNF_OK;
} else {
return LNF_ERR_NOMEM;
}
}
/* file specific request */
if (lnf_file == NULL || lnf_file->nffile == NULL || lnf_file->nffile->file_header == NULL) {
return LNF_ERR_OTHER;
}
h = lnf_file->nffile->file_header;
switch (info) {
case LNF_INFO_FILE_VERSION:
*((uint64_t *)buf) = h->version;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_BLOCKS:
*((uint64_t *)buf) = h->NumBlocks;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_COMPRESSED:
*((int *)buf) = FILE_IS_LZO_COMPRESSED(lnf_file->nffile) || FILE_IS_BZ2_COMPRESSED(lnf_file->nffile) ;
reqsize = sizeof(int);
break;
case LNF_INFO_LZO_COMPRESSED:
*((int *)buf) = FILE_IS_LZO_COMPRESSED(lnf_file->nffile);
reqsize = sizeof(int);
break;
case LNF_INFO_BZ2_COMPRESSED:
*((int *)buf) = FILE_IS_BZ2_COMPRESSED(lnf_file->nffile);
reqsize = sizeof(int);
break;
case LNF_INFO_ANONYMIZED:
*((int *)buf) = h->flags & FLAG_ANONYMIZED;
reqsize = sizeof(int);
break;
case LNF_INFO_CATALOG:
*((int *)buf) = h->flags & FLAG_CATALOG;
reqsize = sizeof(int);
break;
case LNF_INFO_IDENT:
strcpy(buf, h->ident);
reqsize = strlen(h->ident) + 1;
break;
case LNF_INFO_PROC_BLOCKS:
*((uint64_t *)buf) = lnf_file->processed_blocks;
reqsize = sizeof(uint64_t);
break;
}
/* the requested item was one of the above */
if ( reqsize != 0 ) {
if ( reqsize <= size ) {
memcpy(data, buf, reqsize);
return LNF_OK;
} else {
return LNF_ERR_NOMEM;
}
}
/* get stat record */
if (lnf_file->nffile->stat_record == NULL) {
return LNF_ERR_OTHER;
}
s = lnf_file->nffile->stat_record;
switch (info) {
case LNF_INFO_FIRST:
*((uint64_t *)buf) = s->first_seen * 1000LL + s->msec_first;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_LAST:
*((uint64_t *)buf) = s->last_seen * 1000LL + s->msec_last;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_FAILURES:
*((uint64_t *)buf) = s->sequence_failure;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_FLOWS:
*((uint64_t *)buf) = s->numflows;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_BYTES:
*((uint64_t *)buf) = s->numbytes;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_PACKETS:
*((uint64_t *)buf) = s->numpackets;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_FLOWS_TCP:
*((uint64_t *)buf) = s->numflows_tcp;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_FLOWS_UDP:
*((uint64_t *)buf) = s->numflows_udp;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_FLOWS_ICMP:
*((uint64_t *)buf) = s->numflows_icmp;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_FLOWS_OTHER:
*((uint64_t *)buf) = s->numflows_other;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_BYTES_TCP:
*((uint64_t *)buf) = s->numbytes_tcp;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_BYTES_UDP:
*((uint64_t *)buf) = s->numbytes_udp;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_BYTES_ICMP:
*((uint64_t *)buf) = s->numbytes_icmp;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_BYTES_OTHER:
*((uint64_t *)buf) = s->numbytes_other;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_PACKETS_TCP:
*((uint64_t *)buf) = s->numpackets_tcp;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_PACKETS_UDP:
*((uint64_t *)buf) = s->numpackets_udp;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_PACKETS_ICMP:
*((uint64_t *)buf) = s->numpackets_icmp;
reqsize = sizeof(uint64_t);
break;
case LNF_INFO_PACKETS_OTHER:
*((uint64_t *)buf) = s->numpackets_other;
reqsize = sizeof(uint64_t);
break;
}
if ( reqsize != 0 ) {
if ( reqsize <= size ) {
memcpy(data, buf, reqsize);
return LNF_OK;
} else {
return LNF_ERR_NOMEM;
}
} else {
return LNF_ERR_OTHER;
}
}
/* XXX should be redesigned */
void lnf_update_exporter_stats(lnf_file_t *lnf_file, nffile_t *nffile) {
generic_exporter_t *exporter;
exporter_stats_record_t *estats;
size_t size;
int i = 0;
size = sizeof(exporter_stats_record_t) + (lnf_file->num_exporters - 1 ) * sizeof(struct exporter_stat_s);
estats = malloc(size);
if (estats == NULL) {
return;
}
memset(estats, 0x0, size);
/* prepare header */
estats->header.type = ExporterStatRecordType;
estats->header.size = size;
estats->stat_count = lnf_file->num_exporters;
/* fill statistics */
exporter = lnf_file->exporters;
while (exporter != NULL) {
estats->stat[i].sysid = exporter->info.sysid;
estats->stat[i].sequence_failure = exporter->sequence_failure;
estats->stat[i].packets = exporter->packets;
estats->stat[i].flows = exporter->flows;
i++;
exporter = exporter->next;
}
AppendToBuffer(lnf_file->nffile, (void *)&estats, estats->header.size);
free(estats);
}
/* close file handler and release related structures */
void lnf_close(lnf_file_t *lnf_file) {
lnf_map_list_t *map_list, *tmp_map_list;
generic_exporter_t *exporter;
generic_sampler_t *sampler;
void *tmp;
if (lnf_file == NULL || lnf_file->nffile == NULL) {
return ;
}
if (lnf_file->flags & LNF_WRITE) {
/* append exporter statistics into file */
lnf_update_exporter_stats(lnf_file, lnf_file->nffile);
// write the last records in buffer
if (lnf_file->nffile->block_header->NumRecords ) {
if ( WriteBlock(lnf_file->nffile) <= 0 ) {
fprintf(stderr, "Failed to write output buffer: '%s'" , strerror(errno));
}
}
CloseUpdateFile(lnf_file->nffile, NULL );
} else {
CloseFile(lnf_file->nffile);
}
DisposeFile(lnf_file->nffile);
PackExtensionMapList(lnf_file->extension_map_list);
FreeExtensionMaps(lnf_file->extension_map_list);
map_list = lnf_file->lnf_map_list;
while (map_list != NULL) {
tmp_map_list = map_list;
map_list = map_list->next;
bit_array_release(&tmp_map_list->bit_array);
if (tmp_map_list->map != NULL) {
free(tmp_map_list->map);
}
free(tmp_map_list);
}
if (lnf_file->v1convert_buffer != NULL) {
free(lnf_file->v1convert_buffer);
}
/* free exporter list */
exporter = lnf_file->exporters;
while (exporter != NULL) {
tmp = exporter;
exporter = exporter->next;
free(tmp);
}
/* free sampler list */
sampler = lnf_file->samplers;
while (sampler != NULL) {
tmp = sampler;
sampler = sampler->next;
free(tmp);
}
free(lnf_file);
}
/* return next record in file */
/* status of read and fill pre-prepared structure lnf_rec */
int lnf_read_record(lnf_file_t *lnf_file, lnf_rec_t *lnf_rec) {
//master_record_t *master_record;
int ret;
uint32_t map_id;
extension_map_t *map;
int i;
common_record_t *common_record_ptr;
#ifdef COMPAT15
int v1_map_done = 0;
#endif
begin:
if (lnf_file->blk_record_remains == 0) {
/* all records in block have been processed, we are going to load nex block */
// get next data block from file
if (lnf_file->nffile) {
ret = ReadBlock(lnf_file->nffile);
lnf_file->processed_blocks++;
} else {
ret = NF_EOF; /* the firt file in the list */
}
switch (ret) {
case NF_CORRUPT:
return LNF_ERR_CORRUPT;
case NF_ERROR:
return LNF_ERR_READ;
case NF_EOF:
return LNF_EOF;
default:
// successfully read block
lnf_file->processed_bytes += ret;
}
/* block types to be skipped -> goto begin */
/* block types that are unknown -> return */
switch (lnf_file->nffile->block_header->id) {
case DATA_BLOCK_TYPE_1: /* old record type - nfdump 1.5 */
lnf_file->skipped_blocks++;
goto begin;
return LNF_ERR_COMPAT15;
break;
case DATA_BLOCK_TYPE_2: /* common record type - normally processed */
break;
case Large_BLOCK_Type:
lnf_file->skipped_blocks++;
goto begin;
break;
default:
lnf_file->skipped_blocks++;
return LNF_ERR_UNKBLOCK;
}
lnf_file->flow_record = lnf_file->nffile->buff_ptr;
lnf_file->blk_record_remains = lnf_file->nffile->block_header->NumRecords;
} /* reading block */
/* there are some records to process - we are going continue reading next record */
lnf_file->blk_record_remains--;
switch (lnf_file->flow_record->type) {
case ExporterRecordType:
case SamplerRecordype:
case ExporterInfoRecordType:
case ExporterStatRecordType:
case SamplerInfoRecordype:
/* just skip */
FLOW_RECORD_NEXT(lnf_file->flow_record);
goto begin;
break;
case ExtensionMapType:
map = (extension_map_t *)lnf_file->flow_record;
//Insert_Extension_Map(&instance->extension_map_list, map);
Insert_Extension_Map(lnf_file->extension_map_list, map);
FLOW_RECORD_NEXT(lnf_file->flow_record);
goto begin;
break;
case CommonRecordV0Type:
// convert common record v0
if ( lnf_file->v1convert_buffer == NULL) {
lnf_file->v1convert_buffer = malloc(65536); /* very suspisous part of code taken from nfdump */
if ( lnf_file->v1convert_buffer == NULL ) {
return LNF_ERR_NOMEM;
}
}
ConvertCommonV0((void *)lnf_file->flow_record, (common_record_t *)lnf_file->v1convert_buffer);
common_record_ptr = (common_record_t *)lnf_file->v1convert_buffer;
break;
case CommonRecordType:
/* data record type - go ahead */
common_record_ptr = lnf_file->flow_record;
break;
default:
FLOW_RECORD_NEXT(lnf_file->flow_record);
return LNF_ERR_UNKREC;
}
/* we are sure that record is CommonRecordType */
map_id = lnf_file->flow_record->ext_map;
if ( map_id >= MAX_EXTENSION_MAPS ) {
FLOW_RECORD_NEXT(lnf_file->flow_record);
return LNF_ERR_EXTMAPB;
}
if ( lnf_file->extension_map_list->slot[map_id] == NULL ) {
FLOW_RECORD_NEXT(lnf_file->flow_record);
return LNF_ERR_EXTMAPM;
}
// changed in 1.6.8 - added exporter info
// ExpandRecord_v2( flow_record, extension_map_list.slot[map_id], master_record);
ExpandRecord_v2(common_record_ptr, lnf_file->extension_map_list->slot[map_id], NULL, lnf_rec->master_record);
// update number of flows matching a given map
lnf_file->extension_map_list->slot[map_id]->ref_count++;
// Move pointer by number of bytes for netflow record
FLOW_RECORD_NEXT(lnf_file->flow_record);
/*
{
char *s;
PrintExtensionMap(instance->extension_map_list.slot[map_id]->map);
format_file_block_record(master_record, &s, 0);
printf("READ: %s\n", s);
}
*/
// processing map
//bit_array_clear(&lnf_file->extensions_arr);
bit_array_clear(lnf_rec->extensions_arr);
i = 0;
while (lnf_rec->master_record->map_ref->ex_id[i]) {
__bit_array_set(lnf_rec->extensions_arr, lnf_rec->master_record->map_ref->ex_id[i], 1);
i++;
}
// lnf_rec->extensions_arr = &(lnf_file->extensions_arr);
/* the record seems OK. We prepare hash reference with items */
// lnf_file->lnf_rec = lnf_rec; /* XXX temporary */
return LNF_OK;
} /* end of _readfnction */
/* return next record in file */
int lnf_read(lnf_file_t *lnf_file, lnf_rec_t *lnf_rec) {
int ret;
if (lnf_file->flags & LNF_READ_LOOP) {
NEW_READ:
ret = lnf_read_record(lnf_file, lnf_rec);
/* we are at the end of the file, we will wait for new records or inode change */
if (ret == LNF_EOF) {
struct stat stat_buf;
/* wait for while */
sleep(1);
/* check inode change -> indicastes new file */
if (stat(lnf_file->filename, &stat_buf) != 0) {
return LNF_EOF;
}
/* inode change - close odl file and open a new one */
if (lnf_file->inode != 0 && lnf_file->inode != stat_buf.st_ino) {
if (lnf_file->nffile != NULL) {
CloseFile(lnf_file->nffile);
}
lnf_file->nffile = OpenFile((char *)lnf_file->filename, NULL);
if (lnf_file->nffile == NULL) {
return LNF_ERR_OTHER;
}
}
lnf_file->inode = stat_buf.st_ino;
/* sleep for while and try to read again */
goto NEW_READ;
} else {
return ret;
}
} else {
/* normal read -> map function to lnf_read_file */
return lnf_read_record(lnf_file, lnf_rec);
}
}
extension_map_t * lnf_lookup_map(lnf_file_t *lnf_file, bit_array_t *ext ) {
extension_map_t *map;
lnf_map_list_t *map_list;
int i = 0;
int is_set = 0;
int id = 0;
int map_id = 0;
// find whether the template already exist
map_id = 0;
map_list = lnf_file->lnf_map_list;
if (map_list == NULL) {
// first map
map_list = malloc(sizeof(lnf_map_list_t));
if (map_list == NULL) {
return NULL;
}
lnf_file->lnf_map_list = map_list;
} else {
if (bit_array_cmp(&(map_list->bit_array), ext) == 0) {
return map_list->map;
}
map_id++;
while (map_list->next != NULL ) {
if (bit_array_cmp(&(map_list->bit_array), ext) == 0) {
return map_list->map;
} else {
map_id++;
map_list = map_list->next;
}
}
map_list->next = malloc(sizeof(lnf_map_list_t));
if (map_list->next == NULL) {
return NULL;
}
map_list = map_list->next;
}
// allocate memory potentially for all extensions
map = malloc(sizeof(extension_map_t) + (lnf_file->max_num_extensions + 1) * sizeof(uint16_t));
if (map == NULL) {
free(map_list);
return NULL;
}
map_list->map = map;
map_list->next = NULL;
bit_array_init(&map_list->bit_array, lnf_file->max_num_extensions + 1);
bit_array_copy(&map_list->bit_array, ext);
map->type = ExtensionMapType;
map->map_id = map_id;
// set extension map according the bits set in ext structure
id = 0;
i = 0;
while ( (is_set = bit_array_get(ext, id)) != -1 ) {
// fprintf(stderr, "i: %d, bit %d, val: %d\n", i, id, is_set);
if (is_set)
map->ex_id[i++] = id;
id++;
}
map->ex_id[i++] = 0;
// determine size and align 32bits
map->size = sizeof(extension_map_t) + ( i - 1 ) * sizeof(uint16_t);
if (( map->size & 0x3 ) != 0 ) {
map->size += (4 - ( map->size & 0x3 ));
}
map->extension_size = 0;
i=0;
while (map->ex_id[i]) {
int id = map->ex_id[i];
map->extension_size += extension_descriptor[id].size;
i++;
}
//Insert_Extension_Map(&instance->extension_map_list, map);
Insert_Extension_Map(lnf_file->extension_map_list, map);
AppendToBuffer(lnf_file->nffile, (void *)map, map->size);
return map;
}
/* lookup exporter ID by exporter ID an eporter IP
fileds: LNF_FLD_EXPORTER_ID LNF_FLD_EXPORTER_IP
returns - internal exporter ID (sysid)
Exporters are organizes in linked lst. If the ID and IP is not
found in the list the new entry is created */
generic_exporter_t* lnf_lookup_exporter(lnf_file_t *lnf_file, lnf_rec_t *lnf_rec) {
generic_exporter_t *exporter;
generic_exporter_t *tmp;
ip_addr_t ip;
/* no exporter set in the record */
if ((lnf_rec->flags & LNF_REC_EXPORTER) == 0) {
return NULL;
}
exporter = lnf_file->exporters;
/* walk via all exporters */
while (exporter != NULL) {
if (lnf_rec->exporter->info.id == exporter->info.id && memcmp(&lnf_rec->exporter->info.ip, &exporter->info.ip, sizeof(ip_addr_t)) == 0) {
return exporter;
}
exporter = exporter->next;
}
exporter = calloc(sizeof(generic_exporter_t), 1);
if (exporter == NULL) {
return NULL;
}
/* add new exporter into linked list */
tmp = lnf_file->exporters;
lnf_file->exporters = exporter;
exporter->next = tmp;
/* copy exporter info data */
exporter->info.id = lnf_rec->exporter->info.id;
memcpy(&exporter->info.ip, &lnf_rec->exporter->info.ip, sizeof(ip_addr_t));
/* assign sysid */
lnf_file->num_exporters++;
exporter->info.sysid = lnf_file->num_exporters;
/* additional exporter_info_record_t fields */
exporter->info.version = lnf_rec->exporter->info.version;
ip.v6[0] = htonll(exporter->info.ip.v6[0]);
ip.v6[1] = htonll(exporter->info.ip.v6[1]);
if (IN6_IS_ADDR_V4COMPAT((struct in6_addr *)&ip)) {
exporter->info.sa_family = AF_INET;
} else {
exporter->info.sa_family = AF_INET6;
}
exporter->info.header.size = sizeof(exporter_info_record_t);
exporter->info.header.type = ExporterInfoRecordType;
AppendToBuffer(lnf_file->nffile, (void *)&exporter->info, exporter->info.header.size);
return exporter;
}
/* return next record in file */
/* status of read and fill pre-prepared structure lnf_rec */
int lnf_write(lnf_file_t *lnf_file, lnf_rec_t *lnf_rec) {
extension_map_t *map;
generic_exporter_t *exporter;
/* lookup and add map into file if it it is nescessary */
map = lnf_lookup_map(lnf_file, lnf_rec->extensions_arr);
if (map == NULL) {
return LNF_ERR_WRITE;
}
lnf_rec->master_record->map_ref = map;
lnf_rec->master_record->ext_map = map->map_id;
lnf_rec->master_record->type = CommonRecordType;
/* lookup and add exporter record into file if it is nescessary */
exporter = lnf_lookup_exporter(lnf_file, lnf_rec);
/* assign exporter sysid and update statistics */
if (exporter != NULL) {
lnf_rec->master_record->exporter_sysid = exporter->info.sysid;
exporter->packets += lnf_rec->master_record->dPkts;
exporter->flows += lnf_rec->master_record->aggr_flows;
exporter->sequence_failure += lnf_rec->sequence_failures;
}
UpdateStat(lnf_file->nffile->stat_record, lnf_rec->master_record);
PackRecord(lnf_rec->master_record, lnf_file->nffile);
return LNF_OK;
}
/* initialise empty record */
int lnf_rec_init(lnf_rec_t **recp) {
lnf_rec_t *rec;
int i, numext;
rec = malloc(sizeof(lnf_rec_t));
if (rec == NULL) {
*recp = NULL;
return LNF_ERR_NOMEM;
}
rec->extensions_arr = NULL;
rec->field_data = NULL;
rec->master_record = malloc(sizeof(master_record_t));
if (rec->master_record == NULL) {
lnf_rec_free(rec);
*recp = NULL;
return LNF_ERR_NOMEM;
}
rec->extensions_arr = malloc(sizeof(bit_array_t));
if (rec->extensions_arr == NULL) {
lnf_rec_free(rec);
*recp = NULL;
return LNF_ERR_NOMEM;
}
/* exporter and sampler structure initialisation */
rec->exporter = malloc(sizeof(generic_exporter_t));
rec->sampler = malloc(sizeof(generic_sampler_t));
if (rec->exporter == NULL || rec->sampler == NULL) {
lnf_rec_free(rec);
*recp = NULL;
return LNF_ERR_NOMEM;
}
memset(rec->exporter, 0x0, sizeof(generic_exporter_t));
memset(rec->sampler, 0x0, sizeof(generic_sampler_t));
rec->exporter->info.version = LNF_DEFAULT_EXPORTER_VERSION;
/* initialise nfdump extension list */
i = 1;
numext = 0;
while ( extension_descriptor[i++].id ) {
numext++;
}
if (!bit_array_init(rec->extensions_arr, numext + 1)) {
lnf_rec_free(rec);
*recp = NULL;
return LNF_ERR_NOMEM;
}
/* initialise (non nfdump) field data */
rec->field_data = malloc( LNF_FLD_TERM_ * sizeof(void*) );
if (rec->field_data == NULL) {
lnf_rec_free(rec);
*recp = NULL;
return LNF_ERR_NOMEM;
}
memset(rec->field_data, 0x0, LNF_FLD_TERM_ * sizeof(void*));
for (i = LNF_FLD_ZERO_; i < LNF_FLD_TERM_; i++) {
if (lnf_fields_def[i].type != LNF_FLD_ZERO_) {
rec->field_data[i] = malloc(lnf_fields_def[i].size);
if (rec->field_data[i] == NULL) {
lnf_rec_free(rec);
*recp = NULL;
return LNF_ERR_NOMEM;
}
}
}
lnf_rec_clear(rec);
*recp = rec;
return LNF_OK;
}
/* clear record */
void lnf_rec_clear(lnf_rec_t *rec) {
if (rec != NULL) {
bit_array_clear(rec->extensions_arr);
memset(rec->master_record, 0x0, sizeof(master_record_t));
rec->sequence_failures = 0;
}
memset(rec->exporter, 0x0, sizeof(generic_exporter_t));
memset(rec->sampler, 0x0, sizeof(generic_sampler_t));
rec->exporter->info.version = LNF_DEFAULT_EXPORTER_VERSION;
}
/* copy record */
int lnf_rec_copy(lnf_rec_t *dst, lnf_rec_t *src) {
if (dst == NULL || src == NULL) {
return LNF_ERR_OTHER;
}
memcpy(dst->master_record, src->master_record, sizeof(master_record_t));
memcpy(dst->exporter, src->exporter, sizeof(generic_exporter_t));
memcpy(dst->sampler, src->sampler, sizeof(generic_sampler_t));
dst->sequence_failures = src->sequence_failures;
dst->flags = src->flags;
dst->exporter->info.version = LNF_DEFAULT_EXPORTER_VERSION;
if ( bit_array_copy(dst->extensions_arr, src->extensions_arr)) {
return LNF_OK;
} else {
return LNF_ERR_OTHER;
}
}
/* get data from the record in binnary representation */
int lnf_rec_get_raw(lnf_rec_t *rec, int type, char *buf, size_t size, size_t *ret_size) {
int i, offset, data_size;
char data[LNF_MAX_FIELD_LEN];
lnf_rec_raw_t *raw = (lnf_rec_raw_t *)buf; /* map buffer to lnf_rec_raw_t */
lnf_rec_raw_entry_t *current_entry;
if (rec == NULL) {
return LNF_ERR_OTHER;
}
if (type != LNF_REC_RAW_TLV) {
lnf_seterror("%s: unsupported version in TLV (0x%x)", __func__, type);
return LNF_ERR_OTHER_MSG;
}
raw->version = LNF_REC_RAW_TLV;
raw->size = 0;
offset = sizeof(lnf_rec_raw_t);
*ret_size = 0;
/* walk via all items */
for (i = LNF_FLD_ZERO_; i < LNF_FLD_TERM_; i++) {
if ( lnf_rec_fget(rec, i, data) == LNF_OK ) {
data_size = __lnf_fld_size(i);
switch ( __lnf_fld_type(i) ) {
case LNF_UINT16:
*(uint16_t *)data = htons(*(uint16_t *)data);
break;
case LNF_UINT32:
*(uint32_t *)data = htonl(*(uint32_t *)data);
break;
case LNF_UINT64:
*(uint64_t *)data = htonll(*(uint64_t *)data);
break;
}
current_entry = (lnf_rec_raw_entry_t *)(buf + offset);
current_entry->field = i;
current_entry->data_size = data_size;
memcpy(&buf[offset + sizeof(lnf_rec_raw_entry_t)], data, data_size);
offset += sizeof(lnf_rec_raw_entry_t) + data_size;
raw->size += sizeof(lnf_rec_raw_entry_t) + data_size;
if (offset > size) {
return LNF_ERR_NOMEM;
}
}
}
*ret_size = offset;
return LNF_OK;
}
/* get data from the record in binnary representation */
int lnf_rec_set_raw(lnf_rec_t *rec, char *buf, size_t size) {
int offset;
char data[LNF_MAX_FIELD_LEN];
lnf_rec_raw_t *raw = (lnf_rec_raw_t *)buf; /* map buffer to lnf_rec_raw_t */
lnf_rec_raw_entry_t *current_entry;
if (rec == NULL) {
return LNF_ERR_OTHER;
}
/* check size in buffer */
if (size < sizeof(lnf_rec_raw_t)) {
lnf_seterror("%s: invalid buffer size");
return LNF_ERR_OTHER_MSG;
}
/* check version */
if (raw->version != LNF_REC_RAW_TLV) {
lnf_seterror("%s: unsupported version in TLV (0x%x)", __func__, raw->version);
return LNF_ERR_OTHER_MSG;
}
/* check if we have all data in buffer */
if (raw->size + sizeof(lnf_rec_raw_t) > size) {
lnf_seterror("%s: the size of data (%dB) is slaller than buffer size (%dB)", __func__, raw->size + sizeof(lnf_rec_raw_t), size);
return LNF_ERR_OTHER_MSG;
}
lnf_rec_clear(rec);
offset = sizeof(lnf_rec_raw_t);
/* walk via all entiries in buffer */
while(offset < raw->size) {
current_entry = (lnf_rec_raw_entry_t *)(buf + offset);
if ( current_entry->data_size >= LNF_MAX_FIELD_LEN ) {
return LNF_ERR_NOMEM;
}
memcpy(data, current_entry->data, current_entry->data_size);
switch ( lnf_fld_type(current_entry->field) ) {
case LNF_UINT16:
*(uint16_t *)data = ntohs(*(uint16_t *)data);
break;
case LNF_UINT32:
*(uint32_t *)data = ntohl(*(uint32_t *)data);
break;
case LNF_UINT64:
*(uint64_t *)data = ntohll(*(uint64_t *)data);
break;
}
lnf_rec_fset(rec, current_entry->field, data);
offset += sizeof(lnf_rec_raw_entry_t) + current_entry->data_size;
}
return LNF_OK;
}
/* free record */
void lnf_rec_free(lnf_rec_t *rec) {
int i;
if (rec == NULL) {
return;
}
if (rec->extensions_arr != NULL) {
bit_array_release(rec->extensions_arr);
free(rec->extensions_arr);
}
if (rec->master_record != NULL) {
free(rec->master_record);
}
if (rec->exporter != NULL) {
free(rec->exporter);
}
if (rec->sampler != NULL) {
free(rec->sampler);
}
if (rec->field_data != NULL) {
for (i = LNF_FLD_ZERO_; i < LNF_FLD_TERM_; i++) {
if (rec->field_data[i] != NULL) {
free(rec->field_data[i]);
}
}
free(rec->field_data);
}
free(rec);
}
/* returns LN_OK or LNF_ERR_UNKFLD */
/* TAG for check_items_map.pl: lnf_rec_fset */
int lnf_rec_fset(lnf_rec_t *rec, int field, void * p) {
if (lnf_fld_type(field) == LNF_NONE) {
return LNF_ERR_UNKFLD;
}
return __lnf_rec_fset(rec, field, p);
}
/* returns LN_OK or LNF_ERR_UNKFLD */
/* TAG for check_items_map.pl: lnf_rec_fget */
int lnf_rec_fget(lnf_rec_t *rec, int field, void * p) {
if (lnf_fld_type(field) == LNF_NONE) {
return LNF_ERR_UNKFLD;
}
return __lnf_rec_fget(rec, field, p);
}
/* initialize filter */
/* returns LNF_OK or LNF_ERR_FILTER */
/* there is a new code for lnf_filter, however it is experimental so far */
int lnf_filter_init_v1(lnf_filter_t **filterp, char *expr) {
lnf_filter_t *filter;
filter = malloc(sizeof(lnf_filter_t));
if (filter == NULL) {
return LNF_ERR_NOMEM;
}
#ifdef LNF_THREADS
pthread_mutex_lock(&lnf_nfdump_filter_mutex);
#endif
filter->v2filter = 0; /* nitialised as V1 - nfdump filter */
filter->engine = CompileFilter(expr);
#ifdef LNF_THREADS
pthread_mutex_unlock(&lnf_nfdump_filter_mutex);
#endif
if ( !filter->engine ) {
free(filter);
return LNF_ERR_FILTER;
}
*filterp = filter;
return LNF_OK;
}
/* call the proper version of the filter initialisation */
/* So far we use V1 - original nfdump filter. In future */
/* it will be replaced by new code V2 - libnf filter */
int lnf_filter_init(lnf_filter_t **filterp, char *expr) {
return lnf_filter_init_v1(filterp, expr);
}
/************************************************************/
/* Fields */
/************************************************************/
/* returns data type for field ir LNF_NONE if field does not exist */
int lnf_fld_type(int field) {
if (field > LNF_FLD_TERM_) {
return LNF_NONE;
}
return __lnf_fld_type(field);
}
/************************************************************/
/* Errrr handling - needs to be updated for threades */
/************************************************************/
/* get error string */
void lnf_error(const char *buf, int buflen) {
strncpy((char *)buf, error_str, buflen - 1);
}
/* set error string */
void lnf_seterror(char *format, ...) {
va_list args;
va_start(args, format);
vsnprintf(error_str, LNF_MAX_STRING - 1, format, args);
va_end(args);
}
/* compatibility with nfdump */
/* cannot be a macro - is reverence from other files */
void LogError(char *format, ...) {
va_list args;
va_start(args, format);
lnf_seterror(format, args);
va_end(args);
}
/* empry functions - required by nfdump */
void LogInfo(char *format, ...) { }
void format_number(uint64_t num, char *s, int scale, int fixed_width) { }
/* dummy functions from flist.c */
char *GetCurrentFilename(void) { return NULL; }
nffile_t *GetNextFile(nffile_t *nffile, time_t twin_start, time_t twin_end) { return NULL; }
void SetupInputFileSequence(char *multiple_dirs, char *single_file, char *multiple_files) { }
| ImoStocky/libnf | src/libnf.c | C | gpl-3.0 | 38,557 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2286,
1011,
2325,
1010,
12675,
17491,
18689,
5488,
2023,
5371,
2003,
2112,
1997,
5622,
24700,
2546,
1012,
5658,
2622,
1012,
5622,
24700,
2546,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE23_Relative_Path_Traversal__char_file_ifstream_08.cpp
Label Definition File: CWE23_Relative_Path_Traversal.label.xml
Template File: sources-sink-08.tmpl.cpp
*/
/*
* @description
* CWE: 23 Relative Path Traversal
* BadSource: file Read input from a file
* GoodSource: Use a fixed file name
* Sink: ifstream
* BadSink : Open the file named in data using ifstream::open()
* Flow Variant: 08 Control flow: if(staticReturnsTrue()) and if(staticReturnsFalse())
*
* */
#include "std_testcase.h"
#ifdef _WIN32
#define BASEPATH "c:\\temp\\"
#else
#include <wchar.h>
#define BASEPATH "/tmp/"
#endif
#ifdef _WIN32
#define FILENAME "C:\\temp\\file.txt"
#else
#define FILENAME "/tmp/file.txt"
#endif
#include <fstream>
using namespace std;
/* The two function below always return the same value, so a tool
should be able to identify that calls to the functions will always
return a fixed value. */
static int staticReturnsTrue()
{
return 1;
}
static int staticReturnsFalse()
{
return 0;
}
namespace CWE23_Relative_Path_Traversal__char_file_ifstream_08
{
#ifndef OMITBAD
void bad()
{
char * data;
char dataBuffer[FILENAME_MAX] = BASEPATH;
data = dataBuffer;
if(staticReturnsTrue())
{
{
/* Read input from a file */
size_t dataLen = strlen(data);
FILE * pFile;
/* if there is room in data, attempt to read the input from a file */
if (FILENAME_MAX-dataLen > 1)
{
pFile = fopen(FILENAME, "r");
if (pFile != NULL)
{
/* POTENTIAL FLAW: Read data from a file */
if (fgets(data+dataLen, (int)(FILENAME_MAX-dataLen), pFile) == NULL)
{
printLine("fgets() failed");
/* Restore NUL terminator if fgets fails */
data[dataLen] = '\0';
}
fclose(pFile);
}
}
}
}
{
ifstream inputFile;
/* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
inputFile.open((char *)data);
inputFile.close();
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B1() - use goodsource and badsink by changing the staticReturnsTrue() to staticReturnsFalse() */
static void goodG2B1()
{
char * data;
char dataBuffer[FILENAME_MAX] = BASEPATH;
data = dataBuffer;
if(staticReturnsFalse())
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Use a fixed file name */
strcat(data, "file.txt");
}
{
ifstream inputFile;
/* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
inputFile.open((char *)data);
inputFile.close();
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
char * data;
char dataBuffer[FILENAME_MAX] = BASEPATH;
data = dataBuffer;
if(staticReturnsTrue())
{
/* FIX: Use a fixed file name */
strcat(data, "file.txt");
}
{
ifstream inputFile;
/* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
inputFile.open((char *)data);
inputFile.close();
}
}
void good()
{
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
using namespace CWE23_Relative_Path_Traversal__char_file_ifstream_08; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| JianpingZeng/xcc | xcc/test/juliet/testcases/CWE23_Relative_Path_Traversal/s02/CWE23_Relative_Path_Traversal__char_file_ifstream_08.cpp | C++ | bsd-3-clause | 4,569 | [
30522,
1013,
1008,
23561,
7013,
3231,
18382,
5371,
5371,
18442,
1024,
19296,
2063,
21926,
1035,
5816,
1035,
4130,
1035,
29053,
2389,
1035,
1035,
25869,
1035,
5371,
1035,
2065,
21422,
1035,
5511,
1012,
18133,
2361,
3830,
6210,
5371,
1024,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.