text
stringlengths 2
1.04M
| meta
dict |
|---|---|
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
}
.btn-default .badge,
.btn-primary .badge,
.btn-success .badge,
.btn-info .badge,
.btn-warning .badge,
.btn-danger .badge {
text-shadow: none;
}
.btn:active,
.btn.active {
background-image: none;
}
.btn-default {
text-shadow: 0 1px 0 #fff;
background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0));
background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #dbdbdb;
border-color: #ccc;
}
.btn-default:hover,
.btn-default:focus {
background-color: #e0e0e0;
background-position: 0 -15px;
}
.btn-default:active,
.btn-default.active {
background-color: #e0e0e0;
border-color: #dbdbdb;
}
.btn-default:disabled,
.btn-default[disabled] {
background-color: #e0e0e0;
background-image: none;
}
.btn-primary {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88));
background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #245580;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #265a88;
background-position: 0 -15px;
}
.btn-primary:active,
.btn-primary.active {
background-color: #265a88;
border-color: #245580;
}
.btn-primary:disabled,
.btn-primary[disabled] {
background-color: #265a88;
background-image: none;
}
.btn-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641));
background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #3e8f3e;
}
.btn-success:hover,
.btn-success:focus {
background-color: #419641;
background-position: 0 -15px;
}
.btn-success:active,
.btn-success.active {
background-color: #419641;
border-color: #3e8f3e;
}
.btn-success:disabled,
.btn-success[disabled] {
background-color: #419641;
background-image: none;
}
.btn-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2));
background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #28a4c9;
}
.btn-info:hover,
.btn-info:focus {
background-color: #2aabd2;
background-position: 0 -15px;
}
.btn-info:active,
.btn-info.active {
background-color: #2aabd2;
border-color: #28a4c9;
}
.btn-info:disabled,
.btn-info[disabled] {
background-color: #2aabd2;
background-image: none;
}
.btn-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316));
background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #e38d13;
}
.btn-warning:hover,
.btn-warning:focus {
background-color: #eb9316;
background-position: 0 -15px;
}
.btn-warning:active,
.btn-warning.active {
background-color: #eb9316;
border-color: #e38d13;
}
.btn-warning:disabled,
.btn-warning[disabled] {
background-color: #eb9316;
background-image: none;
}
.btn-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a));
background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #b92c28;
}
.btn-danger:hover,
.btn-danger:focus {
background-color: #c12e2a;
background-position: 0 -15px;
}
.btn-danger:active,
.btn-danger.active {
background-color: #c12e2a;
border-color: #b92c28;
}
.btn-danger:disabled,
.btn-danger[disabled] {
background-color: #c12e2a;
background-image: none;
}
.thumbnail,
.img-thumbnail {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-color: #e8e8e8;
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
background-color: #2e6da4;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
.navbar-default {
background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8));
background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2));
background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
}
.navbar-brand,
.navbar-nav > li > a {
text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.navbar-inverse {
background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222));
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
}
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%);
background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f));
background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
@media (max-width: 767px) {
.navbar .navbar-nav .open .dropdown-menu > .active > a,
.navbar .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #fff;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
}
.alert {
text-shadow: 0 1px 0 rgba(255, 255, 255, .2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
}
.alert-success {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc));
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
background-repeat: repeat-x;
border-color: #b2dba1;
}
.alert-info {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0));
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
background-repeat: repeat-x;
border-color: #9acfea;
}
.alert-warning {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0));
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
background-repeat: repeat-x;
border-color: #f5e79e;
}
.alert-danger {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3));
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
background-repeat: repeat-x;
border-color: #dca7a7;
}
.progress {
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5));
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090));
background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44));
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5));
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f));
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c));
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-striped {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
}
.list-group {
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
text-shadow: 0 -1px 0 #286090;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a));
background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);
background-repeat: repeat-x;
border-color: #2b669a;
}
.list-group-item.active .badge,
.list-group-item.active:hover .badge,
.list-group-item.active:focus .badge {
text-shadow: none;
}
.panel {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.panel-default > .panel-heading {
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.panel-primary > .panel-heading {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
.panel-success > .panel-heading {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6));
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
background-repeat: repeat-x;
}
.panel-info > .panel-heading {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
background-repeat: repeat-x;
}
.panel-warning > .panel-heading {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc));
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
background-repeat: repeat-x;
}
.panel-danger > .panel-heading {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc));
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
background-repeat: repeat-x;
}
.well {
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5));
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
border-color: #dcdcdc;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
}
|
{
"content_hash": "390edb3bbd36b6e89079b610b0b7e724",
"timestamp": "",
"source": "github",
"line_count": 465,
"max_line_length": 207,
"avg_line_length": 48.950537634408605,
"alnum_prop": 0.6842544591863632,
"repo_name": "llegeard/vin_c2c",
"id": "f8202501bc5c9a2537e8d2ce3ac622d633bd5e78",
"size": "22930",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "web/css/f5b484e_part_1_bootstrap-theme_1.css",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "2643"
},
{
"name": "CSS",
"bytes": "6233529"
},
{
"name": "HTML",
"bytes": "35963"
},
{
"name": "JavaScript",
"bytes": "625163"
},
{
"name": "PHP",
"bytes": "84968"
}
],
"symlink_target": ""
}
|
// Dependencies for this module:
// ../../../../knockout
import * as ko from "knockout";
import "./chunks/localization";
export { Survey as Model };
import "../../main.scss";
import "../../modern.scss";
export let Version: string;
export var __assign: any;
export function __extends(thisClass: any, baseClass: any): void;
export var __decorate: (decorators: any, target: any, key: any, desc: any) => any;
export var __spreadArrays: () => any[];
export declare var surveyCss: any;
export declare var defaultStandardCss: {
root: string;
container: string;
header: string;
body: string;
bodyEmpty: string;
footer: string;
title: string;
description: string;
logo: string;
logoImage: string;
headerText: string;
navigationButton: string;
completedPage: string;
navigation: {
complete: string;
prev: string;
next: string;
start: string;
};
progress: string;
progressBar: string;
progressTextInBar: string;
page: {
root: string;
title: string;
description: string;
};
pageTitle: string;
pageDescription: string;
row: string;
question: {
mainRoot: string;
flowRoot: string;
header: string;
headerLeft: string;
content: string;
contentLeft: string;
titleLeftRoot: string;
requiredText: string;
title: string;
number: string;
description: string;
comment: string;
required: string;
titleRequired: string;
hasError: string;
indent: number;
footer: string;
formGroup: string;
};
panel: {
title: string;
titleExpandable: string;
icon: string;
iconExpanded: string;
description: string;
container: string;
};
error: {
root: string;
icon: string;
item: string;
locationTop: string;
locationBottom: string;
};
boolean: {
root: string;
item: string;
control: string;
itemChecked: string;
itemIndeterminate: string;
itemDisabled: string;
switch: string;
slider: string;
label: string;
disabledLabel: string;
};
checkbox: {
root: string;
item: string;
itemChecked: string;
itemInline: string;
label: string;
labelChecked: string;
itemControl: string;
itemDecorator: string;
controlLabel: string;
materialDecorator: string;
other: string;
column: string;
};
comment: string;
dropdown: {
root: string;
control: string;
selectWrapper: string;
other: string;
};
html: {
root: string;
};
image: {
root: string;
image: string;
};
matrix: {
root: string;
label: string;
itemChecked: string;
itemDecorator: string;
cellText: string;
cellTextSelected: string;
cellLabel: string;
};
matrixdropdown: {
root: string;
};
matrixdynamic: {
root: string;
button: string;
buttonAdd: string;
buttonRemove: string;
iconAdd: string;
iconRemove: string;
};
paneldynamic: {
root: string;
title: string;
button: string;
buttonAdd: string;
buttonRemove: string;
buttonPrev: string;
buttonNext: string;
progressContainer: string;
progress: string;
progressBar: string;
progressText: string;
};
multipletext: {
root: string;
itemTitle: string;
row: string;
itemValue: string;
};
radiogroup: {
root: string;
item: string;
itemChecked: string;
itemInline: string;
itemDecorator: string;
label: string;
labelChecked: string;
itemControl: string;
controlLabel: string;
materialDecorator: string;
other: string;
clearButton: string;
column: string;
};
imagepicker: {
root: string;
item: string;
itemChecked: string;
label: string;
itemControl: string;
image: string;
itemInline: string;
itemText: string;
clearButton: string;
};
rating: {
root: string;
item: string;
selected: string;
minText: string;
itemText: string;
maxText: string;
disabled: string;
};
text: string;
expression: string;
file: {
root: string;
placeholderInput: string;
preview: string;
removeButton: string;
fileInput: string;
removeFile: string;
removeFileSvg: string;
fileDecorator: string;
fileSignBottom: string;
removeButtonBottom: string;
chooseFile: string;
noFileChosen: string;
};
signaturepad: {
root: string;
controls: string;
clearButton: string;
};
saveData: {
root: string;
saving: string;
error: string;
success: string;
saveAgainButton: string;
};
window: {
root: string;
body: string;
header: {
root: string;
title: string;
button: string;
buttonExpanded: string;
buttonCollapsed: string;
};
};
};
export declare var defaultBootstrapCss: {
root: string;
container: string;
header: string;
body: string;
bodyEmpty: string;
footer: string;
title: string;
description: string;
logo: string;
logoImage: string;
headerText: string;
navigationButton: string;
completedPage: string;
navigation: {
complete: string;
prev: string;
next: string;
start: string;
};
progress: string;
progressBar: string;
progressTextUnderBar: string;
page: {
root: string;
title: string;
description: string;
};
pageTitle: string;
pageDescription: string;
row: string;
question: {
mainRoot: string;
flowRoot: string;
header: string;
headerLeft: string;
content: string;
contentLeft: string;
titleLeftRoot: string;
title: string;
number: string;
description: string;
descriptionUnderInput: string;
requiredText: string;
comment: string;
required: string;
titleRequired: string;
hasError: string;
indent: number;
formGroup: string;
};
panel: {
title: string;
titleExpandable: string;
icon: string;
iconExpanded: string;
description: string;
container: string;
};
error: {
root: string;
icon: string;
item: string;
locationTop: string;
locationBottom: string;
};
boolean: {
root: string;
item: string;
control: string;
itemChecked: string;
itemIndeterminate: string;
itemDisabled: string;
switch: string;
slider: string;
label: string;
disabledLabel: string;
};
checkbox: {
root: string;
item: string;
itemChecked: string;
itemInline: string;
itemControl: string;
itemDecorator: string;
label: string;
labelChecked: string;
controlLabel: string;
materialDecorator: string;
other: string;
column: string;
};
comment: string;
dropdown: {
root: string;
control: string;
other: string;
};
html: {
root: string;
};
image: {
root: string;
image: string;
};
matrix: {
root: string;
label: string;
itemChecked: string;
itemDecorator: string;
cellText: string;
cellTextSelected: string;
cellLabel: string;
};
matrixdropdown: {
root: string;
};
matrixdynamic: {
root: string;
button: string;
buttonAdd: string;
buttonRemove: string;
iconAdd: string;
iconRemove: string;
};
paneldynamic: {
root: string;
navigation: string;
progressTop: string;
progressBottom: string;
title: string;
button: string;
buttonAdd: string;
buttonRemove: string;
buttonPrev: string;
buttonNext: string;
progressContainer: string;
progress: string;
progressBar: string;
progressText: string;
};
multipletext: {
root: string;
itemTitle: string;
itemValue: string;
};
radiogroup: {
root: string;
item: string;
itemChecked: string;
itemInline: string;
label: string;
labelChecked: string;
itemControl: string;
itemDecorator: string;
controlLabel: string;
materialDecorator: string;
other: string;
clearButton: string;
column: string;
};
imagepicker: {
root: string;
item: string;
itemChecked: string;
itemInline: string;
label: string;
itemControl: string;
image: string;
itemText: string;
clearButton: string;
};
rating: {
root: string;
item: string;
selected: string;
minText: string;
itemText: string;
maxText: string;
disabled: string;
};
text: string;
expression: string;
file: {
root: string;
placeholderInput: string;
preview: string;
removeButton: string;
fileInput: string;
removeFile: string;
removeFileSvg: string;
fileDecorator: string;
fileSignBottom: string;
removeButtonBottom: string;
};
signaturepad: {
root: string;
controls: string;
clearButton: string;
};
saveData: {
root: string;
saving: string;
error: string;
success: string;
saveAgainButton: string;
};
window: {
root: string;
body: string;
header: {
root: string;
title: string;
button: string;
buttonExpanded: string;
buttonCollapsed: string;
};
};
};
export declare var defaultBootstrapMaterialCss: {
root: string;
container: string;
header: string;
body: string;
bodyEmpty: string;
footer: string;
title: string;
description: string;
logo: string;
logoImage: string;
headerText: string;
navigationButton: string;
completedPage: string;
navigation: {
complete: string;
prev: string;
next: string;
start: string;
};
progress: string;
progressBar: string;
progressTextUnderBar: string;
page: {
root: string;
title: string;
description: string;
};
pageTitle: string;
pageDescription: string;
row: string;
question: {
mainRoot: string;
flowRoot: string;
header: string;
headerLeft: string;
content: string;
contentLeft: string;
titleLeftRoot: string;
requiredText: string;
title: string;
number: string;
description: string;
descriptionUnderInput: string;
comment: string;
required: string;
titleRequired: string;
hasError: string;
indent: number;
formGroup: string;
};
panel: {
title: string;
titleExpandable: string;
icon: string;
iconExpanded: string;
description: string;
container: string;
};
error: {
root: string;
icon: string;
item: string;
locationTop: string;
locationBottom: string;
};
boolean: {
root: string;
item: string;
control: string;
itemChecked: string;
itemIndeterminate: string;
itemDisabled: string;
switch: string;
slider: string;
label: string;
disabledLabel: string;
};
checkbox: {
root: string;
item: string;
itemChecked: string;
itemInline: string;
itemDecorator: string;
itemControl: string;
label: string;
labelChecked: string;
controlLabel: string;
materialDecorator: string;
other: string;
column: string;
};
comment: string;
dropdown: {
root: string;
control: string;
other: string;
};
html: {
root: string;
};
image: {
root: string;
image: string;
};
matrix: {
root: string;
row: string;
label: string;
cellText: string;
cellTextSelected: string;
cellLabel: string;
itemValue: string;
itemChecked: string;
itemDecorator: string;
};
matrixdropdown: {
root: string;
itemValue: string;
};
matrixdynamic: {
root: string;
button: string;
itemValue: string;
buttonAdd: string;
buttonRemove: string;
iconAdd: string;
iconRemove: string;
};
paneldynamic: {
root: string;
navigation: string;
progressTop: string;
progressBottom: string;
title: string;
button: string;
buttonAdd: string;
buttonRemove: string;
buttonPrev: string;
buttonNext: string;
progressContainer: string;
progress: string;
progressBar: string;
progressText: string;
};
multipletext: {
root: string;
itemTitle: string;
row: string;
itemValue: string;
};
radiogroup: {
root: string;
item: string;
itemChecked: string;
itemInline: string;
itemDecorator: string;
label: string;
labelChecked: string;
itemControl: string;
controlLabel: string;
materialDecorator: string;
other: string;
clearButton: string;
column: string;
};
imagepicker: {
root: string;
item: string;
itemChecked: string;
itemInline: string;
label: string;
itemControl: string;
image: string;
itemText: string;
clearButton: string;
};
rating: {
root: string;
item: string;
selected: string;
minText: string;
itemText: string;
maxText: string;
disabled: string;
};
text: string;
expression: string;
file: {
root: string;
placeholderInput: string;
preview: string;
removeButton: string;
fileInput: string;
removeFile: string;
removeFileSvg: string;
fileDecorator: string;
fileSignBottom: string;
removeButtonBottom: string;
};
signaturepad: {
root: string;
controls: string;
clearButton: string;
};
saveData: {
root: string;
saving: string;
error: string;
success: string;
saveAgainButton: string;
};
window: {
root: string;
body: string;
header: {
root: string;
title: string;
button: string;
buttonExpanded: string;
buttonCollapsed: string;
};
};
};
export declare var modernCss: {
root: string;
container: string;
header: string;
body: string;
bodyEmpty: string;
footer: string;
title: string;
description: string;
logo: string;
logoImage: string;
headerText: string;
navigationButton: string;
completedPage: string;
navigation: {
complete: string;
prev: string;
next: string;
start: string;
};
panel: {
title: string;
titleExpandable: string;
description: string;
container: string;
content: string;
icon: string;
iconExpanded: string;
};
paneldynamic: {
root: string;
navigation: string;
title: string;
button: string;
buttonRemove: string;
buttonAdd: string;
progressTop: string;
progressBottom: string;
buttonPrev: string;
buttonNext: string;
progressContainer: string;
progress: string;
progressBar: string;
progressText: string;
separator: string;
};
progress: string;
progressBar: string;
progressText: string;
progressTextInBar: string;
page: {
root: string;
title: string;
description: string;
};
pageTitle: string;
pageDescription: string;
row: string;
question: {
mainRoot: string;
flowRoot: string;
asCell: string;
header: string;
headerLeft: string;
headerTop: string;
headerBottom: string;
content: string;
contentLeft: string;
titleLeftRoot: string;
titleOnAnswer: string;
titleOnError: string;
title: string;
requiredText: string;
number: string;
description: string;
descriptionUnderInput: string;
comment: string;
required: string;
titleRequired: string;
indent: number;
footer: string;
formGroup: string;
hasError: string;
};
image: {
root: string;
image: string;
};
error: {
root: string;
icon: string;
item: string;
locationTop: string;
locationBottom: string;
};
checkbox: {
root: string;
item: string;
itemDisabled: string;
itemChecked: string;
itemHover: string;
itemInline: string;
label: string;
labelChecked: string;
itemControl: string;
itemDecorator: string;
controlLabel: string;
materialDecorator: string;
other: string;
column: string;
};
radiogroup: {
root: string;
item: string;
itemInline: string;
label: string;
labelChecked: string;
itemDisabled: string;
itemChecked: string;
itemHover: string;
itemControl: string;
itemDecorator: string;
controlLabel: string;
materialDecorator: string;
other: string;
clearButton: string;
column: string;
};
boolean: {
root: string;
small: string;
item: string;
control: string;
itemChecked: string;
itemIndeterminate: string;
itemDisabled: string;
switch: string;
slider: string;
label: string;
disabledLabel: string;
};
text: {
root: string;
small: string;
onError: string;
};
multipletext: {
root: string;
item: string;
itemTitle: string;
row: string;
cell: string;
};
dropdown: {
root: string;
small: string;
control: string;
selectWrapper: string;
other: string;
onError: string;
};
imagepicker: {
root: string;
item: string;
itemInline: string;
itemChecked: string;
itemDisabled: string;
itemHover: string;
label: string;
itemControl: string;
image: string;
itemText: string;
clearButton: string;
other: string;
};
matrix: {
tableWrapper: string;
root: string;
cell: string;
headerCell: string;
label: string;
itemValue: string;
itemChecked: string;
itemDisabled: string;
itemHover: string;
materialDecorator: string;
itemDecorator: string;
cellText: string;
cellTextSelected: string;
cellTextDisabled: string;
};
matrixdropdown: {
root: string;
cell: string;
headerCell: string;
};
matrixdynamic: {
root: string;
cell: string;
headerCell: string;
button: string;
buttonAdd: string;
buttonRemove: string;
iconAdd: string;
iconRemove: string;
};
rating: {
root: string;
item: string;
selected: string;
minText: string;
itemText: string;
maxText: string;
disabled: string;
};
comment: {
root: string;
small: string;
};
expression: string;
file: {
root: string;
other: string;
placeholderInput: string;
preview: string;
fileSign: string;
fileSignBottom: string;
fileDecorator: string;
fileInput: string;
noFileChosen: string;
chooseFile: string;
disabled: string;
removeButton: string;
removeButtonBottom: string;
removeFile: string;
removeFileSvg: string;
wrapper: string;
};
signaturepad: {
root: string;
small: string;
controls: string;
clearButton: string;
};
saveData: {
root: string;
saving: string;
error: string;
success: string;
saveAgainButton: string;
};
window: {
root: string;
body: string;
header: {
root: string;
title: string;
button: string;
buttonExpanded: string;
buttonCollapsed: string;
};
};
};
import "./chunks/localization";
/**
* Global survey settings
*/
export declare var settings: {
/**
* The prefix that uses to store the question comment, as {questionName} + {commentPrefix}.
* The default
*/
commentPrefix: string;
/**
* Encode parameter on calling restfull web API
*/
webserviceEncodeParameters: boolean;
/**
* SurveyJS web service API url
*/
surveyServiceUrl: string;
/**
* separator that can allow to set value and text of ItemValue object in one string as: "value|text"
*/
itemValueSeparator: string;
/**
* default locale name for localizable strings that uses during serialization, {"default": "My text", "de": "Mein Text"}
*/
defaultLocaleName: string;
/**
* Default row name for matrix (single choice)
*/
matrixDefaultRowName: string;
/**
* Default cell type for dropdown and dynamic matrices
*/
matrixDefaultCellType: string;
/**
* Total value postfix for dropdown and dynamic matrices. The total value stores as: {matrixName} + {postfix}
*/
matrixTotalValuePostFix: string;
/**
* Maximum row count in dynamic matrix
*/
matrixMaximumRowCount: number;
/**
* Maximum panel count in dynamic panel
*/
panelMaximumPanelCount: number;
/**
* Maximum rate value count in rating question
*/
ratingMaximumRateValueCount: number;
/**
* Disable the question while choices are getting from the web service
*/
disableOnGettingChoicesFromWeb: boolean;
/**
* Set to true to always serialize the localization string as object even if there is only one value for default locale. Instead of string "MyStr" serialize as {default: "MyStr"}
*/
serializeLocalizableStringAsObject: boolean;
/**
* Set to false to hide empty page title in design mode
*/
allowShowEmptyTitleInDesignMode: boolean;
/**
* Set this property to true to execute the complete trigger on value change instead of on next page.
*/
executeCompleteTriggerOnValueChanged: boolean;
};
export interface HashTable<T> {
[key: string]: T;
}
export declare class Helpers {
/**
* A static methods that returns true if a value underfined, null, empty string or empty array.
* @param value
*/
static isValueEmpty(value: any): boolean;
static isArrayContainsEqual(x: any, y: any): boolean;
static isArraysEqual(x: any, y: any, ignoreOrder?: boolean): boolean;
static isTwoValueEquals(x: any, y: any, ignoreOrder?: boolean): boolean;
static randomizeArray<T>(array: Array<T>): Array<T>;
static getUnbindValue(value: any): any;
static createCopy(obj: any): any;
static isConvertibleToNumber(value: any): boolean;
static isNumber(value: any): boolean;
static getMaxLength(maxLength: number, surveyLength: number): any;
static getNumberByIndex(index: number, startIndexStr: string): string;
static isCharNotLetterAndDigit(ch: string): boolean;
static isCharDigit(ch: string): boolean;
}
export declare class ValidatorResult {
value: any;
error: SurveyError;
constructor(value: any, error?: SurveyError);
}
/**
* Base SurveyJS validator class.
*/
export declare class SurveyValidator extends Base {
errorOwner: ISurveyErrorOwner;
onAsyncCompleted: (result: ValidatorResult) => void;
constructor();
text: string;
readonly isValidateAllValues: boolean;
readonly locText: LocalizableString;
protected getErrorText(name: string): string;
protected getDefaultErrorText(name: string): string;
validate(value: any, name?: string, values?: any, properties?: any): ValidatorResult;
readonly isRunning: boolean;
readonly isAsync: boolean;
getLocale(): string;
getMarkdownHtml(text: string): string;
getProcessedText(text: string): string;
protected createCustomError(name: string): SurveyError;
toString(): string;
}
export interface IValidatorOwner {
getValidators(): Array<SurveyValidator>;
validatedValue: any;
getValidatorTitle(): string;
getDataFilteredValues(): any;
getDataFilteredProperties(): any;
}
export declare class ValidatorRunner {
onAsyncCompleted: (errors: Array<SurveyError>) => void;
run(owner: IValidatorOwner): Array<SurveyError>;
}
/**
* Validate numeric values.
*/
export declare class NumericValidator extends SurveyValidator {
constructor(minValue?: number, maxValue?: number);
getType(): string;
validate(value: any, name?: string, values?: any, properties?: any): ValidatorResult;
protected getDefaultErrorText(name: string): any;
/**
* The minValue property.
*/
minValue: number;
/**
* The maxValue property.
*/
maxValue: number;
}
/**
* Validate text values.
*/
export declare class TextValidator extends SurveyValidator {
constructor(minLength?: number, maxLength?: number, allowDigits?: boolean);
getType(): string;
validate(value: any, name?: string, values?: any, properties?: any): ValidatorResult;
protected getDefaultErrorText(name: string): any;
/**
* The minLength property.
*/
minLength: number;
/**
* The maxLength property.
*/
maxLength: number;
/**
* The allowDigits property.
*/
allowDigits: boolean;
}
export declare class AnswerCountValidator extends SurveyValidator {
constructor(minCount?: number, maxCount?: number);
getType(): string;
validate(value: any, name?: string, values?: any, properties?: any): ValidatorResult;
protected getDefaultErrorText(name: string): string;
/**
* The minCount property.
*/
minCount: number;
/**
* The maxCount property.
*/
maxCount: number;
}
/**
* Use it to validate the text by regular expressions.
*/
export declare class RegexValidator extends SurveyValidator {
constructor(regex?: string);
getType(): string;
validate(value: any, name?: string, values?: any, properties?: any): ValidatorResult;
/**
* The regex property.
*/
regex: string;
}
/**
* Validate e-mail address in the text input
*/
export declare class EmailValidator extends SurveyValidator {
constructor();
getType(): string;
validate(value: any, name?: string, values?: any, properties?: any): ValidatorResult;
protected getDefaultErrorText(name: string): any;
}
/**
* Show error if expression returns false
*/
export declare class ExpressionValidator extends SurveyValidator {
constructor(expression?: string);
getType(): string;
readonly isValidateAllValues: boolean;
readonly isAsync: boolean;
readonly isRunning: boolean;
validate(value: any, name?: string, values?: any, properties?: any): ValidatorResult;
protected generateError(res: boolean, value: any): ValidatorResult;
protected getDefaultErrorText(name: string): any;
protected ensureConditionRunner(): boolean;
/**
* The expression property.
*/
expression: string;
}
/**
* Array of ItemValue is used in checkox, dropdown and radiogroup choices, matrix columns and rows.
* It has two main properties: value and text. If text is empty, value is used for displaying.
* The text property is localizable and support markdown.
*/
export declare class ItemValue extends Base {
[index: string]: any;
static Separator: string;
static createArray(locOwner: ILocalizableOwner): Array<ItemValue>;
static setupArray(items: Array<ItemValue>, locOwner: ILocalizableOwner): void;
static setData(items: Array<ItemValue>, values: Array<any>): void;
static getData(items: Array<ItemValue>): any;
static getItemByValue(items: Array<ItemValue>, val: any): ItemValue;
static getTextOrHtmlByValue(items: Array<ItemValue>, val: any): string;
static locStrsChanged(items: Array<ItemValue>): void;
static runConditionsForItems(items: Array<ItemValue>, filteredItems: Array<ItemValue>, runner: ConditionRunner, values: any, properties: any, useItemExpression?: boolean): boolean;
static runEnabledConditionsForItems(items: Array<ItemValue>, runner: ConditionRunner, values: any, properties: any): boolean;
ownerPropertyName: string;
constructor(value: any, text?: string, typeName?: string);
onCreating(): any;
getType(): string;
getLocale(): string;
readonly locText: LocalizableString;
setLocText(locText: LocalizableString): void;
locOwner: ILocalizableOwner;
value: any;
readonly hasText: boolean;
text: string;
readonly calculatedText: string;
getData(): any;
toJSON(): any;
setData(value: any): void;
visibleIf: string;
readonly isVisible: boolean;
setIsVisible(val: boolean): void;
readonly isEnabled: any;
setIsEnabled(val: boolean): void;
addUsedLocales(locales: Array<string>): void;
protected onPropertyValueChanged(name: string, oldValue: any, newValue: any): void;
protected getConditionRunner(isVisible: boolean): ConditionRunner;
}
export interface ISurveyData {
getValue(name: string): any;
setValue(name: string, newValue: any, locNotification: any, allowNotifyValueChanged?: boolean): any;
getVariable(name: string): any;
setVariable(name: string, newValue: any): void;
getComment(name: string): string;
setComment(name: string, newValue: string, locNotification: any): any;
getAllValues(): any;
getFilteredValues(): any;
getFilteredProperties(): any;
}
export interface ITextProcessor {
processText(text: string, returnDisplayValue: boolean): string;
processTextEx(text: string, returnDisplayValue: boolean, doEncoding: boolean): any;
}
export interface ISurveyErrorOwner extends ILocalizableOwner {
getErrorCustomText(text: string, error: SurveyError): string;
}
export interface ISurvey extends ITextProcessor, ISurveyErrorOwner {
currentPage: IPage;
pages: Array<IPage>;
getCss(): any;
isPageStarted(page: IPage): boolean;
pageVisibilityChanged(page: IPage, newValue: boolean): any;
panelVisibilityChanged(panel: IPanel, newValue: boolean): any;
questionVisibilityChanged(question: IQuestion, newValue: boolean): any;
questionsOrder: string;
questionCreated(question: IQuestion): any;
questionAdded(question: IQuestion, index: number, parentPanel: any, rootPanel: any): any;
panelAdded(panel: IElement, index: number, parentPanel: any, rootPanel: any): any;
questionRemoved(question: IQuestion): any;
panelRemoved(panel: IElement): any;
questionRenamed(question: IQuestion, oldName: string, oldValueName: string): any;
validateQuestion(question: IQuestion): SurveyError;
validatePanel(panel: IPanel): SurveyError;
hasVisibleQuestionByValueName(valueName: string): boolean;
questionCountByValueName(valueName: string): number;
processHtml(html: string): string;
getSurveyMarkdownHtml(element: Base, text: string): string;
isDisplayMode: boolean;
isDesignMode: boolean;
areInvisibleElementsShowing: boolean;
isLoadingFromJson: boolean;
isUpdateValueTextOnTyping: boolean;
requiredText: string;
beforeSettingQuestionErrors(question: IQuestion, errors: Array<SurveyError>): void;
questionTitlePattern: string;
getUpdatedQuestionTitle(question: IQuestion, title: string): string;
questionStartIndex: string;
questionTitleLocation: string;
questionDescriptionLocation: string;
questionErrorLocation: string;
storeOthersAsComment: boolean;
maxTextLength: number;
maxOthersLength: number;
clearValueOnDisableItems: boolean;
uploadFiles(name: string, files: File[], uploadingCallback: (status: string, data: any) => any): any;
downloadFile(name: string, content: string, callback: (status: string, data: any) => any): any;
clearFiles(name: string, value: any, fileName: string, clearCallback: (status: string, data: any) => any): any;
updateChoicesFromServer(question: IQuestion, choices: Array<any>, serverResult: any): Array<any>;
updateQuestionCssClasses(question: IQuestion, cssClasses: any): any;
updatePanelCssClasses(panel: IPanel, cssClasses: any): any;
updatePageCssClasses(panel: IPanel, cssClasses: any): any;
afterRenderQuestion(question: IQuestion, htmlElement: any): any;
afterRenderQuestionInput(question: IQuestion, htmlElement: any): any;
afterRenderPanel(panel: IElement, htmlElement: any): any;
afterRenderPage(htmlElement: any): any;
getQuestionByValueNameFromArray(valueName: string, name: string, index: number): IQuestion;
matrixRowAdded(question: IQuestion, row: any): any;
matrixBeforeRowAdded(options: {
question: IQuestion;
canAddRow: boolean;
}): any;
matrixRowRemoved(question: IQuestion, rowIndex: number, row: any): any;
matrixAllowRemoveRow(question: IQuestion, rowIndex: number, row: any): boolean;
matrixCellCreated(question: IQuestion, options: any): any;
matrixAfterCellRender(question: IQuestion, options: any): any;
matrixCellValueChanged(question: IQuestion, options: any): any;
matrixCellValueChanging(question: IQuestion, options: any): any;
matrixCellValidate(question: IQuestion, options: any): SurveyError;
dynamicPanelAdded(question: IQuestion): any;
dynamicPanelRemoved(question: IQuestion, panelIndex: number, panel: IPanel): any;
dynamicPanelItemValueChanged(question: IQuestion, options: any): any;
dragAndDropAllow(options: any): boolean;
scrollElementToTop(element: ISurveyElement, question: IQuestion, page: IPage, id: string): any;
}
export interface ISurveyImpl {
geSurveyData(): ISurveyData;
getSurvey(): ISurvey;
getTextProcessor(): ITextProcessor;
}
export interface IConditionRunner {
runCondition(values: HashTable<any>, properties: HashTable<any>): any;
}
export interface ISurveyElement {
name: string;
isVisible: boolean;
isReadOnly: boolean;
isPage: boolean;
isPanel: boolean;
containsErrors: boolean;
setSurveyImpl(value: ISurveyImpl): any;
onSurveyLoad(): any;
onFirstRendering(): any;
getType(): string;
setVisibleIndex(value: number): number;
locStrsChanged(): any;
delete(): any;
}
export interface IElement extends IConditionRunner, ISurveyElement {
visible: boolean;
parent: IPanel;
renderWidth: string;
width: string;
rightIndent: number;
startWithNewLine: boolean;
getPanel(): IPanel;
getLayoutType(): string;
isLayoutTypeSupported(layoutType: string): boolean;
removeElement(el: IElement): boolean;
onAnyValueChanged(name: string): any;
updateCustomWidgets(): any;
clearIncorrectValues(): any;
clearErrors(): any;
dispose(): void;
}
export interface IQuestion extends IElement, ISurveyErrorOwner {
hasTitle: boolean;
isEmpty(): boolean;
onSurveyValueChanged(newValue: any): any;
updateValueFromSurvey(newValue: any): any;
updateCommentFromSurvey(newValue: any): any;
supportGoNextPageAutomatic(): boolean;
clearUnusedValues(): any;
getDisplayValue(keysAsText: boolean, value: any): any;
getValueName(): string;
clearValue(): any;
clearValueIfInvisible(): any;
isAnswerCorrect(): boolean;
updateValueWithDefaults(): any;
getQuestionFromArray(name: string, index: number): IQuestion;
value: any;
}
export interface IParentElement {
addElement(element: IElement, index: number): any;
removeElement(element: IElement): boolean;
isReadOnly: boolean;
}
export interface IPanel extends ISurveyElement, IParentElement {
getChildrenLayoutType(): string;
getQuestionTitleLocation(): string;
getQuestionStartIndex(): string;
parent: IPanel;
elementWidthChanged(el: IElement): any;
indexOf(el: IElement): number;
elements: Array<IElement>;
}
export interface IPage extends IPanel, IConditionRunner {
isStarted: boolean;
}
/**
* The base class for SurveyJS objects.
*/
export declare class Base {
static commentPrefix: string;
static createItemValue: (item: any, type?: string) => any;
static itemValueLocStrChanged: (arr: Array<any>) => void;
/**
* A static methods that returns true if a value underfined, null, empty string or empty array.
* @param value
*/
isValueEmpty(value: any): boolean;
protected IsPropertyEmpty(value: any): boolean;
protected isLoadingFromJsonValue: boolean;
/**
* Event that raise on property change of the sender object
* sender - the object that owns the property
* options.name - the property name that has been changed
* options.oldValue - old value. Please note, it equals to options.newValue if property is an array
* options.newValue - new value.
*/
onPropertyChanged: Event<(sender: Base, options: any) => any, any>;
/**
* Event that raised on changing property of the ItemValue object.
* sender - the object that owns the property
* options.propertyName - the property name to which ItemValue array is belong. It can be "choices" for dropdown question
* options.obj - the instance of ItemValue object which property has been changed
* options.name - the property of ItemObject that has been changed
* options.oldValue - old value
* options.newValue - new value
*/
onItemValuePropertyChanged: Event<(sender: Base, options: any) => any, any>;
getPropertyValueCoreHandler: (propertiesHash: any, name: string) => any;
setPropertyValueCoreHandler: (propertiesHash: any, name: string, val: any) => void;
createArrayCoreHandler: (propertiesHash: any, name: string) => Array<any>;
constructor();
protected onBaseCreating(): void;
/**
* Returns the type of the object as a string as it represents in the json. It should be in lowcase.
*/
getType(): string;
/**
* Returns the element template name without prefix. Typically it equals to getType().
* @see getType
*/
getTemplate(): string;
/**
* Returns true if the object is loading from Json at the current moment.
*/
readonly isLoadingFromJson: boolean;
startLoadingFromJson(): void;
endLoadingFromJson(): void;
/**
* Deserialized the current object into JSON
* @see fromJSON
*/
toJSON(): any;
/**
* Load object properties and elements. It doesn't reset properties that was changed before and they are not defined in the json parameter.
* @param json the object JSON definition
* @see toJSON
*/
fromJSON(json: any): void;
/**
* Make a clone of the existing object. Create a new object of the same type and load all properties into it.
*/
clone(): Base;
locStrsChanged(): void;
/**
* Returns the property value by name
* @param name property name
*/
getPropertyValue(name: string, defaultValue?: any): any;
protected getPropertyValueCore(propertiesHash: any, name: string): any;
geValueFromHash(): any;
protected setPropertyValueCore(propertiesHash: any, name: string, val: any): void;
iteratePropertiesHash(func: (hash: any, key: any) => void): void;
/**
* set property value
* @param name property name
* @param val new property value
*/
setPropertyValue(name: string, val: any): void;
onPropertyValueChangedCallback(name: string, oldValue: any, newValue: any, sender: Base, arrayChanges: ArrayChanges): void;
itemValuePropertyChanged(item: ItemValue, name: string, oldValue: any, newValue: any): void;
protected onPropertyValueChanged(name: string, oldValue: any, newValue: any): void;
protected propertyValueChanged(name: string, oldValue: any, newValue: any, arrayChanges?: ArrayChanges, target?: Base): void;
/**
* Register a function that will be called on a property value changed.
* @param name the property name
* @param func the function with no parameters that will be called on property changed.
* @param key an optional parameter. If there is already a registered function for this property witht the same key, it will be overwritten.
*/
registerFunctionOnPropertyValueChanged(name: string, func: any, key?: string): void;
/**
* Register a function that will be called on a property value changed from the names list.
* @param names the list of properties names
* @param func the function with no parameters that will be called on property changed.
* @param key an optional parameter. If there is already a registered function for this property witht the same key, it will be overwritten.
*/
registerFunctionOnPropertiesValueChanged(names: Array<string>, func: any, key?: string): void;
/**
* Unregister notification on property value changed
* @param name the property name
* @param key the key with which you have registered the notification for this property. It can be null.
*/
unRegisterFunctionOnPropertyValueChanged(name: string, key?: string): void;
/**
* Unregister notification on property value changed for all properties in the names list.
* @param names the list of properties names
* @param key the key with which you have registered the notification for this property. It can be null.
*/
unRegisterFunctionOnPropertiesValueChanged(names: Array<string>, key?: string): void;
createCustomLocalizableObj(name: string): void;
protected createLocalizableString(name: string, owner: ILocalizableOwner, useMarkDown?: boolean): LocalizableString;
getLocalizableString(name: string): LocalizableString;
getLocalizableStringText(name: string, defaultStr?: string): string;
setLocalizableStringText(name: string, value: string): void;
addUsedLocales(locales: Array<string>): void;
protected AddLocStringToUsedLocales(locStr: LocalizableString, locales: Array<string>): void;
protected createItemValues(name: string): Array<any>;
protected createNewArrayCore(name: string): Array<any>;
protected createNewArray(name: string, onPush?: any, onRemove?: any): Array<any>;
protected getItemValueType(): string;
protected setArray(name: string, src: any[], dest: any[], isItemValues: boolean, onPush: any): void;
protected isTwoValueEquals(x: any, y: any, caseInSensitive?: boolean): boolean;
protected copyCssClasses(dest: any, source: any): void;
}
export declare class ArrayChanges {
index: number;
deleteCount: number;
itemsToAdd: any[];
deletedItems: any[];
constructor(index: number, deleteCount: number, itemsToAdd: any[], deletedItems: any[]);
}
export declare class SurveyError {
text: string;
protected errorOwner: ISurveyErrorOwner;
visible: boolean;
constructor(text?: string, errorOwner?: ISurveyErrorOwner);
readonly locText: LocalizableString;
getText(): string;
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class SurveyElement extends Base implements ISurveyElement {
readOnlyChangedCallback: () => void;
static ScrollElementToTop(elementId: string): boolean;
static GetFirstNonTextElement(elements: any, removeSpaces?: boolean): any;
static FocusElement(elementId: string): boolean;
static CreateDisabledDesignElements: boolean;
disableDesignActions: boolean;
constructor(name: string);
setSurveyImpl(value: ISurveyImpl): void;
protected readonly surveyImpl: ISurveyImpl;
readonly data: ISurveyData;
/**
* Returns the survey object.
*/
readonly survey: ISurvey;
/**
* Returns true if the question in design mode right now.
*/
readonly isDesignMode: boolean;
isContentElement: boolean;
readonly areInvisibleElementsShowing: boolean;
readonly isVisible: boolean;
readonly isReadOnly: boolean;
/**
* Set it to true to make an element question/panel/page readonly.
* @see enableIf
* @see isReadOnly
*/
readOnly: boolean;
protected onReadOnlyChanged(): void;
updateElementCss(): void;
readonly isLoadingFromJson: boolean;
/**
* This is the identifier of a survey element - question or panel.
* @see valueName
*/
name: string;
protected onNameChanged(oldValue: string): void;
/**
* The list of errors. It is created by callig hasErrors functions
* @see hasErrors
*/
errors: Array<SurveyError>;
/**
* Returns true if a question or a container (panel/page) or their chidren have an error.
* The value can be out of date. hasErrors function should be called to get the correct value.
*/
readonly containsErrors: boolean;
updateContainsErrors(): void;
protected getContainsErrors(): boolean;
getElementsInDesign(includeHidden?: boolean): Array<IElement>;
selectedElementInDesign: SurveyElement;
updateCustomWidgets(): void;
onSurveyLoad(): void;
onFirstRendering(): void;
endLoadingFromJson(): void;
setVisibleIndex(index: number): number;
readonly isPage: boolean;
/**
* Return false if it is not panel.
*/
readonly isPanel: boolean;
delete(): void;
protected removeSelfFromList(list: Array<any>): void;
protected readonly textProcessor: ITextProcessor;
protected getProcessedHtml(html: string): string;
protected onSetData(): void;
protected getPage(parent: IPanel): IPage;
protected moveToBase(parent: IPanel, container: IPanel, insertBefore?: any): boolean;
protected setPage(parent: IPanel, val: IPage): void;
}
export declare class Event<T extends Function, Options> {
protected callbacks: Array<T>;
readonly isEmpty: boolean;
fire(sender: any, options: Options): void;
clear(): void;
add(func: T): void;
remove(func: T): void;
hasFunc(func: T): boolean;
}
/**
* The calculated value is a way to define the variable in Survey Creator.
* It has two main properties: name and expression. Based on expression the value read-only property is automatically calculated.
* The name property should be unique though all calcualted values.
* It uses survey.getVariable/seruvey.setVariable functions to get/set its value. The class do not store its value internally.
* You may set includeIntoResult property to true to store this calculated value into survey result.
*/
export declare class CalculatedValue extends Base {
constructor(name?: string, expression?: string);
setOwner(data: ISurveyData): void;
getType(): string;
/**
* The calculated value name. It should be non empty and unique.
*/
name: string;
/**
* Set this property to true to include the non-empty calculated value into survey result, survey.data property.
*/
includeIntoResult: boolean;
/**
* The Expression that used to calculate the value. You may use standard operators like +, -, * and /, squares (). Here is the example of accessing the question value {questionname}.
* <br/>Example: "({quantity} * {price}) * (100 - {discount}) / 100"
*/
expression: string;
locCalculation(): void;
unlocCalculation(): void;
resetCalculation(): void;
doCalculation(calculatedValues: Array<CalculatedValue>, values: HashTable<any>, properties: HashTable<any>): void;
runExpression(values: HashTable<any>, properties: HashTable<any>): void;
readonly value: any;
protected setValue(val: any): void;
}
export declare class AnswerRequiredError extends SurveyError {
text: string;
constructor(text?: string, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class OneAnswerRequiredError extends SurveyError {
text: string;
constructor(text?: string, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class RequreNumericError extends SurveyError {
text: string;
constructor(text?: string, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class ExceedSizeError extends SurveyError {
constructor(maxSize: number, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
getDefaultText(): string;
}
export declare class WebRequestError extends SurveyError {
status: string;
response: string;
constructor(status: string, response: string, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class WebRequestEmptyError extends SurveyError {
text: string;
constructor(text: string, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class OtherEmptyError extends SurveyError {
text: string;
constructor(text: string, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class UploadingFileError extends SurveyError {
text: string;
constructor(text: string, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class RequiredInAllRowsError extends SurveyError {
text: string;
constructor(text: string, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class MinRowCountError extends SurveyError {
minRowCount: number;
constructor(minRowCount: number, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class KeyDuplicationError extends SurveyError {
text: string;
constructor(text: string, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class CustomError extends SurveyError {
text: string;
constructor(text: string, errorOwner?: ISurveyErrorOwner);
getErrorType(): string;
}
export interface ILocalizableOwner {
getLocale(): string;
getMarkdownHtml(text: string): string;
getProcessedText(text: string): string;
}
/**
* The class represents the string that supports multi-languages and markdown.
* It uses in all objects where support for multi-languages and markdown is required.
*/
export declare class LocalizableString {
owner: ILocalizableOwner;
useMarkdown: boolean;
static SerializeAsObject: boolean;
static defaultLocale: string;
onGetTextCallback: (str: string) => string;
onStrChanged: () => void;
sharedData: LocalizableString;
constructor(owner: ILocalizableOwner, useMarkdown?: boolean);
readonly locale: string;
strChanged(): void;
text: string;
readonly calculatedText: string;
readonly pureText: string;
readonly hasHtml: boolean;
readonly html: string;
readonly isEmpty: boolean;
readonly textOrHtml: string;
readonly renderedHtml: string;
getLocaleText(loc: string): string;
setLocaleText(loc: string, value: string): void;
hasNonDefaultText(): boolean;
getLocales(): Array<string>;
getJson(): any;
setJson(value: any): void;
equals(obj: any): boolean;
onChanged(): void;
protected onCreating(): void;
}
export declare class ExpressionItem extends Base implements ILocalizableOwner {
locOwner: ILocalizableOwner;
constructor(expression?: string);
getType(): string;
runCondition(values: any, properties: any): boolean;
/**
* The expression property. If this expression returns true, then survey will use html property to show on complete page.
*/
expression: string;
readonly locHtml: LocalizableString;
getLocale(): string;
getMarkdownHtml(text: string): string;
getProcessedText(text: string): string;
}
/**
* A class that contains expression and html propeties. It uses in survey.completedHtmlOnCondition array.
* If the expression returns true then html of this item uses instead of survey.completedHtml property
* @see SurveyModel.completedHtmlOnCondition
* @see SurveyModel.completedHtml
*/
export declare class HtmlConditionItem extends ExpressionItem {
constructor(expression?: string, html?: string);
getType(): string;
/**
* The html that shows on completed ('Thank you') page. The expression should return true
* @see expression
*/
html: string;
readonly locHtml: LocalizableString;
}
/**
* A class that contains expression and url propeties. It uses in survey.navigateToUrlOnCondition array.
* If the expression returns true then url of this item uses instead of survey.navigateToUrl property
* @see SurveyModel.navigateToUrl
*/
export declare class UrlConditionItem extends ExpressionItem {
constructor(expression?: string, url?: string);
getType(): string;
/**
* The url that survey navigates to on completing the survey. The expression should return true
* @see expression
*/
url: string;
readonly locUrl: LocalizableString;
}
/**
* A definition for filling choices for checkbox, dropdown and radiogroup questions from resfull services.
* The run method call a restfull service and results can be get on getResultCallback.
*/
export declare class ChoicesRestfull extends Base {
static EncodeParameters: boolean;
static clearCache(): void;
static onBeforeSendRequest: (sender: ChoicesRestfull, options: {
request: XMLHttpRequest;
}) => void;
protected processedUrl: string;
protected processedPath: string;
getResultCallback: (items: Array<ItemValue>) => void;
beforeSendRequestCallback: () => void;
updateResultCallback: (items: Array<ItemValue>, serverResult: any) => Array<ItemValue>;
getItemValueCallback: (item: any) => any;
error: SurveyError;
owner: IQuestion;
constructor();
run(textProcessor?: ITextProcessor): void;
readonly isRunning: boolean;
readonly isWaitingForParameters: boolean;
protected useChangedItemsResults(): boolean;
protected parseResponse(response: any): any;
protected sendRequest(): void;
getType(): string;
readonly isEmpty: boolean;
getCustomPropertiesNames(): Array<string>;
setData(json: any): void;
getData(): any;
url: string;
path: string;
valueName: string;
titleName: string;
allowEmptyResponse: boolean;
readonly itemValueType: string;
clear(): void;
protected beforeSendRequest(): void;
protected onLoad(result: any): void;
}
export declare class FunctionFactory {
static Instance: FunctionFactory;
register(name: string, func: (params: any[]) => any, isAsync?: boolean): void;
unregister(name: string): void;
hasFunction(name: string): boolean;
isAsyncFunction(name: string): boolean;
clear(): void;
getAll(): Array<string>;
run(name: string, params: any[], properties?: HashTable<any>): any;
}
export declare var registerFunction: (name: string, func: (params: any[]) => any, isAsync?: boolean) => void;
export declare class ExpressionRunnerBase {
constructor(expression: string);
expression: string;
getVariables(): Array<string>;
hasFunction(): boolean;
readonly isAsync: boolean;
canRun(): boolean;
protected runCore(values: HashTable<any>, properties?: HashTable<any>): any;
protected doOnComplete(res: any): void;
}
export declare class ConditionRunner extends ExpressionRunnerBase {
onRunComplete: (result: boolean) => void;
run(values: HashTable<any>, properties?: HashTable<any>): boolean;
protected doOnComplete(res: any): void;
}
export declare class ExpressionRunner extends ExpressionRunnerBase {
onRunComplete: (result: any) => void;
run(values: HashTable<any>, properties?: HashTable<any>): any;
protected doOnComplete(res: any): void;
}
export declare abstract class Operand {
toString(func?: (op: Operand) => string): string;
abstract getType(): string;
abstract evaluate(processValue?: ProcessValue): any;
abstract setVariables(variables: Array<string>): any;
hasFunction(): boolean;
hasAsyncFunction(): boolean;
addToAsyncList(list: Array<FunctionOperand>): void;
}
export declare class BinaryOperand extends Operand {
constructor(operatorName: string, left?: any, right?: any, isArithmeticOp?: boolean);
getType(): string;
readonly isArithmetic: boolean;
readonly isConjunction: boolean;
readonly conjunction: string;
readonly operator: string;
readonly leftOperand: any;
readonly rightOperand: any;
evaluate(processValue?: ProcessValue): any;
toString(func?: (op: Operand) => string): string;
setVariables(variables: Array<string>): void;
hasFunction(): boolean;
hasAsyncFunction(): boolean;
addToAsyncList(list: Array<FunctionOperand>): void;
}
export declare class UnaryOperand extends Operand {
constructor(expressionValue: Operand, operatorName: string);
readonly operator: string;
readonly expression: Operand;
getType(): string;
toString(func?: (op: Operand) => string): string;
evaluate(processValue?: ProcessValue): boolean;
setVariables(variables: Array<string>): void;
}
export declare class ArrayOperand extends Operand {
values: Array<Operand>;
constructor(values: Array<Operand>);
getType(): string;
toString(func?: (op: Operand) => string): string;
evaluate(processValue?: ProcessValue): Array<any>;
setVariables(variables: Array<string>): void;
hasFunction(): boolean;
hasAsyncFunction(): boolean;
addToAsyncList(list: Array<FunctionOperand>): void;
}
export declare class Const extends Operand {
constructor(value: any);
getType(): string;
toString(func?: (op: Operand) => string): string;
readonly correctValue: any;
evaluate(): any;
setVariables(variables: Array<string>): void;
protected getCorrectValue(value: any): any;
}
export declare class Variable extends Const {
constructor(variableName: string);
getType(): string;
toString(func?: (op: Operand) => string): string;
readonly variable: string;
evaluate(processValue?: ProcessValue): any;
setVariables(variables: Array<string>): void;
}
export declare class FunctionOperand extends Operand {
onAsyncReady: () => void;
constructor(origionalValue: string, parameters: ArrayOperand);
getType(): string;
evaluateAsync(processValue: ProcessValue): void;
evaluate(processValue?: ProcessValue): any;
toString(func?: (op: Operand) => string): string;
setVariables(variables: Array<string>): void;
readonly isReady: boolean;
hasFunction(): boolean;
hasAsyncFunction(): boolean;
addToAsyncList(list: Array<FunctionOperand>): void;
}
export declare class OperandMaker {
static throwInvalidOperatorError(op: string): void;
static safeToString(operand: Operand, func: (op: Operand) => string): string;
static toOperandString(value: string): string;
static isSpaceString(str: string): boolean;
static isNumeric(value: string): boolean;
static isBooleanValue(value: string): boolean;
static unaryFunctions: HashTable<Function>;
static binaryFunctions: HashTable<Function>;
static operatorToString(operatorName: string): string;
static signs: HashTable<string>;
}
export declare class ConditionsParserError {
at: number;
code: string;
constructor(at: number, code: string);
}
export declare class ConditionsParser {
createCondition(text: string): Operand;
parseExpression(text: string): Operand;
readonly error: ConditionsParserError;
}
export interface ValueCore {
hasValue: boolean;
value: any;
}
export declare class ProcessValue {
values: HashTable<any>;
properties: HashTable<any>;
constructor();
getFirstName(text: string, obj?: any): string;
hasValue(text: string, values?: HashTable<any>): boolean;
setValue(obj: any, text: string, value: any): void;
getValue(text: string, values?: HashTable<any>): any;
}
export interface IObject {
[key: string]: any;
}
export declare class JsonObjectProperty implements IObject {
name: string;
static getItemValuesDefaultValue: (val: any) => any;
[key: string]: any;
isSerializable: boolean;
isLightSerializable: boolean;
isCustom: boolean;
isDynamicChoices: boolean;
className: string;
alternativeName: string;
classNamePart: string;
baseClassName: string;
defaultValueValue: any;
serializationProperty: string;
displayName: string;
category: string;
categoryIndex: number;
visibleIndex: number;
showMode: string;
maxLength: number;
maxValue: any;
minValue: any;
layout: string;
onGetValue: (obj: any) => any;
onSetValue: (obj: any, value: any, jsonConv: JsonObject) => any;
visibleIf: (obj: any) => boolean;
constructor(name: string, isRequired?: boolean);
type: string;
isArray: boolean;
isRequired: boolean;
readonly hasToUseGetValue: string | ((obj: any) => any);
defaultValue: any;
isDefaultValue(value: any): boolean;
getValue(obj: any): any;
getPropertyValue(obj: any): any;
readonly hasToUseSetValue: string | ((obj: any, value: any, jsonConv: JsonObject) => any);
setValue(obj: any, value: any, jsonConv: JsonObject): void;
getObjType(objType: string): string;
getClassName(className: string): string;
/**
* Depricated, please use getChoices
*/
readonly choices: Array<any>;
readonly hasChoices: boolean;
getChoices(obj: any, choicesCallback?: any): Array<any>;
setChoices(value: Array<any>, valueFunc: () => Array<any>): void;
getBaseValue(): string;
setBaseValue(val: any): void;
readOnly: boolean;
isVisible(layout: string, obj?: any): boolean;
visible: boolean;
isLocalizable: boolean;
mergeWith(prop: JsonObjectProperty): void;
addDependedProperty(name: string): void;
getDependedProperties(): Array<string>;
}
export declare class CustomPropertiesCollection {
static addProperty(className: string, property: any): void;
static removeProperty(className: string, propertyName: string): void;
static addClass(className: string, parentClassName: string): void;
static getProperties(className: string): Array<any>;
static createProperties(obj: any): void;
}
export declare class JsonMetadataClass {
name: string;
creator: (json?: any) => any;
parentName: string;
static requiredSymbol: string;
static typeSymbol: string;
properties: Array<JsonObjectProperty>;
constructor(name: string, properties: Array<any>, creator?: (json?: any) => any, parentName?: string);
find(name: string): JsonObjectProperty;
createProperty(propInfo: any): JsonObjectProperty;
}
export declare class JsonMetadata {
addClass(name: string, properties: Array<any>, creator?: (json?: any) => any, parentName?: string): JsonMetadataClass;
removeClass(name: string): void;
overrideClassCreatore(name: string, creator: () => any): void;
overrideClassCreator(name: string, creator: () => any): void;
getProperties(className: string): Array<JsonObjectProperty>;
getPropertiesByObj(obj: any): Array<JsonObjectProperty>;
findProperty(className: string, propertyName: string): JsonObjectProperty;
findProperties(className: string, propertyNames: Array<string>): Array<JsonObjectProperty>;
createClass(name: string, json?: any): any;
getChildrenClasses(name: string, canBeCreated?: boolean): Array<JsonMetadataClass>;
getRequiredProperties(name: string): Array<string>;
addProperties(className: string, propertiesInfos: Array<any>): void;
addProperty(className: string, propertyInfo: any): void;
removeProperty(className: string, propertyName: string): boolean;
findClass(name: string): JsonMetadataClass;
isDescendantOf(className: string, ancestorClassName: string): boolean;
addAlterNativeClassName(name: string, alternativeName: string): void;
}
export declare class JsonError {
type: string;
message: string;
description: string;
at: Number;
constructor(type: string, message: string);
getFullDescription(): string;
}
export declare class JsonUnknownPropertyError extends JsonError {
propertyName: string;
className: string;
constructor(propertyName: string, className: string);
}
export declare class JsonMissingTypeErrorBase extends JsonError {
baseClassName: string;
type: string;
message: string;
constructor(baseClassName: string, type: string, message: string);
}
export declare class JsonMissingTypeError extends JsonMissingTypeErrorBase {
propertyName: string;
baseClassName: string;
constructor(propertyName: string, baseClassName: string);
}
export declare class JsonIncorrectTypeError extends JsonMissingTypeErrorBase {
propertyName: string;
baseClassName: string;
constructor(propertyName: string, baseClassName: string);
}
export declare class JsonRequiredPropertyError extends JsonError {
propertyName: string;
className: string;
constructor(propertyName: string, className: string);
}
export declare class JsonObject {
static readonly metaData: JsonMetadata;
errors: JsonError[];
lightSerializing: boolean;
toJsonObject(obj: any, storeDefaults?: boolean): any;
toObject(jsonObj: any, obj: any): void;
toObjectCore(jsonObj: any, obj: any): void;
protected toJsonObjectCore(obj: any, property: JsonObjectProperty, storeDefaults?: boolean): any;
valueToJson(obj: any, result: any, property: JsonObjectProperty, storeDefaults?: boolean): void;
protected valueToObj(value: any, obj: any, property: JsonObjectProperty): void;
}
export declare var Serializer: JsonMetadata;
export interface IMatrixDropdownData {
value: any;
onRowChanged(row: MatrixDropdownRowModelBase, columnName: string, newRowValue: any, isDeletingValue: boolean): void;
onRowChanging(row: MatrixDropdownRowModelBase, columnName: string, rowValue: any): any;
getRowIndex(row: MatrixDropdownRowModelBase): number;
validateCell(row: MatrixDropdownRowModelBase, columnName: string, rowValue: any): SurveyError;
columns: Array<MatrixDropdownColumn>;
createQuestion(row: MatrixDropdownRowModelBase, column: MatrixDropdownColumn): Question;
getLocale(): string;
getMarkdownHtml(text: string): string;
getProcessedText(text: string): string;
getSharedQuestionByName(columnName: string, row: MatrixDropdownRowModelBase): Question;
onTotalValueChanged(): any;
getSurvey(): ISurvey;
}
export interface IMatrixColumnOwner extends ILocalizableOwner {
getRequiredText(): string;
onColumnPropertiesChanged(column: MatrixDropdownColumn): void;
onShowInMultipleColumnsChanged(column: MatrixDropdownColumn): void;
getCellType(): string;
onColumnCellTypeChanged(column: MatrixDropdownColumn): void;
}
export declare var matrixDropdownColumnTypes: {
dropdown: {
properties: string[];
onCellQuestionUpdate: (cellQuestion: any, column: any, question: any, data: any) => void;
};
checkbox: {
properties: string[];
onCellQuestionUpdate: (cellQuestion: any, column: any, question: any, data: any) => void;
};
radiogroup: {
properties: string[];
onCellQuestionUpdate: (cellQuestion: any, column: any, question: any, data: any) => void;
};
text: {
properties: string[];
onCellQuestionUpdate: (cellQuestion: any, column: any, question: any, data: any) => void;
};
comment: {
properties: string[];
onCellQuestionUpdate: (cellQuestion: any, column: any, question: any, data: any) => void;
};
boolean: {
properties: string[];
onCellQuestionUpdate: (cellQuestion: any, column: any, question: any, data: any) => void;
};
expression: {
properties: string[];
onCellQuestionUpdate: (cellQuestion: any, column: any, question: any, data: any) => void;
};
rating: {
properties: string[];
};
};
export declare class MatrixDropdownColumn extends Base implements ILocalizableOwner {
static getColumnTypes(): Array<string>;
constructor(name: string, title?: string);
getDynamicPropertyName(): string;
getDynamicType(): string;
getDynamicProperties(): Array<string>;
colOwner: IMatrixColumnOwner;
locStrsChanged(): void;
addUsedLocales(locales: Array<string>): void;
readonly index: number;
setIndex(val: number): void;
getType(): string;
cellType: string;
readonly templateQuestion: Question;
readonly value: string;
readonly isVisible: boolean;
setIsVisible(newVal: boolean): void;
hasVisibleCell: boolean;
name: string;
title: string;
readonly locTitle: LocalizableString;
readonly fullTitle: string;
isRequired: boolean;
requiredErrorText: string;
readonly locRequiredErrorText: LocalizableString;
readOnly: boolean;
hasOther: boolean;
visibleIf: string;
enableIf: string;
requiredIf: string;
showInMultipleColumns: boolean;
readonly isSupportMultipleColumns: boolean;
readonly isShowInMultipleColumns: boolean;
readonly hasCondition: boolean;
validators: Array<SurveyValidator>;
totalType: string;
totalExpression: string;
readonly hasTotal: boolean;
totalFormat: string;
readonly locTotalFormat: LocalizableString;
totalMaximumFractionDigits: number;
totalMinimumFractionDigits: number;
totalDisplayStyle: string;
totalCurrency: string;
minWidth: string;
width: string;
colCount: number;
getLocale(): string;
getMarkdownHtml(text: string): string;
getProcessedText(text: string): string;
createCellQuestion(data: any): Question;
updateCellQuestion(cellQuestion: Question, data: any): void;
defaultCellTypeChanged(): void;
protected calcCellQuestionType(): string;
protected updateTemplateQuestion(): void;
protected createNewQuestion(cellType: string): Question;
protected setQuestionProperties(question: Question): void;
protected propertyValueChanged(name: string, oldValue: any, newValue: any): void;
}
export declare class MatrixDropdownCell {
column: MatrixDropdownColumn;
row: MatrixDropdownRowModelBase;
data: IMatrixDropdownData;
constructor(column: MatrixDropdownColumn, row: MatrixDropdownRowModelBase, data: IMatrixDropdownData);
locStrsChanged(): void;
protected createQuestion(column: MatrixDropdownColumn, row: MatrixDropdownRowModelBase, data: IMatrixDropdownData): Question;
readonly question: Question;
value: any;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
readonly hasCondition: boolean;
}
export declare class MatrixDropdownTotalCell extends MatrixDropdownCell {
column: MatrixDropdownColumn;
row: MatrixDropdownRowModelBase;
data: IMatrixDropdownData;
constructor(column: MatrixDropdownColumn, row: MatrixDropdownRowModelBase, data: IMatrixDropdownData);
protected createQuestion(column: MatrixDropdownColumn, row: MatrixDropdownRowModelBase, data: IMatrixDropdownData): Question;
locStrsChanged(): void;
updateCellQuestion(): void;
getTotalExpression(): string;
}
export declare class MatrixDropdownRowModelBase implements ISurveyData, ISurveyImpl, ILocalizableOwner, ITextProcessor {
static RowVariableName: string;
static OwnerVariableName: string;
static IndexVariableName: string;
protected data: IMatrixDropdownData;
cells: Array<MatrixDropdownCell>;
constructor(data: IMatrixDropdownData, value: any);
readonly id: string;
readonly rowName: any;
value: any;
readonly locText: LocalizableString;
getAllValues(): any;
getFilteredValues(): any;
getFilteredProperties(): any;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
onAnyValueChanged(name: string): void;
getDataValueCore(valuesHash: any, key: string): any;
getValue(name: string): any;
setValue(name: string, newColumnValue: any): void;
getVariable(name: string): any;
setVariable(name: string, newValue: any): void;
getComment(name: string): string;
setComment(name: string, newValue: string, locNotification: any): void;
readonly isEmpty: boolean;
getQuestionByColumn(column: MatrixDropdownColumn): Question;
getQuestionByColumnName(columnName: string): Question;
protected getSharedQuestionByName(columnName: string): Question;
clearIncorrectValues(val: any): void;
readonly hasCondition: boolean;
getLocale(): string;
getMarkdownHtml(text: string): string;
getProcessedText(text: string): string;
locStrsChanged(): void;
updateCellQuestionOnColumnChanged(column: MatrixDropdownColumn): void;
onQuestionReadOnlyChanged(parentIsReadOnly: boolean): void;
protected updateCellOnColumnChanged(cell: MatrixDropdownCell): void;
protected buildCells(value: any): void;
protected createCell(column: MatrixDropdownColumn): MatrixDropdownCell;
geSurveyData(): ISurveyData;
getSurvey(): ISurvey;
protected readonly rowIndex: number;
getTextProcessor(): ITextProcessor;
processText(text: string, returnDisplayValue: boolean): string;
processTextEx(text: string, returnDisplayValue: boolean): any;
}
export declare class MatrixDropdownTotalRowModel extends MatrixDropdownRowModelBase {
constructor(data: IMatrixDropdownData);
protected createCell(column: MatrixDropdownColumn): MatrixDropdownCell;
setValue(name: string, newValue: any): void;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
protected updateCellOnColumnChanged(cell: MatrixDropdownCell): void;
}
export declare class QuestionMatrixDropdownRenderedCell {
minWidth: string;
width: string;
locTitle: LocalizableString;
cell: MatrixDropdownCell;
row: MatrixDropdownRowModelBase;
question: Question;
isRemoveRow: boolean;
choiceIndex: number;
matrix: QuestionMatrixDropdownModelBase;
constructor();
readonly hasQuestion: boolean;
readonly hasTitle: boolean;
readonly id: number;
readonly showErrorOnTop: boolean;
readonly showErrorOnBottom: boolean;
item: ItemValue;
readonly isChoice: boolean;
readonly choiceValue: any;
readonly isCheckbox: boolean;
readonly isFirstChoice: boolean;
}
export declare class QuestionMatrixDropdownRenderedRow {
cells: Array<QuestionMatrixDropdownRenderedCell>;
constructor();
readonly id: number;
}
export declare class QuestionMatrixDropdownRenderedTable extends Base {
matrix: QuestionMatrixDropdownModelBase;
constructor(matrix: QuestionMatrixDropdownModelBase);
readonly showHeader: boolean;
readonly showFooter: boolean;
readonly hasFooter: boolean;
readonly hasRemoveRows: boolean;
isRequireReset(): boolean;
readonly headerRow: QuestionMatrixDropdownRenderedRow;
readonly footerRow: QuestionMatrixDropdownRenderedRow;
readonly rows: Array<QuestionMatrixDropdownRenderedRow>;
protected build(): void;
onAddedRow(): void;
onRemovedRow(index: number): void;
protected buildHeader(): void;
protected buildFooter(): void;
protected buildRows(): void;
}
/**
* A base class for matrix dropdown and matrix dynamic questions.
*/
export declare class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<MatrixDropdownRowModelBase, MatrixDropdownColumn> implements IMatrixDropdownData {
name: string;
static defaultCellType: string;
static addDefaultColumns(matrix: QuestionMatrixDropdownModelBase): void;
protected isRowChanging: boolean;
columnsChangedCallback: () => void;
updateCellsCallback: () => void;
columnLayoutChangedCallback: () => void;
onRenderedTableResetCallback: () => void;
onRenderedTableCreatedCallback: (table: QuestionMatrixDropdownRenderedTable) => void;
onCellCreatedCallback: (options: any) => void;
onCellValueChangedCallback: (options: any) => void;
protected createColumnValues(): any[];
constructor(name: string);
getType(): string;
readonly isRowsDynamic: boolean;
/**
* Set columnLayout to 'vertical' to place columns vertically and rows horizontally. It makes sense when we have many columns and few rows.
* @see columns
* @see rowCount
*/
columnLayout: string;
columnsLocation: string;
/**
* Returns true if columns are located horizontally
* @see columnLayout
*/
readonly isColumnLayoutHorizontal: boolean;
readonly hasRowText: boolean;
getFooterText(): LocalizableString;
readonly canRemoveRows: boolean;
canRemoveRow(row: MatrixDropdownRowModelBase): boolean;
protected onRowsChanged(): void;
protected onStartRowAddingRemoving(): void;
protected onEndRowAdding(): void;
protected onEndRowRemoving(index: number): void;
protected resetRenderedTable(): void;
readonly renderedTable: QuestionMatrixDropdownRenderedTable;
protected createRenderedTable(): QuestionMatrixDropdownRenderedTable;
protected onMatrixRowCreated(row: MatrixDropdownRowModelBase): void;
/**
* Use this property to change the default cell type.
*/
cellType: string;
/**
* The default column count for radiogroup and checkbox cell types.
*/
columnColCount: number;
/**
* Use this property to set the mimimum column width.
*/
columnMinWidth: string;
/**
* Set this property to true to show the horizontal scroll.
*/
horizontalScroll: boolean;
getRequiredText(): string;
onColumnPropertiesChanged(column: MatrixDropdownColumn): void;
onShowInMultipleColumnsChanged(column: MatrixDropdownColumn): void;
onColumnCellTypeChanged(column: MatrixDropdownColumn): void;
readonly hasFooter: boolean;
protected updateHasFooter(): void;
readonly hasTotal: boolean;
getCellType(): string;
getConditionJson(operator?: string, path?: string): any;
clearIncorrectValues(): void;
clearErrors(): void;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
protected shouldRunColumnExpression(): boolean;
protected runCellsCondition(values: HashTable<any>, properties: HashTable<any>): void;
protected runTotalsCondition(values: HashTable<any>, properties: HashTable<any>): void;
locStrsChanged(): void;
/**
* Returns the column by it's name. Retuns null if a column with this name doesn't exist.
* @param column
*/
getColumnByName(columnName: string): MatrixDropdownColumn;
getColumnName(columnName: string): MatrixDropdownColumn;
/**
* Returns the column width.
* @param column
*/
getColumnWidth(column: MatrixDropdownColumn): string;
/**
* The default choices for dropdown, checkbox and radiogroup cell types.
*/
choices: Array<any>;
/**
* The default options caption for dropdown cell type.
*/
optionsCaption: string;
readonly locOptionsCaption: LocalizableString;
addColumn(name: string, title?: string): MatrixDropdownColumn;
protected getVisibleRows(): Array<MatrixDropdownRowModelBase>;
readonly totalValue: any;
protected getVisibleTotalRow(): MatrixDropdownRowModelBase;
readonly visibleTotalRow: MatrixDropdownRowModelBase;
onSurveyLoad(): void;
/**
* Returns the row value. If the row value is empty, the object is empty: {}.
* @param rowIndex row index from 0 to visible row count - 1.
*/
getRowValue(rowIndex: number): any;
/**
* Set the row value.
* @param rowIndex row index from 0 to visible row count - 1.
* @param rowValue an object {"column name": columnValue,... }
*/
setRowValue(rowIndex: number, rowValue: any): any;
protected generateRows(): Array<MatrixDropdownRowModelBase>;
protected generateTotalRow(): MatrixDropdownRowModelBase;
protected createNewValue(nullOnEmpty?: boolean): any;
protected getRowValueCore(row: MatrixDropdownRowModelBase, questionValue: any, create?: boolean): any;
protected getRowDisplayValue(row: MatrixDropdownRowModelBase, rowValue: any): any;
getPlainData(options?: {
includeEmpty?: boolean;
calculations?: Array<{
propertyName: string;
}>;
}): any;
protected onBeforeValueChanged(val: any): void;
protected setQuestionValue(newValue: any): void;
supportGoNextPageAutomatic(): boolean;
protected getContainsErrors(): boolean;
protected getIsAnswered(): boolean;
hasErrors(fireCallback?: boolean, rec?: any): boolean;
protected getIsRunningValidators(): boolean;
getAllErrors(): Array<SurveyError>;
protected getFirstInputElementId(): string;
protected getFirstErrorInputElementId(): string;
protected getFirstCellQuestion(onError: boolean): Question;
protected onReadOnlyChanged(): void;
createQuestion(row: MatrixDropdownRowModelBase, column: MatrixDropdownColumn): Question;
protected createQuestionCore(row: MatrixDropdownRowModelBase, column: MatrixDropdownColumn): Question;
protected deleteRowValue(newValue: any, row: MatrixDropdownRowModelBase): any;
onAnyValueChanged(name: string): void;
protected isObject(value: any): boolean;
protected onCellValueChanged(row: MatrixDropdownRowModelBase, columnName: string, rowValue: any): void;
validateCell(row: MatrixDropdownRowModelBase, columnName: string, rowValue: any): SurveyError;
onRowChanging(row: MatrixDropdownRowModelBase, columnName: string, rowValue: any): any;
onRowChanged(row: MatrixDropdownRowModelBase, columnName: string, newRowValue: any, isDeletingValue: boolean): void;
getRowIndex(row: MatrixDropdownRowModelBase): number;
getSharedQuestionByName(columnName: string, row: MatrixDropdownRowModelBase): Question;
onTotalValueChanged(): any;
getQuestionFromArray(name: string, index: number): IQuestion;
getSurvey(): ISurvey;
}
export declare class MatrixDropdownRowModel extends MatrixDropdownRowModelBase {
name: string;
constructor(name: string, item: ItemValue, data: IMatrixDropdownData, value: any);
readonly rowName: string;
readonly text: string;
readonly locText: LocalizableString;
}
/**
* A Model for a matrix dropdown question. You may use a dropdown, checkbox, radiogroup, text and comment questions as a cell editors.
*/
export declare class QuestionMatrixDropdownModel extends QuestionMatrixDropdownModelBase implements IMatrixDropdownData {
name: string;
constructor(name: string);
getType(): string;
/**
* Set this property to show it on the first column for the total row.
*/
totalText: string;
readonly locTotalText: LocalizableString;
getFooterText(): LocalizableString;
protected getDisplayValueCore(keysAsText: boolean, value: any): any;
addConditionObjectsByContext(objects: Array<IConditionObject>, context: any): void;
clearIncorrectValues(): void;
clearValueIfInvisible(): void;
protected generateRows(): Array<MatrixDropdownRowModel>;
protected createMatrixRow(item: ItemValue, value: any): MatrixDropdownRowModel;
}
export declare class MatrixDynamicRowModel extends MatrixDropdownRowModelBase {
index: number;
constructor(index: number, data: IMatrixDropdownData, value: any);
readonly rowName: string;
}
/**
* A Model for a matrix dymanic question. You may use a dropdown, checkbox, radiogroup, text and comment questions as a cell editors.
* An end-user may dynamically add/remove rows, unlike in matrix dropdown question.
*/
export declare class QuestionMatrixDynamicModel extends QuestionMatrixDropdownModelBase implements IMatrixDropdownData {
name: string;
constructor(name: string);
getType(): string;
readonly isRowsDynamic: boolean;
/**
* Set it to true, to show a confirmation dialog on removing a row
* @see ConfirmDeleteText
*/
confirmDelete: boolean;
/**
* Set it to a column name and the library shows duplication error, if there are same values in different rows in the column.
* @see keyDuplicationError
*/
keyName: string;
/**
* If it is not empty, then this value is set to every new row, including rows created initially, unless the defaultValue is not empty
* @see defaultValue
* @see defaultValueFromLastRow
*/
defaultRowValue: any;
/**
* Set it to true to copy the value into new added row from the last row. If defaultRowValue is set and this property equals to true,
* then the value for new added row is merging.
* @see defaultValue
* @see defaultRowValue
*/
defaultValueFromLastRow: boolean;
protected isDefaultValueEmpty(): boolean;
protected setDefaultValue(): void;
/**
* The number of rows in the matrix.
* @see minRowCount
* @see maxRowCount
*/
rowCount: number;
/**
* The minimum row count. A user could not delete a row if the rowCount equals to minRowCount
* @see rowCount
* @see maxRowCount
* @see allowAddRows
*/
minRowCount: number;
/**
* The maximum row count. A user could not add a row if the rowCount equals to maxRowCount
* @see rowCount
* @see minRowCount
* @see allowAddRows
*/
maxRowCount: number;
/**
* Set this property to false to disable ability to add new rows. "Add new Row" button becomes invsible in UI
* @see canAddRow
* @see allowRemoveRows
*/
allowAddRows: boolean;
/**
* Set this property to false to disable ability to remove rows. "Remove" row buttons become invsible in UI
* @see canRemoveRows
* @see allowAddRows
*/
allowRemoveRows: boolean;
/**
* Returns true, if a new row can be added.
* @see allowAddRows
* @see maxRowCount
* @see canRemoveRows
* @see rowCount
*/
readonly canAddRow: boolean;
/**
* Returns true, if row can be removed.
* @see minRowCount
* @see canAddRow
* @see rowCount
*/
readonly canRemoveRows: boolean;
canRemoveRow(row: MatrixDropdownRowModelBase): boolean;
/**
* Creates and add a new row.
*/
addRow(): void;
protected hasRowsAsItems(): boolean;
/**
* Removes a row by it's index. If confirmDelete is true, show a confirmation dialog
* @param index a row index, from 0 to rowCount - 1
* @see removeRow
* @see confirmDelete
*/
removeRowUI(value: any): void;
isRequireConfirmOnRowDelete(index: number): boolean;
/**
* Removes a row by it's index.
* @param index a row index, from 0 to rowCount - 1
*/
removeRow(index: number): void;
/**
* Use this property to change the default text showing in the confirmation delete dialog on removing a row.
*/
confirmDeleteText: string;
readonly locConfirmDeleteText: LocalizableString;
/**
* The duplication value error text. Set it to show the text different from the default.
* @see keyName
*/
keyDuplicationError: string;
readonly locKeyDuplicationError: LocalizableString;
/**
* Use this property to change the default value of add row button text.
*/
addRowText: string;
readonly locAddRowText: LocalizableString;
/**
* By default the 'Add Row' button is shown on bottom if columnLayout is horizontal and on top if columnLayout is vertical. <br/>
* You may set it to "top", "bottom" or "topBottom" (to show on top and bottom).
* @see columnLayout
*/
addRowLocation: string;
readonly isAddRowOnTop: boolean;
readonly isAddRowOnBottom: boolean;
/**
* Use this property to change the default value of remove row button text.
*/
removeRowText: string;
readonly locRemoveRowText: LocalizableString;
protected getDisplayValueCore(keysAsText: boolean, value: any): any;
addConditionObjectsByContext(objects: Array<IConditionObject>, context: any): void;
supportGoNextPageAutomatic(): boolean;
readonly hasRowText: boolean;
protected onCheckForErrors(errors: Array<SurveyError>, isOnValueChanged: boolean): void;
hasErrors(fireCallback?: boolean, rec?: any): boolean;
protected generateRows(): Array<MatrixDynamicRowModel>;
protected createMatrixRow(value: any): MatrixDynamicRowModel;
protected onBeforeValueChanged(val: any): void;
protected createNewValue(): any;
protected deleteRowValue(newValue: any, row: MatrixDropdownRowModelBase): any;
protected getRowValueCore(row: MatrixDropdownRowModelBase, questionValue: any, create?: boolean): any;
}
export interface IMatrixData {
onMatrixRowChanged(row: MatrixRowModel): void;
}
export declare class MatrixRowModel {
fullName: string;
protected rowValue: any;
constructor(item: ItemValue, fullName: string, data: IMatrixData, value: any);
readonly name: string;
readonly text: string;
readonly locText: LocalizableString;
value: any;
protected onValueChanged(): void;
}
export interface IMatrixCellsOwner extends ILocalizableOwner {
getRows(): Array<any>;
getColumns(): Array<any>;
}
export declare class MartrixCells {
cellsOwner: IMatrixCellsOwner;
constructor(cellsOwner: IMatrixCellsOwner);
readonly isEmpty: boolean;
setCellText(row: any, column: any, val: string): void;
setDefaultCellText(column: any, val: string): void;
getCellLocText(row: any, column: any): LocalizableString;
getDefaultCellLocText(column: any, val: string): LocalizableString;
getCellDisplayLocText(row: any, column: any): LocalizableString;
getCellText(row: any, column: any): string;
getDefaultCellText(column: any): string;
getCellDisplayText(row: any, column: any): string;
readonly rows: Array<any>;
readonly columns: Array<any>;
getJson(): any;
setJson(value: any): void;
protected createString(): LocalizableString;
}
/**
* A Model for a simple matrix question.
*/
export declare class QuestionMatrixModel extends QuestionMatrixBaseModel<MatrixRowModel, ItemValue> implements IMatrixData, IMatrixCellsOwner {
name: string;
constructor(name: string);
getType(): string;
/**
* Set this property to true, if you want a user to answer all rows.
*/
isAllRowRequired: boolean;
/**
* Returns true, if there is at least one row.
*/
readonly hasRows: boolean;
/**
* Use this property to render items in a specific order: "random" or "initial". Default is "initial".
*/
rowsOrder: string;
getRows(): Array<any>;
getColumns(): Array<any>;
protected getQuizQuestionCount(): number;
protected getCorrectAnswerCount(): number;
protected getVisibleRows(): Array<MatrixRowModel>;
protected sortVisibleRows(array: Array<MatrixRowModel>): Array<MatrixRowModel>;
endLoadingFromJson(): void;
protected processRowsOnSet(newRows: Array<any>): MatrixRowModel[];
/**
* Returns the list of visible rows as model objects.
* @see rowsVisibleIf
*/
readonly visibleRows: Array<MatrixRowModel>;
cells: MartrixCells;
readonly hasCellText: boolean;
setCellText(row: any, column: any, val: string): void;
getCellText(row: any, column: any): string;
setDefaultCellText(column: any, val: string): void;
getDefaultCellText(column: any): string;
getCellDisplayText(row: any, column: any): string;
getCellDisplayLocText(row: any, column: any): LocalizableString;
supportGoNextPageAutomatic(): boolean;
protected onCheckForErrors(errors: Array<SurveyError>, isOnValueChanged: boolean): void;
protected getIsAnswered(): boolean;
protected createMatrixRow(item: ItemValue, fullName: string, value: any): MatrixRowModel;
protected setQuestionValue(newValue: any): void;
protected getDisplayValueCore(keysAsText: boolean, value: any): any;
getPlainData(options?: {
includeEmpty?: boolean;
calculations?: Array<{
propertyName: string;
}>;
}): any;
addConditionObjectsByContext(objects: Array<IConditionObject>, context: any): void;
getConditionJson(operator?: string, path?: string): any;
clearValueIfInvisible(): void;
protected getFirstInputElementId(): string;
onMatrixRowChanged(row: MatrixRowModel): void;
}
export interface IMultipleTextData extends ILocalizableOwner, IPanel {
getSurvey(): ISurvey;
getTextProcessor(): ITextProcessor;
getAllValues(): any;
getMultipleTextValue(name: string): any;
setMultipleTextValue(name: string, value: any): any;
getItemDefaultValue(name: string): any;
getIsRequiredText(): string;
}
export declare class MultipleTextItemModel extends Base implements IValidatorOwner, ISurveyData, ISurveyImpl {
valueChangedCallback: (newValue: any) => void;
constructor(name?: any, title?: string);
getType(): string;
readonly id: string;
/**
* The item name.
*/
name: string;
readonly question: Question;
readonly editor: QuestionTextModel;
protected createEditor(name: string): QuestionTextModel;
addUsedLocales(locales: Array<string>): void;
locStrsChanged(): void;
setData(data: IMultipleTextData): void;
/**
* Set this property to true, to make the item a required. If a user doesn't fill the item then a validation error will be generated.
*/
isRequired: boolean;
/**
* Use this property to change the default input type.
*/
inputType: string;
/**
* Item title. If it is empty, the item name is rendered as title. This property supports markdown.
* @see name
*/
title: string;
readonly locTitle: LocalizableString;
/**
* Returns the text or html for rendering the title.
*/
readonly fullTitle: string;
/**
* The maximim text length. If it is -1, defaul value, then the survey maxTextLength property will be used.
* If it is 0, then the value is unlimited
* @see SurveyModel.maxTextLength
*/
maxLength: number;
getMaxLength(): any;
/**
* The input place holder.
*/
placeHolder: string;
readonly locPlaceHolder: LocalizableString;
/**
* The custom text that will be shown on required error. Use this property, if you do not want to show the default text.
*/
requiredErrorText: string;
readonly locRequiredErrorText: LocalizableString;
/**
* The list of question validators.
*/
validators: Array<SurveyValidator>;
getValidators(): Array<SurveyValidator>;
/**
* The item value.
*/
value: any;
isEmpty(): boolean;
onValueChanged(newValue: any): void;
geSurveyData(): ISurveyData;
getSurvey(): ISurvey;
getTextProcessor(): ITextProcessor;
getValue(name: string): any;
setValue(name: string, value: any): void;
getVariable(name: string): any;
setVariable(name: string, newValue: any): void;
getComment(name: string): string;
setComment(name: string, newValue: string): void;
getAllValues(): any;
getFilteredValues(): any;
getFilteredProperties(): any;
getValidatorTitle(): string;
validatedValue: any;
getDataFilteredValues(): any;
getDataFilteredProperties(): any;
}
/**
* A Model for a multiple text question.
*/
export declare class QuestionMultipleTextModel extends Question implements IMultipleTextData, IPanel {
name: string;
colCountChangedCallback: () => void;
constructor(name: string);
getType(): string;
setSurveyImpl(value: ISurveyImpl): void;
readonly isAllowTitleLeft: boolean;
onSurveyLoad(): void;
setQuestionValue(newValue: any): void;
onSurveyValueChanged(newValue: any): void;
/**
* The list of input items.
*/
items: Array<MultipleTextItemModel>;
/**
* Add a new text item.
* @param name a item name
* @param title a item title (optional)
*/
addItem(name: string, title?: string): MultipleTextItemModel;
getItemByName(name: string): MultipleTextItemModel;
addConditionObjectsByContext(objects: Array<IConditionObject>, context: any): void;
getConditionJson(operator?: string, path?: string): any;
locStrsChanged(): void;
supportGoNextPageAutomatic(): boolean;
/**
* The number of columns. Items are rendred in one line if the value is 0.
*/
colCount: number;
/**
* The default text input size.
*/
itemSize: number;
/**
* Returns the list of rendered rows.
*/
getRows(): Array<any>;
protected onValueChanged(): void;
protected createTextItem(name: string, title: string): MultipleTextItemModel;
protected onItemValueChanged(): void;
protected getIsRunningValidators(): boolean;
hasErrors(fireCallback?: boolean, rec?: any): boolean;
getAllErrors(): Array<SurveyError>;
clearErrors(): void;
protected getContainsErrors(): boolean;
protected getIsAnswered(): boolean;
getMultipleTextValue(name: string): any;
setMultipleTextValue(name: string, value: any): void;
getItemDefaultValue(name: string): any;
getSurvey(): ISurvey;
getTextProcessor(): ITextProcessor;
getAllValues(): any;
getIsRequiredText(): string;
addElement(element: IElement, index: number): void;
removeElement(element: IElement): boolean;
getQuestionTitleLocation(): string;
getQuestionStartIndex(): string;
getChildrenLayoutType(): string;
elementWidthChanged(el: IElement): void;
readonly elements: Array<IElement>;
indexOf(el: IElement): number;
}
export declare class DragDropInfo {
source: IElement;
target: IElement;
nestedPanelDepth: number;
constructor(source: IElement, target: IElement, nestedPanelDepth?: number);
destination: ISurveyElement;
isBottom: boolean;
isEdge: boolean;
}
export declare class QuestionRowModel extends Base {
panel: PanelModelBase;
constructor(panel: PanelModelBase);
readonly elements: Array<IElement>;
visible: boolean;
readonly visibleElements: Array<IElement>;
updateVisible(): void;
addElement(q: IElement): void;
readonly index: number;
}
/**
* A base class for a Panel and Page objects.
*/
export declare class PanelModelBase extends SurveyElement implements IPanel, IConditionRunner, ILocalizableOwner, ISurveyErrorOwner {
name: string;
addElementCallback: (element: IElement) => void;
removeElementCallback: (element: IElement) => void;
onGetQuestionTitleLocation: () => string;
constructor(name?: string);
getType(): string;
setSurveyImpl(value: ISurveyImpl): void;
endLoadingFromJson(): void;
/**
* PanelModel or PageModel title property.
* @description
*/
title: string;
readonly locTitle: LocalizableString;
readonly _showTitle: boolean;
readonly _showDescription: boolean;
/**
* PanelModel or PageModel description property. It renders under title by using smaller font. Unlike the title, description can be empty.
* @see title
*/
description: string;
readonly locDescription: LocalizableString;
locStrsChanged(): void;
/**
* The custom text that will be shown on required error. Use this property, if you do not want to show the default text.
*/
requiredErrorText: string;
readonly locRequiredErrorText: LocalizableString;
getLocale(): string;
getMarkdownHtml(text: string): string;
getProcessedText(text: string): string;
/**
* A parent element. It is always null for the Page object and always not null for the Panel object. Panel object may contain Questions and other Panels.
*/
parent: PanelModelBase;
readonly depth: number;
/**
* An expression that returns true or false. If it returns true the Panel becomes visible and if it returns false the Panel becomes invisible. The library runs the expression on survey start and on changing a question value. If the property is empty then visible property is used.
* @see visible
*/
visibleIf: string;
readonly cssClasses: any;
protected readonly css: any;
/**
* A unique element identificator. It is generated automatically.
*/
id: string;
/**
* Returns true if the current object is Panel. Returns false if the current object is Page (a root Panel).
*/
readonly isPanel: boolean;
getPanel(): IPanel;
getLayoutType(): string;
isLayoutTypeSupported(layoutType: string): boolean;
/**
* Returns the list of all questions located in the Panel/Page, including in the nested Panels.
* @see Question
* @see elements
*/
readonly questions: Array<Question>;
/**
* Returns the question by its name
* @param name the question name
*/
getQuestionByName(name: string): Question;
/**
* Retuns the element by its name. It works recursively.
* @param name the element name
*/
getElementByName(name: string): IElement;
getQuestionByValueName(valueName: string): Question;
/**
* Returns question values on the current page
*/
getValue(): any;
/**
* Returns question comments on the current page
*/
getComments(): any;
/**
* Call this function to remove all question values from the current page/panel, that end-user will not be able to enter.
* For example the value that doesn't exists in a radigroup/dropdown/checkbox choices or matrix rows/columns.
* Please note, this function doesn't clear values for invisible questions or values that doesn't associated with questions.
* @see Question.clearIncorrectValues
*/
clearIncorrectValues(): void;
/**
* Call this function to clear all errors in the panel / page and all its child elements (panels and questions)
*/
clearErrors(): void;
/**
* Returns the list of the elements in the object, Panel/Page. Elements can be questions or panels. The function doesn't return elements in the nested Panels.
*/
readonly elements: Array<IElement>;
getElementsInDesign(includeHidden?: boolean): Array<IElement>;
/**
* Returns true if the current element belongs to the Panel/Page. It looks in nested Panels as well.
* @param element
* @see PanelModel
*/
containsElement(element: IElement): boolean;
/**
* Set this property to true, to require the answer at least in one question in the panel.
*/
isRequired: boolean;
/**
* Returns true, if there is an error on this Page or inside the current Panel
* @param fireCallback set it to true, to show errors in UI
* @param focusOnFirstError set it to true to focus on the first question that doesn't pass the validation
*/
hasErrors(fireCallback?: boolean, focusOnFirstError?: boolean, rec?: any): boolean;
getErrorCustomText(text: string, error: SurveyError): string;
protected hasErrorsCore(rec: any): void;
protected getContainsErrors(): boolean;
updateElementVisibility(): void;
getFirstQuestionToFocus(withError?: boolean): Question;
/**
* Call it to focus the input on the first question
*/
focusFirstQuestion(): void;
/**
* Call it to focus the input of the first question that has an error.
*/
focusFirstErrorQuestion(): void;
/**
* Fill list array with the questions.
* @param list
* @param visibleOnly set it to true to get visible questions only
*/
addQuestionsToList(list: Array<IQuestion>, visibleOnly?: boolean, includingDesignTime?: boolean): void;
/**
* Fill list array with the panels.
* @param list
*/
addPanelsIntoList(list: Array<IPanel>, visibleOnly?: boolean, includingDesignTime?: boolean): void;
/**
* Returns true if the current object is Page and it is the current page.
*/
readonly isActive: boolean;
updateCustomWidgets(): void;
/**
* Set this property different from "default" to set the specific question title location for this panel/page.
* @see SurveyModel.questionTitleLocation
*/
questionTitleLocation: string;
getQuestionTitleLocation(): string;
protected getStartIndex(): string;
getQuestionStartIndex(): string;
getChildrenLayoutType(): string;
protected readonly root: PanelModelBase;
protected childVisibilityChanged(): void;
protected createRow(): QuestionRowModel;
onSurveyLoad(): void;
onFirstRendering(): void;
readonly rows: Array<QuestionRowModel>;
protected onRowsChanged(): void;
protected onAddElement(element: IElement, index: number): void;
protected onRemoveElement(element: IElement): void;
protected updateRowsRemoveElementFromRow(element: IElement, row: QuestionRowModel): void;
elementWidthChanged(el: IElement): void;
/**
* Returns rendered title text or html.
*/
readonly processedTitle: string;
protected getRenderedTitle(str: string): string;
/**
* Use it to get/set the object visibility.
* @see visibleIf
*/
visible: boolean;
protected onVisibleChanged(): void;
/**
* Returns true if object is visible or survey is in design mode right now.
*/
readonly isVisible: boolean;
getIsPageVisible(exceptionQuestion: IQuestion): boolean;
setVisibleIndex(index: number): number;
protected beforeSetVisibleIndex(index: number): number;
protected getPanelStartIndex(index: number): number;
protected isContinueNumbering(): boolean;
/**
* Retuns true if readOnly property is true or survey is in display mode or parent panel/page is readOnly.
* @see SurveyModel.model
* @see readOnly
*/
readonly isReadOnly: boolean;
protected onReadOnlyChanged(): void;
updateElementCss(): void;
/**
* An expression that returns true or false. If it returns false the Panel/Page becomes read only and an end-user will not able to answer on qustions inside it.
* The library runs the expression on survey start and on changing a question value. If the property is empty then readOnly property is used.
* @see readOnly
* @see isReadOnly
*/
enableIf: string;
/**
* Add an element into Panel or Page. Returns true if the element added successfully. Otherwise returns false.
* @param element
* @param index element index in the elements array
*/
addElement(element: IElement, index?: number): boolean;
protected canAddElement(element: IElement): boolean;
/**
* Add a question into Panel or Page. Returns true if the question added successfully. Otherwise returns false.
* @param question
* @param index element index in the elements array
*/
addQuestion(question: Question, index?: number): boolean;
/**
* Add a panel into Panel or Page. Returns true if the panel added successfully. Otherwise returns false.
* @param panel
* @param index element index in the elements array
*/
addPanel(panel: PanelModel, index?: number): boolean;
/**
* Creates a new question and adds it at location of index, by default the end of the elements list. Returns null, if the question could not be created or could not be added into page or panel.
* @param questionType the possible values are: "text", "checkbox", "dropdown", "matrix", "html", "matrixdynamic", "matrixdropdown" and so on.
* @param name a question name
* @param index element index in the elements array
*/
addNewQuestion(questionType: string, name?: string, index?: number): Question;
/**
* Creates a new panel and adds it into the end of the elements list. Returns null, if the panel could not be created or could not be added into page or panel.
* @param name a panel name
*/
addNewPanel(name?: string): PanelModel;
/**
* Returns the index of element parameter in the elements list.
* @param element question or panel
*/
indexOf(element: IElement): number;
protected createNewPanel(name: string): PanelModel;
/**
* Remove an element (Panel or Question) from the elements list.
* @param element
* @see elements
*/
removeElement(element: IElement): boolean;
/**
* Remove question from the elements list.
* @param question
* @see elements
* @see removeElement
*/
removeQuestion(question: Question): void;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
onAnyValueChanged(name: string): void;
protected dragDropAddTarget(dragDropInfo: DragDropInfo): void;
protected dragDropFindRow(findElement: ISurveyElement): QuestionRowModel;
dragDropMoveElement(src: IElement, target: IElement, targetIndex: number): void;
dispose(): void;
}
/**
* A container element, similar to the Page objects. However, unlike the Page, Panel can't be a root.
* It may contain questions and other panels.
*/
export declare class PanelModel extends PanelModelBase implements IElement {
name: string;
stateChangedCallback: () => void;
constructor(name?: string);
getType(): string;
onSurveyLoad(): void;
readonly isPanel: boolean;
/**
* Get/set the page where the panel is located.
*/
page: IPage;
delete(): void;
/**
* Set this property to "collapsed" to render only Panel title and expanded button and to "expanded" to render the collapsed button in the Panel caption
*/
state: string;
/**
* Returns true if the Panel is in the collapsed state
* @see state
* @see collapse
* @see isExpanded
*/
readonly isCollapsed: boolean;
/**
* Returns true if the Panel is in the expanded state
* @see state
* @see expand
* @see isCollapsed
*/
readonly isExpanded: boolean;
/**
* Collapse the Panel
* @see state
*/
collapse(): void;
/**
* Expand the Panel
* @see state
*/
expand(): void;
/**
* Move panel to a new container Page/Panel. Add as a last element if insertBefore parameter is not used or inserted into the given index,
* if insert parameter is number, or before the given element, if the insertBefore parameter is a question or panel
* @param container Page or Panel to where a question is relocated.
* @param insertBefore Use it if you want to set the panel to a specific position. You may use a number (use 0 to insert int the beginning) or element, if you want to insert before this element.
*/
moveTo(container: IPanel, insertBefore?: any): boolean;
/**
* Returns the visible index of the panel in the survey. Commonly it is -1 and it doesn't show.
* You have to set showNumber to true to show index/numbering for the Panel
* @see showNumber
*/
readonly visibleIndex: number;
/**
* Set showNumber to true to start showing the number for this panel.
* @see visibleIndex
*/
showNumber: boolean;
/**
* Gets or sets a value that specifies how the elements numbers inside panel are displayed.
*
* The following options are available:
*
* - `default` - display questions numbers as defined in parent panel or survey
* - `onpanel` - display questions numbers, start numbering from beginning of this page
* - `off` - turn off the numbering for questions titles
* @see showNumber
*/
showQuestionNumbers: string;
/**
* Gets or sets the first question index for elements inside the panel. The first question index is '1.' by default and it is taken from survey.questionStartIndex property.
* You may start it from '100' or from 'A', by setting '100' or 'A' to this property.
* You can set the start index to "(1)" or "# A)" or "a)" to render question number as (1), # A) and a) accordingly.
* @see survey.questionStartIndex
*/
questionStartIndex: string;
getQuestionStartIndex(): string;
/**
* The property returns the question number. If question is invisible then it returns empty string.
* If visibleIndex is 1, then no is 2, or 'B' if survey.questionStartIndex is 'A'.
* @see SurveyModel.questionStartIndex
*/
readonly no: string;
protected setNo(visibleIndex: number): void;
protected beforeSetVisibleIndex(index: number): number;
protected getPanelStartIndex(index: number): number;
protected isContinueNumbering(): boolean;
protected hasErrorsCore(rec: any): void;
protected getRenderedTitle(str: string): string;
/**
* The Panel width.
*/
width: string;
/**
* The left indent. Set this property to increase the panel left indent.
*/
indent: number;
/**
* The inner indent. Set this property to increase the panel content margin.
*/
innerIndent: number;
renderWidth: string;
/**
* The Panel renders on the new line if the property is true. If the property is false, the panel tries to render on the same line/row with a previous question/panel.
*/
startWithNewLine: boolean;
/**
* The right indent of the Panel.
*/
rightIndent: number;
paddingLeft: string;
innerPaddingLeft: string;
paddingRight: string;
clearOnDeletingContainer(): void;
protected onVisibleChanged(): void;
}
/**
* The flow panel object. It is a container with flow layout where you can mix questions with mardown text.
*
*/
export declare class FlowPanelModel extends PanelModel {
static contentElementNamePrefix: string;
contentChangedCallback: () => void;
onGetHtmlForQuestion: (question: Question) => string;
onCustomHtmlProducing: () => string;
constructor(name?: string);
getType(): string;
getChildrenLayoutType(): string;
onSurveyLoad(): any;
content: string;
readonly locContent: LocalizableString;
html: string;
protected onContentChanged(): any;
produceHtml(): string;
getQuestionFromText(str: string): Question;
protected getHtmlForQuestion(question: Question): string;
protected getQuestionHtmlId(question: Question): string;
protected onAddElement(element: IElement, index: number): void;
protected onRemoveElement(element: IElement): void;
dragDropMoveElement(src: IElement, target: IElement, targetIndex: number): void;
getElementContentText(element: IElement): string;
}
/**
* The page object. It has elements collection, that contains questions and panels.
*/
export declare class PageModel extends PanelModelBase implements IPage {
name: string;
constructor(name?: string);
getType(): string;
toString(): string;
readonly isPage: boolean;
delete(): void;
onFirstRendering(): void;
/**
* The visible index of the page. It has values from 0 to visible page count - 1.
* @see SurveyModel.visiblePages
* @see SurveyModel.pages
*/
visibleIndex: number;
/**
* Returns true, if the page is started page in the survey. It can be shown on the start only and the end-user could not comeback to it after it passed it.
*/
readonly isStarted: boolean;
readonly cssClasses: any;
getIsPageVisible(exceptionQuestion: IQuestion): boolean;
num: number;
/**
* Set this property to "hide" to make "Prev", "Next" and "Complete" buttons are invisible for this page. Set this property to "show" to make these buttons visible, even if survey showNavigationButtons property is false.
* @see SurveyMode.showNavigationButtons
*/
navigationButtonsVisibility: string;
/**
* The property returns true, if the page has been shown to the end-user.
*/
readonly wasShown: boolean;
readonly hasShown: boolean;
setWasShown(val: boolean): void;
/**
* The property returns true, if the elements are randomized on the page
* @see hasShown
* @see questionsOrder
* @see SurveyModel.questionsOrder
*/
readonly areQuestionsRandomized: boolean;
/**
* Use this property to randomize questions. Set it to 'random' to randomize questions, 'initial' to keep them in the same order or 'default' to use the Survey questionsOrder property
* @see SurveyModel.questionsOrder
* @see areQuestionsRandomized
*/
questionsOrder: string;
/**
* Call it to scroll to the page top.
*/
scrollToTop(): void;
/**
* Time in seconds end-user spent on this page
*/
timeSpent: number;
/**
* Returns the list of all panels in the page
*/
getPanels(visibleOnly?: boolean, includingDesignTime?: boolean): Array<IPanel>;
/**
* The maximum time in seconds that end-user has to complete the page. If the value is 0 or less, the end-user has unlimited number of time to finish the page.
* @see startTimer
* @see SurveyModel.maxTimeToFinishPage
*/
maxTimeToFinish: number;
protected onNumChanged(value: number): void;
protected onVisibleChanged(): void;
dragDropStart(src: IElement, target: IElement, nestedPanelDepth?: number): void;
dragDropMoveTo(destination: ISurveyElement, isBottom?: boolean, isEdge?: boolean): boolean;
dragDropFinish(isCancel?: boolean): IElement;
}
export interface IConditionObject {
name: string;
text: string;
question: Question;
}
/**
* A base class for all questions.
*/
export declare class Question extends SurveyElement implements IQuestion, IConditionRunner, ILocalizableOwner, IValidatorOwner {
name: string;
[index: string]: any;
customWidgetData: {
isNeedRender: boolean;
};
focusCallback: () => void;
surveyLoadCallback: () => void;
valueChangedCallback: () => void;
commentChangedCallback: () => void;
validateValueCallback: () => SurveyError;
questionTitleTemplateCallback: () => string;
protected isReadyValue: boolean;
/**
* The event is fired when isReady property of question is changed.
* <br/> options.question - the question
* <br/> options.isReady - current value of isReady
* <br/> options.oldIsReady - old value of isReady
*/
onReadyChanged: Event<(sender: Question, options: any) => any, any>;
constructor(name: string);
getValueName(): string;
/**
* Use this property if you want to store the question result in the name different from the question name.
* Question name should be unique in the survey and valueName could be not unique. It allows to share data between several questions with the same valueName.
* The library set the value automatically if the question.name property is not valid. For example, if it contains the period '.' symbol.
* In this case if you set the question.name property to 'x.y' then the valueName becomes 'x y'.
* @see name
*/
valueName: string;
protected onValueNameChanged(oldValue: string): void;
protected onNameChanged(oldValue: string): void;
readonly isReady: boolean;
/**
* Get is question ready to use
*/
choicesLoaded(): void;
/**
* Get/set the page where the question is located.
*/
page: IPage;
getPanel(): IPanel;
delete(): void;
readonly isFlowLayout: boolean;
getLayoutType(): string;
isLayoutTypeSupported(layoutType: string): boolean;
/**
* Use it to get/set the question visibility.
* @see visibleIf
*/
visible: boolean;
protected onVisibleChanged(): void;
/**
* Use it to choose how other question values will be rendered in title if referenced in {}.
*/
useDisplayValuesInTitle: boolean;
/**
* An expression that returns true or false. If it returns true the Question becomes visible and if it returns false the Question becomes invisible. The library runs the expression on survey start and on changing a question value. If the property is empty then visible property is used.
* @see visible
*/
visibleIf: string;
/**
* Returns true if the question is visible or survey is in design mode right now.
*/
readonly isVisible: boolean;
/**
* Returns the visible index of the question in the survey. It can be from 0 to all visible questions count - 1
* The visibleIndex is -1 if the title is 'hidden' or hideNumber is true
* @see titleLocation
* @see hideNumber
*/
readonly visibleIndex: number;
/**
* Set hideNumber to true to stop showing the number for this question. The question will not be counter
* @see visibleIndex
* @see titleLocation
*/
hideNumber: boolean;
/**
* Returns true if the question may have a title located on the left
*/
readonly isAllowTitleLeft: boolean;
/**
* Returns the type of the object as a string as it represents in the json.
*/
getType(): string;
/**
* Move question to a new container Page/Panel. Add as a last element if insertBefore parameter is not used or inserted into the given index,
* if insert parameter is number, or before the given element, if the insertBefore parameter is a question or panel
* @param container Page or Panel to where a question is relocated.
* @param insertBefore Use it if you want to set the question to a specific position. You may use a number (use 0 to insert int the beginning) or element, if you want to insert before this element.
*/
moveTo(container: IPanel, insertBefore?: any): boolean;
setSurveyImpl(value: ISurveyImpl): void;
getDataFilteredValues(): any;
getDataFilteredProperties(): any;
/**
* A parent element. It can be panel or page.
*/
parent: IPanel;
protected onParentChanged(): void;
/**
* Returns false if the question doesn't have a title property, for example: QuestionHtmlModel, or titleLocation property equals to "hidden"
* @see titleLocation
*/
readonly hasTitle: boolean;
/**
* Set this property different from "default" to set the specific question title location for this panel/page.
* @see SurveyModel.questionTitleLocation
*/
titleLocation: string;
/**
* Return the title location based on question titleLocation property and QuestionTitleLocation of it's parents
* @see titleLocation
* @see PanelModelBase.QuestionTitleLocation
* @see SurveyModel.QuestionTitleLocation
*/
getTitleLocation(): string;
protected getTitleLocationCore(): string;
readonly hasTitleOnLeft: boolean;
readonly hasTitleOnTop: boolean;
readonly hasTitleOnBottom: boolean;
readonly hasTitleOnLeftTop: boolean;
readonly errorLocation: string;
/**
* Returns false if the question doesn't have an input element, for example: QuestionHtmlModel
*/
readonly hasInput: boolean;
readonly inputId: string;
/**
* Question title. Use survey questionTitleTemplate property to change the title question is rendered. If it is empty, then question name property is used.
* @see SurveyModel.questionTitleTemplate
*/
title: string;
readonly locTitle: LocalizableString;
/**
* Question description. It renders under question title by using smaller font. Unlike the title, description can be empty.
* @see title
*/
description: string;
readonly locDescription: LocalizableString;
/**
* Question description location. By default, value is "default" and it depends on survey questionDescriptionLocation property
* You may change it to "underInput" to render it under question input or "underTitle" to rendered it under title.
* @see description
* @see Survey.questionDescriptionLocation
*/
descriptionLocation: string;
readonly hasDescriptionUnderTitle: boolean;
readonly hasDescriptionUnderInput: boolean;
/**
* The custom text that will be shown on required error. Use this property, if you do not want to show the default text.
*/
requiredErrorText: string;
readonly locRequiredErrorText: LocalizableString;
/**
* Use it to get or set the comment value.
*/
commentText: string;
readonly locCommentText: LocalizableString;
/**
* Returns a copy of question errors survey. For some questions like matrix and panel dynamic it includes the errors of nested questions.
*/
getAllErrors(): Array<SurveyError>;
/**
* The link to the custom widget.
*/
readonly customWidget: QuestionCustomWidget;
updateCustomWidget(): void;
readonly isCompositeQuestion: boolean;
afterRenderQuestionElement(el: any): void;
beforeDestoyQuestionElement(el: any): void;
/**
* Returns the rendred question title.
*/
readonly processedTitle: string;
/**
* Returns the title after processing the question template.
* @see SurveyModel.questionTitleTemplate
*/
readonly fullTitle: string;
readonly questionTitlePattern: string;
readonly isRequireTextOnStart: boolean;
readonly isRequireTextBeforeTitle: boolean;
readonly isRequireTextAfterTitle: boolean;
/**
* The Question renders on the new line if the property is true. If the property is false, the question tries to render on the same line/row with a previous question/panel.
*/
startWithNewLine: boolean;
/**
* Returns all css classes that used for rendering the question. You may use survey.updateQuestionCssClasses event to override css classes for a question.
* @see SurveyModel.updateQuestionCssClasses
*/
readonly cssClasses: any;
readonly cssRoot: string;
protected setCssRoot(val: string): void;
protected getCssRoot(cssClasses: any): string;
readonly cssHeader: string;
protected setCssHeader(val: string): void;
protected getCssHeader(cssClasses: any): string;
readonly cssContent: string;
protected setCssContent(val: string): void;
protected getCssContent(cssClasses: any): string;
readonly cssTitle: string;
protected setCssTitle(val: string): void;
protected getCssTitle(cssClasses: any): string;
readonly cssError: string;
protected setCssError(val: string): void;
protected getCssError(cssClasses: any): string;
updateElementCss(): void;
protected updateElementCssCore(cssClasses: any): void;
protected updateCssClasses(res: any, css: any): void;
protected getCssType(): string;
/**
* Use it to set the specific width to the question like css style (%, px, em etc).
*/
width: string;
/**
* The rendered width of the question.
*/
renderWidth: string;
/**
* Set it different from 0 to increase the left padding.
*/
indent: number;
/**
* Set it different from 0 to increase the right padding.
*/
rightIndent: number;
paddingLeft: string;
paddingRight: string;
/**
* Move the focus to the input of this question.
* @param onError set this parameter to true, to focus the input with the first error, other wise the first input will be focused.
*/
focus(onError?: boolean): void;
protected fireCallback(callback: () => void): void;
getOthersMaxLength(): any;
protected onCreating(): void;
protected getFirstInputElementId(): string;
protected getFirstErrorInputElementId(): string;
protected getProcessedTextValue(textValue: TextPreProcessorValue): void;
supportComment(): boolean;
supportOther(): boolean;
/**
* Set this property to true, to make the question a required. If a user doesn't answer the question then a validation error will be generated.
*/
isRequired: boolean;
/**
* An expression that returns true or false. If it returns true the Question becomes required and an end-user has to answer it.
* If it returns false the Question then an end-user may not answer it the Question maybe empty.
* The library runs the expression on survey start and on changing a question value. If the property is empty then isRequired property is used.
* @see isRequired
*/
requiredIf: string;
/**
* Set it to true, to add a comment for the question.
*/
hasComment: boolean;
/**
* The unique identificator. It is generated automatically.
*/
id: string;
readonly ariaTitleId: string;
readonly ariaRole: string;
hasOther: boolean;
protected hasOtherChanged(): void;
readonly requireUpdateCommentValue: boolean;
/**
* Retuns true if readOnly property is true or survey is in display mode or parent panel/page is readOnly.
* @see SurveyModel.model
* @see readOnly
*/
readonly isReadOnly: boolean;
/**
* An expression that returns true or false. If it returns false the Question becomes read only and an end-user will not able to answer on the qustion. The library runs the expression on survey start and on changing a question value. If the property is empty then readOnly property is used.
* @see readOnly
* @see isReadOnly
*/
enableIf: string;
/**
* Run visibleIf and enableIf expressions. If visibleIf or/and enabledIf are not empty, then the results of performing the expression (true or false) set to the visible/readOnly properties.
* @param values Typically survey results
* @see visible
* @see visibleIf
* @see readOnly
* @see enableIf
*/
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
/**
* The property returns the question number. If question is invisible then it returns empty string.
* If visibleIndex is 1, then no is 2, or 'B' if survey.questionStartIndex is 'A'.
* @see SurveyModel.questionStartIndex
*/
readonly no: string;
protected getStartIndex(): string;
onSurveyLoad(): void;
protected onSetData(): void;
protected initDataFromSurvey(): void;
protected initCommentFromSurvey(): void;
/**
* Get/Set the question value.
* @see SurveyMode.setValue
* @see SurveyMode.getValue
*/
value: any;
clearValue(): void;
createValueCopy(): any;
clearValueIfInvisible(): void;
readonly displayValue: any;
protected updateDisplayValue(): any;
/**
* Return the question value as a display text. For example, for dropdown, it would return the item text instead of item value.
* @param keysAsText Set this value to true, to return key (in matrices questions) as display text as well.
* @param value use this parameter, if you want to get display value for this value and not question.value. It is undefined by default.
*/
getDisplayValue(keysAsText: boolean, value?: any): any;
protected getDisplayValueCore(keyAsText: boolean, value: any): any;
/**
* Set the default value to the question. It will be assign to the question on loading the survey from JSON or adding a question to the survey or on setting this property of the value is empty.
*/
defaultValue: any;
/**
* Returns question answer data as a plain object: with question title, name, value and displayValue.
* For complex questions (like matrix, etc.) isNode flag is set to true and data contains array of nested objects (rows)
* set options.includeEmpty to false if you want to skip empty answers
*/
getPlainData(options?: {
includeEmpty?: boolean;
calculations?: Array<{
propertyName: string;
}>;
}): any;
/**
* The correct answer on the question. Set this value if you are doing a quiz.
* @see SurveyModel.correctAnswers
* @see SurveyModel.inCorrectAnswers
*/
correctAnswer: any;
/**
* Returns questions count: 1 for the non-matrix questions and all inner visible questions that has input(s) widgets for question of matrix types.
* @see getQuizQuestions
*/
readonly quizQuestionCount: number;
readonly correctAnswerCount: number;
protected getQuizQuestionCount(): number;
protected getCorrectAnswerCount(): number;
isAnswerCorrect(): boolean;
updateValueWithDefaults(): void;
getQuestionFromArray(name: string, index: number): IQuestion;
getDefaultValue(): any;
protected isDefaultValueEmpty(): boolean;
protected setDefaultValue(): void;
/**
* The question comment value.
*/
comment: string;
protected getQuestionComment(): string;
protected setQuestionComment(newValue: string): void;
/**
* Returns true if the question value is empty
*/
isEmpty(): boolean;
isAnswered: boolean;
protected updateIsAnswered(): void;
protected getIsAnswered(): boolean;
/**
* The list of question validators.
*/
validators: Array<SurveyValidator>;
getValidators(): Array<SurveyValidator>;
getSupportedValidators(): Array<string>;
protected addSupportedValidators(supportedValidators: Array<string>): void;
addConditionObjectsByContext(objects: Array<IConditionObject>, context: any): void;
getConditionJson(operator?: string, path?: string): any;
/**
* Returns true if there is a validation error(s) in the question.
* @param fireCallback set it to true to show an error in UI.
*/
hasErrors(fireCallback?: boolean, rec?: any): boolean;
/**
* Returns the validation errors count.
*/
readonly currentErrorCount: number;
/**
* Returns the char/string for a required question.
* @see SurveyModel.requiredText
*/
readonly requiredText: string;
/**
* Add error into the question error list.
* @param error
*/
addError(error: SurveyError | string): void;
/**
* Remove a particular error from the question error list.
* @param error
*/
removeError(error: SurveyError): void;
protected onCheckForErrors(errors: Array<SurveyError>, isOnValueChanged: boolean): void;
protected hasRequiredError(): boolean;
onCompletedAsyncValidators: (hasErrors: boolean) => void;
readonly isRunningValidators: boolean;
protected getIsRunningValidators(): boolean;
protected runValidators(): Array<SurveyError>;
protected raiseOnCompletedAsyncValidators(): void;
protected allowNotifyValueChanged: boolean;
protected setNewValue(newValue: any): void;
protected locNotificationInData: boolean;
protected isTextValue(): boolean;
readonly isSurveyInputTextUpdate: boolean;
readonly isInputTextUpdate: boolean;
protected setNewValueInData(newValue: any): void;
protected getValueCore(): any;
protected setValueCore(newValue: any): void;
protected valueFromData(val: any): any;
protected valueToData(val: any): any;
protected onValueChanged(): void;
protected setNewComment(newValue: string): void;
updateValueFromSurvey(newValue: any): void;
updateCommentFromSurvey(newValue: any): any;
protected setQuestionValue(newValue: any, updateIsAnswered?: boolean): void;
onSurveyValueChanged(newValue: any): void;
setVisibleIndex(val: number): number;
removeElement(element: IElement): boolean;
supportGoNextPageAutomatic(): boolean;
/**
* Call this function to remove values from the current question, that end-user will not be able to enter.
* For example the value that doesn't exists in a radigroup/dropdown/checkbox choices or matrix rows/columns.
*/
clearIncorrectValues(): void;
clearOnDeletingContainer(): void;
/**
* Call this function to clear all errors in the question
*/
clearErrors(): void;
clearUnusedValues(): void;
onAnyValueChanged(name: string): void;
locOwner: ILocalizableOwner;
/**
* Returns the current survey locale
* @see SurveyModel.locale
*/
getLocale(): string;
getMarkdownHtml(text: string): string;
getProcessedText(text: string): string;
getErrorCustomText(text: string, error: SurveyError): string;
getValidatorTitle(): string;
validatedValue: any;
getAllValues(): any;
dispose(): void;
}
/**
* A Model for non value question. This question doesn't add any new functionality. It hides some properties, including the value.
*/
export declare class QuestionNonValue extends Question {
name: string;
constructor(name: string);
getType(): string;
readonly hasInput: boolean;
readonly hasTitle: boolean;
getTitleLocation(): string;
readonly hasComment: boolean;
getAllErrors(): Array<SurveyError>;
supportGoNextPageAutomatic(): boolean;
addConditionObjectsByContext(objects: Array<IConditionObject>, context: any): void;
getConditionJson(operator?: string, path?: string): any;
}
/**
* A Model for an question that renders empty "div" tag. It used as a base class for some custom widgets
*/
export declare class QuestionEmptyModel extends Question {
name: string;
constructor(name: string);
getType(): string;
}
/**
* It is a base class for checkbox, dropdown and radiogroup questions.
*/
export declare class QuestionSelectBase extends Question {
visibleChoicesChangedCallback: () => void;
/**
* Use this property to fill the choices from a restful service.
* @see choices
*/
choicesByUrl: ChoicesRestfull;
constructor(name: string);
getType(): string;
isLayoutTypeSupported(layoutType: string): boolean;
/**
* Returns the other item. By using this property, you may change programmatically it's value and text.
* @see hasOther
*/
readonly otherItem: ItemValue;
/**
* Returns true if a user select the 'other' item.
*/
readonly isOtherSelected: boolean;
/**
* An expression that returns true or false. It runs against each choices item and if for this item it returns true, then the item is visible otherwise the item becomes invisible. Please use {item} to get the current item value in the expression.
* @see visibleIf
* @see choicesEnableIf
*/
choicesVisibleIf: string;
/**
* An expression that returns true or false. It runs against each choices item and if for this item it returns true, then the item is enabled otherwise the item becomes disabled. Please use {item} to get the current item value in the expression.
* @see choicesVisibleIf
*/
choicesEnableIf: string;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
isSettingDefaultValue: boolean;
protected setDefaultValue(): void;
protected filterItems(): boolean;
protected runItemsCondition(values: HashTable<any>, properties: HashTable<any>): boolean;
protected runItemsEnableCondition(values: HashTable<any>, properties: HashTable<any>): any;
protected getHasOther(val: any): boolean;
readonly validatedValue: any;
protected createRestfull(): ChoicesRestfull;
protected getQuestionComment(): string;
protected setQuestionComment(newValue: string): void;
renderedValue: any;
protected setQuestionValue(newValue: any): void;
protected setNewValue(newValue: any): void;
protected valueFromData(val: any): any;
protected rendredValueFromData(val: any): any;
protected rendredValueToData(val: any): any;
protected renderedValueFromDataCore(val: any): any;
protected rendredValueToDataCore(val: any): any;
protected hasUnknownValue(val: any, includeOther?: boolean): boolean;
protected isValueDisabled(val: any): boolean;
/**
* If the clearIncorrectValuesCallback is set, it is used to clear incorrrect values instead of default behaviour.
*/
clearIncorrectValuesCallback: () => void;
/**
* The list of items. Every item has value and text. If text is empty, the value is rendered. The item text supports markdown.
* @see choicesByUrl
*/
choices: Array<any>;
hideIfChoicesEmpty: boolean;
keepIncorrectValues: boolean;
/**
* Please use survey.storeOthersAsComment to change the behavior on the survey level. This property is depricated and invisible in Survey Creator.
* By default the entered text in the others input in the checkbox/radiogroup/dropdown are stored as "question name " + "-Comment". The value itself is "question name": "others". Set this property to false, to store the entered text directly in the "question name" key.
* Possible values are: "default", true, false
* @see SurveyModel.storeOthersAsComment
*/
storeOthersAsComment: any;
protected hasOtherChanged(): void;
/**
* Use this property to render items in a specific order: "asc", "desc", "random". Default value is "none".
*/
choicesOrder: string;
/**
* Use this property to set the different text for other item.
*/
otherText: string;
readonly locOtherText: LocalizableString;
/**
* Use this property to set the place holder text for other or comment field .
*/
otherPlaceHolder: string;
readonly locOtherPlaceHolder: LocalizableString;
/**
* The text that shows when the other item is choosed by the other input is empty.
*/
otherErrorText: string;
readonly locOtherErrorText: LocalizableString;
/**
* The list of items as they will be rendered. If needed items are sorted and the other item is added.
* @see hasOther
* @see choicesOrder
* @see enabledChoices
*/
readonly visibleChoices: Array<ItemValue>;
/**
* The list of enabled items as they will be rendered. The disabled items are not included
* @see hasOther
* @see choicesOrder
* @see visibleChoices
*/
readonly enabledChoices: Array<ItemValue>;
protected updateVisibleChoices(): void;
protected canUseFilteredChoices(): boolean;
protected addToVisibleChoices(items: Array<ItemValue>): void;
getPlainData(options?: {
includeEmpty?: boolean;
calculations?: Array<{
propertyName: string;
}>;
}): any;
/**
* Returns the text for the current value. If the value is null then returns empty string. If 'other' is selected then returns the text for other value.
*/
protected getDisplayValueCore(keysAsText: boolean, value: any): any;
protected getChoicesDisplayValue(items: ItemValue[], val: any): any;
protected readonly activeChoices: Array<ItemValue>;
protected getChoices(): Array<ItemValue>;
supportComment(): boolean;
supportOther(): boolean;
protected onCheckForErrors(errors: Array<SurveyError>, isOnValueChanged: boolean): void;
setSurveyImpl(value: ISurveyImpl): void;
protected getStoreOthersAsComment(): boolean;
onSurveyLoad(): void;
onAnyValueChanged(name: string): void;
protected onBeforeSendRequest(): void;
protected onLoadChoicesFromUrl(array: Array<ItemValue>): void;
protected onVisibleChoicesChanged(): void;
clearIncorrectValues(): void;
clearValueIfInvisible(): void;
protected clearIncorrectValuesCore(): void;
protected canClearValueAnUnknow(val: any): boolean;
protected clearDisabledValuesCore(): void;
clearUnusedValues(): void;
getColumnClass(): any;
getLabelClass(isChecked: boolean): any;
getControlLabelClass(isChecked: boolean): any;
readonly columns: ItemValue[][];
readonly hasColumns: boolean;
choicesLoaded(): void;
}
/**
* A base class for checkbox and radiogroup questions. It introduced a colCount property.
*/
export declare class QuestionCheckboxBase extends QuestionSelectBase {
name: string;
colCountChangedCallback: () => void;
constructor(name: string);
/**
* The number of columns for radiogroup and checkbox questions. Items are rendred in one line if the value is 0.
*/
colCount: number;
protected onParentChanged(): void;
}
/**
* A Model for a checkbox question
*/
export declare class QuestionCheckboxModel extends QuestionCheckboxBase {
name: string;
constructor(name: string);
readonly ariaRole: string;
getType(): string;
protected onCreating(): void;
protected getFirstInputElementId(): string;
/**
* Returns the select all item. By using this property, you may change programmatically it's value and text.
* @see hasSelectAll
*/
readonly selectAllItem: ItemValue;
/**
* Returns the none item. By using this property, you may change programmatically it's value and text.
* @see hasNone
*/
readonly noneItem: ItemValue;
/**
* Use this property to set the different text for none item.
*/
noneText: string;
readonly locNoneText: LocalizableString;
/**
* Use this property to set the different text for Select All item.
*/
selectAllText: string;
readonly locSelectAllText: LocalizableString;
/**
* Set this property to true, to show the "Select All" item on the top. If end-user checks this item, then all items are checked.
*/
hasSelectAll: boolean;
/**
* Returns true if all items are selected
* @see toggleSelectAll
*/
isAllSelected: boolean;
/**
* It will select all items, except other and none. If all items have been already selected then it will clear the value
* @see isAllSelected
* @see selectAll
*/
toggleSelectAll(): void;
/**
* Select all items, except other and none.
*/
selectAll(): void;
/**
* Set this property to true, to show the "None" item on the bottom. If end-user checks this item, all other items would be unchecked.
*/
hasNone: boolean;
/**
* Returns true if item is checked
* @param item checkbox item value
*/
isItemSelected(item: ItemValue): boolean;
protected setNewValue(newValue: any): void;
protected canUseFilteredChoices(): boolean;
protected addToVisibleChoices(items: Array<ItemValue>): void;
protected getDisplayValueCore(keysAsText: boolean, value: any): any;
protected clearIncorrectValuesCore(): void;
protected clearDisabledValuesCore(): void;
getConditionJson(operator?: string, path?: string): any;
isAnswerCorrect(): boolean;
protected setDefaultValueWithOthers(): void;
protected getHasOther(val: any): boolean;
protected valueFromData(val: any): any;
protected renderedValueFromDataCore(val: any): any;
protected rendredValueToDataCore(val: any): any;
protected hasUnknownValue(val: any, includeOther?: boolean): boolean;
protected addSupportedValidators(supportedValidators: Array<string>): void;
}
/**
* A Model for a comment question
*/
export declare class QuestionCommentModel extends Question {
name: string;
constructor(name: string);
protected isTextValue(): boolean;
/**
* The maximim text length. If it is -1, defaul value, then the survey maxTextLength property will be used.
* If it is 0, then the value is unlimited
* @see SurveyModel.maxTextLength
*/
maxLength: number;
getMaxLength(): any;
/**
* Use this property to set the input place holder.
*/
placeHolder: string;
readonly locPlaceHolder: LocalizableString;
/**
* The html rows attribute.
*/
rows: number;
/**
* The html cols attribute.
*/
cols: number;
getType(): string;
isEmpty(): boolean;
protected addSupportedValidators(supportedValidators: Array<string>): void;
}
/**
* A Model for a dropdown question
*/
export declare class QuestionDropdownModel extends QuestionSelectBase {
name: string;
constructor(name: string);
/**
* This flag controls whether to show options caption item ('Choose...').
*/
showOptionsCaption: boolean;
/**
* Use this property to set the options caption different from the default value. The default value is taken from localization strings.
*/
optionsCaption: string;
readonly locOptionsCaption: LocalizableString;
getType(): string;
readonly selectedItem: ItemValue;
supportGoNextPageAutomatic(): boolean;
protected getChoices(): Array<ItemValue>;
/**
* Use this and choicesMax property to automatically add choices. For example choicesMin = 1 and choicesMax = 10 will generate ten additional choices from 1 to 10.
* @see choicesMax
* @see choicesStep
*/
choicesMin: number;
/**
* Use this and choicesMax property to automatically add choices. For example choicesMin = 1 and choicesMax = 10 will generate ten additional choices from 1 to 10.
* @see choicesMin
* @see choicesStep
*/
choicesMax: number;
/**
* The default value is 1. It tells the value of the iterator between choicesMin and choicesMax properties.
* If choicesMin = 10, choicesMax = 30 and choicesStep = 10 then you will have only three additional choices: [10, 20, 30].
* @see choicesMin
* @see choicesMax
*/
choicesStep: number;
}
export declare class QuestionFactory {
static Instance: QuestionFactory;
static readonly DefaultChoices: string[];
static readonly DefaultColums: string[];
static readonly DefaultRows: string[];
registerQuestion(questionType: string, questionCreator: (name: string) => Question): void;
unregisterElement(elementType: string): void;
clear(): void;
getAllTypes(): Array<string>;
createQuestion(questionType: string, name: string): Question;
}
export declare class ElementFactory {
static Instance: ElementFactory;
registerElement(elementType: string, elementCreator: (name: string) => IElement): void;
clear(): void;
unregisterElement(elementType: string, removeFromSerializer?: boolean): void;
getAllTypes(): Array<string>;
createElement(elementType: string, name: string): IElement;
}
/**
* A Model for a file question
*/
export declare class QuestionFileModel extends Question {
name: string;
/**
* The event is fired after question state has been changed.
* <br/> sender the question object that fires the event
* <br/> options.state new question state value.
*/
onStateChanged: Event<(sender: QuestionFileModel, options: any) => any, any>;
previewValue: any[];
currentState: string;
constructor(name: string);
getType(): string;
clearOnDeletingContainer(): void;
/**
* Set it to true, to show the preview for the image files.
*/
showPreview: boolean;
/**
* Set it to true, to allow select multiple files.
*/
allowMultiple: boolean;
/**
* The image height.
*/
imageHeight: string;
/**
* The image width.
*/
imageWidth: string;
/**
* Accepted file types. Passed to the 'accept' attribute of the file input tag. See https://www.w3schools.com/tags/att_input_accept.asp for more details.
*/
acceptedTypes: string;
/**
* Set it to false if you do not want to serialize file content as text in the survey.data.
* In this case, you have to write the code onUploadFiles event to store the file content.
* @see SurveyModel.onUploadFiles
*/
storeDataAsText: boolean;
/**
* Set it to true if you want to wait until files will be uploaded to your server.
*/
waitForUpload: boolean;
/**
* Set it to false if you want to disable images preview.
*/
allowImagesPreview: boolean;
/**
* Use this property to setup the maximum allowed file size.
*/
maxSize: number;
/**
* Use this property to setup confirmation to remove file.
*/
needConfirmRemoveFile: boolean;
/**
* The remove file confirmation message.
*/
getConfirmRemoveMessage(fileName: string): string;
/**
* The remove all files confirmation message.
*/
readonly confirmRemoveAllMessage: string;
/**
* The no file chosen caption for modern theme.
*/
readonly noFileChosenCaption: string;
/**
* The choose files button caption for modern theme.
*/
readonly chooseButtonCaption: string;
/**
* The clean files button caption.
*/
readonly cleanButtonCaption: string;
/**
* The remove file button caption.
*/
readonly removeFileCaption: string;
/**
* The input title value.
*/
readonly inputTitle: string;
/**
* Clear value programmatically.
*/
clear(doneCallback?: () => void): void;
/**
* Remove file item programmatically.
*/
removeFile(content: {
name: string;
}): void;
/**
* Load multiple files programmatically.
* @param files
*/
loadFiles(files: File[]): void;
canPreviewImage(fileItem: any): boolean;
protected setQuestionValue(newValue: any): void;
protected onCheckForErrors(errors: Array<SurveyError>, isOnValueChanged: boolean): void;
protected stateChanged(state: string): void;
getPlainData(options?: {
includeEmpty?: boolean;
calculations?: Array<{
propertyName: string;
}>;
}): any;
supportComment(): boolean;
}
/**
* A Model for html question. Unlike other questions it doesn't have value and title.
*/
export declare class QuestionHtmlModel extends QuestionNonValue {
name: string;
constructor(name: string);
getType(): string;
readonly isCompositeQuestion: boolean;
/**
* Set html to display it
*/
html: string;
readonly locHtml: LocalizableString;
readonly processedHtml: string;
}
/**
* A Model for a radiogroup question.
*/
export declare class QuestionRadiogroupModel extends QuestionCheckboxBase {
name: string;
constructor(name: string);
readonly ariaRole: string;
getType(): string;
protected getFirstInputElementId(): string;
readonly selectedItem: ItemValue;
/**
* Show "clear button" flag.
*/
showClearButton: boolean;
readonly canShowClearButton: boolean;
readonly clearButtonCaption: any;
supportGoNextPageAutomatic(): boolean;
}
/**
* A Model for a rating question.
*/
export declare class QuestionRatingModel extends Question {
name: string;
rateValuesChangedCallback: () => void;
constructor(name: string);
onSurveyLoad(): void;
/**
* The list of rate items. Every item has value and text. If text is empty, the value is rendered. The item text supports markdown. If it is empty the array is generated by using rateMin, rateMax and rateStep properties.
* @see rateMin
* @see rateMax
* @see rateStep
*/
rateValues: Array<any>;
/**
* This property is used to generate rate values if rateValues array is empty. It is the first value in the rating. The default value is 1.
* @see rateValues
* @see rateMax
* @see rateStep
*/
rateMin: number;
/**
* This property is used to generate rate values if rateValues array is empty. It is the last value in the rating. The default value is 5.
* @see rateValues
* @see rateMin
* @see rateStep
*/
rateMax: number;
/**
* This property is used to generate rate values if rateValues array is empty. It is the step value. The number of rate values are (rateMax - rateMin) / rateStep. The default value is 1.
* @see rateValues
* @see rateMin
* @see rateMax
*/
rateStep: number;
protected getDisplayValueCore(keysAsText: boolean, value: any): any;
readonly visibleRateValues: ItemValue[];
getType(): string;
supportGoNextPageAutomatic(): boolean;
supportComment(): boolean;
supportOther(): boolean;
/**
* The description of minimum (first) item.
*/
minRateDescription: string;
readonly locMinRateDescription: LocalizableString;
/**
* The description of maximum (last) item.
*/
maxRateDescription: string;
readonly locMaxRateDescription: LocalizableString;
}
/**
* A Model for expression question. It is a read-only question. It calculates value based on epxression property.
*/
export declare class QuestionExpressionModel extends Question {
name: string;
constructor(name: string);
getType(): string;
readonly hasInput: boolean;
/**
* Use this property to display the value in your own format. Make sure you have "{0}" substring in your string, to display the actual value.
*/
format: string;
readonly locFormat: LocalizableString;
/**
* The Expression that used to calculate the question value. You may use standard operators like +, -, * and /, squares (). Here is the example of accessing the question value {questionname}.
* <br/>Example: "({quantity} * {price}) * (100 - {discount}) / 100"
*/
expression: string;
locCalculation(): void;
unlocCalculation(): void;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
/**
* The maximum number of fraction digits to use if displayStyle is not "none". Possible values are from 0 to 20. The default value is -1 and it means that this property is not used.
*/
maximumFractionDigits: number;
/**
* The minimum number of fraction digits to use if displayStyle is not "none". Possible values are from 0 to 20. The default value is -1 and it means that this property is not used.
*/
minimumFractionDigits: number;
protected getDisplayValueCore(keysAsText: boolean, value: any): any;
/**
* You may set this property to "decimal", "currency", "percent" or "date". If you set it to "currency", you may use the currency property to display the value in currency different from USD.
* @see currency
*/
displayStyle: string;
/**
* Use it to display the value in the currency differen from USD. The displayStype should be set to "currency".
* @see displayStyle
*/
currency: string;
useGrouping: boolean;
protected getValueAsStr(val: any): string;
}
export declare function getCurrecyCodes(): Array<string>;
/**
* A Model for an input text question.
*/
export declare class QuestionTextModel extends Question {
name: string;
constructor(name: string);
protected isTextValue(): boolean;
getType(): string;
/**
* Use this property to change the default input type.
*/
inputType: string;
getValidators(): Array<SurveyValidator>;
isLayoutTypeSupported(layoutType: string): boolean;
/**
* The maximim text length. If it is -1, defaul value, then the survey maxTextLength property will be used.
* If it is 0, then the value is unlimited
* @see SurveyModel.maxTextLength
*/
maxLength: number;
getMaxLength(): any;
/**
* The text input size
*/
size: number;
/**
* The minimum value
*/
min: string;
/**
* The maximum value
*/
max: string;
/**
* The step value
*/
step: string;
isEmpty(): boolean;
supportGoNextPageAutomatic(): boolean;
/**
* The input place holder.
*/
placeHolder: string;
readonly locPlaceHolder: LocalizableString;
protected setNewValue(newValue: any): void;
protected correctValueType(newValue: any): any;
protected addSupportedValidators(supportedValidators: Array<string>): void;
}
/**
* A Model for a boolean question.
*/
export declare class QuestionBooleanModel extends Question {
name: string;
constructor(name: string);
getType(): string;
isLayoutTypeSupported(layoutType: string): boolean;
/**
* Returns true if the question check will be rendered in indeterminate mode. value is empty.
*/
readonly isIndeterminate: boolean;
readonly hasTitle: boolean;
/**
* Get/set question value in 3 modes: indeterminate (value is empty), true (check is set) and false (check is unset).
* @see valueTrue
* @see valueFalse
*/
checkedValue: any;
/**
* Set the default state of the check: "indeterminate" - default (value is empty/null), "true" - value equals valueTrue or true, "false" - value equals valueFalse or false.
*/
defaultValue: any;
getDefaultValue(): any;
readonly locTitle: LocalizableString;
/**
* The checkbox label. If it is empty and showTitle is false then title is rendered
* @see showTitle
* @see title
*/
label: string;
readonly locLabel: LocalizableString;
readonly locDisplayLabel: LocalizableString;
/**
* Set this property, if you want to have a different label for state when check is set.
*/
labelTrue: any;
readonly locLabelTrue: LocalizableString;
/**
* Set this property, if you want to have a different label for state when check is unset.
*/
labelFalse: any;
readonly locLabelFalse: LocalizableString;
/**
* Set this property to true to show the question title. It is hidden by default.
*/
showTitle: boolean;
/**
* Set this property, if you want to have a different value from true when check is set.
*/
valueTrue: any;
/**
* Set this property, if you want to have a different value from false when check is unset.
*/
valueFalse: any;
protected setDefaultValue(): void;
}
/**
* A Model for a select image question.
*/
export declare class QuestionImagePickerModel extends QuestionCheckboxBase {
name: string;
constructor(name: string);
getType(): string;
supportGoNextPageAutomatic(): boolean;
protected getItemValueType(): string;
readonly isCompositeQuestion: boolean;
/**
* Multi select option. If set to true, then allows to select multiple images.
*/
multiSelect: boolean;
/**
* Returns true if item is checked
* @param item image picker item value
*/
isItemSelected(item: ItemValue): boolean;
clearIncorrectValues(): void;
/**
* Show label under the image.
*/
showLabel: boolean;
endLoadingFromJson(): void;
protected getValueCore(): any;
protected renderedValueFromDataCore(val: any): any;
protected rendredValueToDataCore(val: any): any;
/**
* The image height.
*/
imageHeight: string;
/**
* The image width.
*/
imageWidth: string;
/**
* The image fit mode.
*/
imageFit: string;
/**
* The content mode.
*/
contentMode: string;
}
/**
* A Model for image question. This question hasn't any functionality and can be used to improve the appearance of the survey.
*/
export declare class QuestionImageModel extends QuestionNonValue {
name: string;
constructor(name: string);
getType(): string;
readonly isCompositeQuestion: boolean;
/**
* The image URL.
*/
imageLink: string;
/**
* The image height.
*/
imageHeight: string;
/**
* The image width.
*/
imageWidth: string;
/**
* The image fit mode.
*/
imageFit: string;
/**
* The content mode.
*/
contentMode: string;
}
/**
* A Model for signature pad question.
*/
export declare class QuestionSignaturePadModel extends Question {
name: string;
protected getCssRoot(cssClasses: any): string;
constructor(name: string);
getType(): string;
afterRenderQuestionElement(el: any): void;
beforeDestoyQuestionElement(el: any): void;
initSignaturePad(el: HTMLElement): void;
destroySignaturePad(el: HTMLElement): void;
/**
* Use it to set the specific width for the signature pad.
*/
width: string;
/**
* Use it to set the specific height for the signature pad.
*/
height: string;
/**
* Use it to clear content of the signature pad.
*/
allowClear: boolean;
/**
* Use it to set pen color for the signature pad.
*/
penColor: string;
/**
* The clear signature button caption.
*/
readonly clearButtonCaption: string;
}
export interface IQuestionPanelDynamicData {
getItemIndex(item: ISurveyData): number;
getPanelItemData(item: ISurveyData): any;
setPanelItemData(item: ISurveyData, name: string, val: any): any;
getSharedQuestionFromArray(name: string, panelIndex: number): Question;
getSurvey(): ISurvey;
getRootData(): ISurveyData;
}
export declare class QuestionPanelDynamicItem implements ISurveyData, ISurveyImpl, ITextProcessor {
static ItemVariableName: string;
static IndexVariableName: string;
constructor(data: IQuestionPanelDynamicData, panel: PanelModel);
readonly panel: PanelModel;
setSurveyImpl(): void;
getValue(name: string): any;
setValue(name: string, newValue: any): void;
getVariable(name: string): any;
setVariable(name: string, newValue: any): void;
getComment(name: string): string;
setComment(name: string, newValue: string, locNotification: any): void;
getAllValues(): any;
getFilteredValues(): any;
getFilteredProperties(): any;
geSurveyData(): ISurveyData;
getSurvey(): ISurvey;
getTextProcessor(): ITextProcessor;
processText(text: string, returnDisplayValue: boolean): string;
processTextEx(text: string, returnDisplayValue: boolean): any;
}
export declare class QuestionPanelDynamicTemplateSurveyImpl implements ISurveyImpl {
data: IQuestionPanelDynamicData;
constructor(data: IQuestionPanelDynamicData);
geSurveyData(): ISurveyData;
getSurvey(): ISurvey;
getTextProcessor(): ITextProcessor;
}
/**
* A Model for a panel dymanic question. You setup the template panel, but adding elements (any question or a panel) and assign a text to it's title, and this panel will be used as a template on creating dynamic panels. The number of panels is defined by panelCount property.
* An end-user may dynamically add/remove panels, unless you forbidden this.
*/
export declare class QuestionPanelDynamicModel extends Question implements IQuestionPanelDynamicData {
name: string;
renderModeChangedCallback: () => void;
panelCountChangedCallback: () => void;
currentIndexChangedCallback: () => void;
constructor(name: string);
setSurveyImpl(value: ISurveyImpl): void;
getType(): string;
readonly isCompositeQuestion: boolean;
clearOnDeletingContainer(): void;
readonly isAllowTitleLeft: boolean;
removeElement(element: IElement): boolean;
/**
* The template Panel. This panel is used as a template on creatign dynamic panels
* @see templateElements
* @see templateTitle
* @see panelCount
*/
readonly template: PanelModel;
getPanel(): IPanel;
/**
* The template Panel elements, questions and panels.
* @see templateElements
* @see template
* @see panelCount
*/
readonly templateElements: Array<IElement>;
/**
* The template Panel title property.
* @see templateElements
* @see template
* @see panelCount
*/
templateTitle: string;
readonly locTemplateTitle: LocalizableString;
/**
* The template Panel description property.
* @see templateElements
* @see template
* @see panelCount
* @see templateTitle
*/
templateDescription: string;
readonly locTemplateDescription: LocalizableString;
protected readonly items: Array<ISurveyData>;
/**
* The array of dynamic panels created based on panel template
* @see template
* @see panelCount
*/
readonly panels: Array<PanelModel>;
/**
* The index of current active dynamical panel when the renderMode is not "list". If there is no dymamic panel (panelCount = 0) or renderMode equals "list" it returns -1, otherwise it returns a value from 0 to panelCount - 1.
* @see currentPanel
* @see panels
* @see panelCount
* @see renderMode
*/
currentIndex: number;
/**
* The current active dynamical panel when the renderMode is not "list". If there is no dymamic panel (panelCount = 0) or renderMode equals "list" it returns null.
* @see currenIndex
* @see panels
* @see panelCount
* @see renderMode
*/
readonly currentPanel: PanelModel;
/**
* Set it to true, to show a confirmation dialog on removing a panel
* @see ConfirmDeleteText
*/
confirmDelete: boolean;
/**
* Set it to a question name used in the template panel and the library shows duplication error, if there are same values in different panels of this question.
* @see keyDuplicationError
*/
keyName: string;
/**
* Use this property to change the default text showing in the confirmation delete dialog on removing a panel.
*/
confirmDeleteText: string;
readonly locConfirmDeleteText: LocalizableString;
/**
* The duplication value error text. Set it to show the text different from the default.
* @see keyName
*/
keyDuplicationError: string;
readonly locKeyDuplicationError: LocalizableString;
/**
* Use this property to change the default previous button text. Previous button shows the previous panel, change the currentPanel, when the renderMode doesn't equal to "list".
* @see currentPanel
* @see currentIndex
* @see renderMode
*/
panelPrevText: string;
readonly locPanelPrevText: LocalizableString;
/**
* Use this property to change the default next button text. Next button shows the next panel, change the currentPanel, when the renderMode doesn't equal to "list".
* @see currentPanel
* @see currentIndex
* @see renderMode
*/
panelNextText: string;
readonly locPanelNextText: LocalizableString;
/**
* Use this property to change the default value of add panel button text.
*/
panelAddText: string;
readonly locPanelAddText: LocalizableString;
/**
* Use this property to change the default value of remove panel button text.
*/
panelRemoveText: string;
readonly locPanelRemoveText: LocalizableString;
/**
* Returns true when the renderMode equals to "progressTop" or "progressTopBottom"
*/
readonly isProgressTopShowing: boolean;
/**
* Returns true when the renderMode equals to "progressBottom" or "progressTopBottom"
*/
readonly isProgressBottomShowing: boolean;
/**
* Returns true when currentIndex is more than 0.
* @see currenIndex
* @see currenPanel
*/
readonly isPrevButtonShowing: boolean;
/**
* Returns true when currentIndex is more than or equal 0 and less then panelCount - 1.
* @see currenIndex
* @see currenPanel
* @see panelCount
*/
readonly isNextButtonShowing: boolean;
/**
* Returns true when showRangeInProgress equals to true, renderMode doesn't equal to "list" and panelCount is >= 2.
*/
readonly isRangeShowing: boolean;
getElementsInDesign(includeHidden?: boolean): Array<IElement>;
protected getValueCore(): any;
protected setValueCore(newValue: any): void;
/**
* Use this property to get/set the number of dynamic panels.
* @see template
* @see minPanelCount
* @see maxPanelCount
* @see addPanel
* @see removePanel
* @see removePanelUI
*/
panelCount: number;
/**
* Use this property to allow the end-user to collapse/expand the panels. It works only if the renderMode property equals to "list" and templateTitle property is not empty. The following values are available:
* <br/> default - the default value. User can't collpase/expand panels
* <br/> expanded - User can collpase/expand panels and all panels are expanded by default
* <br/> collapsed - User can collpase/expand panels and all panels are collapsed by default
* <br/> firstExpanded - User can collpase/expand panels. The first panel is expanded and others are collapsed
* @see renderMode
* @see templateTitle
*/
panelsState: string;
/**
* The minimum panel count. A user could not delete a panel if the panelCount equals to minPanelCount
* @see panelCount
* @see maxPanelCount
*/
minPanelCount: number;
/**
* The maximum panel count. A user could not add a panel if the panelCount equals to maxPanelCount
* @see panelCount
* @see minPanelCount
*/
maxPanelCount: number;
/**
* Set this property to false to hide the 'Add New' button
* @see allowRemovePanel
*/
allowAddPanel: boolean;
/**
* Set this property to false to hide the 'Remove' button
* @see allowAddPanel
*/
allowRemovePanel: boolean;
/**
* Set this property different from "default" to set the specific question title location for the template questions.
* @see SurveyModel.questionTitleLocation
* @see PanelModelBase.questionTitleLocation
*/
templateTitleLocation: string;
/**
* Use this property to show/hide the numbers in titles in questions inside a dynamic panel.
* By default the value is "off". You may set it to "onPanel" and the first question inside a dynamic panel will start with 1 or "onSurvey" to include nested questions in dymamic panels into global survey question numbering.
*/
showQuestionNumbers: string;
/**
* Shows the range from 1 to panelCount when renderMode doesn't equal to "list". Set to false to hide this element.
* @see panelCount
* @see renderMode
*/
showRangeInProgress: boolean;
/**
* By default the property equals to "list" and all dynamic panels are rendered one by one on the page. You may change it to: "progressTop", "progressBottom" or "progressTopBottom" to render only one dynamic panel at once. The progress and navigation elements can be rendred on top, bottom or both.
*/
renderMode: string;
/**
* Returns true when renderMode equals to "list".
* @see renderMode
*/
readonly isRenderModeList: boolean;
setVisibleIndex(value: number): number;
/**
* Returns true when an end user may add a new panel. The question is not read only and panelCount less than maxPanelCount
* @see isReadOnly
* @see panelCount
* @see maxPanelCount
*/
readonly canAddPanel: boolean;
/**
* Returns true when an end user may remove a panel. The question is not read only and panelCount is more than minPanelCount
* @see isReadOnly
* @see panelCount
* @see minPanelCount
*/
readonly canRemovePanel: boolean;
protected rebuildPanels(): void;
/**
* If it is not empty, then this value is set to every new panel, including panels created initially, unless the defaultValue is not empty
* @see defaultValue
* @see defaultValueFromLastRow
*/
defaultPanelValue: any;
/**
* Set it to true to copy the value into new added panel from the last panel. If defaultPanelValue is set and this property equals to true,
* then the value for new added panel is merging.
* @see defaultValue
* @see defaultPanelValue
*/
defaultValueFromLastPanel: boolean;
protected isDefaultValueEmpty(): boolean;
protected setDefaultValue(): void;
isEmpty(): boolean;
/**
* Add a new dynamic panel based on the template Panel. It checks if canAddPanel returns true and then calls addPanel method.
* @see template
* @see panelCount
* @see panels
* @see canAddPanel
*/
addPanelUI(): PanelModel;
/**
* Add a new dynamic panel based on the template Panel.
* @see template
* @see panelCount
* @see panels
*/
addPanel(): PanelModel;
/**
* Call removePanel function. Do nothing is canRemovePanel returns false. If confirmDelete set to true, it shows the confirmation dialog first.
* @param value a panel or panel index
* @see removePanel
* @see confirmDelete
* @see confirmDeleteText
* @see canRemovePanel
*
*/
removePanelUI(value: any): void;
/**
* Goes to the next panel in the PanelDynamic
*
*/
goToNextPanel(): void;
/**
* Goes to the previous panel in the PanelDynamic
*
*/
goToPrevPanel(): void;
/**
* Removes a dynamic panel from the panels array.
* @param value a panel or panel index
* @see panels
* @see template
*/
removePanel(value: any): void;
locStrsChanged(): void;
clearIncorrectValues(): void;
clearErrors(): void;
getQuestionFromArray(name: string, index: number): IQuestion;
getSharedQuestionFromArray(name: string, panelIndex: number): Question;
addConditionObjectsByContext(objects: Array<IConditionObject>, context: any): void;
getConditionJson(operator?: string, path?: string): any;
protected onReadOnlyChanged(): void;
onSurveyLoad(): void;
onFirstRendering(): void;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
protected runPanelsCondition(values: HashTable<any>, properties: HashTable<any>): void;
onAnyValueChanged(name: string): void;
hasErrors(fireCallback?: boolean, rec?: any): boolean;
protected getContainsErrors(): boolean;
protected getIsAnswered(): boolean;
clearValueIfInvisible(): void;
protected getIsRunningValidators(): boolean;
getAllErrors(): Array<SurveyError>;
protected getDisplayValueCore(keysAsText: boolean, value: any): any;
protected createNewPanel(): PanelModel;
protected createAndSetupNewPanelObject(): PanelModel;
protected createNewPanelObject(): PanelModel;
setQuestionValue(newValue: any): void;
onSurveyValueChanged(newValue: any): void;
protected onSetData(): void;
getItemIndex(item: ISurveyData): number;
getPanelItemData(item: ISurveyData): any;
setPanelItemData(item: ISurveyData, name: string, val: any): void;
getSurvey(): ISurvey;
getRootData(): ISurveyData;
getPlainData(options?: {
includeEmpty?: boolean;
calculations?: Array<{
propertyName: string;
}>;
}): any;
readonly progressText: string;
}
export declare var surveyTimerFunctions: {
setTimeout: (func: () => any) => number;
clearTimeout: (timerId: number) => void;
};
export declare class SurveyTimer {
static readonly instance: SurveyTimer;
onTimer: Event<() => any, any>;
start(func?: () => any): void;
stop(func?: () => any): void;
doTimer(): void;
}
/**
* The `Survey` object contains information about the survey, Pages, Questions, flow logic and etc.
*/
export declare class SurveyModel extends Base implements ISurvey, ISurveyData, ISurveyImpl, ISurveyTriggerOwner, ISurveyErrorOwner, ILocalizableOwner {
[index: string]: any;
static platform: string;
readonly platformName: string;
/**
* You can display an additional field (comment field) for the most of questions; users can enter additional comments to their response.
* The comment field input is saved as `'question name' + 'commentPrefix'`.
* @see data
* @see Question.hasComment
*/
commentPrefix: string;
/**
* The event is fired before the survey is completed and the `onComplete` event is fired. You can prevent the survey from completing by setting `options.allowComplete` to `false`
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.allowComplete` - Specifies whether a user can complete a survey. Set this property to `false` to prevent the survey from completing. The default value is `true`.
* @see onComplete
*/
onCompleting: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired after a user clicks the 'Complete' button and finishes a survey. Use this event to send the survey data to your web server.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.showDataSaving(text)` - call this method to show that the survey is saving survey data on your server. The `text` is an optional parameter to show a custom message instead of default.
* <br/> `options.showDataSavingError(text)` - call this method to show that an error occurred while saving the data on your server. If you want to show a custom error, use an optional `text` parameter.
* <br/> `options.showDataSavingSuccess(text)` - call this method to show that the data was successfully saved on the server.
* <br/> `options.showDataSavingClear` - call this method to hide the text about the saving progress.
* @see data
* @see clearInvisibleValues
* @see completeLastPage
* @see surveyPostId
*/
onComplete: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired after a user clicks the 'Complete' button. The event allows you to specify the URL opened after completing a survey.
* Specify the `navigateToUrl` property to make survey navigate to another url.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.url` - Specifies a URL opened after completing a survey. Set this property to an empty string to cancel the navigation and show the completed survey page.
* @see navigateToUrl
* @see navigateToUrlOnCondition
*/
onNavigateToUrl: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired after the survey changed it's state from "starting" to "running". The "starting" state means that survey shows the started page.
* The `firstPageIsStarted` property should be set to `true`, if you want to display a start page in your survey. In this case, an end user should click the "Start" button to start the survey.
* @see firstPageIsStarted
*/
onStarted: Event<(sender: SurveyModel) => any, any>;
/**
* The event is fired on clicking the 'Next' button if the `sendResultOnPageNext` is set to `true`. You can use it to save the intermediate results, for example, if your survey is large enough.
* <br/> `sender` - the survey object that fires the event.
* @see sendResultOnPageNext
*/
onPartialSend: Event<(sender: SurveyModel) => any, any>;
/**
* The event is fired before the current page changes to another page. Typically it happens when a user click the 'Next' or 'Prev' buttons.
* <br/> `sender` - the survey object that fires the event.
* <br/> `option.oldCurrentPage` - the previous current/active page.
* <br/> `option.newCurrentPage` - a new current/active page.
* <br/> `option.allowChanging` - set it to `false` to disable the current page changing. It is `true` by default.
* <br/> `option.isNextPage` - commonly means, that end-user press the next page button. In general, it means that options.newCurrentPage is the next page after options.oldCurrentPage
* <br/> `option.isPrevPage` - commonly means, that end-user press the previous page button. In general, it means that options.newCurrentPage is the previous page before options.oldCurrentPage
* @see currentPage
* @see currentPageNo
* @see nextPage
* @see prevPage
* @see completeLastPage
* @see onCurrentPageChanged
**/
onCurrentPageChanging: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired when the current page has been changed to another page. Typically it happens when a user click on 'Next' or 'Prev' buttons.
* <br/> `sender` - the survey object that fires the event.
* <br/> `option.oldCurrentPage` - a previous current/active page.
* <br/> `option.newCurrentPage` - a new current/active page.
* <br/> `option.isNextPage` - commonly means, that end-user press the next page button. In general, it means that options.newCurrentPage is the next page after options.oldCurrentPage
* <br/> `option.isPrevPage` - commonly means, that end-user press the previous page button. In general, it means that options.newCurrentPage is the previous page before options.oldCurrentPage
* @see currentPage
* @see currentPageNo
* @see nextPage
* @see prevPage
* @see completeLastPage
* @see onCurrentPageChanging
*/
onCurrentPageChanged: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired before the question value (answer) is changed. It can be done via UI by a user or programmatically on calling the `setValue` method.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.name` - the value name that has being changed.
* <br/> `options.question` - a question which `question.name` equals to the value name. If there are several questions with the same name, the first question is used. If there is no such questions, the `options.question` is null.
* <br/> `options.oldValue` - an old, previous value.
* <br/> `options.value` - a new value. You can change it.
* @see setValue
* @see onValueChanged
*/
onValueChanging: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired when the question value (i.e., answer) has been changed. The question value can be changed in UI (by a user) or programmatically (on calling `setValue` method).
* Use the `onDynamicPanelItemValueChanged` and `onMatrixCellValueChanged` events to handle changes in a question in the Panel Dynamic and a cell question in matrices.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.name` - the value name that has been changed.
* <br/> `options.question` - a question which `question.name` equals to the value name. If there are several questions with the same name, the first question is used. If there is no such questions, the `options.question` is `null`.
* <br/> `options.value` - a new value.
* @see setValue
* @see onValueChanging
* @see onDynamicPanelItemValueChanged
* @see onMatrixCellValueChanged
*/
onValueChanged: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired when a question visibility has been changed.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a question which visibility has been changed.
* <br/> `options.name` - a question name.
* <br/> `options.visible` - a question `visible` boolean value.
* @see Question.visibile
* @see Question.visibileIf
*/
onVisibleChanged: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on changing a page visibility.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.page` - a page which visibility has been changed.
* <br/> `options.visible` - a page `visible` boolean value.
* @see PageModel.visibile
* @see PageModel.visibileIf
*/
onPageVisibleChanged: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on changing a panel visibility.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.panel` - a panel which visibility has been changed.
* <br/> `options.visible` - a panel `visible` boolean value.
* @see PanelModel.visibile
* @see PanelModel.visibileIf
*/
onPanelVisibleChanged: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on creating a new question.
* Unlike the onQuestionAdded event, this event calls for all question created in survey including inside: a page, panel, matrix cell, dynamic panel and multiple text.
* or inside a matrix cell or it can be a text question in multiple text items or inside a panel of a panel dynamic.
* You can use this event to set up properties to a question based on it's type for all questions, regardless where they are located, on the page or inside a matrix cell.
* Please note: If you want to use this event for questions loaded from JSON then you have to create survey with empty/null JSON parameter, assign the event and call survey.fromJSON(yourJSON) function.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a newly created question object.
* @see Question
* @see onQuestionAdded
*/
onQuestionCreated: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on adding a new question into survey.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a newly added question object.
* <br/> `options.name` - a question name.
* <br/> `options.index` - an index of the question in the container (page or panel).
* <br/> `options.parentPanel` - a container where a new question is located. It can be a page or panel.
* <br/> `options.rootPanel` - typically, it is a page.
* @see Question
* @see onQuestionCreated
*/
onQuestionAdded: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on removing a question from survey.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a removed question object.
* <br/> `options.name` - a question name.
* @see Question
*/
onQuestionRemoved: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on adding a panel into survey.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.panel` - a newly added panel object.
* <br/> `options.name` - a panel name.
* <br/> `options.index` - an index of the panel in the container (a page or panel).
* <br/> `options.parentPanel` - a container (a page or panel) where a new panel is located.
* <br/> `options.rootPanel` - a root container, typically it is a page.
* @see PanelModel
*/
onPanelAdded: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on removing a panel from survey.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.panel` - a removed panel object.
* <br/> `options.name` - a panel name.
* @see PanelModel
*/
onPanelRemoved: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on adding a page into survey.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.page` - a newly added `panel` object.
* @see PanelModel
*/
onPageAdded: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on validating value in a question. You can specify a custom error message using `options.error`. The survey blocks completing the survey or going to the next page when the error messages are displayed.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a validated question.
* <br/> `options.name` - a question name.
* <br/> `options.value` - the current question value (answer).
* <br/> `options.error` - an error string. It is empty by default.
* @see onServerValidateQuestions
* @see onSettingQuestionErrors
*/
onValidateQuestion: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired before errors are assigned to a question. You may add/remove/modify errors for a question.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a validated question.
* <br/> `options.errors` - the list of errors. The list is empty by default and remains empty if a validated question has no errors.
* @see onValidateQuestion
*/
onSettingQuestionErrors: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* Use this event to validate data on your server.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.data` - the values of all non-empty questions on the current page. You can get a question value as `options.data["myQuestionName"]`.
* <br/> `options.errors` - set your errors to this object as: `options.errors["myQuestionName"] = "Error text";`. It will be shown as a question error.
* <br/> `options.complete()` - call this function to tell survey that your server callback has been processed.
* @see onValidateQuestion
* @see onValidatePanel
*/
onServerValidateQuestions: any;
/**
* The event is fired on validating a panel. Set your error to `options.error` and survey will show the error for the panel and block completing the survey or going to the next page.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.name` - a panel name.
* <br/> `options.error` - an error string. It is empty by default.
* @see onValidateQuestion
*/
onValidatePanel: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* Use the event to change the default error text.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.text` - an error text.
* <br/> `options.error` - an instance of the `SurveyError` object.
* <br/> `options.name` - the error name. The following error names are available:
* required, requireoneanswer, requirenumeric, exceedsize, webrequest, webrequestempty, otherempty,
* uploadingfile, requiredinallrowserror, minrowcounterror, keyduplicationerror, custom
*/
onErrorCustomText: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* Use the this event to be notified when the survey finished validate questions on the current page. It commonly happens when a user try to go to the next page or complete the survey
* options.questions - the list of questions that have errors
* options.errors - the list of errors
* options.page - the page where question(s) are located
*/
onValidatedErrorsOnCurrentPage: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* Use this event to modify the HTML content before rendering, for example `completeHtml` or `loadingHtml`.
* `options.html` - specifies the modified HTML content.
* @see completedHtml
* @see loadingHtml
*/
onProcessHtml: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* Use this event to change the question title in code.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.title` - a calculated question title, based on question `title`, `name`, `isRequired`, and `visibleIndex` properties.
* <br/> `options.question` - a question object.
*/
onGetQuestionTitle: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* Use this event to process the markdown text.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.element` - SurveyJS element (a question, panel, page, or survey) where the string is going to be rendered.
* <br/> `options.text` - a text that is going to be rendered.
* <br/> `options.html` - an HTML content. It is `null` by default. Use this property to specify the HTML content rendered instead of `options.text`.
*/
onTextMarkdown: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event fires when it gets response from the [dxsurvey.com](http://www.dxsurvey.com) service on saving survey results. Use it to find out if the results have been saved successfully.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.success` - it is `true` if the results has been sent to the service successfully.
* <br/> `options.response` - a response from the service.
*/
onSendResult: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* Use it to get results after calling the `getResult` method. It returns a simple analytics from [dxsurvey.com](http://www.dxsurvey.com) service.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.success` - it is `true` if the results were got from the service successfully.
* <br/> `options.data` - the object `{AnswersCount, QuestionResult : {} }`. `AnswersCount` is the number of posted survey results. `QuestionResult` is an object with all possible unique answers to the question and number of these answers.
* <br/> `options.dataList` - an array of objects `{name, value}`, where `name` is an unique value/answer to the question and `value` is a number/count of such answers.
* <br/> `options.response` - the server response.
* @see getResult
*/
onGetResult: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on uploading the file in QuestionFile when `storeDataAsText` is set to `false`. Use this event to change the uploaded file name or to prevent a particular file from being uploaded.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.name` - the file name.
* <br/> `options.file` - the Javascript File object.
* <br/> `options.accept` - a boolean value, `true` by default. Set it to `false` to deny this file uploading.
* @see uploadFiles
* @see QuestionFileModel.storeDataAsText
*/
onUploadFiles: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on downloading a file in QuestionFile. Use this event to pass the file to a preview.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.name` - the question name.
* <br/> `options.content` - the file content.
* <br/> `options.fileValue` - single file question value.
* <br/> `options.callback` - a call back function to get the status on downloading the file and the downloaded file content.
* @see downloadFile
*/
onDownloadFile: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* This event is fired on clearing the value in a QuestionFile. Use this event to remove files stored on your server.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.name` - the question name.
* <br/> `options.value` - the question value.
* <br/> `options.fileName` - a removed file's name, set it to `null` to clear all files.
* <br/> `options.callback` - a call back function to get the status on clearing the files operation.
* @see clearFiles
*/
onClearFiles: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired after choices for radiogroup, checkbox, and dropdown has been loaded from a RESTful service and before they are assigned to a question.
* You may change the choices, before they are assigned or disable/enabled make visible/invisible question, based on loaded results.
* <br/> `sender` - the survey object that fires the event.
* <br/> `question` - the question where loaded choices are going to be assigned.
* <br/> `choices` - the loaded choices. You can change the loaded choices to before they are assigned to question.
* <br/> `serverResult` - a result that comes from the server as it is.
*/
onLoadChoicesFromServer: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired after survey is loaded from api.surveyjs.io service.
* You can use this event to perform manipulation with the survey model after it was loaded from the web service.
* <br/> `sender` - the survey object that fires the event.
* @see surveyId
* @see loadSurveyFromService
*/
onLoadedSurveyFromService: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on processing the text when it finds a text in brackets: `{somevalue}`. By default, it uses the value of survey question values and variables.
* For example, you may use the text processing in loading choices from the web. If your `choicesByUrl.url` equals to "UrlToServiceToGetAllCities/{country}/{state}",
* you may set on this event `options.value` to "all" or empty string when the "state" value/question is non selected by a user.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.name` - the name of the processing value, for example, "state" in our example.
* <br/> `options.value` - the value of the processing text.
* <br/> `options.isExists` - a boolean value. Set it to `true` if you want to use the value and set it to `false` if you don't.
*/
onProcessTextValue: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired before rendering a question. Use it to override the default question CSS classes.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a question for which you can change the CSS classes.
* <br/> `options.cssClasses` - an object with CSS classes. For example `{root: "table", button: "button"}`. You can change them to your own CSS classes.
*/
onUpdateQuestionCssClasses: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired before rendering a panel. Use it to override the default panel CSS classes.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.panel` - a panel for which you can change the CSS classes.
* <br/> `options.cssClasses` - an object with CSS classes. For example `{title: "sv_p_title", description: "small"}`. You can change them to your own CSS classes.
*/
onUpdatePanelCssClasses: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired before rendering a page. Use it to override the default page CSS classes.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.page` - a page for which you can change the CSS classes.
* <br/> `options.cssClasses` - an object with CSS classes. For example `{title: "sv_p_title", description: "small"}`. You can change them to your own CSS classes.
*/
onUpdatePageCssClasses: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired right after survey is rendered in DOM.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.htmlElement` - a root HTML element bound to the survey object.
*/
onAfterRenderSurvey: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired right after a page is rendered in DOM. Use it to modify HTML elements.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.htmlElement` - an HTML element bound to the survey header object.
*/
onAfterRenderHeader: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired right after a page is rendered in DOM. Use it to modify HTML elements.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.page` - a page object for which the event is fired. Typically the current/active page.
* <br/> `options.htmlElement` - an HTML element bound to the page object.
*/
onAfterRenderPage: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired right after a question is rendered in DOM. Use it to modify HTML elements.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a question object for which the event is fired.
* <br/> `options.htmlElement` - an HTML element bound to the question object.
*/
onAfterRenderQuestion: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired right after a non-composite question (text, comment, dropdown, radiogroup, checkbox) is rendered in DOM. Use it to modify HTML elements.
* This event is not fired for matrices, panels, multiple text and image picker.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a question object for which the event is fired.
* <br/> `options.htmlElement` - an HTML element bound to the question object.
*/
onAfterRenderQuestionInput: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired right after a panel is rendered in DOM. Use it to modify HTML elements.
* <br/> `sender` - the survey object that fires the event
* <br/> `options.panel` - a panel object for which the event is fired
* <br/> `options.htmlElement` - an HTML element bound to the panel object
*/
onAfterRenderPanel: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on adding a new row in Matrix Dynamic question.
* <br/> `sender` - the survey object that fires the event
* <br/> `options.question` - a matrix question.
* <br/> `options.row` - a new added row.
* @see QuestionMatrixDynamicModel
* @see QuestionMatrixDynamicModel.visibleRows
*/
onMatrixRowAdded: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired before adding a new row in Matrix Dynamic question.
* <br/> `sender` - the survey object that fires the event
* <br/> `options.question` - a matrix question.
* <br/> `options.canAddRow` - specifies whether a new row can be added
* @see QuestionMatrixDynamicModel
* @see QuestionMatrixDynamicModel.visibleRows
*/
onMatrixBeforeRowAdded: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on removing a row from Matrix Dynamic question.
* <br/> `sender` - the survey object that fires the event
* <br/> `options.question` - a matrix question
* <br/> `options.rowIndex` - a removed row index
* <br/> `options.row` - a removed row object
* @see QuestionMatrixDynamicModel
* @see QuestionMatrixDynamicModel.visibleRows
*/
onMatrixRowRemoved: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired before rendering "Remove" button for removing a row from Matrix Dynamic question.
* <br/> `sender` - the survey object that fires the event
* <br/> `options.question` - a matrix question.
* <br/> `options.rowIndex` - a row index.
* <br/> `options.row` - a row object.
* <br/> `options.allow` - a boolean property. Set it to `false` to disable the row removing.
* @see QuestionMatrixDynamicModel
*/
onMatrixAllowRemoveRow: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired for every cell created in Matrix Dynamic and Matrix Dropdown questions.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - the matrix question.
* <br/> `options.cell` - the matrix cell.
* <br/> `options.cellQuestion` - the question/editor in the cell. You may customize it, change it's properties, like choices or visible.
* <br/> `options.rowValue` - the value of the current row. To access a particular column's value within the current row, use: `options.rowValue["columnValue"]`.
* <br/> `options.column` - the matrix column object.
* <br/> `options.columName` - the matrix column name.
* <br/> `options.row` - the matrix row object.
* @see onMatrixBeforeRowAdded
* @see onMatrixRowAdded
* @see QuestionMatrixDynamicModel
* @see QuestionMatrixDropdownModel
*/
onMatrixCellCreated: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired for every cell after is has been rendered in DOM.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - the matrix question.
* <br/> `options.cell` - the matrix cell.
* <br/> `options.cellQuestion` - the question/editor in the cell.
* <br/> `options.htmlElement` - an HTML element bound to the `cellQuestion` object.
* <br/> `options.column` - the matrix column object.
* <br/> `options.row` - the matrix row object.
* @see onMatrixCellCreated
* @see QuestionMatrixDynamicModel
* @see QuestionMatrixDropdownModel
*/
onMatrixAfterCellRender: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired when cell value is changed in Matrix Dynamic and Matrix Dropdown questions.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - the matrix question.
* <br/> `options.columName` - the matrix column name.
* <br/> `options.value` - a new value.
* <br/> `options.row` - the matrix row object.
* <br/> `options.getCellQuestion(columnName)` - the function that returns the cell question by column name.
* @see onMatrixCellValueChanging
* @see onMatrixBeforeRowAdded
* @see onMatrixRowAdded
* @see QuestionMatrixDynamicModel
* @see QuestionMatrixDropdownModel
*/
onMatrixCellValueChanged: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on changing cell value in Matrix Dynamic and Matrix Dropdown questions. You may change the `options.value` property to change a cell value.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - the matrix question.
* <br/> `options.columName` - the matrix column name.
* <br/> `options.value` - a new value.
* <br/> `options.oldValue` - the old value.
* <br/> `options.row` - the matrix row object.
* <br/> `options.getCellQuestion(columnName)` - the function that returns a cell question by column name.
* @see onMatrixCellValueChanged
* @see onMatrixBeforeRowAdded
* @see onMatrixRowAdded
* @see QuestionMatrixDynamicModel
* @see QuestionMatrixDropdownModel
*/
onMatrixCellValueChanging: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired when Matrix Dynamic and Matrix Dropdown questions validate the cell value.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - the matrix question.
* <br/> `options.columName` - the matrix column name.
* <br/> `options.value` - a cell value.
* <br/> `options.row` - the matrix row object.
* <br/> `options.getCellQuestion(columnName)` - the function that returns the cell question by column name.
* @see onMatrixBeforeRowAdded
* @see onMatrixRowAdded
* @see QuestionMatrixDynamicModel
* @see QuestionMatrixDropdownModel
*/
onMatrixCellValidate: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on adding a new panel in Panel Dynamic question.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a panel question.
* @see QuestionPanelDynamicModel
* @see QuestionPanelDynamicModel.panels
*/
onDynamicPanelAdded: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired on removing a panel from Panel Dynamic question.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a panel question.
* <br/> `options.panelIndex` - a removed panel index.
* <br/> `options.panel` - a removed panel.
* @see QuestionPanelDynamicModel
* @see QuestionPanelDynamicModel.panels
*/
onDynamicPanelRemoved: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired every second if the method `startTimer` has been called.
* @see startTimer
* @see timeSpent
* @see Page.timeSpent
*/
onTimer: Event<(sender: SurveyModel) => any, any>;
/**
* The event is fired before displaying a new information in the Timer Panel. Use it to change the default text.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.text` - the timer panel info text.
*/
onTimerPanelInfoText: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The event is fired when item value is changed in Panel Dynamic question.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - the panel question.
* <br/> `options.panel` - the dynamic panel item.
* <br/> `options.name` - the item name.
* <br/> `options.value` - a new value.
* <br/> `options.itemIndex` - the panel item index.
* <br/> `options.itemValue` - the panel item object.
* @see onDynamicPanelAdded
* @see QuestionPanelDynamicModel
*/
onDynamicPanelItemValueChanged: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* Use this event to define, whether an answer to a question is correct or not.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.question` - a question on which you have to decide if the answer is correct or not.
* <br/> `options.result` - returns `true`, if an answer is correct, or `false`, if the answer is not correct. Use questions' `value` and `correctAnswer` properties to return the correct value.
* <br/> `options.correctAnswers` - you may change the default number of correct or incorrect answers in the question, for example for matrix, where each row is a quiz question.
* @see Question.value
* @see Question.correctAnswer
*/
onIsAnswerCorrect: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* Use this event to control drag&drop operations during design mode.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.allow` - set it to `false` to disable dragging.
* <br/> `options.target` - a target element that is dragged.
* <br/> `options.source` - a source element. It can be `null`, if it is a new element, dragging from toolbox.
* <br/> `options.parent` - a page or panel where target element is dragging.
* <br/> `options.insertBefore` - an element before the target element is dragging. It can be `null` if parent container (page or panel) is empty or dragging an element after the last element in a container.
* <br/> `options.insertAfter` - an element after the target element is dragging. It can be `null` if parent container (page or panel) is empty or dragging element to the first position within the parent container.
* @see setDesignMode
* @see isDesignMode
*/
onDragDropAllow: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* Use this event to control scrolling element to top. You can cancel the default behavior by setting options.cancel property to true.
* <br/> `sender` - the survey object that fires the event.
* <br/> `options.element` - an element that is going to be scrolled on top.
* <br/> `options.question` - a question that is going to be scrolled on top. It can be null if options.page is not null.
* <br/> `options.page` - a page that is going to be scrolled on top. It can be null if options.question is not null.
* <br/> `options.elementId` - the unique element DOM Id.
* <br/> `options.cancel` - set this property to true to cancel the default scrolling.
*/
onScrollingElementToTop: Event<(sender: SurveyModel, options: any) => any, any>;
/**
* The list of errors on loading survey JSON. If the list is empty after loading a JSON, then the JSON is correct and has no errors.
* @see JsonError
*/
jsonErrors: Array<JsonError>;
constructor(jsonObj?: any);
getType(): string;
protected onPropertyValueChanged(name: string, oldValue: any, newValue: any): void;
/**
* Returns a list of all pages in the survey, including invisible pages.
* @see PageModel
* @see visiblePages
*/
readonly pages: Array<PageModel>;
getCss(): any;
css: any;
/**
* Gets or sets a list of triggers in the survey.
* @see SurveyTrigger
*/
triggers: Array<SurveyTrigger>;
/**
* Gets or sets a list of calculated values in the survey.
* @see CalculatedValue
*/
calculatedValues: Array<CalculatedValue>;
/**
* Gets or sets an identifier of a survey model loaded from the [dxsurvey.com](http://www.dxsurvey.com) service. When specified, the survey JSON is automatically loaded from [dxsurvey.com](http://www.dxsurvey.com) service.
* @see loadSurveyFromService
* @see onLoadedSurveyFromService
*/
surveyId: string;
/**
* Gets or sets an identifier of a survey model saved to the [dxsurvey.com](http://www.dxsurvey.com) service. When specified, the survey data is automatically saved to the [dxsurvey.com](http://www.dxsurvey.com) service.
* @see onComplete
* @see surveyShowDataSaving
*/
surveyPostId: string;
/**
* Gets or sets user's identifier (e.g., e-mail or unique customer id) in your web application.
* If you load survey or post survey results from/to [dxsurvey.com](http://www.dxsurvey.com) service, then the library do not allow users to run the same survey the second time.
* On the second run, the user will see the survey complete page.
*/
clientId: string;
/**
* Gets or sets a cookie name used to save information about completing the survey.
* If the property is not empty, before starting the survey, the Survey library checks if the cookie with this name exists.
* If it is `true`, the survey goes to complete mode and a user sees the survey complete page. On completing the survey the cookie with this name is created.
*/
cookieName: string;
/**
* Gets or sets whether to save survey results on completing every page. If the property value is set to `true`, the `onPartialSend` event is fired.
* @see onPartialSend
* @see clientId
*/
sendResultOnPageNext: boolean;
/**
* Gets or sets whether to show the progress on saving/sending data into the [dxsurvey.com](http://www.dxsurvey.com) service.
* @see surveyPostId
*/
surveyShowDataSaving: boolean;
/**
* Gets or sets whether the first input is focused on showing a next or a previous page.
*/
focusFirstQuestionAutomatic: boolean;
/**
* Gets or sets whether the first input is focused if the current page has errors.
* Set this property to `false` (the default value is `true`) if you do not want to bring the focus to the first question that has error on the page.
*/
focusOnFirstError: boolean;
/**
* Gets or sets the navigation buttons position.
* Possible values: 'bottom' (default), 'top', 'both' and 'none'. Set it to 'none' to hide 'Prev', 'Next' and 'Complete' buttons.
* It makes sense if you are going to create a custom navigation, have only a single page, or the `goNextPageAutomatic` property is set to `true`.
* @see goNextPageAutomatic
* @see showPrevButton
*/
showNavigationButtons: string | any;
/**
* Gets or sets whether the Survey displays "Prev" button in its pages. Set it to `false` to prevent end-users from going back to their answers.
* @see showNavigationButtons
*/
showPrevButton: boolean;
/**
* Gets or sets whether the Survey displays survey title in its pages. Set it to `false` to hide a survey title.
* @see title
*/
showTitle: boolean;
/**
* Gets or sets whether the Survey displays page titles. Set it to `false` to hide page titles.
* @see PageModel.title
*/
showPageTitles: boolean;
/**
* On finishing the survey the complete page is shown. Set the property to `false`, to hide the complete page.
* @see data
* @see onComplete
* @see navigateToUrl
*/
showCompletedPage: boolean;
/**
* Set this property to a url you want to navigate after a user completing the survey.
* By default it uses after calling onComplete event. In case calling options.showDataSaving callback in onComplete event, navigateToUrl will be used on calling options.showDataSavingSuccess callback.
*/
navigateToUrl: string;
/**
* Gets or sets a list of URL condition items. If the expression of this item returns `true`, then survey will navigate to the item URL.
* @see UrlConditionItem
* @see navigateToUrl
*/
navigateToUrlOnCondition: Array<UrlConditionItem>;
getNavigateToUrl(): string;
/**
* Gets or sets the required question mark. The required question mark is a char or string that is rendered in the required questions' titles.
* @see Question.title
*/
requiredText: string;
/**
* Gets or sets whether to hide all required errors.
*/
hideRequiredErrors: boolean;
beforeSettingQuestionErrors(question: IQuestion, errors: Array<SurveyError>): void;
/**
* Gets or sets the first question index. The first question index is '1' by default. You may start it from '100' or from 'A', by setting '100' or 'A' to this property.
* You can set the start index to "(1)" or "# A)" or "a)" to render question number as (1), # A) and a) accordingly.
* @see Question.title
* @see requiredText
*/
questionStartIndex: string;
/**
* Gets or sets whether the "Others" option text is stored as question comment.
*
* By default the entered text in the "Others" input in the checkbox/radiogroup/dropdown is stored as `"question name " + "-Comment"`. The value itself is `"question name": "others"`.
* Set this property to `false`, to store the entered text directly in the `"question name"` key.
* @see commentPrefix
*/
storeOthersAsComment: boolean;
/**
* Specifies the default maximum length for questions like text and comment, including matrix cell questions.
*
* The default value is `0`, that means that the text and comment have the same max length as the standard HTML input - 524288 characters: https://www.w3schools.com/tags/att_input_maxlength.asp.
* @see maxOthersLength
*/
maxTextLength: number;
/**
* Gets or sets the default maximum length for question comments and others
*
* The default value is `0`, that means that the question comments have the same max length as the standard HTML input - 524288 characters: https://www.w3schools.com/tags/att_input_maxlength.asp.
* @see Question.hasComment
* @see Question.hasOther
* @see maxTextLength
*/
maxOthersLength: number;
/**
* Gets or ses whether a user can navigate the next page automatically after answering all the questions on a page without pressing the "Next" button.
* The available options:
*
* - `true` - navigate the next page and submit survey data automatically.
* - `autogonext` - navigate the next page automatically but do not submit survey data.
* - `false` - do not navigate the next page and do not submit survey data automatically.
* @see showNavigationButtons
*/
goNextPageAutomatic: boolean | "autogonext";
/**
* Gets or sets whether a survey is automatically completed when `goNextPageAutomatic = true`. Set it to `false` if you do not want to submit survey automatically on completing the last survey page.
* @see goNextPageAutomatic
*/
allowCompleteSurveyAutomatic: boolean;
/**
* Gets or sets a value that specifies how the survey validates the question answers.
*
* The following options are available:
*
* - `onNextPage` (default) - check errors on navigating to the next page or on completing the survey.
* - `onValueChanged` - check errors on every question value (i.e., answer) changing.
* - `onComplete` - to validate all visible questions on complete button click. If there are errors on previous pages, then the page with the first error becomes the current.
*/
checkErrorsMode: string;
/**
* Gets or sets a value that specifies how the survey updates its questions' text values.
*
* The following options are available:
*
* - `onBlur` (default) - the value is updated after an input loses the focus.
* - `onTyping` - update the value of text questions, "text" and "comment", on every key press.
*
* Note, that setting to "onTyping" may lead to a performance degradation, in case you have many expressions in the survey.
*/
textUpdateMode: string;
/**
* Gets or sets a value that specifies how the invisible data is included in survey data.
*
* The following options are available:
*
* - `none` - include the invisible values into the survey data.
* - `onHidden` - clear the question value when it becomes invisible. If a question has value and it was invisible initially then survey clears the value on completing.
* - `onComplete` (default) - clear invisible question values on survey complete. In this case, the invisible questions will not be stored on the server.
* @see Question.visible
* @see onComplete
*/
clearInvisibleValues: any;
/**
* Call this function to remove all question values from the survey, that end-user will not be able to enter.
* For example the value that doesn't exists in a radiogroup/dropdown/checkbox choices or matrix rows/columns.
* Please note, this function doesn't clear values for invisible questions or values that doesn't associated with questions.
* In fact this function just call clearIncorrectValues function of all questions in the survey
* @see Question.clearIncorrectValues
* @see Page.clearIncorrectValues
* @see Panel.clearIncorrectValues
*/
clearIncorrectValues(): void;
/**
* Gets or sets the survey locale. The default value it is empty, this means the 'en' locale is used.
* You can set it to 'de' - German, 'fr' - French and so on. The library has built-in localization for several languages. The library has a multi-language support as well.
*/
locale: string;
/**
* Returns an array of locales that are used in the current survey.
*/
getUsedLocales(): Array<string>;
protected onLocaleChanged(): void;
getLocale(): string;
locStrsChanged(): void;
getMarkdownHtml(text: string): string;
getProcessedText(text: string): string;
getLocString(str: string): any;
getErrorCustomText(text: string, error: SurveyError): string;
/**
* Returns the text that is displayed when there are no any visible pages and questiona.
*/
readonly emptySurveyText: string;
/**
* Gets or sets a survey title.
* @see description
*/
title: string;
readonly locTitle: LocalizableString;
/**
* Gets or sets a survey description. The survey description is displayed under a survey title.
* @see title
*/
description: string;
readonly locDescription: LocalizableString;
/**
* Gets or sets a survey logo.
* @see title
*/
logo: string;
readonly locLogo: LocalizableString;
/**
* Gets or sets a survey logo width.
* @see logo
*/
logoWidth: number;
/**
* Gets or sets a survey logo height.
* @see logo
*/
logoHeight: number;
/**
* Gets or sets a survey logo position.
* @see logo
*/
logoPosition: string;
readonly hasLogo: boolean;
readonly isLogoBefore: boolean;
readonly isLogoAfter: boolean;
readonly logoClassNames: string;
/**
* The logo fit mode.
* @see logo
*/
logoFit: string;
/**
* Gets or sets the HTML content displayed on the complete page. Use this property to change the default complete page text.
* @see showCompletedPage
* @see completedHtmlOnCondition
* @see locale
*/
completedHtml: string;
readonly locCompletedHtml: LocalizableString;
/**
* The list of HTML condition items. If the expression of this item returns `true`, then a survey will use this item HTML instead of `completedHtml`.
* @see HtmlConditionItem
* @see completeHtml
*/
completedHtmlOnCondition: Array<HtmlConditionItem>;
/**
* Calculates a given expression and returns a result value.
* @param expression
*/
runExpression(expression: string): any;
/**
* Calculates a given expression and returns `true` or `false`.
* @param expression
*/
runCondition(expression: string): boolean;
readonly renderedCompletedHtml: string;
/**
* The HTML content displayed to an end user that has already completed the survey.
* @see clientId
* @see locale
*/
completedBeforeHtml: string;
readonly locCompletedBeforeHtml: LocalizableString;
/**
* The HTML that shows on loading survey Json from the [dxsurvey.com](http://www.dxsurvey.com) service.
* @see surveyId
* @see locale
*/
loadingHtml: string;
readonly locLoadingHtml: LocalizableString;
/**
* Gets or sets the 'Start' button caption.
* The 'Start' button is shown on the started page. Set the `firstPageIsStarted` property to `true`, to display the started page.
* @see firstPageIsStarted
* @see locale
*/
startSurveyText: string;
readonly locStartSurveyText: LocalizableString;
/**
* Gets or sets the 'Prev' button caption.
* @see locale
*/
pagePrevText: string;
readonly locPagePrevText: LocalizableString;
/**
* Gets or sets the 'Next' button caption.
* @see locale
*/
pageNextText: string;
readonly locPageNextText: LocalizableString;
/**
* Gets or sets the 'Complete' button caption.
* @see locale
*/
completeText: string;
readonly locCompleteText: LocalizableString;
/**
* Set the pattern for question title. Default is "numTitleRequire", 1. What is your name? *,
* You can set it to numRequireTitle: 1. * What is your name?
* You can set it to requireNumTitle: * 1. What is your name?
* You can set it to numTitle (remove require symbol completely): 1. What is your name?
* @see QuestionModel.title
*/
questionTitlePattern: string;
getQuestionTitlePatternOptions(): Array<any>;
/**
* Gets or sets a question title template. Obsolete, please use questionTitlePattern
* @see QuestionModel.title
* @see questionTitlePattern
*/
questionTitleTemplate: string;
readonly locQuestionTitleTemplate: LocalizableString;
getUpdatedQuestionTitle(question: IQuestion, title: string): string;
/**
* Gets or sets whether the survey displays page numbers on pages titles.
*/
showPageNumbers: boolean;
/**
* Gets or sets a value that specifies how the question numbers are displayed.
*
* The following options are available:
*
* - `on` - display question numbers
* - `onpage` - display question numbers, start numbering on every page
* - `off` - turn off the numbering for questions titles
*/
showQuestionNumbers: string;
/**
* Gets or sets the survey progress bar position.
*
* The following options are available:
*
* - `top` - show progress bar in the top
* - `bottom` - show progress bar in the bottom
* - `both` - show progress bar in both sides: top and bottom.
*/
showProgressBar: string;
/**
* Gets or sets the type of info in the progress bar.
*
* The following options are available:
*
* - `pages` (default),
* - `questions`,
* - `correctQuestions`.
*/
progressBarType: string;
readonly isShowProgressBarOnTop: boolean;
readonly isShowProgressBarOnBottom: boolean;
/**
* Returns the text/HTML that is rendered as a survey title.
*/
readonly processedTitle: string;
/**
* Gets or sets the question title location.
*
* The following options are available:
*
* - `bottom` - show a question title to bottom
* - `left` - show a question title to left
* - `top` - show a question title to top.
*
* > Some questions, for example matrixes, do not support 'left' value. The title for them will be displayed to the top.
*/
questionTitleLocation: string;
protected updateElementCss(): void;
/**
* Gets or sets the error message position.
*
* The following options are available:
*
* - `top` - to show question error(s) over the question,
* - `bottom` - to show question error(s) under the question.
*/
questionErrorLocation: string;
/**
* Gets or sets the question description position.
*
* The following options are available:
*
* - `underTitle` - show question description under the question title,
* - `underInput` - show question description under the question input instead of question title.
*/
questionDescriptionLocation: string;
/**
* Gets or sets the survey edit mode.
*
* The following options are available:
*
* - `edit` (default) - make a survey editable,
* - `display` - make a survey read-only.
*/
mode: string;
/**
* Gets or sets an object that stores the survey results/data. You can set it directly as `{ 'question name': questionValue, ... }`
*
* > If you set the `data` property after creating the survey, you may need to set the `currentPageNo` to `0`, if you are using `visibleIf` properties for questions/pages/panels to ensure that you are starting from the first page.
* @see setValue
* @see getValue
* @see currentPageNo
*/
data: any;
getAllValues(): any;
/**
* Returns survey result data as an array of plain objects: with question `title`, `name`, `value`, and `displayValue`.
*
* For complex questions (like matrix, etc.) `isNode` flag is set to `true` and data contains array of nested objects (rows).
*
* Set `options.includeEmpty` to `false` if you want to skip empty answers.
*/
getPlainData(options?: {
includeEmpty?: boolean;
calculations?: Array<{
propertyName: string;
}>;
}): any[];
getFilteredValues(): any;
getFilteredProperties(): any;
getDataValueCore(valuesHash: any, key: string): any;
setDataValueCore(valuesHash: any, key: string, value: any): void;
deleteDataValueCore(valuesHash: any, key: string): void;
/**
* Returns all comments from the data.
* @see data
*/
readonly comments: any;
/**
* Returns a list of visible pages. If all pages are visible, then this property returns the same list as the `pages` property.
* @see pages
* @see PageModel.visible
* @see PageModel.visibleIf
*/
readonly visiblePages: Array<PageModel>;
/**
* Returns `true` if the survey contains no pages. The survey is empty.
*/
readonly isEmpty: boolean;
/**
* Deprecated. Use the `pageCount` property instead.
*/
readonly PageCount: number;
/**
* Returns the survey page count.
* @see visiblePageCount
* @see pages
*/
readonly pageCount: number;
/**
* Returns a number of visible pages within the survey.
* @see pageCount
* @see visiblePages
*/
readonly visiblePageCount: number;
/**
* Returns the started page. This property works if the `firstPageIsStarted` property is set to `true`.
* @see firstPageIsStarted
*/
readonly startedPage: PageModel;
/**
* Gets or sets the current survey page. If a survey is rendered, then this property returns a page that a user can see/edit.
*/
currentPage: any;
/**
* The zero-based index of the current page in the visible pages array.
*/
currentPageNo: number;
/**
* Gets or sets the question display order. Use this property to randomize questions. You can randomize questions on a specific page.
*
* The following options are available:
*
* - `random` - randomize questions
* - `initial` - keep questions in the same order, as in a survey model.
* @see SurveyPage.questionsOrder
*/
questionsOrder: string;
/**
* Sets the input focus to the first question with the input field.
*/
focusFirstQuestion(): void;
scrollToTopOnPageChange(): void;
/**
* Returns the current survey state:
*
* - `loading` - loading from the JSON,
* - `completed` - a user has completed the survey,
* - `starting` - the started page is showing,
* - `running` - a user answers questions right now,
* - `empty` - there is nothing to show in the current survey.
*/
readonly state: string;
readonly completedState: string;
readonly completedStateText: string;
protected setCompletedState(value: string, text: string): void;
/**
* Clears the survey data and state. If the survey has a `completed` state, it will get a `running` state.
* @param clearData clear the data
* @param gotoFirstPage make the first page as a current page.
* @see data
* @see state
* @see currentPage
*/
clear(clearData?: boolean, gotoFirstPage?: boolean): void;
mergeValues(src: any, dest: any): void;
protected updateCustomWidgets(page: PageModel): void;
protected currentPageChanging(newValue: PageModel, oldValue: PageModel): boolean;
protected currentPageChanged(newValue: PageModel, oldValue: PageModel): void;
/**
* Returns the progress that a user made while going through the survey.
*/
getProgress(): number;
/**
* Returns the navigation buttons (i.e., 'Prev', 'Next', or 'Complete') position.
*/
readonly isNavigationButtonsShowing: string;
/**
* Returns `true` if the survey is in edit mode.
* @see mode
*/
readonly isEditMode: boolean;
/**
* Returns `true` if the survey is in display mode.
* @see mode
*/
readonly isDisplayMode: boolean;
readonly isUpdateValueTextOnTyping: boolean;
/**
* Returns `true` if the survey is in design mode. It is used by SurveyJS Editor.
* @see setDesignMode
*/
readonly isDesignMode: boolean;
/**
* Sets the survey into design mode.
* @param value use true to set the survey into the design mode.
*/
setDesignMode(value: boolean): void;
/**
* Gets or sets whether to show all elements in the survey, regardless their visibility. The default value is `false`.
*/
showInvisibleElements: boolean;
readonly areInvisibleElementsShowing: boolean;
/**
* Returns `true`, if a user has already completed the survey in this browser and there is a cookie about it. Survey goes to `completed` state if the function returns `true`.
* @see cookieName
* @see setCookie
* @see deleteCookie
* @see state
*/
readonly hasCookie: boolean;
/**
* Set the cookie with `cookieName` in user's browser. It is done automatically on survey complete if the `cookieName` property value is not empty.
* @see cookieName
* @see hasCookie
* @see deleteCookie
*/
setCookie(): void;
/**
* Deletes the cookie with `cookieName` from the browser.
* @see cookieName
* @see hasCookie
* @see setCookie
*/
deleteCookie(): void;
/**
* Gets or sets whether the survey must ignore validation like required questions and others, on `nextPage` and `completeLastPage` function calls. The default is `false`.
* @see nextPage
* @see completeLastPage
* @see mode
*/
ignoreValidation: boolean;
/**
* Navigates user to the next page.
*
* Returns `false` in the following cases:
*
* - if the current page is the last page.
* - if the current page contains errors (for example, a required question is empty).
* @see isCurrentPageHasErrors
* @see prevPage
* @see completeLastPage
*/
nextPage(): boolean;
/**
* Returns `true`, if the current page contains errors, for example, the required question is empty or a question validation is failed.
* @see nextPage
*/
readonly isCurrentPageHasErrors: boolean;
/**
* Returns `true`, if any of the survey pages contains errors.
* @param fireCallback set it to `true`, to show errors in UI.
* @param focusOnFirstError set it to `true` to focus on the first question that doesn't pass the validation and make the page, where the question is located, the current.
*/
hasErrors(fireCallback?: boolean, focusOnFirstError?: boolean): boolean;
/**
* Checks whether survey elements (pages, panels, and questions) have unique question names.
* You can check for unique names for individual page and panel (and all their elements) or a question.
* If the parameter is not specified, then a survey checks that all its elements have unique names.
* @param element page, panel or question, it is `null` by default, that means all survey elements will be checked
*/
ensureUniqueNames(element?: ISurveyElement): void;
/**
* Navigates user to a previous page. If the current page is the first page, `prevPage` returns `false`. `prevPage` does not perform any checks, required questions can be empty.
* @see isFirstPage
*/
prevPage(): boolean;
/**
* Completes the survey, if the current page is the last one. It returns `false` if the last page has no errors.
* If the last page has no errors, `completeLastPage` calls `doComplete` and returns `true`.
* @see isCurrentPageHasErrors
* @see nextPage
* @see doComplete
*/
completeLastPage(): boolean;
protected doCurrentPageComplete(doComplete: boolean): boolean;
/**
* Obsolete use the `questionsOnPageMode` property instead.
* @see questionsOnPageMode
*/
isSinglePage: boolean;
/**
* Gets or sets a value that specifies how the survey combines questions, panels, and pages.
*
* The following options are available:
*
* - `singlePage` - combine all survey pages in a single page. Pages will be converted to panels.
* - `questionPerPage` - show one question per page. Survey will create a separate page for every question.
*/
questionsOnPageMode: string;
/**
* Gets or sets whether the first survey page is a start page. Set this property to `true`, to make the first page a starting page.
* An end user cannot navigate to the start page and the start page does not affect a survey progress.
*/
firstPageIsStarted: boolean;
isPageStarted(page: IPage): boolean;
protected onFirstPageIsStartedChanged(): void;
origionalPages: any;
protected onQuestionsOnPageModeChanged(oldValue: string): void;
/**
* Gets whether the current page is the first one.
*/
readonly isFirstPage: boolean;
readonly isShowPrevButton: boolean;
/**
* Gets whether the current page is the last one.
*/
readonly isLastPage: boolean;
/**
* Completes the survey.
*
* Calling this function performs the following tasks:
*
* - writes cookie if the `cookieName` property is not empty
* - sets the survey into `completed` state
* - fires the `onComplete` event
* - calls `sendResult` function.
*
* Calling the `doComplete` function does not perform any validation, unlike the `completeLastPage` function.
* It calls `navigateToUrl` after calling `onComplete` event.
* In case calling `options.showDataSaving` callback in the `onComplete` event, `navigateToUrl` is used on calling `options.showDataSavingSuccess` callback.
* @see cookieName
* @see state
* @see onComplete
* @see surveyPostId
* @see completeLastPage
* @see navigateToUrl
* @see navigateToUrlOnCondition
*/
doComplete(): void;
/**
* Starts the survey. Changes the survey mode from "starting" to "running". Call this function if your survey has a start page, otherwise this function does nothing.
* @see firstPageIsStarted
*/
start(): boolean;
/**
* Gets whether the question values on the current page are validating on the server at the current moment.
* @see onServerValidateQuestions
*/
readonly isValidatingOnServer: boolean;
protected onIsValidatingOnServerChanged(): void;
protected doServerValidation(): boolean;
protected doNextPage(): void;
setCompleted(): void;
/**
* Returns the HTML content for the complete page.
* @see completedHtml
*/
readonly processedCompletedHtml: string;
/**
* Returns the HTML content, that is shown to a user that had completed the survey before.
* @see completedHtml
* @see cookieName
*/
readonly processedCompletedBeforeHtml: string;
/**
* Returns the HTML content, that is shows when a survey loads the survey JSON.
*/
readonly processedLoadingHtml: string;
/**
* Returns the text for the current progress.
*/
readonly progressText: string;
protected afterRenderSurvey(htmlElement: any): void;
updateQuestionCssClasses(question: IQuestion, cssClasses: any): void;
updatePanelCssClasses(panel: IPanel, cssClasses: any): void;
updatePageCssClasses(page: IPage, cssClasses: any): void;
afterRenderPage(htmlElement: any): void;
afterRenderHeader(htmlElement: any): void;
afterRenderQuestion(question: IQuestion, htmlElement: any): void;
afterRenderQuestionInput(question: IQuestion, htmlElement: any): void;
afterRenderPanel(panel: IElement, htmlElement: any): void;
matrixBeforeRowAdded(options: any): void;
matrixRowAdded(question: IQuestion, row: any): void;
getQuestionByValueNameFromArray(valueName: string, name: string, index: number): IQuestion;
matrixRowRemoved(question: IQuestion, rowIndex: number, row: any): void;
matrixAllowRemoveRow(question: IQuestion, rowIndex: number, row: any): boolean;
matrixCellCreated(question: IQuestion, options: any): void;
matrixAfterCellRender(question: IQuestion, options: any): void;
matrixCellValueChanged(question: IQuestion, options: any): void;
matrixCellValueChanging(question: IQuestion, options: any): void;
matrixCellValidate(question: IQuestion, options: any): SurveyError;
dynamicPanelAdded(question: IQuestion): void;
dynamicPanelRemoved(question: IQuestion, panelIndex: number, panel: IPanel): void;
dynamicPanelItemValueChanged(question: IQuestion, options: any): void;
dragAndDropAllow(options: any): boolean;
scrollElementToTop(element: ISurveyElement, question: IQuestion, page: IPage, id: string): any;
/**
* Uploads a file to server.
* @param name a question name
* @param file an uploaded file
* @param storeDataAsText set it to `true` to encode file content into the survey results
* @param uploadingCallback a call back function to get the status on uploading the file
*/
uploadFiles(name: string, files: File[], uploadingCallback: (status: string, data: any) => any): void;
/**
* Downloads a file from server
* @param name a question name
* @param fileValue a single file question value
* @param callback a call back function to get the status on downloading the file and the downloaded file content
*/
downloadFile(questionName: string, fileValue: any, callback: (status: string, data: any) => any): void;
/**
* Clears files from server.
* @param name a question name
* @param value a file question value
* @param callback a call back function to get the status of the clearing operation
*/
clearFiles(name: string, value: any, fileName: string, callback: (status: string, data: any) => any): void;
updateChoicesFromServer(question: IQuestion, choices: Array<ItemValue>, serverResult: any): Array<ItemValue>;
protected createSurveyService(): dxSurveyService;
protected uploadFilesCore(name: string, files: File[], uploadingCallback: (status: string, data: any) => any): void;
getPage(index: number): PageModel;
/**
* Adds an existing page to the survey.
* @param page a newly added page
* @see addNewPage
*/
addPage(page: PageModel): void;
/**
* Creates a new page and adds it to a survey. Generates a new name if the `name` parameter is not specified.
* @param name a page name
* @see addPage
*/
addNewPage(name?: string): PageModel;
/**
* Removes a page from a survey.
* @param page
*/
removePage(page: PageModel): void;
/**
* Returns a question by its name.
* @param name a question name
* @param caseInsensitive
* @see getQuestionByValueName
*/
getQuestionByName(name: string, caseInsensitive?: boolean): Question;
/**
* Returns a question by its value name
* @param valueName a question name
* @param caseInsensitive
* @see getQuestionByName
* @see Question.valueName
*/
getQuestionByValueName(valueName: string, caseInsensitive?: boolean): IQuestion;
/**
* Gets a list of questions by their names.
* @param names an array of question names
* @param caseInsensitive
*/
getQuestionsByNames(names: string[], caseInsensitive?: boolean): IQuestion[];
/**
* Returns a page on which an element (question or panel) is placed.
* @param element Question or Panel
*/
getPageByElement(element: IElement): PageModel;
/**
* Returns a page on which a question is located.
* @param question
*/
getPageByQuestion(question: IQuestion): PageModel;
/**
* Returns a page by it's name.
* @param name
*/
getPageByName(name: string): PageModel;
/**
* Returns a list of pages by their names.
* @param names a list of page names
*/
getPagesByNames(names: string[]): PageModel[];
/**
* Returns a list of all questions in a survey.
* @param visibleOnly set it `true`, if you want to get only visible questions
*/
getAllQuestions(visibleOnly?: boolean, includingDesignTime?: boolean): Array<Question>;
/**
* Returns quiz questions. All visible questions that has input(s) widgets.
* @see getQuizQuestionCount
*/
getQuizQuestions(): Array<IQuestion>;
/**
* Returns a panel by its name.
* @param name a panel name
* @param caseInsensitive
* @see getQuestionByName
*/
getPanelByName(name: string, caseInsensitive?: boolean): IPanel;
/**
* Returns a list of all survey's panels.
*/
getAllPanels(visibleOnly?: boolean, includingDesignTime?: boolean): Array<IPanel>;
protected createNewPage(name: string): PageModel;
protected questionOnValueChanging(valueName: string, newValue: any): any;
protected updateQuestionValue(valueName: string, newValue: any): void;
protected notifyQuestionOnValueChanged(valueName: string, newValue: any): void;
/**
* Sends a survey result to the [dxsurvey.com](http://www.dxsurvey.com) service.
* @param postId [dxsurvey.com](http://www.dxsurvey.com) service postId
* @param clientId Typically a customer e-mail or an identifier
* @param isPartialCompleted Set it to `true` if the survey is not completed yet and the results are intermediate
* @see surveyPostId
* @see clientId
*/
sendResult(postId?: string, clientId?: string, isPartialCompleted?: boolean): void;
/**
* Calls the [dxsurvey.com](http://www.dxsurvey.com) service and, on callback, fires the `onGetResult` event with all answers that your users made for a question.
* @param resultId [dxsurvey.com](http://www.dxsurvey.com) service resultId
* @param name The question name
* @see onGetResult
*/
getResult(resultId: string, name: string): void;
/**
* Loads the survey JSON from the [dxsurvey.com](http://www.dxsurvey.com) service.
* If `clientId` is not `null` and a user had completed a survey before, the survey switches to `completedbefore` state.
* @param surveyId [dxsurvey.com](http://www.dxsurvey.com) service surveyId
* @param clientId users' indentifier, for example an e-mail or a unique customer id in your web application.
* @see state
* @see onLoadedSurveyFromService
*/
loadSurveyFromService(surveyId?: string, cliendId?: string): void;
protected onLoadingSurveyFromService(): void;
protected onLoadSurveyFromService(): void;
fromJSON(json: any): void;
setJsonObject(jsonObj: any): void;
endLoadingFromJson(): void;
protected onBeforeCreating(): void;
protected onCreating(): void;
hasVisibleQuestionByValueName(valueName: string): boolean;
questionCountByValueName(valueName: string): number;
/**
* Returns a variable value. Variable, unlike values, are not stored in the survey results.
* @param name A variable name
* @see SetVariable
*/
getVariable(name: string): any;
/**
* Sets a variable value. Variable, unlike values, are not stored in the survey results.
* @param name A variable name
* @param newValue A variable new value
* @see GetVariable
*/
setVariable(name: string, newValue: any): void;
protected getUnbindValue(value: any): any;
/**
* Returns a question value (answer) by a question's name.
* @param name A question name
* @see data
* @see setValue
*/
getValue(name: string): any;
/**
* Sets a question value (answer). It runs all triggers and conditions (`visibleIf` properties).
*
* Goes to the next page if `goNextPageAutomatic` is `true` and all questions on the current page are answered correctly.
* @param name A question name
* @param newValue A new question value
* @see data
* @see getValue
* @see PageModel.visibleIf
* @see Question.visibleIf
* @see goNextPageAutomatic
*/
setValue(name: string, newQuestionValue: any, locNotification?: any, allowNotifyValueChanged?: boolean): void;
protected doOnPageAdded(page: PageModel): void;
protected tryGoNextPageAutomatic(name: string): void;
/**
* Returns the comment value.
* @param name A comment's name.
* @see setComment
*/
getComment(name: string): string;
/**
* Sets a comment value.
* @param name A comment name.
* @param newValue A new comment value.
* @see getComment
*/
setComment(name: string, newValue: string, locNotification?: any): void;
/**
* Removes a value from the survey results.
* @param {string} name The name of the value. Typically it is a question name.
*/
clearValue(name: string): void;
/**
* Gets or sets whether to clear value on disable items in checkbox, dropdown and radiogroup questions.
* By default, values are not cleared on disabled the corresponded items. This property is not persisted in survey JSON and you have to set it in code.
*/
clearValueOnDisableItems: boolean;
questionVisibilityChanged(question: IQuestion, newValue: boolean): void;
pageVisibilityChanged(page: IPage, newValue: boolean): void;
panelVisibilityChanged(panel: IPanel, newValue: boolean): void;
questionCreated(question: IQuestion): any;
questionAdded(question: IQuestion, index: number, parentPanel: any, rootPanel: any): void;
questionRemoved(question: IQuestion): void;
questionRenamed(question: IQuestion, oldName: string, oldValueName: string): any;
panelAdded(panel: IElement, index: number, parentPanel: any, rootPanel: any): void;
panelRemoved(panel: IElement): void;
validateQuestion(question: IQuestion): SurveyError;
validatePanel(panel: IPanel): SurveyError;
processHtml(html: string): string;
processText(text: string, returnDisplayValue: boolean): string;
processTextEx(text: string, returnDisplayValue: boolean, doEncoding: boolean): any;
getSurveyMarkdownHtml(element: Base, text: string): string;
/**
* Returns an amount of corrected quiz answers.
*/
getCorrectedAnswerCount(): number;
/**
* Returns quiz question number. It may be different from `getQuizQuestions.length` because some widgets like matrix may have several questions.
* @see getQuizQuestions
*/
getQuizQuestionCount(): number;
/**
* Returns an amount of incorrect quiz answers.
*/
getInCorrectedAnswerCount(): number;
getCorrectedAnswers(): number;
getInCorrectedAnswers(): number;
/**
* Gets or sets a timer panel position. The timer panel displays information about how much time an end user spends on a survey/page.
*
* The available options:
* - `top` - display timer panel in the top.
* - `bottom` - display timer panel in the bottom.
* - `none` - do not display a timer panel.
*
* If the value is not equal to 'none', the survey calls the `startTimer()` method on survey rendering.
* @see showTimerPanelMode
* @see startTimer
* @see stopTimer
*/
showTimerPanel: string;
readonly isTimerPanelShowingOnTop: boolean;
readonly isTimerPanelShowingOnBottom: boolean;
/**
* Gets or set a value that specifies whether the timer displays information for the page or for the entire survey.
*
* The available options:
*
* - `page` - show timer information for page
* - `survey` - show timer information for survey
*
* Use the `onTimerPanelInfoText` event to change the default text.
* @see showTimerPanel
* @see onTimerPanelInfoText
*/
showTimerPanelMode: string;
readonly timerInfoText: string;
/**
* Starts a timer that will calculate how much time end-user spends on the survey or on pages.
* @see stopTimer
* @see timeSpent
*/
startTimer(): void;
startTimerFromUI(): void;
/**
* Stops the timer.
* @see startTimer
* @see timeSpent
*/
stopTimer(): void;
/**
* Returns the time in seconds an end user spends on the survey
* @see startTimer
* @see PageModel.timeSpent
*/
timeSpent: number;
/**
* Gets or sets the maximum time in seconds that end user has to complete a survey. If the value is 0 or less, an end user has no time limit to finish a survey.
* @see startTimer
* @see maxTimeToFinishPage
*/
maxTimeToFinish: number;
/**
* Gets or sets the maximum time in seconds that end user has to complete a page in the survey. If the value is 0 or less, an end user has no time limit.
*
* You may override this value for every page.
* @see startTimer
* @see maxTimeToFinish
* @see PageModel.maxTimeToFinish
*/
maxTimeToFinishPage: number;
protected doTimer(): void;
geSurveyData(): ISurveyData;
getSurvey(): ISurvey;
getTextProcessor(): ITextProcessor;
getObjects(pages: string[], questions: string[]): any[];
setTriggerValue(name: string, value: any, isVariable: boolean): void;
copyTriggerValue(name: string, fromName: string): void;
focusQuestion(name: string): boolean;
/**
* Use this method to dispose survey model properly.
*/
dispose(): void;
}
/**
* A base class for all triggers.
* A trigger calls a method when the expression change the result: from false to true or from true to false.
* Please note, it runs only one changing the expression result.
*/
export declare class Trigger extends Base {
static operatorsValue: HashTable<Function>;
static readonly operators: HashTable<Function>;
constructor();
getType(): string;
toString(): string;
operator: string;
value: any;
name: string;
expression: string;
checkExpression(keys: any, values: HashTable<any>, properties?: HashTable<any>): void;
check(value: any): void;
protected onSuccess(values: HashTable<any>, properties: HashTable<any>): void;
protected onFailure(): void;
endLoadingFromJson(): void;
buildExpression(): string;
}
export interface ISurveyTriggerOwner {
getObjects(pages: string[], questions: string[]): any[];
setCompleted(): any;
setTriggerValue(name: string, value: any, isVariable: boolean): any;
copyTriggerValue(name: string, fromName: string): any;
focusQuestion(name: string): boolean;
}
/**
* It extends the Trigger base class and add properties required for SurveyJS classes.
*/
export declare class SurveyTrigger extends Trigger {
protected ownerValue: ISurveyTriggerOwner;
constructor();
readonly owner: ISurveyTriggerOwner;
setOwner(owner: ISurveyTriggerOwner): void;
readonly isOnNextPage: boolean;
}
/**
* If expression returns true, it makes questions/pages visible.
* Ohterwise it makes them invisible.
*/
export declare class SurveyTriggerVisible extends SurveyTrigger {
pages: string[];
questions: string[];
constructor();
getType(): string;
protected onSuccess(values: HashTable<any>, properties: HashTable<any>): void;
protected onFailure(): void;
protected onItemSuccess(item: any): void;
protected onItemFailure(item: any): void;
}
/**
* If expression returns true, it completes the survey.
*/
export declare class SurveyTriggerComplete extends SurveyTrigger {
constructor();
getType(): string;
readonly isOnNextPage: boolean;
protected onSuccess(values: HashTable<any>, properties: HashTable<any>): void;
}
/**
* If expression returns true, the value from property **setValue** will be set to **setToName**
*/
export declare class SurveyTriggerSetValue extends SurveyTrigger {
constructor();
getType(): string;
setToName: string;
setValue: any;
isVariable: boolean;
protected onSuccess(values: HashTable<any>, properties: HashTable<any>): void;
}
/**
* If expression returns true, the survey go to question **gotoName** and focus it.
*/
export declare class SurveyTriggerSkip extends SurveyTrigger {
constructor();
getType(): string;
gotoName: string;
protected onSuccess(values: HashTable<any>, properties: HashTable<any>): void;
}
/**
* If expression returns true, the **runExpression** will be run. If **setToName** property is not empty then the result of **runExpression** will be set to it.
*/
export declare class SurveyTriggerRunExpression extends SurveyTrigger {
constructor();
getType(): string;
setToName: string;
runExpression: string;
protected onSuccess(values: HashTable<any>, properties: HashTable<any>): void;
}
/**
* If expression returns true, the value from question **fromName** will be set into **setToName**.
*/
export declare class SurveyTriggerCopyValue extends SurveyTrigger {
constructor();
setToName: string;
fromName: string;
getType(): string;
protected onSuccess(values: HashTable<any>, properties: HashTable<any>): void;
}
/**
* A Model for a survey running in the Window.
*/
export declare class SurveyWindowModel extends Base {
static surveyElementName: string;
surveyValue: SurveyModel;
windowElement: HTMLDivElement;
templateValue: string;
expandedChangedCallback: () => void;
showingChangedCallback: () => void;
closeWindowOnCompleteCallback: () => void;
constructor(jsonObj: any, initialModel?: SurveyModel);
getType(): string;
/**
* A survey object.
* @see SurveyModel
*/
readonly survey: SurveyModel;
/**
* Set this value to negative value, for example -1, to avoid closing the window on completing the survey. Leave it equals to 0 (default value) to close the window immediately, or set it to 3, 5, 10, ... to close the window in 3, 5, 10 seconds.
*/
closeOnCompleteTimeout: number;
/**
* Returns true if the window is currently showing. Set it to true to show the window and false to hide it.
* @see show
* @see hide
*/
isShowing: boolean;
/**
* Show the window
* @see hide
* @see isShowing
*/
show(): void;
/**
* Hide the window
* @see show
* @see isShowing
*/
hide(): void;
/**
* Returns true if the window is expanded. Set it to true to expand the window or false to collapse it.
* @see expand
* @see collapse
*/
isExpanded: boolean;
/**
* The window and survey title.
*/
title: string;
readonly locTitle: LocalizableString;
/**
* Expand the window to show the survey.
*/
expand(): void;
/**
* Collapse the window and show survey title only.
*/
collapse(): void;
protected createSurvey(jsonObj: any): SurveyModel;
protected expandcollapse(value: boolean): void;
protected onSurveyComplete(): void;
protected closeWindowOnComplete(): void;
}
export declare class TextPreProcessorItem {
start: number;
end: number;
}
export declare class TextPreProcessorValue {
name: string;
returnDisplayValue: boolean;
constructor(name: string, returnDisplayValue: boolean);
value: any;
isExists: boolean;
canProcess: boolean;
}
export declare class TextPreProcessor {
onProcess: (textValue: TextPreProcessorValue) => void;
constructor();
process(text: string, returnDisplayValue?: boolean, doEncoding?: boolean): string;
readonly hasAllValuesOnLastRun: boolean;
}
/**
* The class contains methods to work with www.dxsurvey.com service.
*/
export declare class dxSurveyService {
static serviceUrl: string;
constructor();
loadSurvey(surveyId: string, onLoad: (success: boolean, result: string, response: any) => void): void;
getSurveyJsonAndIsCompleted(surveyId: string, clientId: string, onLoad: (success: boolean, surveyJson: any, result: string, response: any) => void): void;
sendResult(postId: string, result: JSON, onSendResult: (success: boolean, response: any, request?: any) => void, clientId?: string, isPartialCompleted?: boolean): void;
sendFile(postId: string, file: File, onSendFile: (success: boolean, response: any) => void): void;
getResult(resultId: string, name: string, onGetResult: (success: boolean, data: any, dataList: Array<any>, response: any) => void): void;
isCompleted(resultId: string, clientId: string, onIsCompleted: (success: boolean, result: string, response: any) => void): void;
}
export declare var englishStrings: {
pagePrevText: string;
pageNextText: string;
completeText: string;
startSurveyText: string;
otherItemText: string;
noneItemText: string;
selectAllItemText: string;
progressText: string;
panelDynamicProgressText: string;
questionsProgressText: string;
emptySurvey: string;
completingSurvey: string;
completingSurveyBefore: string;
loadingSurvey: string;
optionsCaption: string;
value: string;
requiredError: string;
requiredErrorInPanel: string;
requiredInAllRowsError: string;
numericError: string;
textMinLength: string;
textMaxLength: string;
textMinMaxLength: string;
minRowCountError: string;
minSelectError: string;
maxSelectError: string;
numericMinMax: string;
numericMin: string;
numericMax: string;
invalidEmail: string;
invalidExpression: string;
urlRequestError: string;
urlGetChoicesError: string;
exceedMaxSize: string;
otherRequiredError: string;
uploadingFile: string;
loadingFile: string;
chooseFile: string;
noFileChosen: string;
confirmDelete: string;
keyDuplicationError: string;
addColumn: string;
addRow: string;
removeRow: string;
addPanel: string;
removePanel: string;
choices_Item: string;
matrix_column: string;
matrix_row: string;
savingData: string;
savingDataError: string;
savingDataSuccess: string;
saveAgainButton: string;
timerMin: string;
timerSec: string;
timerSpentAll: string;
timerSpentPage: string;
timerSpentSurvey: string;
timerLimitAll: string;
timerLimitPage: string;
timerLimitSurvey: string;
cleanCaption: string;
clearCaption: string;
chooseFileCaption: string;
removeFileCaption: string;
booleanCheckedLabel: string;
booleanUncheckedLabel: string;
confirmRemoveFile: string;
confirmRemoveAllFiles: string;
questionTitlePatternText: string;
};
export declare var surveyLocalization: {
currentLocaleValue: string;
defaultLocaleValue: string;
locales: {
[index: string]: any;
};
localeNames: {
[index: string]: any;
};
supportedLocales: any[];
currentLocale: string;
defaultLocale: string;
getLocaleStrings(loc: string): any;
getCurrentStrings(): any;
getString: (strName: string) => any;
getLocales: () => string[];
};
export declare var surveyStrings: {
pagePrevText: string;
pageNextText: string;
completeText: string;
startSurveyText: string;
otherItemText: string;
noneItemText: string;
selectAllItemText: string;
progressText: string;
panelDynamicProgressText: string;
questionsProgressText: string;
emptySurvey: string;
completingSurvey: string;
completingSurveyBefore: string;
loadingSurvey: string;
optionsCaption: string;
value: string;
requiredError: string;
requiredErrorInPanel: string;
requiredInAllRowsError: string;
numericError: string;
textMinLength: string;
textMaxLength: string;
textMinMaxLength: string;
minRowCountError: string;
minSelectError: string;
maxSelectError: string;
numericMinMax: string;
numericMin: string;
numericMax: string;
invalidEmail: string;
invalidExpression: string;
urlRequestError: string;
urlGetChoicesError: string;
exceedMaxSize: string;
otherRequiredError: string;
uploadingFile: string;
loadingFile: string;
chooseFile: string;
noFileChosen: string;
confirmDelete: string;
keyDuplicationError: string;
addColumn: string;
addRow: string;
removeRow: string;
addPanel: string;
removePanel: string;
choices_Item: string;
matrix_column: string;
matrix_row: string;
savingData: string;
savingDataError: string;
savingDataSuccess: string;
saveAgainButton: string;
timerMin: string;
timerSec: string;
timerSpentAll: string;
timerSpentPage: string;
timerSpentSurvey: string;
timerLimitAll: string;
timerLimitPage: string;
timerLimitSurvey: string;
cleanCaption: string;
clearCaption: string;
chooseFileCaption: string;
removeFileCaption: string;
booleanCheckedLabel: string;
booleanUncheckedLabel: string;
confirmRemoveFile: string;
confirmRemoveAllFiles: string;
questionTitlePatternText: string;
};
export declare class QuestionCustomWidget {
name: string;
widgetJson: any;
htmlTemplate: string;
constructor(name: string, widgetJson: any);
afterRender(question: IQuestion, el: any): void;
willUnmount(question: IQuestion, el: any): void;
getDisplayValue(question: IQuestion, value?: any): string;
isFit(question: IQuestion): boolean;
init(): void;
activatedByChanged(activatedBy: string): void;
readonly isDefaultRender: boolean;
readonly pdfQuestionType: string;
readonly pdfRender: any;
}
export declare class CustomWidgetCollection {
static Instance: CustomWidgetCollection;
onCustomWidgetAdded: Event<(customWidget: QuestionCustomWidget) => any, any>;
readonly widgets: Array<QuestionCustomWidget>;
add(widgetJson: any, activatedBy?: string): void;
addCustomWidget(widgetJson: any, activatedBy?: string): void;
/**
* Returns the way the custom wiget is activated. It can be activated by a property ("property"), question type ("type") or by new/custom question type ("customtype").
* @param widgetName the custom widget name
* @see setActivatedBy
*/
getActivatedBy(widgetName: string): string;
/**
* Sets the way the custom wiget is activated. The activation types are: property ("property"), question type ("type") or new/custom question type ("customtype"). A custom wiget may support all or only some of this activation types.
* @param widgetName
* @param activatedBy there are three possible variants: "property", "type" and "customtype"
*/
setActivatedBy(widgetName: string, activatedBy: string): void;
clear(): void;
getCustomWidgetByName(name: string): QuestionCustomWidget;
getCustomWidget(question: IQuestion): QuestionCustomWidget;
}
export declare class ComponentQuestionJSON {
name: string;
json: any;
constructor(name: string, json: any);
onInit(): void;
onCreated(question: Question): void;
onLoaded(question: Question): void;
onPropertyChanged(question: Question, propertyName: string, newValue: any): void;
onItemValuePropertyChanged(question: Question, item: ItemValue, propertyName: string, name: string, newValue: any): void;
readonly isComposite: boolean;
}
export declare class ComponentCollection {
static Instance: ComponentCollection;
onCreateComposite: (name: string, questionJSON: ComponentQuestionJSON) => QuestionCompositeModel;
onCreateCustom: (name: string, questionJSON: ComponentQuestionJSON) => QuestionCustomModel;
onAddingJson: (name: string, isComposite: boolean) => void;
add(json: any): void;
readonly items: Array<ComponentQuestionJSON>;
getCustomQuestionByName(name: string): ComponentQuestionJSON;
clear(): void;
createQuestion(name: string, questionJSON: ComponentQuestionJSON): Question;
protected createCompositeModel(name: string, questionJSON: ComponentQuestionJSON): QuestionCompositeModel;
protected createCustomModel(name: string, questionJSON: ComponentQuestionJSON): QuestionCustomModel;
}
export declare abstract class QuestionCustomModelBase extends Question implements ISurveyImpl, ISurveyData, IPanel {
name: string;
customQuestion: ComponentQuestionJSON;
constructor(name: string, customQuestion: ComponentQuestionJSON);
getType(): string;
protected createWrapper(): void;
protected onPropertyValueChanged(name: string, oldValue: any, newValue: any): void;
itemValuePropertyChanged(item: ItemValue, name: string, oldValue: any, newValue: any): void;
onFirstRendering(): void;
protected abstract getElement(): SurveyElement;
protected initElement(el: SurveyElement): void;
setSurveyImpl(value: ISurveyImpl): void;
onSurveyLoad(): void;
protected setQuestionValue(newValue: any, updateIsAnswered?: boolean): void;
protected setNewValue(newValue: any): void;
geSurveyData(): ISurveyData;
getSurvey(): ISurvey;
getTextProcessor(): ITextProcessor;
getValue(name: string): any;
setValue(name: string, newValue: any, locNotification: any, allowNotifyValueChanged?: boolean): any;
protected convertDataName(name: string): string;
protected convertDataValue(name: string, newValue: any): any;
getVariable(name: string): any;
setVariable(name: string, newValue: any): void;
getComment(name: string): string;
setComment(name: string, newValue: string, locNotification: any): any;
getAllValues(): any;
getFilteredValues(): any;
getFilteredProperties(): any;
addElement(element: IElement, index: number): void;
removeElement(element: IElement): boolean;
getQuestionTitleLocation(): string;
getQuestionStartIndex(): string;
getChildrenLayoutType(): string;
elementWidthChanged(el: IElement): void;
readonly elements: Array<IElement>;
indexOf(el: IElement): number;
}
export declare class QuestionCustomModel extends QuestionCustomModelBase {
getTemplate(): string;
protected createWrapper(): void;
protected getElement(): SurveyElement;
hasErrors(fireCallback?: boolean, rec?: any): boolean;
focus(onError?: boolean): void;
readonly contentQuestion: Question;
protected createQuestion(): Question;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
protected convertDataName(name: string): string;
protected convertDataValue(name: string, newValue: any): any;
protected setQuestionValue(newValue: any, updateIsAnswered?: boolean): void;
onSurveyValueChanged(newValue: any): void;
protected initElement(el: SurveyElement): void;
protected updateElementCssCore(cssClasses: any): void;
}
export declare class QuestionCompositeModel extends QuestionCustomModelBase {
protected createWrapper(): void;
getTemplate(): string;
protected getCssType(): string;
protected getElement(): SurveyElement;
readonly contentPanel: PanelModel;
hasErrors(fireCallback?: boolean, rec?: any): boolean;
updateElementCss(): void;
protected createPanel(): PanelModel;
protected onReadOnlyChanged(): void;
onSurveyLoad(): void;
setVisibleIndex(val: number): number;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
getValue(name: string): any;
protected convertDataValue(name: string, newValue: any): any;
protected setQuestionValue(newValue: any, updateIsAnswered?: boolean): void;
}
export declare class StylesManager {
static Styles: {
[key: string]: string;
};
static Media: {
[key: string]: {
media: string;
style: string;
};
};
static ThemeColors: {
[key: string]: {
[key: string]: string;
};
};
static ThemeCss: {
[key: string]: string;
};
static modernThemeCss: {
[key: string]: string;
};
static bootstrapThemeCss: {
[key: string]: string;
};
static bootstrapmaterialThemeCss: {
[key: string]: string;
};
static findSheet(styleSheetId: string): CSSStyleSheet;
static createSheet(styleSheetId: string): CSSStyleSheet;
static applyTheme(themeName?: string, themeSelector?: string): void;
static Enabled: boolean;
constructor();
initializeStyles(sheet: CSSStyleSheet): void;
}
export declare class Survey extends SurveyModel {
static cssType: string;
koCurrentPage: any;
koIsFirstPage: any;
koIsLastPage: any;
dummyObservable: any;
koState: any;
koProgress: any;
koProgressText: any;
koAfterRenderPage: any;
koAfterRenderHeader: any;
koCompletedState: any;
koCompletedStateText: any;
koCompletedStateCss: any;
koTimerInfoText: any;
getDataValueCore(valuesHash: any, key: string): any;
setDataValueCore(valuesHash: any, key: string, value: any): void;
deleteDataValueCore(valuesHash: any, key: string): void;
constructor(jsonObj?: any, renderedElement?: any, css?: any);
protected onBaseCreating(): void;
nextPageUIClick(): void;
nextPageMouseDown(): void;
readonly cssNavigationComplete: string;
readonly cssNavigationPrev: string;
readonly cssNavigationStart: string;
readonly cssNavigationNext: string;
readonly completedCss: string;
render(element?: any): void;
clear(clearData?: boolean, gotoFirstPage?: boolean): void;
protected onLocaleChanged(): void;
koEventAfterRender(element: any, survey: any): void;
loadSurveyFromService(surveyId?: string, clientId?: string, renderedElement?: any): void;
setCompleted(): void;
start(): boolean;
protected createNewPage(name: string): Page;
protected getHtmlTemplate(): string;
protected onBeforeCreating(): void;
protected currentPageChanged(newValue: PageModel, oldValue: PageModel): void;
pageVisibilityChanged(page: IPage, newValue: boolean): void;
protected onLoadSurveyFromService(): void;
protected onLoadingSurveyFromService(): void;
protected setCompletedState(value: string, text: string): void;
protected doTimer(): void;
updateSurvey(newProps: any, oldProps?: any): void;
dispose(): void;
}
export declare var registerTemplateEngine: (ko: any, platform: string) => void;
export declare class ImplementorBase {
element: Base;
constructor(element: Base);
dispose(): void;
}
export declare class QuestionRow extends QuestionRowModel {
panel: PanelModelBase;
koGetType: any;
koElementAfterRender: any;
constructor(panel: PanelModelBase);
getElementType(el: any): "survey-panel" | "survey-question";
koAfterRender(el: any, con: any): void;
}
export declare class PanelImplementorBase extends ImplementorBase {
panel: PanelModelBase;
constructor(panel: PanelModelBase);
}
export declare class Panel extends PanelModel {
koElementType: any;
koCss: any;
koIsExpanded: any;
koIsCollapsed: any;
koErrorClass: any;
doExpand: any;
constructor(name?: string);
protected onBaseCreating(): void;
protected createRow(): QuestionRowModel;
protected onCreating(): void;
protected onNumChanged(value: number): void;
getTitleStyle(): any;
endLoadingFromJson(): void;
dispose(): void;
}
export declare class Page extends PageModel {
constructor(name?: string);
protected onBaseCreating(): void;
protected createRow(): QuestionRowModel;
protected createNewPanel(name: string): PanelModel;
protected onCreating(): void;
protected onNumChanged(value: number): void;
dispose(): void;
}
export declare class FlowPanel extends FlowPanelModel {
koElementType: any;
koElementAfterRender: any;
placeHolder: string;
constructor(name?: string);
protected onCreating(): void;
protected getHtmlForQuestion(question: Question): string;
}
export declare class QuestionImplementor extends ImplementorBase {
question: Question;
koTemplateName: any;
koElementType: any;
constructor(question: Question);
protected getKoValue(): any;
protected updateQuestion(): void;
protected onVisibleIndexChanged(): void;
protected onSurveyLoad(): void;
protected getQuestionTemplate(): string;
protected getNo(): string;
protected updateKoDummy(): void;
protected koQuestionAfterRender(elements: any, con: any): void;
dispose(): void;
}
export declare class QuestionSelectBaseImplementor extends QuestionImplementor {
protected onCreated(): void;
constructor(question: Question);
protected readonly isOtherSelected: boolean;
}
export declare class QuestionCheckboxBaseImplementor extends QuestionSelectBaseImplementor {
constructor(question: Question);
}
export declare class QuestionCheckbox extends QuestionCheckboxModel {
name: string;
koAllSelected: any;
constructor(name: string);
protected onBaseCreating(): void;
protected onValueChanged(): void;
protected onVisibleChoicesChanged(): void;
protected updateAllSelected(): void;
getItemClass(item: any): any;
getLabelClass(item: any): any;
getItemIndex(item: any): number;
}
export declare class QuestionComment extends QuestionCommentModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class QuestionDropdown extends QuestionDropdownModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class QuestionFile extends QuestionFileModel {
name: string;
koState: any;
koHasValue: any;
koData: any;
koInputTitle: any;
koChooseFileClass: any;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class QuestionHtml extends QuestionHtmlModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class MatrixRow extends MatrixRowModel {
fullName: string;
koValue: any;
koCellClick: any;
constructor(item: ItemValue, fullName: string, data: IMatrixData, value: any);
protected onValueChanged(): void;
}
export declare class QuestionMatrix extends QuestionMatrixModel {
name: string;
koVisibleRows: ko.ObservableArray<MatrixRowModel>;
koVisibleColumns: ko.ObservableArray<any>;
constructor(name: string);
protected onBaseCreating(): void;
protected onColumnsChanged(): void;
protected onRowsChanged(): void;
onSurveyLoad(): void;
protected createMatrixRow(item: ItemValue, fullName: string, value: any): MatrixRowModel;
protected getVisibleRows(): Array<MatrixRowModel>;
getItemCss(row: any, column: any): string;
}
export declare class QuestionMatrixBaseImplementor extends QuestionImplementor {
koCellAfterRender: any;
koRecalc: any;
koAddRowClick: any;
koRemoveRowClick: any;
koIsAddRowOnTop: any;
koIsAddRowOnBottom: any;
koTable: any;
constructor(question: Question);
protected getQuestionTemplate(): string;
protected isAddRowTop(): boolean;
protected isAddRowBottom(): boolean;
protected canRemoveRows(): boolean;
protected addRow(): void;
protected removeRow(row: MatrixDropdownRowModelBase): void;
dispose(): void;
}
export declare class QuestionMatrixDropdown extends QuestionMatrixDropdownModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
dispose(): void;
}
export declare class QuestionMatrixDynamicImplementor extends QuestionMatrixBaseImplementor {
constructor(question: Question);
protected isAddRowTop(): boolean;
protected isAddRowBottom(): boolean;
protected canRemoveRows(): boolean;
protected addRow(): void;
protected removeRow(row: MatrixDynamicRowModel): void;
}
export declare class QuestionMatrixDynamic extends QuestionMatrixDynamicModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class QuestionPanelDynamicImplementor extends QuestionImplementor {
koRecalc: any;
koAddPanelClick: any;
koRemovePanelClick: any;
koButtonAddCss: any;
koButtonPrevCss: any;
koButtonNextCss: any;
koPrevPanelClick: any;
koNextPanelClick: any;
koCanAddPanel: any;
koCanRemovePanel: any;
koProgressText: any;
koProgress: any;
koPanel: any;
koIsList: any;
koIsProgressTop: any;
koIsProgressBottom: any;
koIsNextButton: any;
koIsPrevButton: any;
koIsRange: any;
koRangeValue: any;
koRangeMax: any;
constructor(question: Question);
protected onPanelCountChanged(): void;
protected onRenderModeChanged(): void;
protected onCurrentIndexChanged(): void;
protected addPanel(): void;
protected removePanel(val: any): void;
protected readonly buttonAddCss: string;
protected readonly buttonPrevCss: any;
protected readonly buttonNextCss: any;
protected readonly progress: string;
}
export declare class QuestionPanelDynamic extends QuestionPanelDynamicModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
protected createNewPanelObject(): PanelModel;
}
export declare class MultipleTextItem extends MultipleTextItemModel {
name: any;
constructor(name?: any, title?: string);
protected createEditor(name: string): QuestionTextModel;
}
export declare class QuestionMultipleText extends QuestionMultipleTextModel {
name: string;
koRows: any;
constructor(name: string);
protected onBaseCreating(): void;
protected onColCountChanged(): void;
protected createTextItem(name: string, title: string): MultipleTextItemModel;
}
export declare class QuestionRadiogroup extends QuestionRadiogroupModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
getItemClass(item: any): any;
getLabelClass(item: any): any;
getItemIndex(item: any): number;
getControlLabelClass(item: any): any;
}
export declare class QuestionRating extends QuestionRatingModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class QuestionText extends QuestionTextModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class QuestionBoolean extends QuestionBooleanModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
getItemCss(row: any, column: any): any;
getCheckedLabelCss(): string;
getUncheckedLabelCss(): string;
onSwitchClick(data: any, event: any): boolean;
onTrueLabelClick(data: any, event: any): boolean;
onFalseLabelClick(data: any, event: any): boolean;
}
export declare class QuestionEmpty extends QuestionEmptyModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class QuestionExpressionImplementor extends QuestionImplementor {
question: Question;
constructor(question: Question);
}
export declare class QuestionExpression extends QuestionExpressionModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class QuestionImagePicker extends QuestionImagePickerModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
getItemClass(item: any): string;
}
export declare class SurveyWindow extends SurveyWindowModel {
koExpanded: any;
koExpandedCss: any;
doExpand: any;
constructor(jsonObj?: any, initialModel?: SurveyModel);
protected createSurvey(jsonObj: any): SurveyModel;
protected closeWindowOnComplete(): void;
protected template: string;
protected doShowingChanged(): void;
protected getDefaultTemplate(): string;
readonly css: any;
}
export declare var koTemplate: any;
export declare class SurveyTemplateText {
constructor();
addText(newText: string, id: string, name: string): void;
replaceText(replaceText: string, id: string, questionType?: string): void;
protected getId(id: string, questionType: string): string;
protected text: string;
}
export declare class QuestionImage extends QuestionImageModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class QuestionSignaturePad extends QuestionSignaturePadModel {
name: string;
constructor(name: string);
protected onBaseCreating(): void;
}
export declare class QuestionCustom extends QuestionCustomModel {
name: string;
constructor(name: string, questionJSON: ComponentQuestionJSON);
protected onBaseCreating(): void;
}
export declare class QuestionComposite extends QuestionCompositeModel {
name: string;
constructor(name: string, questionJSON: ComponentQuestionJSON);
protected onBaseCreating(): void;
}
/**
* A Model for a matrix base question.
*/
export declare class QuestionMatrixBaseModel<TRow, TColumn> extends Question {
name: string;
protected filteredColumns: Array<TColumn>;
protected filteredRows: Array<ItemValue>;
protected generatedVisibleRows: Array<TRow>;
protected generatedTotalRow: TRow;
visibleRowsChangedCallback: () => void;
protected createColumnValues(): any;
constructor(name: string);
getType(): string;
readonly isCompositeQuestion: boolean;
readonly isAllowTitleLeft: boolean;
/**
* Set this property to false, to hide table header. The default value is true.
*/
showHeader: boolean;
/**
* The list of columns. A column has a value and an optional text
*/
columns: Array<any>;
readonly visibleColumns: Array<any>;
/**
* The list of rows. A row has a value and an optional text
*/
rows: Array<any>;
protected processRowsOnSet(newRows: Array<any>): any[];
protected getVisibleRows(): Array<TRow>;
/**
* Returns the list of visible rows as model objects.
* @see rowsVisibleIf
*/
readonly visibleRows: Array<TRow>;
/**
* An expression that returns true or false. It runs against each row item and if for this item it returns true, then the item is visible otherwise the item becomes invisible. Please use {item} to get the current item value in the expression.
* @see visibleIf
*/
rowsVisibleIf: string;
/**
* An expression that returns true or false. It runs against each column item and if for this item it returns true, then the item is visible otherwise the item becomes invisible. Please use {item} to get the current item value in the expression.
* @see rowsVisibleIf
*/
columnsVisibleIf: string;
runCondition(values: HashTable<any>, properties: HashTable<any>): void;
protected filterItems(): boolean;
protected onColumnsChanged(): void;
protected onRowsChanged(): void;
protected shouldRunColumnExpression(): boolean;
protected hasRowsAsItems(): boolean;
protected runItemsCondition(values: HashTable<any>, properties: HashTable<any>): boolean;
clearIncorrectValues(): void;
protected clearInvisibleValuesInRows(): void;
}
|
{
"content_hash": "8d439b551bd5d015711c82e467a1dc9f",
"timestamp": "",
"source": "github",
"line_count": 7722,
"max_line_length": 309,
"avg_line_length": 41.80808080808081,
"alnum_prop": 0.6217933230496652,
"repo_name": "cdnjs/cdnjs",
"id": "d06e24a03ba6bffff142483c14726f8cee2f99b6",
"size": "323032",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ajax/libs/survey-jquery/1.7.4/survey.jquery.d.ts",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
}
|
layout: page
title: "Change is good!"
subheadline: "Feeling Responsive Theme Changelog"
description: "History and changelog of Feeling Responsive Theme by Phlow Media."
image:
header: "header_unsplash_9.jpg"
permalink: "/changelog/"
---
2014-09-21 // Version 0.9
: Optimized code, tweaked CSS, added images, deleted `header: "no"` from front matter (because it not necessary), added drafts to the new `_drafts`-folder to begin posts and pages faster and enhanced the documentation. Huh, 1.0 I am coming.
2014-09-16 // Version 0.8
: Added [video post format][5] for that cinematic flavor. Added URL- and Credit-feature to images and revamped the homepage a little bit to give blog-content more exposure. Optimized some includes, especially the `_include/list-posts.html`-Include which support some nifty parameters.
2014-09-15 // Version 0.7
: Added an [example of a gallery][4] to show how to use Clearing Lightbox. Meta information is used in posts via `/include/meta_information.html`. To optimize pages/posts for search engines you have now have an extra front matter-variable called `meta_description`. Also the theme supports facebook open graph information.
2014-09-12 // Version 0.6
: Finally the [blogpage][1] has pagination and an [archive for all blog-posts][2] using the [foundation accordion][3].
2014-08-22 // Version 0.5
: Better typograpyh, extended [documentation]({{ site.url}}/documentation/) and little subtle css-things to make *Feeling Responsive* a little better.
2014-08-17 // Version 0.4
: First beta release of »Feeling Responsive« with the current jekyll templates.
2014-08-17 // Version 0.3
: First release – only *HTML-Version* – of »Feeling Responsive« on Github-Pages with some hickups.
2014-07-26 // Version 0.2
: Updated Navigation & Social Media-Configuration via custom data in `_data`
2014-07-07 // Version 0.1
: Start of theme coding and development.
2014-06-23
: First Ideas and scribbles at the beach in [Bergen/Netherlands][6].
[1]: {{ site.url }}/blog/
[2]: {{ site.url }}/blog/archive/
[3]: http://foundation.zurb.com/docs/components/accordion.html
[4]: {{ site.url }}/design/gallery/
[5]: {{ site.url }}/design/video/
[6]: https://www.google.de/maps/place/Strandpaviljoen+Joep+B.V./@51.9960733,5.830135,6z/data=!4m2!3m1!1s0x47cf5918df69093b:0x7c11ab31102c1c8a
[7]: #
[8]: #
[9]: #
[10]: #
|
{
"content_hash": "5ae342ab9bdf74f85a070e64eb1e9fbd",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 324,
"avg_line_length": 45.73076923076923,
"alnum_prop": 0.7300252312867956,
"repo_name": "buddhists/buddhists.github.io",
"id": "930bb1d33b282557e37905c13d9b279c54ad3032",
"size": "2394",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "changelog.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "228513"
},
{
"name": "JavaScript",
"bytes": "225772"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_05) on Thu Sep 30 22:15:59 GMT+01:00 2004 -->
<TITLE>
org.springframework.dao (Spring Framework)
</TITLE>
<META NAME="keywords" CONTENT="org.springframework.dao package">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<FONT size="+1" CLASS="FrameTitleFont">
<A HREF="../../../org/springframework/dao/package-summary.html" target="classFrame">org.springframework.dao</A></FONT>
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
<TR>
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">
Exceptions</FONT>
<FONT CLASS="FrameItemFont">
<BR>
<A HREF="CannotAcquireLockException.html" title="class in org.springframework.dao" target="classFrame">CannotAcquireLockException</A>
<BR>
<A HREF="CannotSerializeTransactionException.html" title="class in org.springframework.dao" target="classFrame">CannotSerializeTransactionException</A>
<BR>
<A HREF="CleanupFailureDataAccessException.html" title="class in org.springframework.dao" target="classFrame">CleanupFailureDataAccessException</A>
<BR>
<A HREF="ConcurrencyFailureException.html" title="class in org.springframework.dao" target="classFrame">ConcurrencyFailureException</A>
<BR>
<A HREF="DataAccessException.html" title="class in org.springframework.dao" target="classFrame">DataAccessException</A>
<BR>
<A HREF="DataAccessResourceFailureException.html" title="class in org.springframework.dao" target="classFrame">DataAccessResourceFailureException</A>
<BR>
<A HREF="DataIntegrityViolationException.html" title="class in org.springframework.dao" target="classFrame">DataIntegrityViolationException</A>
<BR>
<A HREF="DataRetrievalFailureException.html" title="class in org.springframework.dao" target="classFrame">DataRetrievalFailureException</A>
<BR>
<A HREF="DeadlockLoserDataAccessException.html" title="class in org.springframework.dao" target="classFrame">DeadlockLoserDataAccessException</A>
<BR>
<A HREF="IncorrectResultSizeDataAccessException.html" title="class in org.springframework.dao" target="classFrame">IncorrectResultSizeDataAccessException</A>
<BR>
<A HREF="IncorrectUpdateSemanticsDataAccessException.html" title="class in org.springframework.dao" target="classFrame">IncorrectUpdateSemanticsDataAccessException</A>
<BR>
<A HREF="InvalidDataAccessApiUsageException.html" title="class in org.springframework.dao" target="classFrame">InvalidDataAccessApiUsageException</A>
<BR>
<A HREF="InvalidDataAccessResourceUsageException.html" title="class in org.springframework.dao" target="classFrame">InvalidDataAccessResourceUsageException</A>
<BR>
<A HREF="OptimisticLockingFailureException.html" title="class in org.springframework.dao" target="classFrame">OptimisticLockingFailureException</A>
<BR>
<A HREF="TypeMismatchDataAccessException.html" title="class in org.springframework.dao" target="classFrame">TypeMismatchDataAccessException</A>
<BR>
<A HREF="UncategorizedDataAccessException.html" title="class in org.springframework.dao" target="classFrame">UncategorizedDataAccessException</A></FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|
{
"content_hash": "887e32d7e69102b8e9147a9b10cf1411",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 167,
"avg_line_length": 52.354838709677416,
"alnum_prop": 0.7895871842267406,
"repo_name": "dachengxi/spring1.1.1_source",
"id": "7fc0f6d22b80f8a66f0361df03c0f133b8b0de7f",
"size": "3246",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/api/org/springframework/dao/package-frame.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "163"
},
{
"name": "FreeMarker",
"bytes": "8024"
},
{
"name": "HTML",
"bytes": "34675"
},
{
"name": "Java",
"bytes": "5934573"
}
],
"symlink_target": ""
}
|
If you do not use the `inlineSources` compiler options,
add your source folder into the `files` array.
> Why?
The source map generated by `tsc` has `"sources":["../src/<file>.ts"]`.
If the source code is not distributed,
tools such as `webpack` will emit a warning saying it cannot resolve the source file.
|
{
"content_hash": "0f96381817cad3d99c2549040b777f70",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 87,
"avg_line_length": 39.375,
"alnum_prop": 0.7206349206349206,
"repo_name": "unional/TypeScript",
"id": "4c06e7c5d6bae954de16f052da2e01ed9c68ef7d",
"size": "341",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pages/07-files-and-projects/package.json.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "2404"
},
{
"name": "TypeScript",
"bytes": "1938"
}
],
"symlink_target": ""
}
|
package org.codehaus.groovy.grails.plugins;
import java.util.List;
/**
* Defines interface for obtaining a sublist of <code>GrailsPlugin</code> instances
* based on an original supplied list of <code>GrailsPlugin</code> instances.
*
* @author Phil Zoio
*/
public interface PluginFilter {
/**
* Returns a filtered list of plugins.
* @param original the original supplied set of <code>GrailsPlugin</code> instances
* @return a sublist of these items
*/
List<GrailsPlugin> filterPluginList(List<GrailsPlugin> original);
}
|
{
"content_hash": "a06777689f2e0d2cd6818ca08bb76a65",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 87,
"avg_line_length": 30.263157894736842,
"alnum_prop": 0.6956521739130435,
"repo_name": "erdi/grails-core",
"id": "66a22d1aadd59d18806ab1b98f1cfb2ef9b03fe4",
"size": "575",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "grails-core/src/main/groovy/org/codehaus/groovy/grails/plugins/PluginFilter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Gosu",
"bytes": "94"
},
{
"name": "Groovy",
"bytes": "3976293"
},
{
"name": "Java",
"bytes": "4672452"
},
{
"name": "JavaScript",
"bytes": "1919"
},
{
"name": "Shell",
"bytes": "5485"
}
],
"symlink_target": ""
}
|
TooManyQuestions::Application.routes.draw do
devise_for :users
root :to => "questions#index"
resources :questions do
resources :answers
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
end
|
{
"content_hash": "ce40df494da3ff2ba5fbf614f87eeb85",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 91,
"avg_line_length": 28.058823529411764,
"alnum_prop": 0.6593291404612159,
"repo_name": "natsteinmetz/too_many_questions",
"id": "025ffcdc2f0119672b8a9637aacd44c1e1302435",
"size": "1908",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/routes.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2677"
},
{
"name": "CoffeeScript",
"bytes": "458"
},
{
"name": "JavaScript",
"bytes": "641"
},
{
"name": "Ruby",
"bytes": "43249"
}
],
"symlink_target": ""
}
|
package org.apache.ignite.internal.processors.cache;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import java.util.NavigableMap;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.pagemem.wal.record.RollbackRecord;
import org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl;
import org.apache.ignite.internal.util.GridLongList;
import org.apache.ignite.internal.util.typedef.F;
import org.jetbrains.annotations.Nullable;
/**
* Update counter implementation used for cache groups in persistent mode for both tx and atomic caches.
* <p>
* Implements the partition update counter flow to avoid situations when:
* <ol>
* <li>update counter could be incremented and persisted while corresponding update is not recorded to WAL.</li>
* <li>update counter could be updated out of order.</li>
* </ol>
* All these situations are sources of partitions desync in case of node failure under load.
* <p>
* The main idea is to track updates received out-of-order to ensure valid state of the update counter for rebalancing.
* <p>
* Below a short description of new flow:
* <ol>
* <li>Update counter is <i>reserved</i> for each update in partition on tx prepare phase (which always happens
* on primary partition owner). Reservation causes HWM increment.</li>
* <li>Reserved counter values are propagated on backup nodes and stored in backup transactions.</li>
* <li>On commit reserved counters are assigned to cache entries.</li>
* <li>LWM is incremented ONLY after corresponding WAL data record for each entry was written.</li>
* <li>In case of rollback (manual or during tx recovery on node failure) reserved updates are also applied and
* logged to WAL using {@link RollbackRecord} for further recovery purposes.</li>
* </ol>
*/
public class PartitionUpdateCounterTrackingImpl implements PartitionUpdateCounter {
/**
* Max allowed missed updates. Overflow will trigger critical failure handler to prevent OOM.
*/
public static final int MAX_MISSED_UPDATES = 10_000;
/** Counter updates serialization version. */
private static final byte VERSION = 1;
/** Queue of applied out of order counter updates. */
protected NavigableMap<Long, Item> queue = new TreeMap<>();
/** LWM. */
protected final AtomicLong cntr = new AtomicLong();
/** HWM. */
protected final AtomicLong reserveCntr = new AtomicLong();
/** */
protected boolean first = true;
/** */
protected final CacheGroupContext grp;
/**
* Initial counter points to last sequential update after WAL recovery.
* @deprecated TODO FIXME https://issues.apache.org/jira/browse/IGNITE-11794
*/
@Deprecated protected volatile long initCntr;
/**
* @param grp Group.
*/
public PartitionUpdateCounterTrackingImpl(CacheGroupContext grp) {
this.grp = grp;
}
/** {@inheritDoc} */
@Override public void init(long initUpdCntr, @Nullable byte[] cntrUpdData) {
cntr.set(initUpdCntr);
reserveCntr.set(initCntr = initUpdCntr);
queue = fromBytes(cntrUpdData);
}
/** {@inheritDoc} */
@Override public long initial() {
return initCntr;
}
/** {@inheritDoc} */
@Override public long get() {
return cntr.get();
}
/** */
protected synchronized long highestAppliedCounter() {
return queue.isEmpty() ? cntr.get() : queue.lastEntry().getValue().absolute();
}
/**
* @return Next update counter. For tx mode called by {@link DataStreamerImpl} IsolatedUpdater.
*/
@Override public long next() {
long next = cntr.incrementAndGet();
reserveCntr.set(next);
return next;
}
/** {@inheritDoc} */
@Override public synchronized void update(long val) throws IgniteCheckedException {
// Reserved update counter is updated only on exchange.
long cur = get();
// Always set reserved counter equal to max known counter.
long max = Math.max(val, cur);
if (reserveCntr.get() < max)
reserveCntr.set(max);
// Outdated counter (txs are possible before current topology future is finished if primary is not changed).
if (val < cur)
return;
// Absolute counter should be not less than last applied update.
// Otherwise supplier doesn't contain some updates and rebalancing couldn't restore consistency.
// Best behavior is to stop node by failure handler in such a case.
if (val < highestAppliedCounter())
throw new IgniteCheckedException("Failed to update the counter [newVal=" + val + ", curState=" + this + ']');
cntr.set(val);
/** If some holes are present at this point, thar means some update were missed on recovery and will be restored
* during rebalance. All gaps are safe to "forget".
* Should only do it for first PME (later missed updates on node left are reset in {@link #finalizeUpdateCounters}. */
if (first) {
queue.clear();
first = false;
}
}
/** {@inheritDoc} */
@Override public synchronized boolean update(long start, long delta) {
long cur = cntr.get();
if (cur > start)
return false;
else if (cur < start) {
// Try merge with adjacent gaps in sequence.
long next = start + delta;
// Merge with next.
Item nextItem = queue.remove(next);
if (nextItem != null)
delta += nextItem.delta;
// Merge with previous, possibly modifying previous.
Map.Entry<Long, Item> prev = queue.lowerEntry(start);
if (prev != null) {
Item prevItem = prev.getValue();
if (prevItem.absolute() == start) {
prevItem.delta += delta;
return true;
}
else if (prevItem.within(next - 1))
return false;
}
if (queue.size() >= MAX_MISSED_UPDATES) // Should trigger failure handler.
throw new IgniteException("Too many gaps [cntr=" + this + ']');
return queue.putIfAbsent(start, new Item(start, delta)) == null;
}
else { // cur == start
long next = start + delta;
// There is only one next sequential item possible, all other items will be merged.
Item nextItem = queue.remove(next);
if (nextItem != null)
next += nextItem.delta;
boolean res = cntr.compareAndSet(cur, next);
assert res;
return true;
}
}
/** {@inheritDoc} */
@Override public void updateInitial(long start, long delta) {
update(start, delta);
initCntr = get();
if (reserveCntr.get() < initCntr)
reserveCntr.set(initCntr);
}
/** {@inheritDoc} */
@Override public synchronized GridLongList finalizeUpdateCounters() {
Map.Entry<Long, Item> item = queue.pollFirstEntry();
GridLongList gaps = null;
while (item != null) {
if (gaps == null)
gaps = new GridLongList((queue.size() + 1) * 2);
long start = cntr.get() + 1;
long end = item.getValue().start;
gaps.add(start);
gaps.add(end);
// Close pending ranges.
cntr.set(item.getValue().absolute());
item = queue.pollFirstEntry();
}
reserveCntr.set(get());
return gaps;
}
/** {@inheritDoc} */
@Override public synchronized long reserve(long delta) {
long cntr = get();
long reserved = reserveCntr.getAndAdd(delta);
assert reserved >= cntr : "LWM after HWM: lwm=" + cntr + ", hwm=" + reserved;
return reserved;
}
/** {@inheritDoc} */
@Override public long next(long delta) {
return cntr.getAndAdd(delta);
}
/** {@inheritDoc} */
@Override public synchronized boolean sequential() {
return queue.isEmpty();
}
/** {@inheritDoc} */
@Override public synchronized @Nullable byte[] getBytes() {
if (queue.isEmpty())
return null;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
dos.writeByte(VERSION);
int size = queue.size();
dos.writeInt(size);
for (Item item : queue.values()) {
dos.writeLong(item.start);
dos.writeLong(item.delta);
}
bos.close();
return bos.toByteArray();
}
catch (IOException e) {
throw new IgniteException(e);
}
}
/**
* @param raw Raw bytes.
*/
private @Nullable NavigableMap<Long, Item> fromBytes(@Nullable byte[] raw) {
NavigableMap<Long, Item> ret = new TreeMap<>();
if (raw == null)
return ret;
try {
ByteArrayInputStream bis = new ByteArrayInputStream(raw);
DataInputStream dis = new DataInputStream(bis);
dis.readByte(); // Version.
int cnt = dis.readInt(); // Holes count.
while (cnt-- > 0) {
Item item = new Item(dis.readLong(), dis.readLong());
ret.put(item.start, item);
}
return ret;
}
catch (IOException e) {
throw new IgniteException(e);
}
}
/** {@inheritDoc} */
@Override public synchronized void reset() {
initCntr = 0;
cntr.set(0);
reserveCntr.set(0);
queue.clear();
}
/** {@inheritDoc} */
@Override public void resetInitialCounter() {
initCntr = 0;
}
/**
* Update counter task. Update from start value by delta value.
*/
private static class Item {
/** */
private long start;
/** */
private long delta;
/**
* @param start Start value.
* @param delta Delta value.
*/
private Item(long start, long delta) {
this.start = start;
this.delta = delta;
}
/** {@inheritDoc} */
@Override public String toString() {
return "Item [" +
"start=" + start +
", delta=" + delta +
']';
}
/** */
public long start() {
return start;
}
/** */
public long delta() {
return delta;
}
/** */
public long absolute() {
return start + delta;
}
/** */
public boolean within(long cntr) {
return cntr - start < delta;
}
/** {@inheritDoc} */
@Override public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Item item = (Item)o;
if (start != item.start)
return false;
return delta == item.delta;
}
}
/** {@inheritDoc} */
@Override public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
PartitionUpdateCounterTrackingImpl cntr = (PartitionUpdateCounterTrackingImpl)o;
if (!queue.equals(cntr.queue))
return false;
return this.cntr.get() == cntr.cntr.get();
}
/** {@inheritDoc} */
@Override public long reserved() {
return reserveCntr.get();
}
/** {@inheritDoc} */
@Override public synchronized boolean empty() {
return get() == 0 && sequential();
}
/** {@inheritDoc} */
@Override public Iterator<long[]> iterator() {
return F.iterator(queue.values().iterator(), item -> new long[] {item.start, item.delta}, true);
}
/** {@inheritDoc} */
@Override public String toString() {
return "Counter [lwm=" + get() + ", holes=" + queue +
", maxApplied=" + highestAppliedCounter() + ", hwm=" + reserveCntr.get() + ']';
}
/** {@inheritDoc} */
@Override public CacheGroupContext context() {
return grp;
}
/** {@inheritDoc} */
@Override public PartitionUpdateCounter copy() {
PartitionUpdateCounterTrackingImpl copy = createInstance();
copy.cntr.set(cntr.get());
copy.first = first;
copy.queue = new TreeMap<>(queue);
copy.initCntr = initCntr;
copy.reserveCntr.set(reserveCntr.get());
return copy;
}
/** */
protected PartitionUpdateCounterTrackingImpl createInstance() {
return new PartitionUpdateCounterTrackingImpl(grp);
}
}
|
{
"content_hash": "4653e92ac484ebfa8507cd6641fdc3f7",
"timestamp": "",
"source": "github",
"line_count": 460,
"max_line_length": 126,
"avg_line_length": 28.893478260869564,
"alnum_prop": 0.577909863817621,
"repo_name": "daradurvs/ignite",
"id": "0f9d72c5b84bfda36a34a858adaac498af0fe38f",
"size": "14093",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/PartitionUpdateCounterTrackingImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "61105"
},
{
"name": "C",
"bytes": "5286"
},
{
"name": "C#",
"bytes": "6398736"
},
{
"name": "C++",
"bytes": "3684371"
},
{
"name": "CSS",
"bytes": "281251"
},
{
"name": "Dockerfile",
"bytes": "16105"
},
{
"name": "Groovy",
"bytes": "15081"
},
{
"name": "HTML",
"bytes": "821135"
},
{
"name": "Java",
"bytes": "42324953"
},
{
"name": "JavaScript",
"bytes": "1785625"
},
{
"name": "M4",
"bytes": "21724"
},
{
"name": "Makefile",
"bytes": "121296"
},
{
"name": "PHP",
"bytes": "486991"
},
{
"name": "PLpgSQL",
"bytes": "623"
},
{
"name": "PowerShell",
"bytes": "11844"
},
{
"name": "Python",
"bytes": "342274"
},
{
"name": "Scala",
"bytes": "1386030"
},
{
"name": "Shell",
"bytes": "615962"
},
{
"name": "TSQL",
"bytes": "6130"
},
{
"name": "TypeScript",
"bytes": "476855"
}
],
"symlink_target": ""
}
|
package com.coolweather.app.model;
/**
* ÏØÊµÌåÀà
* @author Administrator
*
*/
public class County {
private int id;
private String countyName;
private String countyCode;
private int cityId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName;
}
public String getCountyCode() {
return countyCode;
}
public void setCountyCode(String countyCode) {
this.countyCode = countyCode;
}
public int getCityId() {
return cityId;
}
public void setCityId(int cityId) {
this.cityId = cityId;
}
}
|
{
"content_hash": "02b4e1000436359d245ead29069aba47",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 47,
"avg_line_length": 16.75609756097561,
"alnum_prop": 0.6972343522561864,
"repo_name": "yang111yang/coolweather",
"id": "8eb8ddbb5f569fa0ad45d16df8b2b24e3d0ed953",
"size": "687",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/coolweather/app/model/County.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "28496"
}
],
"symlink_target": ""
}
|
class Money
module V6Compatibility
module_function
def currency_id
Currency.prepend(CurrencyId)
Currency.instances.clear
end
module CurrencyId
def initialize(*)
super
@id = @code.downcase.to_sym
end
def to_sym
@code.to_sym
end
def code
symbol || @code
end
def iso_code
@code
end
end
end
end
|
{
"content_hash": "6692c8a8df88a2aedc5fbd758b6c4478",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 35,
"avg_line_length": 14.448275862068966,
"alnum_prop": 0.548926014319809,
"repo_name": "printercu/money",
"id": "90f78a6b499da6644c19182063d2e95c5cf06a9e",
"size": "419",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/money/v6_compatibility/currency_id.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "204527"
}
],
"symlink_target": ""
}
|
<?php
declare(strict_types=1);
/**
* DO NOT EDIT THIS FILE as it will be overwritten by the Pbj compiler.
* @link https://github.com/gdbots/pbjc-php
*
* Returns an array of curies using mixin "gdbots:ncr:mixin:lock-node:v1"
* @link http://schemas.triniti.io/json-schema/gdbots/ncr/mixin/lock-node/1-0-0.json#
*/
return [
];
|
{
"content_hash": "c60cc7b8a13d14ae6541be2d7d9cd439",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 25.53846153846154,
"alnum_prop": 0.6987951807228916,
"repo_name": "triniti/schemas",
"id": "9567187f67310924b3bf9fabcea2dc1e6da0b94b",
"size": "332",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "build/php/src/manifests/gdbots/ncr/mixin/lock-node/v1.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "121294"
},
{
"name": "JavaScript",
"bytes": "616189"
},
{
"name": "PHP",
"bytes": "761386"
},
{
"name": "Shell",
"bytes": "516"
}
],
"symlink_target": ""
}
|
<?php
namespace Redmine\Tests\Unit\Api;
use Redmine\Api\IssueCategory;
/**
* @coversDefaultClass \Redmine\Api\IssueCategory
*
* @author Malte Gerth <mail@malte-gerth.de>
*/
class IssueCategoryTest extends \PHPUnit\Framework\TestCase
{
/**
* Test all().
*
* @covers ::all
* @test
*/
public function testAllReturnsClientGetResponseWithProject()
{
// Test values
$projectId = 5;
$getResponse = 'API Response';
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->once())
->method('get')
->with(
$this->stringStartsWith('/projects/5/issue_categories.json')
)
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertSame($getResponse, $api->all($projectId));
}
/**
* Test all().
*
* @covers ::all
* @test
*/
public function testAllReturnsClientGetResponseWithParametersAndProject()
{
// Test values
$projectId = 5;
$parameters = ['not-used'];
$getResponse = ['API Response'];
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->any())
->method('get')
->with(
$this->logicalAnd(
$this->stringStartsWith('/projects/5/issue_categories.json'),
$this->stringContains('not-used')
)
)
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertSame($getResponse, $api->all($projectId, $parameters));
}
/**
* Test listing().
*
* @covers ::listing
* @test
*/
public function testListingReturnsNameIdArray()
{
// Test values
$getResponse = [
'issue_categories' => [
['id' => 1, 'name' => 'IssueCategory 1'],
['id' => 5, 'name' => 'IssueCategory 5'],
],
];
$expectedReturn = [
'IssueCategory 1' => 1,
'IssueCategory 5' => 5,
];
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->atLeastOnce())
->method('get')
->with(
$this->stringStartsWith('/projects/5/issue_categories')
)
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertSame($expectedReturn, $api->listing(5));
}
/**
* Test listing().
*
* @covers ::listing
* @test
*/
public function testListingCallsGetOnlyTheFirstTime()
{
// Test values
$getResponse = [
'issue_categories' => [
['id' => 1, 'name' => 'IssueCategory 1'],
['id' => 5, 'name' => 'IssueCategory 5'],
],
];
$expectedReturn = [
'IssueCategory 1' => 1,
'IssueCategory 5' => 5,
];
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->once())
->method('get')
->with(
$this->stringStartsWith('/projects/5/issue_categories')
)
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertSame($expectedReturn, $api->listing(5));
$this->assertSame($expectedReturn, $api->listing(5));
}
/**
* Test listing().
*
* @covers ::listing
* @test
*/
public function testListingCallsGetEveryTimeWithForceUpdate()
{
// Test values
$getResponse = [
'issue_categories' => [
['id' => 1, 'name' => 'IssueCategory 1'],
['id' => 5, 'name' => 'IssueCategory 5'],
],
];
$expectedReturn = [
'IssueCategory 1' => 1,
'IssueCategory 5' => 5,
];
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->exactly(2))
->method('get')
->with(
$this->stringStartsWith('/projects/5/issue_categories')
)
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertSame($expectedReturn, $api->listing(5, true));
$this->assertSame($expectedReturn, $api->listing(5, true));
}
/**
* Test show().
*
* @covers ::get
* @covers ::show
* @test
*/
public function testShowReturnsClientGetResponse()
{
// Test values
$getResponse = 'API Response';
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->once())
->method('get')
->with($this->stringStartsWith('/issue_categories/5.json'))
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertSame($getResponse, $api->show(5));
}
/**
* Test remove().
*
* @covers ::delete
* @covers ::remove
* @test
*/
public function testRemoveCallsDelete()
{
// Test values
$getResponse = 'API Response';
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->once())
->method('delete')
->with(
$this->logicalAnd(
$this->stringStartsWith('/issue_categories/5'),
$this->logicalXor(
$this->stringContains('.json?'),
$this->stringContains('.xml?')
)
)
)
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertSame($getResponse, $api->remove(5));
}
/**
* Test remove().
*
* @covers ::delete
* @covers ::remove
* @test
*/
public function testRemoveCallsDeleteWithParameters()
{
// Test values
$getResponse = 'API Response';
$parameters = ['not-used'];
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->once())
->method('delete')
->with(
$this->logicalAnd(
$this->stringStartsWith('/issue_categories/5'),
$this->logicalXor(
$this->stringContains('.json?'),
$this->stringContains('.xml?')
),
$this->stringContains('not-used')
)
)
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertSame($getResponse, $api->remove(5, $parameters));
}
/**
* Test getIdByName().
*
* @covers ::getIdByName
* @test
*/
public function testGetIdByNameMakesGetRequest()
{
// Test values
$getResponse = [
'issue_categories' => [
['id' => 5, 'name' => 'IssueCategory 5'],
],
];
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->once())
->method('get')
->with(
$this->stringStartsWith('/projects/5/issue_categories.json')
)
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertFalse($api->getIdByName(5, 'IssueCategory 1'));
$this->assertSame(5, $api->getIdByName(5, 'IssueCategory 5'));
}
/**
* Test create().
*
* @covers ::post
* @covers ::create
* @expectedException \Exception
* @test
*/
public function testCreateThrowsExceptionIfNameIsMissing()
{
// Test values
$parameters = [
'name' => null,
'assigned_to_id' => 2,
];
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$api->create(5, $parameters);
}
/**
* Test create().
*
* @covers ::post
* @covers ::create
* @test
*/
public function testCreateCallsPost()
{
// Test values
$getResponse = 'API Response';
$parameters = [
'name' => 'Test Category',
'assigned_to_id' => 2,
];
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->once())
->method('post')
->with(
'/projects/5/issue_categories.xml',
$this->logicalAnd(
$this->stringStartsWith('<?xml version="1.0"?>'."\n".'<issue_category>'),
$this->stringEndsWith('</issue_category>'."\n"),
$this->stringContains('<name>Test Category</name>'),
$this->stringContains('<assigned_to_id>2</assigned_to_id>')
)
)
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertSame($getResponse, $api->create(5, $parameters));
}
/**
* Test update().
*
* @covers ::put
* @covers ::update
* @test
*/
public function testUpdateCallsPut()
{
// Test values
$getResponse = 'API Response';
$parameters = [
'name' => 'Test Category',
'assigned_to_id' => 2,
];
// Create the used mock objects
$client = $this->getMockBuilder('Redmine\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->once())
->method('put')
->with(
'/issue_categories/5.xml',
$this->logicalAnd(
$this->stringStartsWith('<?xml version="1.0"?>'."\n".'<issue_category>'),
$this->stringEndsWith('</issue_category>'."\n"),
$this->stringContains('<name>Test Category</name>'),
$this->stringContains('<assigned_to_id>2</assigned_to_id>')
)
)
->willReturn($getResponse);
// Create the object under test
$api = new IssueCategory($client);
// Perform the tests
$this->assertSame($getResponse, $api->update(5, $parameters));
}
}
|
{
"content_hash": "03fb42988b6a8ed444ad3871d6f29a8d",
"timestamp": "",
"source": "github",
"line_count": 437,
"max_line_length": 93,
"avg_line_length": 28.1441647597254,
"alnum_prop": 0.49418651922920565,
"repo_name": "arlin2050/php-redmine-api",
"id": "0d24eb5de3fde660c1301dee44013cb535266c72",
"size": "12299",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/Unit/Api/IssueCategoryTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "326643"
}
],
"symlink_target": ""
}
|
<?php
class MCLogger{
private static function _getPrepareInfo($format, $json){
$ret = array(
'log_str' => '',
'errno' => 0,
);
$ret['log_str'] = StringFormat::format($format, $json);
$ret['errno'] = (
isset($json) && isset($json['errno'])
? $json['errno'] : 0
);
return $ret;
}
public static function debug($format, $json = null){
$logInfo = self::_getPrepareInfo($format, $json);
CLogger::debug($logInfo['log_str'], $logInfo['errno']);
}
public static function trace($format, $json = null){
$logInfo = self::_getPrepareInfo($format, $json);
CLogger::trace($logInfo['log_str'], $logInfo['errno']);
}
public static function notice($format, $json = null){
$logInfo = self::_getPrepareInfo($format, $json);
CLogger::notice($logInfo['log_str'], $logInfo['errno']);
}
public static function warning($format, $json = null){
$logInfo = self::_getPrepareInfo($format, $json);
CLogger::warning($logInfo['log_str'], $logInfo['errno']);
}
public static function fatal($format, $json = null){
$logInfo = self::_getPrepareInfo($format, $json);
CLogger::fatal($logInfo['log_str'], $logInfo['errno']);
}
}
|
{
"content_hash": "c71439c0076b217431fb2b7490495c6f",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 59,
"avg_line_length": 28.523809523809526,
"alnum_prop": 0.6085141903171953,
"repo_name": "MichaelHu/mcphp",
"id": "0daa2d4dac59e10d4ae7a13657bbbcc78a186023",
"size": "1198",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/utils/MCLogger.class.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "1648766"
},
{
"name": "Shell",
"bytes": "112"
}
],
"symlink_target": ""
}
|
require 'arel-wings'
|
{
"content_hash": "3da33492a26b33492f95fc19624ac8fd",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 20,
"avg_line_length": 20,
"alnum_prop": 0.8,
"repo_name": "appsinyourpants/arel-wings",
"id": "72c56e16305249cbe96bc71576c72be984d0fbfc",
"size": "20",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "rails/init.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "408"
}
],
"symlink_target": ""
}
|
<?php
namespace Baskets;
class test{
// STRING SETTINGS
// DB SETTINGS
private $db;
private $dbuser = 'baskets';
private $dbpass = 'baskets';
private $dbname = 'baskets';
private $dbhost = 'localhost';
/*
************************************************************
TRAITS
************************************************************
*/
// INCLUDES
/*
************************************************************
CONSTRUCT
************************************************************
*/
public function __construct( $debug = false ){
/*
require_once("lib/traits/databaseConnectorTrait.php");
session_start();
$this->db = db_connect($this->dbhost,$this->dbname,$this->dbuser,$this->dbpass);
// $this->db_connect(); // Connect to DB
$this->log_visit(); // Log the visit
// $this->login_page(); // Show login page
*/ $this->say_hello();
}
/*
************************************************************
PRIMARY FUNCTIONS
************************************************************
*/
/*
private function db_connect(){
try {
$this->db = new PDO("mysql:host=$this->dbhost;dbname=$this->dbname", $this->dbuser, $this->dbpass);
} catch(PDOException $e) {
echo $e->getMessage();
}
}
*/
public function log_visit(){
$stm = $this->db->prepare("INSERT INTO visits (dt,ua,ip) VALUES(NOW(),?,?)");
$stm->execute(array($_SERVER['HTTP_USER_AGENT'],ip2long($_SERVER['REMOTE_ADDR'])));
}
/*
************************************************************
PAGES
************************************************************
*/
private function login_page(){ ?>
<!DOCTYPE html>
<html>
<head>
<link rel='stylesheet' type='text/css' href='reset.css' />
<link rel='stylesheet' type='text/css' href='style.css' />
<title>Login | Baskets</title>
</head>
<body>
<div class='login_box'>
<form id='login' method='post'>
<label for='usremail'>Email:</label><input type='email' name='usremail' id='usremail'><br />
<label for='usrpass'>Password:</label><input type='password' name='usrpass' id='usrpass'><br />
</form>
</div>
</body>
</html>
<?php }
/*
************************************************************
MISC FUNCTIONS
************************************************************
*/
public function say_hello(){
$location = geoip_record_by_name($_SERVER['REMOTE_ADDR']);
echo "hello world, the initial class has been created.<br>";
echo "you are connecting from ".$_SERVER['REMOTE_ADDR']." in ".$location['city']."<br>";
}
public function show_visits(){
foreach($this->db->query("SELECT * FROM visits") as $visit){
echo $visit['id'] . " - " . $visit['dt'] . " - " . $visit['ip'] . "<br>";
}
}
}
|
{
"content_hash": "979cb98d9f14efd389c1a1029d9368df",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 102,
"avg_line_length": 23.31896551724138,
"alnum_prop": 0.47245841035120145,
"repo_name": "kevashcraft/baskets-old",
"id": "10d2d1c281ae5b5af8ea816d6ed80e125616a3b2",
"size": "2705",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Baskets/test.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "14087"
},
{
"name": "JavaScript",
"bytes": "49434"
},
{
"name": "PHP",
"bytes": "204394"
},
{
"name": "Shell",
"bytes": "53"
}
],
"symlink_target": ""
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE400_Resource_Exhaustion__fscanf_fwrite_72a.cpp
Label Definition File: CWE400_Resource_Exhaustion.label.xml
Template File: sources-sinks-72a.tmpl.cpp
*/
/*
* @description
* CWE: 400 Resource Exhaustion
* BadSource: fscanf Read data from the console using fscanf()
* GoodSource: Assign count to be a relatively small number
* Sinks: fwrite
* GoodSink: Write to a file count number of times, but first validate count
* BadSink : Write to a file count number of times
* Flow Variant: 72 Data flow: data passed in a vector from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <vector>
using namespace std;
namespace CWE400_Resource_Exhaustion__fscanf_fwrite_72
{
#ifndef OMITBAD
/* bad function declaration */
void badSink(vector<int> countVector);
void bad()
{
int count;
vector<int> countVector;
/* Initialize count */
count = -1;
/* POTENTIAL FLAW: Read count from the console using fscanf() */
fscanf(stdin, "%d", &count);
/* Put count in a vector */
countVector.insert(countVector.end(), 1, count);
countVector.insert(countVector.end(), 1, count);
countVector.insert(countVector.end(), 1, count);
badSink(countVector);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void goodG2BSink(vector<int> countVector);
static void goodG2B()
{
int count;
vector<int> countVector;
/* Initialize count */
count = -1;
/* FIX: Use a relatively small number */
count = 20;
/* Put count in a vector */
countVector.insert(countVector.end(), 1, count);
countVector.insert(countVector.end(), 1, count);
countVector.insert(countVector.end(), 1, count);
goodG2BSink(countVector);
}
/* goodB2G uses the BadSource with the GoodSink */
void goodB2GSink(vector<int> countVector);
static void goodB2G()
{
int count;
vector<int> countVector;
/* Initialize count */
count = -1;
/* POTENTIAL FLAW: Read count from the console using fscanf() */
fscanf(stdin, "%d", &count);
countVector.insert(countVector.end(), 1, count);
countVector.insert(countVector.end(), 1, count);
countVector.insert(countVector.end(), 1, count);
goodB2GSink(countVector);
}
void good()
{
goodG2B();
goodB2G();
}
#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 CWE400_Resource_Exhaustion__fscanf_fwrite_72; /* 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
|
{
"content_hash": "c8c9b0d172c2ac3ecabc6178efb440fd",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 109,
"avg_line_length": 27.305785123966942,
"alnum_prop": 0.6579903147699758,
"repo_name": "JianpingZeng/xcc",
"id": "b4fd52ea3174ed10340e77250d1799471b7a4f91",
"size": "3304",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "xcc/test/juliet/testcases/CWE400_Resource_Exhaustion/s01/CWE400_Resource_Exhaustion__fscanf_fwrite_72a.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
}
|
<?php
/**
* Created by PhpStorm.
* User: ydera00
* Date: 3/14/17
* Time: 9:42 AM
*/
namespace Giftcards\ModRewriteBundle\Routing;
use Giftcards\ModRewrite\Compiler\Compiler;
use Giftcards\ModRewrite\Rewriter;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\InvalidParameterException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RouterInterface;
class Router implements RouterInterface, RequestMatcherInterface
{
protected $rewriter;
protected $compiler;
protected $fileNames;
/** @var RequestContext|null */
protected $context;
protected $controller;
public function __construct(
Rewriter $rewriter,
Compiler $compiler,
$fileNames,
$controller = 'GiftcardsModRewriteBundle:Rewrite:rewrite'
) {
$this->rewriter = $rewriter;
$this->compiler = $compiler;
$this->fileNames = $fileNames;
$this->controller = $controller;
}
/**
* {@inheritdoc}
*/
public function setContext(RequestContext $context)
{
$this->context = $context;
return $this;
}
/**
* {@inheritdoc}
*/
public function getContext()
{
return $this->context;
}
/**
* Gets the RouteCollection instance associated with this Router.
*
* @return RouteCollection A RouteCollection instance
*/
public function getRouteCollection()
{
return new RouteCollection();
}
/**
* Generates a URL or path for a specific route based on the given parameters.
*
* Parameters that reference placeholders in the route pattern will substitute them in the
* path or host. Extra params are added as query string to the URL.
*
* When the passed reference type cannot be generated for the route because it requires a different
* host or scheme than the current one, the method will return a more comprehensive reference
* that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH
* but the route requires the https scheme whereas the current scheme is http, it will instead return an
* ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches
* the route in any case.
*
* If there is no route with the given name, the generator must throw the RouteNotFoundException.
*
* @param string $name The name of the route
* @param mixed $parameters An array of parameters
* @param bool|string $referenceType The type of reference to be generated (one of the constants)
*
* @return string The generated URL
*
* @throws RouteNotFoundException If the named route doesn't exist
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
* it does not match the requirement
*
* @api
*/
public function generate(
$name,
$parameters = array(),
$referenceType = self::ABSOLUTE_PATH
) {
throw new RouteNotFoundException(sprintf(
'Unable to generate a URL for the named route "%s" as such route does not exist.',
$name
));
}
/**
* Tries to match a URL path with a set of routes.
*
* If the matcher can not find information, it must throw one of the exceptions documented
* below.
*
* @param string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded)
*
* @return array An array of parameters
*
* @throws ResourceNotFoundException If the resource could not be found
* @throws MethodNotAllowedException If the resource was found but the request method is not allowed
*
* @api
*/
public function match($pathinfo)
{
$method = $this->context ? $this->context->getMethod() : 'GET';
$parameters = $this->context ? $this->context->getParameters() : array();
$pathinfo = $this->context ? sprintf(
'%s://%s%s%s',
$this->context->getScheme(),
$this->context->getHost(),
$pathinfo,
$this->context->getQueryString() ? '?' . $this->context->getQueryString() : ''
) : $pathinfo;
return $this->matchRequest(Request::create(
$pathinfo,
$method,
$parameters
));
}
/**
* Tries to match a request with a set of routes.
*
* If the matcher can not find information, it must throw one of the exceptions documented
* below.
*
* @param Request $request The request to match
*
* @return array An array of parameters
*
* @throws ResourceNotFoundException If no matching resource could be found
* @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed
*/
public function matchRequest(Request $request)
{
$result = null;
foreach ($this->fileNames as $fileName) {
$result = $this->rewriter->rewrite(
rawurldecode($request->getPathInfo()),
$request,
$this->compiler->compile(file_get_contents($fileName))
);
if ($result->getMatchedRule()) {
break;
}
}
if (!$result || !$result->getMatchedRule()) {
throw new ResourceNotFoundException();
}
return array(
'_route' => $result->getMatchedRule()->getRewrite()->getContent(),
'_controller' => $this->controller,
'result' => $result
);
}
}
|
{
"content_hash": "dd2cad191be4cbace09f0b681ffe6e61",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 116,
"avg_line_length": 34.119565217391305,
"alnum_prop": 0.6363491557820962,
"repo_name": "giftcards/GiftcardsModRewriteBundle",
"id": "783e6bea06fc5a2894e7cb7c8a37177b15cc4d77",
"size": "6278",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Routing/Router.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2989"
},
{
"name": "PHP",
"bytes": "49350"
}
],
"symlink_target": ""
}
|
These are slides for a talk on obstacles encountered when testing JavaScript.
I highly recommend reading the book
[Maintainable JavaScript](http://shop.oreilly.com/product/0636920025245.do)
by Nicholas Zakas.
## Installation
You will need Node.js, npm, Bower, and Gulp.
### Run the slides
Sources are in `src/`.
To build the project:
```bash
(cd src && bower install)
```
To get it on a local webserver:
```bash
npm install && gulp
```
The app will be running on `http://localhost:8012`.
### Demos
Demos are in `demo/*/` respectively.
To run them, in either directory run `npm install && npm test`.
If everything works, I'm happy. If something doesn't, please reach out to me,
because that's why I'm doing this! 🐢
#### Known issues
For the Chimp tests, it can happen that processes remain that you need to kill
manually.
|
{
"content_hash": "b669025892b1529a7e2e4db2c29fdb71",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 78,
"avg_line_length": 22.513513513513512,
"alnum_prop": 0.7262905162064826,
"repo_name": "orangecms/javascript-testing",
"id": "9b3cedf4a901338e329b23b2fd0f6748a5aa627c",
"size": "845",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1831"
},
{
"name": "JavaScript",
"bytes": "508"
}
],
"symlink_target": ""
}
|
<!--
Safe sample
input : use shell_exec to cat /tmp/tainted.txt
sanitize : use of floatval
File : use of untrusted data in a double quoted event handler in a script
-->
<!--Copyright 2015 Bertrand STIVALET
Permission is hereby granted, without written agreement or royalty fee, to
use, copy, modify, and distribute this software and its documentation for
any purpose, provided that the above copyright notice and the following
three paragraphs appear in all copies of this software.
IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.-->
<!DOCTYPE html>
<html>
<head/>
<body>
<?php
$tainted = shell_exec('cat /tmp/tainted.txt');
$tainted = floatval($tainted);
echo "<div onmouseover=\"x=\"". $tainted ."\"\>";
?>
<h1>Hello World!</h1>
</div>
</body>
</html>
|
{
"content_hash": "f736dcb1dbf6dcc0dc689decf056c296",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 75,
"avg_line_length": 22.87719298245614,
"alnum_prop": 0.7530674846625767,
"repo_name": "stivalet/PHP-Vulnerability-test-suite",
"id": "495850349fd76c3abc94281c32ec286ea1b6dbb5",
"size": "1304",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "XSS/CWE_79/safe/CWE_79__shell_exec__func_floatval__Use_untrusted_data_script-doublequoted_Event_Handler.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "64184004"
}
],
"symlink_target": ""
}
|
/* $Id: views.css,v 1.11.4.2 2010/03/12 00:25:37 merlinofchaos Exp $ */
.views-exposed-form .views-exposed-widget {
float: left; /* LTR */
padding: .5em 1em 0 0; /* LTR */
}
.views-exposed-form .views-exposed-widget .form-submit {
margin-top: 1.6em;
}
.views-exposed-form .form-item,
.views-exposed-form .form-submit {
margin-top: 0;
margin-bottom: 0;
}
.views-exposed-form label {
font-weight: bold;
}
.views-exposed-widgets {
margin-bottom: .5em;
}
html.js a.views-throbbing,
html.js span.views-throbbing {
background:url(../images/status-active.gif) no-repeat right center;
padding-right:18px;
}
/* administrative hover links */
div.view div.views-admin-links {
font-size: xx-small;
margin-right: 1em;
margin-top: 1em;
/* width: 95%; */
}
.block div.view div.views-admin-links {
margin-top: 0;
}
div.view div.views-admin-links ul {
padding-left: 0;
}
div.view div.views-admin-links li a {
color: #ccc;
}
div.view div.views-admin-links li {
padding-bottom: 2px;
z-index: 201;
}
div.view div.views-admin-links-hover a,
div.view div.views-admin-links:hover a {
color: #000;
}
div.view div.views-admin-links-hover,
div.view div.views-admin-links:hover {
background: transparent;;
}
div.view div.views-admin-links a:before {
content: "[";
}
div.view div.views-admin-links a:after {
content: "]";
}
div.view div.views-hide {
display: none;
}
/** For IE we add the class via js; for other browsers we rely on :hover **/
div.view div.views-hide-hover,
div.view:hover div.views-hide {
display: block;
position: absolute;
z-index: 200;
}
/* don't do this one in IE */
div.view:hover div.views-hide {
margin-top: -1.5em;
}
/* Remove the border on tbody that system puts in */
.views-view-grid tbody {
border-top: none;
}
|
{
"content_hash": "782b3f1a27dcb993dd03e55572d77e61",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 76,
"avg_line_length": 19.625,
"alnum_prop": 0.6395966029723992,
"repo_name": "temptemp5678/drupalnote",
"id": "aadd3f8f5b8c6fe95d9082aab11ff8faef62df72",
"size": "1884",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "sites/all/modules/views/css/views.css",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "286236"
},
{
"name": "HTML",
"bytes": "474914"
},
{
"name": "JavaScript",
"bytes": "3033952"
},
{
"name": "PHP",
"bytes": "538500"
}
],
"symlink_target": ""
}
|
<header><a href="{{ site.baseurl }}/">{{ site.title | upcase }}</a></header>
|
{
"content_hash": "c90bba6fea4b9c643f8c39aa1a3793e6",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 76,
"avg_line_length": 77,
"alnum_prop": 0.5714285714285714,
"repo_name": "shefaet/shefaet.github.io",
"id": "1e675214a7ec82aad4e91faba6a35da73c0fe8a6",
"size": "77",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_includes/header.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "18004"
},
{
"name": "HTML",
"bytes": "68691"
}
],
"symlink_target": ""
}
|
package org.hisp.dhis.sms;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.hisp.dhis.sms.incoming.IncomingSms;
import org.hisp.dhis.sms.incoming.IncomingSmsStore;
import org.springframework.beans.factory.annotation.Autowired;
public class DatabaseSupportedInternalMemoryMessageQueue
implements MessageQueue
{
private List<IncomingSms> queue = new ArrayList<>();
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@Autowired
private IncomingSmsStore incomingSmsStore;
// -------------------------------------------------------------------------
// Implementation
// -------------------------------------------------------------------------
@Override
public void put( IncomingSms message )
{
queue.add( message );
}
@Override
public IncomingSms get()
{
if ( queue != null && queue.size() > 0 )
{
return queue.get( 0 );
}
return null;
}
@Override
public void remove( IncomingSms message )
{
queue.remove( message );
}
@Override
public void initialize()
{
Collection<IncomingSms> messages = incomingSmsStore.getAllUnparsedSmses();
if ( messages != null )
{
queue.addAll( messages );
}
}
}
|
{
"content_hash": "23876152e0a491c373d3037849661364",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 82,
"avg_line_length": 23.758064516129032,
"alnum_prop": 0.49287169042769857,
"repo_name": "uonafya/jphes-core",
"id": "f5b50da7bd4863de01ae214047f3032ecd636e2b",
"size": "3029",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DatabaseSupportedInternalMemoryMessageQueue.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "290775"
},
{
"name": "HTML",
"bytes": "76142"
},
{
"name": "Java",
"bytes": "16409512"
},
{
"name": "JavaScript",
"bytes": "3255823"
},
{
"name": "Ruby",
"bytes": "1011"
},
{
"name": "SCSS",
"bytes": "4229"
},
{
"name": "Shell",
"bytes": "394"
},
{
"name": "XSLT",
"bytes": "8281"
}
],
"symlink_target": ""
}
|
# geoip-native-lite
__!! NOT MAINTAINED !!__
This project is no longer maintained. Please use [geoip-lite](https://github.com/bluesmoon/node-geoip) instead.
__!! NOT MAINTAINED !!__
## Goals
* Fast IP address to country lookup:
* 1,000,000+ ops/second for IPv4 addresses
* 500,000+ ops/second for IPv6 addresses
* Minimal RAM usage
* Native JavaScript implementation for ease-of-use and portability
## Installation
Add to your application via `npm`:
```
npm install geoip-native-lite --save
```
This will install `geoip-native-lite` and add it to your application's `package.json` file.
## Update Data Files
This module ships with pre-built data files. If you'd like to update the data files for yourself, run the update script like this:
```
npm run updatedata
```
## How to Use
* [lookup](#lookup)
* [loadData](#loaddata)
* [loadDataSync](#loaddatasync)
### lookup
`lookup(ip)`
Lookup the country in which the IP address is located. Supports both ipv4 and ipv6.
Usage:
```js
var GeoIpNativeLite = require('geoip-native-lite');
// Must load data before lookups can be performed.
GeoIpNativeLite.loadDataSync();
// Data loaded successfully.
// Ready for lookups.
var ip = '128.21.16.34';
var country = GeoIpNativeLite.lookup(ip);
if (country) {
console.log(ip, 'is geo-located in', country.toUpperCase());
} else {
console.log('Failed to geo-locate the IP address:', ip);
}
```
### loadData
`loadData([options, ]cb)`
Asynchronously loads geoip data.
Usage:
```js
var GeoIpNativeLite = require('geoip-native-lite');
GeoIpNativeLite.loadData(options, function(error, data) {
if (error) {
// Something went wrong.
} else {
// Data loaded successfully.
// Ready for lookups.
}
});
```
Options:
```js
var options = {
/*
Set to TRUE to load ipv4 geoip data.
Default value is TRUE.
*/
ipv4: true,
/*
Set to TRUE to load ipv6 geoip data.
Default value is FALSE.
*/
ipv6: false,
/*
Set to TRUE to cache data in memory.
Default value is TRUE.
*/
cache: true
};
```
### loadDataSync
`loadDataSync([options])`
Synchronously loads geoip data.
Usage:
```js
var GeoIpNativeLite = require('geoip-native-lite');
GeoIpNativeLite.loadDataSync(options);
var country = GeoIpNativeLite.lookup('198.169.246.30');
```
Options:
```js
var options = {
/*
Set to TRUE to load ipv4 geoip data.
Default value is TRUE.
*/
ipv4: true,
/*
Set to TRUE to load ipv6 geoip data.
Default value is FALSE.
*/
ipv6: false,
/*
Set to TRUE to cache data in memory.
Default value is TRUE.
*/
cache: true
};
```
## Contributing
There are a number of ways you can contribute:
* **Improve or correct the documentation** - All the documentation is in this `readme.md` file. If you see a mistake, or think something should be clarified or expanded upon, please [submit a pull request](https://github.com/chill117/geoip-native-lite/pulls/new)
* **Report a bug** - Please review [existing issues](https://github.com/chill117/geoip-native-lite/issues) before submitting a new one; to avoid duplicates. If you can't find an issue that relates to the bug you've found, please [create a new one](https://github.com/chill117/geoip-native-lite/issues).
* **Request a feature** - Again, please review the [existing issues](https://github.com/chill117/geoip-native-lite/issues) before posting a feature request. If you can't find an existing one that covers your feature idea, please [create a new one](https://github.com/chill117/geoip-native-lite/issues).
* **Fix a bug** - Have a look at the [existing issues](https://github.com/chill117/geoip-native-lite/issues) for the project. If there's a bug in there that you'd like to tackle, please feel free to do so. I would ask that when fixing a bug, that you first create a failing test that proves the bug. Then to fix the bug, make the test pass. This should hopefully ensure that the bug never creeps into the project again. After you've done all that, you can [submit a pull request](https://github.com/chill117/geoip-native-lite/pulls/new) with your changes.
## Tests
To run all tests (except benchmarks):
```
npm test
```
To run benchmarks:
```
npm run test:benchmarks
```
To run only unit tests:
```
npm run test:unit
```
To run only code-style checks:
```
npm run lint
```
## Licensing
All the code in this project is [MIT licensed](https://github.com/chill117/geoip-native-lite/blob/master/LICENSE).
The geoip data used in this project is [licensed separately](https://github.com/chill117/geoip-native-lite/blob/master/data/LICENSE.txt).
|
{
"content_hash": "58620560ba18470f76511dd7ce0282ab",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 555,
"avg_line_length": 23.260204081632654,
"alnum_prop": 0.7139723623601667,
"repo_name": "chill117/geoip-native-lite",
"id": "12181f080ad1459424cd893f3c0175ac70433575",
"size": "4559",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "readme.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "27716"
}
],
"symlink_target": ""
}
|
@class IVVExchangeFromListViewModel, IVVExchangeToListViewModel;
@class IVVCurrencyTransacrionModel;
#import "IVVCurrencyConstants.h"
#import "IVVModelConstants.h"
@protocol IVVExchangeListViewModelFactory <NSObject>
- (IVVExchangeToListViewModel *)exchangeToListViewModelWithMoneyAmounts:(IVVCurrencyRates)moneyAmounts
currencyRates:(IVVCurrencyRates)currencyRates;
- (IVVExchangeFromListViewModel *)exchangeFromListViewModelWithMoneyAmounts:(IVVCurrencyRates)moneyAmounts
currencyRates:(IVVCurrencyRates)currencyRates;
- (IVVExchangeFromListViewModel *)enrichExchangeFromListViewModel:(IVVExchangeFromListViewModel *)viewModel
withTransactionModel:(IVVCurrencyTransacrionModel *)transactionModel;
- (IVVExchangeToListViewModel *)enrichExchangeToListViewModel:(IVVExchangeToListViewModel *)viewModel
withTransactionModel:(IVVCurrencyTransacrionModel *)transactionModel;
@end
|
{
"content_hash": "560d2a98d02d0968b155e3411aba3557",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 114,
"avg_line_length": 51.857142857142854,
"alnum_prop": 0.7144168962350781,
"repo_name": "ignatovv/AwesomeCurrencyConverter",
"id": "84dbe296d8c2744d3f4fd8d7d5dbe92876288c0d",
"size": "1283",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AwesomeCurrencyConverter/Classes/Presentation/UserStory/CurrencyConvertion/Presenter/ViewModelFactory/ExchangeViewModelFactory/IVVExchangeListViewModelFactory.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "30544"
},
{
"name": "Objective-C",
"bytes": "127782"
},
{
"name": "Ruby",
"bytes": "1023"
}
],
"symlink_target": ""
}
|
<!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>CTEST_SCP_COMMAND — CMake 3.3.2 Documentation</title>
<link rel="stylesheet" href="../_static/cmake.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '3.3.2',
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>
<link rel="shortcut icon" href="../_static/cmake-favicon.ico"/>
<link rel="top" title="CMake 3.3.2 Documentation" href="../index.html" />
<link rel="up" title="cmake-variables(7)" href="../manual/cmake-variables.7.html" />
<link rel="next" title="CTEST_SITE" href="CTEST_SITE.html" />
<link rel="prev" title="CTEST_P4_UPDATE_OPTIONS" href="CTEST_P4_UPDATE_OPTIONS.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="CTEST_SITE.html" title="CTEST_SITE"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="CTEST_P4_UPDATE_OPTIONS.html" title="CTEST_P4_UPDATE_OPTIONS"
accesskey="P">previous</a> |</li>
<li>
<img src="../_static/cmake-logo-16.png" alt=""
style="vertical-align: middle; margin-top: -2px" />
</li>
<li>
<a href="http://www.cmake.org/">CMake</a> »
</li>
<li>
<a href="../index.html">3.3.2 Documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="../manual/cmake-variables.7.html" accesskey="U">cmake-variables(7)</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="ctest-scp-command">
<span id="variable:CTEST_SCP_COMMAND"></span><h1>CTEST_SCP_COMMAND<a class="headerlink" href="#ctest-scp-command" title="Permalink to this headline">¶</a></h1>
<p>Specify the CTest <code class="docutils literal"><span class="pre">SCPCommand</span></code> setting
in a <span class="target" id="index-0-manual:ctest(1)"></span><a class="reference internal" href="../manual/ctest.1.html#manual:ctest(1)" title="ctest(1)"><code class="xref cmake cmake-manual docutils literal"><span class="pre">ctest(1)</span></code></a> dashboard client script.</p>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="CTEST_P4_UPDATE_OPTIONS.html"
title="previous chapter">CTEST_P4_UPDATE_OPTIONS</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="CTEST_SITE.html"
title="next chapter">CTEST_SITE</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/variable/CTEST_SCP_COMMAND.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="CTEST_SITE.html" title="CTEST_SITE"
>next</a> |</li>
<li class="right" >
<a href="CTEST_P4_UPDATE_OPTIONS.html" title="CTEST_P4_UPDATE_OPTIONS"
>previous</a> |</li>
<li>
<img src="../_static/cmake-logo-16.png" alt=""
style="vertical-align: middle; margin-top: -2px" />
</li>
<li>
<a href="http://www.cmake.org/">CMake</a> »
</li>
<li>
<a href="../index.html">3.3.2 Documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="../manual/cmake-variables.7.html" >cmake-variables(7)</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2000-2015 Kitware, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4a0+.
</div>
</body>
</html>
|
{
"content_hash": "3c9e3ee536099ef9a799afe5d91fc45f",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 283,
"avg_line_length": 40,
"alnum_prop": 0.5886690647482015,
"repo_name": "ARMmbed/yotta_osx_installer",
"id": "0d4f4d9a6584ccb9408151097ad0e065b8fa3340",
"size": "5561",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "prerequisites/CMake.app/Contents/doc/cmake/html/variable/CTEST_SCP_COMMAND.html",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "46"
},
{
"name": "Assembly",
"bytes": "29493"
},
{
"name": "Batchfile",
"bytes": "1321"
},
{
"name": "C",
"bytes": "3589917"
},
{
"name": "C++",
"bytes": "10603800"
},
{
"name": "CMake",
"bytes": "2408460"
},
{
"name": "CSS",
"bytes": "17863"
},
{
"name": "Emacs Lisp",
"bytes": "14305"
},
{
"name": "FORTRAN",
"bytes": "2105"
},
{
"name": "Groff",
"bytes": "3889491"
},
{
"name": "HTML",
"bytes": "31505361"
},
{
"name": "JavaScript",
"bytes": "90647"
},
{
"name": "Logos",
"bytes": "8877"
},
{
"name": "Makefile",
"bytes": "2798"
},
{
"name": "Objective-C",
"bytes": "254392"
},
{
"name": "Python",
"bytes": "7903768"
},
{
"name": "Shell",
"bytes": "36795"
},
{
"name": "VimL",
"bytes": "8478"
},
{
"name": "XC",
"bytes": "8384"
},
{
"name": "XS",
"bytes": "8334"
}
],
"symlink_target": ""
}
|
typedef struct Timer Timer;
struct Timer
{
portTickType xTicksToWait;
xTimeOutType xTimeOut;
};
typedef struct Network Network;
struct Network
{
int my_socket;
int (*mqttread) (Network*, unsigned char*, int, int);
int (*mqttwrite) (Network*, unsigned char*, int, int);
void (*disconnect) (Network*);
};
void TimerInit(Timer*);
int TimerLeftMS(Timer*);
char TimerIsExpired(Timer*);
void TimerCountdownMS(Timer*, unsigned int);
void TimerCountdown(Timer*, unsigned int);
int ESP8266_read(Network*, unsigned char*, int, int);
int ESP8266_write(Network*, unsigned char*, int, int);
void ESP8266_disconnect(Network*);
void NetworkInit(Network*);
int ConnectNetwork(Network*, char*, int);
#endif
|
{
"content_hash": "71237e45431b3fdd73aaa9512598e0a8",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 55,
"avg_line_length": 23.366666666666667,
"alnum_prop": 0.738944365192582,
"repo_name": "vaibhav93/ESP-RTOS-MQTT",
"id": "5be0ab15e9ef53ea29277e6a969bf8714d922aa3",
"size": "906",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/MQTTClient/include/MQTTESP8266.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "97006"
},
{
"name": "Makefile",
"bytes": "1228"
}
],
"symlink_target": ""
}
|
package imagereferencemutators
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
kapi "k8s.io/kubernetes/pkg/apis/core"
buildapi "github.com/openshift/origin/pkg/build/apis/build"
)
// ImageReferenceMutateFunc is passed a reference representing an image, and may alter
// the Name, Kind, and Namespace fields of the reference. If an error is returned the
// object may still be mutated under the covers.
type ImageReferenceMutateFunc func(ref *kapi.ObjectReference) error
type ImageReferenceMutator interface {
// Mutate invokes fn on every image reference in the object. If fn returns an error,
// a field.Error is added to the list to be returned. Mutate does not terminate early
// if errors are detected.
Mutate(fn ImageReferenceMutateFunc) field.ErrorList
}
var errNoImageMutator = fmt.Errorf("No list of images available for this object")
// GetImageReferenceMutator returns a mutator for the provided object, or an error if no
// such mutator is defined. Only references that are different between obj and old will
// be returned unless old is nil.
func GetImageReferenceMutator(obj, old runtime.Object) (ImageReferenceMutator, error) {
switch t := obj.(type) {
case *buildapi.Build:
if oldT, ok := old.(*buildapi.Build); ok && oldT != nil {
return &buildSpecMutator{spec: &t.Spec.CommonSpec, oldSpec: &oldT.Spec.CommonSpec, path: field.NewPath("spec")}, nil
}
return &buildSpecMutator{spec: &t.Spec.CommonSpec, path: field.NewPath("spec")}, nil
case *buildapi.BuildConfig:
if oldT, ok := old.(*buildapi.BuildConfig); ok && oldT != nil {
return &buildSpecMutator{spec: &t.Spec.CommonSpec, oldSpec: &oldT.Spec.CommonSpec, path: field.NewPath("spec")}, nil
}
return &buildSpecMutator{spec: &t.Spec.CommonSpec, path: field.NewPath("spec")}, nil
default:
if spec, path, err := GetPodSpec(obj); err == nil {
if old == nil {
return &podSpecMutator{spec: spec, path: path}, nil
}
oldSpec, _, err := GetPodSpec(old)
if err != nil {
return nil, fmt.Errorf("old and new pod spec objects were not of the same type %T != %T: %v", obj, old, err)
}
return &podSpecMutator{spec: spec, oldSpec: oldSpec, path: path}, nil
}
if spec, path, err := GetPodSpecV1(obj); err == nil {
if old == nil {
return &podSpecV1Mutator{spec: spec, path: path}, nil
}
oldSpec, _, err := GetPodSpecV1(old)
if err != nil {
return nil, fmt.Errorf("old and new pod spec objects were not of the same type %T != %T: %v", obj, old, err)
}
return &podSpecV1Mutator{spec: spec, oldSpec: oldSpec, path: path}, nil
}
return nil, errNoImageMutator
}
}
type AnnotationAccessor interface {
// Annotations returns a map representing annotations. Not mutable.
Annotations() map[string]string
// SetAnnotations sets representing annotations onto the object.
SetAnnotations(map[string]string)
// TemplateAnnotations returns a map representing annotations on a nested template in the object. Not mutable.
// If no template is present bool will be false.
TemplateAnnotations() (map[string]string, bool)
// SetTemplateAnnotations sets annotations on a nested template in the object.
// If no template is present bool will be false.
SetTemplateAnnotations(map[string]string) bool
}
type annotationsAccessor struct {
object metav1.Object
template metav1.Object
}
func (a annotationsAccessor) Annotations() map[string]string {
return a.object.GetAnnotations()
}
func (a annotationsAccessor) TemplateAnnotations() (map[string]string, bool) {
if a.template == nil {
return nil, false
}
return a.template.GetAnnotations(), true
}
func (a annotationsAccessor) SetAnnotations(annotations map[string]string) {
a.object.SetAnnotations(annotations)
}
func (a annotationsAccessor) SetTemplateAnnotations(annotations map[string]string) bool {
if a.template == nil {
return false
}
a.template.SetAnnotations(annotations)
return true
}
// GetAnnotationAccessor returns an accessor for the provided object or false if the object
// does not support accessing annotations.
func GetAnnotationAccessor(obj runtime.Object) (AnnotationAccessor, bool) {
switch t := obj.(type) {
case metav1.Object:
templateObject, _ := GetTemplateMetaObject(obj)
return annotationsAccessor{object: t, template: templateObject}, true
default:
return nil, false
}
}
|
{
"content_hash": "762549fd869a14fd6a2dafb1c24bcb06",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 119,
"avg_line_length": 37.109243697478995,
"alnum_prop": 0.7384510869565217,
"repo_name": "jwhonce/origin",
"id": "37050621dbc4388e74a4ed72f7f383d8994535c7",
"size": "4416",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pkg/api/imagereferencemutators/meta.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "921"
},
{
"name": "DIGITAL Command Language",
"bytes": "117"
},
{
"name": "Dockerfile",
"bytes": "27608"
},
{
"name": "Go",
"bytes": "15118830"
},
{
"name": "HTML",
"bytes": "3131"
},
{
"name": "Makefile",
"bytes": "8654"
},
{
"name": "Perl",
"bytes": "365"
},
{
"name": "Python",
"bytes": "16418"
},
{
"name": "Ruby",
"bytes": "484"
},
{
"name": "Shell",
"bytes": "998471"
}
],
"symlink_target": ""
}
|
using J2N;
using Microsoft.Extensions.Configuration;
using NUnit.Framework;
using System;
using System.IO;
using Assert = Lucene.Net.TestFramework.Assert;
namespace Lucene.Net.Configuration
{
internal class TestConfigurationSettings : ConfigurationSettingsTestCase
{
// This variable must be unique in all of the tests
private const string EnvironmentVariablePrefix = "lucenetest:";
// Using a different file extension ensures we don't accidentally load the
// settings from the current test framework setup, and only get the mock values.
private const string TestJsonFileName = "lucene.testsettings.mock.json";
private const string TestParentJsonFileName = "parent.lucene.testsettings.mock.json";
private readonly static string parentDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
private readonly static string testDirectory = Path.Combine(parentDirectory, "SubDirectory");
private readonly static string currentJsonFilePath = Path.Combine(testDirectory, TestJsonFileName);
private readonly static string parentJsonFilePath = Path.Combine(parentDirectory, TestJsonFileName);
public override void BeforeClass()
{
// Create directories if they do not exist
Directory.CreateDirectory(testDirectory);
// Output the current test file to the file system
using (var input = this.GetType().FindAndGetManifestResourceStream(TestJsonFileName))
using (var output = new FileStream(currentJsonFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite | FileShare.Delete))
{
input.CopyTo(output);
}
// Output the parent test file to the file system
using (var input = this.GetType().FindAndGetManifestResourceStream(TestParentJsonFileName))
using (var output = new FileStream(parentJsonFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite | FileShare.Delete))
{
input.CopyTo(output);
}
// set an Enviroment variable used in the test
string testKey = EnvironmentVariablePrefix + "tests:setup";
string testValue = "setup";
Environment.SetEnvironmentVariable(testKey, testValue);
base.BeforeClass();
}
public override void AfterClass()
{
DirectoryInfo dir = null;
try
{
dir = new DirectoryInfo(testDirectory);
}
catch { }
try
{
foreach (var file in dir.GetFiles())
{
try
{
file.Delete();
}
catch { }
}
}
catch { }
try
{
dir.Delete();
}
catch { }
try
{
File.Delete(parentJsonFilePath);
}
catch { }
try
{
Directory.Delete(parentDirectory);
}
catch { }
base.AfterClass();
}
private static readonly IConfigurationFactory ConfigurationFactory = new TestConfigurationFactory
{
TestDirectory = testDirectory,
JsonTestSettingsFileName = TestJsonFileName,
EnvironmentVariablePrefix = EnvironmentVariablePrefix
};
protected override IConfiguration LoadConfiguration()
{
return ConfigurationFactory.GetConfiguration();
}
[Test]
public virtual void ReadPreconfiguredEnvironmentTest()
{
string testKey = "tests:setup";
string testValue = "setup";
Assert.AreEqual(testValue, ConfigurationSettings.CurrentConfiguration[testKey]);
Assert.AreEqual(testValue, SystemProperties.GetProperty(testKey));
}
[Test]
public virtual void SetRuntimeEnvironmentTest()
{
string testKey = "tests:setting";
string testValue = "test.success";
ConfigurationSettings.CurrentConfiguration[testKey] = testValue;
Assert.AreEqual(testValue, ConfigurationSettings.CurrentConfiguration[testKey]);
Assert.AreEqual(testValue, SystemProperties.GetProperty(testKey));
}
[Test]
public virtual void TestSetandUnset()
{
string testKey = "tests:locale";
string testValue_fr = "fr";
string testValue_en = "en";
//ConfigurationSettings.CurrentConfiguration[testKey] = testValue_fr;
Assert.AreEqual(testValue_fr, ConfigurationSettings.CurrentConfiguration["tests:locale"]);
Assert.AreEqual(testValue_fr, ConfigurationSettings.CurrentConfiguration[testKey]);
Assert.AreEqual(testValue_fr, SystemProperties.GetProperty(testKey));
ConfigurationSettings.CurrentConfiguration[testKey] = testValue_en;
Assert.AreEqual(testValue_en, ConfigurationSettings.CurrentConfiguration[testKey]);
Assert.AreEqual(testValue_en, SystemProperties.GetProperty(testKey));
ConfigurationSettings.CurrentConfiguration.Reload();
Assert.AreEqual(testValue_fr, ConfigurationSettings.CurrentConfiguration[testKey]);
Assert.AreEqual(testValue_fr, SystemProperties.GetProperty(testKey));
}
[Test(Description = "Tests whether the a default value in a JSON file in the parent directory exists.")]
public virtual void TestDefaultedValue()
{
string testKey = "tests:defaulted";
string testValue = "the-default";
Assert.AreEqual(testValue, ConfigurationSettings.CurrentConfiguration[testKey]);
}
[Test(Description = "Tests whether the a default value in a JSON file in the parent directory can be overridden by a subdirectory.")]
public virtual void TestOverriddenValue()
{
string testKey = "tests:overridden";
string testValue = "the-override";
Assert.AreEqual(testValue, ConfigurationSettings.CurrentConfiguration[testKey]);
}
}
}
|
{
"content_hash": "27e8756449c5dfa28b58560bb66bd10b",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 153,
"avg_line_length": 38.475903614457835,
"alnum_prop": 0.61985282605292,
"repo_name": "jeme/lucenenet",
"id": "9fa28e64c17474b71edb618f61f91bc67360b6d9",
"size": "7250",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "src/Lucene.Net.Tests.TestFramework/Configuration/TestConfigurationSettings.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2827"
},
{
"name": "C#",
"bytes": "41317243"
},
{
"name": "CSS",
"bytes": "13508"
},
{
"name": "Gnuplot",
"bytes": "2444"
},
{
"name": "HTML",
"bytes": "79746"
},
{
"name": "JavaScript",
"bytes": "67020"
},
{
"name": "Liquid",
"bytes": "5637"
},
{
"name": "PowerShell",
"bytes": "150007"
},
{
"name": "Shell",
"bytes": "2611"
},
{
"name": "XSLT",
"bytes": "21773"
}
],
"symlink_target": ""
}
|
package cmd
import (
"fmt"
"log"
"os"
"path/filepath"
"github.com/codegangsta/cli"
"github.com/exercism/cli/api"
"github.com/exercism/cli/config"
)
// Submit posts an iteration to the API.
func Submit(ctx *cli.Context) {
if len(ctx.Args()) == 0 {
log.Fatal("Please enter a file name")
}
c, err := config.New(ctx.GlobalString("config"))
if err != nil {
log.Fatal(err)
}
if ctx.GlobalBool("verbose") {
log.Printf("Exercises dir: %s", c.Dir)
dir, err := os.Getwd()
if err != nil {
log.Printf("Unable to get current working directory - %s", err)
} else {
log.Printf("Current dir: %s", dir)
}
}
if !c.IsAuthenticated() {
log.Fatal(msgPleaseAuthenticate)
}
dir, err := filepath.EvalSymlinks(c.Dir)
if err != nil {
log.Fatal(err)
}
if ctx.GlobalBool("verbose") {
log.Printf("eval symlinks (dir): %s", dir)
}
files := []string{}
for _, filename := range ctx.Args() {
if ctx.GlobalBool("verbose") {
log.Printf("file name: %s", filename)
}
if isTest(filename) && !ctx.Bool("test") {
log.Fatal("You're trying to submit a test file. If this is really what " +
"you want, please pass the --test flag to exercism submit.")
}
file, err := filepath.Abs(filename)
if err != nil {
log.Fatal(err)
}
if ctx.GlobalBool("verbose") {
log.Printf("absolute path: %s", file)
}
file, err = filepath.EvalSymlinks(file)
if err != nil {
log.Fatal(err)
}
if ctx.GlobalBool("verbose") {
log.Printf("eval symlinks (file): %s", file)
}
files = append(files, file)
}
iteration, err := api.NewIteration(dir, files)
if err != nil {
log.Fatalf("Unable to submit - %s", err)
}
iteration.Key = c.APIKey
client := api.NewClient(c)
submission, err := client.Submit(iteration)
if err != nil {
log.Fatal(err)
}
msg := `
Submitted %s in %s.
Your submission can be found online at %s
To get the next exercise, run "exercism fetch" again.
`
fmt.Printf(msg, submission.Name, submission.Language, submission.URL)
}
|
{
"content_hash": "8e4bc71e5668c1d866317ddf74a2a261",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 77,
"avg_line_length": 20.21212121212121,
"alnum_prop": 0.6366816591704147,
"repo_name": "lcowell/cli",
"id": "a4c773384d9d37edd32bce0a1188b8026328dc7b",
"size": "2001",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cmd/submit.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "68013"
},
{
"name": "Python",
"bytes": "60"
},
{
"name": "Shell",
"bytes": "1583"
}
],
"symlink_target": ""
}
|
require 'test_helper'
class NavigationTest < ActiveSupport::IntegrationCase
test "csv import process" do
visit(product_csv_import_upload_path)
attach_file('file', File.expand_path("../../support/test_csv.csv/", __FILE__))
click_button 'csv_submit'
assert File.exists?(File.expand_path("../../dummy/tmp/test_csv.csv/",__FILE__))
select 'Description', :from => 'attributes[description]'
select 'Price', :from => 'attributes[price]'
select 'Name', :from => 'attributes[name]'
click_button 'mapping_submit'
assert Product.last.name = 'Test'
assert !File.exists?(File.expand_path("../../dummy/tmp/test_csv.csv/",__FILE__))
end
end
|
{
"content_hash": "d80d6e6a654d9717c00167137f7adfcc",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 84,
"avg_line_length": 41.9375,
"alnum_prop": 0.6631892697466468,
"repo_name": "gregmolnar/csv_import",
"id": "10ae980d99fb989b4defbecf3fab7461267cfaa1",
"size": "671",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/integration/navigation_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "916"
},
{
"name": "HTML",
"bytes": "4945"
},
{
"name": "JavaScript",
"bytes": "6966"
},
{
"name": "Ruby",
"bytes": "22321"
}
],
"symlink_target": ""
}
|
var DEBUG = process.env.DEBUG;
var through = require('through');
var _prompt = ">".charCodeAt(0);
var bindexof = require('buffer-indexof');
var empty = new Buffer(0);
var echoback = require('./echoback-stream');
module.exports = function(serialPort){
var delim = new Buffer("\n")
, state = 'start'
, running = false
, q = []
;
var s = through(function(command){
//console.log('>> command ',command);
if(typeof command == 'string') command = {command:command};
if(!command || !command.command) return;
//console.log('>> command queue length',q.length);
q.push(command);
run();
});
s.lastData = Date.now();
var bufs = empty;
var resultbuf = '';
var writemax = 63;
serialPort.on('data',function(buf){
s.emit('log',buf);
})
// ebStream is used for writing to serialPort
// it can get stuck super easily if any command echoback gets corrupted.
ebStream = echoback(serialPort,writemax);
serialPort.on('data',function(buf){
s.lastData = Date.now();
//console.log('\n))) remaining: "'+bufs+'" ((((\n')
//console.log("\n=== looking for lines inside of ===\n\""+buf+"\"\n=========\n");
var idx;
while((idx = bindexof(buf,delim)) > -1){
bufs = Buffer.concat([bufs,buf.slice(0,idx+1)]);
//console.log("\n---------this code thinks this is a line --------------\n\""+bufs+"\"\n----------\n");
s.emit('line',bufs+'');
bufs = empty;
buf = buf.slice(idx+1);
}
if(buf.length){
bufs = Buffer.concat([bufs,buf])
}
// is the start of the line a prompt?
// these are not followed by a new line so i have to emit them right away.
if(bufs[0] === _prompt){
//console.log('GOT PROMPT!');
s.emit('line',bufs.slice(0,2)); // prompt is "> "
bufs = bufs.slice(2);
} else {
//console.log("\n-- did not get prompt "+bufs[0]+" != "+_prompt+" --\n")
//console.log(bufs[0],bufs[1],bufs[2]);
//bufs[0]
}
});
s.on('line',function(buf){
//console.log('\n---- line ----\n')
if(state == 'prompt') {
// i can ignore data comming from here until a command is issued
debug('prompt###',buf+'');
} else {
if(buf[0] == _prompt) {
handlePrompt(buf);
} else {
debug(state,'result###',buf+'');
resultbuf += buf;
}
}
});
var opened;
function handlePrompt(buf){
debug('end of result###',buf+'');
if(state == 'result') {
// transform stream baby!
running.result = resultbuf;
s.queue(running);
} else if(!opened) {
opened = true;
setImmediate(function(){
s.emit('open');// the bitlash prompt is up.
});
}
resultbuf = '';
running = false;
state = 'prompt';
run();
}
function run(){
if(state == 'prompt' && q.length) {
state = 'result';
var command = q.shift();
running = command;
ebStream.write(new Buffer(command.command.trim()+"\r\n"));
}
}
return s;
}
function debug(){
if(!DEBUG) return;
console.log.apply(console,arguments);
}
|
{
"content_hash": "1041e98fdaad0c46cb9a42e286d72818",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 109,
"avg_line_length": 22.67153284671533,
"alnum_prop": 0.5476497102382486,
"repo_name": "soldair/pinoccio-serial",
"id": "32a357b91ca3588e19616d33c455af7aa9fdb1be",
"size": "3107",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/bitlash-stream.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "13289"
}
],
"symlink_target": ""
}
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4016
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TABS_UserControls.usercontrols {
public partial class findacollegue {
/// <summary>
/// txtFName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtFName;
/// <summary>
/// txtLName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtLName;
/// <summary>
/// txtPosition control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPosition;
/// <summary>
/// ddlSchools control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlSchools;
/// <summary>
/// btnSearch control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSearch;
/// <summary>
/// gridUsers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Obout.Grid.Grid gridUsers;
/// <summary>
/// Column1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Obout.Grid.Column Column1;
/// <summary>
/// Column2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Obout.Grid.Column Column2;
/// <summary>
/// Column3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Obout.Grid.Column Column3;
/// <summary>
/// Column4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Obout.Grid.Column Column4;
/// <summary>
/// Column5 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Obout.Grid.Column Column5;
/// <summary>
/// Column6 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Obout.Grid.Column Column6;
/// <summary>
/// Column7 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Obout.Grid.Column Column7;
/// <summary>
/// infoTpl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Obout.Grid.GridTemplate infoTpl;
}
}
|
{
"content_hash": "06857e9d96e014d35591d3ba441a7c24",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 84,
"avg_line_length": 34.894366197183096,
"alnum_prop": 0.5095862764883956,
"repo_name": "cmorrow/cmorrow.github.io",
"id": "5b72f7fd28200a54a414b361ef601c54f5820f5a",
"size": "4957",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "portfolio/TABS/web/usercontrols/findacollegue.ascx.designer.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "1386316"
},
{
"name": "ActionScript",
"bytes": "129752"
},
{
"name": "AngelScript",
"bytes": "60232"
},
{
"name": "C#",
"bytes": "771072"
},
{
"name": "CSS",
"bytes": "835386"
},
{
"name": "HTML",
"bytes": "4708093"
},
{
"name": "JavaScript",
"bytes": "17373"
},
{
"name": "PHP",
"bytes": "1391"
},
{
"name": "Ruby",
"bytes": "8845"
},
{
"name": "Shell",
"bytes": "139"
},
{
"name": "Smalltalk",
"bytes": "40136"
}
],
"symlink_target": ""
}
|
import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/Home'
import PlayerStatTool from '@/components/PlayerStatTool.vue'
import PetPictures from '@/components/PetPictures.vue'
Vue.use(Router)
export default new Router({
mode: 'history',
routes: [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/PlayerStatTool',
name: 'Stat Generator',
component: PlayerStatTool
},
{
path: '/PetPictures',
name: 'Pet Pictures',
component: PetPictures
},
{
path: '*',
redirect: '/',
component: Home
}
]
})
|
{
"content_hash": "44161dc4ed280acde74b1e7540225c0f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 60,
"avg_line_length": 19.363636363636363,
"alnum_prop": 0.5852895148669797,
"repo_name": "jarmbrust/dm-tool",
"id": "3ce7e17232f44f579e1a2000d927c423c4554b12",
"size": "639",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/router/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "675"
},
{
"name": "JavaScript",
"bytes": "21763"
},
{
"name": "Vue",
"bytes": "9764"
}
],
"symlink_target": ""
}
|
using Aspose.Cells.Charts;
using System;
namespace Aspose.Cells.Examples.CSharp.Articles.ManageChartsAndShapes
{
class ReadAndManipulateExcel2016Charts
{
public static void Run()
{
//Source directory
string sourceDir = RunExamples.Get_SourceDirectory();
//Output directory
string outputDir = RunExamples.Get_OutputDirectory();
// Load source excel file containing excel 2016 charts
Workbook book = new Workbook(sourceDir + "sampleReadAndManipulateExcel2016Charts.xlsx");
// Access the first worksheet which contains the charts
Worksheet sheet = book.Worksheets[0];
// Access all charts one by one and read their types
for (int i = 0; i < sheet.Charts.Count; i++)
{
// Access the chart
Chart ch = sheet.Charts[i];
// Print chart type
Console.WriteLine(ch.Type);
// Change the title of the charts as per their types
ch.Title.Text = "Chart Type is " + ch.Type.ToString();
}
// Save the workbook
book.Save(outputDir + "outputReadAndManipulateExcel2016Charts.xlsx");
Console.WriteLine("ReadAndManipulateExcel2016Charts executed successfully.\r\n");
}
}
}
|
{
"content_hash": "6575cea52fb9465962b0d2400547218a",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 100,
"avg_line_length": 33.46341463414634,
"alnum_prop": 0.5954810495626822,
"repo_name": "aspose-cells/Aspose.Cells-for-.NET",
"id": "a8b082b9b265863ea55c6f2a1c4dd4abb538af31",
"size": "1374",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Examples/CSharp/Articles/ManageChartsAndShapes/ReadAndManipulateExcel2016Charts.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP.NET",
"bytes": "476598"
},
{
"name": "C#",
"bytes": "1503796"
},
{
"name": "CSS",
"bytes": "44647"
},
{
"name": "HTML",
"bytes": "133439"
},
{
"name": "JavaScript",
"bytes": "375700"
},
{
"name": "PHP",
"bytes": "16554"
}
],
"symlink_target": ""
}
|
<component name="libraryTable">
<library name="Maven: org.apache.sis.core:sis-metadata:0.6">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/sis/core/sis-metadata/0.6/sis-metadata-0.6.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/sis/core/sis-metadata/0.6/sis-metadata-0.6-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/sis/core/sis-metadata/0.6/sis-metadata-0.6-sources.jar!/" />
</SOURCES>
</library>
</component>
|
{
"content_hash": "132f73cc94ba5ce71975dba92959903b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 113,
"avg_line_length": 41.61538461538461,
"alnum_prop": 0.6506469500924215,
"repo_name": "null-dev/WebLinkedServer",
"id": "2430806e7c5db46fcf5b63437762ec1138b4bc6c",
"size": "541",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".idea/libraries/Maven__org_apache_sis_core_sis_metadata_0_6.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "3374"
},
{
"name": "Java",
"bytes": "47746"
}
],
"symlink_target": ""
}
|
namespace blink {
PassRefPtr<SharedBuffer> readFile(const char* fileName)
{
String filePath = Platform::current()->unitTestSupport()->webKitRootDir();
filePath.append(fileName);
return Platform::current()->unitTestSupport()->readFromFile(filePath);
}
PassRefPtr<SharedBuffer> readFile(const char* dir, const char* fileName)
{
String filePath = Platform::current()->unitTestSupport()->webKitRootDir();
filePath.append("/");
filePath.append(dir);
filePath.append("/");
filePath.append(fileName);
return Platform::current()->unitTestSupport()->readFromFile(filePath);
}
unsigned hashBitmap(const SkBitmap& bitmap)
{
return StringHasher::hashMemory(bitmap.getPixels(), bitmap.getSize());
}
static unsigned createDecodingBaseline(DecoderCreator createDecoder, SharedBuffer* data)
{
OwnPtr<ImageDecoder> decoder = createDecoder();
decoder->setData(data, true);
ImageFrame* frame = decoder->frameBufferAtIndex(0);
return hashBitmap(frame->bitmap());
}
void createDecodingBaseline(DecoderCreator createDecoder, SharedBuffer* data, Vector<unsigned>* baselineHashes)
{
OwnPtr<ImageDecoder> decoder = createDecoder();
decoder->setData(data, true);
size_t frameCount = decoder->frameCount();
for (size_t i = 0; i < frameCount; ++i) {
ImageFrame* frame = decoder->frameBufferAtIndex(i);
baselineHashes->append(hashBitmap(frame->getSkBitmap()));
}
}
void testByteByByteDecode(DecoderCreator createDecoder, const char* file, size_t expectedFrameCount, int expectedRepetitionCount)
{
RefPtr<SharedBuffer> data = readFile(file);
ASSERT_TRUE(data.get());
Vector<unsigned> baselineHashes;
createDecodingBaseline(createDecoder, data.get(), &baselineHashes);
OwnPtr<ImageDecoder> decoder = createDecoder();
size_t frameCount = 0;
size_t framesDecoded = 0;
// Pass data to decoder byte by byte.
for (size_t length = 1; length <= data->size() && !decoder->failed(); ++length) {
RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), length);
decoder->setData(tempData.get(), length == data->size());
EXPECT_LE(frameCount, decoder->frameCount());
frameCount = decoder->frameCount();
if (!decoder->isSizeAvailable())
continue;
ImageFrame* frame = decoder->frameBufferAtIndex(frameCount - 1);
if (frame && frame->status() == ImageFrame::FrameComplete && framesDecoded < frameCount)
++framesDecoded;
}
EXPECT_FALSE(decoder->failed());
EXPECT_EQ(expectedFrameCount, decoder->frameCount());
EXPECT_EQ(expectedFrameCount, framesDecoded);
EXPECT_EQ(expectedRepetitionCount, decoder->repetitionCount());
ASSERT_EQ(expectedFrameCount, baselineHashes.size());
for (size_t i = 0; i < decoder->frameCount(); i++) {
ImageFrame* frame = decoder->frameBufferAtIndex(i);
EXPECT_EQ(baselineHashes[i], hashBitmap(frame->getSkBitmap()));
}
}
// This test verifies that calling SharedBuffer::mergeSegmentsIntoBuffer() does
// not break decoding at a critical point: in between a call to decode the size
// (when the decoder stops while it may still have input data to read) and a
// call to do a full decode.
void testMergeBuffer(DecoderCreator createDecoder, const char* file)
{
RefPtr<SharedBuffer> data = readFile(file);
ASSERT_TRUE(data);
const unsigned hash = createDecodingBaseline(createDecoder, data.get());
// In order to do any verification, this test needs to move the data owned
// by the SharedBuffer. A way to guarantee that is to create a new one, and
// then append a string of characters greater than kSegmentSize. This
// results in writing the data into a segment, skipping the internal
// contiguous buffer.
RefPtr<SharedBuffer> segmentedData = SharedBuffer::create();
segmentedData->append(data->data(), data->size());
OwnPtr<ImageDecoder> decoder = createDecoder();
decoder->setData(segmentedData.get(), true);
ASSERT_TRUE(decoder->isSizeAvailable());
// This will call SharedBuffer::mergeSegmentsIntoBuffer, copying all
// segments into the contiguous buffer. If the ImageDecoder was pointing to
// data in a segment, its pointer would no longer be valid.
segmentedData->data();
ImageFrame* frame = decoder->frameBufferAtIndex(0);
ASSERT_FALSE(decoder->failed());
EXPECT_EQ(frame->status(), ImageFrame::FrameComplete);
EXPECT_EQ(hashBitmap(frame->bitmap()), hash);
}
} // namespace blink
|
{
"content_hash": "0ef91beb975d589a135755c9bb3ef8bb",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 129,
"avg_line_length": 37.54545454545455,
"alnum_prop": 0.7041602465331279,
"repo_name": "Bysmyyr/chromium-crosswalk",
"id": "7b34e954408277d01e1e6ff2ec72238110a7abd4",
"size": "5090",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
}
|
package com.tian.project.chabaike.fragment;
import android.content.Context;
import android.os.Handler;
import android.support.v4.view.ViewPager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.loopj.android.image.SmartImageView;
import com.tian.project.chabaike.R;
import com.tian.project.chabaike.adapter.CycleAdapter;
import com.tian.project.chabaike.entity.HomePage;
public class HomePageViewpPager {
// ¿Ø¼þÏà¹Ø
private Context context;
private ViewPager vpHomePage;
private LinearLayout llDotGroup;
private SmartImageView[] imgViews;
private ImageView[] imgDots;
// Êý¾ÝÏà¹Ø
private HomePage homePage;
private Handler handler = new Handler();
public HomePageViewpPager(Context context, LinearLayout llDotGroup,
HomePage homePage) {
this.context = context;
this.llDotGroup = llDotGroup;
this.homePage = homePage;
int num = homePage.getData().size();
if (num > 1) {
imgViews = new SmartImageView[num + 2];
for (int i = 0; i < imgViews.length; i++) {
if (i == 0) {
imgViews[i] = new SmartImageView(context);
imgViews[i].setImageUrl(homePage.getData().get(num - 1)
.getImage());
}else if(i==num+1){
imgViews[i] = new SmartImageView(context);
imgViews[i].setImageUrl(homePage.getData().get(0)
.getImage());
}else{
imgViews[i] = new SmartImageView(context);
imgViews[i].setImageUrl(homePage.getData().get(i-1)
.getImage());
}
}
} else {
imgViews = new SmartImageView[1];
imgViews[0].setImageUrl(homePage.getData().get(0).getImage());
}
imgDots = new ImageView[num];
for (int i = 0; i < imgDots.length; i++) {
imgDots[i] = new ImageView(context);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
10, 10);
params.setMargins(10, 0, 0, 0);
imgDots[i].setLayoutParams(params);
if (i == 0) {
imgDots[i].setImageResource(R.drawable.page_now);
} else {
imgDots[i].setImageResource(R.drawable.page);
}
llDotGroup.addView(imgDots[i]);
}
}
public void start(ViewPager vpHomePage) {
this.vpHomePage = vpHomePage;
CycleAdapter cycleAdapter = new CycleAdapter(vpHomePage,imgViews, imgDots);
vpHomePage.setAdapter(cycleAdapter);
vpHomePage.setOnPageChangeListener(cycleAdapter);
if (imgViews.length > 1) {
vpHomePage.setCurrentItem(1);
handler.postDelayed(changeImgTask, 3000);
}
}
Runnable changeImgTask = new Runnable() {
@Override
public void run() {
int index = vpHomePage.getCurrentItem();
index = (index + 1) % imgViews.length;
vpHomePage.setCurrentItem(index);
handler.postDelayed(changeImgTask, 3000);
}
};
}
|
{
"content_hash": "f1716e186df6a89a7b3b041ced2006ea",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 77,
"avg_line_length": 28.132653061224488,
"alnum_prop": 0.6779107725788901,
"repo_name": "SmiletolifeTian/Android_Tian_Project_Chabaike",
"id": "26094a12284758106bd23b2f1ec1f36c154363b1",
"size": "2757",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/tian/project/chabaike/fragment/HomePageViewpPager.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "71694"
}
],
"symlink_target": ""
}
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".CreateAlbumScreen" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="create album" />
</RelativeLayout>
|
{
"content_hash": "744690c9d614d949c9c63e10f2705b3e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 40.5,
"alnum_prop": 0.7299382716049383,
"repo_name": "techmaster-prj/AlbumSlideShowApp",
"id": "f43f989c318b277c861f88ab5e3e3ed6d988b3b6",
"size": "648",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MyAlbumSlideshow/res/layout/activity_create_album_screen.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "8961"
}
],
"symlink_target": ""
}
|
var bridge = require("./bridge");
var transformer = require("./transformer");
var clickHandlerSetup = require("./onclick");
bridge.registerListener( "clearContents", function() {
clearContents();
});
bridge.registerListener( "setMargins", function( payload ) {
document.getElementById( "content" ).style.marginTop = payload.marginTop + "px";
document.getElementById( "content" ).style.marginLeft = payload.marginLeft + "px";
document.getElementById( "content" ).style.marginRight = payload.marginRight + "px";
});
bridge.registerListener( "setPaddingTop", function( payload ) {
document.getElementById( "content" ).style.paddingTop = payload.paddingTop + "px";
});
bridge.registerListener( "setPaddingBottom", function( payload ) {
document.getElementById( "content" ).style.paddingBottom = payload.paddingBottom + "px";
});
bridge.registerListener( "beginNewPage", function( payload ) {
clearContents();
// fire an event back to the app, but with a slight timeout, which should
// have the effect of "waiting" until the page contents have cleared before sending the
// event, allowing synchronization of sorts between the WebView and the app.
// (If we find a better way to synchronize the two, it can be done here, as well)
setTimeout( function() {
bridge.sendMessage( "onBeginNewPage", payload );
}, 10);
});
function getLeadParagraph() {
var text = "";
var plist = document.getElementsByTagName( "p" );
if (plist.length > 0) {
text = plist[0].innerText;
}
return text;
}
// Returns currently highlighted text.
// If fewer than two characters are highlighted, returns the text of the first paragraph.
bridge.registerListener( "getTextSelection", function( payload ) {
var text = window.getSelection().toString().trim();
if (text.length < 2 && payload.purpose === "share") {
text = getLeadParagraph();
}
if (text.length > 250) {
text = text.substring(0, 249);
}
if (payload.purpose === "edit_here") {
var range = window.getSelection().getRangeAt(0);
var newRangeStart = Math.max(0, range.startOffset - 20);
range.setStart(range.startContainer, newRangeStart);
text = range.toString();
}
bridge.sendMessage( "onGetTextSelection", { "purpose" : payload.purpose, "text" : text, "sectionID" : getCurrentSection() } );
});
bridge.registerListener( "displayLeadSection", function( payload ) {
// This might be a refresh! Clear out all contents!
clearContents();
// create an empty div to act as the title anchor
var titleDiv = document.createElement( "div" );
titleDiv.id = "heading_" + payload.section.id;
titleDiv.setAttribute( "data-id", 0 );
titleDiv.className = "section_heading";
document.getElementById( "content" ).appendChild( titleDiv );
var issuesContainer = document.createElement( "div" );
issuesContainer.setAttribute( "dir", window.directionality );
issuesContainer.id = "issues_container";
document.getElementById( "content" ).appendChild( issuesContainer );
var content = document.createElement( "div" );
content.setAttribute( "dir", window.directionality );
content.innerHTML = payload.section.text;
content.id = "content_block_0";
document.head.getElementsByTagName("base")[0].setAttribute("href", payload.siteBaseUrl);
window.apiLevel = payload.apiLevel;
window.string_table_infobox = payload.string_table_infobox;
window.string_table_other = payload.string_table_other;
window.string_table_close = payload.string_table_close;
window.string_expand_refs = payload.string_expand_refs;
window.pageTitle = payload.title;
window.isMainPage = payload.isMainPage;
window.fromRestBase = payload.fromRestBase;
window.isBeta = payload.isBeta;
window.siteLanguage = payload.siteLanguage;
window.isNetworkMetered = payload.isNetworkMetered;
// append the content to the DOM now, so that we can obtain
// dimension measurements for items.
document.getElementById( "content" ).appendChild( content );
// Content service transformations
if (!window.fromRestBase) {
transformer.transform( "moveFirstGoodParagraphUp" );
transformer.transform( "hideRedLinks", content );
transformer.transform( "anchorPopUpMediaTransforms", content );
transformer.transform( "hideIPA", content );
} else {
clickHandlerSetup.addIPAonClick( content );
}
// client only transformations:
transformer.transform( "addDarkModeStyles", content ); // client setting
transformer.transform( "setDivWidth", content ); // offsetWidth
if (!window.isMainPage) {
transformer.transform( "hideTables", content ); // clickHandler
transformer.transform( "addImageOverflowXContainers", content ); // offsetWidth
if (!window.isNetworkMetered) {
transformer.transform( "widenImages", content ); // offsetWidth
}
}
transformer.transform("displayDisambigLink", content);
transformer.transform("displayIssuesLink", content);
document.getElementById( "loading_sections").className = "loading";
bridge.sendMessage( "pageInfo", {
"issues" : collectIssues(),
"disambiguations" : collectDisambig()
});
//if there were no page issues, then hide the container
if (!issuesContainer.hasChildNodes()) {
document.getElementById( "content" ).removeChild(issuesContainer);
}
scrolledOnLoad = false;
});
function clearContents() {
document.getElementById( "content" ).innerHTML = "";
window.scrollTo( 0, 0 );
}
function buildEditSectionButton(id) {
var editButtonWrapper = document.createElement( "span" );
editButtonWrapper.className = "edit_section_button_wrapper android";
var editButton = document.createElement( "a" );
editButton.setAttribute( 'data-id', id );
editButton.setAttribute( 'data-action', "edit_section" );
editButton.className = "edit_section_button android";
editButtonWrapper.appendChild( editButton );
return editButtonWrapper;
}
function elementsForSection( section ) {
var heading = document.createElement( "h" + ( section.toclevel + 1 ) );
heading.setAttribute( "dir", window.directionality );
heading.innerHTML = typeof section.line !== "undefined" ? section.line : "";
heading.id = section.anchor;
heading.className = "section_heading";
heading.setAttribute( 'data-id', section.id );
heading.appendChild( buildEditSectionButton( section.id ) );
var content = document.createElement( "div" );
content.setAttribute( "dir", window.directionality );
content.innerHTML = section.text;
content.id = "content_block_" + section.id;
// Content service transformations
if (!window.fromRestBase) {
transformer.transform( "hideRedLinks", content );
transformer.transform( "anchorPopUpMediaTransforms", content );
transformer.transform( "hideIPA", content );
} else {
clickHandlerSetup.addIPAonClick( content );
}
transformer.transform( "addDarkModeStyles", content ); // client setting
transformer.transform( "setDivWidth", content ); // offsetWidth
transformer.transform( "hideRefs", content ); // clickHandler
if (!window.isMainPage) {
transformer.transform( "hideTables", content ); // clickHandler
transformer.transform( "addImageOverflowXContainers", content ); // offsetWidth
if (!window.isNetworkMetered) {
transformer.transform( "widenImages", content ); // offsetWidth
}
}
return [ heading, content ];
}
var scrolledOnLoad = false;
bridge.registerListener( "displaySection", function ( payload ) {
if ( payload.noMore ) {
// if we still haven't scrolled to our target offset (if we have one),
// then do it now.
if (payload.scrollY > 0 && !scrolledOnLoad) {
window.scrollTo( 0, payload.scrollY );
scrolledOnLoad = true;
}
document.getElementById( "loading_sections").className = "";
bridge.sendMessage( "pageLoadComplete", {
"sequence": payload.sequence });
} else {
var contentWrapper = document.getElementById( "content" );
elementsForSection(payload.section).forEach(function (element) {
contentWrapper.appendChild(element);
// do we have a y-offset to scroll to?
if (payload.scrollY > 0 && payload.scrollY < element.offsetTop && !scrolledOnLoad) {
window.scrollTo( 0, payload.scrollY );
scrolledOnLoad = true;
}
});
// do we have a section to scroll to?
if ( typeof payload.fragment === "string" && payload.fragment.length > 0 && payload.section.anchor === payload.fragment) {
scrollToSection( payload.fragment );
}
bridge.sendMessage( "requestSection", { "sequence": payload.sequence, "index": payload.section.id + 1 });
}
});
bridge.registerListener( "scrollToSection", function ( payload ) {
scrollToSection( payload.anchor );
});
function collectDisambig() {
var res = [];
var links = document.querySelectorAll( 'div.hatnote a' );
var i = 0,
len = links.length;
for (; i < len; i++) {
// Pass the href; we'll decode it into a proper page title in Java
res.push( links[i].getAttribute( 'href' ) );
}
return res;
}
function collectIssues() {
var res = [];
var issues = document.querySelectorAll( 'table.ambox' );
var i = 0,
len = issues.length;
for (; i < len; i++) {
// .ambox- is used e.g. on eswiki
res.push( issues[i].querySelector( '.mbox-text, .ambox-text' ).innerHTML );
}
return res;
}
function scrollToSection( anchor ) {
if (anchor === "heading_0") {
// if it's the first section, then scroll all the way to the top, since there could
// be a lead image, native title components, etc.
window.scrollTo( 0, 0 );
} else {
var el = document.getElementById( anchor );
var scrollY = el.offsetTop - transformer.getDecorOffset();
window.scrollTo( 0, scrollY );
}
}
bridge.registerListener( "scrollToBottom", function () {
window.scrollTo(0, document.body.scrollHeight);
});
/**
* Returns the section id of the section that has the header closest to but above midpoint of screen
*/
function getCurrentSection() {
var sectionHeaders = document.getElementsByClassName( "section_heading" );
var topCutoff = window.scrollY + ( document.documentElement.clientHeight / 2 );
var curClosest = null;
for ( var i = 0; i < sectionHeaders.length; i++ ) {
var el = sectionHeaders[i];
if ( curClosest === null ) {
curClosest = el;
continue;
}
if ( el.offsetTop >= topCutoff ) {
break;
}
if ( Math.abs(el.offsetTop - topCutoff) < Math.abs(curClosest.offsetTop - topCutoff) ) {
curClosest = el;
}
}
return curClosest.getAttribute( "data-id" );
}
bridge.registerListener( "requestCurrentSection", function() {
bridge.sendMessage( "currentSectionResponse", { sectionID: getCurrentSection() } );
} );
|
{
"content_hash": "f5347265da6d490c1c6cdb38db063957",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 130,
"avg_line_length": 37.80602006688963,
"alnum_prop": 0.6611818825194621,
"repo_name": "SAGROUP2/apps-android-wikipedia",
"id": "52ada765e533882b7ccceca7765a162e7d3b482a",
"size": "11304",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "www/js/sections.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "72858"
},
{
"name": "HTML",
"bytes": "3079"
},
{
"name": "Java",
"bytes": "2365077"
},
{
"name": "JavaScript",
"bytes": "116671"
},
{
"name": "Makefile",
"bytes": "531"
},
{
"name": "Python",
"bytes": "18555"
},
{
"name": "Shell",
"bytes": "2043"
}
],
"symlink_target": ""
}
|
package bf.cg;
import java.io.PrintWriter;
import java.nio.file.Paths;
import java.util.List;
/**
* Created by Baofeng Xue on 2016/2/5.
*/
public class GenJpa {
static String template = "\n @Column(name=\"%s_ENC\")\n" +
" @LCEncryptionCiphertextField\n" +
" private String %sEnc;";
public static void main(String[] args) throws Exception {
Main.init(args);
if (Main.getCommonPath() == null) {
return;
}
String baseDir = Main.getCommonPath();
String className = Main.getJpa();
String[] columns = Main.getColumns().split(",");
String inputFile = baseDir + String.format("/lc-dao/src/main/java/com/lendingclub/data/domain/jpa/%s.java", className);
boolean exists = Paths.get(inputFile).toFile().exists();
if (!exists) {
inputFile = baseDir + String.format("/lc-dao/src/main/java/com/lendingclub/data/domain/jpa/collections/%s.java", className);
}
List<String> lines = Main.readLines(inputFile);
String currentColumn = null;
PrintWriter pw = Main.getPrintWriter(inputFile + ".bak");
for (String line : lines) {
for (String column : columns) {
if (line.contains("name") && line.contains(column.toUpperCase())) {
currentColumn = column;
pw.print(" @LCEncryptionCleartextField(LCEncryptionCleartextField.EncryptionState.TRANSITIONAL)\n");
}
}
pw.println(line);
if (currentColumn != null) {
if (line.contains(";")) {
String insertedText = String.format(template, currentColumn.toUpperCase(), Main.toProperty(currentColumn));
pw.println(insertedText);
currentColumn = null;
}
}
}
pw.close();
}
}
|
{
"content_hash": "85a785f14103750a112106d94a8b5191",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 136,
"avg_line_length": 33.6140350877193,
"alnum_prop": 0.5662839248434238,
"repo_name": "xuebaofeng/table-change-tool",
"id": "dae2d44c556d51e70d761ed610d5ca61335b2193",
"size": "1916",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/bf/cg/GenJpa.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "17159"
},
{
"name": "Shell",
"bytes": "250"
}
],
"symlink_target": ""
}
|
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Main extends CI_Controller {
public function index()
{
redirect('cliente/index');
}
}
|
{
"content_hash": "6cb55e84b21b49a190ea34c9b1563635",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 63,
"avg_line_length": 16.9,
"alnum_prop": 0.6982248520710059,
"repo_name": "gimenez/SCME",
"id": "1bcac9f89305de718a0afa877367c6818c8e9063",
"size": "169",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/controllers/Main.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "240"
},
{
"name": "CSS",
"bytes": "147642"
},
{
"name": "HTML",
"bytes": "5633"
},
{
"name": "JavaScript",
"bytes": "484"
},
{
"name": "PHP",
"bytes": "1744399"
}
],
"symlink_target": ""
}
|
package org.springframework.boot.test.context;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.mock.web.SpringBootMockServletContext;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.boot.web.reactive.context.GenericReactiveWebApplicationContext;
import org.springframework.boot.web.servlet.support.ServletContextApplicationContextInitializer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.core.SpringVersion;
import org.springframework.core.annotation.MergedAnnotations;
import org.springframework.core.annotation.MergedAnnotations.SearchStrategy;
import org.springframework.core.annotation.Order;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.ResourceLoader;
import org.springframework.test.context.ContextConfigurationAttributes;
import org.springframework.test.context.ContextCustomizer;
import org.springframework.test.context.ContextLoader;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.support.AbstractContextLoader;
import org.springframework.test.context.support.AnnotationConfigContextLoaderUtils;
import org.springframework.test.context.support.TestPropertySourceUtils;
import org.springframework.test.context.web.WebMergedContextConfiguration;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.context.support.GenericWebApplicationContext;
/**
* A {@link ContextLoader} that can be used to test Spring Boot applications (those that
* normally startup using {@link SpringApplication}). Although this loader can be used
* directly, most test will instead want to use it with
* {@link SpringBootTest @SpringBootTest}.
* <p>
* The loader supports both standard {@link MergedContextConfiguration} as well as
* {@link WebMergedContextConfiguration}. If {@link WebMergedContextConfiguration} is used
* the context will either use a mock servlet environment, or start the full embedded web
* server.
* <p>
* If {@code @ActiveProfiles} are provided in the test class they will be used to create
* the application context.
*
* @author Dave Syer
* @author Phillip Webb
* @author Andy Wilkinson
* @author Stephane Nicoll
* @author Madhura Bhave
* @author Scott Frederick
* @since 1.4.0
* @see SpringBootTest
*/
public class SpringBootContextLoader extends AbstractContextLoader {
@Override
public ApplicationContext loadContext(MergedContextConfiguration config) throws Exception {
Class<?>[] configClasses = config.getClasses();
String[] configLocations = config.getLocations();
Assert.state(!ObjectUtils.isEmpty(configClasses) || !ObjectUtils.isEmpty(configLocations),
() -> "No configuration classes or locations found in @SpringApplicationConfiguration. "
+ "For default configuration detection to work you need Spring 4.0.3 or better (found "
+ SpringVersion.getVersion() + ").");
SpringApplication application = getSpringApplication();
application.setMainApplicationClass(config.getTestClass());
application.addPrimarySources(Arrays.asList(configClasses));
application.getSources().addAll(Arrays.asList(configLocations));
ConfigurableEnvironment environment = getEnvironment();
if (!ObjectUtils.isEmpty(config.getActiveProfiles())) {
setActiveProfiles(environment, config.getActiveProfiles());
}
ResourceLoader resourceLoader = (application.getResourceLoader() != null) ? application.getResourceLoader()
: new DefaultResourceLoader(getClass().getClassLoader());
TestPropertySourceUtils.addPropertiesFilesToEnvironment(environment, resourceLoader,
config.getPropertySourceLocations());
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, getInlinedProperties(config));
application.setEnvironment(environment);
List<ApplicationContextInitializer<?>> initializers = getInitializers(config, application);
if (config instanceof WebMergedContextConfiguration) {
application.setWebApplicationType(WebApplicationType.SERVLET);
if (!isEmbeddedWebEnvironment(config)) {
new WebConfigurer().configure(config, application, initializers);
}
}
else if (config instanceof ReactiveWebMergedContextConfiguration) {
application.setWebApplicationType(WebApplicationType.REACTIVE);
if (!isEmbeddedWebEnvironment(config)) {
new ReactiveWebConfigurer().configure(application);
}
}
else {
application.setWebApplicationType(WebApplicationType.NONE);
}
application.setInitializers(initializers);
return application.run(getArgs(config));
}
/**
* Builds new {@link org.springframework.boot.SpringApplication} instance. You can
* override this method to add custom behavior
* @return {@link org.springframework.boot.SpringApplication} instance
*/
protected SpringApplication getSpringApplication() {
return new SpringApplication();
}
/**
* Builds a new {@link ConfigurableEnvironment} instance. You can override this method
* to return something other than {@link StandardEnvironment} if necessary.
* @return a {@link ConfigurableEnvironment} instance
*/
protected ConfigurableEnvironment getEnvironment() {
return new StandardEnvironment();
}
/**
* Return the application arguments to use. If no arguments are available, return an
* empty array.
* @param config the source context configuration
* @return the application arguments to use
* @deprecated since 2.2.7
* @see SpringApplication#run(String...)
*/
@Deprecated
protected String[] getArgs(MergedContextConfiguration config) {
return SpringBootTestArgs.get(config.getContextCustomizers());
}
private void setActiveProfiles(ConfigurableEnvironment environment, String[] profiles) {
environment.setActiveProfiles(profiles);
// Also add as properties to override any application.properties
String[] pairs = new String[profiles.length];
for (int i = 0; i < profiles.length; i++) {
pairs[i] = "spring.profiles.active[" + i + "]=" + profiles[i];
}
TestPropertyValues.of(pairs).applyTo(environment);
}
protected String[] getInlinedProperties(MergedContextConfiguration config) {
ArrayList<String> properties = new ArrayList<>();
// JMX bean names will clash if the same bean is used in multiple contexts
disableJmx(properties);
properties.addAll(Arrays.asList(config.getPropertySourceProperties()));
return StringUtils.toStringArray(properties);
}
private void disableJmx(List<String> properties) {
properties.add("spring.jmx.enabled=false");
}
/**
* Return the {@link ApplicationContextInitializer initializers} that will be applied
* to the context. By default this method will adapt {@link ContextCustomizer context
* customizers}, add {@link SpringApplication#getInitializers() application
* initializers} and add
* {@link MergedContextConfiguration#getContextInitializerClasses() initializers
* specified on the test}.
* @param config the source context configuration
* @param application the application instance
* @return the initializers to apply
* @since 2.0.0
*/
protected List<ApplicationContextInitializer<?>> getInitializers(MergedContextConfiguration config,
SpringApplication application) {
List<ApplicationContextInitializer<?>> initializers = new ArrayList<>();
for (ContextCustomizer contextCustomizer : config.getContextCustomizers()) {
initializers.add(new ContextCustomizerAdapter(contextCustomizer, config));
}
initializers.addAll(application.getInitializers());
for (Class<? extends ApplicationContextInitializer<?>> initializerClass : config
.getContextInitializerClasses()) {
initializers.add(BeanUtils.instantiateClass(initializerClass));
}
if (config.getParent() != null) {
initializers.add(new ParentContextApplicationContextInitializer(config.getParentApplicationContext()));
}
return initializers;
}
private boolean isEmbeddedWebEnvironment(MergedContextConfiguration config) {
return MergedAnnotations.from(config.getTestClass(), SearchStrategy.TYPE_HIERARCHY).get(SpringBootTest.class)
.getValue("webEnvironment", WebEnvironment.class).orElse(WebEnvironment.NONE).isEmbedded();
}
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
super.processContextConfiguration(configAttributes);
if (!configAttributes.hasResources()) {
Class<?>[] defaultConfigClasses = detectDefaultConfigurationClasses(configAttributes.getDeclaringClass());
configAttributes.setClasses(defaultConfigClasses);
}
}
/**
* Detect the default configuration classes for the supplied test class. By default
* simply delegates to
* {@link AnnotationConfigContextLoaderUtils#detectDefaultConfigurationClasses}.
* @param declaringClass the test class that declared {@code @ContextConfiguration}
* @return an array of default configuration classes, potentially empty but never
* {@code null}
* @see AnnotationConfigContextLoaderUtils
*/
protected Class<?>[] detectDefaultConfigurationClasses(Class<?> declaringClass) {
return AnnotationConfigContextLoaderUtils.detectDefaultConfigurationClasses(declaringClass);
}
@Override
public ApplicationContext loadContext(String... locations) throws Exception {
throw new UnsupportedOperationException(
"SpringApplicationContextLoader does not support the loadContext(String...) method");
}
@Override
protected String[] getResourceSuffixes() {
return new String[] { "-context.xml", "Context.groovy" };
}
@Override
protected String getResourceSuffix() {
throw new IllegalStateException();
}
/**
* Inner class to configure {@link WebMergedContextConfiguration}.
*/
private static class WebConfigurer {
private static final Class<GenericWebApplicationContext> WEB_CONTEXT_CLASS = GenericWebApplicationContext.class;
void configure(MergedContextConfiguration configuration, SpringApplication application,
List<ApplicationContextInitializer<?>> initializers) {
WebMergedContextConfiguration webConfiguration = (WebMergedContextConfiguration) configuration;
addMockServletContext(initializers, webConfiguration);
application.setApplicationContextClass(WEB_CONTEXT_CLASS);
}
private void addMockServletContext(List<ApplicationContextInitializer<?>> initializers,
WebMergedContextConfiguration webConfiguration) {
SpringBootMockServletContext servletContext = new SpringBootMockServletContext(
webConfiguration.getResourceBasePath());
initializers.add(0, new ServletContextApplicationContextInitializer(servletContext, true));
}
}
/**
* Inner class to configure {@link ReactiveWebMergedContextConfiguration}.
*/
private static class ReactiveWebConfigurer {
private static final Class<GenericReactiveWebApplicationContext> WEB_CONTEXT_CLASS = GenericReactiveWebApplicationContext.class;
void configure(SpringApplication application) {
application.setApplicationContextClass(WEB_CONTEXT_CLASS);
}
}
/**
* Adapts a {@link ContextCustomizer} to a {@link ApplicationContextInitializer} so
* that it can be triggered via {@link SpringApplication}.
*/
private static class ContextCustomizerAdapter
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
private final ContextCustomizer contextCustomizer;
private final MergedContextConfiguration config;
ContextCustomizerAdapter(ContextCustomizer contextCustomizer, MergedContextConfiguration config) {
this.contextCustomizer = contextCustomizer;
this.config = config;
}
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
this.contextCustomizer.customizeContext(applicationContext, this.config);
}
}
@Order(Ordered.HIGHEST_PRECEDENCE)
private static class ParentContextApplicationContextInitializer
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
private final ApplicationContext parent;
ParentContextApplicationContextInitializer(ApplicationContext parent) {
this.parent = parent;
}
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
applicationContext.setParent(this.parent);
}
}
}
|
{
"content_hash": "7a651682c7a3aa6af6c1ed7cac5c7e49",
"timestamp": "",
"source": "github",
"line_count": 310,
"max_line_length": 130,
"avg_line_length": 41.38709677419355,
"alnum_prop": 0.8000779423226813,
"repo_name": "yangdd1205/spring-boot",
"id": "b737e6e0fe43ff589baa007359eae6df3871a5a8",
"size": "13451",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "55077"
},
{
"name": "HTML",
"bytes": "4198"
},
{
"name": "Java",
"bytes": "97751"
},
{
"name": "Shell",
"bytes": "71373"
}
],
"symlink_target": ""
}
|
<?php
class LevDev_GoogleShoppingApi_Block_Adminhtml_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('log_grid');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
}
/**
* Prepare grid collection object
*
* @return LevDev_GoogleShoppingApi_Block_Adminhtml_Log_Grid
*/
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('googleshoppingapi/log_collection');
$collection->setOrder('id','DESC');
$this->setCollection($collection);
parent::_prepareCollection();
return $this;
}
/**
* Prepare grid colunms
*
* @return LevDev_GoogleShoppingApi_Block_Adminhtml_Log_Grid
*/
protected function _prepareColumns()
{
if (!Mage::app()->isSingleStoreMode()) {
$this->addColumn('store_id', array(
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
'index' => 'store_id',
'type' => 'store',
'store_view'=> true,
'display_deleted' => true,
));
}
$this->addColumn('created_at',
array(
'header' => $this->__('Created at'),
'index' => 'created_at',
'type' => 'datetime',
));
$this->addColumn('log_level',
array(
'header' => $this->__('Log Level'),
'index' => 'log_level',
'type' => 'text',
'renderer' => 'LevDev_GoogleShoppingApi_Block_Adminhtml_Log_Renderer_Loglevel'
));
$this->addColumn('message',
array(
'header' => $this->__('Message'),
'index' => 'message',
'type' => 'text',
'nl2br' => true,
'truncate' => 10000,
));
return parent::_prepareColumns();
}
/**
* Return row url for js event handlers
*
* @param Varien_Object
* @return string
*/
public function getRowUrl($row)
{
return false;
}
/**
* Grid url getter
*
* @params array $params
*
* @return string current grid url
*/
public function getCurrentUrl($params = array('_current' => true))
{
return $this->getUrl('*/*/grid', $params);
}
}
|
{
"content_hash": "8b513e566594a9dcf477fa3dfe0b2e88",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 96,
"avg_line_length": 28.43820224719101,
"alnum_prop": 0.4847886210983801,
"repo_name": "Leviathan-Development/Google-Shopping-Api",
"id": "1eb8dee2f2f293998dd64fc76c1ce20a83fe09ff",
"size": "2531",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/code/community/LevDev/GoogleShoppingApi/Block/Adminhtml/Log/Grid.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "7969"
},
{
"name": "PHP",
"bytes": "132579"
}
],
"symlink_target": ""
}
|
extern crate mopa;
mod ast;
mod context;
mod filter;
mod scanner;
mod tags;
mod template;
mod value;
mod compiler;
pub use template::Template;
pub use context::{Context, HashMapContext, MultiContext};
pub use value::{Value, ValueAsStringByRef, ValueAsString, ValueAsIterator, ValueAsObject, ValueAsBool};
pub use value::helpers::value_to_trait_object;
pub use filter::FilterFunction;
pub use ast::Node;
pub use compiler::TemplateCompiler;
|
{
"content_hash": "a49b649f38571f1fad10fd9e687804fd",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 103,
"avg_line_length": 24.444444444444443,
"alnum_prop": 0.7863636363636364,
"repo_name": "SlNPacifist/rust-dtl",
"id": "5e2036cab65f432fb9df9c5d25965685f2a5b5ae",
"size": "1597",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/lib.rs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "28"
},
{
"name": "Rust",
"bytes": "66763"
}
],
"symlink_target": ""
}
|
/*! 1510333116583 */
@font-face {
font-family: 'sans-bold';
font-style: normal;
font-weight: normal;
src: url(assets/fonts/OpenSans-Bold.ttf);
src: url(assets/fonts/OpenSans-Bold.eot?#iefix) format('embedded-opentype');
src: url(assets/fonts/OpenSans-Bold.otf);
src: url(data:image/svg+xml;base64,bW9kdWxlLmV4cG9ydHMgPSBfX3dlYnBhY2tfcHVibGljX3BhdGhfXyArICJhc3NldHMvZm9udHMvT3BlblNhbnMtQm9sZC5zdmciOw==) format('svg');
src: url(assets/fonts/OpenSans-Bold.woff) format('woff');
src: url(assets/fonts/OpenSans-Bold.woff2);
}
@font-face {
font-family: 'sans-regular';
font-style: normal;
font-weight: normal;
src: url(assets/fonts/OpenSans-Regular.ttf);
src: url(assets/fonts/OpenSans-Regular.eot?#iefix) format('embedded-opentype');
src: url(assets/fonts/OpenSans-Regular.otf);
src: url(data:image/svg+xml;base64,bW9kdWxlLmV4cG9ydHMgPSBfX3dlYnBhY2tfcHVibGljX3BhdGhfXyArICJhc3NldHMvZm9udHMvT3BlblNhbnMtUmVndWxhci5zdmciOw==) format('svg');
src: url(assets/fonts/OpenSans-Regular.woff) format('woff');
src: url(assets/fonts/OpenSans-Regular.woff2);
}
@font-face {
font-family: 'sans-semibold';
font-style: normal;
font-weight: normal;
src: url(assets/fonts/OpenSans-Semibold.ttf);
src: url(assets/fonts/OpenSans-Semibold.eot?#iefix) format('embedded-opentype');
src: url(assets/fonts/OpenSans-Semibold.otf);
src: url(data:image/svg+xml;base64,bW9kdWxlLmV4cG9ydHMgPSBfX3dlYnBhY2tfcHVibGljX3BhdGhfXyArICJhc3NldHMvZm9udHMvT3BlblNhbnMtU2VtaWJvbGQuc3ZnIjs=) format('svg');
src: url(assets/fonts/OpenSans-Semibold.woff) format('woff');
src: url(assets/fonts/OpenSans-Semibold.woff2);
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: transparent;
}
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body,
ul,
ol,
p {
padding: 0;
margin: 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: normal;
padding: 0;
margin: 0;
}
a {
text-decoration: none;
color: inherit;
}
ul,
ol {
list-style: none;
}
textarea {
resize: vertical;
}
/**** form item specific css ***/
input {
font-family: inherit;
border-radius: 0;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
input[type=number]::-moz-inner-spin-button,
input[type=number]::-moz-outer-spin-button {
-moz-appearance: none;
margin: 0;
}
input:disabled {
font-family: inherit;
font-size: inherit;
color: inherit;
}
button:focus {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
input:focus,
select:focus,
textarea:focus,
button:focus {
outline: none;
}
/** float css **/
.f-l {
float: left;
}
.f-r {
float: right;
}
.c-b {
clear: both;
}
.full-width {
width: 100%;
}
/**
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.cf:before,
.cf:after {
content: " ";
/* 1 */
display: table;
/* 2 */
}
.cf:after {
clear: both;
}
/**
* For IE 6/7 only
* Include this rule to trigger hasLayout and contain floats.
*/
.cf {
*zoom: 1;
}
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
min-height: 100vh;
font-family: sans-regular;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
.button {
background: #45A1D9;
height: 40px;
line-height: 40px;
display: inline-block;
padding: 0 20px;
text-align: center;
border-radius: 3px;
cursor: pointer;
font-size: 14px;
font-family: 'sans-regular';
color: #FFF;
-webkit-box-shadow: 0px 3px 4.7px 0.3px rgba(0, 0, 0, 0.24);
-moz-box-shadow: 0px 3px 4.7px 0.3px rgba(0, 0, 0, 0.24);
box-shadow: 0px 3px 4.7px 0.3px rgba(0, 0, 0, 0.24);
min-width: 120px;
}
.ripple {
position: relative;
overflow: hidden;
}
.ripple:after {
content: "";
display: block;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
background-image: radial-gradient(circle, #000 10%, transparent 10.01%);
background-repeat: no-repeat;
background-position: 50%;
transform: scale(10, 10);
opacity: 0;
transition: transform .5s, opacity 1s;
}
.ripple:active:after {
transform: scale(0, 0);
opacity: .2;
transition: 0s;
}
.homepage .home-section-wrap {
min-height: 100vh;
height: 100%;
opacity: 0.8;
width: 100%;
position: relative;
background: url(8b8ca1f72b3e07f732ed5fb8334936ff.jpeg);
background-repeat: repeat-x;
background-attachment: fixed;
background-position: center;
background-size: cover;
}
.homepage .overlay {
min-height: 100vh;
height: 100%;
background-color: rgba(21, 21, 21, 0.7);
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.homepage .viewport-wrap {
max-width: 1024px;
margin: 0 auto;
}
.homepage #customViewport {
max-width: none;
padding: 0 50px;
}
.homepage .title-wrap {
position: absolute;
top: 45%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: 100%;
text-align: center;
z-index: 0;
}
.homepage .title-wrap .title {
font-size: 40px;
font-family: 'sans-bold';
color: #FFF;
margin: 20px 0;
}
.homepage .title-wrap .subtitle {
font-size: 14px;
font-family: 'sans-regular';
color: #FFF;
padding: 5px 0;
border-top: 1px solid rgba(255, 255, 255, 0.8);
border-bottom: 1px solid rgba(255, 255, 255, 0.8);
display: inline-block;
}
.homepage #contactBtn {
width: 200px;
background: #FF5252;
margin-top: 50px;
display: block;
position: relative;
left: 50%;
-webkit-transform: translateX(-50%);
-moz-transform: translateX(-50%);
-ms-transform: translateX(-50%);
-o-transform: translateX(-50%);
transform: translateX(-50%);
}
@media (min-width: 768px) and (max-width: 1024px) {
.homepage .title-wrap .title {
font-size: 34px;
}
}
@media (max-width: 767px) {
.homepage .home-section-wrap {
padding: 0 20px;
}
.homepage .title-wrap {
padding: 0 20px;
top: 50%;
}
.homepage .title-wrap .title {
font-size: 22px;
}
.homepage #customViewport {
padding: 0;
}
}
.navbar-wrap {
height: 80px;
padding: 10px 0;
position: absolute;
width: 100%;
z-index: 5;
}
.navbar-wrap .logo-wrap {
background: url(b682d91459c3f2f86b462a19e1f13a2b.jpg);
background-repeat: no-repeat;
background-size: contain;
background-position: left;
height: 46px;
width: 200px;
margin: 7px 0;
cursor: pointer;
}
.nav-components-wrap {
line-height: 60px;
}
.nav-components-wrap .nav-component {
font-size: 14px;
font-family: 'sans-bold';
color: #FFF;
display: inline-block;
cursor: pointer;
}
.nav-components-wrap .nav-component:not(:last-child) {
margin-right: 20px;
}
.nav-components-wrap .nav-component:hover {
color: #FF5252;
}
@media (max-width: 767px) {
.navbar-wrap {
padding: 0 10px;
}
.navbar-wrap .logo-wrap {
width: 110px;
}
.nav-components-wrap .nav-component {
font-size: 12px;
}
.nav-components-wrap .nav-component:not(:last-child) {
margin-right: 10px;
}
}
#filmSchoolWrap #filmschoolImage {
background: url(61aea21f1a77f94555e5a7e2e12cd470.jpeg);
height: 100vh;
width: 100%;
background-repeat: no-repeat;
background-size: cover;
background-position: fixed;
background-attachment: fixed;
position: relative;
}
#filmSchoolWrap #filmschoolContentWrap {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: 100%;
text-align: center;
}
#filmSchoolWrap .content-header {
font-size: 48px;
font-family: 'sans-bold';
color: #FFF;
}
#filmSchoolWrap .content-subheader {
margin-top: 25px;
font-size: 36px;
font-family: 'sans-regular';
color: #FFF;
}
/*# sourceMappingURL=style.css.map*/
|
{
"content_hash": "3979b66190bca11b08791649ca58c101",
"timestamp": "",
"source": "github",
"line_count": 484,
"max_line_length": 161,
"avg_line_length": 19.171487603305785,
"alnum_prop": 0.6758271365448864,
"repo_name": "mkkaushiksjce/Sushupti_Web_Application",
"id": "2f13302d5ba5d5b2e2e535755c211483ec3a28da",
"size": "9279",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dist/style.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "63813"
},
{
"name": "HTML",
"bytes": "1178"
},
{
"name": "JavaScript",
"bytes": "13733"
}
],
"symlink_target": ""
}
|
declare module 'passport-google-oauth' {
import express from "express";
import passport from "passport";
module p {
interface Profile extends passport.Profile {
gender: string;
_raw: string;
_json: any;
}
interface IOAuthStrategyOption {
consumerKey: string;
consumerSecret: string;
callbackURL: string;
reguestTokenURL?: string;
accessTokenURL?: string;
userAuthorizationURL?: string;
sessionKey?: string;
}
class OAuthStrategy implements passport.Strategy {
constructor(options: IOAuthStrategyOption,
verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void);
name: string;
authenticate: (req: express.Request, options?: Object) => void;
}
interface IOAuth2StrategyOption {
clientID: string;
clientSecret: string;
callbackURL: string;
authorizationURL?: string;
tokenURL?: string;
accessType?: string;
approval_prompt?: string;
prompt?: string;
loginHint?: string;
userID?: string;
hostedDomain?: string;
display?: string;
requestVisibleActions?: string;
openIDRealm?: string;
}
class OAuth2Strategy implements passport.Strategy {
constructor(options: IOAuth2StrategyOption,
verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void);
name: string;
authenticate: (req: express.Request, options?: Object) => void;
}
}
export default p;
}
|
{
"content_hash": "75eb14262840593e1a6ad2cf17c9b1de",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 140,
"avg_line_length": 28.966666666666665,
"alnum_prop": 0.5995397008055235,
"repo_name": "mikaturunen/cthulhu-generator-application",
"id": "e0ad2967cbff2df43eb4694f497d50d4745848f9",
"size": "2039",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "typedefinitions/passport-google-oauth/passport-google-oauth.d.ts",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9853"
},
{
"name": "HTML",
"bytes": "21452"
},
{
"name": "JavaScript",
"bytes": "52783"
},
{
"name": "TypeScript",
"bytes": "736810"
}
],
"symlink_target": ""
}
|
package com.krosshuang.krosslib.lib.math;
import android.graphics.PointF;
/**
*
* Created by krosshuang on 2015/10/23.
*/
public class PolarPointF {
public float r; //distance to reference point.
public float angle; //angle in radians.
public static PolarPointF parseFromCartesianCoordinatePoint(float x, float y) {
PolarPointF p = new PolarPointF();
p.angle = (float)Math.atan2(y, x);
p.r = (float)Math.sqrt(x * x + y * y);
return p;
}
public PointF toCartesianCoordinatePoint() {
PointF p = new PointF();
p.x = r * (float)Math.cos(angle);
p.y = r * (float)Math.sin(angle);
return p;
}
}
|
{
"content_hash": "435b6bd8d7467e08dbcfe813d63fac0f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 83,
"avg_line_length": 26.814814814814813,
"alnum_prop": 0.5828729281767956,
"repo_name": "krossford/KrossAndroidLib",
"id": "bc91138ee2de4fa9afbf9c05097b45ee8e89d658",
"size": "724",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "android-project/app/src/main/java/com/krosshuang/krosslib/lib/math/PolarPointF.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "101823"
}
],
"symlink_target": ""
}
|
package lc.evaluatedivision;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/*
Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return -1.0.
Example:
Given a / b = 2.0, b / c = 3.0.
queries are: a / c = ?, b / a = ?, a / e = ?, a / a = ?, x / x = ? .
return [6.0, 0.5, -1.0, 1.0, -1.0 ].
The input is: vector<pair<string, string>> equations, vector<double>& values, vector<pair<string, string>> queries , where equations.size() == values.size(), and the values are positive. This represents the equations. Return vector<double>.
According to the example above:
equations = [ ["a", "b"], ["b", "c"] ],
values = [2.0, 3.0],
queries = [ ["a", "c"], ["b", "a"], ["a", "e"], ["a", "a"], ["x", "x"] ].
The input is always valid. You may assume that evaluating the queries will result in no division by zero and there is no contradiction.
*/
public class Solution {
// Floyd-Warshall approach, advantageous when the grpah is dense and number of queries is large
// Credit to post https://discuss.leetcode.com/topic/58981/java-solution-using-floyd-warshall-algorithm/2
public double [] calcEquationsFW(String [][] equations, double [] values, String [][] queries) {
Map<String, Map<String, Double>> graph = new HashMap<>();
// building the undirected graph
for (int i = 0; i < equations.length; i ++) {
String src = equations[i][0], dst = equations[i][1];
if (!graph.containsKey(src)) graph.put(src, new HashMap<>());
if (!graph.containsKey(dst)) graph.put(dst, new HashMap<>());
graph.get(src).put(src, 1.0);
graph.get(dst).put(dst, 1.0);
graph.get(src).put(dst, values[i]);
graph.get(dst).put(src, 1.0 / values[i]);
}
// NOTE: apply Floyd-Warshall on Adj Map, but here we are not solving the
// ASAP problem, thus once we get the solution we are fine(no need to perform min)
for (String mid : graph.keySet()) {
for (String src : graph.get(mid).keySet()) {
for (String dst : graph.get(mid).keySet()) {
// the three nested loop above guarantee mid, src, and dst all exist in graph
// and they've got path linked to each other(src - mid and mid - dst)
double val = graph.get(src).get(mid) * graph.get(mid).get(dst);
graph.get(src).put(dst, val);
}
}
}
double [] res = new double [queries.length];
for (int i = 0; i < res.length; i ++) {
if (!graph.containsKey(queries[i][0])) {
res[i] = -1;
} else {
res[i] = graph.get(queries[i][0]).getOrDefault(queries[i][1], -1.0);
}
}
return res;
}
// Credit to post https://discuss.leetcode.com/topic/59036/java-4ms-neat-code-dfs-easy-to-understand
// DFS approach, time complexity: O(|V| + |E|), space complexity: O(|E|)
// This approach is efficient when the number of queries is small and the graph
// is rather sparse. When number of queries are large or the graph is dense, dfs can be very time consming.
// at this time we resort to Floyd-Warshall(recall All-Pair-Shortest-Path problem)
public double[] calcEquationDFS(String[][] equations, double[] values, String[][] queries) {
Map<String, Map<String, Double>> graph = new HashMap<>();
// construct undirected graph
for (int i = 0; i < equations.length; i ++) {
String [] eq = equations[i];
if (graph.containsKey(eq[0])) {
graph.get(eq[0]).put(eq[1], values[i]);
} else {
Map<String, Double> tmp = new HashMap<>();
tmp.put(eq[1], values[i]);
graph.put(eq[0], tmp);
}
if (graph.containsKey(eq[1])) {
graph.get(eq[1]).put(eq[0], 1.0 / values[i]);
} else {
Map<String, Double> tmp = new HashMap<>();
tmp.put(eq[0], 1.0 / values[i]);
graph.put(eq[1], tmp);
}
}
// use dfs to search path between specified two nodes(two factors in the query)
double [] res = new double [queries.length];
for (int j = 0; j < queries.length; j ++) {
// use a set to hold visited nodes
res[j] = dfs(graph, queries[j][0], queries[j][1], new HashSet<String>());
}
return res;
}
private double dfs(Map<String, Map<String, Double>> graph,
String start, String end, Set<String> visited) {
// check whether start and end exist in the graph, if not exist then return -1.0
if (!graph.containsKey(end) || !graph.containsKey(start)) return -1.0;
else if (start.equals(end)) return 1.0;
Map<String, Double> neighbors = graph.get(start);
double res = 0;
// take heed on the iteration with entries
for (Map.Entry<String, Double> entry : neighbors.entrySet()) {
String key = entry.getKey();
// if visited doesn't contain the key, then add(key) will return true; otherwise
// key is already in visited, hence return false, in which case we do nothing
if (visited.add(key)) {
res = entry.getValue() * dfs(graph, key, end, visited);
// remove key from visited, restore the path
visited.remove(key);
// path to the end found(note the results must be positive), return directly
if (res > 0) return res;
}
}
// not found
return -1.0;
}
}
|
{
"content_hash": "8071642c360a096197e499e39d800a1c",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 240,
"avg_line_length": 41.92248062015504,
"alnum_prop": 0.6168639053254438,
"repo_name": "wuyrush/lc2016",
"id": "ae81748b03fc2260558b97820dbbb66a823ffa9a",
"size": "5408",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/lc/evaluatedivision/Solution.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "779414"
}
],
"symlink_target": ""
}
|
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.eg = global.eg || {}, global.eg.Parallax = factory());
}(this, (function () { 'use strict';
var win;
if (typeof window === "undefined") {
// window is undefined in node.js
win = {
document: {},
navigator: {
userAgent: ""
}
};
} else {
win = window;
}
var document$1 = win.document;
var _a;
var ua = win.navigator.userAgent;
var SUPPORT_ADDEVENTLISTENER = !!("addEventListener" in document$1);
var SUPPORT_PASSIVE = function () {
var supportsPassiveOption = false;
try {
if (SUPPORT_ADDEVENTLISTENER && Object.defineProperty) {
// tslint:disable-next-line: no-empty
document$1.addEventListener("test", function () {}, Object.defineProperty({}, "passive", {
get: function () {
supportsPassiveOption = true;
}
}));
}
} catch (e) {//
}
return supportsPassiveOption;
}();
var IS_IE = /MSIE|Trident|Windows Phone|Edge/.test(ua);
var IS_IOS = /iPhone|iPad/.test(ua);
var IS_ANDROID2 = /Android 2\./.test(ua);
var agent = ua.toLowerCase();
var isMobile = /mobi|ios|android/.test(agent);
var ALIGN = {
START: "start",
CENTER: "center",
END: "end",
JUSTIFY: "justify"
};
var webkit = /applewebkit\/([\d|.]*)/g.exec(agent);
var WEBKIT_VERSION = webkit && parseInt(webkit[1], 10) || 0;
var TRANSFORM = (_a = function () {
var properties = {
transitionend: "",
webkitTransitionEnd: "-webkit-",
MSTransitionEnd: "-ms-",
oTransitionEnd: "-o-",
mozTransitionEnd: "-moz-"
};
for (var property in properties) {
var prefix = properties[property];
if ("on" + property.toLowerCase() in win) {
return [prefix + "transform", prefix + "transition", property];
}
}
return [];
}(), _a[0]),
TRANSITION = _a[1],
TRANSITION_END = _a[2];
function toArray(nodes) {
// SCRIPT5014 in IE8
var array = [];
if (nodes) {
var length = nodes.length;
for (var i = 0; i < length; i++) {
array.push(nodes[i]);
}
}
return array;
}
function matchHTML(html) {
return html.match(/^<([A-z]+)\s*([^>]*)>/);
}
function $(param, multi) {
if (multi === void 0) {
multi = false;
}
var el;
if (typeof param === "string") {
// String (HTML, Selector)
// check if string is HTML tag format
var match = matchHTML(param); // creating element
if (match) {
// HTML
var dummy = document$1.createElement("div");
dummy.innerHTML = param;
el = dummy.childNodes;
} else {
// Selector
el = document$1.querySelectorAll(param);
}
if (multi) {
return toArray(el);
} else {
return el && el[0];
}
} else if (isWindow(param)) {
// window
el = param;
} else if (isJQuery(param)) {
// jQuery
el = multi ? $(param.toArray(), true) : $(param.get(0), false);
} else if (Array.isArray(param)) {
el = param.map(function (v) {
return $(v);
});
if (!multi) {
el = el.length >= 1 ? el[0] : undefined;
}
} else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) {
// HTMLElement, Document
el = param;
} else {
el = [].slice.call(el);
}
return el;
}
function assign(target) {
var sources = [];
for (var _i = 1; _i < arguments.length; _i++) {
sources[_i - 1] = arguments[_i];
}
sources.forEach(function (source) {
for (var key in source) {
target[key] = source[key];
}
});
return target;
}
function isJQuery(el) {
return typeof win.jQuery === "function" && el instanceof win.jQuery || el.constructor.prototype.jquery && el.toArray;
}
function isWindow(el) {
return el === win;
}
var style = {
vertical: {
position: "top",
size: "height",
cammelSize: "Height",
coordinate: "Y"
},
horizontal: {
position: "left",
size: "width",
cammelSize: "Width",
coordinate: "X"
}
};
var START = ALIGN.START,
CENTER = ALIGN.CENTER;
/**
* @classdesc Parallax is a displacement or difference in the apparent position of an object viewed along two different lines of sight. You can apply parallax by scrolling the image and speed of the item.
* @ko Parallax는 서로 다른 두 개의 시선에서 바라본 물체의 외관상 위치의 변위 또는 차이입니다. 스크롤에 따라 이미지와 아이템의 속도를 차이를 줌으로써 parallax을 적용할 수 있습니다.
* @class eg.Parallax
* @param {Element|String} [root=window] Scrolling target. If you scroll in the body, set window. 스크롤하는 대상. 만약 body에서 스크롤하면 window로 설정한다.
* @param {Object} [options] The option object of eg.Parallax module <ko>eg.Parallax 모듈의 옵션 객체</ko>
* @param {Boolean} [options.horizontal=false] Direction of the scroll movement (false: vertical, true: horizontal) <ko>스크롤 이동 방향 (false: 세로방향, true: 가로방향)</ko>
* @param {Element|String} [options.container=null] Container wrapping items. If root and container have no gaps, do not set option. <ko> 아이템들을 감싸고 있는 컨테이너. 만약 root와 container간의 차이가 없으면, 옵션을 설정하지 않아도 된다.</ko>
* @param {String} [options.selector="img"] The selector of the image to apply the parallax in the item <ko> 아이템안에 있는 parallax를 적용할 이미지의 selector </ko>
* @param {Boolean} [options.strength=1] Dimensions that indicate the sensitivity of parallax. The higher the strength, the faster.
* @param {Boolean} [options.center=0] The middle point of parallax. The top is 1 and the bottom is -1. <ko> parallax가 가운데로 오는 점. 상단이 1이고 하단이 -1이다. </ko>
* @param {Boolean} [options.range=[-1, 1]] Range to apply the parallax. The top is 1 and the bottom is -1. <ko> parallax가 적용되는 범위, 상단이 1이고 하단이 -1이다. </ko>
* @param {Boolean} [options.align="start"] The alignment of the image in the item. ("start" : top or left, "center": middle) <ko> 아이템안의 이미지의 정렬 </ko>
* @example
```
<script>
// isOverflowScroll: false
var parallax = new eg.Parallax(window, {
container: ".container",
selector: "img.parallax",
strength: 0.8,
center: 0,
range: [-1, 1],
align: "center",
horizontal: true,
});
// isOverflowScroll: ture
var parallax = new eg.Parallax(".container", {
selector: "img.parallax",
strength: 0.8,
center: 0,
range: [-1, 1],
align: "center",
horizontal: true,
});
// item interface
var item = {
// original size
size: {
width: 100,
height: 100,
},
// view size
rect: {
top: 100,
left: 100,
width: 100,
height: 100,
}
};
</script>
```
**/
var Parallax =
/*#__PURE__*/
function () {
function Parallax(root, options) {
if (root === void 0) {
root = window;
}
if (options === void 0) {
options = {};
}
this.options = assign({
container: null,
selector: "img",
strength: 1,
center: 0,
range: [-1, 1],
align: START,
horizontal: false
}, options);
this._root = $(root);
this._container = this.options.container && $(this.options.container);
this._rootSize = 0;
this._containerPosition = 0;
this._style = style[this.options.horizontal ? "horizontal" : "vertical"];
this.resize();
}
/**
* As the browser is resized, the gaps between the root and the container and the size of the items are updated.
* @ko 브라우저의 크기가 변경됨으로 써 root와 container의 간격과 아이템들의 크기를 갱신한다.
* @method eg.Parallax#resize
* @param {Array} [items = []] Items to apply parallax. It does not apply if it is not in visible range. <ko>parallax를 적용할 아이템들. 가시거리에 존재하지 않으면 적용이 안된다.</ko>
* @return {eg.Parallax} An instance of a module itself<ko>모듈 자신의 인스턴스</ko>
* @example
```js
window.addEventListener("resize", function (e) {
parallax.resize(items);
});
```
*/
var __proto = Parallax.prototype;
__proto.resize = function (items) {
var _this = this;
if (items === void 0) {
items = [];
}
var root = this._root;
var container = this._container;
var positionName = this._style.position;
var sizeName = this._style.cammelSize;
if (!container || root === container) {
this._containerPosition = 0;
} else {
var rootRect = (isWindow(root) ? document.body : root).getBoundingClientRect();
var containertRect = container.getBoundingClientRect();
this._containerPosition = containertRect[positionName] - rootRect[positionName];
}
this._rootSize = isWindow(root) ? window["inner" + sizeName] || document.documentElement["client" + sizeName] : root["client" + sizeName];
if (isMobile && isWindow(root)) {
var bodyWidth = document.body.offsetWidth || document.documentElement.offsetWidth;
var windowWidth = window.innerWidth;
this._rootSize = this._rootSize / (bodyWidth / windowWidth);
}
items.forEach(function (item) {
_this._checkParallaxItem(item.el);
});
return this;
};
/**
* Scrolls the image in the item by a parallax.
* @ko 스크롤하면 아이템안의 이미지를 시차적용시킨다.
* @method eg.Parallax#refresh
* @param {Array} [items = []] Items to apply parallax. It does not apply if it is not in visible range. <ko>parallax를 적용할 아이템들. 가시거리에 존재하지 않으면 적용이 안된다.</ko>
* @param {Number} [scrollPositionStart = 0] The scroll position.
* @return {eg.Parallax} An instance of a module itself<ko>모듈 자신의 인스턴스</ko>
* @example
```js
document.body.addEventListener("scroll", function (e) {
parallax.refresh(items, e.scrollTop);
});
```
*/
__proto.refresh = function (items, scrollPositionStart) {
var _this = this;
if (items === void 0) {
items = [];
}
if (scrollPositionStart === void 0) {
scrollPositionStart = 0;
}
var styleNames = this._style;
var positionName = styleNames.position;
var coordinateName = styleNames.coordinate;
var sizeName = styleNames.size;
var options = this.options;
var strength = options.strength,
center = options.center,
range = options.range,
align = options.align;
var rootSize = this._rootSize;
var scrollPositionEnd = scrollPositionStart + rootSize;
var containerPosition = this._containerPosition;
items.forEach(function (item) {
if (!item.rect || !item.size || !item.el) {
return;
}
var position = containerPosition + item.rect[positionName];
var itemSize = item.rect[sizeName] || item.size[sizeName]; // check item is in container.
if (scrollPositionStart > position + itemSize || scrollPositionEnd < position) {
return;
}
var el = item.el;
if (!el.__IMAGE__) {
_this._checkParallaxItem(el);
}
if (el.__IMAGE__ === -1) {
return;
}
var imageElement = el.__IMAGE__;
var boxElement = el.__BOX__;
var boxSize = boxElement.__SIZE__;
var imageSize = imageElement.__SIZE__; // no parallax
if (boxSize >= imageSize) {
// remove transform style
imageElement.style[TRANSFORM] = "";
return;
} // if area's position is center, ratio is 0.
// if area is hidden at the top, ratio is 1.
// if area is hidden at the bottom, ratio is -1.
var imagePosition = position + boxSize / 2;
var ratio = (scrollPositionStart + rootSize / 2 - (rootSize + boxSize) / 2 * center - imagePosition) / (rootSize + boxSize) * 2 * strength; // if ratio is out of the range of -1 and 1, show empty space.
ratio = Math.max(Math.min(ratio, range[1]), range[0]); // dist is the position when thumnail's image is centered.
var dist = (boxSize - imageSize) / 2;
var translate = dist * (1 - ratio);
if (align === CENTER) {
translate -= dist;
}
imageElement.__TRANSLATE__ = translate;
imageElement.__RATIO__ = ratio;
imageElement.style[TRANSFORM] = "translate" + coordinateName + "(" + translate + "px)";
});
return this;
};
__proto._checkParallaxItem = function (element) {
if (!element) {
return;
}
var selector = this.options.selector;
if (!element.__IMAGE__) {
var img = element.querySelector(selector);
element.__IMAGE__ = img || -1;
if (!img) {
return;
}
element.__BOX__ = img.parentNode;
}
if (element.__IMAGE__ === -1) {
return;
}
var sizeName = this._style.cammelSize;
element.__IMAGE__.__SIZE__ = element.__IMAGE__["offset" + sizeName];
element.__BOX__.__SIZE__ = element.__BOX__["offset" + sizeName];
};
return Parallax;
}();
return Parallax;
})));
//# sourceMappingURL=parallax.js.map
|
{
"content_hash": "835077da4acd634deb43ede33077cf86",
"timestamp": "",
"source": "github",
"line_count": 443,
"max_line_length": 209,
"avg_line_length": 29.006772009029344,
"alnum_prop": 0.5940856031128404,
"repo_name": "cdnjs/cdnjs",
"id": "438626a6e94aea3414c05af0d6bd57bc0224b9dc",
"size": "13679",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ajax/libs/egjs-infinitegrid/3.8.4-beta.0/parallax.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
}
|
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PoGo.ApiClient;
using PoGo.ApiClient.Authentication;
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace PoGo.Tests.ApiClient
{
[TestClass]
public class PtcLoginTests
{
[TestMethod]
public async Task PtcLogin_GetLoginParameters()
{
var ptcLogin = new PtcAuthenticationProvider("testuser", "testpass");
var loginData = await ptcLogin.GetLoginParameters().ConfigureAwait(false);
Assert.IsNotNull(loginData);
Assert.IsTrue(string.IsNullOrWhiteSpace(loginData.Lt));
Assert.IsTrue(string.IsNullOrWhiteSpace(loginData.Execution));
//loginData.Should().NotBeNull();
//loginData.Lt.Should().NotBeNullOrWhiteSpace();
//loginData.Execution.Should().NotBeNullOrWhiteSpace();
}
}
}
|
{
"content_hash": "4eab8113075eb04cbaa16fd90f115a53",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 86,
"avg_line_length": 27.057142857142857,
"alnum_prop": 0.6810982048574445,
"repo_name": "PoGo-Devs/PoGo",
"id": "2d79914f7514a7f6bb8cd20e1eed7ec3a590221d",
"size": "949",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/PoGo.Tests.ApiClient/PtcLoginTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "3126013"
}
],
"symlink_target": ""
}
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mil.navy.med.dzreg.service;
import javax.jws.WebService;
/**
*
* @author nhin
*/
@WebService(serviceName = "RegistriesService", portName = "RegistriesServicePort", endpointInterface = "mil.navy.med.dzreg.service.RegistriesServicePortType", targetNamespace = "urn:mil:navy:med:dzreg:service", wsdlLocation = "WEB-INF/wsdl/RegistriesService.wsdl")
public class RegistriesWS {
public mil.navy.med.dzreg.types.PersonRegistryProfileResponseType getRegistryProfile(mil.navy.med.dzreg.types.PersonRegistryProfileRequestType parameters) {
return new RegistriesServiceImpl().getRegistryProfile(parameters);
}
public mil.navy.med.dzreg.types.AckType register(mil.navy.med.dzreg.types.RegisterPersonRequestType parameters) {
return new RegistriesServiceImpl().register(parameters);
}
public mil.navy.med.dzreg.types.AckType unregister(mil.navy.med.dzreg.types.RegisterPersonRequestType parameters) {
return new RegistriesServiceImpl().unregister(parameters);
}
}
|
{
"content_hash": "4b823ee8644a07dd277a480adc5c2eb2",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 264,
"avg_line_length": 37.43333333333333,
"alnum_prop": 0.7640249332146037,
"repo_name": "TATRC/KMR2",
"id": "ea6639288ee2f078e77fc64cd81afe04e59de23f",
"size": "2772",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Services/RegistriesService/src/main/java/mil/navy/med/dzreg/service/RegistriesWS.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "3767453"
},
{
"name": "JavaScript",
"bytes": "2184689"
}
],
"symlink_target": ""
}
|
"use strict";
var constants = require(__dirname + "/constants"); //TODO: remove this (dependency: Fish)
function Fish(x, y, rotation) { var that=this; that.init(x, y, rotation); }
Fish.prototype = {
constructor: Fish,
params : constants.fish,
init: function(x, y, rotation) {
var that=this;
that.x = x || 0;
that.y = y || 0;
that.rotation = rotation || 0;
that.ticks = 0;
that.pickTarget();
// document.addEventListener('mousemove', function (e) {
// that.targetX = e.pageX;
// that.targetY = e.pageY;
// });
},
pickTarget : function() {
var that=this;
that.targetX = Math.random()*constants.screenWidth;
that.targetY = Math.random()*constants.screenHeight;
},
rotate : function(x, y) {
var that=this;
var targetRotation = that.targetRotation = Math.atan2(y - that.y, x - that.x);
if(that.rotation < targetRotation) {
that.rotation = (that.rotation + 0.05);
} else {
that.rotation = (that.rotation - 0.05);
}
},
update: function() {
var that=this;
that.ticks++; //Increment our internal clock.
//AI - some abstraction to come later.
if(that.ticks >= 200) {
that.ticks -= 200;
that.pickTarget();
}
that.rotate(that.targetX, that.targetY);
//Motion: Should be handled by World.
that.x += Math.cos(that.rotation)*that.params.minSpeed;
that.y += Math.sin(that.rotation)*that.params.minSpeed;
}
}
function World(options) { var that=this; that.init(options); }
World.prototype = {
constructor: World,
init: function(options) {
var that=this;
that.fish = [];
for(let i=options.numberOfFish-1;i>=0;i--) {
let positionX = Math.random()*700;//options.screenWidth;
let positionY = Math.random()*700;//options.screenHeight;
let rotation = Math.random()*2*Math.PI;
that.fish.push(new Fish(positionX, positionY, rotation));
}
},
update: function() {
var that=this;
for(let i=that.fish.length-1;i>=0;i--) {
let fish = that.fish[i];
fish.update();
}
}
};
/**
* Used for outputting world information to the screen.
* @param {DOM} target - Canvas to draw to
* @method Display
* @constructor
*/
function Display(target) { var that=this; that.init(target); }
Display.prototype = {
constructor: Display,
init: function(target) {
var that=this;
that.canvas = target;
that.context = that.canvas.getContext("2d");
},
/**
* Take a world and render it to the screen.
* @param {World} world
* @method render
*/
render: function(world) {
var that=this;
var fishes = world.fish;
that.context.clearRect(0, 0, that.canvas.width, that.canvas.height);
for(let i=fishes.length-1;i>=0;i--) {
let fish = fishes[i];
that.context.save();
that.context.lineWidth=5;
that.context.translate(fish.x, fish.y);
that.context.rotate(fish.rotation);
let path = new Path2D();
path.moveTo(-20, -10);
path.lineTo(0, 0);
path.lineTo(-20, 10);
that.context.stroke(path);
that.context.restore();
that.context.fillRect(fish.targetX, fish.targetY, 5, 5);
}
}
};
function Aquarium(constants) { var that=this; that.init(constants); }
Aquarium.prototype = {
constructor: Aquarium,
init: function(constants) {
var that=this;
that.world = new World(constants);
that.displays = [];
that.step = that.step.bind(that); //for preserving context with requestAnimationFrame
},
start: function() {
var that=this;
that.step();
},
step: function(timestep) {
var that=this;
that.world.update();
for(let i=that.displays.length-1;i>=0;i--) {
that.displays[i].render(that.world);
}
window.setTimeout(that.step, 1000/60); //There's no reason to use requestAnimationFrame here.
},
addTarget: function(target) {
var that=this;
that.displays.push(new Display(target));
},
}
module.exports = Aquarium;
|
{
"content_hash": "ca586130074b979bd00425a52a68d3bd",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 101,
"avg_line_length": 28.127388535031848,
"alnum_prop": 0.561141304347826,
"repo_name": "danShumway/aquarium",
"id": "b5829247d7ffde0dd5866238ede89f5ac18cc99f",
"size": "4416",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/aquarium.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "343"
},
{
"name": "JavaScript",
"bytes": "5035"
}
],
"symlink_target": ""
}
|
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>dataproc-metastore-install-without-bom</artifactId>
<packaging>jar</packaging>
<name>Google Dataproc Metastore Install Without Bom</name>
<url>https://github.com/googleapis/java-dataproc-metastore</url>
<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.2.0</version>
</parent>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- [START dataproc-metastore_install_without_bom] -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-dataproc-metastore</artifactId>
<version>2.4.4</version>
</dependency>
<!-- [END dataproc-metastore_install_without_bom] -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<version>1.1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- compile and run all snippet tests -->
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>add-snippets-source</id>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>../snippets/src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-snippets-tests</id>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>../snippets/src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
|
{
"content_hash": "95b6c7d24abfb7197b857702b8468256",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 204,
"avg_line_length": 32.54761904761905,
"alnum_prop": 0.6100950987564009,
"repo_name": "googleapis/java-dataproc-metastore",
"id": "981db1f369681dd74c4ca6d76e98fe8116acaa1d",
"size": "2734",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "samples/install-without-bom/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "801"
},
{
"name": "Java",
"bytes": "7152872"
},
{
"name": "Python",
"bytes": "788"
},
{
"name": "Shell",
"bytes": "20477"
}
],
"symlink_target": ""
}
|
cask 'fork' do
version '1.0.78.1'
sha256 '689835f65d7513a7f4d11903c97bcc088473170140edfdd5a065c40999c0b21f'
# forkapp.ams3.cdn.digitaloceanspaces.com/mac was verified as official when first introduced to the cask
url "https://forkapp.ams3.cdn.digitaloceanspaces.com/mac/Fork-#{version}.dmg"
appcast 'https://git-fork.com/update/feed.xml'
name 'Fork'
homepage 'https://git-fork.com/'
auto_updates true
app 'Fork.app'
binary "#{appdir}/Fork.app/Contents/Resources/fork_cli", target: 'fork'
zap trash: [
'~/Library/Application Support/com.DanPristupov.Fork',
'~/Library/Caches/com.DanPristupov.Fork',
'~/Library/Preferences/com.DanPristupov.Fork.plist',
'~/Library/Saved Application State/com.DanPristupov.Fork.savedState',
]
end
|
{
"content_hash": "d3c4a54e06ab05e9333bc9cfabfcfd28",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 106,
"avg_line_length": 37.54545454545455,
"alnum_prop": 0.6888619854721549,
"repo_name": "josa42/homebrew-cask",
"id": "4fbec13a99f14a7a030d24a032afc367d69830ca",
"size": "826",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Casks/fork.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Dockerfile",
"bytes": "778"
},
{
"name": "HCL",
"bytes": "1658"
},
{
"name": "Python",
"bytes": "3252"
},
{
"name": "Ruby",
"bytes": "2256245"
},
{
"name": "Shell",
"bytes": "37698"
}
],
"symlink_target": ""
}
|
module Qboard
class Users
attr_reader :client
def initialize(client)
@client = client
end
def all
response = client.get('/users.json')
end
def find(user_id)
response = client.get("/users/#{user_id}.json")
end
end
end
|
{
"content_hash": "2a0d32fdd93425e15022715117d048a5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 53,
"avg_line_length": 15,
"alnum_prop": 0.5962962962962963,
"repo_name": "tylerpearson/qboard-ruby-client",
"id": "42a84ed3ce2cabb348725f4c8753465550a9ff0d",
"size": "270",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/qboard/users.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "6194"
},
{
"name": "Shell",
"bytes": "115"
}
],
"symlink_target": ""
}
|
package com.amazonaws.mturk.addon;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.amazonaws.mturk.dataschema.QuestionFormAnswers;
import com.amazonaws.mturk.dataschema.QuestionFormAnswersType;
import com.amazonaws.mturk.requester.Assignment;
import com.amazonaws.mturk.requester.AssignmentStatus;
import com.amazonaws.mturk.requester.HIT;
import com.amazonaws.mturk.service.axis.RequesterService;
import com.amazonaws.mturk.util.ClientConfig;
/**
* The HITResults class provides a way to hold Assignment results for a particular HIT.
*/
public class HITResults
{
public static final String NO_ANSWER = "none";
public static final String EMPTY_ANSWER = "emptyanswer";
public static final String EMPTY = "";
public static final char DELIMITER = '\t';
public static final String MULTI_ANSWER_DELIMITER = "|";
private HIT hit;
private Assignment[] assignments;
protected ClientConfig config;
private static Assignment[] NO_ASSIGNMENTS = new Assignment[] { new Assignment() };
private final String EXCEL_COMPLIANT_DATE_FORMAT = "EEE MMM dd HH:mm:ss zzz yyyy";
private final SimpleDateFormat DATE_FORMATTER =
new SimpleDateFormat(EXCEL_COMPLIANT_DATE_FORMAT);
public HITResults(HIT hit, Assignment[] assignments, ClientConfig config) {
this.hit = hit;
this.assignments = assignments;
this.config = config;
}
public HIT getHIT() {
return this.hit;
}
public Assignment[] getAssignments() {
return this.assignments;
}
public void writeResults(HITDataOutput writer) throws IOException {
Map<String,String> hitResults = this.getHITResults();
Map<String,String> assignmentResults;
if (assignments == null || assignments.length == 0) {
assignments = NO_ASSIGNMENTS; // Feature 1826272 (output empty assignment data even when HIT has no assignments)
}
for (Assignment assignment : this.assignments) {
assignmentResults = this.getAssignmentResults(assignment);
assignmentResults.putAll( hitResults );
writer.writeValues( assignmentResults ); // append
}
}
public Map<String,String> getHITResults() {
// Add standard HIT results
Map<String,String> results = new HashMap<String,String>( HITTypeResults.HIT_HEADERS.length );
results.put( HITProperties.HITField.HitId.getFieldName(), hit.getHITId());
results.put( HITProperties.HITField.HitTypeId.getFieldName(), hit.getHITTypeId());
results.put( HITProperties.HITField.Title.getFieldName(), hit.getTitle());
results.put( HITProperties.HITField.Description.getFieldName(), hit.getDescription());
results.put( HITProperties.HITField.Keywords.getFieldName(), hit.getKeywords());
results.put( HITProperties.HITField.Reward.getFieldName(), hit.getReward().getFormattedPrice());
String creationTime = DATE_FORMATTER.format(hit.getCreationTime().getTime());
results.put( HITProperties.HITField.CreationTime.getFieldName(), creationTime);
results.put( HITProperties.HITField.MaxAssignments.getFieldName(),
hit.getMaxAssignments().toString());
results.put( HITProperties.HITField.NumAvailableAssignments.getFieldName(),
hit.getNumberOfAssignmentsAvailable().toString());
results.put( HITProperties.HITField.NumPendingAssignments.getFieldName(),
hit.getNumberOfAssignmentsPending().toString());
results.put( HITProperties.HITField.NumCompletedAssignments.getFieldName(),
hit.getNumberOfAssignmentsCompleted().toString());
String status = hit.getHITStatus() != null ? hit.getHITStatus().getValue() : "";
results.put( HITProperties.HITField.Status.getFieldName(), status);
String reviewStatus = hit.getHITReviewStatus() != null
? hit.getHITReviewStatus().getValue() : "";
results.put( HITProperties.HITField.ReviewStatus.getFieldName(), reviewStatus);
results.put( HITProperties.HITField.Annotation.getFieldName(), hit.getRequesterAnnotation());
results.put( HITProperties.HITField.AssignmentDuration.getFieldName(),
hit.getAssignmentDurationInSeconds().toString());
results.put( HITProperties.HITField.AutoApprovalDelay.getFieldName(),
hit.getAutoApprovalDelayInSeconds().toString());
results.put( HITProperties.HITField.Lifetime.getFieldName(),
DATE_FORMATTER.format(hit.getExpiration().getTime()));
String viewHITUrl = this.config.getRequesterWebsiteURL() + "/mturk/manageHIT?HITId=" + hit.getHITId() ;
results.put( HITProperties.HITField.ViewHITUrl.getFieldName(), viewHITUrl);
return results;
}
public Map<String,String> getAssignmentResults(Assignment assignment) {
// Add standard Assignment results
Map<String,String> results = new LinkedHashMap<String,String>( HITTypeResults.ASSIGNMENT_HEADERS.length );
results.put( HITProperties.AssignmentField.AssignmentId.getFieldName(), assignment.getAssignmentId());
results.put( HITProperties.AssignmentField.WorkerId.getFieldName(), assignment.getWorkerId());
AssignmentStatus status = assignment.getAssignmentStatus();
String statusStr = status != null ? status.getValue() : EMPTY;
results.put( HITProperties.AssignmentField.Status.getFieldName(), statusStr);
String autoApprovalTime = assignment.getAutoApprovalTime() != null ?
DATE_FORMATTER.format(assignment.getAutoApprovalTime().getTime()) : EMPTY;
results.put( HITProperties.AssignmentField.AutoApprovalTime.getFieldName(), autoApprovalTime);
String acceptTime = assignment.getAcceptTime() != null ?
DATE_FORMATTER.format(assignment.getAcceptTime().getTime()) : EMPTY;
results.put( HITProperties.AssignmentField.AcceptTime.getFieldName(), acceptTime);
String submitTime = assignment.getSubmitTime() != null ?
DATE_FORMATTER.format(assignment.getSubmitTime().getTime()) : EMPTY;
results.put( HITProperties.AssignmentField.SubmitTime.getFieldName(), submitTime);
String approvalTime = assignment.getApprovalTime() != null ?
DATE_FORMATTER.format(assignment.getApprovalTime().getTime()) : EMPTY;
results.put( HITProperties.AssignmentField.ApprovalTime.getFieldName(), approvalTime);
String rejectionTime = assignment.getRejectionTime() != null ?
DATE_FORMATTER.format(assignment.getRejectionTime().getTime()) : EMPTY;
results.put( HITProperties.AssignmentField.RejectionTime.getFieldName(), rejectionTime);
String deadline = assignment.getDeadline() != null ?
DATE_FORMATTER.format(assignment.getDeadline().getTime()) : EMPTY;
results.put( HITProperties.AssignmentField.Deadline.getFieldName(), deadline);
String requesterFeedback = assignment.getRequesterFeedback() != null ?
assignment.getRequesterFeedback() : EMPTY;
results.put( HITProperties.AssignmentField.RequesterFeedback.getFieldName(), requesterFeedback);
String rejectFlag = status != null && status == AssignmentStatus.Rejected ? "y" : EMPTY;
results.put( HITProperties.AssignmentField.RejectFlag.getFieldName(), rejectFlag);
// Add Assignment-specific answers
String answers = this.getAnswers(assignment);
results.put( HITProperties.AssignmentField.Answers.getFieldName(), answers);
return results;
}
@SuppressWarnings("unchecked")
private String getAnswers(Assignment assignment) {
String result = EMPTY;
AssignmentStatus status = assignment.getAssignmentStatus();
if (status == null) {
return NO_ANSWER;
}
String answerXML = assignment.getAnswer();
QuestionFormAnswers qfa = RequesterService.parseAnswers(answerXML);
List<QuestionFormAnswersType.AnswerType> answers =
(List<QuestionFormAnswersType.AnswerType>) qfa.getAnswer();
for (QuestionFormAnswersType.AnswerType answer : answers) {
String assignmentId = assignment.getAssignmentId();
String answerValue = RequesterService.getAnswerValue(assignmentId, answer, true);
if (answerValue != null) {
result += answerValue + DELIMITER;
}
}
return result;
}
}
|
{
"content_hash": "b754343f802a37ab69b33e91402cdbb1",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 122,
"avg_line_length": 42.55329949238579,
"alnum_prop": 0.7214600978170106,
"repo_name": "spinn3r/mturksdk-java-code-maven",
"id": "b260cb8ca368d706cfcbcabc8064d44f0eb2cdbf",
"size": "8907",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/com/amazonaws/mturk/addon/HITResults.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "378818"
},
{
"name": "Shell",
"bytes": "1436"
},
{
"name": "XSLT",
"bytes": "67554"
}
],
"symlink_target": ""
}
|
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Eval_ extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs an eval() node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
function getType() : string {
return 'Expr_Eval';
}
}
|
{
"content_hash": "ea76c3b202f65fcf2514e4a135f84244",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 69,
"avg_line_length": 20.8,
"alnum_prop": 0.5769230769230769,
"repo_name": "cwi-swat/PHP-Parser",
"id": "ada8e958523ad517a457427b9a18b718b1a9f2a0",
"size": "624",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/PhpParser/Node/Expr/Eval_.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "1214483"
},
{
"name": "Shell",
"bytes": "223"
},
{
"name": "Yacc",
"bytes": "99128"
}
],
"symlink_target": ""
}
|
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!DOCTYPE cxxClass PUBLIC "-//NOKIA//DTD DITA C++ API Class Reference Type v0.5.0//EN" "dtd/cxxClass.dtd" >
<cxxClass id="class_messages_1_1_t_e_peer">
<apiName>Messages::TEPeer</apiName>
<cxxClassDetail>
<cxxClassDefinition>
<cxxClassAccessSpecifier value="public"/>
<cxxClassDerivations>
<cxxClassDerivation>
<cxxClassDerivationAccessSpecifier value="public"/>
<cxxClassBaseClass href="class_messages_1_1_t_e_base.xml#class_messages_1_1_t_e_base">Messages::TEBase</cxxClassBaseClass>
</cxxClassDerivation>
</cxxClassDerivations>
<cxxClassAPIItemLocation>
<cxxClassDeclarationFile name="filePath" value="K:/epoc32/include/elements/nm_messages_peer.h"/>
<cxxClassDeclarationFileLine name="lineNumber" value="35"/>
<cxxClassDefinitionFile name="filePath" value="K:/epoc32/include/elements/nm_messages_peer.h"/>
<cxxClassDefinitionFileLineStart name="lineNumber" value="34"/>
<cxxClassDefinitionFileLineEnd name="lineNumber" value="72"/>
</cxxClassAPIItemLocation>
</cxxClassDefinition>
<apiDesc/>
</cxxClassDetail>
<cxxEnumeration id="class_messages_1_1_t_e_peer_1a418c3848c5589f0ef6a4022573748611">
<apiName>@96</apiName>
<cxxEnumerationDetail>
<cxxEnumerationDefinition>
<cxxEnumerationAccessSpecifier value="private"/>
<cxxEnumerationScopedName>Messages::TEPeer</cxxEnumerationScopedName>
<cxxEnumerationPrototype>@96</cxxEnumerationPrototype>
<cxxEnumerationNameLookup>Messages::TEPeer:@96</cxxEnumerationNameLookup>
<cxxEnumerators>
<cxxEnumerator id="class_messages_1_1_t_e_peer_1a418c3848c5589f0ef6a4022573748611a2cbd04374f69485cf95c648e7ba9a8f5">
<apiName>ELeaveRequest</apiName>
<cxxEnumeratorScopedName>Messages::TEPeer</cxxEnumeratorScopedName>
<cxxEnumeratorPrototype>ELeaveRequest = 1</cxxEnumeratorPrototype>
<cxxEnumeratorNameLookup>Messages::TEPeer::ELeaveRequest</cxxEnumeratorNameLookup>
<cxxEnumeratorInitialiser value="1"/>
<cxxEnumeratorAPIItemLocation>
<cxxEnumeratorDeclarationFile name="filePath" value="K:/epoc32/include/elements/nm_messages_peer.h"/>
<cxxEnumeratorDeclarationFileLine name="lineNumber" value="41"/>
</cxxEnumeratorAPIItemLocation>
<apiDesc/>
</cxxEnumerator>
<cxxEnumerator id="class_messages_1_1_t_e_peer_1a418c3848c5589f0ef6a4022573748611ab344090efbfb36ee4e8f5337a7e037f6">
<apiName>ELeaveComplete</apiName>
<cxxEnumeratorScopedName>Messages::TEPeer</cxxEnumeratorScopedName>
<cxxEnumeratorPrototype>ELeaveComplete = 2</cxxEnumeratorPrototype>
<cxxEnumeratorNameLookup>Messages::TEPeer::ELeaveComplete</cxxEnumeratorNameLookup>
<cxxEnumeratorInitialiser value="2"/>
<cxxEnumeratorAPIItemLocation>
<cxxEnumeratorDeclarationFile name="filePath" value="K:/epoc32/include/elements/nm_messages_peer.h"/>
<cxxEnumeratorDeclarationFileLine name="lineNumber" value="42"/>
</cxxEnumeratorAPIItemLocation>
<apiDesc/>
</cxxEnumerator>
</cxxEnumerators>
<cxxEnumerationAPIItemLocation>
<cxxEnumerationDeclarationFile name="filePath" value="K:/epoc32/include/elements/nm_messages_peer.h"/>
<cxxEnumerationDeclarationFileLine name="lineNumber" value="40"/>
<cxxEnumerationDefinitionFile name="filePath" value="K:/sf/os/commsfw/datacommsserver/esockserver/csock/cs_connectionserv.cpp"/>
<cxxEnumerationDefinitionFileLineStart name="lineNumber" value="39"/>
<cxxEnumerationDefinitionFileLineEnd name="lineNumber" value="43"/>
</cxxEnumerationAPIItemLocation>
</cxxEnumerationDefinition>
<apiDesc/>
</cxxEnumerationDetail>
</cxxEnumeration>
<cxxTypedef id="class_messages_1_1_t_e_peer_1ab6dc9e1420306ac884228ce5f08d6fde">
<apiName>TLeaveRequest</apiName>
<cxxTypedefDetail>
<cxxTypedefDefinition>
<cxxTypedefAccessSpecifier value="public"/>
<cxxTypedefDeclaredType>
<apiRelation href="struct_messages_1_1_t_message_sig_void.xml#struct_messages_1_1_t_message_sig_void">TMessageSigVoid</apiRelation>< ELeaveRequest, TEPeer::ERealmId ></cxxTypedefDeclaredType>
<cxxTypedefScopedName>Messages::TEPeer</cxxTypedefScopedName>
<cxxTypedefPrototype>TMessageSigVoid< ELeaveRequest, TEPeer::ERealmId > TLeaveRequest</cxxTypedefPrototype>
<cxxTypedefNameLookup>Messages::TEPeer::TLeaveRequest</cxxTypedefNameLookup>
<cxxTypedefAPIItemLocation>
<cxxTypedefDeclarationFile name="filePath" value="K:/epoc32/include/elements/nm_messages_peer.h"/>
<cxxTypedefDeclarationFileLine name="lineNumber" value="60"/>
</cxxTypedefAPIItemLocation>
</cxxTypedefDefinition>
<apiDesc/>
</cxxTypedefDetail>
</cxxTypedef>
<cxxTypedef id="class_messages_1_1_t_e_peer_1a93ecd22d9af1350b3d1cf2e775606f76">
<apiName>TLeaveComplete</apiName>
<cxxTypedefDetail>
<cxxTypedefDefinition>
<cxxTypedefAccessSpecifier value="public"/>
<cxxTypedefDeclaredType>
<apiRelation href="struct_messages_1_1_t_message_sig_void.xml#struct_messages_1_1_t_message_sig_void">TMessageSigVoid</apiRelation>< ELeaveComplete, TEPeer::ERealmId ></cxxTypedefDeclaredType>
<cxxTypedefScopedName>Messages::TEPeer</cxxTypedefScopedName>
<cxxTypedefPrototype>TMessageSigVoid< ELeaveComplete, TEPeer::ERealmId > TLeaveComplete</cxxTypedefPrototype>
<cxxTypedefNameLookup>Messages::TEPeer::TLeaveComplete</cxxTypedefNameLookup>
<cxxTypedefAPIItemLocation>
<cxxTypedefDeclarationFile name="filePath" value="K:/epoc32/include/elements/nm_messages_peer.h"/>
<cxxTypedefDeclarationFileLine name="lineNumber" value="70"/>
</cxxTypedefAPIItemLocation>
</cxxTypedefDefinition>
<apiDesc/>
</cxxTypedefDetail>
</cxxTypedef>
<cxxClassInherits>
<cxxClassInheritsDetail>
<cxxClassEnumerationInherited href="class_messages_1_1_t_e_peer.xml#class_messages_1_1_t_e_base_1a240ee0678b9e4f6eadff68541292d97c">Messages::TEBase:@72</cxxClassEnumerationInherited>
</cxxClassInheritsDetail>
</cxxClassInherits>
</cxxClass>
|
{
"content_hash": "8116f8db7e7c681f9d4e522e8063e3cc",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 203,
"avg_line_length": 54.981818181818184,
"alnum_prop": 0.7703373015873016,
"repo_name": "prio/cxxapiref",
"id": "60f7ad6d1e87f4b82f3f64f5a80ffc3746bfdb95",
"size": "6048",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/esock_dll/class_messages_1_1_t_e_peer.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "2834"
}
],
"symlink_target": ""
}
|
Desktop application timer built with the Electron framework
#Functionality
1. Shows the time
2. Reset time hour mark
|
{
"content_hash": "768dbc5e55a5b4140c233e9b1146bcbe",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 59,
"avg_line_length": 29.25,
"alnum_prop": 0.8205128205128205,
"repo_name": "Casepl/electron_timer",
"id": "a3c5a7ecb0d8e7e1ce8e842b16eb0b4e67b44f69",
"size": "161",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "787"
},
{
"name": "HTML",
"bytes": "814"
},
{
"name": "JavaScript",
"bytes": "20886"
},
{
"name": "Shell",
"bytes": "349"
}
],
"symlink_target": ""
}
|
create class test_class(col1 integer,
col2 set varchar(10) default{'golf','football'});
insert into test_class(col1) values(999);
select * from test_class;
select attr_name, class_name, default_value
from db_attribute
where class_name = 'test_class' order by 1;
drop class test_class;
|
{
"content_hash": "29e73c8fb8114c70fe451fcb6aa12b44",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 73,
"avg_line_length": 26.416666666666668,
"alnum_prop": 0.6813880126182965,
"repo_name": "CUBRID/cubrid-testcases",
"id": "cd9d1c9747ba7727e73aa5b4913b55bd82a134db",
"size": "384",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "sql/_01_object/_10_system_table/_004_db_attribute/cases/1008.sql",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PLSQL",
"bytes": "682246"
},
{
"name": "Roff",
"bytes": "23262735"
},
{
"name": "TSQL",
"bytes": "5619"
},
{
"name": "eC",
"bytes": "710"
}
],
"symlink_target": ""
}
|
---
uid: SolidEdgeConstants.PCFFilePermissions
summary:
remarks:
---
|
{
"content_hash": "3c385180d1084ae5ecc716e416479a22",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 42,
"avg_line_length": 14.4,
"alnum_prop": 0.7361111111111112,
"repo_name": "SolidEdgeCommunity/docs",
"id": "b323d0534d6d23857bf06abc03886a595ada6a13",
"size": "74",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docfx_project/apidoc/SolidEdgeConstants.PCFFilePermissions.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "38"
},
{
"name": "C#",
"bytes": "5048212"
},
{
"name": "C++",
"bytes": "2265"
},
{
"name": "CSS",
"bytes": "148"
},
{
"name": "PowerShell",
"bytes": "180"
},
{
"name": "Smalltalk",
"bytes": "1996"
},
{
"name": "Visual Basic",
"bytes": "10236277"
}
],
"symlink_target": ""
}
|
using System;
using System.Runtime.InteropServices;
using System.Threading;
namespace UnmanagedBefore
{
public class Sample : IDisposable
{
IntPtr handle;
public Sample()
{
handle = new IntPtr();
}
// ReSharper disable once UnusedMember.Local
void DisposeUnmanaged()
{
CloseHandle(handle);
handle = IntPtr.Zero;
}
[DllImport("kernel32.dll", SetLastError=true)]
static extern bool CloseHandle(IntPtr hObject);
public void Method()
{
//Some code
}
public void Dispose()
{
//must be empty
}
}
}
namespace UnmanagedAfter
{
public class Sample : IDisposable
{
IntPtr handle;
volatile int disposeSignaled;
bool disposed;
public Sample()
{
handle = new IntPtr();
}
void DisposeUnmanaged()
{
CloseHandle(handle);
handle = IntPtr.Zero;
}
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool CloseHandle(IntPtr handle);
public void Method()
{
ThrowIfDisposed();
//Some code
}
void ThrowIfDisposed()
{
if (disposed)
{
throw new ObjectDisposedException("TemplateClass");
}
}
public void Dispose()
{
if (Interlocked.Exchange(ref disposeSignaled, 1) != 0)
{
return;
}
DisposeUnmanaged();
GC.SuppressFinalize(this);
disposed = true;
}
~Sample()
{
Dispose();
}
}
}
|
{
"content_hash": "283c8548619da404462edfb9e67eb9e4",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 67,
"avg_line_length": 19.236559139784948,
"alnum_prop": 0.48518725544997204,
"repo_name": "Fody/Janitor",
"id": "3882db43a84df5946010b250b9e7121d93acc02e",
"size": "1791",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Template/Unmanaged/Sample.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "65254"
}
],
"symlink_target": ""
}
|
ACCEPTED
#### According to
NUB Generator [autonym]
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "501e1117ee16715644a4babb14160a9d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 23,
"avg_line_length": 9.076923076923077,
"alnum_prop": 0.6779661016949152,
"repo_name": "mdoering/backbone",
"id": "f8dd7f3811fd0302b0b4d37da63fd3d1e14f7ea0",
"size": "182",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Pinophyta/Pinopsida/Pinales/Pinaceae/Keteleeria/Keteleeria davidiana/Keteleeria davidiana davidiana/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
}
|
BOOST_AUTO_TEST_SUITE(scrypt_tests)
BOOST_AUTO_TEST_CASE(scrypt_hashtest)
{
// Test Scrypt hash with known inputs against expected outputs for all
// supported Nfactors, only goes up to N = 1048576 due to current 32 bit
// limit on nTime. Blocktime is packed in the pseudoheaders in inputhex
#define HASHCOUNT 50
const char* inputhex[HASHCOUNT] = {
""
};
const char* expected[HASHCOUNT] = {
""
};
uint256 scrypthash;
std::vector<unsigned char> inputbytes;
for (int i = 0; i < HASHCOUNT; i++) {
inputbytes = ParseHex(inputhex[i]);
unsigned int blocktime = *(unsigned int*)(&inputbytes[68]);
printf("%i\n", blocktime);
unsigned char Nfactor = GetNfactor(blocktime);
unsigned int scratchpad_size = 128 * (1 << (Nfactor+1)) + 512;
std::vector<char> scratchpad = std::vector<char>(scratchpad_size);
#if defined(USE_SSE2)
// Test SSE2 scrypt
scrypt_N_1_1_256_sp_sse2((const char*)&inputbytes[0],
BEGIN(scrypthash), &scratchpad[0],
Nfactor);
#endif
// Test generic scrypt
scrypt_N_1_1_256_sp_generic((const char*)&inputbytes[0],
BEGIN(scrypthash), &scratchpad[0],
Nfactor);
BOOST_CHECK_EQUAL(scrypthash.ToString().c_str(), expected[i]);
}
}
BOOST_AUTO_TEST_SUITE_END()
|
{
"content_hash": "858762399c12d2340b75872b2d62f21c",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 76,
"avg_line_length": 37.53846153846154,
"alnum_prop": 0.5758196721311475,
"repo_name": "spdcoin/Speedcoin",
"id": "d1be1f2d98093b31a2b4da6c67a2115041f8d067",
"size": "1558",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/test/scrypt_tests.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "32412"
},
{
"name": "C++",
"bytes": "2616700"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "HTML",
"bytes": "50615"
},
{
"name": "Makefile",
"bytes": "13723"
},
{
"name": "NSIS",
"bytes": "6503"
},
{
"name": "Objective-C",
"bytes": "1052"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "69723"
},
{
"name": "QMake",
"bytes": "15502"
},
{
"name": "Roff",
"bytes": "18420"
},
{
"name": "Shell",
"bytes": "16485"
}
],
"symlink_target": ""
}
|
<?php
/**
* Contains \jamesiarmes\PhpEws\Response\GetConversationItemsResponseType.
*/
namespace jamesiarmes\PhpEws\Response;
/**
* Defines a response to a GetConversationItems request.
*
* @package php-ews\Response
*/
class GetConversationItemsResponseType extends BaseResponseMessageType
{
}
|
{
"content_hash": "c18841b005e1cd39c6b7a3da8dd7ca48",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 18.9375,
"alnum_prop": 0.7788778877887789,
"repo_name": "Deakin/php-ews",
"id": "0cd81875530a5a93ef93e512eb3d0a4cde036af4",
"size": "303",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "src/Response/GetConversationItemsResponseType.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "818"
},
{
"name": "PHP",
"bytes": "1170771"
}
],
"symlink_target": ""
}
|
<div class="form main-form vcenter" ng-controller="AuthCtrl" ng-class="{'register-form' : global.registerForm}">
<div class="login-form__left" ui-view></div>
</div>
|
{
"content_hash": "3f913872a8780d60271e16232643172d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 112,
"avg_line_length": 56.333333333333336,
"alnum_prop": 0.6923076923076923,
"repo_name": "kalomj/Pollution",
"id": "11060fc526ee6a9577d39edb61ef85a889c4c02f",
"size": "169",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/custom/pollution/public/views/login/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "306991"
},
{
"name": "C++",
"bytes": "215751"
},
{
"name": "CSS",
"bytes": "201637"
},
{
"name": "DTrace",
"bytes": "12324"
},
{
"name": "Groff",
"bytes": "19312"
},
{
"name": "HTML",
"bytes": "53180"
},
{
"name": "JavaScript",
"bytes": "1085648"
},
{
"name": "Python",
"bytes": "3523"
},
{
"name": "Shell",
"bytes": "15787"
}
],
"symlink_target": ""
}
|
PDC data model for user management
|
{
"content_hash": "a1465ee03e24694c46e9e665483998f9",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 34,
"avg_line_length": 35,
"alnum_prop": 0.8285714285714286,
"repo_name": "uc-cdis/userdatamodel",
"id": "f7eb2a7e7506f07772e617ecf123e5230e1c2d81",
"size": "51",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "29523"
}
],
"symlink_target": ""
}
|
/* 01/12/2007 Bill Crawford - Implemented gray banners */
/* head tabs */
div.head-tabs {
background-image: url(../images/tab-bkg.gif);
}
/* head-tab table */
div.head-tabs table {
font-size: 9pt;
color: white;
margin-top: 0pt;
margin-bottom: 0pt;
background: transparent;
border: none;
position: relative;
/*top: 1px;*/
}
/* head-tab row */
div.head-tabs tr {
vertical-align: middle;
}
@media print {
div.head-tabs tr {
position: relative;
left: -2px;
}
}
/* head-tab sides */
td.tab-edge {
padding: 0px;
background-color: #FFFFFF;
}
@media print {
td.tab-edge {
visibility: hidden;
}
} /* @media print */
/* head-tab bodies */
td.tab {
padding-left: 1em;
padding-right: 1em;
padding-top: 0px;
padding-bottom: 0px;
background-image: url(../images/tab-bkg.gif);
cursor: hand;
vertical-align: middle;
}
@media print {
td.tab {
border: 2 solid #999;
background-image: none;
}
} /* @media print */
/* head-tab bodies, selected */
td.tab-active {
padding-left: 1em;
padding-right: 1em;
padding-top: 0px;
padding-bottom: 0px;
background-color: #FFFFFF;
cursor: default;
vertical-align: middle;
}
@media print {
td.tab-active {
border: 2 solid #038;
background-image: none;
}
} /* @media print */
/* head-tab bodies, dimmed */
td.tab-disabled {
padding-left: 1em;
padding-right: 1em;
padding-top: 0px;
padding-bottom: 0px;
background-image: url(../images/tab-bkg-o.gif);
cursor: default;
vertical-align: middle;
}
/* head-tab text */
td.tab span {
color: white;
width: 100%;
padding: 0px;
}
@media print {
td.tab span {
color: #999;
}
} /* @media print */
/* head-tab text, selected */
td.tab-active span {
color: #000000;
font-weight: bold;
padding: 0px;
position: relative;
top: 0px;
}
/* head-tab text, dimmed */
td.tab-disabled span {
width: 100%;
color: #666;
position: relative;
top: 0px;
visibility: hidden;
}
/* head-region bottom margin */
div.head-margin {
line-height: 0pt;
padding-bottom: 6pt;
}
div.see-also {
margin-top: 18pt;
padding-top: 2pt;
border-top: 1 solid #449;
}
span.see-also {
color: #338;
font-weight: bold;
}
div.topic-list {
padding-top: 0;
margin-top: 0;
padding-bottom: 0;
margin-bottom: 0;
}
.topiclist-litem {
margin-bottom: 6pt;
}
/* data table */
/* also used in dialog box topics */
table.ref-data {
margin-top: 0;
margin-bottom: 0;
border: none;
font-size: 9pt;
border: none;
}
/* data table td */
table.ref-data td {
padding-left: 0;
padding-bottom: 12pt;
}
/* TABLES */
TABLE.Plain
{background-color: transparent;
color: black;
border-bottom: none;
font-family: Verdana;
font-size: 9pt;
line-height: 12pt;
margin-bottom: 0pt;
margin-top: 0pt;
text-align: left}
TD.Plain
{color: black;
padding-bottom: 0pt;
padding-left: 0pt;
padding-right: 0pt;
padding-top: 0pt;
vertical-align: baseline}
.qrEntryHeadTitle, .qrEntryTitle, .qrTitle
{
font-size:9pt;
padding: 3pt 2pt 3pt 2pt;
margin-top: 5pt;
margin-bottom: 5pt;
}
.qrEntryHeadTitle, .qrEntryTitle
{
font-weight:bold;
color:white;
}
.qrEntryHeadTitle, .qrEntryTitle, .qrEntryValue
{
padding-left: 7pt;
}
.qrEntryValue
{
font-size:9pt;
}
a.qrItemLink
{
display: none;
color: #333399;
text-decoration:none;
}
.qrEntryHeadTitle
{
background-color: #3366AA;
}
.qrEntryTitle
{
background-color: #6699CC;
}
.qrTitle
{
display: none;
color:#993333;
background-color: #FFAA66;
vertical-align: middle;
text-align : center;
}
div.qrItem
{
}
div.qrentryheadtitle {
background-color: #35a;
}
div.qrentrytitle {
background-color: transparent;
color: #038;
font-size: 10pt;
padding-left: 0;
padding-bottom: 0;
margin-bottom: 0;
margin-top: 8pt;
}
div.qrentryvalue {
padding-left: 0;
padding-top: 0;
margin-top: 4pt;
}
div.qrentryvalue img.qricon {
margin-top: 4;
}
table.ref-data td {
width: 0;
}
table.ref-data {
border: none;
}
hr.qr-line1
{
display: none;
height:3px;
color:#FFAA66;
}
hr.qr-line2
{
display: none;
height:3px;
color:#3366AA;
}
/* collapsible */
div.collapsible {
margin-top: 10pt;
margin-bottom: 5pt;
}
img.collapsible {
cursor: hand;
}
div.collapsible-section {
}
span.collapsible-section-title {
color: #027;
font-family: Verdana;
font-size: 10pt;
font-weight: bold;
padding-left: 5;
cursor: hand;
}
/*******************************************************************************/
/* Definition Lists */
/* */
/*******************************************************************************/
/* definition list */
table.dl {
font-size: 10pt;
}
/* in a definition list, a term-definition pair */
tr.dl-pair {
}
td.term {
width: 100pt;
vertical-align: baseline;
padding-left: 0;
padding-right: 12pt;
}
td.definiton {
vertical-align: baseline;
padding: 0;
}
/* Civil 3D quick reference sections */
div.section {
margin-top: 12pt;
}
span.term {
font-size: 10pt;
font-weight: bold;
color: #36c;
}
div.definition {
margin-bottom: 10pt;
}
div.definition p {
margin-top: 4pt;
}
div.definition ul {
margin-top: 0pt;
}
div.definition li {
margin-top: 4pt;
}
/*******************************************************************************/
/* Links */
/* */
/*******************************************************************************/
/* definition links (glossary links) */
span.term a {
color: green; /* 'green' = #070 */
text-decoration: none;
border-bottom: 1px dotted green;
}
/* definition links */
span.term a:visited {
color: green;
}
/*******************************************************************************/
/* Tables */
/* */
/*******************************************************************************/
p.table-title {
font-weight: bold;
color: #338;
}
/* Ruled Tables */
table.ruled {
font-size: 1em;
line-height: 1.3em;
width: 100%;
margin-top: 1.4em;
margin-bottom: 1.4em;
border-bottom: 3px solid #3D3D3D;
border-top: 4px solid #3D3D3D;
background-color: #F2F2F2;
}
table.ruled-wide {
font-size: 1em;
line-height: 1.3em;
width: 100%;
margin-top: 1.4em;
margin-bottom: 1.4em;
border-bottom: 3px solid #3D3D3D;
border-top: 4px solid #3D3D3D;
background-color: #F2F2F2;
}
table.ruled th {
color: white;
background-color: #3D3D3D;
padding-left: 10pt;
padding-right: 10pt;
padding-top: 3px;
padding-bottom: 8px;
vertical-align: center;
}
table.ruled-wide th {
color: white;
background-color: #3D3D3D;
padding-left: 10pt;
padding-right: 10pt;
padding-top: 3px;
padding-bottom: 8px;
vertical-align: center;
}
table.ruled td {
padding-left: 10pt;
padding-right: 10pt;
padding-top: 4pt;
padding-bottom: 5pt;
border-bottom: 1px solid #3D3D3D;
vertical-align: baseline;
}
table.ruled-wide td {
padding-left: 10pt;
padding-right: 10pt;
padding-top: 4pt;
padding-bottom: 5pt;
border-bottom: 1px solid #3D3D3D;
vertical-align: baseline;
}
/* Unruled Tables */
table.not-ruled, table.not-ruled-wide {
font-size: 1em;
line-height: 1.3em;
width: 0;
margin-top: 1em;
margin-bottom: 1em;
}
table.not-ruled th, table.not-ruled-wide th {
color: #338;
padding-right: 20pt;
padding-top: 4pt;
padding-bottom: 2pt;
vertical-align: text-bottom;
}
table.not-ruled td, table.not-ruled-wide td {
padding-left: 0;
padding-right: 20pt;
padding-top: 2pt;
padding-bottom: 2pt;
vertical-align: baseline;
}
/* tables in list elements */
li table.ruled, li table.ruled-wide, li table.not-ruled, li table.not-ruled-wide {
width: 0;
}
/* paras within tables */
table.ruled p, table.ruled-wide p, table.not-ruled p, table.not-ruled-wide p {
margin-top: 2pt;
margin-bottom: 2pt;
}
/* div.note_xx within tables */
table.ruled div.note-note,
table.ruled-wide div.note-note,
table.not-ruled div.note-note,
table.not-ruled-wide div.note-note {
margin-top: 2pt;
margin-bottom: 2pt;
}
/* ul's within tables */
table.ruled ul, table.ruled-wide ul, table.not-ruled ul, table.not-ruled-wide ul {
margin-top: 2pt;
margin-bottom: 2pt;
}
/* ol's within tables */
table.ruled ol, table.ruled-wide ol, table.not-ruled ol, table.not-ruled-wide ol {
margin-top: 2pt;
margin-bottom: 2pt;
}
/* li's within tables */
table.ruled li, table.ruled-wide li, table.not-ruled li, table.not-ruled-wide li {
margin-top: 0;
margin-bottom: 2pt;
}
@media print {
table.ruled-wide th.table-heading {
color: #3D3D3D;
background-color: transparent;
padding-top: 4pt;
border-bottom: 4 solid #3D3D3D;
}
} /* @media print */
|
{
"content_hash": "ed856396f9dc8eca574f196bbd3b2e25",
"timestamp": "",
"source": "github",
"line_count": 540,
"max_line_length": 82,
"avg_line_length": 16.387037037037036,
"alnum_prop": 0.601762911063397,
"repo_name": "jumpinjackie/mapguide4j",
"id": "a5fd147e419868d2d820532bbdd072e827d08876",
"size": "8849",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "internal/localized/help/en/style/isd.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "268401"
},
{
"name": "JavaScript",
"bytes": "391126"
},
{
"name": "PHP",
"bytes": "11141"
},
{
"name": "Scala",
"bytes": "755"
},
{
"name": "XSLT",
"bytes": "22812"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Loads a Typelib</title>
</head>
<body><div class="manualnavbar" style="text-align: center;">
<div class="prev" style="text-align: left; float: left;"><a href="function.com-isenum.html">com_isenum</a></div>
<div class="next" style="text-align: right; float: right;"><a href="function.com-load.html">com_load</a></div>
<div class="up"><a href="ref.com.html">COM Functions</a></div>
<div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.com-load-typelib" class="refentry">
<div class="refnamediv">
<h1 class="refname">com_load_typelib</h1>
<p class="verinfo">(PHP 4 >= 4.1.0, PHP 5)</p><p class="refpurpose"><span class="refname">com_load_typelib</span> — <span class="dc-title">Loads a Typelib</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.com-load-typelib-description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">bool</span> <span class="methodname"><strong>com_load_typelib</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$typelib_name</code></span>
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$case_insensitive</code><span class="initializer"> = true</span></span>
] )</div>
<p class="para rdfs-comment">
Loads a type-library and registers its constants in the engine, as though
they were defined using <span class="function"><a href="function.define.html" class="function">define()</a></span>.
</p>
<p class="para">
Note that it is much more efficient to use the <a href="com.configuration.html#ini.com.typelib-file" class="xref"></a> configuration setting to pre-load and
register the constants, although not so flexible.
</p>
<p class="para">
If you have turned on <a href="com.configuration.html#ini.com.autoregister-typelib" class="xref"></a>, then
PHP will attempt to automatically register the constants associated with a
COM object when you instantiate it. This depends on the interfaces
provided by the COM object itself, and may not always be possible.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.com-load-typelib-parameters">
<h3 class="title">Parameters</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">typelib_name</code></dt>
<dd>
<p class="para">
<code class="parameter">typelib_name</code> can be one of the following:
<ul class="itemizedlist">
<li class="listitem">
<p class="para">
The filename of a <em>.tlb</em> file or the executable module
that contains the type library.
</p>
</li>
<li class="listitem">
<p class="para">
The type library GUID, followed by its version number, for example
<em>{00000200-0000-0010-8000-00AA006D2EA4},2,0</em>.
</p>
</li>
<li class="listitem">
<p class="para">
The type library name, e.g. <em>Microsoft OLE DB ActiveX Data
Objects 1.0 Library</em>.
</p>
</li>
</ul>
PHP will attempt to resolve the type library in this order, as the
process gets more and more expensive as you progress down the list;
searching for the type library by name is handled by physically
enumerating the registry until we find a match.
</p>
</dd>
<dt>
<code class="parameter">case_insensitive</code></dt>
<dd>
<p class="para">
The <code class="parameter">case_insensitive</code> behaves in the same way as
the parameter with the same name in the <span class="function"><a href="function.define.html" class="function">define()</a></span>
function.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.com-load-typelib-returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure.
</p>
</div>
</div><hr /><div class="manualnavbar" style="text-align: center;">
<div class="prev" style="text-align: left; float: left;"><a href="function.com-isenum.html">com_isenum</a></div>
<div class="next" style="text-align: right; float: right;"><a href="function.com-load.html">com_load</a></div>
<div class="up"><a href="ref.com.html">COM Functions</a></div>
<div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
|
{
"content_hash": "75debec92ba68c28869f6df2174cd997",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 176,
"avg_line_length": 41.44347826086957,
"alnum_prop": 0.6493915232899706,
"repo_name": "dpkshrma/phpdox",
"id": "387298fcec4896938e13df7cb7716ec7cf837020",
"size": "4766",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "functions/function.com-load-typelib.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "26553092"
},
{
"name": "PHP",
"bytes": "8567"
},
{
"name": "Shell",
"bytes": "286"
}
],
"symlink_target": ""
}
|
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.9.0.77
// SpecFlow Generator Version:1.9.0.0
// Runtime Version:4.0.30319.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
#pragma warning disable
namespace Calculator.AcceptanceTests
{
using TechTalk.SpecFlow;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("CalculatorTests")]
public partial class CalculatorTestsFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "CalculatorTests.feature"
#line hidden
[NUnit.Framework.TestFixtureSetUpAttribute()]
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "CalculatorTests", "In order to avoid silly mistakes\nAs a math idiot\nI want to be told the sum of two" +
" numbers", ProgrammingLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
[NUnit.Framework.TestFixtureTearDownAttribute()]
public virtual void FeatureTearDown()
{
testRunner.OnFeatureEnd();
testRunner = null;
}
[NUnit.Framework.SetUpAttribute()]
public virtual void TestInitialize()
{
}
[NUnit.Framework.TearDownAttribute()]
public virtual void ScenarioTearDown()
{
testRunner.OnScenarioEnd();
}
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
{
testRunner.OnScenarioStart(scenarioInfo);
}
public virtual void ScenarioCleanup()
{
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Add two numbers")]
public virtual void AddTwoNumbers()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Add two numbers", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
testRunner.Given("the calculator exe is running", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 8
testRunner.When("I enter 70", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 9
testRunner.And("I enter 30", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 10
testRunner.And("I enter +", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
#line 11
testRunner.Then("the result should be", "30 + 70 = 100\nStack: 100", ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Add three numbers")]
public virtual void AddThreeNumbers()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Add three numbers", ((string[])(null)));
#line 17
this.ScenarioSetup(scenarioInfo);
#line 18
testRunner.Given("the calculator exe is running", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 19
testRunner.When("I enter 70", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 20
testRunner.And("I enter 20", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 21
testRunner.And("I enter 50", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 22
testRunner.And("I enter +", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
#line 23
testRunner.Then("the result should be", "50 + 20 = 70\nStack: 70, 70", ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 28
testRunner.When("I enter +", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
#line 29
testRunner.Then("the result should be", "70 + 70 = 140\nStack: 140", ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
}
}
#pragma warning restore
#endregion
|
{
"content_hash": "90b13ce8ec48b613316b56ae17c0f8a6",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 243,
"avg_line_length": 39.421487603305785,
"alnum_prop": 0.6262054507337527,
"repo_name": "andygjp/CalculatorTesting",
"id": "56ab8fe0c9df1f686668abb9165145c7d7947dba",
"size": "4772",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Calculator.AcceptanceTests/CalculatorTests.feature.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "13722"
},
{
"name": "Cucumber",
"bytes": "573"
}
],
"symlink_target": ""
}
|
/***** < ivan *****/
#include <QNetworkProxy>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QDebug>
#include <stdlib.h>
#include <QList>
#include <QWebHitTestResult>
#include "terminal.h"
#include <QNetworkInterface>
#include <QFile>
#include <QRegExp>
#include <QWebPage>
#include <QHostInfo>
#include "net.h"
#include "phantom.h"
Net::Net(QObject *parent)
: QObject(parent)
{
setObjectName("Net");
m_timeout = 0;
m_timeoutTimer.setSingleShot(true);
connect(&m_timeoutTimer, SIGNAL(timeout()), SLOT(_timeoutTestFunction()));
m_net = new QNetworkAccessManager();
m_bypassProxy = true;
m_userAgent = QString();
}
QString Net::_fetchUrl(const QString &url, const QString &method, const QVariant &op)
{
QByteArray body;
QNetworkRequest request;
QVariantMap fileMapDownload, fileMapUpload;
QString fileEncoding = "auto";
bool
isFileUpload = false,
isFileDownload = false;
QNetworkProxy proxy = QNetworkProxy::applicationProxy();
if (m_bypassProxy) { // turn off proxy
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
}
qDebug() << "Net - _fetchUrl [" << url << "] as " << method << " request (file upload will use only POST (default) or PUT)";
if (op.type() == QVariant::Map) {
QVariantMap settingsMap = op.toMap();
if (settingsMap.contains("upload")) {
fileMapUpload = QVariantMap(settingsMap.value("upload").toMap());
if (fileMapUpload.contains("file") && fileMapUpload.contains("mime")) {
isFileUpload = true;
}
}
if (settingsMap.contains("download")) {
fileMapDownload = QVariantMap(settingsMap.value("download").toMap());
if (fileMapDownload.contains("file")) {
isFileDownload = true;
}
}
if (settingsMap.contains("fileEncoding")) {
fileEncoding = settingsMap.value("fileEncoding").toString().toLower();
}
QString bodyString = settingsMap.value("data").toString();
QString encoding = settingsMap.value("encoding").toString().toLower();
if (isFileUpload) {
qDebug() << "Net - Uploading file" << fileMapUpload.value("file").toString();
QFile file(fileMapUpload.value("file").toString());
if (!file.open(QIODevice::ReadOnly)){
qDebug() << "Net - QFile Error: File not found!";
m_fetchResult.clear();
m_fetchResult.insert("url", url);
m_fetchResult.insert("file", fileMapUpload.value("file").toString());
m_fetchResult.insert("error", "File not found!");
return "";
}
body.append(file.readAll());
file.close();
request.setRawHeader(QString("Content-Type").toLatin1(),fileMapUpload.value("mime").toString().toLatin1());
request.setRawHeader(QString("Content-Length").toLatin1(), QString::number(body.length()).toLatin1());
}
else {
body = encoding == "utf-8" || encoding == "utf8" ? bodyString.toUtf8() : bodyString.toLatin1();
}
if (settingsMap.contains("headers")) {
QMapIterator<QString, QVariant> i(settingsMap.value("headers").toMap());
while (i.hasNext()) {
i.next();
if (!isFileUpload || i.key().toUtf8() != "Content-Type" && i.key().toUtf8() != "Content-Length") { // ignore Content-Type and Content-Length for file upload
request.setRawHeader(i.key().toUtf8(), i.value().toString().toUtf8());
qDebug() << "Net - Adding header: " << i.key().toUtf8() << ": " << i.value().toString().toUtf8();
}
else {
qDebug() << "Net - Ignore header: " << i.key().toUtf8() << ": " << i.value().toString().toUtf8();
}
}
}
if (request.header(QNetworkRequest::UserAgentHeader).isNull() && !m_userAgent.isEmpty()) {
qDebug() << "Net - Using agent : " << m_userAgent;
request.setHeader(QNetworkRequest::UserAgentHeader, m_userAgent);
}
request.setUrl(url);
if (method == "POST" || (isFileUpload && method != "POST" && method != "PUT"))
m_reply = m_net->post(request, body);
else if (method == "PUT")
m_reply = m_net->put(request, body);
else if (method == "DELETE")
m_reply = m_net->deleteResource(request);
else if (method == "HEAD")
m_reply = m_net->head(request);
else
m_reply = m_net->get(request);
}
else
{
if (method == "DELETE")
m_reply = m_net->deleteResource(QNetworkRequest(QUrl(url)));
else
m_reply = m_net->get(QNetworkRequest(QUrl(url)));
}
if (Phantom::instance()->config()->ignoreSslErrors()) {
qDebug() << "Net - ignoreSslErrors";
//connect(m_reply, SIGNAL(sslErrors(const QList<QSslError> &)), m_reply, SLOT(ignoreSslErrors()));
m_reply->ignoreSslErrors();
}
// run timeout
if (m_timeout > 0) {
m_timeoutTimer.setInterval(m_timeout);
m_timeoutTimer.start();
qDebug() << "Net - fetch timeout is " << m_timeout;
}
if (isFileDownload) {
qDebug() << "Net - downloading to :" << fileMapDownload.value("file");
connect(m_reply, SIGNAL(finished()), &m_loop, SLOT(quit()));
connect(m_reply, SIGNAL(readyRead()), &m_loop, SLOT(quit()));
QFile file(fileMapDownload.value("file").toString());
file.open(QIODevice::WriteOnly);
while (true) {
bool finished = m_reply->isFinished();
//not working: m_reply->waitForReadyRead((m_timeout > 0) ? m_timeout : -1);
if (!finished) m_loop.exec();
QByteArray da = m_reply->readAll();
qDebug() << "Net - size read " << da.size();
if (da.size() == 0) {
break;
}
file.write(da);
if (finished) break;
}
file.close();
disconnect(m_reply, SIGNAL(finished()), &m_loop, SLOT(quit()));
disconnect(m_reply, SIGNAL(readyRead()), &m_loop, SLOT(quit()));
qDebug() << "Net - done downloading";
}
else {
//QTimer::singleShot(m_globalTimeout, this, SLOT(_globalTimeoutTestFunction()));
connect(m_reply, SIGNAL(finished()), &m_loop, SLOT(quit()));
m_loop.exec();
disconnect(m_reply, SIGNAL(finished()), &m_loop, SLOT(quit()));
m_timeoutTimer.stop();
}
if (m_bypassProxy) { // restore proxy
QNetworkProxy::setApplicationProxy(proxy);
}
m_fetchResult.clear();
QString originalUrl = m_reply->request().url().toString();
m_fetchResult.insert("url", originalUrl);
QString actualUrl = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl().toString();
if (actualUrl == "") {
m_fetchResult.insert("actualUrl", originalUrl);
}
else {
m_fetchResult.insert("actualUrl", resolveUrl(originalUrl, actualUrl));
}
m_fetchResult.insert("statusMessage", QString::fromUtf8(m_reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()));
m_fetchResult.insert("status", m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt());
switch (m_reply->error())
{
case QNetworkReply::NoError:
m_fetchResult.insert("error", 0);
break;
case QNetworkReply::ConnectionRefusedError:
m_fetchResult.insert("errorMessage", "ConnectionRefusedError");
m_fetchResult.insert("error", 1);
break;
case QNetworkReply::RemoteHostClosedError:
m_fetchResult.insert("errorMessage", "RemoteHostClosedError");
m_fetchResult.insert("error", 2);
break;
case QNetworkReply::HostNotFoundError:
m_fetchResult.insert("errorMessage", "HostNotFoundError");
m_fetchResult.insert("error", 3);
break;
case QNetworkReply::TimeoutError:
m_fetchResult.insert("errorMessage", "TimeoutError");
m_fetchResult.insert("error", 4);
break;
case QNetworkReply::OperationCanceledError:
m_fetchResult.insert("errorMessage", "OperationCanceledError");
m_fetchResult.insert("error", 5);
break;
case QNetworkReply::SslHandshakeFailedError:
m_fetchResult.insert("errorMessage", "SslHandshakeFailedError");
m_fetchResult.insert("error", 6);
break;
case QNetworkReply::TemporaryNetworkFailureError:
m_fetchResult.insert("errorMessage", "TemporaryNetworkFailureError");
m_fetchResult.insert("error", 7);
break;
/*case QNetworkReply::NetworkSessionFailedError:
m_fetchResult.insert("errorMessage", "NetworkSessionFailedError");
m_fetchResult.insert("error", 8);
break;
case QNetworkReply::BackgroundRequestNotAllowedError:
m_fetchResult.insert("errorMessage", "BackgroundRequestNotAllowedError");
m_fetchResult.insert("error", 9);
break;*/
case QNetworkReply::ProxyConnectionRefusedError:
m_fetchResult.insert("errorMessage", "ProxyConnectionRefusedError");
m_fetchResult.insert("error", 101);
break;
case QNetworkReply::ProxyConnectionClosedError:
m_fetchResult.insert("errorMessage", "ProxyConnectionClosedError");
m_fetchResult.insert("error", 102);
break;
case QNetworkReply::ProxyNotFoundError:
m_fetchResult.insert("errorMessage", "ProxyNotFoundError");
m_fetchResult.insert("error", 103);
break;
case QNetworkReply::ProxyTimeoutError:
m_fetchResult.insert("errorMessage", "ProxyTimeoutError");
m_fetchResult.insert("error", 104);
break;
case QNetworkReply::ProxyAuthenticationRequiredError:
m_fetchResult.insert("errorMessage", "ProxyAuthenticationRequiredError");
m_fetchResult.insert("error", 105);
break;
case QNetworkReply::ContentAccessDenied:
m_fetchResult.insert("errorMessage", "ContentAccessDenied");
m_fetchResult.insert("error", 201);
break;
case QNetworkReply::ContentOperationNotPermittedError:
m_fetchResult.insert("errorMessage", "ContentOperationNotPermittedError");
m_fetchResult.insert("error", 202);
break;
case QNetworkReply::ContentNotFoundError:
m_fetchResult.insert("errorMessage", "ContentNotFoundError");
m_fetchResult.insert("error", 203);
break;
case QNetworkReply::AuthenticationRequiredError:
m_fetchResult.insert("errorMessage", "AuthenticationRequiredError");
m_fetchResult.insert("error", 204);
break;
case QNetworkReply::ContentReSendError:
m_fetchResult.insert("errorMessage", "ContentReSendError");
m_fetchResult.insert("error", 205);
break;
case QNetworkReply::ProtocolUnknownError:
m_fetchResult.insert("errorMessage", "ProtocolUnknownError");
m_fetchResult.insert("error", 301);
break;
case QNetworkReply::ProtocolInvalidOperationError:
m_fetchResult.insert("errorMessage", "ProtocolInvalidOperationError");
m_fetchResult.insert("error", 302);
break;
case QNetworkReply::UnknownNetworkError:
m_fetchResult.insert("errorMessage", "UnknownNetworkError");
m_fetchResult.insert("error", 99);
break;
case QNetworkReply::UnknownProxyError:
m_fetchResult.insert("errorMessage", "UnknownProxyError");
m_fetchResult.insert("error", 199);
break;
case QNetworkReply::UnknownContentError:
m_fetchResult.insert("errorMessage", "UnknownContentError");
m_fetchResult.insert("error", 299);
break;
case QNetworkReply::ProtocolFailure:
m_fetchResult.insert("errorMessage", "ProtocolFailure");
m_fetchResult.insert("error", 399);
break;
default:
m_fetchResult.insert("errorMessage", "Unknown");
m_fetchResult.insert("error", 999);
break;
}
if (isFileDownload) {
m_fetchResult.insert("size", m_reply->header(QNetworkRequest::ContentLengthHeader).toLongLong());
delete m_reply;
return QString("ok");
}
QByteArray dataByteArray = m_reply->readAll();
m_fetchResult.insert("size",
(m_reply->header(QNetworkRequest::ContentLengthHeader).isValid())
? m_reply->header(QNetworkRequest::ContentLengthHeader).toLongLong()
: dataByteArray.size()
);
QTextCodec *codec = 0;
qDebug() << "Net - fileEncoding :" << fileEncoding;
if (fileEncoding != "auto") { // detect encoding
codec = QTextCodec::codecForName(fileEncoding.toLatin1());
}
if (codec == 0) { // detect encoding
qDebug() << "Net - encoding will be autodetected";
// BOM
codec = QTextCodec::codecForUtfText(dataByteArray, 0);
// HTTP Content-Type HEADER
if (!codec) {
qDebug() << "Net - encoding not detected by BOM";
if (m_reply->header(QNetworkRequest::ContentTypeHeader).isValid()) {
// get contentType header
QString contentType = m_reply->header(QNetworkRequest::ContentTypeHeader).toString();
qDebug() << "Net - Content-Type :" << contentType;
// search for [charset=?] in it
QRegExp rxCharset("charset=(.*)", Qt::CaseInsensitive);
if (rxCharset.indexIn(contentType) > -1) {
// try to get codec by name, if it fails 0 will be returned
qDebug() << "Net - Content-Type charset :" << rxCharset.cap(1);
codec = QTextCodec::codecForName(rxCharset.cap(1).toLatin1());
}
else {
qDebug() << "Net - Content-Type doesn't contain [charset]";
}
}
else {
qDebug() << "Net - Content-Type header is missing";
}
}
// META
// THIS IS MODIFIED QTextCodec::codecForHtml FUNCTION
// c:\phantomjs\src\qt\qtbase\src\corelib\codecs\qtextcodec.cpp
if (!codec) {
qDebug() << "Net - encoding not detected by Content-Type";
// test on first 4096 - originaly it was 512
QByteArray sample = dataByteArray.left(4096).toLower();
int pos = sample.indexOf("meta ");
if (pos != -1) {
pos = sample.indexOf("charset=", pos);
if (pos != -1) {
pos += qstrlen("charset=");
int pos2 = pos;
// The attribute can be closed with either """, "'", ">" or "/",
// none of which are valid charset characters.
while (++pos2 < sample.size()) {
char ch = sample.at(pos2);
if (ch == '\"' || ch == '\'' || ch == '>') {
qDebug() << "Net - meta tag encoding: " << sample.mid(pos, pos2 - pos);
codec = QTextCodec::codecForName(sample.mid(pos, pos2 - pos));
break;
}
}
}
}
}
// DEFAULT UTF-8
if (!codec) {
qDebug() << "Net - codec is unknown - UTF-8 will be used";
codec = QTextCodec::codecForName("utf-8");
}
//codec = QTextCodec::codecForHtml(dataByteArray, codec);
}
qDebug() << "Net - final encoding :" << QString::fromUtf8(codec->name());
delete m_reply;
return codec->toUnicode(dataByteArray);
}
QVariantMap Net::fetchResult() const
{
return m_fetchResult;
}
void Net::_setFetchResult(const QVariantMap &result)
{
m_fetchResult = result;
}
bool Net::bypassProxy() const
{
return m_bypassProxy;
}
void Net::setBypassProxy(bool value)
{
m_bypassProxy = value;
}
QString Net::userAgent() const
{
return m_userAgent;
}
void Net::setUserAgent(const QString &agent)
{
m_userAgent = agent;
}
bool Net::echo(const QString &host, int port, const QString &message)
{
QTcpSocket socket;
qDebug() << "Net - Echoing host " << host << ":" << port;
socket.connectToHost( host, port );
if (socket.waitForConnected( 8000 )) { // 8sec timeout
bool ok = true;
while (socket.state() == QAbstractSocket::ConnectedState) {
if (message.length() > 0) {
socket.write( message.toUtf8() );
ok = socket.waitForBytesWritten();
}
break;
} // while
qDebug() << "Net - echo status: " << ok;
socket.close();
return ok;
}
else {
qDebug() << "Net - timeout..." << socket.state();
return false;
}
}
QString Net::resolveUrl(const QString &base, const QString &relative) const
{
QUrl baseUrl(base);
QUrl relativeUrl(relative);
return baseUrl.resolved(relativeUrl).toString();
}
QString Net::localIP() const
{
foreach (const QHostAddress &address, QNetworkInterface::allAddresses()) {
if (address.protocol() == QAbstractSocket::IPv4Protocol
&& address != QHostAddress(QHostAddress::LocalHost)
&& address.toString().section( ".",-1,-1 ) != "1")
return address.toString();
}
return "";
}
QString Net::localHostName() const
{
return QHostInfo::localHostName();
}
int Net::timeout() const
{
return m_timeout;
}
void Net::setTimeout(int timeout)
{
m_timeout = timeout;
}
void Net::_timeoutTestFunction()
{
qDebug("fetch timeout! abort");
m_reply->abort();
m_loop.quit();
}
/***** ivan > *****/
|
{
"content_hash": "a9409d171a22b2245c60a3dbbf4304ee",
"timestamp": "",
"source": "github",
"line_count": 472,
"max_line_length": 172,
"avg_line_length": 38.54661016949152,
"alnum_prop": 0.5775530394635594,
"repo_name": "iradul/phantomjs-clone",
"id": "28513d6c043d8a127a17849e6114a970093b2677",
"size": "18194",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/net.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "825"
},
{
"name": "Assembly",
"bytes": "268988"
},
{
"name": "Batchfile",
"bytes": "32378"
},
{
"name": "Bison",
"bytes": "12791"
},
{
"name": "C",
"bytes": "8919569"
},
{
"name": "C#",
"bytes": "1101"
},
{
"name": "C++",
"bytes": "208011988"
},
{
"name": "CMake",
"bytes": "554470"
},
{
"name": "CSS",
"bytes": "760708"
},
{
"name": "DTrace",
"bytes": "1931"
},
{
"name": "Emacs Lisp",
"bytes": "393"
},
{
"name": "GAP",
"bytes": "188715"
},
{
"name": "Groff",
"bytes": "570631"
},
{
"name": "HTML",
"bytes": "5465225"
},
{
"name": "Java",
"bytes": "339535"
},
{
"name": "JavaScript",
"bytes": "9646193"
},
{
"name": "Makefile",
"bytes": "21096"
},
{
"name": "Objective-C",
"bytes": "2820750"
},
{
"name": "Objective-C++",
"bytes": "7474669"
},
{
"name": "Perl",
"bytes": "1736748"
},
{
"name": "Perl6",
"bytes": "38417"
},
{
"name": "Prolog",
"bytes": "14631"
},
{
"name": "Protocol Buffer",
"bytes": "8758"
},
{
"name": "Python",
"bytes": "5502820"
},
{
"name": "QML",
"bytes": "170356"
},
{
"name": "QMake",
"bytes": "587612"
},
{
"name": "Ruby",
"bytes": "424059"
},
{
"name": "Shell",
"bytes": "436635"
},
{
"name": "XSLT",
"bytes": "1047"
}
],
"symlink_target": ""
}
|
module Cldr
module Format
class Decimal
class Base
def interpolate(string, value, orientation = :right)
value = value.to_s
length = value.length
start, pad = orientation == :left ? [0, :rjust] : [-length, :ljust]
string = string.dup
string = string.ljust(length, '#') if string.length < length
string[start, length] = value
string.gsub('#', '')
end
end
end
end
end
|
{
"content_hash": "1059bffa3b482f04e3fd412a6ef8b857",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 77,
"avg_line_length": 26.444444444444443,
"alnum_prop": 0.5441176470588235,
"repo_name": "camertron/ruby-cldr",
"id": "d025ffa21a0a5c86c23cb9fe4c3f59eb819cb7d7",
"size": "476",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/cldr/format/decimal/base.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "172492"
}
],
"symlink_target": ""
}
|
require 'spec_helper'
describe CosukaOpsworks do
it 'has a version number' do
expect(CosukaOpsworks::VERSION).not_to be nil
end
end
|
{
"content_hash": "92eb22b3d10d261f295648ce85f21ce6",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 49,
"avg_line_length": 20.142857142857142,
"alnum_prop": 0.7446808510638298,
"repo_name": "SonicGarden/cosuka_opsworks",
"id": "7a4f39dce6b82ae9c281fa1563407e658948b5d2",
"size": "141",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/cosuka_opsworks_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "14828"
}
],
"symlink_target": ""
}
|
from corehq.apps.locations.models import all_locations
from corehq.apps.commtrack.models import Product, SupplyPointCase
def supply_point_ids(locations):
keys = [[loc.domain, loc._id] for loc in locations]
rows = SupplyPointCase.get_db().view(
'commtrack/supply_point_by_loc',
keys=keys,
include_docs=False,
)
return [row['id'] for row in rows]
def get_relevant_supply_point_ids(domain, active_location=None):
if active_location:
return supply_point_ids([active_location] + active_location.descendants)
else:
return supply_point_ids(all_locations(domain))
def product_ids_filtered_by_program(domain, program):
products = Product.by_program_id(domain, program, False)
return [p['_id'] for p in products]
|
{
"content_hash": "4ddef6f376711d2f9c429176a4f1047a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 80,
"avg_line_length": 32.541666666666664,
"alnum_prop": 0.6965428937259923,
"repo_name": "SEL-Columbia/commcare-hq",
"id": "0cba6a41e901996e0ffe4a590be8f2f61b492a16",
"size": "781",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "corehq/apps/reports/commtrack/util.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ActionScript",
"bytes": "15950"
},
{
"name": "CSS",
"bytes": "768322"
},
{
"name": "JavaScript",
"bytes": "2647080"
},
{
"name": "Python",
"bytes": "7806659"
},
{
"name": "Shell",
"bytes": "28569"
}
],
"symlink_target": ""
}
|
// Copyright (c) 2015 The Polcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef Polcoin_REVERSELOCK_H
#define Polcoin_REVERSELOCK_H
/**
* An RAII-style reverse lock. Unlocks on construction and locks on destruction.
*/
template<typename Lock>
class reverse_lock
{
public:
explicit reverse_lock(Lock& lock) : lock(lock) {
lock.unlock();
}
~reverse_lock() {
lock.lock();
}
private:
reverse_lock(reverse_lock const&);
reverse_lock& operator=(reverse_lock const&);
Lock& lock;
};
#endif // Polcoin_REVERSELOCK_H
|
{
"content_hash": "5c24a3e1b862779a32d154918b67aaef",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 80,
"avg_line_length": 21.870967741935484,
"alnum_prop": 0.6902654867256637,
"repo_name": "wargo32/Polcoin",
"id": "270b3336403c3571bf018ebda0437e7e2db9da03",
"size": "678",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/reverselock.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "456682"
},
{
"name": "C++",
"bytes": "3876763"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Groff",
"bytes": "18445"
},
{
"name": "HTML",
"bytes": "50621"
},
{
"name": "Java",
"bytes": "2100"
},
{
"name": "Makefile",
"bytes": "63563"
},
{
"name": "Objective-C",
"bytes": "2022"
},
{
"name": "Objective-C++",
"bytes": "7240"
},
{
"name": "Protocol Buffer",
"bytes": "2308"
},
{
"name": "Python",
"bytes": "491253"
},
{
"name": "QMake",
"bytes": "2020"
},
{
"name": "Shell",
"bytes": "30599"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="ro">
<head>
<!-- Generated by javadoc (version 1.7.0_07) on Tue May 27 14:37:25 EEST 2014 -->
<title>Uses of Class net.sf.jasperreports.engine.util.JRFontNotFoundException (JasperReports 5.6.0 API)</title>
<meta name="date" content="2014-05-27">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class net.sf.jasperreports.engine.util.JRFontNotFoundException (JasperReports 5.6.0 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../net/sf/jasperreports/engine/util/JRFontNotFoundException.html" title="class in net.sf.jasperreports.engine.util">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?net/sf/jasperreports/engine/util/class-use/JRFontNotFoundException.html" target="_top">Frames</a></li>
<li><a href="JRFontNotFoundException.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class net.sf.jasperreports.engine.util.JRFontNotFoundException" class="title">Uses of Class<br>net.sf.jasperreports.engine.util.JRFontNotFoundException</h2>
</div>
<div class="classUseContainer">No usage of net.sf.jasperreports.engine.util.JRFontNotFoundException</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../net/sf/jasperreports/engine/util/JRFontNotFoundException.html" title="class in net.sf.jasperreports.engine.util">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?net/sf/jasperreports/engine/util/class-use/JRFontNotFoundException.html" target="_top">Frames</a></li>
<li><a href="JRFontNotFoundException.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>
<span style="font-decoration:none;font-family:Arial,Helvetica,sans-serif;font-size:8pt;font-style:normal;color:#000000;">© 2001-2010 Jaspersoft Corporation <a href="http://www.jaspersoft.com" target="_blank" style="color:#000000;">www.jaspersoft.com</a></span>
</small></p>
</body>
</html>
|
{
"content_hash": "0a6c47f9102a39b10b4ad4e24fafa5aa",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 265,
"avg_line_length": 39.6,
"alnum_prop": 0.6300505050505051,
"repo_name": "phurtado1112/cnaemvc",
"id": "43a89dfb5239f9333445a2d3a84615c44e4cfbdc",
"size": "4752",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/JasperReport__5.6/docs/api/net/sf/jasperreports/engine/util/class-use/JRFontNotFoundException.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "11139"
},
{
"name": "HTML",
"bytes": "112926414"
},
{
"name": "Java",
"bytes": "532942"
}
],
"symlink_target": ""
}
|
UISelectRole::UISelectRole()
{
}
UISelectRole::~UISelectRole()
{
g_pPlayerLogic->RemoveEventCallBack(E_PlayerEvent_RoleList, this);
}
bool UISelectRole::initLayout()
{
if(!UIDialog::initLayout())
return false;
m_pRoleList = ui::ListView::create();
m_pRoleList->setSizeType(ui::SizeType::SIZE_PERCENT);
m_pRoleList->setSizePercent(ccp(0.1f, 0.25f));
m_pRoleList->setPositionType(ui::PositionType::POSITION_PERCENT);
m_pRoleList->setPositionPercent(ccp(0.5f, 0.5f));
//m_pRoleList->setBackGroundColorType(ui::LayoutBackGroundColorType::LAYOUT_COLOR_SOLID);
m_pRoleList->setBackGroundColor(ccc3(255, 0, 0));
m_pRoleList->setAnchorPoint(ccp(0.5, 0.5));
m_pContent->addChild(m_pRoleList);
auto button = ui::Button::create();
button->loadTextureNormal("Button_Normal.png",ui::TextureResType::UI_TEX_TYPE_LOCAL);
button->setScale9Enabled(true);
button->setSizePercent(ccp(1.0f, 0.2f));
button->setSizeType(ui::SizeType::SIZE_PERCENT);
m_pRoleList->setItemModel(button);
button = ui::Button::create();
button->loadTextureNormal("Button_Normal.png",ui::TextureResType::UI_TEX_TYPE_LOCAL);
button->setScale9Enabled(true);
button->setSizePercent(ccp(0.1f, 0.1f));
button->setSizeType(ui::SizeType::SIZE_PERCENT);
button->setTitleText("CreateRole");
button->setPositionType(ui::PositionType::POSITION_PERCENT);
button->setPositionPercent(ccp(0.5f, 0.2f));
button->setTitleColor(ccc3(0, 0, 0));
button->addTouchEventListener(this, ui::SEL_TouchEvent(&UISelectRole::OnRoleCreate));
m_pContent->addChild(button);
g_pPlayerLogic->AddEventCallBack(E_PlayerEvent_RoleList, this, &UISelectRole::OnRoleListEvent);
return true;
}
void UISelectRole::initData(void *customData)
{
g_pPlayerLogic->RequireRoleList();
m_pRoleList->removeAllItems();
}
int UISelectRole::OnRoleListEvent(const int nEventID, const NFIDataList& varDataList)
{
auto roleList = g_pPlayerLogic->GetRoleList();
m_pRoleList->removeAllItems();
for(int i = 0; i < roleList.size(); i++)
{
const NFMsg::RoleLiteInfo &kRoleInfo = roleList[i];
m_pRoleList->pushBackDefaultItem();
ui::Button *pButton = (ui::Button *)m_pRoleList->getItem(m_pRoleList->getItems()->count()-1);
pButton->addTouchEventListener(this, ui::SEL_TouchEvent(&UISelectRole::OnRoleSelected));
pButton->setTitleText(kRoleInfo.noob_name());
pButton->setTitleColor(ccc3(0, 0, 0));
}
return 0;
}
void UISelectRole::OnRoleSelected(CCObject *pObject , ui::TouchEventType type)
{
if(type == ui::TouchEventType::TOUCH_EVENT_ENDED)
{
auto serverList = g_pPlayerLogic->GetRoleList();
int nIndex = m_pRoleList->getIndex((Widget*)pObject);
g_pPlayerLogic->RequireEnterGameServer(0);
g_pUIManager->CloseDialog();
GameScene::showScene();
}
}
void UISelectRole::OnRoleCreate(CCObject *pObject , ui::TouchEventType type)
{
if(type == ui::TouchEventType::TOUCH_EVENT_ENDED)
{
NFCDataList varData;
g_pKernelModule->Random(0, 1000, 1, varData);
g_pPlayerLogic->RequireCreateRole(CCString::createWithFormat("TestRole%lld", varData.Int(0))->getCString(), 1, 1);
}
}
|
{
"content_hash": "093a7e6aa12cf411b02155b0de59a906",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 116,
"avg_line_length": 33.09782608695652,
"alnum_prop": 0.7402298850574712,
"repo_name": "IGGINC/NFDemo",
"id": "79ea938b66ff473f4e2d45f8b595fafbf1dc00f3",
"size": "3153",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Client/Cocos2.x/Game/Classes/UI/UISelectRole.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1112"
},
{
"name": "C",
"bytes": "5966"
},
{
"name": "C#",
"bytes": "388924"
},
{
"name": "C++",
"bytes": "133157"
},
{
"name": "CMake",
"bytes": "1006"
},
{
"name": "Java",
"bytes": "55911"
},
{
"name": "Lua",
"bytes": "7653"
},
{
"name": "Makefile",
"bytes": "1704"
},
{
"name": "Objective-C",
"bytes": "3642"
},
{
"name": "Objective-C++",
"bytes": "8859"
},
{
"name": "Protocol Buffer",
"bytes": "77803"
},
{
"name": "Shell",
"bytes": "3004"
},
{
"name": "XSLT",
"bytes": "82915"
}
],
"symlink_target": ""
}
|
@implementation SCLPinchGestureRecognizer {
CGPoint _location;
CGVector _vector;
}
#pragma mark SCLPinchGestureRecognizer
- (CGVector)vectorInView:(UIView *)view
{
CGPoint point1 = _location;
CGPoint point2 = _location;
point2.x += _vector.dx;
point2.y += _vector.dy;
point1 = [self.view convertPoint:point1 toView:view];
point2 = [self.view convertPoint:point2 toView:view];
return CGVectorMake(point2.x - point1.x, point2.y - point1.y);
}
#pragma mark UIGestureRecognizer
- (CGPoint)locationInView:(UIView *)view
{
return [self.view convertPoint:_location toView:view];
}
#pragma mark UIGestureRecognizer (ForSubclassEyesOnly)
- (void)reset
{
[super reset];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
if ([touches count] == 1) {
_location = [[touches anyObject] locationInView:self.view];
}
else {
self.state = UIGestureRecognizerStateFailed;
}
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesMoved:touches withEvent:event];
if (self.state == UIGestureRecognizerStateFailed) {
return;
}
CGPoint startLocation = _location;
CGPoint currentLocation = [touches.anyObject locationInView:self.view];
CGVector vector;
vector.dx = currentLocation.x - startLocation.x;
vector.dy = currentLocation.y - startLocation.y;
static CGFloat distanceTolerance = 80.0;
CGFloat distance = (CGFloat)sqrt((vector.dx * vector.dx) + (vector.dy * vector.dy));
if (distance >= distanceTolerance && self.state == UIGestureRecognizerStatePossible) {
_vector = vector;
self.state = UIGestureRecognizerStateRecognized;
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesCancelled:touches withEvent:event];
self.state = UIGestureRecognizerStateFailed;
}
@end
|
{
"content_hash": "76995c80e71deb18ac4dc86ec078b214",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 90,
"avg_line_length": 25.433734939759034,
"alnum_prop": 0.685457129322596,
"repo_name": "junpluse/ScreenLayout",
"id": "7ccca9084b79a0243ab5ff8100b9e87ec6529ba4",
"size": "2359",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ScreenLayout/SCLPinchGestureRecognizer.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "175212"
}
],
"symlink_target": ""
}
|
import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
import { User } from './user';
import { App } from './app';
import { id } from '../id';
@Entity()
export class AuthSession {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the AuthSession.'
})
public createdAt: Date;
@Index()
@Column('varchar', {
length: 128
})
public token: string;
@Column({
...id(),
nullable: true
})
public userId: User['id'];
@ManyToOne(type => User, {
onDelete: 'CASCADE',
nullable: true
})
@JoinColumn()
public user: User | null;
@Column(id())
public appId: App['id'];
@ManyToOne(type => App, {
onDelete: 'CASCADE'
})
@JoinColumn()
public app: App | null;
}
|
{
"content_hash": "81e10c5a36ba137dc49cfd24e6acc07e",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 86,
"avg_line_length": 17.976744186046513,
"alnum_prop": 0.6326002587322122,
"repo_name": "syuilo/Misskey",
"id": "4eec27e3f63e4dca71629c4b7f01180d3f7428ee",
"size": "773",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/models/entities/auth-session.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "391893"
},
{
"name": "HTML",
"bytes": "191647"
},
{
"name": "JavaScript",
"bytes": "2503315"
},
{
"name": "LiveScript",
"bytes": "432675"
}
],
"symlink_target": ""
}
|
package com.inepex.ineForm.shared.htmlrender;
import java.util.ArrayList;
import java.util.List;
import junit.framework.Assert;
import org.jukito.JukitoModule;
import org.jukito.JukitoRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.inepex.ineForm.client.IneFormProperties;
import com.inepex.ineForm.client.form.widgets.assist.NationalityAssist;
import com.inepex.ineForm.client.form.widgets.kvo.NationalityKVO;
import com.inepex.ineForm.server.guice.IneFormExportGuiceModule;
import com.inepex.ineForm.server.util.JavaDateFormatter;
import com.inepex.ineForm.shared.render.DefaultTableFieldRenderer;
import com.inepex.ineForm.shared.render.TableFieldRenderer;
import com.inepex.ineForm.shared.tablerender.HtmlRenderer;
import com.inepex.ineForm.shared.tablerender.HtmlRenderer.HtmlRendererFactory;
import com.inepex.ineForm.test.TestIneFormClientGuiceModule;
import com.inepex.ineFrame.server.NumberUtilSrv;
import com.inepex.ineFrame.shared.util.NumberUtil;
import com.inepex.ineFrame.shared.util.date.DateFormatter;
import com.inepex.ineFrame.test.DefaultIneFrameClientSideTestBase;
import com.inepex.ineom.shared.assistedobject.AssistedObject;
import com.inepex.ineom.shared.descriptorstore.DescriptorStore;
@RunWith(JukitoRunner.class)
public class HtmlRendererTest extends DefaultIneFrameClientSideTestBase {
List<AssistedObject> kvos;
public static class Module extends JukitoModule {
@Override
protected void configureTest() {
install(new TestIneFormClientGuiceModule());
install(new IneFormExportGuiceModule());
bind(DateFormatter.class).to(JavaDateFormatter.class);
bind(NumberUtil.class).to(NumberUtilSrv.class);
bind(TableFieldRenderer.class).to(DefaultTableFieldRenderer.class);
}
}
@Before
public void init(DescriptorStore descriptorStore) {
NationalityAssist.registerDescriptors(descriptorStore);
IneFormProperties.showIds = true;
kvos = new ArrayList<AssistedObject>();
NationalityKVO nat1 = new NationalityKVO();
nat1.setId(1L);
nat1.setName("Nat1");
NationalityKVO nat2 = new NationalityKVO();
nat2.setId(2L);
nat2.setName("Nat2");
kvos.add(nat1);
kvos.add(nat2);
}
@Test
public void renderTest(HtmlRendererFactory htmlRendererFactory) {
HtmlRenderer renderer = htmlRendererFactory.create(NationalityKVO.descriptorName, null);
String csvString = renderer.render(kvos);
Assert.assertEquals(
"<html>\n"
+ "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>"
+ "<style type=\"text/css\">td {border: 1px solid black;}\n"
+ "th {background-color: #f2f2f2; border: 1px solid black;}\n"
+ "table {text-align: left; empty-cells: show; border-collapse: collapse;}</style></head><table>\n"
+ "<tr><td>1</td><td>Nat1</td></tr>\n" + "<tr><td>2</td><td>Nat2</td></tr>\n"
+ "</table></html>",
csvString);
}
@Test
public void renderWithHeaderTest(HtmlRendererFactory htmlRendererFactory) {
HtmlRenderer renderer = htmlRendererFactory.create(NationalityKVO.descriptorName, null);
renderer.setRenderHeader(true);
String csvString = renderer.render(kvos);
Assert.assertEquals(
"<html>\n"
+ "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>"
+ "<style type=\"text/css\">td {border: 1px solid black;}\n"
+ "th {background-color: #f2f2f2; border: 1px solid black;}\n"
+ "table {text-align: left; empty-cells: show; border-collapse: collapse;}</style></head><table>\n"
+ "<tr><th>Id</th><th>Name</th></tr>\n" + "<tr><td>1</td><td>Nat1</td></tr>\n"
+ "<tr><td>2</td><td>Nat2</td></tr>\n" + "</table></html>",
csvString);
}
}
|
{
"content_hash": "3b482ca652192972e7d94f17f9fe6527",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 115,
"avg_line_length": 42.03030303030303,
"alnum_prop": 0.6621004566210046,
"repo_name": "inepex/ineform",
"id": "1aca18c9dc409ef601f841d37eccd15759dafa0a",
"size": "4161",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ineform/src/test/java/com/inepex/ineForm/shared/htmlrender/HtmlRendererTest.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "66"
},
{
"name": "CSS",
"bytes": "6901"
},
{
"name": "HTML",
"bytes": "2189"
},
{
"name": "Java",
"bytes": "3083846"
}
],
"symlink_target": ""
}
|
<div id="bookModal" class="bd-book-modal modal">
<div class="bd-book-modal-background"></div>
<div class="modal-content">
<div class="bd-book-modal-columns">
<div class="bd-book-modal-column bd-is-cover">
{% include book/book-cover.html %}
</div>
<div class="bd-book-modal-column bd-is-content">
{% include book/book-content.html show_cover=true %}
</div>
</div>
</div>
<button class="bd-book-modal-close modal-close is-large" aria-label="close"></button>
</div>
|
{
"content_hash": "4f4dc79e5db5546ef370bf9551bbdb41",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 88,
"avg_line_length": 37.142857142857146,
"alnum_prop": 0.625,
"repo_name": "jgthms/bulma",
"id": "a99d164fae35e2c3fe53369562014337e50abfda",
"size": "520",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/_includes/book/book-modal.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "245028"
},
{
"name": "JavaScript",
"bytes": "3952"
},
{
"name": "SCSS",
"bytes": "1979"
},
{
"name": "Sass",
"bytes": "141318"
},
{
"name": "Shell",
"bytes": "969"
}
],
"symlink_target": ""
}
|
"""
px_romfs_pruner.py:
Try to keep size of the ROMFS minimal.
This script goes through the temporarily copied ROMFS data and deletes all
comments, empty lines and unnecessary whitespace.
It also deletes hidden files such as auto-saved backups that a text editor
might have left in the tree.
@author: Julian Oes <julian@oes.ch>
"""
from __future__ import print_function
import argparse
import re
import os
import io
def main():
# Parse commandline arguments
parser = argparse.ArgumentParser(description="ROMFS pruner.")
parser.add_argument('--folder', action="store",
help="ROMFS scratch folder.")
parser.add_argument('--board', action="store",
help="Board architecture for this run")
args = parser.parse_args()
# go through temp folder
for (root, dirs, files) in os.walk(args.folder):
for file in files:
file_path = os.path.join(root, file)
# delete hidden files
if file.startswith("."):
os.remove(file_path)
continue
# delete documentation
if file.startswith("README"):
os.remove(file_path)
continue
# delete CMakeLists
if file.startswith("CMakeLists"):
os.remove(file_path)
continue
# only prune text files
if ".zip" in file or ".bin" in file or ".swp" in file \
or ".data" in file or ".DS_Store" in file:
continue
# read file line by line
pruned_content = ""
board_excluded = False
with io.open(file_path, "r", newline=None) as f:
for line in f:
if re.search(r'\b{0} exclude\b'.format(args.board), line):
board_excluded = True
# handle mixer files differently than startup files
if file_path.endswith(".mix"):
if line.startswith(("Z:", "M:", "R: ", "O:", "S:",
"H:", "T:", "P:")):
# reduce multiple consecutive spaces into a
# single space
line_reduced = re.sub(' +', ' ', line)
pruned_content += line_reduced
else:
if not line.isspace() \
and not line.strip().startswith("#"):
pruned_content += line.strip() + "\n"
# delete the file if it doesn't contain the architecture
# write out the pruned content else
if not board_excluded:
# overwrite old scratch file
with open(file_path, "wb") as f:
pruned_content = re.sub("\r\n", "\n", pruned_content)
f.write(pruned_content.encode("ascii", errors='strict'))
else:
os.remove(file_path)
if __name__ == '__main__':
main()
|
{
"content_hash": "2b5a0ccc59c9707646dda61bd021ec7e",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 78,
"avg_line_length": 36.22352941176471,
"alnum_prop": 0.5050341019811627,
"repo_name": "mje-nz/PX4-Firmware",
"id": "82e7c452815ab80aadc2c7ba26acc700ad556b6a",
"size": "4806",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "Tools/px_romfs_pruner.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "3055284"
},
{
"name": "C++",
"bytes": "8152043"
},
{
"name": "CMake",
"bytes": "932688"
},
{
"name": "GDB",
"bytes": "41"
},
{
"name": "Groovy",
"bytes": "33603"
},
{
"name": "HTML",
"bytes": "5281"
},
{
"name": "MATLAB",
"bytes": "9938"
},
{
"name": "Makefile",
"bytes": "19543"
},
{
"name": "Perl",
"bytes": "11401"
},
{
"name": "Python",
"bytes": "1260823"
},
{
"name": "Shell",
"bytes": "260898"
},
{
"name": "XSLT",
"bytes": "6736"
}
],
"symlink_target": ""
}
|
package org.sleuthkit.autopsy.datamodel;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import java.util.logging.Level;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import static org.sleuthkit.autopsy.core.UserPreferences.hideKnownFilesInViewsTree;
import static org.sleuthkit.autopsy.core.UserPreferences.hideSlackFilesInViewsTree;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.FileTypes.FileTypesKey;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.autopsy.guiutils.RefreshThrottler;
/**
* Class which contains the Nodes for the 'By Mime Type' view located in the
* File Types view, shows all files with a mime type. Will initially be empty
* until file type identification has been performed. Contains a Property Change
* Listener which is checking for changes in IngestJobEvent Completed or
* Canceled and IngestModuleEvent Content Changed.
*/
public final class FileTypesByMimeType extends Observable implements AutopsyVisitableItem {
private final static Logger logger = Logger.getLogger(FileTypesByMimeType.class.getName());
private static final Set<IngestManager.IngestJobEvent> INGEST_JOB_EVENTS_OF_INTEREST = EnumSet.of(IngestManager.IngestJobEvent.COMPLETED, IngestManager.IngestJobEvent.CANCELLED);
/**
* The nodes of this tree will be determined dynamically by the mimetypes
* which exist in the database. This hashmap will store them with the media
* type as the key and a Map, from media subtype to count, as the value.
*/
private final HashMap<String, Map<String, Long>> existingMimeTypeCounts = new HashMap<>();
/**
* Root of the File Types tree. Used to provide single answer to question:
* Should the child counts be shown next to the nodes?
*/
private final FileTypes typesRoot;
/**
* The pcl is in the class because it has the easiest mechanisms to add and
* remove itself during its life cycles.
*/
private final PropertyChangeListener pcl;
private static final Set<Case.Events> CASE_EVENTS_OF_INTEREST = EnumSet.of(Case.Events.DATA_SOURCE_ADDED, Case.Events.CURRENT_CASE);
/**
* RefreshThrottler is used to limit the number of refreshes performed when
* CONTENT_CHANGED and DATA_ADDED ingest module events are received.
*/
private final RefreshThrottler refreshThrottler;
/**
* Create the base expression used as the where clause in the queries for
* files by mime type. Filters out certain kinds of files and directories,
* and known/slack files based on user preferences.
*
* @return The base expression to be used in the where clause of queries for
* files by mime type.
*/
private String createBaseWhereExpr() {
return "(dir_type = " + TskData.TSK_FS_NAME_TYPE_ENUM.REG.getValue() + ")"
+ " AND (type IN ("
+ TskData.TSK_DB_FILES_TYPE_ENUM.FS.ordinal() + ","
+ TskData.TSK_DB_FILES_TYPE_ENUM.CARVED.ordinal() + ","
+ TskData.TSK_DB_FILES_TYPE_ENUM.DERIVED.ordinal() + ","
+ TskData.TSK_DB_FILES_TYPE_ENUM.LAYOUT_FILE.ordinal() + ","
+ TskData.TSK_DB_FILES_TYPE_ENUM.LOCAL.ordinal()
+ (hideSlackFilesInViewsTree() ? "" : ("," + TskData.TSK_DB_FILES_TYPE_ENUM.SLACK.ordinal()))
+ "))"
+ ((filteringDataSourceObjId() > 0) ? " AND data_source_obj_id = " + this.filteringDataSourceObjId() : " ")
+ (hideKnownFilesInViewsTree() ? (" AND (known IS NULL OR known != " + TskData.FileKnown.KNOWN.getFileKnownValue() + ")") : "");
}
private void removeListeners() {
deleteObservers();
IngestManager.getInstance().removeIngestJobEventListener(pcl);
refreshThrottler.unregisterEventListener();
Case.removeEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, pcl);
}
/**
* Performs the query on the database to get all distinct MIME types of
* files in it, and populate the hashmap with those results.
*/
private void populateHashMap() {
String query = "SELECT mime_type, count(*) AS count FROM tsk_files "
+ " WHERE mime_type IS NOT null "
+ " AND " + createBaseWhereExpr()
+ " GROUP BY mime_type";
synchronized (existingMimeTypeCounts) {
existingMimeTypeCounts.clear();
try
(SleuthkitCase.CaseDbQuery dbQuery = Case.getCurrentCaseThrows().getSleuthkitCase().executeQuery(query)) {
ResultSet resultSet = dbQuery.getResultSet();
while (resultSet.next()) {
final String mime_type = resultSet.getString("mime_type"); //NON-NLS
if (!mime_type.isEmpty()) {
//if the mime_type contained multiple slashes then everything after the first slash will become the subtype
final String mediaType = StringUtils.substringBefore(mime_type, "/");
final String subType = StringUtils.removeStart(mime_type, mediaType + "/");
if (!mediaType.isEmpty() && !subType.isEmpty()) {
final long count = resultSet.getLong("count");
existingMimeTypeCounts.computeIfAbsent(mediaType, t -> new HashMap<>())
.put(subType, count);
}
}
}
} catch (NoCurrentCaseException | TskCoreException | SQLException ex) {
logger.log(Level.SEVERE, "Unable to populate File Types by MIME Type tree view from DB: ", ex); //NON-NLS
}
}
setChanged();
notifyObservers();
}
FileTypesByMimeType(FileTypes typesRoot) {
this.typesRoot = typesRoot;
this.pcl = (PropertyChangeEvent evt) -> {
String eventType = evt.getPropertyName();
if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString())
|| eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString())
|| eventType.equals(Case.Events.DATA_SOURCE_ADDED.toString())) {
refreshMimeTypes();
} else if (eventType.equals(Case.Events.CURRENT_CASE.toString())) {
if (evt.getNewValue() == null) {
removeListeners();
}
}
};
refreshThrottler = new RefreshThrottler(new FileTypesByMimeTypeRefresher());
IngestManager.getInstance().addIngestJobEventListener(INGEST_JOB_EVENTS_OF_INTEREST, pcl);
refreshThrottler.registerForIngestModuleEvents();
Case.addEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, pcl);
populateHashMap();
}
@Override
public <T> T accept(AutopsyItemVisitor<T> visitor) {
return visitor.visit(this);
}
long filteringDataSourceObjId() {
return typesRoot.filteringDataSourceObjId();
}
/**
* Method to check if the node in question is a ByMimeTypeNode which is
* empty.
*
* @param node the Node which you wish to check.
*
* @return True if originNode is an instance of ByMimeTypeNode and is empty,
* false otherwise.
*/
public static boolean isEmptyMimeTypeNode(Node node) {
boolean isEmptyMimeNode = false;
if (node instanceof FileTypesByMimeType.ByMimeTypeNode && ((FileTypesByMimeType.ByMimeTypeNode) node).isEmpty()) {
isEmptyMimeNode = true;
}
return isEmptyMimeNode;
}
private void refreshMimeTypes() {
/**
* Checking for a current case is a stop gap measure until a different
* way of handling the closing of cases is worked out. Currently, remote
* events may be received for a case that is already closed.
*/
try {
Case.getCurrentCaseThrows();
typesRoot.updateShowCounts();
populateHashMap();
} catch (NoCurrentCaseException notUsed) {
/**
* Case is closed, do nothing.
*/
}
}
/**
* Responsible for updating the 'By Mime Type' view in the UI. See
* RefreshThrottler for more details.
*/
private class FileTypesByMimeTypeRefresher implements RefreshThrottler.Refresher {
@Override
public void refresh() {
refreshMimeTypes();
}
@Override
public boolean isRefreshRequired(PropertyChangeEvent evt) {
return true;
}
}
/**
* Class which represents the root node of the "By MIME Type" tree, will
* have children of each media type present in the database or no children
* when the file detection module has not been run and MIME type is
* currently unknown.
*/
class ByMimeTypeNode extends DisplayableItemNode {
@NbBundle.Messages({"FileTypesByMimeType.name.text=By MIME Type"})
final String NAME = Bundle.FileTypesByMimeType_name_text();
ByMimeTypeNode() {
super(Children.create(new ByMimeTypeNodeChildren(), true), Lookups.singleton(Bundle.FileTypesByMimeType_name_text()));
super.setName(NAME);
super.setDisplayName(NAME);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file_types.png");
}
@Override
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
return visitor.visit(this);
}
@Override
public String getItemType() {
return getClass().getName();
}
boolean isEmpty() {
synchronized (existingMimeTypeCounts) {
return existingMimeTypeCounts.isEmpty();
}
}
}
/**
* Creates the children for the "By MIME Type" node these children will each
* represent a distinct media type present in the DB
*/
private class ByMimeTypeNodeChildren extends ChildFactory<String> implements Observer {
private ByMimeTypeNodeChildren() {
super();
addObserver(this);
}
@Override
protected boolean createKeys(List<String> mediaTypeNodes) {
final List<String> keylist;
synchronized (existingMimeTypeCounts) {
keylist = new ArrayList<>(existingMimeTypeCounts.keySet());
}
Collections.sort(keylist);
mediaTypeNodes.addAll(keylist);
return true;
}
@Override
protected Node createNodeForKey(String key) {
return new MediaTypeNode(key);
}
@Override
public void update(Observable o, Object arg) {
refresh(true);
}
}
/**
* The Media type node created by the ByMimeTypeNodeChildren and contains
* one of the unique media types present in the database for this case.
*/
class MediaTypeNode extends DisplayableItemNode {
@NbBundle.Messages({"FileTypesByMimeTypeNode.createSheet.mediaType.name=Type",
"FileTypesByMimeTypeNode.createSheet.mediaType.displayName=Type",
"FileTypesByMimeTypeNode.createSheet.mediaType.desc=no description"})
MediaTypeNode(String name) {
super(Children.create(new MediaTypeNodeChildren(name), true), Lookups.singleton(name));
setName(name);
setDisplayName(name);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file_types.png");
}
@Override
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
return visitor.visit(this);
}
@Override
protected Sheet createSheet() {
Sheet sheet = super.createSheet();
Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
if (sheetSet == null) {
sheetSet = Sheet.createPropertiesSet();
sheet.put(sheetSet);
}
sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileTypesByMimeTypeNode.createSheet.mediaType.name"), NbBundle.getMessage(this.getClass(), "FileTypesByMimeTypeNode.createSheet.mediaType.displayName"), NbBundle.getMessage(this.getClass(), "FileTypesByMimeTypeNode.createSheet.mediaType.desc"), getDisplayName()));
return sheet;
}
@Override
public String getItemType() {
return getClass().getName();
}
}
/**
* Creates children for media type nodes, children will be MediaSubTypeNodes
* and represent one of the subtypes which are present in the database of
* their media type.
*/
private class MediaTypeNodeChildren extends ChildFactory<String> implements Observer {
String mediaType;
MediaTypeNodeChildren(String name) {
addObserver(this);
this.mediaType = name;
}
@Override
protected boolean createKeys(List<String> mediaTypeNodes) {
mediaTypeNodes.addAll(existingMimeTypeCounts.get(mediaType).keySet());
return true;
}
@Override
protected Node createNodeForKey(String subtype) {
String mimeType = mediaType + "/" + subtype;
return new MediaSubTypeNode(mimeType);
}
@Override
public void update(Observable o, Object arg) {
refresh(true);
}
}
/**
* Node which represents the media sub type in the By MIME type tree, the
* media subtype is the portion of the MIME type following the /.
*/
final class MediaSubTypeNode extends FileTypes.BGCountUpdatingNode {
@NbBundle.Messages({"FileTypesByMimeTypeNode.createSheet.mediaSubtype.name=Subtype",
"FileTypesByMimeTypeNode.createSheet.mediaSubtype.displayName=Subtype",
"FileTypesByMimeTypeNode.createSheet.mediaSubtype.desc=no description"})
private final String mimeType;
private final String subType;
private MediaSubTypeNode(String mimeType) {
super(typesRoot, Children.create(new MediaSubTypeNodeChildren(mimeType), true), Lookups.singleton(mimeType));
this.mimeType = mimeType;
this.subType = StringUtils.substringAfter(mimeType, "/");
super.setName(mimeType);
super.setDisplayName(subType);
updateDisplayName();
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-filter-icon.png"); //NON-NLS
addObserver(this);
}
/**
* This returns true because any MediaSubTypeNode that exists is going
* to be a bottom level node in the Tree view on the left of Autopsy.
*
* @return true
*/
@Override
public boolean isLeafTypeNode() {
return true;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor< T> visitor) {
return visitor.visit(this);
}
@Override
protected Sheet createSheet() {
Sheet sheet = super.createSheet();
Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
if (sheetSet == null) {
sheetSet = Sheet.createPropertiesSet();
sheet.put(sheetSet);
}
sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileTypesByMimeTypeNode.createSheet.mediaSubtype.name"), NbBundle.getMessage(this.getClass(), "FileTypesByMimeTypeNode.createSheet.mediaSubtype.displayName"), NbBundle.getMessage(this.getClass(), "FileTypesByMimeTypeNode.createSheet.mediaSubtype.desc"), getDisplayName()));
return sheet;
}
@Override
public String getItemType() {
return getClass().getName();
}
@Override
public void update(Observable o, Object arg) {
updateDisplayName();
}
@Override
String getDisplayNameBase() {
return subType;
}
@Override
long calculateChildCount() {
return existingMimeTypeCounts.get(StringUtils.substringBefore(mimeType, "/")).get(subType);
}
}
/**
* Factory for populating the contents of the Media Sub Type Node with the
* files that match MimeType which is represented by this position in the
* tree.
*/
private class MediaSubTypeNodeChildren extends BaseChildFactory<FileTypesKey> implements Observer {
private final String mimeType;
private MediaSubTypeNodeChildren(String mimeType) {
super(mimeType, new ViewsKnownAndSlackFilter<>());
addObserver(this);
this.mimeType = mimeType;
}
@Override
public void update(Observable o, Object arg) {
refresh(true);
}
@Override
protected Node createNodeForKey(FileTypesKey key) {
return key.accept(new FileTypes.FileNodeCreationVisitor());
}
@Override
protected List<FileTypesKey> makeKeys() {
try {
return Case.getCurrentCaseThrows().getSleuthkitCase()
.findAllFilesWhere(createBaseWhereExpr() + " AND mime_type = '" + mimeType + "'")
.stream().map(f -> new FileTypesKey(f)).collect(Collectors.toList()); //NON-NLS
} catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.SEVERE, "Couldn't get search results", ex); //NON-NLS
}
return Collections.emptyList();
}
@Override
protected void onAdd() {
// No-op
}
@Override
protected void onRemove() {
// No-op
}
}
}
|
{
"content_hash": "3823c22301a14de2149590219fc9c5a5",
"timestamp": "",
"source": "github",
"line_count": 498,
"max_line_length": 355,
"avg_line_length": 37.8714859437751,
"alnum_prop": 0.631389183457052,
"repo_name": "rcordovano/autopsy",
"id": "e75739290c2865ea683b539f0808d27dc50084fb",
"size": "19546",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByMimeType.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "578"
},
{
"name": "AutoIt",
"bytes": "27605"
},
{
"name": "Batchfile",
"bytes": "171962"
},
{
"name": "CSS",
"bytes": "193577"
},
{
"name": "HTML",
"bytes": "272271"
},
{
"name": "Java",
"bytes": "18367663"
},
{
"name": "JavaScript",
"bytes": "4412"
},
{
"name": "Perl",
"bytes": "12676"
},
{
"name": "Python",
"bytes": "765412"
},
{
"name": "Shell",
"bytes": "235268"
}
],
"symlink_target": ""
}
|
TextBox::InitInfo AutomapUiView::getLocationTextBoxInitInfo(const std::string_view &text, const FontLibrary &fontLibrary)
{
const TextRenderUtils::TextShadowInfo shadowInfo(
AutomapUiView::LocationTextBoxShadowOffsetX,
AutomapUiView::LocationTextBoxShadowOffsetY,
AutomapUiView::LocationTextBoxShadowColor);
return TextBox::InitInfo::makeWithCenter(
text,
AutomapUiView::LocationTextBoxCenterPoint,
AutomapUiView::LocationTextBoxFontName,
AutomapUiView::LocationTextBoxFontColor,
AutomapUiView::LocationTextBoxTextAlignment,
shadowInfo,
0,
fontLibrary);
}
TextureAssetReference AutomapUiView::getBackgroundTextureAssetRef()
{
return TextureAssetReference(std::string(ArenaTextureName::Automap));
}
TextureAssetReference AutomapUiView::getBackgroundPaletteTextureAssetRef()
{
return AutomapUiView::getBackgroundTextureAssetRef();
}
TextureAssetReference AutomapUiView::getCursorTextureAssetRef()
{
return TextureAssetReference(std::string(ArenaTextureName::QuillCursor));
}
TextureAssetReference AutomapUiView::getCursorPaletteTextureAssetRef()
{
return AutomapUiView::getBackgroundPaletteTextureAssetRef();
}
const Color &AutomapUiView::getPixelColor(const VoxelDefinition &floorDef, const VoxelDefinition &wallDef,
const TransitionDefinition *transitionDef)
{
const ArenaTypes::VoxelType floorType = floorDef.type;
const ArenaTypes::VoxelType wallType = wallDef.type;
if (floorType == ArenaTypes::VoxelType::Chasm)
{
const ArenaTypes::ChasmType chasmType = floorDef.chasm.type;
if (chasmType == ArenaTypes::ChasmType::Dry)
{
// Dry chasms are a different color if a wall is over them.
return (wallType == ArenaTypes::VoxelType::Wall) ? AutomapUiView::ColorRaised : AutomapUiView::ColorDryChasm;
}
else if (chasmType == ArenaTypes::ChasmType::Lava)
{
// Lava chasms ignore all but raised platforms.
return (wallType == ArenaTypes::VoxelType::Raised) ? AutomapUiView::ColorRaised : AutomapUiView::ColorLavaChasm;
}
else if (chasmType == ArenaTypes::ChasmType::Wet)
{
// Water chasms ignore all but raised platforms.
return (wallType == ArenaTypes::VoxelType::Raised) ? AutomapUiView::ColorRaised : AutomapUiView::ColorWetChasm;
}
else
{
DebugLogWarning("Unrecognized chasm type \"" +
std::to_string(static_cast<int>(chasmType)) + "\".");
return AutomapUiView::ColorNotImplemented;
}
}
else if (floorType == ArenaTypes::VoxelType::Floor)
{
// If nothing is over the floor, return transparent. Otherwise, choose from
// a number of cases.
if (wallType == ArenaTypes::VoxelType::None)
{
return AutomapUiView::ColorFloor;
}
else if (wallType == ArenaTypes::VoxelType::Wall)
{
if (transitionDef == nullptr)
{
// Not a transition.
return AutomapUiView::ColorWall;
}
else
{
const TransitionType transitionType = transitionDef->getType();
if ((transitionType == TransitionType::CityGate) ||
(transitionType == TransitionType::EnterInterior) ||
(transitionType == TransitionType::ExitInterior))
{
return AutomapUiView::ColorDoor;
}
else if (transitionType == TransitionType::LevelChange)
{
const TransitionDefinition::LevelChangeDef &levelChangeDef = transitionDef->getLevelChange();
return levelChangeDef.isLevelUp ? AutomapUiView::ColorLevelUp : AutomapUiView::ColorLevelDown;
}
else
{
DebugLogWarning("Unrecognized transition type \"" +
std::to_string(static_cast<int>(transitionType)) + "\".");
return AutomapUiView::ColorNotImplemented;
}
}
}
else if (wallType == ArenaTypes::VoxelType::Raised)
{
return AutomapUiView::ColorRaised;
}
else if (wallType == ArenaTypes::VoxelType::Diagonal)
{
return AutomapUiView::ColorFloor;
}
else if (wallType == ArenaTypes::VoxelType::Door)
{
return AutomapUiView::ColorDoor;
}
else if (wallType == ArenaTypes::VoxelType::TransparentWall)
{
// Transparent walls with collision (hedges) are shown, while
// ones without collision (archways) are not.
const VoxelDefinition::TransparentWallData &transparentWallData = wallDef.transparentWall;
return transparentWallData.collider ? AutomapUiView::ColorWall : AutomapUiView::ColorFloor;
}
else if (wallType == ArenaTypes::VoxelType::Edge)
{
return AutomapUiView::ColorWall;
}
else
{
DebugLogWarning("Unrecognized wall data type \"" +
std::to_string(static_cast<int>(wallType)) + "\".");
return AutomapUiView::ColorNotImplemented;
}
}
else
{
DebugLogWarning("Unrecognized floor data type \"" +
std::to_string(static_cast<int>(floorType)) + "\".");
return AutomapUiView::ColorNotImplemented;
}
}
const Color &AutomapUiView::getWildPixelColor(const VoxelDefinition &floorDef, const VoxelDefinition &wallDef,
const TransitionDefinition *transitionDef)
{
// The wilderness automap focuses more on displaying floor voxels than wall voxels.
// It's harder to make sense of in general compared to city and interior automaps,
// so the colors should probably be replaceable by an option or a mod at some point.
const ArenaTypes::VoxelType floorType = floorDef.type;
const ArenaTypes::VoxelType wallType = wallDef.type;
if (floorType == ArenaTypes::VoxelType::Chasm)
{
// The wilderness only has wet chasms, but support all of them just because.
const ArenaTypes::ChasmType chasmType = floorDef.chasm.type;
if (chasmType == ArenaTypes::ChasmType::Dry)
{
// Dry chasms are a different color if a wall is over them.
return (wallType == ArenaTypes::VoxelType::Wall) ? AutomapUiView::ColorWildWall : AutomapUiView::ColorDryChasm;
}
else if (chasmType == ArenaTypes::ChasmType::Lava)
{
// Lava chasms ignore all but raised platforms.
return (wallType == ArenaTypes::VoxelType::Raised) ? AutomapUiView::ColorWildWall : AutomapUiView::ColorLavaChasm;
}
else if (chasmType == ArenaTypes::ChasmType::Wet)
{
// Water chasms ignore all but raised platforms.
return (wallType == ArenaTypes::VoxelType::Raised) ? AutomapUiView::ColorWildWall : AutomapUiView::ColorWetChasm;
}
else
{
DebugLogWarning("Unrecognized chasm type \"" +
std::to_string(static_cast<int>(chasmType)) + "\".");
return AutomapUiView::ColorNotImplemented;
}
}
else if (floorType == ArenaTypes::VoxelType::Floor)
{
if (wallType == ArenaTypes::VoxelType::None)
{
// Regular ground is transparent; all other grounds are wall color.
const VoxelDefinition::FloorData &floorData = floorDef.floor;
const bool isRegularGround = !floorData.isWildWallColored;
if (isRegularGround)
{
return AutomapUiView::ColorFloor;
}
else
{
return AutomapUiView::ColorWildWall;
}
}
else if (wallType == ArenaTypes::VoxelType::Wall)
{
if (transitionDef == nullptr)
{
return AutomapUiView::ColorWildWall;
}
else
{
const TransitionType transitionType = transitionDef->getType();
if ((transitionType == TransitionType::CityGate) ||
(transitionType == TransitionType::EnterInterior) ||
(transitionType == TransitionType::ExitInterior))
{
// Certain wilderness voxels are rendered like walls.
// @todo: may need to revisit this for the new VoxelDefinition design (see ArenaWildUtils::menuIsDisplayedInWildAutomap()).
// - can't just rely on the new floor.isWildWallColored?
const bool isHidden = false; // @todo
return isHidden ? AutomapUiView::ColorWildWall : AutomapUiView::ColorWildDoor;
}
else if (transitionType == TransitionType::LevelChange)
{
const TransitionDefinition::LevelChangeDef &levelChangeDef = transitionDef->getLevelChange();
return levelChangeDef.isLevelUp ? AutomapUiView::ColorLevelUp : AutomapUiView::ColorLevelDown;
}
else
{
DebugLogWarning("Unrecognized transition type \"" +
std::to_string(static_cast<int>(transitionType)) + "\".");
return AutomapUiView::ColorNotImplemented;
}
}
}
else if (wallType == ArenaTypes::VoxelType::Raised)
{
return AutomapUiView::ColorWildWall;
}
else if (wallType == ArenaTypes::VoxelType::Diagonal)
{
return AutomapUiView::ColorFloor;
}
else if (wallType == ArenaTypes::VoxelType::Door)
{
return AutomapUiView::ColorWildDoor;
}
else if (wallType == ArenaTypes::VoxelType::TransparentWall)
{
return AutomapUiView::ColorFloor;
}
else if (wallType == ArenaTypes::VoxelType::Edge)
{
const VoxelDefinition::EdgeData &edgeData = wallDef.edge;
// For some reason, most edges are hidden.
const bool isHiddenEdge = (edgeData.facing == VoxelFacing2D::PositiveX) ||
(edgeData.facing == VoxelFacing2D::NegativeX) ||
(edgeData.facing == VoxelFacing2D::NegativeZ);
if (isHiddenEdge)
{
return AutomapUiView::ColorFloor;
}
else
{
return AutomapUiView::ColorWildWall;
}
}
else
{
DebugLogWarning("Unrecognized wall data type \"" +
std::to_string(static_cast<int>(wallType)) + "\".");
return AutomapUiView::ColorNotImplemented;
}
}
else
{
DebugLogWarning("Unrecognized floor data type \"" +
std::to_string(static_cast<int>(floorType)) + "\".");
return AutomapUiView::ColorNotImplemented;
}
}
Buffer2D<uint32_t> AutomapUiView::makeAutomap(const CoordInt2 &playerCoord, CardinalDirectionName playerCompassDir,
bool isWild, const LevelInt2 &levelDims, const ChunkManager &chunkManager)
{
// Create scratch surface triple the size of the voxel area so that all directions of the player's arrow
// are representable in the same texture. This may change in the future for memory optimization.
constexpr int automapDim = ChunkUtils::CHUNK_DIM * ((AutomapUiView::ChunkDistance * 2) + 1);
constexpr int surfaceDim = automapDim * AutomapUiView::PixelSize;
Buffer2D<uint32_t> dstBuffer(surfaceDim, surfaceDim);
// Fill with transparent color first (used by floor voxels).
const Color &floorColor = AutomapUiView::ColorFloor;
dstBuffer.fill(floorColor.toARGB());
const ChunkInt2 &playerChunk = playerCoord.chunk;
ChunkInt2 minChunk, maxChunk;
ChunkUtils::getSurroundingChunks(playerChunk, AutomapUiView::ChunkDistance, &minChunk, &maxChunk);
// Lambda for filling in a chunk voxel in the map surface.
auto drawSquare = [&dstBuffer, &minChunk, &maxChunk](const CoordInt2 &coord, const Color &color)
{
// The min chunk origin is at the top right corner of the texture. +X is south, +Z is west
// (strangely, flipping the horizontal coordinate here does not mirror the resulting texture,
// therefore the mirroring is done in the pixel drawing loop).
const int automapX = ((coord.chunk.y - minChunk.y) * ChunkUtils::CHUNK_DIM) + coord.voxel.y;
const int automapY = ((coord.chunk.x - minChunk.x) * ChunkUtils::CHUNK_DIM) + coord.voxel.x;
const int surfaceWidth = dstBuffer.getWidth();
const int xOffset = automapX * AutomapUiView::PixelSize;
const int yOffset = automapY * AutomapUiView::PixelSize;
const uint32_t colorARGB = color.toARGB();
uint32_t *pixels = dstBuffer.get();
for (int h = 0; h < AutomapUiView::PixelSize; h++)
{
const int yCoord = yOffset + h;
for (int w = 0; w < AutomapUiView::PixelSize; w++)
{
const int xCoord = xOffset + w;
const int index = (surfaceWidth - xCoord - 1) + (yCoord * surfaceWidth);
pixels[index] = colorARGB;
}
}
};
// Fill in squares on the automap.
for (SNInt chunkX = minChunk.x; chunkX <= maxChunk.x; chunkX++)
{
for (WEInt chunkZ = minChunk.y; chunkZ <= maxChunk.y; chunkZ++)
{
const ChunkInt2 chunkPos(chunkX, chunkZ);
const Chunk *chunk = chunkManager.tryGetChunk(chunkPos);
DebugAssert(chunk != nullptr);
for (SNInt x = 0; x < ChunkUtils::CHUNK_DIM; x++)
{
for (WEInt z = 0; z < ChunkUtils::CHUNK_DIM; z++)
{
const Chunk::VoxelID floorVoxelID = chunk->getVoxel(x, 0, z);
const Chunk::VoxelID wallVoxelID = chunk->getVoxel(x, 1, z);
const VoxelDefinition &floorVoxelDef = chunk->getVoxelDef(floorVoxelID);
const VoxelDefinition &wallVoxelDef = chunk->getVoxelDef(wallVoxelID);
const TransitionDefinition *transitionDef = chunk->tryGetTransition(VoxelInt3(x, 1, z));
// Decide which color to use for the automap pixel.
Color color;
if (isWild)
{
color = AutomapUiView::getWildPixelColor(floorVoxelDef, wallVoxelDef, transitionDef);
}
else
{
// @todo: make a coord-to-level-voxel function for this
const LevelInt2 levelPos(
(chunkPos.x * ChunkUtils::CHUNK_DIM) + x,
(chunkPos.y * ChunkUtils::CHUNK_DIM) + z);
const bool isInsideLevelBounds = (chunkX >= 0) && (chunkZ >= 0) && (levelPos.x < levelDims.x) && (levelPos.y < levelDims.y);
if (isInsideLevelBounds)
{
color = AutomapUiView::getPixelColor(floorVoxelDef, wallVoxelDef, transitionDef);
}
else
{
color = floorColor;
}
}
drawSquare(CoordInt2(chunkPos, VoxelInt2(x, z)), color);
}
}
}
}
// Lambda for drawing the player's arrow in the automap. It's drawn differently
// depending on their direction.
auto drawPlayer = [&dstBuffer](SNInt x, WEInt z, CardinalDirectionName cardinalDirection)
{
const int surfaceX = dstBuffer.getWidth() - AutomapUiView::PixelSize - (z * AutomapUiView::PixelSize);
const int surfaceY = x * AutomapUiView::PixelSize;
uint32_t *pixels = dstBuffer.get();
// Draw the player's arrow within the map pixel.
const std::vector<Int2> &offsets = AutomapUiView::PlayerArrowPatterns.at(cardinalDirection);
for (const auto &offset : offsets)
{
const int index = (surfaceX + offset.x) + ((surfaceY + offset.y) * dstBuffer.getWidth());
pixels[index] = AutomapUiView::ColorPlayer.toARGB();
}
};
// Player will always be rendered in the center chunk, "local" to the rendered chunks.
const SNInt playerLocalX = (AutomapUiView::ChunkDistance * ChunkUtils::CHUNK_DIM) + playerCoord.voxel.x;
const WEInt playerLocalZ = (AutomapUiView::ChunkDistance * ChunkUtils::CHUNK_DIM) + playerCoord.voxel.y;
drawPlayer(playerLocalX, playerLocalZ, playerCompassDir);
return dstBuffer;
}
UiTextureID AutomapUiView::allocMapTexture(const GameState &gameState, const CoordInt2 &playerCoordXZ,
const VoxelDouble2 &playerDirection, const ChunkManager &chunkManager, Renderer &renderer)
{
const CardinalDirectionName playerCompassDir = CardinalDirection::getDirectionName(playerDirection);
const bool isWild = [&gameState]()
{
const MapDefinition &activeMapDef = gameState.getActiveMapDef();
return activeMapDef.getMapType() == MapType::Wilderness;
}();
const MapDefinition &mapDef = gameState.getActiveMapDef();
const MapInstance &mapInst = gameState.getActiveMapInst();
const LevelDefinition &activeLevelDef = mapDef.getLevel(mapInst.getActiveLevelIndex());
const LevelInt2 levelDims(activeLevelDef.getWidth(), activeLevelDef.getDepth());
Buffer2D<uint32_t> automapBuffer = AutomapUiView::makeAutomap(playerCoordXZ, playerCompassDir, isWild, levelDims, chunkManager);
const BufferView2D<const uint32_t> automapBufferView(
automapBuffer.get(), automapBuffer.getWidth(), automapBuffer.getHeight());
UiTextureID textureID;
if (!renderer.tryCreateUiTexture(automapBufferView, &textureID))
{
DebugCrash("Couldn't create UI texture for automap.");
}
return textureID;
}
UiTextureID AutomapUiView::allocBgTexture(TextureManager &textureManager, Renderer &renderer)
{
const TextureAssetReference paletteTextureAssetRef = AutomapUiView::getBackgroundPaletteTextureAssetRef();
const TextureAssetReference textureAssetRef = AutomapUiView::getBackgroundTextureAssetRef();
UiTextureID textureID;
if (!TextureUtils::tryAllocUiTexture(textureAssetRef, paletteTextureAssetRef, textureManager, renderer, &textureID))
{
DebugCrash("Couldn't create UI texture for automap background.");
}
return textureID;
}
UiTextureID AutomapUiView::allocCursorTexture(TextureManager &textureManager, Renderer &renderer)
{
const TextureAssetReference paletteTextureAssetRef = AutomapUiView::getCursorPaletteTextureAssetRef();
const TextureAssetReference textureAssetRef = AutomapUiView::getCursorTextureAssetRef();
UiTextureID textureID;
if (!TextureUtils::tryAllocUiTexture(textureAssetRef, paletteTextureAssetRef, textureManager, renderer, &textureID))
{
DebugCrash("Couldn't create UI texture for automap cursor.");
}
return textureID;
}
|
{
"content_hash": "1849f492d69a6e0a608ed387eaef4230",
"timestamp": "",
"source": "github",
"line_count": 453,
"max_line_length": 130,
"avg_line_length": 36.06843267108168,
"alnum_prop": 0.7295428116775813,
"repo_name": "afritz1/OpenTESArena",
"id": "cfd17938efef8fcbe3bd130fb0f86cb099e53ab1",
"size": "16958",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "OpenTESArena/src/Interface/AutomapUiView.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "3026496"
},
{
"name": "CMake",
"bytes": "17544"
}
],
"symlink_target": ""
}
|
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('pre-fill', 'Integration | Component | pre fill', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{pre-fill}}`);
assert.equal(this.$().text().trim(), '');
});
|
{
"content_hash": "5c3b25fa3f650d56215de35c1376a5bd",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 72,
"avg_line_length": 30.4,
"alnum_prop": 0.6644736842105263,
"repo_name": "gabycampagna/frontend",
"id": "2932c3e54a901be7bf98f570b2da292c7e0c03e0",
"size": "456",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tests/integration/components/pre-fill-test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "119927"
},
{
"name": "HTML",
"bytes": "404364"
},
{
"name": "JavaScript",
"bytes": "1815942"
}
],
"symlink_target": ""
}
|
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <ogg/ogg.h>
#include <theora/theoradec.h>
#include "ogv-decoder-video.h"
#include "ogv-ogg-support.h"
/* Video decode state */
th_info theoraInfo;
th_comment theoraComment;
th_setup_info *theoraSetupInfo;
th_dec_ctx *theoraDecoderContext;
int theoraHeaders = 0;
int theoraProcessingHeaders;
void ogv_video_decoder_init() {
/* init supporting Theora structures needed in header parsing */
th_comment_init(&theoraComment);
th_info_init(&theoraInfo);
}
int ogv_video_decoder_process_frame(const char *data, size_t data_len);
int ogv_video_decoder_process_header(const char *data, size_t data_len) {
ogg_packet oggPacket;
ogv_ogg_import_packet(&oggPacket, data, data_len);
// hack, theora looks for packet b_o_s
if (theoraHeaders == 0) {
oggPacket.b_o_s = 256;
}
theoraHeaders++;
theoraProcessingHeaders = th_decode_headerin(&theoraInfo, &theoraComment, &theoraSetupInfo, &oggPacket);
if (theoraProcessingHeaders == 0) {
// We've completed the theora header
theoraDecoderContext = th_decode_alloc(&theoraInfo, theoraSetupInfo);
int hdec = !(theoraInfo.pixel_fmt & 1);
int vdec = !(theoraInfo.pixel_fmt & 2);
int display_width = theoraInfo.pic_width;
int display_height = theoraInfo.pic_height;
if (theoraInfo.aspect_numerator > 0 && theoraInfo.aspect_denominator > 0) {
display_width = display_width * theoraInfo.aspect_numerator / theoraInfo.aspect_denominator;
}
ogvjs_callback_init_video(theoraInfo.frame_width, theoraInfo.frame_height,
hdec, vdec,
(float) theoraInfo.fps_numerator / theoraInfo.fps_denominator,
theoraInfo.pic_width, theoraInfo.pic_height,
theoraInfo.pic_x, theoraInfo.pic_y,
display_width, display_height);
// Last header packet is also first data packet.
return ogv_video_decoder_process_frame(data, data_len);
} else if (theoraProcessingHeaders > 0) {
return 1;
} else {
printf("Error parsing theora headers: %d.\n", theoraProcessingHeaders);
return 0;
}
}
int ogv_video_decoder_process_frame(const char *data, size_t data_len) {
ogg_packet oggPacket;
ogv_ogg_import_packet(&oggPacket, data, data_len);
int ret = th_decode_packetin(theoraDecoderContext, &oggPacket, NULL);
if (ret == 0 || ret == TH_DUPFRAME) {
th_ycbcr_buffer ycbcr;
th_decode_ycbcr_out(theoraDecoderContext, ycbcr);
int hdec = !(theoraInfo.pixel_fmt & 1);
int vdec = !(theoraInfo.pixel_fmt & 2);
ogvjs_callback_frame(ycbcr[0].data, ycbcr[0].stride,
ycbcr[1].data, ycbcr[1].stride,
ycbcr[2].data, ycbcr[2].stride,
theoraInfo.frame_width, theoraInfo.frame_height,
hdec, vdec);
return 1;
} else {
printf("Theora decoder failed mysteriously? %d\n", ret);
return 0;
}
}
void ogv_video_decoder_destroy() {
if (theoraDecoderContext) {
th_decode_free(theoraDecoderContext);
theoraDecoderContext = NULL;
}
th_comment_clear(&theoraComment);
th_info_clear(&theoraInfo);
}
|
{
"content_hash": "85624ada621498bb792459271df6458e",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 105,
"avg_line_length": 31.548076923076923,
"alnum_prop": 0.6638220054861322,
"repo_name": "xzf158/ogv.js",
"id": "a106cf36f580d264a09a01b32c4d781aa63edc6f",
"size": "3281",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/ogv-decoder-video-theora.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "6225"
},
{
"name": "C",
"bytes": "42385"
},
{
"name": "C++",
"bytes": "158"
},
{
"name": "CSS",
"bytes": "5545"
},
{
"name": "HTML",
"bytes": "2282"
},
{
"name": "JavaScript",
"bytes": "164418"
},
{
"name": "Makefile",
"bytes": "14922"
},
{
"name": "Shell",
"bytes": "10891"
}
],
"symlink_target": ""
}
|
[](https://travis-ci.org/vvillee/places)
[](https://waffle.io/vvillee/places)
[](https://waffle.io/vvillee/places)
Places
======
Show places on map
Overview
--------
This application displays places nearby you on a map. It is easy to use with mobile or desktop browser. As an administrator you may configure the places and their location.
### Instructions For User
1. Go to application URL
2. Select your location (if not located automatically)
3. Application shows you nearby places within the viewport
4. Zoom the map in or out to see more or less places
### Instruction For Developer
There will be instructions.
### Technical notes
Backend with Node.js and MongoDB database. This is deployable to Heroku with MongoSoup addon
### Live
https://nearby-places-app.herokuapp.com/
### Draft wireframe for V1.0
https://raw.githubusercontent.com/vvillee/places/master/docs/places_screens.png
|
{
"content_hash": "b298faf578d74536f1ac7cd012da361b",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 172,
"avg_line_length": 31.864864864864863,
"alnum_prop": 0.7616624257845632,
"repo_name": "vvillee/places",
"id": "0320b46a36da29df402e5cdbada38e95135572aa",
"size": "1179",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1848"
}
],
"symlink_target": ""
}
|
<script src="https://apis.google.com/js/platform.js?onload=initGooglePlatform" async defer></script>
<script>
window.googleLogin = function() {
};
function initGooglePlatform() {
gapi.load('auth2', function() {
window.googleLogin = function() {
gapi.auth2.authorize({
client_id: '<?php echo $clientId; ?>',
scope: 'email profile',
response_type: 'id_token permission'
}, function(response) {
if (response.error) {
// An error happened!
return;
}
//var accessToken = response.access_token;
var idToken = response.id_token;
var form = document.createElement('form');
document.body.appendChild(form);
form.action = '<?php echo $authUrl; ?>';
form.method = 'post';
var input = document.createElement('input');
form.appendChild(input);
input.name = 'idtoken';
input.value = idToken;
input.type = 'hidden';
form.submit();
});
}
document.getElementById('google-authenticator').innerHTML = <?php
echo json_encode($this->template($loginButtonTemplate, [
'url' => 'javascript:googleLogin()',
'authentication' => $authenticator
]))
?>;
});
}
</script>
<span id="google-authenticator"></span>
|
{
"content_hash": "3594c22b0cd2465e570816905a112616",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 100,
"avg_line_length": 31.433962264150942,
"alnum_prop": 0.46338535414165666,
"repo_name": "CatLabInteractive/Accounts",
"id": "a289d0188e365831739d869b28da39f4f9a5f8bb",
"size": "1666",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/CatLab/Accounts/templates/authenticators/deligated/google/login-script.phpt",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "856"
},
{
"name": "PHP",
"bytes": "153390"
},
{
"name": "Shell",
"bytes": "159"
}
],
"symlink_target": ""
}
|
layout: default
title: DataStructures
---
# Data Structures
<!-- TOC -->
- [Amortised analysis](#amortised-analysis)
- [Stack ADT](#stack-adt)
- [List ADT](#list-adt)
- [Queue ADT](#queue-adt)
- [Dictionary ADT](#dictionary-adt)
- [Priority queue ADT](#priority-queue-adt)
- [Disjoint Set ADT](#disjoint-set-adt)
- [Flat forest and deep forest](#flat-forest-and-deep-forest)
- [Lazy forest](#lazy-forest)
- [Binary Search Tree](#binary-search-tree)
- [BST Deletion](#bst-deletion)
- [2-3-4 tree](#2-3-4-tree)
- [2-3-4 Insertion](#2-3-4-insertion)
- [Red Black Tree](#red-black-tree)
- [RBT Insertion](#rbt-insertion)
- [B-tree](#b-tree)
- [B-tree insertion](#b-tree-insertion)
- [B-tree deletion](#b-tree-deletion)
- [Hash-tables](#hash-tables)
- [Chaining](#chaining)
- [Open addressing](#open-addressing)
- [Binary heap](#binary-heap)
- [Binomial heap](#binomial-heap)
- [Fibonacci heap](#fibonacci-heap)
- [Analysis using potentials](#analysis-using-potentials)
- [Relationship to Fibonacci numbers](#relationship-to-fibonacci-numbers)
<!-- /TOC -->
## Amortised analysis
- Amortised analysis considers the average cost of a sequence of operations in a data structure.
- Aggregate analysis puts an upper bound on the total cost of *n* operations then states that the amortised cost is $T(n)/n$.
- If we have a sequence of operations with true cost $c_i$, if we can invent $c_i'$ such that $\sum c_i \leq \sum c_i'$, then these $c_i'$ are valid amortised costs.
$$\text{aggregate true cost} \leq \text{aggregate amortised cost}$$
- An alternative method to find amortised costs is the **potential method**:
- $\Phi$ is a function that maps possible states of the data structure to real numbers $\geq 0$
- $\Phi = 0$ for the empty data structure.
- $c' = c + \Phi(S_{post}) - \Phi(S_{ante})$
- $\Phi$ should be chosen such that 'normal' operations, which build up the 'mess' in a data structure, lead to increasing $\Phi$. This builds up credit for the expensive operation that cleans that data structure.
- As in physics, the total change in potential between two states is path-independent. This can be used to prove that the potential method results in a valid amortised cost.
- For example, with a dynamic array we can use $\Phi = 2 \times (\text{num items}) - \text{capacity}$
- normal insert has true cost $O(1)$ and amortised cost $O(1)$
- doubling the array has true cost $O(n)$ but amortised cost $O(1)$, because $\Delta \Phi = 2-n$.
## Stack ADT
LIFO data structure that only offers operations for the top item
```java
ADT Stack {
boolean isEmpty();
void push(Item x);
Item pop(); // precondition: !isEmpty
Item top(); // precondition: !isEmpty
}
```
Commonly implemented using an array and a TOS (top-of-stack) index or linked list.
## List ADT
```java
ADT List {
boolean isEmpty();
Item head(); // precondition: !isEmpty
void prepend(Item x);
List tail(); // precondition: !isEmpty
void setTail(List newTail); // precondition: !isEmpty
}
```
## Queue ADT
Similar to a stack, but is LIFO.
```java
ADT Queue {
boolean isEmpty();
void push(Item x);
Item pop(); // precondition: !isEmpty
Item first(); // precondition: !isEmpty
}
```
A double-ended queue (**deque**) generalises the stack/queue to a data structure that allows insertions and extractions at the front or rear.
## Dictionary ADT
```java
ADT Dictionary {
void set(Key k, Value v);
Value get(Key k);
void delete(Key k);
}
```
- If they keys are drawn from a relatively small range of integers, we can use **direct addressing** where the keys are just indices into an array, in which the values would be stored.
- However, dictionaries are most often implemented as [binary search trees](#binary-search-tree).
## Priority queue ADT
- Used to keep track of a dynamic set of objects whose keys support a total ordering.
- Like a FIFO queue, except each key corresponds to a priority – items with higher priority move to the top.
- Normally implemented as heaps.
```java
ADT PriorityQueue {
void insert(Item x)
Item first();
Item popmin();
void decreasekey();
void delete(Item x);
}
```
## Disjoint Set ADT
- Used to keep track of a dynamic collection of items in disjoint sets (e.g Kruskal)
- Each set is referred to by a handle, e.g a representative element from the set, or a hash ID. It doesn't matter as long as it is stable.
```java
ADT DisjointSet {
Handle get_set_with(Item x);
void add_singleton(Item x);
void merge(Handle x, Handle y);
}
```
### Flat forest and deep forest
- In the **flat forest** implementation, items in a set are stored as a linked list, but they also point to the set's handle.
- `get_set_with` is $O(1)$.
- to `merge` we just iterate through one set in $O(n)$ and update their pointers.
- using the **weighted union heuristic**, we should keep track of the size of each set and always update the pointers on the smaller set.
- the aggregate cost of *m* operations, *n* of which are `add_singleton`, is $O(m + n \lg n)$.
- Alternatively, to make `merge` faster, we can just build a deeper tree by attaching one tree to the other, i.e **deep forest**
- although `merge` becomes $O(1)$, `get_set_with` needs to walk up the tree to find the root.
- using the **union by rank heuristic**, we should keep track of the rank of each root (height) and attach the shorter tree to the taller one.
### Lazy forest
- In order to get the best benefits of flat and deep trees, we defer cleanup in the style of the Fibonacci heap, using the **path compression heuristic**.
- `merge` is the same as in a deep forest: update the handle of the shorter tree to point to the handle of the taller tree.
- `get_set_with(x)` walks up the tree to find the root, then walks up again making *x* and all its parents point directly to the root.
- The ranks are not updated during cleanup, thus they only represent an upper bound.
- It can be shown the the cost of *m* operations on *n* items is $\approx O(m)$.
## Binary Search Tree
[*Interactive practice*](https://www.cs.usfca.edu/~galles/visualization/BST.html)
- Binary search trees (BSTs) are made of nodes that point to two sub-trees. The left sub-tree will be items smaller than the key of the node, right sub-tree will be larger items.
- The **successor** will be the left-most node in the right subtree (if that exists). Otherwise, walk up the tree until the link goes up-and-right.
- If a node has two children, its successor has no left child (otherwise there would be a smaller node).
- Most operations are $O(\lg n)$ if the tree is balanced, but balance cannot be guaranteed.
- Deletion:
- it is trivial to delete a leaf node or a node with one child
- to delete a node with two children, replace it with its successor (which must come from the right subtree), then delete, because the successor has no left child.
## 2-3-4 tree
- Similar to a BST, except each node can now have 2, 3, or 4 children (i.e 1, 2, 3 keys).
- A 2-3-4 tree is always balanced, so searching is bounded by $O(h)$.
- Always try to insert into the bottom layer: if you see any 4-nodes along the way, split them into two 2-nodes. Thus the tree can only increase in height if the root is a 4-node, in which case it is split into three 2-nodes.
## Red Black Tree
[*Interactive practice*](https://www.cs.usfca.edu/~galles/visualization/RedBlack.html)
An RBT is a BST that satisfies five invariants:
1. Every node is either red or black
2. The root is black
3. All leaf nodes are black, and don't contain data
4. If a node is red, its children are both black.
5. **Any path from a given node to leaves contains the same number of black nodes.**
Red black trees are isomorphic to 2-3-4 trees, but has the advantage that it is easier to code:
<center>
<img src="{{ site.imageurl }}/note_img/234_isomporphism.jpg" style="width:50%;"/>
</center>
Operations that don't modify the tree structure are the same as for BSTs. But in order to preserve the RBT invariants, other operations require **rotations**.
<center>
<img src="{{ site.imageurl }}/note_img/bst_rotation.png" style="width:80%;"/>
</center>
In the diagram above, D has been rotated to the right, then B has been rotated to the left. These rotations apply to non-root nodes as well.
To rotate a parent *x* right given its left child *y*:
```python
if y != null:
x.l = y.r
y.r = x
x = y
```
Likewise, a left-rotation:
```python
if y != null:
x.r = y.l
y.l = x
x = y
```
### RBT Insertion
- Let *p* denote the parent, *g* the grandparent, *u* the uncle, and *n* the new node to be inserted.
- If *p* is black, we can just insert a red child directly.
- If *p* is red, we will insert a red *n* then clean up the tree. In this case, *g* must be black (because the tree cannot have two red nodes in a row).
**Case 1 – red uncle**
<center>
<img src="{{ site.imageurl }}/note_img/rbt_case1.png" style="width:50%;"/>
</center>
- Easy: flip colour of *p*, *u*, *g*.
- If *g* is a root, just recolour it black and finish.
- If *g* has a red parent, we have moved the problem up two levels.
**Case 2 – black uncle, bent**
<center>
<img src="{{ site.imageurl }}/note_img/rbt_case2.png" style="width:50%;"/>
</center>
Left-rotate *n* and we are now in case 3.
**Case 3 – black uncle, straight**
- Swap colours of *p* and *g*, then right-rotate *g*.
<center>
<img src="{{ site.imageurl }}/note_img/rbt_case3.png" style="width:70%;"/>
</center>
## B-tree
- B-trees are a generalisation of BSTs with a high branching factor, with the idea that children may actually be stored on a separate disc.
- Each node of a B-tree has a lower and upper bound on the number of keys it may contain (except the root has no lower bound).
- A B-tree is parameterised by a **minimum degreee** *t* such that each node will have between *t* and *2t* pointers. A 2-3-4 tree is thus a B-tree of degree 2.
- Insertion is generalised from 2-3-4 trees: on the way down, whenever you find a full node, split it into two and move the median key up one level. Insertion can only happen in the bottom level.
### B-tree deletion
- We can only delete a key from the bottom otherwise its children lose their separator. Hence we start by replacing the key with its successor like with BSTs.
- But we must prepare the tree first, because deleting might violate the minimum fullness requirement.
- Hence if deletion would cause the node to become too small, we **refill** a node, redistributing some keys from its siblings if they can afford to lose some, or merging.
- Merging siblings makes the parent lose a key, so we might have to recursively refill the parent.
```python
def delete(k):
if k is in bottom node B:
if B cannot lose key:
refill(B)
delete k from B
else:
swap(k, successor(k))
# now k is in a bottom node
delete(k)
def refill(B):
"""
PRECONDITION: B has t-1 keys
POSTCONDITION: B has more than t-1 keys
"""
if either sibling can lose keys:
redistribute keys to B
else:
# B and all siblings have t-1 keys
merge B with a sibling
if B.parent has fewer than t-1 keys:
refill(B.parent)
```
## Hash-tables
- A hash-table is a data structure that may be used to implement the dictionary ADT.
- Keys are mapped to an integer between 0 and $m-1$ with some **hash function** $h(k)$, and can then be stored at that index in an array of size *m*.
- If two keys map to the same location, there is a **hash collision**. This can be resolved by **chaining** or **open-addressing**
- Chaining is a simple solution:
- Each array location points to a linked list.
- With a good hash function, keys will be evenly distributed in the array.
- Worst case is $O(n)$ if all items hash to one bucket.
### Open addressing
- $h(k)$ is the first preference for where to store a given key. If it is already full, we use some rule to **probe** the hash table for another position.
- We then follow this succession rule every time we query an item, checking for key equality.
- When an item is deleted, it should be marked as deleted rather than just removed – otherwise it interferes with the probing.
- If insertion causes the occupancy to increase beyond a certain threshold, the size of the hash table should be increased (like with dynamic arrays).
- **Linear probing** simply finds the next available memory cell and inserts it there.
- return $h(k) + j \mod m$, where *j* is the number of attempts
- leads to **primary clustering**, in which failed attempts hit the same bucket and overflow to the same buckets, resulting in long runs of occupied buckets
- **Quadratic probing** is an improvement that increases the space between guesses:
- return $(h(k) + cj + dj^2) \mod m$
- doesn't suffer from primary clustering, but suffers from **secondary clustering** in which two keys that hash to the same value lead to the same probing sequence.
- **Double hashing** suffers from neither primary nor secondary clustering:
- return $h_1(k) + j h_2(k) \mod m$ using different hash functions.
- thus keys that hash to the same value will have different probing sequences
- best open-addressing scheme in terms of collision reduction but has overhead of extra hash
## Binary heap
- A heap is an **almost full binary tree** which satisfies the **heap property**, where each node has a value at least as large as those of its children. Thus the root node is the maximum element.
- The height of a binary heap is $\left \lfloor \lg n \right \rfloor$.
- Isomorphic to an array where `a[k] >= a[2k+1]` and `a[k] >= a[2k+2]`.
- Min-heaps can be used to implement the priority queue ADT, allowing for easy access of the highest priority item.
- All operations are bounded by $O(\lg n)$ except for merging, which can only be done in $O(n)$ by concatenating the two arrays and heapifying.
## Binomial heap
- One problem with binary heaps is that they have an $O(n_1 + n_2)$ cost to merge (concatenate arrays then heapify).
- A binomial tree of order 0 is a single node (height 0).
- A binomial tree of order *k* is obtained by combining two binomial trees of order $k-1$.
- contains $2^k$ nodes
- height is always equal to order
<center>
<img src="{{ site.imageurl }}note_img/binomial_heap.png" style="width:80%;"/>
</center>
- A binomial heap is a forest of **binomial trees**, at most one of each order.
- if a heap contains *n* nodes, it contains $O(\lg n)$ binomial trees, the largest of which has order $O(\lg n)$.
- can be thought of as a binary number
- `first` is $O(\lg n)$ because we have to scan through the root of each binomial tree in the heap.
- Merging is very similar to binary addition, and is thus $O(\lg (n_1 + n_2))$.
- `popmin` requires $O(\lg n)$ to find the minimum. The children of this minimum are another binomial heap, so after deleting the minimum we can merge it with the rest in $O(\lg n)$.
- `push` can be viewed as merging a new binomial heap which only contains a tree of order 0. It is $O(1)$ amortised because most operations don't touch many trees, but $O(\lg n)$ worst case.
## Fibonacci heap
- Designed to make Dijkstra's algorithm more practical by offering amortised $O(1)$ `push` and `decreasekey`.
- Idea is to be lazy for these operations, only cleaning up when `popmin` is called.
- Uses a list of heaps (pointers to roots), as well as a pointer to `minroot`.
- `push` creates a new heap with one node, adds it to the list of heaps, and updates `minroot` if necessary.
- `popmin` requires cleanup:
- delete the `minroot` node, then promote its children to be roots
- while there are two roots with the same degree, merge them.
- update `minroot`
```python
def push(k, v):
h = new heap(k, v) # only one node
add h to rootlist
update minroot if k < minroot.key
def popmin():
min = copy(minroot)
for child in minroot.children:
clear child mark
add child to rootlist
delete minroot
cleanup()
minroot = minimum of rootlist
return min
def cleanup():
"""
To cleanup, we use an auxiliary array where the index corresponds
to the degree. If there is already a tree in an index, merge.
"""
root_array = [None, None, ...]
for tree t in roots:
x = t
while root_array[x.degree] is not None:
u = root_array[x.degree]
root_array[x.degree] = None
x = merge(x, u)
root_array[x.degree] = x
return [root for root in root_array if root is not None]
```
- `decreasekey` is slightly more complicated:
- instead of just dumping heap violations into the list, we may also need to dump its parent. Otherwise the `minroot` heap might be wide and shallow, leading to slow `popmin`
- if you lose one child, you get marked as a `loser` node
- if you lose two children, you get dumped into the root list and the mark is removed.
```python
def decreasekey(v, new_key):
let n be the node containing v
n.key = new_key
if n violates heap condition:
repeat:
p = n.parent
remove n from p.children
insert n into rootlist, updaing minroot
n.loser = False
n = p
until p.loser == False
if p not in rootlist:
p.loser = True
```
### Analysis using potentials
- We need $\Phi$ to increase for `push` and `decreasekey` to build up for the expensive `popmin`, which does all the cleanup. Each `push` and `decreasekey` adds a root, while `popmin` removes the `loser` mark. Thus:
$$\Phi = \text{num roots} + 2(\text{num loser nodes})$$
- Every `push` has $\Delta \Phi = 1$, so the cost is $O(1)$ amortised.
- For `decreasekey`, the cost depends on whether the parents are losers etc, but the total amortised cost is still $O(1)$.
- The cost of `popmin` will depend on $d_{max}$, the upper bound on the degree of any node in the heap.
- promoting the children of `minroot` has true cost $O(d_{max})$, and the same amortised cost.
- cleanup is $O(d_{max})$ as well.
### Relationship to Fibonacci numbers
- As a consequence of the grandchild rule, if a node in a Fibonacci heap has *d* children, then that the subtree rooted at that node has more than $\geq F_{d+2}$, where *F* is a Fibonacci number.
- Consider a node *x* in the Fibonacci heap, with children $y_1, y_2, \ldots, y_d$ in the order which they became children of *x*.
- When *x* acquired $y_2$, it already had $y_1$, so $y_2$ must have had $\geq 1$ child for it to be merged. Likewise, $y_3$ must have had $\geq 2$ children, $y_d$ must have had $\geq d -1$ children.
- But `decreasekey` could have caused them to lose at most one child.
- The total number of nodes is then bounded by:
$$N_d \geq N_{d-2} + N_{d-3} + \cdots + N_0 + N_0 + 1$$
- Where $N_0 \geq 0$, corresponding to either $y_1$ or $y_2$.
- Thus by definition of the Fibonacci numbers:
$$n \geq F_{d+2} \geq \phi^d \implies d_{max} = O(\log n)$$
|
{
"content_hash": "3a36e2777673bdd564e22df138bf7487",
"timestamp": "",
"source": "github",
"line_count": 446,
"max_line_length": 225,
"avg_line_length": 43.044843049327355,
"alnum_prop": 0.6894468173768101,
"repo_name": "surelyourejoking/ReasonableDeviations",
"id": "a9fbd452f2b63096c9bf107c84a8f9a54cc097a6",
"size": "19212",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "_notes/DataStructures.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "14031"
},
{
"name": "HTML",
"bytes": "6665"
}
],
"symlink_target": ""
}
|
module Mongoid
module Sadstory
VERSION = "0.0.2"
end
end
|
{
"content_hash": "ba5b823cdda7584ff7890c66277ceba6",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 21,
"avg_line_length": 13,
"alnum_prop": 0.6615384615384615,
"repo_name": "netguru/mongoid-sadstory",
"id": "dbfd7823f23c91ad8b5c80e399bc5f43f3ad5374",
"size": "65",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/mongoid/sadstory/version.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "4961"
}
],
"symlink_target": ""
}
|
!-----------------------------------------------------------------------
! Skeleton 2-1/2D Darwin PIC code
! written by Viktor K. Decyk, UCLA
program dpic2
use dpush2_h
implicit none
! indx/indy = exponent which determines grid points in x/y direction:
! nx = 2**indx, ny = 2**indy.
integer, parameter :: indx = 9, indy = 9
! npx/npy = number of electrons distributed in x/y direction.
integer, parameter :: npx = 3072, npy = 3072
! ndim = number of velocity coordinates = 3
integer, parameter :: ndim = 3
! tend = time at end of simulation, in units of plasma frequency.
! dt = time interval between successive calculations.
! qme = charge on electron, in units of e.
real, parameter :: tend = 10.0, dt = 0.1, qme = -1.0
! vtx/vty = thermal velocity of electrons in x/y direction
! vx0/vy0 = drift velocity of electrons in x/y direction.
real, parameter :: vtx = 1.0, vty = 1.0, vx0 = 0.0, vy0 = 0.0
! vtx/vz0 = thermal/drift velocity of electrons in z direction
real, parameter :: vtz = 1.0, vz0 = 0.0
! ax/ay = smoothed particle size in x/y direction
! ci = reciprocal of velocity of light.
real :: ax = .912871, ay = .912871, ci = 0.1
! idimp = number of particle coordinates = 5
! ipbc = particle boundary condition: 1 = periodic
! sortime = number of time steps between standard electron sorting
integer :: idimp = 5, ipbc = 1, sortime = 50
! omx/omy/omz = magnetic field electron cyclotron frequency in x/y/z
real :: omx = 0.4, omy = 0.0, omz = 0.0
! ndc = number of corrections in darwin iteration
integer :: ndc = 1
! wke/we = particle kinetic/electrostatic field energy
! wf/wm/wt = magnetic field/transverse electric field/total energy
real :: wke = 0.0, we = 0.0, wf = 0.0, wm = 0.0, wt = 0.0
real :: zero = 0.0
! declare scalars for standard code
integer :: k
integer :: np, nx, ny, nxh, nyh, nxe, nye, nxeh, nxyh, nxhy
integer :: mdim, ny1, ntime, nloop, isign
real :: qbme, affp, q2m0, wpm, wpmax, wpmin
!
! declare arrays for standard code:
! part, part2 = particle arrays
real, dimension(:,:), pointer :: part, part2, tpart
! qe = electron charge density with guard cells
real, dimension(:,:), pointer :: qe
! cue = electron current density with guard cells
! dcu = acceleration density with guard cells
! cus = transverse electric field
! amu = momentum flux with guard cells
real, dimension(:,:,:), pointer :: cue, dcu, cus, amu
! exyze = transverse electric field with guard cells
! fxyze/bxyze = smoothed electric/magnetic field with guard cells
real, dimension(:,:,:), pointer :: fxyze, exyze, bxyze
! ffc, ffe = form factor arrays for poisson solvers
complex, dimension(:,:), pointer :: ffc, ffe
! mixup = bit reverse table for FFT
integer, dimension(:), pointer :: mixup
! sct = sine/cosine table for FFT
complex, dimension(:), pointer :: sct
! npicy = scratch array for reordering particles
integer, dimension(:), pointer :: npicy
! ss = scratch array for WFFT2RN
complex, dimension(:,:), pointer :: ss
!
! declare and initialize timing data
real :: time
integer, dimension(4) :: itime
real :: tdpost = 0.0, tguard = 0.0, tfft = 0.0, tfield = 0.0
real :: tdjpost = 0.0, tdcjpost = 0.0, tpush = 0.0, tsort = 0.0
double precision :: dtime
!
! initialize scalars for standard code
! np = total number of particles in simulation
! nx/ny = number of grid points in x/y direction
np = npx*npy; nx = 2**indx; ny = 2**indy; nxh = nx/2; nyh = ny/2
nxe = nx + 2; nye = ny + 1; nxeh = nxe/2
nxyh = max(nx,ny)/2; nxhy = max(nxh,ny); ny1 = ny + 1
! nloop = number of time steps in simulation
! ntime = current time step
nloop = tend/dt + .0001; ntime = 0
! mdim = dimension of amu array
mdim = 2*ndim - 2
qbme = qme
affp = real(nx*ny)/real(np)
!
! allocate data for standard code
allocate(part(idimp,np))
if (sortime > 0) allocate(part2(idimp,np))
allocate(qe(nxe,nye),fxyze(ndim,nxe,nye),exyze(ndim,nxe,nye))
allocate(cue(ndim,nxe,nye),dcu(ndim,nxe,nye),cus(ndim,nxe,nye))
allocate(amu(mdim,nxe,nye),bxyze(ndim,nxe,nye))
allocate(ffc(nxh,nyh),ffe(nxh,nyh),mixup(nxhy),sct(nxyh))
allocate(npicy(ny1),ss(mdim,nxeh))
!
! prepare fft tables
call WFFT2RINIT(mixup,sct,indx,indy,nxhy,nxyh)
! calculate form factor: ffc
isign = 0
call POIS23(qe,fxyze,isign,ffc,ax,ay,affp,we,nx,ny,nxeh,nye,nxh, &
&nyh)
! initialize electrons
call DISTR2H(part,vtx,vty,vtz,vx0,vy0,vz0,npx,npy,idimp,np,nx,ny, &
&ipbc)
!
! find maximum and minimum initial electron density
qe = 0.0
call GPOST2L(part,qe,qme,np,idimp,nxe,nye)
call AGUARD2L(qe,nx,ny,nxe,nye)
call FWPMINMX2(qe,qbme,wpmax,wpmin,nx,ny,nxe,nye)
wpm = 0.5*(wpmax + wpmin)*affp
! accelerate convergence: update wpm
if (wpm <= 10.0) wpm = 0.75*wpm
write (*,*) 'wpm=',wpm
q2m0 = wpm/affp
! calculate form factor: ffe
isign = 0
call EPOIS23(dcu,cus,isign,ffe,ax,ay,affp,wpm,ci,wf,nx,ny,nxeh,nye&
&,nxh,nyh)
!
! initialize transverse electric field
cus = 0.0
!
! * * * start main iteration loop * * *
!
500 if (nloop <= ntime) go to 2000
! write (*,*) 'ntime = ', ntime
!
! deposit current with standard procedure: updates cue
call dtimer(dtime,itime,-1)
cue = 0.0
call GJPOST2L(part,cue,qme,zero,np,idimp,nx,ny,nxe,nye,ipbc)
! call GSJPOST2L(part,cue,qme,zero,np,idimp,nx,ny,nxe,nxe*nye,ipbc)
call dtimer(dtime,itime,1)
time = real(dtime)
tdjpost = tdjpost + time
!
! deposit charge with standard procedure: updates qe
call dtimer(dtime,itime,-1)
qe = 0.0
call GPOST2L(part,qe,qme,np,idimp,nxe,nye)
! call GSPOST2L(part,qe,qme,np,idimp,nxe,nxe*nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tdpost = tdpost + time
!
! add guard cells with standard procedure: updates qe, cue
call dtimer(dtime,itime,-1)
call AGUARD2L(qe,nx,ny,nxe,nye)
call ACGUARD2L(cue,nx,ny,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tguard = tguard + time
!
! transform charge to fourier space with standard procedure: updates qe
call dtimer(dtime,itime,-1)
isign = -1
call WFFT2RX(qe,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfft = tfft + time
!
! calculate longitudinal force/charge in fourier space with standard
! procedure: updates fxyze, we
call dtimer(dtime,itime,-1)
isign = -1
call POIS23(qe,fxyze,isign,ffc,ax,ay,affp,we,nx,ny,nxeh,nye,nxh, &
&nyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! transform longitudinal electric force to real space with standard
! procedure: updates fxyze
call dtimer(dtime,itime,-1)
isign = 1
call WFFT2R3(fxyze,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfft = tfft + time
!
! transform current to fourier space with standard procedure: update cue
call dtimer(dtime,itime,-1)
isign = -1
call WFFT2R3(cue,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfft = tfft + time
!
! take transverse part of current with standard procedure: updates cue
call dtimer(dtime,itime,-1)
call CUPERP2(cue,nx,ny,nxeh,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! calculate magnetic field in fourier space with standard procedure:
! updates bxyze, wm
call dtimer(dtime,itime,-1)
call BBPOIS23(cue,bxyze,ffc,ci,wm,nx,ny,nxeh,nye,nxh,nyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! transform magnetic force to real space with standard procedure:
! updates bxyze
call dtimer(dtime,itime,-1)
isign = 1
call WFFT2R3(bxyze,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfft = tfft + time
!
! add constant to magnetic field with standard procedure: updates bxyze
call dtimer(dtime,itime,-1)
call BADDEXT2(bxyze,omx,omy,omz,nx,ny,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! copy guard cells with standard procedure: updates fxyze, bxyze
call dtimer(dtime,itime,-1)
call BGUARD2L(fxyze,nx,ny,nxe,nye)
call BGUARD2L(bxyze,nx,ny,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tguard = tguard + time
!
! add longitudinal and old transverse electric fields with standard
! procedure: updates exyze
call dtimer(dtime,itime,-1)
call ADDVRFIELD2(exyze,cus,fxyze,ndim,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! deposit electron acceleration density and momentum flux with standard
! procedure: updates dcu, amu
call dtimer(dtime,itime,-1)
dcu = 0.0; amu = 0.0
call GDJPOST2L(part,exyze,bxyze,dcu,amu,qme,qbme,dt,idimp,np,nxe, &
&nye)
! call GSDJPOST2L(part,exyze,bxyze,dcu,amu,qme,qbme,dt,idimp,np,nxe,&
! &nxe*nye)
! add old scaled electric field with standard procedure: updates dcu
call ASCFGUARD2L(dcu,cus,q2m0,nx,ny,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tdcjpost = tdcjpost + time
!
! add guard cells with standard procedure: updates dcu, amu
call dtimer(dtime,itime,-1)
call ACGUARD2L(dcu,nx,ny,nxe,nye)
call AMCGUARD2L(amu,nx,ny,nxe,nye,mdim)
call dtimer(dtime,itime,1)
time = real(dtime)
tguard = tguard + time
!
! transform acceleration density and momentum flux to fourier space
! with standard procedure: updates dcu, amu
call dtimer(dtime,itime,-1)
isign = -1
call WFFT2R3(dcu,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh)
call WFFT2RN(amu,ss,isign,mixup,sct,indx,indy,nxeh,nye,mdim,nxhy, &
&nxyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfft = tfft + time
!
! take transverse part of time derivative of current with standard
! procedure: updates dcu
call dtimer(dtime,itime,-1)
call ADCUPERP23(dcu,amu,nx,ny,nxeh,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! calculate convective part of transverse electric field with standard
! procedure: updates cus, wf
call dtimer(dtime,itime,-1)
isign = -1
call EPOIS23(dcu,cus,isign,ffe,ax,ay,affp,wpm,ci,wf,nx,ny,nxeh,nye&
&,nxh,nyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! transform transverse electric field to real space with standard
! procedure: updates cus
call dtimer(dtime,itime,-1)
isign = 1
call WFFT2R3(cus,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfft = tfft + time
!
! copy guard cells with standard procedure: updates cus
call dtimer(dtime,itime,-1)
call BGUARD2L(cus,nx,ny,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tguard = tguard + time
!
! add longitudinal and transverse electric fields with standard
! procedure: exyze = cus + fxyze, updates exyze
! cus needs to be retained for next time step
call dtimer(dtime,itime,-1)
call ADDVRFIELD2(exyze,cus,fxyze,ndim,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! inner iteration loop
do k = 1, ndc
!
! deposit electron current and acceleration density and momentum flux
! with standard procedure: updates cue, dcu, amu
call dtimer(dtime,itime,-1)
cue = 0.0; dcu = 0.0; amu = 0.0
call GDCJPOST2L(part,exyze,bxyze,cue,dcu,amu,qme,qbme,dt,idimp,np,&
&nxe,nye)
! call GSDCJPOST2L(part,exyze,bxyze,cue,dcu,amu,qme,qbme,dt,idimp,np&
! &,nxe,nxe*nye)
! add scaled electric field with standard procedure: updates dcu
call ASCFGUARD2L(dcu,cus,q2m0,nx,ny,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tdcjpost = tdcjpost + time
!
! add guard cells for current, acceleration density, and momentum flux
! with standard procedure: updates cue, dcu, amu
call dtimer(dtime,itime,-1)
call ACGUARD2L(cue,nx,ny,nxe,nye)
call ACGUARD2L(dcu,nx,ny,nxe,nye)
call AMCGUARD2L(amu,nx,ny,nxe,nye,mdim)
call dtimer(dtime,itime,1)
time = real(dtime)
tguard = tguard + time
!
! transform current to fourier space with standard procedure: update cue
call dtimer(dtime,itime,-1)
isign = -1
call WFFT2R3(cue,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfft = tfft + time
!
! take transverse part of current with standard procedure: updates cue
call dtimer(dtime,itime,-1)
call CUPERP2(cue,nx,ny,nxeh,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! calculate magnetic field in fourier space with standard procedure:
! updates bxyze, wm
call dtimer(dtime,itime,-1)
call BBPOIS23(cue,bxyze,ffc,ci,wm,nx,ny,nxeh,nye,nxh,nyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! transform magnetic force to real space with standard procedure:
! updates bxyze
call dtimer(dtime,itime,-1)
isign = 1
call WFFT2R3(bxyze,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfft = tfft + time
!
! add constant to magnetic field with standard procedure: updates bxzye
call dtimer(dtime,itime,-1)
call BADDEXT2(bxyze,omx,omy,omz,nx,ny,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! transform acceleration density and momentum flux to fourier space
! with standard procedure: updates dcu and amu
call dtimer(dtime,itime,-1)
isign = -1
call WFFT2R3(dcu,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh)
call WFFT2RN(amu,ss,isign,mixup,sct,indx,indy,nxeh,nye,mdim,nxhy, &
&nxyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfft = tfft + time
!
! take transverse part of time derivative of current with standard
! procedure: updates dcu
call dtimer(dtime,itime,-1)
call ADCUPERP23(dcu,amu,nx,ny,nxeh,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! calculate transverse electric field with standard procedure:
! updates cus, wf
call dtimer(dtime,itime,-1)
isign = -1
call EPOIS23(dcu,cus,isign,ffe,ax,ay,affp,wpm,ci,wf,nx,ny,nxeh,nye&
&,nxh,nyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
! transform transverse electric field to real space with standard
! procedure: updates cus
call dtimer(dtime,itime,-1)
isign = 1
call WFFT2R3(cus,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh)
call dtimer(dtime,itime,1)
time = real(dtime)
tfft = tfft + time
!
! copy guard cells with standard procedure: updates bxyze, cus
call dtimer(dtime,itime,-1)
call BGUARD2L(bxyze,nx,ny,nxe,nye)
call BGUARD2L(cus,nx,ny,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tguard = tguard + time
!
! add longitudinal and transverse electric fields with standard
! procedure: exyze = cus + fxyze, updates exyze
! cus needs to be retained for next time step
call dtimer(dtime,itime,-1)
call ADDVRFIELD2(exyze,cus,fxyze,ndim,nxe,nye)
call dtimer(dtime,itime,1)
time = real(dtime)
tfield = tfield + time
!
enddo
!
! push particles with standard procedure: updates part, wke
wke = 0.0
call dtimer(dtime,itime,-1)
call GBPUSH23L(part,exyze,bxyze,qbme,dt,dt,wke,idimp,np,nx,ny,nxe,&
&nye,ipbc)
! call GSBPUSH23L(part,exyze,bxyze,qbme,dt,dt,wke,idimp,np,nx,ny,nxe&
! &,nxe*nye,ipbc)
call dtimer(dtime,itime,1)
time = real(dtime)
tpush = tpush + time
!
! sort particles by cell for standard procedure
if (sortime > 0) then
if (mod(ntime,sortime)==0) then
call dtimer(dtime,itime,-1)
call DSORTP2YL(part,part2,npicy,idimp,np,ny1)
! exchange pointers
tpart => part
part => part2
part2 => tpart
call dtimer(dtime,itime,1)
time = real(dtime)
tsort = tsort + time
endif
endif
!
if (ntime==0) then
wt = we + wm
write (*,*) 'Initial Total Field, Kinetic and Total Energies:'
write (*,'(3e14.7)') wt, wke, wke + wt
write (*,*) 'Initial Electrostatic, Transverse Electric and Mag&
&netic Field Energies:'
write (*,'(3e14.7)') we, wf, wm
endif
!
ntime = ntime + 1
go to 500
2000 continue
!
! * * * end main iteration loop * * *
!
write (*,*) 'ntime, ndc = ', ntime, ndc
wt = we + wm
write (*,*) 'Final Total Field, Kinetic and Total Energies:'
write (*,'(3e14.7)') wt, wke, wke + wt
write (*,*) 'Final Electrostatic, Transverse Electric and Magnetic&
& Field Energies:'
write (*,'(3e14.7)') we, wf, wm
!
write (*,*)
write (*,*) 'deposit time = ', tdpost
write (*,*) 'current deposit time = ', tdjpost
write (*,*) 'current derivative deposit time = ', tdcjpost
tdpost = tdpost + tdjpost + tdcjpost
write (*,*) 'total deposit time = ', tdpost
write (*,*) 'guard time = ', tguard
write (*,*) 'solver time = ', tfield
write (*,*) 'fft time = ', tfft
write (*,*) 'push time = ', tpush
write (*,*) 'sort time = ', tsort
tfield = tfield + tguard + tfft
write (*,*) 'total solver time = ', tfield
time = tdpost + tpush + tsort
write (*,*) 'total particle time = ', time
wt = time + tfield
write (*,*) 'total time = ', wt
write (*,*)
!
wt = 1.0e+09/(real(nloop)*real(np))
write (*,*) 'Push Time (nsec) = ', tpush*wt
write (*,*) 'Deposit Time (nsec) = ', tdpost*wt
write (*,*) 'Sort Time (nsec) = ', tsort*wt
write (*,*) 'Total Particle Time (nsec) = ', time*wt
!
stop
end program
|
{
"content_hash": "b7ca2ad1c61e0c3a14207343c864e7c5",
"timestamp": "",
"source": "github",
"line_count": 513,
"max_line_length": 73,
"avg_line_length": 35.91033138401559,
"alnum_prop": 0.6379329063076756,
"repo_name": "tsung1029/dpic2",
"id": "27db43451303695b898a35a4fb07d8dff23bbcd6",
"size": "18422",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dpic2.f90",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "167713"
},
{
"name": "FORTRAN",
"bytes": "208996"
},
{
"name": "Makefile",
"bytes": "2320"
}
],
"symlink_target": ""
}
|
(function() {
'use strict';
// ------------------------------------
angular
.module('myApp')
.controller("TripController", tripController);
tripController.$inject = ["TripService", "LoginService", "$state", "$mdDialog"];
function tripController(TripService, LoginService, $state, $mdDialog) {
var vm = this;
vm.trip = TripService.getTrip($state.params.tripId);
vm.canEdit = LoginService.canEdit;
vm.goEdit = function() { $state.go('trip.edit') };
vm.showImage = function(img) {
var templateString = ''
templateString += '<md-dialog aria-label="' + img.alt + '">';
templateString += '<img src="' + img.src + '">';
templateString += '</md-dialog>';
$mdDialog.show({
template : templateString,
parent: angular.element(document.body),
clickOutsideToClose: true
})
}
}
// ------------------------------------
})();
|
{
"content_hash": "f09b99cba715a44a4fd215ec989ccc27",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 82,
"avg_line_length": 24.416666666666668,
"alnum_prop": 0.5790671217292378,
"repo_name": "flxw/flighttrack",
"id": "48db2f9ac2de865810f6e1d3c3510e1187e73a92",
"size": "879",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/trip/trip.controller.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3902"
},
{
"name": "HTML",
"bytes": "15268"
},
{
"name": "JavaScript",
"bytes": "34626"
}
],
"symlink_target": ""
}
|
"use strict";
var path = require('path'),
fs = require('fs'),
ejs = require('ejs'),
wrench = require('wrench'),
prompt = require('./prompt'),
disectModules = require('./disect-modules');
var writeTemplate = function(template, targetPath, options) {
wrench.mkdirSyncRecursive(path.dirname(targetPath));
var rendered = ejs.render(fs.readFileSync(template, 'utf-8'), options);
fs.writeFileSync(targetPath, rendered, 'utf-8');
};
var writeViewTemplate = function(templateName) {
var template = path.join(this.viewTemplateDir, templateName + ".jade.ejs");
var targetPath = path.join("views", this.model.path, path.basename(template).replace('.ejs', ''));
writeTemplate(template, targetPath, this);
};
var createApp = function(data) {
var source = path.join(this.templateDir, 'app');
var appTemplate = path.join(this.templateDir, 'ejs', 'app.js.ejs');
if (!fs.existsSync(source)) {
throw 'Directory "' + source + '" does not exist!';
}
data.dependencies = disectModules(data.dependencies);
data.devDependencies = disectModules(data.devDependencies);
// Transform scripts prompt
data.scripts = {
start: data.scripts
};
var target = data.name;
wrench.copyDirSyncRecursive(source, target, { preserve : false });
writeTemplate(appTemplate, path.join(target, "app.js"), data);
// Delete prompted properties that should not be part of package
delete data.mongoSessionStore
delete data.i18n
fs.writeFile(path.resolve(target, 'package.json'), JSON.stringify(data, null, ' '), function(err) {
console.log();
console.log('Initialized app in directory "' + target + '"');
console.log();
console.log('To start the generated app run:');
console.log(' cd ' + target);
console.log(' npm install');
console.log(' npm start OR node app.js');
});
};
var commands = {
app : function(options) {
prompt.app({ name : options.model.singular }, options.switches, function(err, result) {
if (err) {
return;
}
createApp.bind(options)(result);
});
},
scaffold : function(options) {
commands.view(options);
commands.model(options);
commands.route(options);
},
resource : function(options) {
options.rest = true;
commands.model(options);
commands.route(options);
},
view : function(options) {
options.viewTemplateDir = path.join(options.templateDir, 'scaffold', 'views');
if (!fs.existsSync(options.viewTemplateDir)) {
throw 'Directory "' + options.viewTemplateDir + '" does not exist!';
}
['create', 'edit', 'index', 'detail', 'delete'].forEach(writeViewTemplate.bind(options));
console.log('Views created in directory ' + path.join('views', options.model.path));
},
model : function(options) {
var templatePath = path.join(options.templateDir, 'scaffold', 'model', 'default.js.ejs');
if (!fs.existsSync(templatePath)) {
throw 'File "' + templatePath + '" does not exist!';
}
var target = path.join('models', options.model.path + '.js');
writeTemplate(templatePath, target, options);
console.log('Model written to ' + target);
},
route : function(options) {
var template = options.rest ? "rest.js.ejs" : "default.js.ejs";
var templatePath = path.join(options.templateDir, 'scaffold', 'route', template);
if (!fs.existsSync(templatePath)) {
throw 'File "' + templatePath + '" does not exist!';
}
var target = path.join('routes', options.model.path + '.js');
writeTemplate(templatePath, target, options);
console.log('Route written to ' + target);
},
rm : function(options) {
// TODO: Implement
}
};
module.exports = commands;
|
{
"content_hash": "09bcc6f7cec91e0dd37b814191f710b7",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 104,
"avg_line_length": 31.275590551181104,
"alnum_prop": 0.6117824773413897,
"repo_name": "the-diamond-dogs-group-oss/bumm",
"id": "90cf05953be8f6bfdd83a11930c3750711bc2604",
"size": "3972",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/commands.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "273"
},
{
"name": "JavaScript",
"bytes": "22144"
}
],
"symlink_target": ""
}
|
/**
* Reduction data collectors to use while computing analytics expressions. For multi-sharded
* collections, this is the data that is sent from shard to shard.
*/
package org.apache.solr.analytics.function.reduction.data;
|
{
"content_hash": "43a71a0b993afb91f56084e294cfd313",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 92,
"avg_line_length": 32.714285714285715,
"alnum_prop": 0.7729257641921398,
"repo_name": "apache/solr",
"id": "3ba2c0bdddc450f4530bd378f41a7e5299e07c88",
"size": "1030",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "solr/modules/analytics/src/java/org/apache/solr/analytics/function/reduction/data/package-info.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "509"
},
{
"name": "Batchfile",
"bytes": "91853"
},
{
"name": "CSS",
"bytes": "234034"
},
{
"name": "Emacs Lisp",
"bytes": "73"
},
{
"name": "HTML",
"bytes": "326277"
},
{
"name": "Handlebars",
"bytes": "7549"
},
{
"name": "Java",
"bytes": "35849436"
},
{
"name": "JavaScript",
"bytes": "17639"
},
{
"name": "Python",
"bytes": "219385"
},
{
"name": "Shell",
"bytes": "279599"
},
{
"name": "XSLT",
"bytes": "35107"
}
],
"symlink_target": ""
}
|
using System;
using System.Web.Mvc;
using CS.Extension;
namespace CS.Web.Mvc
{
/// <summary>
/// Ajax专用的JsonResult
/// </summary>
public class AjaxResult : JsonResult
{
/// <summary>
/// 是否将首字母小写
/// </summary>
public bool IsCamelCaseJson { get; set; }
public override void ExecuteResult(ControllerContext context)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
var response = context.HttpContext.Response;
response.ContentType = !string.IsNullOrEmpty(ContentType) ? ContentType : "application/json";
if (ContentEncoding != null)
{
response.ContentEncoding = ContentEncoding;
}
if (Data != null)
{
var json = IsCamelCaseJson ? Data.ToCamelCaseJsonByJc() : Data.ToJsonByJc();
response.Write(json);
}
}
}
}
|
{
"content_hash": "ef67bce5f734f9229c23706cd7843698",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 105,
"avg_line_length": 28.194444444444443,
"alnum_prop": 0.5349753694581281,
"repo_name": "cswares/CS.Utility",
"id": "02d5f65b1ec01c76a77253c2222b6029807b382f",
"size": "1039",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sources/CS.Utility.Web/Web/Mvc/AjaxResult.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "704987"
}
],
"symlink_target": ""
}
|
var request = require('request');
module.exports = function(ferd) {
ferd.listen(/^ferd translate$/i, function(response) {
response.send('Instructions: `ferd translate` _`text to translate`_');
});
ferd.listen(/ferd translate (.*)/i, function(response) {
var text = response.match[1];
var url = 'https://translate.yandex.net/api/v1.5/tr.json/translate?key='+ process.env.TRANSLATE +'&lang=en&text=' + text + '&options=1';
request(url, function (error, responser, body) {
var result = JSON.parse(body);
response.send(result.text[0]);
});
});
};
|
{
"content_hash": "b3ad48735b9d97047e0c156994f6a9c3",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 140,
"avg_line_length": 27.045454545454547,
"alnum_prop": 0.6336134453781512,
"repo_name": "ferdx/ferd-translate",
"id": "71a589b05cc61f51bd6dece9f959d9258760fcf7",
"size": "595",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "translate.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "595"
}
],
"symlink_target": ""
}
|
Package.describe({
name: 'rocketchat:iframe-login',
summary: '',
version: '1.0.0',
});
Package.onUse(function(api) {
// Server libs
api.use('rocketchat:logger', 'server');
api.use('kadira:flow-router', 'client');
api.use('rocketchat:lib');
api.use('accounts-base');
api.use('ecmascript');
api.use('reactive-var');
api.use('http');
api.use('tracker');
api.use('check');
api.imply('facebook-oauth');
api.imply('twitter-oauth');
api.imply('google-oauth');
api.imply('oauth');
// Server files
api.addFiles('iframe_rocketchat.js', 'server');
api.addFiles('iframe_server.js', 'server');
// Client files
api.addFiles('iframe_client.js', 'client');
});
|
{
"content_hash": "5b880c339c569b32ec0db4b7e41ca941",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 48,
"avg_line_length": 20.424242424242426,
"alnum_prop": 0.655786350148368,
"repo_name": "flaviogrossi/Rocket.Chat",
"id": "c1855fd0da7154685b4b5f8475e482a1efbbe602",
"size": "674",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "packages/rocketchat-iframe-login/package.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "549"
},
{
"name": "CSS",
"bytes": "389912"
},
{
"name": "Cap'n Proto",
"bytes": "3959"
},
{
"name": "CoffeeScript",
"bytes": "30843"
},
{
"name": "Dockerfile",
"bytes": "1874"
},
{
"name": "HTML",
"bytes": "415928"
},
{
"name": "JavaScript",
"bytes": "3996494"
},
{
"name": "Ruby",
"bytes": "4653"
},
{
"name": "Shell",
"bytes": "30169"
},
{
"name": "Standard ML",
"bytes": "1843"
}
],
"symlink_target": ""
}
|
/* global $ */
import { Promise } from "vendor/liquid-fire";
export default function revealModal(oldView, insertNewView) {
return insertNewView().then(function(newView){
var box, obscure;
if (!newView ||
!(box = newView.$('.modal-popup > div')[0]) ||
!(obscure = newView.$('.obscure')[0])) {
return;
}
// liquid-fire always starts newView at "display: none", the
// animate function normally handles clearing it for us.
newView.$().css('display', 'block');
return Promise.all([
$.Velocity.animate(obscure, {opacity: [0.5, 0]}, {duration: 200}),
$.Velocity.animate(box, {scale: [1, 0]}, {duration: 200})
]);
});
}
|
{
"content_hash": "379c769286fd7bdb8da90ea4fd66b152",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 72,
"avg_line_length": 32.61904761904762,
"alnum_prop": 0.5985401459854015,
"repo_name": "ef4/ember-animation-demo",
"id": "1f8bcb4d77bface142b78f484ef9728205dc53e5",
"size": "685",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/transitions/reveal-modal.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "19476"
},
{
"name": "CoffeeScript",
"bytes": "19457"
},
{
"name": "JavaScript",
"bytes": "8879"
}
],
"symlink_target": ""
}
|
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ashman.fivehundredpx"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<application
android:name=".FiveHundredApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".GalleryActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".PictureViewActivity"
android:label="@string/app_name"
android:theme="@style/Transparent" />
<activity
android:name=".LoginActivity"
android:label="@string/login"
android:theme="@style/AppTheme" />
<activity
android:name=".SettingsActivity"
android:label="@string/settings"
android:theme="@style/AppTheme" />
<activity
android:name=".FullPictureViewActivity"
android:label="@string/app_name"
android:theme="@style/FullPictureActivity"
android:configChanges="orientation|keyboardHidden|screenSize"/>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
|
{
"content_hash": "0b6d20d8033eb4058f5fce2bddcbde97",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 38.23529411764706,
"alnum_prop": 0.56,
"repo_name": "marc-ashman/500px",
"id": "ef38690a61529c026b711a779d77a1ac19115f31",
"size": "1950",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "500px-gallery/500px-App/src/main/AndroidManifest.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "1574"
},
{
"name": "Java",
"bytes": "387248"
},
{
"name": "Shell",
"bytes": "2314"
}
],
"symlink_target": ""
}
|
package com.example.fw;
import java.io.File;
import autoitx4java.AutoItX;
import com.jacob.com.ComThread;
import com.jacob.com.LibraryLoader;
public class AutoItHelper extends HelpersBase {
static {
File jacob = new File("./lib/jacob-1.17-x64.dll");
System.setProperty(LibraryLoader.JACOB_DLL_PATH, jacob.getAbsolutePath());
}
public AutoItHelper(ApplicationManager manager) {
super(manager);
ComThread.InitMTA();
aux = new AutoItX();
}
private String winTitle;
private String winText;
private final AutoItX aux;
public AutoItHelper winWaitAndActivate(String winTitle, String winText, int timeout) {
this.winTitle = winTitle;
this.winText = winText;
aux.winWait(winTitle, winText, timeout);
aux.winActivate(winTitle, winText);
aux.winWaitActive(winTitle, winText, timeout);
System.out.println("Windows activated: " + winTitle);
return this;
}
public AutoItHelper click(String controlID) {
aux.controlClick(winTitle, winText, controlID);
System.out.println("Control clicked: " + controlID);
return this;
}
public AutoItHelper focus(String controlID) {
aux.controlFocus(winTitle, winText, controlID);
System.out.println("Control focused: " + controlID);
return this;
}
public AutoItHelper send(String text) {
aux.send(text, false);
System.out.println("Control send [text]: " + text);
return this;
}
public AutoItHelper send(String controlID, String text) {
focus(controlID);
aux.send(text, false);
System.out.println("Control send [controlID]: " + controlID + " [text]: " + text);
return this;
}
public String getText(String controlID) {
return aux.controlGetText(winTitle, winText, controlID);
}
public boolean isWindow(String winTitle, String text) {
return aux.winExists(winTitle,text);
}
}
|
{
"content_hash": "c35dee22d7432fc27d6c39c3fc81a55a",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 90,
"avg_line_length": 28.056338028169016,
"alnum_prop": 0.6556224899598394,
"repo_name": "ErmOlka/Prog4Test",
"id": "8e43a07abd23d49c13343799d92f0cd47c2ca930",
"size": "1992",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "addressbook-native-tests/src/com/example/fw/AutoItHelper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "129990"
},
{
"name": "Shell",
"bytes": "476"
}
],
"symlink_target": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.