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 |
|---|---|---|---|---|---|
/// <reference path='fourslash.ts' />
// Handle having zero modifiers on a method.
// @allowNonTsExtensions: true
// @Filename: file1.js
//// class C {
//// M() {
//// const q = /*a*/1 + 2/*b*/;
//// q.toString();
//// }
//// }
goTo.select('a', 'b')
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to method in class 'C'",
newContent:
`class C {
M() {
const q = this./*RENAME*/newMethod();
q.toString();
}
newMethod() {
return 1 + 2;
}
}`
});
| TypeScript | 5 | nilamjadhav/TypeScript | tests/cases/fourslash/extract-method26.ts | [
"Apache-2.0"
] |
else ← {(⍺⍺⍣⍺)(⍵⍵⍣(~⍺))⍵}
f ← {⍵ + 30}
g ← {⍵ - 30}
⎕ ← (3>2) f else g 28
⎕ ← (3>3) f else g 28
A ← (2 2 ⍴ ⍳ 4)
⎕ ← (3>2) f else g A
⎕ ← (3>3) f else g A
0 | APL | 3 | melsman/apltail | tests/else.apl | [
"MIT"
] |
C Copyright(c) 1998, Space Science and Engineering Center, UW-Madison
C Refer to "McIDAS Software Acquisition and Distribution Policies"
C in the file mcidas/data/license.txt
C *** $Id: kbxfy2.dlm,v 1.2 2005/06/08 14:58:31 rickk Tst $ ***
C$ Name:
C$ kbxini - Calibration module for FY2 data
C$
C$ Interface:
C$ integer function
C$ kbxini(character*4 input_cal,character*4 output_cal,integer io_size(*))
C$
C$ Input:
C$ input_cal - Input calibration type ('RAW')
C$ output_cal - Output calibration type ('TEMP','ALB','RAD','RAW','BRIT')
C$ io_size - Source and destination byte depth
C$ io_size(1) - Source pixel size (2)
C$ io_size(2) - Destination pixel size (1,2,4)
C$
C$ Output:
C$ Error messages if return value is not 0. (To be backward compatible
C$ with the existing API, the return value does not indicate which
C$ error was encountered.)
C$
C$ Return values:
C$ 0 - success
C$ -1 - error
C$
C$ Remarks:
C$ See remarks at subroutine RD_CAL for details of FY2 Calibration Block.
C$ Note also that for ADDE we need to comment out all SDEST and DDEST
C$ calls, since messages cannot be sent to "stdout" pipe mixed with data.
C$
C$ EDEST messages will be sent to "stderr" and can be left in, but will
C$ not be returned to a remote client.
C$
C$
C$ Categories:
C$ image
C$ display
C$ calibration
C$ met/science
integer function kbxini(input_cal,output_cal,io_size)
implicit none
c
c --- input parametes
c
character*4 input_cal ! input calibration type (RAW)
character*4 output_cal ! output cal type (TEMP,ALB,RAD,RAW,BRIT)
integer io_size(*) ! source and destination byte depth
c
c --- local variables
c
character*4 cal_input ! input calibration type (RAW)
character*4 cal_output ! output cal type (TEMP, ALB, RAD, RAW, BRIT)
integer dest_byte_size ! number of bytes for destination pixel
integer src_byte_size ! number of bytes for source pixel
common/fy2/cal_input,cal_output,src_byte_size,dest_byte_size
c
c --- set local variables to fill common block
c
cal_input = input_cal
cal_output = output_cal
c
c --- Verify that the input calibration type
c
if (cal_input(1:3) .ne. 'RAW') then
kbxini = -1
c
c --- Verify that the output calibration type
c
elseif ((cal_output(1:4) .ne. 'TEMP') .and.
& (cal_output(1:3) .ne. 'RAD') .and.
& (cal_output(1:3) .ne. 'RAW') .and.
& (cal_output(1:3) .ne. 'ALB') .and.
& (cal_output(1:4) .ne. 'BRIT')) then
kbxini = -1
else
src_byte_size = io_size(1)
dest_byte_size = io_size(2)
kbxini = 0
endif
return
end
C$ Name:
C$ kbxcal - Converts input DN to output of correct byte size & dimensions
C$
C$ Interface:
C$ integer function
C$ kbxcal(integer prefix(*), integer area_dir(*), integer num_pixels,
C$ integer band, integer ibuf(*) )
C$
C$ Input:
C$ prefix - Line prefix calibration information
C$ area_dir - Area directory associated with the IBUF data
C$ num_pixels - Number of pixels in IBUF array
C$ band - Band number for data in IBUF array
C$ ibuf - array of data to be converted
C$
C$ Output:
C$ ibuf - array of converted data
C$
C$ Return values:
C$ 0 - success
C$ -1 - failure to build a calibration lookup table
C$ (output will always be returned in IBUF, even with an
C$ invalid or unbuilt table)
C$
C$ Remarks:
C$ KBXINI determines if the conversion is permitted, by putting
C$ constraints on the conversion types. Here, the type is assumed
C$ already validated, and the only decision is whether to build a
C$ table for a new valid type or use the table already existing.
C$ Since data is always returned, it is the user's responsibility to
C$ test return value KBXCAL for 0 to guarantee returned data is valid.
C$
C$ Categories:
C$ image
C$ display
C$ calibration
C$ met/science
integer function kbxcal(prefix,area_dir,num_pixels,band,ibuf)
implicit none
include 'areaparm.inc' ! defines NUMAREAOPTIONS
c
c --- input parameters
c
integer prefix(*) ! line prefix information to determine detector
integer area_dir(*) ! area directory
integer num_pixels ! number of pixels in ibuf array
integer band ! band number
integer ibuf(*) ! I/O array containing pixels to be modified
c
c --- external functions
c
real temp_to_rad ! converts temperature to radiance
character*12 cfi
c
c --- local variables
c
character*4 cal_input ! input calibration type RAW
character*4 cal_output ! output cal type (TEMP, ALB, RAD, RAW, BRIT)
integer alb_table(256) ! albedo table determined from raw values to send to MPIXTB
integer albedo_brit(256) ! brightness table determined from albedoes to send to MPIXTB
integer area_number ! area number found in area directory
integer cal_block(6528) ! cal block - includes directory and tables
integer cal_offset ! offset into area directory to get cal block
integer dest_byte_size ! number of bytes for destination pixel
integer detector ! which detector is used (1-4)
integer i ! do loop index
integer ir_band_offset ! offset into ir tables to find band temp table
integer ir_table_offset ! offset into cal block to find ir tables
integer j ! do loop index
integer last_area ! last area used for araget
integer last_band ! last area used for araget
integer rad_table(1024) ! radiance table determined from temperatures
integer src_byte_size ! number of bytes for source pixel
integer store_alb_table(5,256) ! albedo table determined from raw values
integer store_albedo_brit(5,256) ! brightness table determined from albedoes
integer temp_brit(1024) ! brightness table determined from temperatures
integer temp_table(1024) ! temperature table determined from raw values
integer vis_band_offset ! offset into cal block to find vis tables
integer vis_detector(4) ! codes determining visible detector used
integer vis_offset ! offset into cal block to find albedo table
real albedo ! albedo read in from calibration table
real radiance ! radiance returned from temp_to_rad
real temperature ! temperature read in from calibration table
logical ir_data ! flag indicating ir data requested
logical vis_data ! flag indicating visible data requested
common/fy2/cal_input,cal_output,src_byte_size,dest_byte_size
data last_area /-1/
data last_band /-1/
data vis_band_offset /192/
data vis_detector(1) /Z'6C6C0000'/
data vis_detector(2) /Z'B4B40000'/
data vis_detector(3) /Z'D8D80000'/
data vis_detector(4) /Z'FCFC0000'/
kbxcal = 0
c
c --- set ir_data/vis_data flag
c
if (band .eq. 1) then
vis_data = .TRUE.
ir_data = .FALSE.
else
vis_data = .FALSE.
ir_data = .TRUE.
endif
c
c --- read in calibration block
c
area_number = area_dir(33)
cal_offset = area_dir(63)
if (last_area .ne. area_number) then
call araget(area_number,cal_offset,26112,cal_block)
endif
last_area = area_number
if (vis_data) then
c
c --- read detector number from line prefix to determine vis_offset
c --- if the prefix is not found, use detector 1
c
detector = 1
do 10 i = 1,4
if (vis_detector(i) .eq. prefix(2)) then
detector = i
endif
10 continue
endif
if ((vis_data) .and. (last_band .ne. band)) then
c
c --- create albedo and brightness tables for each detector
c --- note that the raw values are 0-255 for visible
c
do 20 j = 1,4
do 30 i=1,256,4
vis_offset = vis_band_offset + (j-1) * 64
albedo = float(cal_block(vis_offset+i/4+1)) / 10000.
store_albedo_brit(j,i) = nint(0.5+25.5*sqrt(albedo))
store_alb_table(j,i) = nint(albedo * 100.)
store_albedo_brit(j,i+1) = nint(0.5+25.5*sqrt(albedo))
store_alb_table(j,i+1) = nint(albedo * 100.)
store_albedo_brit(j,i+2) = nint(0.5+25.5*sqrt(albedo))
store_alb_table(j,i+2) = nint(albedo * 100.)
store_albedo_brit(j,i+3) = nint(0.5+25.5*sqrt(albedo))
store_alb_table(j,i+3) = nint(albedo * 100.)
30 continue
20 continue
endif
do 40 i=1,256
alb_table(i) = store_alb_table(detector,i)
albedo_brit(i) = store_albedo_brit(detector,i)
40 continue
c
c --- if data is from ir band
c --- 1) determine the offset
c --- 2) create temp, radiance and brit lookup tables
c
if ((ir_data) .and. (last_band .ne. band)) then
c
c --- determine ir_offset - based on band - the location is the
c --- directory portion of the calibration block. Value is given
c --- bytes, so divide by 4 to use words.
c
ir_band_offset = cal_block((band-2)*2 + 8)/ 4
c
c --- create temperature, radiance and brightness tables
c
do 110 i=1,1024
temperature =
& float(cal_block(ir_band_offset + i)) / 1000.
radiance = temp_to_rad(temperature,band)
temp_table(i) = nint(temperature * 100.)
rad_table(i) = nint(radiance * 1000.)
call gryscl(temperature,temp_brit(i))
110 continue
endif
c
c --- Convert ibuf to appropriate quantity
c
if (vis_data) then
if (cal_output(1:3) .eq. 'RAW') then
call mpixel(num_pixels,src_byte_size,
& dest_byte_size,ibuf)
elseif (cal_output(1:3) .eq. 'ALB') then
call mpixtb(num_pixels,src_byte_size,
& dest_byte_size,ibuf,alb_table)
elseif (cal_output(1:4) .eq. 'BRIT') then
call mpixtb(num_pixels,src_byte_size,
& dest_byte_size,ibuf,albedo_brit)
endif
endif
if (ir_data) then
if (cal_output(1:3) .eq. 'RAW') then
call mpixel(num_pixels,src_byte_size,
& dest_byte_size,ibuf)
elseif (cal_output(1:3) .eq. 'RAD') then
call mpixtb(num_pixels,src_byte_size,
& dest_byte_size,ibuf,rad_table)
elseif (cal_output(1:4) .eq. 'TEMP') then
call mpixtb(num_pixels,src_byte_size,
& dest_byte_size,ibuf,temp_table)
elseif (cal_output(1:4) .eq. 'BRIT') then
call mpixtb(num_pixels,src_byte_size,
& dest_byte_size,ibuf,temp_brit)
endif
endif
last_band = band
return
end
C$ Name:
C$ kbxopt - Returns auxiliary parameters for setup or sets internal state
C$
C$ Interface:
C$ integer function
C$ kbxopt(character*4 option, integer param_in(*), integer param_out(*))
C$
C$ Input:
C$ option - Option ('KEYS', 'INFO')
C$ param_in - Array of input parameters
C$
C$ Output:
C$ param_out - Array of output parameters
C$ (The number of input and output parameters is determined
C$ by the option or function executed. The calling routine
C$ is responsible for having arrays large enough to send
C$ and receive output for the option or function requested.)
C$
C$ Return values:
C$ 0 - success
C$ -1 - Invalid function requested
C$ -3 - Error in breakpoint table (table cannot be set up)
C$
C$ Remarks:
C$ Check the d.pgm code to see how the various functions are used.
C$
C$ Categories:
C$ image
C$ display
C$ calibration
C$ met/science
integer function kbxopt(option,param_in,param_out)
implicit none
c
c --- input parameters
c
character*4 option ! option
integer param_in(*) ! input parameters
c
c --- output parameters
c
integer param_out(*) ! output parameters
c
c --- external functions
c
integer brkset ! checks SU table
integer ischar ! checks for character string
integer lit ! four byte integer representation of char*4
c
c --- local variables
c
character*4 cal_input ! input calibration type (RAW)
character*4 cal_output ! output cal type (TEMP, ALB, RAD, RAW, BRIT)
character*8 su_file ! stretch table file
integer band ! band number
integer dest_byte_size ! number of bytes for destination pixel
integer src_byte_size ! number of bytes for source pixel
logical ir_data ! flag indicating ir data requested
logical vis_data ! flag indicating visible data requested
common/fy2/cal_input,cal_output,src_byte_size,dest_byte_size
kbxopt = 0
if (option .eq. 'KEYS') then
c
c --- param_in contains frame directory - set ir_data/vis_data flag
c
band = param_in(4)
if (band .eq. 1) then
vis_data = .TRUE.
ir_data = .FALSE.
else
vis_data = .FALSE.
ir_data = .TRUE.
endif
if (vis_data) then
param_out(1) = 3
param_out(2) = lit('RAW ')
param_out(3) = lit('ALB ')
param_out(4) = lit('BRIT')
elseif (ir_data) then
param_out(1) = 4
param_out(2) = lit('RAW ')
param_out(3) = lit('RAD ')
param_out(4) = lit('TEMP')
param_out(5) = lit('BRIT')
endif
c
c --- Check for a stretch table (SU)
c
if (ischar(param_in(38)) .eq. 1) then
call movwc(param_in(38),su_file)
if (brkset(su_file,cal_input) .ne. 0) then
kbxopt = -3
endif
endif
elseif (option .eq. 'BRKP') then
c
c --- param_in(1) is the su table name
c
call movwc(param_in(1),su_file)
if (brkset(su_file,cal_input) .ne. 0) then
kbxopt = -3
endif
elseif (option .eq. 'INFO') then
c
c --- param_in contains frame directory - set ir_data/vis_data flag
c
band = param_in(4)
if (band .eq. 1) then
vis_data = .TRUE.
ir_data = .FALSE.
else
vis_data = .FALSE.
ir_data = .TRUE.
endif
if (vis_data) then
param_out(1) = 3
param_out(2) = lit('RAW ')
param_out(3) = lit('ALB ')
param_out(4) = lit('BRIT')
param_out(5) = lit(' ')
param_out(6) = lit(' % ')
param_out(7) = lit(' ')
param_out(8) = 1
param_out(9) = 100
param_out(10) = 1
elseif (ir_data) then
param_out(1) = 4
param_out(2) = lit('RAW ')
param_out(3) = lit('RAD ')
param_out(4) = lit('TEMP')
param_out(5) = lit('BRIT')
param_out(6) = lit(' ')
param_out(7) = lit('MW**')
param_out(8) = lit(' K ')
param_out(9) = lit(' ')
param_out(10)= 1
param_out(11)= 1000
param_out(12)= 100
param_out(13)= 1
endif
else
kbxopt = -1
endif
return
end
C$ Name:
C$ temp_to_rad - Converts absolute temperature to radiance
C$
C$ Interface:
C$ real function
C$ temp_to_rad(real temperature, integer band)
C$
C$ Input:
C$ temperature - absolute temperature
C$ band - band number
C$
C$ Return values:
C$
C$ radiance - radiance - units of
C$ (milliWatts/meter**2/steradian/(cm**-1))*100.0]
C$
C$
C$ Remarks:
C$
C$ Categories:
C$ calibration
real function temp_to_rad(temperature,band)
implicit none
c
c - symbolic constants & shared data
c
integer NUM_BANDS
parameter (NUM_BANDS=4)
integer NUM_CONST
parameter (NUM_CONST=2)
c
c --- input parameters
c
real temperature ! temperature
integer band ! band number
c
c --- local variables
c
integer iband ! band number
real fk1(NUM_BANDS) ! derived constants for each band
real fk2(NUM_BANDS) ! derived constants for each band
real radiance ! radiance value returned
real tc(NUM_CONST,NUM_BANDS) ! derived temp constants for each band
real adjusted_temp ! temperatured adjusted by derived constants
data fk1/9280.38, 7136.31, 37258.20, 224015.00/
data fk2/1323.95, 1212.95, 2104.22, 3826.28/
data tc/0.72122, 0.99750,
& 1.00668, 0.99621,
& 3.76883, 0.99108,
& 4.00279, 0.99458/
c
c --- subtract 1 from band to match index into arrays for constants
c
iband = band - 1
adjusted_temp = tc(1,iband) + tc(2,iband) * temperature
radiance = fk1(iband) / (exp(fk2(iband) / adjusted_temp) - 1.)
temp_to_rad = radiance
return
end
| IDL | 5 | oxelson/gempak | extlibs/AODT/v72/odtmcidas/navcal/navcal/kbxfy2.dlm | [
"BSD-3-Clause"
] |
namespace OpenAPI.Model
open System
open System.Collections.Generic
open Newtonsoft.Json
open OpenAPI.Model.Category
open OpenAPI.Model.Tag
module Pet =
//#region Pet
[<CLIMutable>]
type Pet = {
[<JsonProperty(PropertyName = "id")>]
Id : int64;
[<JsonProperty(PropertyName = "category")>]
Category : Category;
[<JsonProperty(PropertyName = "name")>]
Name : string;
[<JsonProperty(PropertyName = "photoUrls")>]
PhotoUrls : string[];
[<JsonProperty(PropertyName = "tags")>]
Tags : Tag[];
[<JsonProperty(PropertyName = "status")>]
Status : string;
}
//#endregion
| F# | 4 | MalcolmScoffable/openapi-generator | samples/server/petstore/fsharp-functions/OpenAPI/src/model/Pet.fs | [
"Apache-2.0"
] |
> module EvilTransform where
> type Latitude = Double
> type Longitude = Double
> type Coordinate = (Latitude, Longitude)
> outOfChina :: Coordinate -> Bool
> outOfChina (lat, lng)
> | lat < 0.8293 || lat > 55.8271 = True
> | lng < 72.004 || lng > 137.8347 = True
> | otherwise = False
> transformLat :: Double -> Double -> Double
> transformLat x y = sum [i1, i2, i3, i4]
> where i1 = (-100.0) + 2.0*x + 3.0*y + 0.2*y*y + 0.1*x*y + 0.2*sqrt(abs(x))
> i2 = (20.0*sin(6.0*x*pi) + 20.0*sin(2.0*x*pi)) * 2.0 / 3.0
> i3 = (20.0*sin(y*pi) + 40.0*sin(y/3.0*pi)) * 2.0 / 3.0
> i4 = (160.0*sin(y/12.0*pi) + 320*sin(y*pi/30.0)) * 2.0 / 3.0
> transformLon :: Double -> Double -> Double
> transformLon x y = sum [i1, i2, i3, i4]
> where i1 = 300.0 + x + 2.0*y + 0.1*x*x + 0.1*x*y + 0.1*sqrt(abs(x));
> i2 = (20.0*sin(6.0*x*pi) + 20.0*sin(2.0*x*pi)) * 2.0 / 3.0
> i3 = (20.0*sin(x*pi) + 40.0*sin(x/3.0*pi)) * 2.0 / 3.0
> i4 = (150.0*sin(x/12.0*pi) + 300.0*sin(x/30.0*pi)) * 2.0 / 3.0
> delte :: Coordinate -> Coordinate
> delte (lat, lng) = (dLat, dLng)
> where a = 6378137.0
> ee = 0.00669342162296594323
> radLat = lat / 180.0 * pi
> _magic = sin radLat
> magic = 1 - ee * _magic * _magic
> sqrtMagic = sqrt magic
> _dLat = transformLat (lng-105.0) (lat-35.0)
> _dLng = transformLon (lng-105.0) (lat-35.0)
> dLat = (_dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi)
> dLng = (_dLng * 180.0) / (a / sqrtMagic * cos(radLat) * pi)
> wgs2Gcj :: Coordinate -> Coordinate
> wgs2Gcj wgscoor
> | outOfChina wgscoor = wgscoor
> | otherwise = (wglat + dlat, wglng + dlng)
> where (wglat, wglng) = wgscoor
> (dlat, dlng) = delte wgscoor
> gcj2Wgs :: Coordinate -> Coordinate
> gcj2Wgs gccoor
> | outOfChina gccoor = gccoor
> | otherwise = (gcjLat - dLat, gcjLng - dLng)
> where (gcjLat, gcjLng) = gccoor
> (dLat, dLng) = delte gccoor
> distance :: Coordinate -> Coordinate -> Double
> distance (latA,lngA) (latB, lngB)
> | s > 1 = f 1
> | s < -1 = f (-1)
> | otherwise = f s
> where earchR = 637100
> x = cos(latA * pi / 180) * cos(latB * pi /180) * cos( (lngA - lngB) * pi /180)
> y = sin(latA * pi / 180) * sin(latB * pi /180)
> s = x + y
> f = (\s -> acos(s) * earchR)
> gcj2WgsExact :: Coordinate -> Coordinate
> gcj2WgsExact (gcjLat, gcjLng) = gainOn 0 gcjLat gcjLng mLat mLng pLat pLng
> where initDelta = 0.01
> mLat = gcjLat - initDelta
> mLng = gcjLng - initDelta
> pLat = gcjLat + initDelta
> pLng = gcjLng + initDelta
> gainOn :: Int -- times
> -> Double -- gcjLat
> -> Double -- gcjLng
> -> Double -- mLat
> -> Double -- mLng
> -> Double -- pLat
> -> Double -- pLng
> -> Coordinate
> gainOn i gcjLat gcjLng mLat mLng pLat pLng
> | i >= 29 = (wgsLat, wgsLng)
> | (lessThanThreshold dLat) && (lessThanThreshold dLng) = (wgsLat, wgsLng)
> | otherwise = let _pLat = if (dLat > 0) then wgsLat else pLat
> _mLat = if (dLat <= 0) then wgsLat else mLat
> _pLng = if (dLng > 0) then wgsLng else pLng
> _mLng = if (dLng <= 0) then wgsLng else mLng
> in gainOn (i+1) gcjLat gcjLng _mLat _mLng _pLat _pLng
> where threshold = 0.000001
> wgsLat = (mLat + pLat) / 2
> wgsLng = (mLng + pLng) / 2
> (tmpLat, tmpLng) = wgs2Gcj (wgsLat, wgsLng)
> dLat = tmpLat - gcjLat
> dLng = tmpLng - gcjLng
> lessThanThreshold = (\x -> abs(x) < threshold)
| Literate Haskell | 4 | doctorjane/eviltransform-1 | haskell/EvilTransform.lhs | [
"BSD-2-Clause-FreeBSD"
] |
IokeGround Struct = fn(+attributes, +:attributesWithDefaultValues,
attributeNames = attributes + attributesWithDefaultValues map(key)
val = fn(+values, +:keywordValues,
Struct internal:createInitial(val, attributeNames, attributes, attributesWithDefaultValues, values, keywordValues)
)
val attributeNames = attributeNames
val prependMimic!(Struct)
val)
Struct attributeNames = []
Struct structInstance? = false
Struct internal:createInitial = method(val, attributeNames, attributes, attributesWithDefaultValues, values, keywordValues,
result = fn(+newVals, +:newKeywordVals,
Struct internal:createDerived(result, attributeNames, newVals, newKeywordVals))
result prependMimic!(val)
result structInstance? = true
(attributesWithDefaultValues seq +
attributes zipped(values) +
keywordValues seq) each(vv,
result cell(vv first) = vv second)
result)
Struct internal:createDerived = method(orig, attributeNames, newValues, newKeywordValues,
res = orig mimic
(newValues zipped(attributeNames) mapped(reverse) +
newKeywordValues seq) each(vv,
res cell(vv first) = vv second)
res
)
Struct create = method(+values, +:keywordValues,
@ call(*values, *keywordValues)
)
Struct mimic!(Mixins Sequenced)
Struct seq = method(
attributeNames mapped(name, name => @cell(name))
)
Struct attributes = method(
attributeNames fold({}, d, x, d[x] = @cell(x). d)
)
Struct valuesAt = method(+indices,
indices map(ix,
self[ix]))
Struct cell("[]") = method(index,
ix = if(index mimics?(Number),
attributeNames[index],
index)
@cell(ix))
Struct cell("[]=") = method(index, value,
ix = if(index mimics?(Number),
attributeNames[index],
index)
@cell(ix) = value)
Struct do(=== = generateMatchMethod(==))
Struct cell("==") = method(other,
(Struct === cell(:other) &&
attributes == other attributes))
Struct hash = method(attributes hash)
Struct asText = method(
if(structInstance?,
"(#{attributeNames map(name, "#{name}: #{@cell(name)}") join(", ")})",
"Struct(#{attributeNames join(", ")})"))
Struct notice = method(
if(structInstance?,
"(#{attributeNames map(name, "#{name}: #{@cell(name) notice}") join(", ")})",
"Struct(#{attributeNames join(", ")})"))
Struct inspect = method(
if(structInstance?,
"(#{attributeNames map(name, "#{name}: #{@cell(name) inspect}") join(", ")})",
"Struct(#{attributeNames join(", ")})"))
| Ioke | 3 | olabini/ioke | src/builtin/H50_struct.ik | [
"ICU",
"MIT"
] |
frequency,raw
20.00,2.68
20.20,2.73
20.40,2.77
20.61,2.82
20.81,2.87
21.02,2.92
21.23,3.00
21.44,3.08
21.66,3.16
21.87,3.23
22.09,3.30
22.31,3.33
22.54,3.37
22.76,3.40
22.99,3.44
23.22,3.50
23.45,3.55
23.69,3.61
23.92,3.67
24.16,3.73
24.40,3.78
24.65,3.83
24.89,3.89
25.14,3.95
25.39,4.02
25.65,4.09
25.91,4.15
26.16,4.22
26.43,4.27
26.69,4.33
26.96,4.38
27.23,4.42
27.50,4.45
27.77,4.48
28.05,4.51
28.33,4.58
28.62,4.65
28.90,4.73
29.19,4.75
29.48,4.75
29.78,4.76
30.08,4.78
30.38,4.86
30.68,4.94
30.99,5.02
31.30,5.04
31.61,5.06
31.93,5.08
32.24,5.15
32.57,5.22
32.89,5.30
33.22,5.31
33.55,5.30
33.89,5.28
34.23,5.34
34.57,5.42
34.92,5.50
35.27,5.51
35.62,5.51
35.97,5.50
36.33,5.49
36.70,5.49
37.06,5.49
37.43,5.57
37.81,5.65
38.19,5.69
38.57,5.69
38.95,5.69
39.34,5.73
39.74,5.77
40.14,5.80
40.54,5.80
40.94,5.80
41.35,5.80
41.76,5.80
42.18,5.80
42.60,5.80
43.03,5.80
43.46,5.82
43.90,5.84
44.33,5.89
44.78,5.95
45.23,5.98
45.68,5.99
46.13,6.00
46.60,6.00
47.06,5.99
47.53,5.95
48.01,5.90
48.49,5.90
48.97,5.90
49.46,5.85
49.96,5.80
50.46,5.80
50.96,5.80
51.47,5.80
51.99,5.81
52.51,5.75
53.03,5.70
53.56,5.64
54.10,5.59
54.64,5.56
55.18,5.51
55.74,5.43
56.29,5.34
56.86,5.23
57.42,5.15
58.00,5.08
58.58,4.95
59.16,4.84
59.76,4.78
60.35,4.65
60.96,4.47
61.57,4.28
62.18,4.09
62.80,3.91
63.43,3.66
64.07,3.38
64.71,3.13
65.35,2.86
66.01,2.59
66.67,2.40
67.33,2.22
68.01,2.03
68.69,1.82
69.37,1.58
70.07,1.28
70.77,0.89
71.48,0.59
72.19,0.29
72.91,-0.13
73.64,-0.47
74.38,-0.71
75.12,-0.84
75.87,-0.86
76.63,-0.92
77.40,-0.72
78.17,-0.33
78.95,-0.13
79.74,0.13
80.54,0.26
81.35,0.37
82.16,0.54
82.98,0.66
83.81,1.13
84.65,1.49
85.50,1.86
86.35,2.22
87.22,2.53
88.09,2.79
88.97,3.13
89.86,3.38
90.76,3.63
91.66,3.94
92.58,4.19
93.51,4.39
94.44,4.58
95.39,4.78
96.34,4.90
97.30,4.98
98.28,5.07
99.26,5.17
100.25,5.25
101.25,5.32
102.27,5.34
103.29,5.38
104.32,5.39
105.37,5.37
106.42,5.33
107.48,5.26
108.56,5.20
109.64,5.18
110.74,5.16
111.85,5.12
112.97,5.03
114.10,5.02
115.24,5.01
116.39,4.94
117.55,4.86
118.73,4.80
119.92,4.74
121.12,4.68
122.33,4.58
123.55,4.49
124.79,4.41
126.03,4.37
127.29,4.31
128.57,4.22
129.85,4.08
131.15,3.96
132.46,3.84
133.79,3.71
135.12,3.59
136.48,3.50
137.84,3.41
139.22,3.28
140.61,3.19
142.02,3.08
143.44,2.89
144.87,2.73
146.32,2.55
147.78,2.33
149.26,2.13
150.75,1.90
152.26,1.57
153.78,1.30
155.32,0.98
156.88,0.68
158.44,0.48
160.03,0.29
161.63,0.25
163.24,0.33
164.88,0.51
166.53,0.60
168.19,0.66
169.87,0.67
171.57,0.56
173.29,0.45
175.02,0.32
176.77,0.13
178.54,-0.01
180.32,-0.16
182.13,-0.30
183.95,-0.44
185.79,-0.53
187.65,-0.66
189.52,-0.77
191.42,-0.87
193.33,-0.95
195.27,-1.02
197.22,-1.06
199.19,-1.11
201.18,-1.14
203.19,-1.22
205.23,-1.30
207.28,-1.32
209.35,-1.32
211.44,-1.32
213.56,-1.37
215.69,-1.42
217.85,-1.51
220.03,-1.53
222.23,-1.54
224.45,-1.48
226.70,-1.44
228.96,-1.42
231.25,-1.35
233.57,-1.27
235.90,-1.20
238.26,-1.12
240.64,-1.07
243.05,-0.92
245.48,-0.84
247.93,-0.81
250.41,-0.79
252.92,-0.76
255.45,-0.60
258.00,-0.55
260.58,-0.54
263.19,-0.47
265.82,-0.41
268.48,-0.36
271.16,-0.26
273.87,-0.24
276.61,-0.26
279.38,-0.20
282.17,-0.14
284.99,-0.07
287.84,-0.04
290.72,-0.04
293.63,-0.04
296.57,0.07
299.53,0.11
302.53,0.12
305.55,0.23
308.61,0.25
311.69,0.23
314.81,0.31
317.96,0.35
321.14,0.36
324.35,0.35
327.59,0.35
330.87,0.35
334.18,0.35
337.52,0.35
340.90,0.35
344.30,0.34
347.75,0.37
351.23,0.43
354.74,0.45
358.28,0.45
361.87,0.46
365.49,0.47
369.14,0.47
372.83,0.48
376.56,0.49
380.33,0.50
384.13,0.50
387.97,0.51
391.85,0.51
395.77,0.51
399.73,0.46
403.72,0.42
407.76,0.41
411.84,0.40
415.96,0.40
420.12,0.40
424.32,0.41
428.56,0.42
432.85,0.42
437.18,0.38
441.55,0.39
445.96,0.44
450.42,0.49
454.93,0.55
459.48,0.61
464.07,0.67
468.71,0.70
473.40,0.70
478.13,0.74
482.91,0.79
487.74,0.83
492.62,0.86
497.55,0.88
502.52,0.85
507.55,0.80
512.62,0.77
517.75,0.76
522.93,0.76
528.16,0.75
533.44,0.68
538.77,0.60
544.16,0.56
549.60,0.52
555.10,0.47
560.65,0.34
566.25,0.24
571.92,0.13
577.64,0.09
583.41,0.06
589.25,-0.01
595.14,-0.07
601.09,-0.15
607.10,-0.15
613.17,-0.14
619.30,-0.13
625.50,-0.13
631.75,-0.15
638.07,-0.13
644.45,-0.10
650.89,-0.06
657.40,-0.01
663.98,0.03
670.62,0.01
677.32,0.04
684.10,0.09
690.94,0.12
697.85,0.13
704.83,0.09
711.87,0.08
718.99,0.07
726.18,0.06
733.44,0.03
740.78,0.01
748.19,0.05
755.67,-0.03
763.23,-0.07
770.86,-0.09
778.57,-0.10
786.35,-0.11
794.22,-0.11
802.16,-0.11
810.18,-0.11
818.28,-0.09
826.46,-0.01
834.73,0.01
843.08,0.01
851.51,0.00
860.02,-0.00
868.62,-0.01
877.31,-0.02
886.08,-0.03
894.94,-0.03
903.89,0.04
912.93,0.05
922.06,0.05
931.28,0.05
940.59,0.05
950.00,0.05
959.50,0.06
969.09,-0.00
978.78,-0.03
988.57,-0.01
998.46,-0.00
1008.44,0.01
1018.53,0.00
1028.71,-0.03
1039.00,-0.08
1049.39,-0.07
1059.88,-0.03
1070.48,0.01
1081.19,0.03
1092.00,0.02
1102.92,0.07
1113.95,0.13
1125.09,0.15
1136.34,0.17
1147.70,0.17
1159.18,0.20
1170.77,0.24
1182.48,0.33
1194.30,0.37
1206.25,0.42
1218.31,0.47
1230.49,0.58
1242.80,0.65
1255.22,0.67
1267.78,0.78
1280.45,0.86
1293.26,0.88
1306.19,0.88
1319.25,0.98
1332.45,1.13
1345.77,1.20
1359.23,1.23
1372.82,1.31
1386.55,1.33
1400.41,1.37
1414.42,1.42
1428.56,1.42
1442.85,1.44
1457.28,1.49
1471.85,1.52
1486.57,1.57
1501.43,1.60
1516.45,1.66
1531.61,1.74
1546.93,1.82
1562.40,1.88
1578.02,1.95
1593.80,2.02
1609.74,2.16
1625.84,2.24
1642.10,2.30
1658.52,2.38
1675.10,2.52
1691.85,2.67
1708.77,2.86
1725.86,2.98
1743.12,3.06
1760.55,3.15
1778.15,3.25
1795.94,3.36
1813.90,3.44
1832.03,3.50
1850.36,3.61
1868.86,3.68
1887.55,3.68
1906.42,3.74
1925.49,3.79
1944.74,3.79
1964.19,3.84
1983.83,3.89
2003.67,3.95
2023.71,3.98
2043.94,4.08
2064.38,4.21
2085.03,4.33
2105.88,4.55
2126.94,4.78
2148.20,4.94
2169.69,5.18
2191.38,5.43
2213.30,5.68
2235.43,5.95
2257.78,6.16
2280.36,6.41
2303.17,6.72
2326.20,6.93
2349.46,7.12
2372.95,7.29
2396.68,7.48
2420.65,7.63
2444.86,7.72
2469.31,7.80
2494.00,7.79
2518.94,7.85
2544.13,7.95
2569.57,8.07
2595.27,8.25
2621.22,8.36
2647.43,8.45
2673.90,8.54
2700.64,8.58
2727.65,8.62
2754.93,8.68
2782.48,8.71
2810.30,8.69
2838.40,8.68
2866.79,8.65
2895.46,8.59
2924.41,8.48
2953.65,8.44
2983.19,8.43
3013.02,8.41
3043.15,8.45
3073.58,8.48
3104.32,8.48
3135.36,8.49
3166.72,8.40
3198.38,8.32
3230.37,8.29
3262.67,8.18
3295.30,8.04
3328.25,7.86
3361.53,7.69
3395.15,7.47
3429.10,7.21
3463.39,6.94
3498.03,6.68
3533.01,6.52
3568.34,6.34
3604.02,6.07
3640.06,5.85
3676.46,5.53
3713.22,5.15
3750.36,4.85
3787.86,4.57
3825.74,4.31
3864.00,4.07
3902.64,3.85
3941.66,3.76
3981.08,3.68
4020.89,3.59
4061.10,3.49
4101.71,3.31
4142.73,3.06
4184.15,2.77
4226.00,2.40
4268.26,1.96
4310.94,1.66
4354.05,1.33
4397.59,0.76
4441.56,0.25
4485.98,-0.26
4530.84,-0.94
4576.15,-1.37
4621.91,-1.92
4668.13,-2.24
4714.81,-2.40
4761.96,-2.16
4809.58,-1.71
4857.67,-0.37
4906.25,0.60
4955.31,2.07
5004.87,3.66
5054.91,4.88
5105.46,5.87
5156.52,7.23
5208.08,8.53
5260.16,9.42
5312.77,10.33
5365.89,11.06
5419.55,11.46
5473.75,11.83
5528.49,11.92
5583.77,11.79
5639.61,11.51
5696.00,11.23
5752.96,11.15
5810.49,11.16
5868.60,11.07
5927.28,11.06
5986.56,11.12
6046.42,11.12
6106.89,11.06
6167.96,11.00
6229.64,10.83
6291.93,10.63
6354.85,10.51
6418.40,10.27
6482.58,9.99
6547.41,9.90
6612.88,9.76
6679.01,9.29
6745.80,8.87
6813.26,8.12
6881.39,7.58
6950.21,7.17
7019.71,6.55
7089.91,6.01
7160.81,5.59
7232.41,5.22
7304.74,5.12
7377.79,5.34
7451.56,5.79
7526.08,6.17
7601.34,6.63
7677.35,7.24
7754.13,7.72
7831.67,8.11
7909.98,8.44
7989.08,8.63
8068.98,8.77
8149.67,8.99
8231.16,9.33
8313.47,9.88
8396.61,10.25
8480.57,10.34
8565.38,10.41
8651.03,10.62
8737.54,10.24
8824.92,9.81
8913.17,9.86
9002.30,10.29
9092.32,10.94
9183.25,11.29
9275.08,11.19
9367.83,10.01
9461.51,8.99
9556.12,8.15
9651.68,7.22
9748.20,6.31
9845.68,5.72
9944.14,5.19
10043.58,4.24
10144.02,3.71
10245.46,3.05
10347.91,2.46
10451.39,1.70
10555.91,1.19
10661.46,0.57
10768.08,-0.02
10875.76,-0.29
10984.52,-0.50
11094.36,0.00
11205.31,0.41
11317.36,1.80
11430.53,2.57
11544.84,2.96
11660.29,3.35
11776.89,3.92
11894.66,4.57
12013.60,5.13
12133.74,5.29
12255.08,5.23
12377.63,5.72
12501.41,5.90
12626.42,6.00
12752.68,6.04
12880.21,6.08
13009.01,5.95
13139.10,5.58
13270.49,5.02
13403.20,4.36
13537.23,3.59
13672.60,2.97
13809.33,2.43
13947.42,2.29
14086.90,2.08
14227.77,1.71
14370.04,1.19
14513.74,0.36
14658.88,-0.38
14805.47,-0.68
14953.52,-0.97
15103.06,-2.29
15254.09,-4.39
15406.63,-6.07
15560.70,-7.40
15716.30,-7.59
15873.47,-8.79
16032.20,-7.95
16192.52,-6.56
16354.45,-3.63
16517.99,-2.08
16683.17,-0.61
16850.01,0.20
17018.51,0.62
17188.69,1.30
17360.58,1.83
17534.18,2.44
17709.53,3.08
17886.62,3.48
18065.49,3.68
18246.14,3.91
18428.60,3.93
18612.89,3.72
18799.02,2.95
18987.01,2.06
19176.88,1.57
19368.65,1.10
19562.33,0.90
19757.96,0.54
19955.54,-0.25
| CSV | 1 | vinzmc/AutoEq | measurements/innerfidelity/data/onear/Beyerdynamic DT 770 600 Ohm/Beyerdynamic DT 770 600 Ohm.csv | [
"MIT"
] |
#tag Module
Protected Module RegistryWFS
#tag Method, Flags = &h1
Protected Function AllowActiveDesktop() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoActiveDesktopChanges" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowActiveDesktop(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoActiveDesktopChanges" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowChangeStartMenu() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoChangeStartMenu" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowChangeStartMenu(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoChangeStartMenu" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowCloseLogoff() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoLogoff" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowCloseLogoff(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoLogoff" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowControlPanels() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "System" )
return (policies.Value( "NoDispCpl" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowControlPanels(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
try
policies = policies.Child( "System" )
catch
policies = policies.AddFolder( "System" )
end
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoDispCpl" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowDesktop() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoDesktop" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowDesktop(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoDesktop" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowDrive(driveNum as Integer) As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
dim oldMask as Integer
try
oldMask = policies.Value( "NoDrives" )
end
return BitwiseAnd( oldMask, REALbasic.Pow( 2, driveNum ) ) = 0
#else
#pragma unused driveNum
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowDrive(driveNum as Integer, assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim oldMask as Integer
try
oldMask = policies.Value( "NoDrives" )
end
if not set then
oldMask = BitwiseOr( oldMask, REALbasic.Pow( 2, driveNum ) )
else
oldMask = BitwiseAnd( oldMask, Bitwise.OnesComplement( REALbasic.Pow( 2, driveNum ) ) )
end
policies.Value( "NoDrives" ) = oldMask
#else
#pragma unused driveNum
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowFavoritesMenu() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoFavoritesMenu" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowFavoritesMenu(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoFavoritesMenu" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowFileAssociate() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoFileAssociate" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowFileAssociate(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoFileAssociate" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowFind() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoFind" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowFind(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoFind" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowFolderOptions() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoFolderOptions" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowFolderOptions(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoFolderOptions" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowInternetIcon() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoInternetIcon" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowInternetIcon(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoInternetIcon" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowRecentDocumentsMenu() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoRecentDocsMenu" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowRecentDocumentsMenu(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoRecentDocsMenu" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowRegistryTools() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "System" )
return (policies.Value( "DisableRegistryTools" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowRegistryTools(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
try
policies = policies.Child( "System" )
catch
policies = policies.AddFolder( "System" )
end
dim setInt as Integer
if not set then setInt = 1
policies.Value( "DisableRegistryTools" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowRunMenu() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoRun" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowRunMenu(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoRun" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowSpecialFolders() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoSetFolders" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowSpecialFolders(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoSetFolders" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowTaskbarBands() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoMovingBands" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowTaskbarBands(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoMovingBands" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowTaskbarProperties() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoSetTaskbar" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowTaskbarProperties(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoSetTaskbar" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowTaskManager() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "System" )
return (policies.Value( "DisableTaskMgr" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowTaskManager(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
try
policies = policies.Child( "System" )
catch
policies = policies.AddFolder( "System" )
end
dim setInt as Integer
if not set then setInt = 1
policies.Value( "DisableTaskMgr" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function AllowTrayContextMenu() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return true
policies = policies.Child( "Explorer" )
return (policies.Value( "NoTrayContextMenu" ) = 0)
#endif
exception
return true
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub AllowTrayContextMenu(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if not set then setInt = 1
policies.Value( "NoTrayContextMenu" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h1
Protected Function ClearRecentDocsOnExit() As Boolean
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return false
policies = policies.Child( "Explorer" )
return (policies.Value( "ClearRecentDocsOnExit" ) = 1)
#endif
exception
return false
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub ClearRecentDocsOnExit(assigns set as Boolean)
#if TargetWin32
dim policies as RegistryItem
policies = CurrentUsersPolicies
if policies = nil then return
policies = policies.Child( "Explorer" )
dim setInt as Integer
if set then setInt = 1
policies.Value( "ClearRecentDocsOnExit" ) = setInt
#else
#pragma unused set
#endif
exception
return
End Sub
#tag EndMethod
#tag Method, Flags = &h21
Private Function CurrentUsersPolicies() As RegistryItem
#if TargetWin32
dim ret as RegistryItem
try
ret = new RegistryItem( "HKEY_CURRENT_USER" )
ret = ret.Child( "Software" ).Child( "Microsoft" )
ret = ret.Child( "Windows" ).Child( "CurrentVersion" )
ret = ret.Child( "Policies" )
catch
ret = nil
end
return ret
#endif
return nil
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Function GetBIOSDate() As String
#if TargetWin32 then
Dim sysInfo As String
dim reg as new RegistryItem( "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System" )
if reg <> Nil then
sysInfo = reg.Value( "SystemBiosDate" )
end if
Return sysInfo
#endif
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Function GetBIOSVersion() As String
#if TargetWin32 then
Dim sysInfo As String
dim reg as new RegistryItem( "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System" )
if reg <> Nil then
sysInfo = reg.Value( "SystemBiosVersion" )
end if
Return sysInfo
#endif
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Function GetCPUIdentifier(ProcessorNumber as Integer) As String
#if TargetWin32 then
Dim cpuInfo As String
dim reg as new RegistryItem( "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\" + _
CStr( ProcessorNumber ) )
if reg <> Nil then
cpuInfo = reg.Value( "Identifier" )
end if
Return cpuInfo
#else
#pragma unused ProcessorNumber
#endif
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Function GetCPUName(ProcessorNumber as Integer) As String
#if TargetWin32 then
Dim cpuInfo As String
dim reg as new RegistryItem( "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\" + _
CStr( ProcessorNumber ) )
if reg <> Nil then
cpuInfo = reg.Value( "ProcessorNameString" )
end if
Return cpuInfo
#else
#pragma unused ProcessorNumber
#endif
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Function GetCPUSpeed(ProcessorNumber as Integer) As String
#if TargetWin32 then
Dim cpuSpeed As String
dim reg as new RegistryItem( "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\" + _
CStr( ProcessorNumber ) )
dim mb as new MemoryBlock( 4 )
if reg <> Nil then
cpuSpeed = reg.Value( "~MHZ" )
end if
Return cpuSpeed
#else
#pragma unused ProcessorNumber
#endif
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Function GetCPUType() As String
#if TargetWin32
Declare Sub GetSystemInfo Lib "Kernel32" ( info as Ptr )
dim info as new MemoryBlock( 9 * 4 )
GetSystemInfo( info )
select case info.Long( 24 )
case 386
Return "Intel 386"
case 486
Return "Intel 486"
case 586
Return "Intel Pentium"
case 4000
Return "MIPS 4000"
case 21064
Return "Alpha"
case 601
Return "PPC 601"
case 603
Return "PPC 603"
case 604
Return "PPC 604"
case 620
Return "PPC 620"
case 10003
Return "Hitachi SH3"
case 10004
Return "Hitachi SH3E"
case 10005
Return "Hitachi SH4"
Case 821
Return "Motorola 821"
case 103
Return "SHx SH3"
case 104
Return "SHx SH4"
case 2577
Return "STRONGARM"
case 1824
Return "ARM 720"
case 2080
Return "ARM 820"
case 2336
Return "ARM 920"
case 70001
Return "ARM 7TDMI"
end select
#endif
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Function GetCPUVendor(ProcessorNumber as Integer) As String
#if TargetWin32 then
Dim cpuInfo As String
dim reg as new RegistryItem( "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\" + _
CStr( ProcessorNumber ) )
if reg <> Nil then
cpuInfo = reg.Value( "VendorIdentifier" )
end if
Return cpuInfo
#else
#pragma unused ProcessorNumber
#endif
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Function GetVideoBIOSDate() As String
#if TargetWin32 then
Dim sysInfo As String
dim reg as new RegistryItem( "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System" )
if reg <> Nil then
sysInfo = reg.Value( "VideoBiosDate" )
end if
Return sysInfo
#endif
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Function GetVideoBIOSVersion() As String
#if TargetWin32 then
Dim sysInfo As String
dim reg as new RegistryItem( "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System" )
if reg <> Nil then
sysInfo = reg.Value( "VideoBiosVersion" )
end if
Return sysInfo
#endif
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Function WallpaperStyle() As Integer
Dim dskControlPanel as RegistryItem
dskControlPanel = new RegistryItem( "HKEY_CURRENT_USERS" )
dskControlPanel = dskControlPanel.Child( "Control Panel" ).Child( "Desktop" )
if dskControlPanel = nil then return -1
dim wallStyle as String = dskControlPanel.Value( "WallpaperStyle" ).StringValue
dim tileValue as String = dskControlPanel.Value( "TileWallpaper" ).StringValue
if tileValue = "1" and wallStyle = "1" then
return kTiled
elseif tileValue = "0" and wallStyle = "2" then
return kStretched
else
return kCentered
end if
End Function
#tag EndMethod
#tag Method, Flags = &h1
Protected Sub WallpaperStyle(assigns newStyle as Integer)
Dim DesktopControlPanel as RegistryItem
DesktopControlPanel = new RegistryItem( "HKEY_CURRENT_USERS" )
DesktopControlPanel = DesktopControlPanel.Child( "Control Panel" ).Child( "Desktop" )
if DesktopControlPanel = nil then return
dim wallStyle, tileValue as String
select case newStyle
case kTiled
wallStyle = "1"
tileValue = "1"
case kStretched
wallStyle = "2"
tileValue = "0"
case kCentered
wallStyle = "0"
tileValue = "0"
end select
DesktopControlPanel.Value( "WallpaperStyle" ) = wallStyle
DesktopControlPanel.Value( "TileWallpaper" ) = tileValue
End Sub
#tag EndMethod
#tag Constant, Name = kCentered, Type = Double, Dynamic = False, Default = \"2", Scope = Protected
#tag EndConstant
#tag Constant, Name = kStretched, Type = Double, Dynamic = False, Default = \"1", Scope = Protected
#tag EndConstant
#tag Constant, Name = kTiled, Type = Double, Dynamic = False, Default = \"0", Scope = Protected
#tag EndConstant
#tag ViewBehavior
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="Name"
Visible=true
Group="ID"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
InheritedFrom="Object"
#tag EndViewProperty
#tag EndViewBehavior
End Module
#tag EndModule
| REALbasic | 4 | bskrtich/WFS | Windows Functionality Suite/Miscellaneous/Modules/RegistryWFS.rbbas | [
"MIT"
] |
#include "pch.h"
#include "State.h"
#include <optional>
// Function to get the iterator of a single key remap given the source key. Returns nullopt if it isn't remapped
std::optional<SingleKeyRemapTable::iterator> State::GetSingleKeyRemap(const DWORD& originalKey)
{
auto it = singleKeyReMap.find(originalKey);
if (it != singleKeyReMap.end())
{
return it;
}
return std::nullopt;
}
bool State::CheckShortcutRemapInvoked(const std::optional<std::wstring>& appName)
{
// Assumes appName exists in the app-specific remap table
ShortcutRemapTable& currentRemapTable = appName ? appSpecificShortcutReMap[*appName] : osLevelShortcutReMap;
for (auto& it : currentRemapTable)
{
if (it.second.isShortcutInvoked)
{
return true;
}
}
return false;
}
// Function to get the source and target of a shortcut remap given the source shortcut. Returns nullopt if it isn't remapped
ShortcutRemapTable& State::GetShortcutRemapTable(const std::optional<std::wstring>& appName)
{
if (appName)
{
auto itTable = appSpecificShortcutReMap.find(*appName);
if (itTable != appSpecificShortcutReMap.end())
{
return itTable->second;
}
}
return osLevelShortcutReMap;
}
std::vector<Shortcut>& State::GetSortedShortcutRemapVector(const std::optional<std::wstring>& appName)
{
// Assumes appName exists in the app-specific remap table
return appName ? appSpecificShortcutReMapSortedKeys[*appName] : osLevelShortcutReMapSortedKeys;
}
// Sets the activated target application in app-specific shortcut
void State::SetActivatedApp(const std::wstring& appName)
{
activatedAppSpecificShortcutTarget = appName;
}
// Gets the activated target application in app-specific shortcut
std::wstring State::GetActivatedApp()
{
return activatedAppSpecificShortcutTarget;
}
| C++ | 5 | szlatkow/PowerToys | src/modules/keyboardmanager/KeyboardManagerEngineLibrary/State.cpp | [
"MIT"
] |
2016-01-20 22:32:20 > fs0ciety (~whoami@c27-253-43-52.thoms4.vic.optusnet.com.au) has joined #linux.conf.au
2016-01-20 22:32:20 - Topic for #linux.conf.au is "SOLD OUT | LCA2016 Registrations now open! | Conference Schedule now available: https://linux.conf.au/programme/schedule/monday | https://linux.conf.au | LCA2016 - 1-5 February 2016"
2016-01-20 22:32:20 - Topic set by jayvee (~quassel@pi.sunriseroad.net) on Sun, 17 Jan 2016 16:57:37
2016-01-20 22:32:20 - Channel #linux.conf.au: 132 nicks (1 op, 0 voices, 131 normals)
2016-01-20 22:32:20 - PvNotice(ChanServ): Welcome to the Linux.conf.au channel!
2016-01-20 22:32:20 - URL for #linux.conf.au: http://www.linux.conf.au/
2016-01-20 22:32:22 - Channel created on Sun, 26 Nov 2006 17:42:44
2016-01-20 22:38:51 > fourminutemonta (~david@ppp118-209-1-244.lns20.mel4.internode.on.net) has joined #linux.conf.au
2016-01-20 22:39:56 < threeminutemonta (~david@ppp118-209-241-152.lns20.mel8.internode.on.net) has quit (Ping timeout: 260 seconds)
2016-01-20 22:40:15 - irc: disconnected from server
2016-01-21 11:10:57 > fs0ciety (~whoami@c27-253-43-52.thoms4.vic.optusnet.com.au) has joined #linux.conf.au
2016-01-21 11:10:57 - Topic for #linux.conf.au is "SOLD OUT | LCA2016 Registrations now open! | Conference Schedule now available: https://linux.conf.au/programme/schedule/monday | https://linux.conf.au | LCA2016 - 1-5 February 2016"
2016-01-21 11:10:57 - Topic set by jayvee (~quassel@pi.sunriseroad.net) on Sun, 17 Jan 2016 16:57:37
2016-01-21 11:10:58 - Channel #linux.conf.au: 136 nicks (1 op, 0 voices, 135 normals)
2016-01-21 11:10:58 - PvNotice(ChanServ): Welcome to the Linux.conf.au channel!
2016-01-21 11:10:58 - URL for #linux.conf.au: http://www.linux.conf.au/
2016-01-21 11:11:00 - Channel created on Sun, 26 Nov 2006 17:42:44
2016-01-21 11:11:02 brong meeting with Pobox people and learning how to sysadmin SmartOS so can help with their machines. Yay for different unixes
2016-01-21 11:11:17 brong DrParis: I think we considered IRCloud
2016-01-21 11:11:31 brong not sure why slack won off the top of my head
2016-01-21 11:11:35 brong it might be as good or even better
2016-01-21 11:11:48 brong the underlying thing is that nobody decided to set it up
2016-01-21 11:11:58 fs0ciety brong: Haha yeah, different unixessseses.. if I have to deal with AIX or Solaris anytime soon I'd rather run screaming.
2016-01-21 11:12:00 brong until someone else went and painted the bikeshed
2016-01-21 11:12:07 adhoc_ bot integrations is the only thing going for it, that swayed us
2016-01-21 11:12:13 brong and now everybody is out with the graffiti cans
2016-01-21 11:12:33 nevyn fs0ciety: tru64
2016-01-21 11:12:52 brong fs0ciety: there's OpenBSD in there too
2016-01-21 11:12:53 DrParis My biggest issue with Slack TBH is that the apps are all weird web wrappers that don’t feel fast enough
2016-01-21 11:13:07 brong DrParis: I don't type fast on mobile anyway
2016-01-21 11:13:16 DrParis I meant desktop, too
2016-01-21 11:13:18 nevyn until the email to the list I'd never heard of it.
2016-01-21 11:13:24 brong yeah, so I just use the web on desktop
2016-01-21 11:13:35 fs0ciety brong: Hahaha. Glad there isn't an OpenBSD machine in here in my office. Then again I've spent the past 3 days installing Funtoo on my laptop
2016-01-21 11:13:44 DrParis their web (and native app, which is just a wrapper) is slow and unpleasant :(
2016-01-21 11:14:04 brong I used to like OpenBSD for routers when I last used it 16 years ago... and it's probably still good for that, which is what it's doing
2016-01-21 11:14:19 brong DrParis: yeah, you saw my rant about the scrolling
2016-01-21 11:14:25 brong but it's consistent
2016-01-21 11:14:26 DrParis aye
2016-01-21 11:14:32 brong I use the IRC gateway on my work desktop as well
2016-01-21 11:15:01 simon_green For everyone of us who hasn't heard of Slack, there were be thousands of Slackers who haven't heard of IRC.
2016-01-21 11:15:13 brong simon_green: not that unbalanced in this community
2016-01-21 11:15:18 adhoc_ simon_green: indeed.
2016-01-21 11:15:24 DrParis I’m surprised that people in tech wouldn’t have heard of Slack TBH
2016-01-21 11:15:26 DrParis But yeah
2016-01-21 11:15:37 brong yeah, not having heard of slack, or uber, or tinder or whatever
2016-01-21 11:15:48 fs0ciety ahh the slack conversation from the mailing list
2016-01-21 11:15:49 vmbrasseur o_O
2016-01-21 11:15:51 simon_green I used it at a $job once, and of course their big incident last March.
2016-01-21 11:15:52 brong I guess if you're in a silo which doesn't interact with messaging
2016-01-21 11:15:54 DrParis Apparently the IRC gateway is not being turned on for the Slack instance, so meh to that
2016-01-21 11:15:57 fs0ciety that conversation escalated quickly
2016-01-21 11:15:57 adhoc_ DrParis: it has made news for al lthe wrong reasons, so i'm surprised too
2016-01-21 11:16:01 DrParis adhoc_: right
2016-01-21 11:16:13 edunham I'd suppose that for someone in FOSS communities, it's easier to miss noticing Slack than to be unaware of IRC
2016-01-21 11:16:47 fs0ciety I'm a newbie to Linux Conf, not a newbie to Linux.. I'd rather just stay in irc :)
2016-01-21 11:17:06 adhoc_ edunham: it isn't FLOSS, so easy for eyes to glaze over, if you don't care about all the integrations, which is its key selling point, to part you with your money =)
2016-01-21 11:18:45 fs0ciety adhoc_: Personally I don't think Slack is the right software to use for this purpose. But it is an "unofficial" thing -
2016-01-21 11:19:08 edunham my biggest complaints are the scrollback disappearing on free tier, the inaccessibility to community members who rely on screen readers, high barrier to entry (need manual invitation or someone to set up an auto-invite system) and Yet Another Login
2016-01-21 11:19:18 adhoc_ fs0ciety: i'm not saying it isn't useful (it is), but context is everything.
2016-01-21 11:19:23 edunham but oh well, I think the right solution here is to just hang out in IRC and get help here :)
2016-01-21 11:20:11 fs0ciety adhoc_: Oh I understand, promoting open-source is the whole point of the conference and then use Slack is like a slap in the office
2016-01-21 11:20:17 fs0ciety edunham: I agree
2016-01-21 11:20:43 adhoc_ so how FLOSSy is irccloud ?
2016-01-21 11:20:44 edunham oh and just for the record, I'm more than happy to mentor any newbies who're afraid of IRC clients.
2016-01-21 11:21:29 fs0ciety edunham: how involved can linuxconf be if it requires newbies to be mentored?
2016-01-21 11:21:59 < threeminutemonta (~david@eth778.vic.adsl.internode.on.net) has quit (Ping timeout: 272 seconds)
2016-01-21 11:22:27 adhoc_ fs0ciety: if you are entering a new community, there will always be new things, and things that look daunting
2016-01-21 11:22:32 edunham fs0ciety: I don't really understand what you're asking, but I've met a variety of nice people who just needed a little "no it won't explode" type handholding at the start of learning to use a tool, and then they're ok
2016-01-21 11:22:50 adhoc_ fs0ciety: a five minute conversation can break the ice and help you get you on your feet and in the right direction =)
2016-01-21 11:23:20 edunham sure, at some point you'll never get anywhere if you can't be self-directed -- but when something's totally new, it helpes to have someone point at the screen and name all the parts so you can Google your problems usefullly
2016-01-21 11:23:26 fs0ciety edunham: this is the thing i'm confused about, are you talking in the aspect of a "linux newbie"
2016-01-21 11:24:15 ecognito Well, that's been a mighty big cat set amongst the pigeons.
2016-01-21 11:24:17 edunham I'm talking about anyone in the target audience identified for Slack -- those who for whatever reason find IRC daunting.
2016-01-21 11:24:25 fs0ciety see i thought this whole newbie thing was are you new to the conference, not new to open source
2016-01-21 11:24:29 fs0ciety edunham: now i see
2016-01-21 11:24:47 fs0ciety edunham: well i guess i'm not in that demographic then :)
2016-01-21 11:25:09 edunham I mean, this'll be my first LCA, but I'm on the "pretty please don't make me Slack" side of the holy war so I figure I'd better back up my opinions with time and energy :)
2016-01-21 11:25:45 bradm what I don't get is people are all up in arms about Slack, but seem ok to use Twitter
2016-01-21 11:26:23 fs0ciety bradm: people are like that. haha.
2016-01-21 11:26:29 > threeminutemonta (~david@eth778.vic.adsl.internode.on.net) has joined #linux.conf.au
2016-01-21 11:26:39 adhoc_ bradm: for twitter, the barrier to entry is lower and it is public
2016-01-21 11:26:42 fs0ciety personally i'm not any social network sites, i do have my own personal xmpp server though.
2016-01-21 11:26:45 * faulteh_ expresses his smugness on gnusocial ;)
2016-01-21 11:26:49 adhoc_ bradm: thats a good point actually =)
2016-01-21 11:27:26 adhoc_ faulteh_: that still exists? link!??!
2016-01-21 11:27:37 DrParis adhoc_: irccloud isn’t very flossy, but it provides a featureset equivalent to slack on top of irc for those who want the slack features..
2016-01-21 11:27:49 faulteh_ adhoc_: http://gnu.io/social/
2016-01-21 11:27:56 DrParis and also provides the ease-of-entry that slack does, but to the IRC channel
2016-01-21 11:28:06 adhoc_ DrParis: i see the pricing model there now
2016-01-21 11:28:14 fs0ciety i'd just say just set up a irc channel that can be accessed via a web-page :)
2016-01-21 11:28:27 DrParis that’s already a thing, but then there’s no scrollback
2016-01-21 11:28:40 DrParis adhoc_: the free one is good enough; most of my friends use that to chat in our friends irc channel
2016-01-21 11:29:01 adhoc_ its another busuness model looking for a problem =)
2016-01-21 11:29:04 edunham faulteh_: that's neat! for "Quitter", is there a heuristic for deciding whether to hit the Sweden, Norway, or Iceland button?
2016-01-21 11:29:21 DrParis adhoc_: I think their business model is quite solid TBH –– I pay
2016-01-21 11:29:49 faulteh_ edunham: i'm not sure i was on LoadAverage for a while but now I run my own instance of gnusocial since it's all federated, even set one up for TasLUG to replace wordpress hehe
2016-01-21 11:29:59 edunham ah, cool
2016-01-21 11:30:07 < ecognito (~ecognito@cpe-120-146-201-233.static.vic.bigpond.net.au) has left #linux.conf.au
2016-01-21 11:30:46 < plaw (~plaw@ucalegon.bleeter.id.au) has quit (Changing host)
2016-01-21 11:30:46 > plaw (~plaw@guifications/user/plaw) has joined #linux.conf.au
2016-01-21 11:32:45 < jerrykan (~jerrykan@103.1.184.234) has quit (Ping timeout: 272 seconds)
2016-01-21 11:32:48 < dtbell91 (~dtbell91@127-20-88-118.dcwest.net.au) has quit (Ping timeout: 244 seconds)
2016-01-21 11:32:48 < [julian] (~jdemarchi@opennic/julian) has quit (Ping timeout: 244 seconds)
2016-01-21 11:33:24 > dtbell91 (~dtbell91@127-20-88-118.dcwest.net.au) has joined #linux.conf.au
2016-01-21 11:33:33 > jerrykan (~jerrykan@whatsit.theintraweb.net) has joined #linux.conf.au
2016-01-21 11:33:45 > [julian] (~jdemarchi@opennic/julian) has joined #linux.conf.au
2016-01-21 11:34:23 dtbell91 well there's a downside to IRC... when someone tried to steal your nick off your bouncer you get kicked and everything goes crazy for a minute
2016-01-21 11:34:33 dtbell91 s/tried/tries
2016-01-21 11:34:45 > gorilla (~George@203.208.90.115) has joined #linux.conf.au
2016-01-21 11:37:47 * vmbrasseur eyes dtbell91 suspiciously and keeps him far from her bouncer.
2016-01-21 11:38:26 adhoc_ dtbell91: does that occur with registered nicks ?
2016-01-21 11:38:36 fs0ciety vmbrasseur: Haha, i some how imagined that sentence in my head as if you literally had a bouncer? ;)
2016-01-21 11:38:44 dtbell91 I've registered this one I'm sure... It has a password (I think)
2016-01-21 11:39:09 adhoc_ dtbell91: i haven't had that problem in er .. about a decade
2016-01-21 11:39:14 adhoc_ at least
2016-01-21 11:39:25 < rav0__ (~rav0@252.87.149.122.sta.dodo.net.au) has quit (Ping timeout: 276 seconds)
2016-01-21 11:39:41 vmbrasseur fs0ciety I didn't before but I may need to open a req for one.
2016-01-21 11:39:45 simon_green And then there are the netsplits...
2016-01-21 11:41:03 adhoc_ simon_green: as oppsed to SPoFs ?
2016-01-21 11:41:05 fs0ciety simon_green: netsplits are .. ... painful
2016-01-21 11:41:55 adhoc_ when twitter or slacks auth goes down, which is does occasionally ...
2016-01-21 11:42:10 adhoc_ simon_green: every technology has its pain points
2016-01-21 11:44:18 > taylorbyte (~taylorbyt@202.172.121.52) has joined #linux.conf.au
2016-01-21 11:44:54 < taylorbyte (~taylorbyt@202.172.121.52) has quit (Max SendQ exceeded)
2016-01-21 11:49:18 > taylorbyte (~taylorbyt@202.172.121.52) has joined #linux.conf.au
2016-01-21 11:49:54 < taylorbyte (~taylorbyt@202.172.121.52) has quit (Max SendQ exceeded)
2016-01-21 11:50:58 - Guest96090 is now known as l33t0
2016-01-21 11:51:05 < l33t0 (~l33t0@srv1.tok.jp.vps.epic.as) has quit (Changing host)
2016-01-21 11:51:05 > l33t0 (~l33t0@unaffiliated/l33t0) has joined #linux.conf.au
2016-01-21 11:54:18 > taylorbyte (~taylorbyt@202.172.121.52) has joined #linux.conf.au
2016-01-21 11:54:49 < taylorbyte (~taylorbyt@202.172.121.52) has quit (Max SendQ exceeded)
2016-01-21 11:56:39 > todthomson (01846058@gateway/web/freenode/ip.1.132.96.88) has joined #linux.conf.au
2016-01-21 11:57:15 todthomson ELHO all ;)
2016-01-21 11:59:18 > taylorbyte (~taylorbyt@202.172.121.52) has joined #linux.conf.au
2016-01-21 11:59:54 < taylorbyte (~taylorbyt@202.172.121.52) has quit (Max SendQ exceeded)
2016-01-21 12:04:05 > ohithere (~binary@unaffiliated/ohithere) has joined #linux.conf.au
2016-01-21 12:11:03 > joern (~joern@50-206-43-50-static.hfc.comcastbusiness.net) has joined #linux.conf.au
2016-01-21 12:11:36 > taylorbyte (~taylorbyt@202.172.121.52) has joined #linux.conf.au
2016-01-21 12:11:45 < taylorbyte (~taylorbyt@202.172.121.52) has quit (Max SendQ exceeded)
2016-01-21 12:13:17 Hoolio lo todthomson
2016-01-21 12:16:36 > taylorbyte (~taylorbyt@202.172.121.52) has joined #linux.conf.au
2016-01-21 12:19:16 < stibbons (~stibbons@eth59-167-133-100.static.internode.on.net) has quit (Quit: Leaving.)
2016-01-21 12:22:06 > itgrrl (8899126a@gateway/web/freenode/ip.136.153.18.106) has joined #linux.conf.au
2016-01-21 12:30:42 < taylorbyte (~taylorbyt@202.172.121.52) has quit (Read error: Connection reset by peer)
2016-01-21 12:35:30 > taylorbyte (~taylorbyt@202.172.121.52) has joined #linux.conf.au
2016-01-21 12:37:23 todthomson lo Hoolio :)
2016-01-21 12:47:17 < taylorbyte (~taylorbyt@202.172.121.52) has quit (Ping timeout: 272 seconds)
2016-01-21 12:48:09 Endy Wow.... we have good signage this year, looking at the twitter feed :D
2016-01-21 12:49:54 fs0ciety how many attendee's do have now that it is sold out
2016-01-21 12:50:33 < todthomson (01846058@gateway/web/freenode/ip.1.132.96.88) has quit (Ping timeout: 252 seconds)
2016-01-21 12:50:35 bradm all of them? :)
2016-01-21 12:51:44 fs0ciety yup
2016-01-21 12:51:47 fs0ciety all of them
2016-01-21 12:52:12 dtbell91 yes, we have all of the attendees
2016-01-21 12:52:26 dtbell91 Endy: it's not what you know but who ;-)
2016-01-21 12:52:52 fs0ciety im glad i got my ticket in november
2016-01-21 12:54:19 Endy dtbell91: Too true, too true :D
2016-01-21 12:58:28 > taylorbyte (~taylorbyt@202.172.121.52) has joined #linux.conf.au
2016-01-21 13:02:26 > itgrrl_ (~itgrrl@pa49-195-151-206.pa.nsw.optusnet.com.au) has joined #linux.conf.au
2016-01-21 13:03:09 simon_green I'm glad I got ticket, airfare and accomodation back then.
2016-01-21 13:04:30 fs0ciety luckily i'm in melbourne, so i'm just driving back and forth except on thursday when its drink-a-thon for me
2016-01-21 13:07:52 nevyn fs0ciety: hallway track?
2016-01-21 13:08:01 * nevyn is driving down for the week
2016-01-21 13:08:32 < itgrrl_ (~itgrrl@pa49-195-151-206.pa.nsw.optusnet.com.au) has quit (Quit: bye)
2016-01-21 13:09:07 < joern (~joern@50-206-43-50-static.hfc.comcastbusiness.net) has quit (Ping timeout: 276 seconds)
2016-01-21 13:10:38 fs0ciety nevyn: systemau linux podcast are having a live episode at a local pub
2016-01-21 13:10:53 fs0ciety which gives me an excuse to drink in the evening
2016-01-21 13:13:46 nevyn excuse?
2016-01-21 13:15:36 fs0ciety well work is paying for linux conf ;)
2016-01-21 13:19:13 nevyn have you been before?
2016-01-21 13:20:00 > ctudball (cbd6451e@gateway/web/freenode/ip.203.214.69.30) has joined #linux.conf.au
2016-01-21 13:23:56 < AzMoo (~matt@unaffiliated/azmoo) has quit (Quit: AzMoo)
2016-01-21 13:27:33 - fukawi2 is now known as fukawi2`afk
2016-01-21 13:29:09 lordlod_ I think it was Sydney when I got to the end of the week and realised I had boozed it up every single night.
2016-01-21 13:32:34 > anibal (~anibal@CPE-124-189-180-120.cxzr1.win.bigpond.net.au) has joined #linux.conf.au
2016-01-21 13:33:30 < anibal (~anibal@CPE-124-189-180-120.cxzr1.win.bigpond.net.au) has quit (Quit: AtomicIRC: The nuclear option.)
2016-01-21 13:34:20 > AzMoo (~matt@unaffiliated/azmoo) has joined #linux.conf.au
2016-01-21 13:34:50 > anibal (~anibal@CPE-124-189-180-120.cxzr1.win.bigpond.net.au) has joined #linux.conf.au
2016-01-21 13:35:22 > ecognito (~ecognito@cpe-120-146-201-233.static.vic.bigpond.net.au) has joined #linux.conf.au
2016-01-21 13:39:26 brong this is my first LCA
2016-01-21 13:39:35 > teolupus (~teolupus@2404:130:0:1000:8192:6168:2716:ed05) has joined #linux.conf.au
2016-01-21 13:39:45 brong we booked a large AirBnB close to the conference for whoever from the company wants to crash on any night :)
2016-01-21 13:39:59 brong somehow I got accepted as a speaker
2016-01-21 13:40:14 brong I suspect it was a mistake, but I'm not going to look a gift horse in the camera
2016-01-21 13:40:58 KathyReid brong: with my Speaker Liaison hat on, I can definitively say it was not a mistake
2016-01-21 13:41:11 brong excellent
2016-01-21 13:41:15 brong I guess I should write my talk then
2016-01-21 13:41:42 KathyReid brong: first rule of Speaking, don't tell the Speaker Liaison you haven't written your talk :D
2016-01-21 13:41:49 KathyReid <-- #WrathyKathy
2016-01-21 13:41:59 brong oh, I mean - I guess I should _polish_ my talk
2016-01-21 13:42:13 KathyReid correct :-)
2016-01-21 13:42:43 teolupus I've got a registration code (voucher) provided by my company, but I'm getting a sold out error message from the website. Is there a way I can claim back this ticket online?
2016-01-21 13:42:53 brong I'll crack out a bucket of TurdSparkle2000Plus[tm]
2016-01-21 13:43:02 thaytan KathyReid, I prefer to write my talks the night before
2016-01-21 13:43:06 thaytan so it's all fresh in my mind
2016-01-21 13:43:23 KathyReid teolupus: drop me a line at contact@lcabythebay.org.au with your details. If you have a voucher code, we can register you
2016-01-21 13:43:23 thaytan otherwise, how do you know what you were going to say?
2016-01-21 13:43:41 brong thaytan: I was planning to make it all up on the spot
2016-01-21 13:43:47 teolupus KathyReid: will do. You should have an email form me in the next 3min.
2016-01-21 13:43:49 * KathyReid twitches nervously
2016-01-21 13:43:50 brong "hi, I'm Bron - any questions?"
2016-01-21 13:43:56 thaytan brong, the freshest of fresh!
2016-01-21 13:44:13 thaytan best to peruse the CoC a little beforehand
2016-01-21 13:44:17 KathyReid next you guys will be staying you don't rehearse your talk
2016-01-21 13:44:26 KathyReid teolupus: great stuff, thank you
2016-01-21 13:44:34 brong <flandersandswan>they practice beforehand, which ruins the fun</>
2016-01-21 13:44:59 * brong nips over to slack to sell a different story
2016-01-21 13:45:11 thaytan KathyReid, to me, rehearse is just a car you use for the 2nd funeral
2016-01-21 13:45:40 * KathyReid twitches more nervously
2016-01-21 13:46:09 JackScott brong: Make sure you include a live demo too, those always go well.
2016-01-21 13:46:10 zindello with regards to staying at LCA, I learned a long time ago that staying on or near campus is a must to get the most out of it
2016-01-21 13:46:34 brong oh man - I wish I had a video of the last time I did a live demo
2016-01-21 13:46:43 brong in front of the entire company :)
2016-01-21 13:46:48 zindello The conversations that go on, after hours, after a lot of beer, are priceless and every bit as valuable as the conference content its self (If you can remember them the next morning that is!)
2016-01-21 13:46:53 brong I shut down a production web server in the middle of my talk
2016-01-21 13:47:01 brong told it to reinstall itself
2016-01-21 13:47:03 robn` yeah, I was just about to say that
2016-01-21 13:47:10 robn` what brong calls "live demo" the rest of us call "production"
2016-01-21 13:47:12 - robn` is now known as robn
2016-01-21 13:47:19 brong got to the end of my talk and there was a slide saying "don't forget to bring web5 back up"
2016-01-21 13:47:22 zindello Haha
2016-01-21 13:47:27 zindello I love doing autoscaling demonstations
2016-01-21 13:47:32 brong so I switched to the console where the reinstall had finished and brought it back into production
2016-01-21 13:47:39 zindello "Here we have 6 servers in production" I'm just going to shutdown -h 3 of them
2016-01-21 13:47:49 zindello "Here hold my beer"
2016-01-21 13:48:15 teolupus KathyReid: done. I have provided all the details requested by the registration form on the email. Let me know if you need anything else.
2016-01-21 13:48:16 brong {emoji response}
2016-01-21 13:49:23 robn brong: that's just lazy 😎
2016-01-21 13:49:29 brong ok, enough harassing organisers - I'm going to go pretend I understand email RFCs for real for a bit
2016-01-21 13:49:51 < radsy (~irc@unaffiliated/radsy) has quit (Quit: Leaving)
2016-01-21 13:50:33 brong KathyReid: I promise you my talk will be written, rehearsed(ish) and awesome before the appointed time
2016-01-21 13:50:42 brong robn: shut up
2016-01-21 13:50:49 KathyReid brong: this pleases me :D
2016-01-21 13:50:57 robn brong: yes boss
2016-01-21 13:51:05 > noisymime (noisymime@nat/ibm/x-laohpnwvkyyvklfj) has joined #linux.conf.au
2016-01-21 13:52:58 < neonsignal (~neonsigna@2400:6180:0:d0::438:4001) has left #linux.conf.au
2016-01-21 13:58:03 teolupus Will there be a bus service on Friday returning to Melbourne? What time will it start? Will the airport be its destination?
2016-01-21 13:59:03 teolupus Ignore my question. Found the bus service page. ;-)
2016-01-21 13:59:11 lathiat was jsut about to link that :P
2016-01-21 14:01:49 > fraxinath (~quassel@p4FD48AE7.dip0.t-ipconnect.de) has joined #linux.conf.au
2016-01-21 14:03:29 - fukawi2`afk is now known as fukawi2
2016-01-21 14:03:49 > joern (~joern@c-69-181-137-195.hsd1.ca.comcast.net) has joined #linux.conf.au
2016-01-21 14:04:26 < fraxinas (~quassel@p4FD487DC.dip0.t-ipconnect.de) has quit (Ping timeout: 260 seconds)
2016-01-21 14:04:51 > realist (~realist@unaffiliated/realist) has joined #linux.conf.au
2016-01-21 14:06:13 - Hoolio is now known as Hoolio_
2016-01-21 14:06:15 < AzMoo (~matt@unaffiliated/azmoo) has quit (Quit: AzMoo)
2016-01-21 14:11:33 > AzMoo (~matt@unaffiliated/azmoo) has joined #linux.conf.au
2016-01-21 14:17:10 > Hoolio (~hoolio@vm-144-6-224-56.rc.tasmania.nectar.org.au) has joined #linux.conf.au
2016-01-21 14:20:22 > neonsignal (~neonsigna@2400:6180:0:d0::438:4001) has joined #linux.conf.au
2016-01-21 14:20:28 teolupus KathyReid: it is done. Just need you to manually confirm the payment of the invoice now.
2016-01-21 14:20:59 KathyReid teolupus: on it
2016-01-21 14:22:53 KathyReid teolupus: manual payment applied, you're good to go
2016-01-21 14:23:32 hoju37 another satisfied customer
2016-01-21 14:50:57 < anibal (~anibal@CPE-124-189-180-120.cxzr1.win.bigpond.net.au) has quit (Ping timeout: 250 seconds)
2016-01-21 14:53:52 - DocJosh_ is now known as DocJosh
2016-01-21 15:04:20 < ccaffeini (crazyed@wrongplanet/CrazyEddy) has quit (Remote host closed the connection)
2016-01-21 15:14:34 craige Heya evil_steve. I'm going bring some scotch to LCA so I can lure you to comfy couch some where and talk at length admin work and other related matters (if you saw my eail from some weeks ago).
2016-01-21 15:15:18 fs0ciety craige: that sounded pretty creepy
2016-01-21 15:15:20 fs0ciety ;)
2016-01-21 15:16:44 hoju37 A bottle of scotch attached to a length of string?
2016-01-21 15:16:57 tserong there'll probably be a net, too
2016-01-21 15:17:29 bradm does the scotch have ACME written down the side?
2016-01-21 15:17:39 > ccaffeini (crazyed@wrongplanet/CrazyEddy) has joined #linux.conf.au
2016-01-21 15:17:56 tserong i expect it to go a bit like this: http://i.giphy.com/dybLdL1l7mB6o.gif
2016-01-21 15:18:05 craige Was meant to fs0ciety. evil_steve likes it that way.
2016-01-21 15:18:36 tserong (that vid is from http://www.nature.com/news/when-chickens-go-wild-1.19195 BTW)
2016-01-21 15:21:10 craige I prefer the sequel, Chickens on Spring Break.
2016-01-21 15:22:28 bradm I was thinking more Road Runner and Wile E Coyote, but the classic one, not the new modern 3d version.
2016-01-21 15:34:27 < itgrrl (8899126a@gateway/web/freenode/ip.136.153.18.106) has quit (Ping timeout: 252 seconds)
2016-01-21 15:37:26 < brong (~brong@c-71-58-2-242.hsd1.pa.comcast.net) has quit (Remote host closed the connection)
2016-01-21 15:38:32 > brong (~brong@c-71-58-2-242.hsd1.pa.comcast.net) has joined #linux.conf.au
2016-01-21 15:38:34 > anibal (~anibal@CPE-124-189-180-120.cxzr1.win.bigpond.net.au) has joined #linux.conf.au
2016-01-21 15:43:27 < teolupus (~teolupus@2404:130:0:1000:8192:6168:2716:ed05) has quit (Ping timeout: 250 seconds)
2016-01-21 15:50:07 zindello I hope it's a top notch bottle of scotch, otherwise that's pretty cheap consulting rates :P
2016-01-21 15:52:38 adhoc_ i presume there will be a scotch BoF
2016-01-21 15:52:45 adhoc_ speaking of invite only social networks
2016-01-21 15:52:46 adhoc_ =P
2016-01-21 16:02:28 < brong (~brong@c-71-58-2-242.hsd1.pa.comcast.net) has quit (Remote host closed the connection)
2016-01-21 16:17:34 < noisymime (noisymime@nat/ibm/x-laohpnwvkyyvklfj) has quit (Quit: noisymime)
2016-01-21 16:42:32 evil_steve adhoc_: I tend to find out about it 30 minutes into the event
2016-01-21 16:42:42 evil_steve when someone messages me to say "hey, where are"
2016-01-21 16:46:39 evil_steve craige: this is the "anyone can commit a change to the LA systems if they can find enough friends to upvote it" crowdsourced devops idea?
2016-01-21 16:49:21 craige among many others evil_steve.
2016-01-21 16:49:24 aj evil_steve: i read that as crowd-sourced content updates (wikipedia like) not devops (jenkins/openstack)
2016-01-21 16:49:45 craige I need to do some high bandwidth listening evil_steve.
2016-01-21 16:50:05 craige Then perhaps bounce some ideas around and see what sticks.
2016-01-21 16:54:01 evil_steve sure
2016-01-21 16:54:16 evil_steve aj: the example used was to resolve an issue with some apache configuration
2016-01-21 16:54:34 evil_steve but I think Craige will need to bring several cases and a new liver, and we'll see what comes out of it
2016-01-21 16:57:11 > noisymime (~noisymime@189.85.96.58.static.exetel.com.au) has joined #linux.conf.au
2016-01-21 16:57:23 < anibal (~anibal@CPE-124-189-180-120.cxzr1.win.bigpond.net.au) has quit (Ping timeout: 265 seconds)
2016-01-21 16:58:44 < noisymime (~noisymime@189.85.96.58.static.exetel.com.au) has quit (Client Quit)
2016-01-21 16:59:53 craige sounds like a plan evil_steve.
2016-01-21 17:04:00 < AzMoo (~matt@unaffiliated/azmoo) has quit (Quit: AzMoo)
2016-01-21 17:09:51 aj evil_steve: well i could imagine gerrit/etc and configuration /could/ work, but it doesn't seem like as much of a win as doing it for website contents
2016-01-21 17:20:33 bradm aj: that's how the openstack infra team works, I thought.
2016-01-21 17:21:54 aj bradm: don't know; suspect it's mostly within the team rather than getting benefits from crowdsourcing though?
2016-01-21 17:23:26 bradm aj: I'm fairly sure you need someone from the team to approve it at least
2016-01-21 17:24:41 bradm there's even a talk at the conf about it.
2016-01-21 17:25:26 < threeminutemonta (~david@eth778.vic.adsl.internode.on.net) has quit (Ping timeout: 250 seconds)
2016-01-21 17:30:32 > noisymime (~noisymime@189.85.96.58.static.exetel.com.au) has joined #linux.conf.au
2016-01-21 17:31:18 < noisymime (~noisymime@189.85.96.58.static.exetel.com.au) has quit (Client Quit)
2016-01-21 17:42:07 > rav0__ (~rav0@110.143.149.122.sta.dodo.net.au) has joined #linux.conf.au
2016-01-21 17:43:14 > radsy (~irc@unaffiliated/radsy) has joined #linux.conf.au
2016-01-21 18:11:56 - irc: disconnected from server
| IRC log | 0 | 0x4b1dN/2016-dots | misc/weechat/logs/irc.freenode.#linux.conf.au.weechatlog | [
"MIT"
] |
package unit.issues.misc;
typedef Issue5255Class<T> = Issue5255Class_<T>;
class Issue5255Class_<T> {
@:generic public static function test<T>(arg:T){
return arg;
}
}
| Haxe | 3 | Alan-love/haxe | tests/unit/src/unit/issues/misc/Issue5255Class.hx | [
"MIT"
] |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This file is part of Logtalk <https://logtalk.org/>
% Copyright 1998-2021 Paulo Moura <pmoura@logtalk.org>
% SPDX-License-Identifier: Apache-2.0
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- object(registry_loader_hook,
implements(expanding)).
:- info([
version is 0:9:0,
author is 'Paulo Moura',
date is 2021-10-15,
comment is 'Hook object for filtering registry loader file contents.'
]).
term_expansion((:- initialization(Goal)), (:- initialization(ExpandedGoal))) :-
ground(Goal),
expand(Goal, ExpandedGoal).
% suppress anything else
term_expansion(_, []).
expand((Goal, Goals), (ExpandedGoal, ExpandedGoals)) :-
expand(Goal, ExpandedGoal),
expand(Goals, ExpandedGoals).
expand(logtalk_load(Files, _), logtalk_load(Files, [hook(packs_specs_hook), source_data(on)])) :-
atom_or_atom_list(Files).
expand(logtalk_load(Files), logtalk_load(Files, [hook(packs_specs_hook), source_data(on)])) :-
atom_or_atom_list(Files).
atom_or_atom_list((-)) :-
!,
fail.
atom_or_atom_list([]) :-
!.
atom_or_atom_list([File| Files]) :-
!,
atom(File),
atom_or_atom_list(Files).
atom_or_atom_list(File) :-
atom(File).
:- end_object.
:- object(packs_specs_hook,
implements(expanding)).
:- info([
version is 0:9:0,
author is 'Paulo Moura',
date is 2021-10-15,
comment is 'Hook object for filtering registry and pack specification file contents.'
]).
% filter directives
term_expansion((:- Directive), (:- Directive)) :-
ground(Directive),
valid_directive(Directive).
% suppress rules
term_expansion((_ :- _), []).
% filter facts
term_expansion(Fact, Fact) :-
ground(Fact),
valid_fact(Fact).
% suppress anything else
term_expansion(_, []).
valid_directive(object(_, implements(registry_protocol))).
valid_directive(object(_, implements(pack_protocol))).
valid_directive(info(_)).
valid_directive(end_object).
% common spec
valid_fact(name(Name)) :- atom(Name).
valid_fact(description(Description)) :- atom(Description).
valid_fact(home(URL)) :- safe_url(URL).
% registry spec
valid_fact(clone(URL)) :- safe_url(URL).
valid_fact(archive(URL)) :- safe_url(URL).
% registry spec
valid_fact(license(License)) :- atom(License).
valid_fact(version(_, _, URL, _, _, _)) :- safe_url(URL).
safe_url(URL) :-
( sub_atom(URL, 0, _, _, 'https://') ->
true
; sub_atom(URL, 0, _, _, 'file://')
),
\+ sub_atom(URL, _, _, _, '?').
:- end_object.
| Logtalk | 4 | LogtalkDotOrg/logtalk3 | tools/packs/safety_hooks.lgt | [
"Apache-2.0"
] |
--TEST--
curl_multi_close closed by cleanup functions
--EXTENSIONS--
curl
--FILE--
<?php
$mh = curl_multi_init();
$array = array($mh);
$array[] = &$array;
curl_multi_add_handle($mh, curl_init());
curl_multi_add_handle($mh, curl_init());
curl_multi_add_handle($mh, curl_init());
curl_multi_add_handle($mh, curl_init());
echo "okey";
?>
--EXPECT--
okey
| PHP | 3 | NathanFreeman/php-src | ext/curl/tests/curl_multi_close_reference.phpt | [
"PHP-3.01"
] |
extern crate foobar;
extern crate foobar_macro;
use foobar::*;
use foobar_macro::*;
a_proc_macro!(); // no
#[an_attr_macro]
fn a() {
f(); // no
}
#[an_attr_macro(with_span)]
fn b() {
f(); // yes
}
fn c() {
a_rules_macro!(f()); // yes
}
fn d() {
a_rules_macro!(()); // no
}
fn main(){}
| Rust | 4 | ohno418/rust | src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
proc f() {
return 0;
}
proc g() {
return 1;
}
class Parent {
proc method(arg:int = f()) {
writeln("in Parent.method arg=", arg);
}
}
class Child : Parent {
override proc method(arg:int = g()) {
writeln("in Child.method arg=", arg);
}
}
proc main() {
var x:Parent = new Child();
x.method();
var y = new Child();
y.method();
}
| Chapel | 4 | jhh67/chapel | test/classes/override/override-vdispatch-def-arg.chpl | [
"ECL-2.0",
"Apache-2.0"
] |
set --local BASENAME --regex -- '[^/]+$'
@echo (fisher --version)
@test "fisher install" (
fisher install tests/ponyo >/dev/null
) "$ponyo" = "pyon pyon"
@test "fisher list" (
fisher list | string match $BASENAME | string join " "
) = "fisher fishtape ponyo"
@test "fisher list regex" (
fisher list ponyo | string match $BASENAME
) = ponyo
@test "pyon pyon" (fish --command ponyo | string join " ") = "pyon pyon ponyo"
@test "fisher update" (
fisher update tests/ponyo >/dev/null
) "$ponyo" = "pyon pyon pyon"
@test "fisher remove" (
fisher remove tests/ponyo >/dev/null
) "$ponyo" = ""
@test "has state" -n (
set --names | string match \*fisher\* | string collect
)
@test fish_plugins (
fisher list | string collect
) = (read --null <$__fish_config_dir/fish_plugins | string collect)
| fish | 3 | kenchou/fisher | tests/fisher.fish | [
"MIT"
] |
package {
public class Test {
}
}
import flash.utils.Dictionary;
trace("///var a = new Dictionary()");
var a = new Dictionary();
trace("///a[\"key\"] = 5");
a["key"] = 5;
trace("///a[\"key\"]");
trace(a["key"]);
trace("///a[\"key\"] = 6");
a["key"] = 6;
trace("///var key2 = new Test()");
var key2 = new Test();
trace("///a[key2] = 23");
a[key2] = 23;
trace("///var key3 = new Test()");
var key3 = new Test();
trace('///a[key3] = "Key3 True Value"');
a[key3] = "Key3 True Value";
trace('///a["key3"] = "Key3 False Value"');
a["key3"] = "Key3 False Value";
trace("///var key4 = {\"toString\": function() { return \"key4\"; }}");
var key4 = {"toString": function() { return "key4"; }};
trace('///a[key4] = "Key4 True Value"');
a[key4] = "Key4 True Value";
trace('///a["key4"] = "Key4 False Value"');
a["key4"] = "Key4 False Value";
trace('///a[13] = "i\'ve been found!"');
a[13] = "i've been found!";
trace('///a["13"] = "no I haven\'t"');
a["13"] = "no I haven't";
trace('///a[1.123] = "this violates Rust!"');
a[1.123] = "this violates Rust!";
trace('///a["1.123"] = "this is perfectly acceptable"');
a["1.123"] = "this is perfectly acceptable";
trace('///a[undefined] = "oh no"');
a[undefined] = "oh no";
trace('///a["undefined"] = "uh huh..."');
a["undefined"] = "uh huh...";
trace('///a[null] = "oh YES!"');
a[null] = "oh YES!";
trace('///a["null"] = "yeah sure"');
a["null"] = "yeah sure";
trace('///a[true] = "true"');
a[true] = "true";
trace('///a["true"] = "stringy true"');
a["true"] = "stringy true";
trace('///a[false] = "false"');
a[false] = "false";
trace('///a["false"] = "stringy false"');
a["false"] = "stringy false";
trace('///a[a] = a');
a[a] = a;
var has_key2 = false;
var has_key3 = false;
var has_key4 = false;
trace("/// (enumerating object keys...)");
for (var k in a) {
if (k === key2) {
has_key2 = true;
} else if (k === key3) {
has_key3 = true;
} else if (k === key4) {
has_key4 = true;
}
}
if (has_key2) {
trace("/// (Found key2!)");
}
if (has_key3) {
trace("/// (Found key3!)");
}
if (has_key4) {
trace("/// (Found key4!)");
}
trace("///a.setPropertyIsEnumerable(key2, false);");
a.setPropertyIsEnumerable(key2, false);
trace("///a.setPropertyIsEnumerable(key3, false);");
a.setPropertyIsEnumerable(key3, false);
trace("///a.setPropertyIsEnumerable(key4, false);");
a.setPropertyIsEnumerable(key4, false);
has_key2 = false;
has_key3 = false;
has_key4 = false;
trace("/// (enumerating object keys...)");
for (var k in a) {
if (k === key2) {
has_key2 = true;
} else if (k === key3) {
has_key3 = true;
} else if (k === key4) {
has_key4 = true;
}
}
if (has_key2) {
trace("/// (Found key2!)");
}
if (has_key3) {
trace("/// (Found key3!)");
}
if (has_key4) {
trace("/// (Found key4!)");
}
| ActionScript | 4 | Sprak1/ruffle | tests/tests/swfs/avm2/dictionary_foreach/Test.as | [
"Apache-2.0",
"Unlicense"
] |
/*
* Copyright Disney Enterprises, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License
* and the following modification to it: Section 6 Trademarks.
* deleted and replaced with:
*
* 6. Trademarks. This License does not grant permission to use the
* trade names, trademarks, service marks, or product names of the
* Licensor and its affiliates, except as required for reproducing
* the content of the NOTICE file.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*/
plugin "libSeExprOp2.so";
displacement testdisp(
uniform string DispExpr="0";
)
{
normal Nobj=transform("object",N);
normal Nn=normalize(Nobj);
color res=0;
uniform float used[];
uniform string varNames="(error) Pw P N";
point Pw=transform("world",P);
point Pobj=transform("object",P);
varying color varValues[]={color(Pw),color(Pobj),color(Nobj)};
uniform float DispExprHandle=SeExprBind(DispExpr,varNames,used);
color disp=0;
SeExprEval(DispExprHandle,varValues,disp);
Pobj+=Nn*disp[0];
// recompute position and normal
point Ptmp=transform("object","current",Pobj);
normal Ntmp=-calculatenormal(Ptmp);
N=Ntmp;
P=Ptmp;
}
| Slash | 4 | zsnake1209/SeExpr | src/demos/rman2/testdisp.sl | [
"Apache-2.0"
] |
/* jconfig.sas --- jconfig.h for Amiga systems using SAS C 6.0 and up. */
/* see jconfig.doc for explanations */
#define HAVE_PROTOTYPES
#define HAVE_UNSIGNED_CHAR
#define HAVE_UNSIGNED_SHORT
/* #define void char */
/* #define const */
#undef CHAR_IS_UNSIGNED
#define HAVE_STDDEF_H
#define HAVE_STDLIB_H
#undef NEED_BSD_STRINGS
#undef NEED_SYS_TYPES_H
#undef NEED_FAR_POINTERS
#undef NEED_SHORT_EXTERNAL_NAMES
#undef INCOMPLETE_TYPES_BROKEN
#ifdef JPEG_INTERNALS
#undef RIGHT_SHIFT_IS_UNSIGNED
#define TEMP_DIRECTORY "JPEGTMP:" /* recommended setting for Amiga */
#define NO_MKTEMP /* SAS C doesn't have mktemp() */
#define SHORTxSHORT_32 /* produces better DCT code with SAS C */
#endif /* JPEG_INTERNALS */
#ifdef JPEG_CJPEG_DJPEG
#define BMP_SUPPORTED /* BMP image file format */
#define GIF_SUPPORTED /* GIF image file format */
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
#undef RLE_SUPPORTED /* Utah RLE image file format */
#define TARGA_SUPPORTED /* Targa image file format */
#define TWO_FILE_COMMANDLINE
#define NEED_SIGNAL_CATCHER
#undef DONT_USE_B_MODE
#undef PROGRESS_REPORT /* optional */
#endif /* JPEG_CJPEG_DJPEG */
| SAS | 3 | hyu-iot/gem5 | mibench/office/ghostscript/src/jpeg-6a/jconfig.sas | [
"BSD-3-Clause"
] |
/********************************************************************************
* 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 com.intellij.navigation {
ItemPresentation,
ItemPresentationProvider,
ColoredItemPresentation
}
import com.intellij.openapi.editor.colors {
CodeInsightColors
}
import org.eclipse.ceylon.model.typechecker.model {
ClassOrInterface
}
import org.eclipse.ceylon.ide.intellij.psi {
CeylonPsi
}
import org.eclipse.ceylon.ide.intellij.psi.impl {
DeclarationPsiNameIdOwner,
SpecifierStatementPsiIdOwner
}
import org.eclipse.ceylon.ide.intellij.util {
icons
}
shared class DeclarationPresentationProvider()
satisfies ItemPresentationProvider<DeclarationPsiNameIdOwner> {
shared actual ItemPresentation getPresentation(DeclarationPsiNameIdOwner item)
=> object satisfies ColoredItemPresentation {
shared actual String? presentableText {
if (exists model = item.ceylonNode?.declarationModel) {
value name = model.name;
if (is ClassOrInterface classOrInterface = model.container) {
return classOrInterface.name + "." + name;
} else {
return name;
}
} else {
if (exists name = item.ceylonNode?.identifier?.text) {
if (is CeylonPsi.ClassOrInterfacePsi classOrInterface = item.parent) {
if (exists typeName = classOrInterface.ceylonNode?.identifier?.text) {
return typeName + "." + name;
}
} else {
return name;
}
}
return null;
}
}
shared actual String? locationString {
if (exists model = item.ceylonNode?.declarationModel) {
value nat = model.native then "``model.nativeBackends`` " else "";
value dec
= if (is ClassOrInterface container = model.container)
then container else model;
value qualifiedNameString = dec.container.qualifiedNameString;
return qualifiedNameString.empty
then nat + "(default package)"
else nat + "(``qualifiedNameString``)";
} else if (exists unit = item.ceylonNode?.unit) {
value nameAsString = unit.\ipackage.nameAsString;
return nameAsString.empty
then "(default package)"
else "(``nameAsString``)";
} else {
return null;
}
}
getIcon(Boolean unused)
=> if (exists node = item.ceylonNode)
then icons.forDeclaration(node)
else null;
textAttributesKey
=> if (exists model = item.ceylonNode?.declarationModel, model.deprecated)
then CodeInsightColors.deprecatedAttributes
else null;
};
}
shared class SpecifierPresentationProvider()
satisfies ItemPresentationProvider<SpecifierStatementPsiIdOwner> {
shared actual ItemPresentation? getPresentation(SpecifierStatementPsiIdOwner item)
=> item.ceylonNode.refinement then
object satisfies ItemPresentation {
shared actual String? presentableText {
if (exists model = item.ceylonNode?.declaration) {
value name = model.name;
if (is ClassOrInterface classOrInterface = model.container) {
return classOrInterface.name + "." + name;
} else {
return name;
}
} else {
if (exists text = item.ceylonNode?.baseMemberExpression?.text) {
if (is CeylonPsi.ClassOrInterfacePsi classOrInterface = item.parent) {
if (exists typeName = classOrInterface.ceylonNode?.identifier?.text) {
return typeName + "." + text;
}
} else {
return text;
}
}
return null;
}
}
shared actual String? locationString {
if (exists model = item.ceylonNode?.declaration) {
value dec
= if (is ClassOrInterface container = model.container)
then container else model;
value qualifiedNameString = dec.container.qualifiedNameString;
return if (qualifiedNameString.empty)
then "(default package)"
else "(``qualifiedNameString``)";
} else if (exists unit = item.ceylonNode?.unit) {
value nameAsString = unit.\ipackage.nameAsString;
return nameAsString.empty
then "(default package)"
else "(``nameAsString``)";
}
else {
return null;
}
}
getIcon(Boolean unused)
=> if (exists node = item.ceylonNode)
then icons.forDeclaration(node)
else null;
};
}
| Ceylon | 4 | Kopilov/ceylon-ide-intellij | source/org/eclipse/ceylon/ide/intellij/presentation/PresentationProvider.ceylon | [
"Apache-2.0"
] |
{-# LANGUAGE CPP, RankNTypes, UndecidableInstances, GADTs, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.FileInput
(
-- * Hierarchy
--
-- $hierarchy
-- * Widget Functions
--
-- $functions
)
where
#include "Fl_ExportMacros.h"
#include "Fl_Types.h"
#include "Fl_File_InputC.h"
import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Utils
import Graphics.UI.FLTK.LowLevel.Dispatch
import Graphics.UI.FLTK.LowLevel.Hierarchy
{# fun Fl_File_Input_draw as draw'' { id `Ptr ()' } -> `()' #}
instance (impl ~ ( IO ())) => Op (Draw ()) FileInput orig impl where
runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> draw'' fileInputPtr
{#fun Fl_File_Input_handle as fileInputHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) FileInput orig impl where
runOp _ _ fileInput event = withRef fileInput (\p -> fileInputHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent
{# fun Fl_File_Input_hide as hide' { id `Ptr ()' } -> `()' #}
instance (impl ~ ( IO ())) => Op (Hide ()) FileInput orig impl where
runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> hide' fileInputPtr
{# fun Fl_File_Input_show as show' { id `Ptr ()' } -> `()' #}
instance (impl ~ ( IO ())) => Op (ShowWidget ()) FileInput orig impl where
runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> show' fileInputPtr
{# fun Fl_File_Input_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) FileInput orig impl where
runOp _ _ fileInput rectangle = withRef fileInput $ \fileInputPtr -> do
let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
resize' fileInputPtr x_pos y_pos w_pos h_pos
-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Base.Widget"
-- |
-- v
-- "Graphics.UI.FLTK.LowLevel.Base.Input"
-- |
-- v
-- "Graphics.UI.FLTK.LowLevel.Base.FileInput"
-- |
-- v
-- "Graphics.UI.FLTK.LowLevel.FileInput"
-- @
-- $functions
-- @
-- draw :: 'Ref' 'FileInput' -> 'IO' ()
--
-- handle :: 'Ref' 'FileInput' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'FileInput' -> 'IO' ()
--
-- resize :: 'Ref' 'FileInput' -> 'Rectangle' -> 'IO' ()
--
-- showWidget :: 'Ref' 'FileInput' -> 'IO' ()
-- @
| C2hs Haskell | 4 | ericu/fltkhs | src/Graphics/UI/FLTK/LowLevel/FileInput.chs | [
"MIT"
] |
<!DOCTYPE html>
<html xmlns:py="http://genshi.edgewall.org/">
<head>
<title>PyOpenGL ${version} Function Reference</title>
<link rel="stylesheet" href="./manpage.css" type="text/css" />
<link rel="stylesheet" href="./modern.css" type="text/css" />
<meta charset="utf-8" />
</head>
<body>
<header>
<ul class="menu">
<li><a href="../../index.html">Home</a></li>
<li><a href="../index.html">Docs</a></li>
<li><a href="../installation.html">Install</a></li>
</ul>
<h1>PyOpenGL ${version}</h1>
</header>
<section class="jump-list">
<ul class="toc"><li py:for="package in ref.package_names()">
<a href="#${package}">${package} Reference</a>
</li>
<li><a href="../pydoc/OpenGL.html">Overall PyDoc</a> -- includes Python-specific helper modules and the OpenGL extension modules.
<ul class="toc">
<li py:for="module_name,desc in implementation_module_names">
<a href="../pydoc/OpenGL.${module_name}.html">OpenGL.${module_name} PyDoc</a> ${desc}
</li>
</ul>
</li>
</ul>
</section>
<section py:for="(package,sections) in ref.packages()" class="reference">
<h2 class="package-title"><a name="${package}"/>${package} Reference</h2>
<table><tbody><tr ><th align="right">Function</th><th>Purpose</th></tr>
<tr py:for="name,section in sections" valign="top">
<th align="right" class="section-name">
<a href="${ref.url(section)}">${name}</a>
</th>
<td class="purpose">${section.purpose}</td>
</tr>
</tbody></table>
</section>
<section class="mathjax-note">
<h2>MathML rendering</h2>
<div><a href="http://www.mathjax.org/">
<img title="Powered by MathJax"
src="http://www.mathjax.org/badge.gif"
border="0" alt="Powered by MathJax" /></a></div>
</section>
<footer>
<ul class="menu">
<li><a href="../../index.html">Home</a></li>
<li><a href="../index.html">Docs</a></li>
<li><a href="../installation.html">Install</a></li>
</ul>
<div class="metadata">This document was generated by <code>pyopengl/directdocs</code> on ${date}</div>
</footer>
</body>
</html>
| Genshi | 3 | t20100/pyopengl | directdocs/templates/index.kid | [
"BSD-2-Clause",
"MIT"
] |
"""Diagnostics support for NAM."""
from __future__ import annotations
from dataclasses import asdict
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from . import NAMDataUpdateCoordinator
from .const import DOMAIN
TO_REDACT = {CONF_PASSWORD, CONF_USERNAME}
async def async_get_config_entry_diagnostics(
hass: HomeAssistant, config_entry: ConfigEntry
) -> dict:
"""Return diagnostics for a config entry."""
coordinator: NAMDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
diagnostics_data = {
"info": async_redact_data(config_entry.data, TO_REDACT),
"data": asdict(coordinator.data),
}
return diagnostics_data
| Python | 5 | MrDelik/core | homeassistant/components/nam/diagnostics.py | [
"Apache-2.0"
] |
@import 'nib'
// From https://github.com/tobiasahlin/SpinKit
.sk-spinner-bounce {
margin: 100px auto 0;
width: 70px;
text-align: center;
div {
width: 18px;
height: 18px;
background-color: #333;
border-radius: 100%;
display: inline-block;
-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}
.sk-bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.sk-bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
}
@-webkit-keyframes sk-bouncedelay {
0%, 80%, 100% { -webkit-transform: scale(0) }
40% { -webkit-transform: scale(1.0) }
}
@keyframes sk-bouncedelay {
0%, 80%, 100% {
-webkit-transform: scale(0);
transform: scale(0);
} 40% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
}
| Stylus | 3 | UBessle/wekan | client/components/main/spinner_bounce.styl | [
"MIT"
] |
#summary archive_entry 3 manual page
== NAME ==
*archive_entry_acl_add_entry*,
*archive_entry_acl_add_entry_w*,
*archive_entry_acl_clear*,
*archive_entry_acl_count*,
*archive_entry_acl_next*,
*archive_entry_acl_next_w*,
*archive_entry_acl_reset*,
*archive_entry_acl_text_w*,
*archive_entry_atime*,
*archive_entry_atime_nsec*,
*archive_entry_clear*,
*archive_entry_clone*,
*archive_entry_copy_fflags_text*,
*archive_entry_copy_fflags_text_w*,
*archive_entry_copy_gname*,
*archive_entry_copy_gname_w*,
*archive_entry_copy_hardlink*,
*archive_entry_copy_hardlink_w*,
*archive_entry_copy_link*,
*archive_entry_copy_link_w*,
*archive_entry_copy_pathname_w*,
*archive_entry_copy_sourcepath*,
*archive_entry_copy_stat*,
*archive_entry_copy_symlink*,
*archive_entry_copy_symlink_w*,
*archive_entry_copy_uname*,
*archive_entry_copy_uname_w*,
*archive_entry_dev*,
*archive_entry_devmajor*,
*archive_entry_devminor*,
*archive_entry_filetype*,
*archive_entry_fflags*,
*archive_entry_fflags_text*,
*archive_entry_free*,
*archive_entry_gid*,
*archive_entry_gname*,
*archive_entry_hardlink*,
*archive_entry_ino*,
*archive_entry_mode*,
*archive_entry_mtime*,
*archive_entry_mtime_nsec*,
*archive_entry_nlink*,
*archive_entry_new*,
*archive_entry_pathname*,
*archive_entry_pathname_w*,
*archive_entry_rdev*,
*archive_entry_rdevmajor*,
*archive_entry_rdevminor*,
*archive_entry_set_atime*,
*archive_entry_set_ctime*,
*archive_entry_set_dev*,
*archive_entry_set_devmajor*,
*archive_entry_set_devminor*,
*archive_entry_set_filetype*,
*archive_entry_set_fflags*,
*archive_entry_set_gid*,
*archive_entry_set_gname*,
*archive_entry_set_hardlink*,
*archive_entry_set_link*,
*archive_entry_set_mode*,
*archive_entry_set_mtime*,
*archive_entry_set_pathname*,
*archive_entry_set_rdevmajor*,
*archive_entry_set_rdevminor*,
*archive_entry_set_size*,
*archive_entry_set_symlink*,
*archive_entry_set_uid*,
*archive_entry_set_uname*,
*archive_entry_size*,
*archive_entry_sourcepath*,
*archive_entry_stat*,
*archive_entry_symlink*,
*archive_entry_uid*,
*archive_entry_uname*
- functions for manipulating archive entry descriptions
== SYNOPSIS ==
*#include <archive_entry.h>*
<br>
*void*
<br>
*archive_entry_acl_add_entry*(_struct archive_entry `*`_, _int type_, _int permset_, _int tag_, _int qual_, _const char `*`name_);
<br>
*void*
<br>
*archive_entry_acl_add_entry_w*(_struct archive_entry `*`_, _int type_, _int permset_, _int tag_, _int qual_, _const wchar_t `*`name_);
<br>
*void*
<br>
*archive_entry_acl_clear*(_struct archive_entry `*`_);
<br>
*int*
<br>
*archive_entry_acl_count*(_struct archive_entry `*`_, _int type_);
<br>
*int*
<br>
*archive_entry_acl_next*(_struct archive_entry `*`_, _int want_type_, _int `*`type_, _int `*`permset_, _int `*`tag_, _int `*`qual_, _const char `*``*`name_);
<br>
*int*
<br>
*archive_entry_acl_next_w*(_struct archive_entry `*`_, _int want_type_, _int `*`type_, _int `*`permset_, _int `*`tag_, _int `*`qual_, _const wchar_t `*``*`name_);
<br>
*int*
<br>
*archive_entry_acl_reset*(_struct archive_entry `*`_, _int want_type_);
<br>
*const wchar_t `*`*
<br>
*archive_entry_acl_text_w*(_struct archive_entry `*`_, _int flags_);
<br>
*time_t*
<br>
*archive_entry_atime*(_struct archive_entry `*`_);
<br>
*long*
<br>
*archive_entry_atime_nsec*(_struct archive_entry `*`_);
<br>
*struct archive_entry `*`*
<br>
*archive_entry_clear*(_struct archive_entry `*`_);
<br>
*struct archive_entry `*`*
<br>
*archive_entry_clone*(_struct archive_entry `*`_);
<br>
*const char `*` `*`*
<br>
*archive_entry_copy_fflags_text_w*(_struct archive_entry `*`_, _const char `*`_);
<br>
*const wchar_t `*`*
<br>
*archive_entry_copy_fflags_text_w*(_struct archive_entry `*`_, _const wchar_t `*`_);
<br>
*void*
<br>
*archive_entry_copy_gname*(_struct archive_entry `*`_, _const char `*`_);
<br>
*void*
<br>
*archive_entry_copy_gname_w*(_struct archive_entry `*`_, _const wchar_t `*`_);
<br>
*void*
<br>
*archive_entry_copy_hardlink*(_struct archive_entry `*`_, _const char `*`_);
<br>
*void*
<br>
*archive_entry_copy_hardlink_w*(_struct archive_entry `*`_, _const wchar_t `*`_);
<br>
*void*
<br>
*archive_entry_copy_sourcepath*(_struct archive_entry `*`_, _const char `*`_);
<br>
*void*
<br>
*archive_entry_copy_pathname_w*(_struct archive_entry `*`_, _const wchar_t `*`_);
<br>
*void*
<br>
*archive_entry_copy_stat*(_struct archive_entry `*`_, _const struct stat `*`_);
<br>
*void*
<br>
*archive_entry_copy_symlink*(_struct archive_entry `*`_, _const char `*`_);
<br>
*void*
<br>
*archive_entry_copy_symlink_w*(_struct archive_entry `*`_, _const wchar_t `*`_);
<br>
*void*
<br>
*archive_entry_copy_uname*(_struct archive_entry `*`_, _const char `*`_);
<br>
*void*
<br>
*archive_entry_copy_uname_w*(_struct archive_entry `*`_, _const wchar_t `*`_);
<br>
*dev_t*
<br>
*archive_entry_dev*(_struct archive_entry `*`_);
<br>
*dev_t*
<br>
*archive_entry_devmajor*(_struct archive_entry `*`_);
<br>
*dev_t*
<br>
*archive_entry_devminor*(_struct archive_entry `*`_);
<br>
*mode_t*
<br>
*archive_entry_filetype*(_struct archive_entry `*`_);
<br>
*void*
<br>
*archive_entry_fflags*(_struct archive_entry `*`_, _unsigned long `*`set_, _unsigned long `*`clear_);
<br>
*const char `*`*
<br>
*archive_entry_fflags_text*(_struct archive_entry `*`_);
<br>
*void*
<br>
*archive_entry_free*(_struct archive_entry `*`_);
<br>
*const char `*`*
<br>
*archive_entry_gname*(_struct archive_entry `*`_);
<br>
*const char `*`*
<br>
*archive_entry_hardlink*(_struct archive_entry `*`_);
<br>
*ino_t*
<br>
*archive_entry_ino*(_struct archive_entry `*`_);
<br>
*mode_t*
<br>
*archive_entry_mode*(_struct archive_entry `*`_);
<br>
*time_t*
<br>
*archive_entry_mtime*(_struct archive_entry `*`_);
<br>
*long*
<br>
*archive_entry_mtime_nsec*(_struct archive_entry `*`_);
<br>
*unsigned int*
<br>
*archive_entry_nlink*(_struct archive_entry `*`_);
<br>
*struct archive_entry `*`*
<br>
*archive_entry_new*(_void_);
<br>
*const char `*`*
<br>
*archive_entry_pathname*(_struct archive_entry `*`_);
<br>
*const wchar_t `*`*
<br>
*archive_entry_pathname_w*(_struct archive_entry `*`_);
<br>
*dev_t*
<br>
*archive_entry_rdev*(_struct archive_entry `*`_);
<br>
*dev_t*
<br>
*archive_entry_rdevmajor*(_struct archive_entry `*`_);
<br>
*dev_t*
<br>
*archive_entry_rdevminor*(_struct archive_entry `*`_);
<br>
*void*
<br>
*archive_entry_set_dev*(_struct archive_entry `*`_, _dev_t_);
<br>
*void*
<br>
*archive_entry_set_devmajor*(_struct archive_entry `*`_, _dev_t_);
<br>
*void*
<br>
*archive_entry_set_devminor*(_struct archive_entry `*`_, _dev_t_);
<br>
*void*
<br>
*archive_entry_set_filetype*(_struct archive_entry `*`_, _unsigned int_);
<br>
*void*
<br>
*archive_entry_set_fflags*(_struct archive_entry `*`_, _unsigned long set_, _unsigned long clear_);
<br>
*void*
<br>
*archive_entry_set_gid*(_struct archive_entry `*`_, _gid_t_);
<br>
*void*
<br>
*archive_entry_set_gname*(_struct archive_entry `*`_, _const char `*`_);
<br>
*void*
<br>
*archive_entry_set_hardlink*(_struct archive_entry `*`_, _const char `*`_);
<br>
*void*
<br>
*archive_entry_set_ino*(_struct archive_entry `*`_, _unsigned long_);
<br>
*void*
<br>
*archive_entry_set_link*(_struct archive_entry `*`_, _const char `*`_);
<br>
*void*
<br>
*archive_entry_set_mode*(_struct archive_entry `*`_, _mode_t_);
<br>
*void*
<br>
*archive_entry_set_mtime*(_struct archive_entry `*`_, _time_t_, _long nanos_);
<br>
*void*
<br>
*archive_entry_set_nlink*(_struct archive_entry `*`_, _unsigned int_);
<br>
*void*
<br>
*archive_entry_set_pathname*(_struct archive_entry `*`_, _const char `*`_);
<br>
*void*
<br>
*archive_entry_set_rdev*(_struct archive_entry `*`_, _dev_t_);
<br>
*void*
<br>
*archive_entry_set_rdevmajor*(_struct archive_entry `*`_, _dev_t_);
<br>
*void*
<br>
*archive_entry_set_rdevminor*(_struct archive_entry `*`_, _dev_t_);
<br>
*void*
<br>
*archive_entry_set_size*(_struct archive_entry `*`_, _int64_t_);
<br>
*void*
<br>
*archive_entry_set_symlink*(_struct archive_entry `*`_, _const char `*`_);
<br>
*void*
<br>
*archive_entry_set_uid*(_struct archive_entry `*`_, _uid_t_);
<br>
*void*
<br>
*archive_entry_set_uname*(_struct archive_entry `*`_, _const char `*`_);
<br>
*int64_t*
<br>
*archive_entry_size*(_struct archive_entry `*`_);
<br>
*const char `*`*
<br>
*archive_entry_sourcepath*(_struct archive_entry `*`_);
<br>
*const struct stat `*`*
<br>
*archive_entry_stat*(_struct archive_entry `*`_);
<br>
*const char `*`*
<br>
*archive_entry_symlink*(_struct archive_entry `*`_);
<br>
*const char `*`*
<br>
*archive_entry_uname*(_struct archive_entry `*`_);
== DESCRIPTION ==
These functions create and manipulate data objects that
represent entries within an archive.
You can think of a
*struct archive_entry*
as a heavy-duty version of
*struct stat :*
it includes everything from
*struct stat*
plus associated pathname, textual group and user names, etc.
These objects are used by
*libarchive*(3)
to represent the metadata associated with a particular
entry in an archive.
=== Create and Destroy===
There are functions to allocate, destroy, clear, and copy
_archive_entry_
objects:
<dl>
<dt>*archive_entry_clear*()</dt><dd>
Erases the object, resetting all internal fields to the
same state as a newly-created object.
This is provided to allow you to quickly recycle objects
without thrashing the heap.
</dd><dt>*archive_entry_clone*()</dt><dd>
A deep copy operation; all text fields are duplicated.
</dd><dt>*archive_entry_free*()</dt><dd>
Releases the
*struct archive_entry*
object.
</dd><dt>*archive_entry_new*()</dt><dd>
Allocate and return a blank
*struct archive_entry*
object.
</dd></dl>
=== Set and Get Functions===
Most of the functions here set or read entries in an object.
Such functions have one of the following forms:
<dl>
<dt>*archive_entry_set_XXXX*()</dt><dd>
Stores the provided data in the object.
In particular, for strings, the pointer is stored,
not the referenced string.
</dd><dt>*archive_entry_copy_XXXX*()</dt><dd>
As above, except that the referenced data is copied
into the object.
</dd><dt>*archive_entry_XXXX*()</dt><dd>
Returns the specified data.
In the case of strings, a const-qualified pointer to
the string is returned.
</dd></dl>
String data can be set or accessed as wide character strings
or normal
_char_
strings.
The functions that use wide character strings are suffixed with
*`_`w*.
Note that these are different representations of the same data:
For example, if you store a narrow string and read the corresponding
wide string, the object will transparently convert formats
using the current locale.
Similarly, if you store a wide string and then store a
narrow string for the same data, the previously-set wide string will
be discarded in favor of the new data.
There are a few set/get functions that merit additional description:
<dl>
<dt>*archive_entry_set_link*()</dt><dd>
This function sets the symlink field if it is already set.
Otherwise, it sets the hardlink field.
</dd></dl>
=== File Flags===
File flags are transparently converted between a bitmap
representation and a textual format.
For example, if you set the bitmap and ask for text, the library
will build a canonical text format.
However, if you set a text format and request a text format,
you will get back the same text, even if it is ill-formed.
If you need to canonicalize a textual flags string, you should first set the
text form, then request the bitmap form, then use that to set the bitmap form.
Setting the bitmap format will clear the internal text representation
and force it to be reconstructed when you next request the text form.
The bitmap format consists of two integers, one containing bits
that should be set, the other specifying bits that should be
cleared.
Bits not mentioned in either bitmap will be ignored.
Usually, the bitmap of bits to be cleared will be set to zero.
In unusual circumstances, you can force a fully-specified set
of file flags by setting the bitmap of flags to clear to the complement
of the bitmap of flags to set.
(This differs from
*fflagstostr*(3),
which only includes names for set bits.)
Converting a bitmap to a textual string is a platform-specific
operation; bits that are not meaningful on the current platform
will be ignored.
The canonical text format is a comma-separated list of flag names.
The
*archive_entry_copy_fflags_text*()
and
*archive_entry_copy_fflags_text_w*()
functions parse the provided text and sets the internal bitmap values.
This is a platform-specific operation; names that are not meaningful
on the current platform will be ignored.
The function returns a pointer to the start of the first name that was not
recognized, or NULL if every name was recognized.
Note that every name--including names that follow an unrecognized name--will
be evaluated, and the bitmaps will be set to reflect every name that is
recognized.
(In particular, this differs from
*strtofflags*(3),
which stops parsing at the first unrecognized name.)
=== ACL Handling===
XXX This needs serious help.
XXX
An
"Access Control List"
(ACL) is a list of permissions that grant access to particular users or
groups beyond what would normally be provided by standard POSIX mode bits.
The ACL handling here addresses some deficiencies in the POSIX.1e draft 17 ACL
specification.
In particular, POSIX.1e draft 17 specifies several different formats, but
none of those formats include both textual user/group names and numeric
UIDs/GIDs.
XXX explain ACL stuff XXX
== SEE ALSO ==
*archive*(3)
== HISTORY ==
The
*libarchive*
library first appeared in
FreeBSD 5.3.
== AUTHORS ==
The
*libarchive*
library was written by
Tim Kientzle <kientzle@acm.org.>
| MediaWiki | 4 | OakCityLabs/ios_system | libarchive/libarchive/doc/wiki/ManPageArchiveEntry3.wiki | [
"BSD-3-Clause"
] |
= Maps: Total and Partial Maps
> module Maps
>
> import Logic
> import IndProp
>
> %access public export
>
Maps (or dictionaries) are ubiquitous data structures both generally and in the
theory of programming languages in particular; we're going to need them in many
places in the coming chapters. They also make a nice case study using ideas
we've seen in previous chapters, including building data structures out of
higher-order functions (from `Basics` and `Poly`) and the use of reflection to
streamline proofs (from `IndProp`).
We'll define two flavors of maps: _total_ maps, which include a "default"
element to be returned when a key being looked up doesn't exist, and _partial_
maps, which return a \idr{Maybe} to indicate success or failure. The latter is
defined in terms of the former, using \idr{Nothing} as the default element.
== The Idris Standard Library
\todo[inline]{Edit}
One small digression before we get to maps.
Unlike the chapters we have seen so far, this one does not `Require Import` the
chapter before it (and, transitively, all the earlier chapters). Instead, in
this chapter and from now, on we're going to import the definitions and theorems
we need directly from Idris's standard library stuff. You should not notice much
difference, though, because we've been careful to name our own definitions and
theorems the same as their counterparts in the standard library, wherever they
overlap.
```coq
Require Import Idris.Arith.Arith.
Require Import Idris.Bool.Bool.
Require Import Idris.Strings.String.
Require Import Idris.Logic.FunctionalExtensionality.
```
Documentation for the standard library can be found at
\url{https://www.idris-lang.org/docs/current/}.
The \idr{:search} command is a good way to look for theorems involving objects
of specific types. Take a minute now to experiment with it.
== Identifiers
First, we need a type for the keys that we use to index into our maps. For this
purpose, we again use the type \idr{Id} from the `Lists` chapter. To make this
chapter self contained, we repeat its definition here, together with the
equality comparison function for \idr{Id} and its fundamental property.
> data Id : Type where
> MkId : String -> Id
>
> beq_id : (x1, x2 : Id) -> Bool
> beq_id (MkId n1) (MkId n2) = decAsBool $ decEq n1 n2
>
\todo[inline]{Edit}
(The function \idr{decEq} comes from Idris's string library. If you check its
result type, you'll see that it does not actually return a \idr{Bool}, but
rather a type that looks like \idr{Either (x = y) (Not (x = y))}, called a
{Dec}, which can be thought of as an "evidence-carrying boolean." Formally, an
element of \idr{Dec (x=y)} is either a proof that two things are equal or a
proof that they are unequal, together with a tag indicating which. But for
present purposes you can think of it as just a fancy \idr{Bool}.)
> beq_id_refl : (x : Id) -> True = beq_id x x
> beq_id_refl (MkId n) with (decEq n n)
> beq_id_refl _ | Yes _ = Refl
> beq_id_refl _ | No contra = absurd $ contra Refl
>
The following useful property of \idr{beq_id} follows from an analogous lemma
about strings:
> beq_id_true_iff : (beq_id x y = True) <-> x = y
> beq_id_true_iff = (bto, bfro)
> where
> bto : (beq_id x y = True) -> x = y
> bto {x=MkId n1} {y=MkId n2} prf with (decEq n1 n2)
> bto Refl | Yes eq = cong {f=MkId} eq
> bto Refl | No _ impossible
>
> idInj : MkId x = MkId y -> x = y
> idInj Refl = Refl
>
> bfro : (x = y) -> beq_id x y = True
> bfro {x=MkId n1} {y=MkId n2} prf with (decEq n1 n2)
> bfro _ | Yes _ = Refl
> bfro prf | No contra = absurd $ contra $ idInj prf
>
Similarly:
> beq_id_false_iff : (beq_id x y = False) <-> Not (x = y)
> beq_id_false_iff = (to, fro)
> where
> to : (beq_id x y = False) -> Not (x = y)
> to beqf = (snd not_true_iff_false) beqf . (snd beq_id_true_iff)
>
> fro : (Not (x = y)) -> beq_id x y = False
> fro noteq = (fst not_true_iff_false) $ noteq . (fst beq_id_true_iff)
>
== Total Maps
Our main job in this chapter will be to build a definition of partial maps that
is similar in behavior to the one we saw in the `Lists` chapter, plus
accompanying lemmas about its behavior.
This time around, though, we're going to use _functions_, rather than lists of
key-value pairs, to build maps. The advantage of this representation is that it
offers a more _extensional_ view of maps, where two maps that respond to queries
in the same way will be represented as literally the same thing (the very same
function), rather than just "equivalent" data structures. This, in turn,
simplifies proofs that use maps.
We build partial maps in two steps. First, we define a type of _total maps_ that
return a default value when we look up a key that is not present in the map.
> TotalMap : Type -> Type
> TotalMap a = Id -> a
>
Intuitively, a total map over an element type \idr{a} is just a function that
can be used to look up \idr{Id}s, yielding \idr{a}s.
The function \idr{t_empty} yields an empty total map, given a default element;
this map always returns the default element when applied to any id.
> t_empty : (v : a) -> TotalMap a
> t_empty v = \_ => v
>
We can also write this as:
```idris
t_empty = const
```
More interesting is the \idr{update} function, which (as before) takes a map
\idr{m}, a key \idr{x}, and a value \idr{v} and returns a new map that takes
\idr{x} to \idr{v} and takes every other key to whatever \idr{m} does.
> t_update : (x : Id) -> (v : a) -> (m : TotalMap a) -> TotalMap a
> t_update x v m = \x' => if beq_id x x' then v else m x'
>
This definition is a nice example of higher-order programming: \idr{t_update}
takes a _function_ \idr{m} and yields a new function \idr{\x' => ...} that
behaves like the desired map.
For example, we can build a map taking \idr{Id}s to \idr{Bool}s, where \idr{Id
3} is mapped to \idr{True} and every other key is mapped to \idr{False}, like
this:
\todo[inline]{Seems like a wrong description in the book here}
> examplemap : TotalMap Bool
> examplemap = t_update (MkId "foo") False $
> t_update (MkId "bar") True $
> t_empty False
>
This completes the definition of total maps. Note that we don't need to define a
\idr{find} operation because it is just function application!
> update_example1 : examplemap (MkId "baz") = False
> update_example1 = Refl
>
> update_example2 : examplemap (MkId "foo") = False
> update_example2 = Refl
>
> update_example3 : examplemap (MkId "quux") = False
> update_example3 = Refl
>
> update_example4 : examplemap (MkId "bar") = True
> update_example4 = Refl
>
To use maps in later chapters, we'll need several fundamental facts about how
they behave. Even if you don't work the following exercises, make sure you
thoroughly understand the statements of the lemmas! (Some of the proofs require
the functional extensionality axiom, which is discussed in the `Logic` chapter.)
==== Exercise: 1 star, optional (t_apply_empty)
First, the empty map returns its default element for all keys:
> t_apply_empty : t_empty v x = v
> t_apply_empty = ?t_apply_empty_rhs
>
$\square$
==== Exercise: 2 stars, optional (t_update_eq)
Next, if we update a map \idr{m} at a key \idr{x} with a new value \idr{v} and
then look up \idr{x} in the map resulting from the \idr{update}, we get back
\idr{v}:
> t_update_eq : (t_update x v m) x = v
> t_update_eq = ?t_update_eq_rhs
>
$\square$
==== Exercise: 2 stars, optional (t_update_neq)
On the other hand, if we update a map \idr{m} at a key \idr{x1} and then look up
a _different_ key \idr{x2} in the resulting map, we get the same result that
\idr{m} would have given:
> t_update_neq : Not (x1 = x2) -> (t_update x1 v m) x2 = m x2
> t_update_neq neq = ?t_update_neq_rhs
>
$\square$
==== Exercise: 2 stars, optional (t_update_shadow)
If we update a map \idr{m} at a key \idr{x} with a value \idr{v1} and then
update again with the same key \idr{x} and another value \idr{v2}, the resulting
map behaves the same (gives the same result when applied to any key) as the
simpler map obtained by performing just the second \idr{update} on \idr{m}:
> t_update_shadow : t_update x v2 $ t_update x v1 m = t_update x v2 m
> t_update_shadow = ?t_update_shadow_rhs
>
$\square$
For the final two lemmas about total maps, it's convenient to use the reflection
idioms introduced in chapter `IndProp`. We begin by proving a fundamental
_reflection lemma_ relating the equality proposition on \idr{Id}s with the
boolean function \idr{beq_id}.
==== Exercise: 2 stars, optional (beq_idP)
Use the proof of \idr{beq_natP} in chapter `IndProp` as a template to prove the
following:
> beq_idP : {x, y : Id} -> Reflect (x = y) (beq_id x y)
> beq_idP = ?beq_idP_rhs
>
$\square$
Now, given \idr{Id}s \idr{x1} and \idr{x2}, we can use \idr{with (beq_idP x1
x2)} to simultaneously perform case analysis on the result of \idr{beq_id x1 x2}
and generate hypotheses about the equality (in the sense of \idr{=}) of \idr{x1}
and \idr{x2}.
==== Exercise: 2 stars (t_update_same)
With the example in chapter `IndProp` as a template, use \idr{beq_idP} to prove
the following theorem, which states that if we update a map to assign key
\idr{x} the same value as it already has in \idr{m}, then the result is equal to
\idr{m}:
> t_update_same : t_update x (m x) m = m
> t_update_same = ?t_update_same_rhs
>
$\square$
==== Exercise: 3 stars, recommended (t_update_permute)
Use \idr{beq_idP} to prove one final property of the \idr{update} function: If
we update a map \idr{m} at two distinct keys, it doesn't matter in which order
we do the updates.
> t_update_permute : Not (x2 = x1) -> t_update x1 v1 $ t_update x2 v2 m
> = t_update x2 v2 $ t_update x1 v1 m
> t_update_permute neq = ?t_update_permute_rhs
>
$\square$
== Partial maps
Finally, we define _partial maps_ on top of total maps. A partial map with
elements of type \idr{a} is simply a total map with elements of type \idr{Maybe
a} and default element \idr{Nothing}.
> PartialMap : Type -> Type
> PartialMap a = TotalMap (Maybe a)
>
> empty : PartialMap a
> empty = t_empty Nothing
>
> update : (x : Id) -> (v : a) -> (m : PartialMap a) -> PartialMap a
> update x v m = t_update x (Just v) m
>
We now straightforwardly lift all of the basic lemmas about total maps to
partial maps.
> apply_empty : empty {a} x = Nothing {a}
> apply_empty = Refl
>
> update_eq : (update x v m) x = Just v
> update_eq {v} = t_update_eq {v=Just v}
>
> update_neq : Not (x2 = x1) -> (update x2 v m) x1 = m x1
> update_neq {x1} {x2} {v} = t_update_neq {x1=x2} {x2=x1} {v=Just v}
>
> update_shadow : update x v2 $ update x v1 m = update x v2 m
> update_shadow {v1} {v2} = t_update_shadow {v1=Just v1} {v2=Just v2}
>
> update_same : m x = Just v -> update x v m = m
> update_same prf = rewrite sym prf in t_update_same
>
> update_permute : Not (x2 = x1) -> update x1 v1 $ update x2 v2 m
> = update x2 v2 $ update x1 v1 m
> update_permute {v1} {v2} = t_update_permute {v1=Just v1} {v2=Just v2}
| Idris | 5 | diseraluca/software-foundations | src/Maps.lidr | [
"MIT"
] |
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head><!-- start favicons snippet, use https://realfavicongenerator.net/ --><link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png"><link rel="manifest" href="/assets/site.webmanifest"><link rel="mask-icon" href="/assets/safari-pinned-tab.svg" color="#fc4d50"><link rel="shortcut icon" href="/assets/favicon.ico"><meta name="msapplication-TileColor" content="#ffc40d"><meta name="msapplication-config" content="/assets/browserconfig.xml"><meta name="theme-color" content="#ffffff"><!-- end favicons snippet -->
<title>PlaybackStats (ExoPlayer library)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="PlaybackStats (ExoPlayer library)";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":10,"i37":10,"i38":10,"i39":10,"i40":10,"i41":10,"i42":10,"i43":10,"i44":10,"i45":10,"i46":10,"i47":10,"i48":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = false;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding"> </div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">com.google.android.exoplayer2.analytics</a></div>
<h2 title="Class PlaybackStats" class="title">Class PlaybackStats</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://developer.android.com/reference/java/lang/Object.html" title="class or interface in java.lang" class="externalLink" target="_top">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>com.google.android.exoplayer2.analytics.PlaybackStats</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public final class <span class="typeNameLabel">PlaybackStats</span>
extends <a href="https://developer.android.com/reference/java/lang/Object.html" title="class or interface in java.lang" class="externalLink" target="_top">Object</a></pre>
<div class="block">Statistics about playbacks.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary">
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="PlaybackStats.EventTimeAndException.html" title="class in com.google.android.exoplayer2.analytics">PlaybackStats.EventTimeAndException</a></span></code></th>
<td class="colLast">
<div class="block">Stores an exception with the event time at which it occurred.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="PlaybackStats.EventTimeAndFormat.html" title="class in com.google.android.exoplayer2.analytics">PlaybackStats.EventTimeAndFormat</a></span></code></th>
<td class="colLast">
<div class="block">Stores a format with the event time at which it started being used, or <code>null</code> to indicate
that no format was used.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="PlaybackStats.EventTimeAndPlaybackState.html" title="class in com.google.android.exoplayer2.analytics">PlaybackStats.EventTimeAndPlaybackState</a></span></code></th>
<td class="colLast">
<div class="block">Stores a playback state with the event time at which it became active.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#abandonedBeforeReadyCount">abandonedBeforeReadyCount</a></span></code></th>
<td class="colLast">
<div class="block">The number of playbacks which were abandoned before they were ready to play.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#adPlaybackCount">adPlaybackCount</a></span></code></th>
<td class="colLast">
<div class="block">The number of ad playbacks.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink">List</a><<a href="PlaybackStats.EventTimeAndFormat.html" title="class in com.google.android.exoplayer2.analytics" target="_top">PlaybackStats.EventTimeAndFormat</a>></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#audioFormatHistory">audioFormatHistory</a></span></code></th>
<td class="colLast">
<div class="block">The audio format history as <a href="PlaybackStats.EventTimeAndFormat.html" title="class in com.google.android.exoplayer2.analytics"><code>EventTimeAndFormats</code></a> ordered by <code>
EventTime.realTimeMs</code>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#backgroundJoiningCount">backgroundJoiningCount</a></span></code></th>
<td class="colLast">
<div class="block">The number of playbacks which were pre-buffered in the background.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics">PlaybackStats</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#EMPTY">EMPTY</a></span></code></th>
<td class="colLast">
<div class="block">Empty playback stats.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#endedCount">endedCount</a></span></code></th>
<td class="colLast">
<div class="block">The number of playbacks which reached the ended state at least once.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#fatalErrorCount">fatalErrorCount</a></span></code></th>
<td class="colLast">
<div class="block">The total number of fatal errors.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink">List</a><<a href="PlaybackStats.EventTimeAndException.html" title="class in com.google.android.exoplayer2.analytics" target="_top">PlaybackStats.EventTimeAndException</a>></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#fatalErrorHistory">fatalErrorHistory</a></span></code></th>
<td class="colLast">
<div class="block">The history of fatal errors as <a href="PlaybackStats.EventTimeAndException.html" title="class in com.google.android.exoplayer2.analytics"><code>EventTimeAndExceptions</code></a> ordered by
<code>EventTime.realTimeMs</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#fatalErrorPlaybackCount">fatalErrorPlaybackCount</a></span></code></th>
<td class="colLast">
<div class="block">The total number of playback with at least one fatal error.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#firstReportedTimeMs">firstReportedTimeMs</a></span></code></th>
<td class="colLast">
<div class="block">The elapsed real-time as returned by <code>SystemClock.elapsedRealtime()</code> of the first
reported playback event, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no event has been reported.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#foregroundPlaybackCount">foregroundPlaybackCount</a></span></code></th>
<td class="colLast">
<div class="block">The number of playbacks which were the active foreground playback at some point.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#initialAudioFormatBitrateCount">initialAudioFormatBitrateCount</a></span></code></th>
<td class="colLast">
<div class="block">The number of playbacks with initial audio format bitrate data.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#initialVideoFormatBitrateCount">initialVideoFormatBitrateCount</a></span></code></th>
<td class="colLast">
<div class="block">The number of playbacks with initial video format bitrate data.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#initialVideoFormatHeightCount">initialVideoFormatHeightCount</a></span></code></th>
<td class="colLast">
<div class="block">The number of playbacks with initial video format height data.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#maxRebufferTimeMs">maxRebufferTimeMs</a></span></code></th>
<td class="colLast">
<div class="block">The maximum time spent during a single rebuffer, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no
rebuffer occurred.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink" target="_top">List</a><long[]></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#mediaTimeHistory">mediaTimeHistory</a></span></code></th>
<td class="colLast">
<div class="block">The media time history as an ordered list of long[2] arrays with [0] being the realtime as
returned by <code>SystemClock.elapsedRealtime()</code> and [1] being the media time at this
realtime, in milliseconds.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#nonFatalErrorCount">nonFatalErrorCount</a></span></code></th>
<td class="colLast">
<div class="block">The total number of non-fatal errors.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink">List</a><<a href="PlaybackStats.EventTimeAndException.html" title="class in com.google.android.exoplayer2.analytics" target="_top">PlaybackStats.EventTimeAndException</a>></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#nonFatalErrorHistory">nonFatalErrorHistory</a></span></code></th>
<td class="colLast">
<div class="block">The history of non-fatal errors as <a href="PlaybackStats.EventTimeAndException.html" title="class in com.google.android.exoplayer2.analytics"><code>EventTimeAndExceptions</code></a> ordered
by <code>EventTime.realTimeMs</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_ABANDONED">PLAYBACK_STATE_ABANDONED</a></span></code></th>
<td class="colLast">
<div class="block">Playback is abandoned before reaching the end of the media.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_BUFFERING">PLAYBACK_STATE_BUFFERING</a></span></code></th>
<td class="colLast">
<div class="block">Playback is buffering to resume active playback.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_ENDED">PLAYBACK_STATE_ENDED</a></span></code></th>
<td class="colLast">
<div class="block">Playback has reached the end of the media.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_FAILED">PLAYBACK_STATE_FAILED</a></span></code></th>
<td class="colLast">
<div class="block">Playback is stopped due a fatal error and can be retried.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_INTERRUPTED_BY_AD">PLAYBACK_STATE_INTERRUPTED_BY_AD</a></span></code></th>
<td class="colLast">
<div class="block">Playback is interrupted by an ad.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_JOINING_BACKGROUND">PLAYBACK_STATE_JOINING_BACKGROUND</a></span></code></th>
<td class="colLast">
<div class="block">Playback is buffering in the background for initial playback start.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_JOINING_FOREGROUND">PLAYBACK_STATE_JOINING_FOREGROUND</a></span></code></th>
<td class="colLast">
<div class="block">Playback is buffering in the foreground for initial playback start.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_NOT_STARTED">PLAYBACK_STATE_NOT_STARTED</a></span></code></th>
<td class="colLast">
<div class="block">Playback has not started (initial state).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_PAUSED">PLAYBACK_STATE_PAUSED</a></span></code></th>
<td class="colLast">
<div class="block">Playback is paused but ready to play.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_PAUSED_BUFFERING">PLAYBACK_STATE_PAUSED_BUFFERING</a></span></code></th>
<td class="colLast">
<div class="block">Playback is buffering while paused.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_PLAYING">PLAYBACK_STATE_PLAYING</a></span></code></th>
<td class="colLast">
<div class="block">Playback is actively playing.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_SEEKING">PLAYBACK_STATE_SEEKING</a></span></code></th>
<td class="colLast">
<div class="block">Playback is handling a seek.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_STOPPED">PLAYBACK_STATE_STOPPED</a></span></code></th>
<td class="colLast">
<div class="block">Playback is stopped and can be restarted.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_SUPPRESSED">PLAYBACK_STATE_SUPPRESSED</a></span></code></th>
<td class="colLast">
<div class="block">Playback is suppressed (e.g.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PLAYBACK_STATE_SUPPRESSED_BUFFERING">PLAYBACK_STATE_SUPPRESSED_BUFFERING</a></span></code></th>
<td class="colLast">
<div class="block">Playback is suppressed (e.g.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#playbackCount">playbackCount</a></span></code></th>
<td class="colLast">
<div class="block">The number of individual playbacks for which these stats were collected.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink">List</a><<a href="PlaybackStats.EventTimeAndPlaybackState.html" title="class in com.google.android.exoplayer2.analytics" target="_top">PlaybackStats.EventTimeAndPlaybackState</a>></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#playbackStateHistory">playbackStateHistory</a></span></code></th>
<td class="colLast">
<div class="block">The playback state history as <a href="PlaybackStats.EventTimeAndPlaybackState.html" title="class in com.google.android.exoplayer2.analytics"><code>EventTimeAndPlaybackStates</code></a>
ordered by <code>EventTime.realTimeMs</code>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalAudioFormatBitrateTimeProduct">totalAudioFormatBitrateTimeProduct</a></span></code></th>
<td class="colLast">
<div class="block">The accumulated sum of all audio format bitrates, in bits per second, times the time the format
was used for playback, in milliseconds.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalAudioFormatTimeMs">totalAudioFormatTimeMs</a></span></code></th>
<td class="colLast">
<div class="block">The total media time for which audio format data is available, in milliseconds.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalAudioUnderruns">totalAudioUnderruns</a></span></code></th>
<td class="colLast">
<div class="block">The total number of audio underruns.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalBandwidthBytes">totalBandwidthBytes</a></span></code></th>
<td class="colLast">
<div class="block">The total bytes transferred during <a href="#totalBandwidthTimeMs"><code>totalBandwidthTimeMs</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalBandwidthTimeMs">totalBandwidthTimeMs</a></span></code></th>
<td class="colLast">
<div class="block">The total time for which bandwidth measurement data is available, in milliseconds.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalDroppedFrames">totalDroppedFrames</a></span></code></th>
<td class="colLast">
<div class="block">The total number of dropped video frames.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalInitialAudioFormatBitrate">totalInitialAudioFormatBitrate</a></span></code></th>
<td class="colLast">
<div class="block">The total initial audio format bitrate for all playbacks, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no initial audio format data is available.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalInitialVideoFormatBitrate">totalInitialVideoFormatBitrate</a></span></code></th>
<td class="colLast">
<div class="block">The total initial video format bitrate for all playbacks, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no initial video format data is available.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalInitialVideoFormatHeight">totalInitialVideoFormatHeight</a></span></code></th>
<td class="colLast">
<div class="block">The total initial video format height for all playbacks, in pixels, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a>
if no initial video format data is available.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalPauseBufferCount">totalPauseBufferCount</a></span></code></th>
<td class="colLast">
<div class="block">The total number of times a playback has been paused while rebuffering.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalPauseCount">totalPauseCount</a></span></code></th>
<td class="colLast">
<div class="block">The total number of times a playback has been paused.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalRebufferCount">totalRebufferCount</a></span></code></th>
<td class="colLast">
<div class="block">The total number of times a rebuffer occurred.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalSeekCount">totalSeekCount</a></span></code></th>
<td class="colLast">
<div class="block">The total number of times a seek occurred.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalValidJoinTimeMs">totalValidJoinTimeMs</a></span></code></th>
<td class="colLast">
<div class="block">The total time spent joining the playback, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no valid
join time could be determined.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalVideoFormatBitrateTimeMs">totalVideoFormatBitrateTimeMs</a></span></code></th>
<td class="colLast">
<div class="block">The total media time for which video format bitrate data is available, in milliseconds.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalVideoFormatBitrateTimeProduct">totalVideoFormatBitrateTimeProduct</a></span></code></th>
<td class="colLast">
<div class="block">The accumulated sum of all video format bitrates, in bits per second, times the time the format
was used for playback, in milliseconds.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalVideoFormatHeightTimeMs">totalVideoFormatHeightTimeMs</a></span></code></th>
<td class="colLast">
<div class="block">The total media time for which video format height data is available, in milliseconds.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#totalVideoFormatHeightTimeProduct">totalVideoFormatHeightTimeProduct</a></span></code></th>
<td class="colLast">
<div class="block">The accumulated sum of all video format heights, in pixels, times the time the format was used
for playback, in milliseconds.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#validJoinTimeCount">validJoinTimeCount</a></span></code></th>
<td class="colLast">
<div class="block">The number of playbacks with a valid join time as documented in <a href="#totalValidJoinTimeMs"><code>totalValidJoinTimeMs</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink">List</a><<a href="PlaybackStats.EventTimeAndFormat.html" title="class in com.google.android.exoplayer2.analytics" target="_top">PlaybackStats.EventTimeAndFormat</a>></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#videoFormatHistory">videoFormatHistory</a></span></code></th>
<td class="colLast">
<div class="block">The video format history as <a href="PlaybackStats.EventTimeAndFormat.html" title="class in com.google.android.exoplayer2.analytics"><code>EventTimeAndFormats</code></a> ordered by <code>
EventTime.realTimeMs</code>.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAbandonedBeforeReadyRatio()">getAbandonedBeforeReadyRatio</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the ratio of foreground playbacks which were abandoned before they were ready to play,
or <code>0.0</code> if no playback has been in foreground.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAudioUnderrunRate()">getAudioUnderrunRate</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean rate at which audio underruns occurred, in underruns per play time second, or
<code>0.0</code> if no time was spent playing.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDroppedFramesRate()">getDroppedFramesRate</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean rate at which video frames are dropped, in dropped frames per play time
second, or <code>0.0</code> if no time was spent playing.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getEndedRatio()">getEndedRatio</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the ratio of foreground playbacks which reached the ended state at least once, or
<code>0.0</code> if no playback has been in foreground.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getFatalErrorRate()">getFatalErrorRate</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the rate of fatal errors, in errors per play time second, or <code>0.0</code> if no time was
spend playing.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getFatalErrorRatio()">getFatalErrorRatio</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the ratio of foreground playbacks which experienced fatal errors, or <code>0.0</code> if no
playback has been in foreground.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getJoinTimeRatio()">getJoinTimeRatio</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the ratio of foreground join time to the total time spent playing and waiting, or
<code>0.0</code> if no time was spend playing or waiting.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanAudioFormatBitrate()">getMeanAudioFormatBitrate</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean audio format bitrate, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no
audio format data is available.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanBandwidth()">getMeanBandwidth</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean network bandwidth based on transfer measurements, in bits per second, or
<a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no transfer data is available.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanElapsedTimeMs()">getMeanElapsedTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean time covered by any playback state per playback, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback was recorded.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanInitialAudioFormatBitrate()">getMeanInitialAudioFormatBitrate</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean initial audio format bitrate, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if
no audio format data is available.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanInitialVideoFormatBitrate()">getMeanInitialVideoFormatBitrate</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean initial video format bitrate, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if
no video format data is available.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanInitialVideoFormatHeight()">getMeanInitialVideoFormatHeight</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean initial video format height, in pixels, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no video
format data is available.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanJoinTimeMs()">getMeanJoinTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean time spent joining the playback, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if
no valid join time is available.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanNonFatalErrorCount()">getMeanNonFatalErrorCount</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean number of non-fatal errors per foreground playback, or <code>0.0</code> if no
playback has been in foreground.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanPauseBufferCount()">getMeanPauseBufferCount</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean number of times a playback has been paused while rebuffering per foreground
playback, or <code>0.0</code> if no playback has been in foreground.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanPauseCount()">getMeanPauseCount</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean number of times a playback has been paused per foreground playback, or <code>
0.0</code> if no playback has been in foreground.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanPausedTimeMs()">getMeanPausedTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean time spent in a paused state per foreground playback, in milliseconds, or
<a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanPlayAndWaitTimeMs()">getMeanPlayAndWaitTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean time spent playing or actively waiting for playback per foreground playback,
in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanPlayTimeMs()">getMeanPlayTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean time spent actively playing per foreground playback, in milliseconds, or
<a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanRebufferCount()">getMeanRebufferCount</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean number of times a rebuffer occurred per foreground playback, or <code>0.0</code> if
no playback has been in foreground.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanRebufferTimeMs()">getMeanRebufferTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean time spent rebuffering per foreground playback, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanSeekCount()">getMeanSeekCount</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean number of times a seek occurred per foreground playback, or <code>0.0</code> if no
playback has been in foreground.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanSeekTimeMs()">getMeanSeekTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean time spent per foreground playback from the start of a seek until playback is
ready again, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanSingleRebufferTimeMs()">getMeanSingleRebufferTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean time spent during a single rebuffer, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a>
if no rebuffer was recorded.</div>
</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanSingleSeekTimeMs()">getMeanSingleSeekTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean time spent from the start of a single seek until playback is ready again, in
milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no seek occurred.</div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanTimeBetweenFatalErrors()">getMeanTimeBetweenFatalErrors</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean play time between fatal errors, in seconds.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanTimeBetweenNonFatalErrors()">getMeanTimeBetweenNonFatalErrors</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean play time between non-fatal errors, in seconds.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanTimeBetweenRebuffers()">getMeanTimeBetweenRebuffers</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean play time between rebuffer events, in seconds.</div>
</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanVideoFormatBitrate()">getMeanVideoFormatBitrate</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean video format bitrate, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no
video format data is available.</div>
</td>
</tr>
<tr id="i30" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanVideoFormatHeight()">getMeanVideoFormatHeight</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean video format height, in pixels, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no video format
data is available.</div>
</td>
</tr>
<tr id="i31" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMeanWaitTimeMs()">getMeanWaitTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the mean time spent actively waiting for playback per foreground playback, in
milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground.</div>
</td>
</tr>
<tr id="i32" class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMediaTimeMsAtRealtimeMs(long)">getMediaTimeMsAtRealtimeMs</a></span>​(long realtimeMs)</code></th>
<td class="colLast">
<div class="block">Returns the estimated media time at the given realtime, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if the media time history is unknown.</div>
</td>
</tr>
<tr id="i33" class="rowColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getNonFatalErrorRate()">getNonFatalErrorRate</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the rate of non-fatal errors, in errors per play time second, or <code>0.0</code> if no time
was spend playing.</div>
</td>
</tr>
<tr id="i34" class="altColor">
<td class="colFirst"><code>@com.google.android.exoplayer2.analytics.PlaybackStats.PlaybackState int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPlaybackStateAtTime(long)">getPlaybackStateAtTime</a></span>​(long realtimeMs)</code></th>
<td class="colLast">
<div class="block">Returns the <code>PlaybackStats.PlaybackState</code> at the given time.</div>
</td>
</tr>
<tr id="i35" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPlaybackStateDurationMs(@com.google.android.exoplayer2.analytics.PlaybackStats.PlaybackStateint)">getPlaybackStateDurationMs</a></span>​(@com.google.android.exoplayer2.analytics.PlaybackStats.PlaybackState int playbackState)</code></th>
<td class="colLast">
<div class="block">Returns the total time spent in a given <code>PlaybackStats.PlaybackState</code>, in milliseconds.</div>
</td>
</tr>
<tr id="i36" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getRebufferRate()">getRebufferRate</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the rate of rebuffer events, in rebuffers per play time second, or <code>0.0</code> if no
time was spend playing.</div>
</td>
</tr>
<tr id="i37" class="rowColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getRebufferTimeRatio()">getRebufferTimeRatio</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the ratio of rebuffer time to the total time spent playing and waiting, or <code>0.0</code>
if no time was spend playing or waiting.</div>
</td>
</tr>
<tr id="i38" class="altColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSeekTimeRatio()">getSeekTimeRatio</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the ratio of seek time to the total time spent playing and waiting, or <code>0.0</code> if
no time was spend playing or waiting.</div>
</td>
</tr>
<tr id="i39" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTotalElapsedTimeMs()">getTotalElapsedTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the total time covered by any playback state, in milliseconds.</div>
</td>
</tr>
<tr id="i40" class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTotalJoinTimeMs()">getTotalJoinTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the total time spent joining the playback in foreground, in milliseconds.</div>
</td>
</tr>
<tr id="i41" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTotalPausedTimeMs()">getTotalPausedTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the total time spent in a paused state, in milliseconds.</div>
</td>
</tr>
<tr id="i42" class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTotalPlayAndWaitTimeMs()">getTotalPlayAndWaitTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the total time spent playing or actively waiting for playback, in milliseconds.</div>
</td>
</tr>
<tr id="i43" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTotalPlayTimeMs()">getTotalPlayTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the total time spent actively playing, in milliseconds.</div>
</td>
</tr>
<tr id="i44" class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTotalRebufferTimeMs()">getTotalRebufferTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the total time spent rebuffering, in milliseconds.</div>
</td>
</tr>
<tr id="i45" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTotalSeekTimeMs()">getTotalSeekTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the total time spent from the start of a seek until playback is ready again, in
milliseconds.</div>
</td>
</tr>
<tr id="i46" class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTotalWaitTimeMs()">getTotalWaitTimeMs</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the total time spent actively waiting for playback, in milliseconds.</div>
</td>
</tr>
<tr id="i47" class="rowColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getWaitTimeRatio()">getWaitTimeRatio</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the ratio of wait times to the total time spent playing and waiting, or <code>0.0</code> if
no time was spend playing or waiting.</div>
</td>
</tr>
<tr id="i48" class="altColor">
<td class="colFirst"><code>static <a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics">PlaybackStats</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#merge(com.google.android.exoplayer2.analytics.PlaybackStats...)">merge</a></span>​(<a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics">PlaybackStats</a>... playbackStats)</code></th>
<td class="colLast">
<div class="block">Returns the combined <a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics"><code>PlaybackStats</code></a> for all input <a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics"><code>PlaybackStats</code></a>.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.<a href="https://developer.android.com/reference/java/lang/Object.html" title="class or interface in java.lang" class="externalLink" target="_top">Object</a></h3>
<code><a href="https://developer.android.com/reference/java/lang/Object.html#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink" target="_top">wait</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="PLAYBACK_STATE_NOT_STARTED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_NOT_STARTED</h4>
<pre>public static final int PLAYBACK_STATE_NOT_STARTED</pre>
<div class="block">Playback has not started (initial state).</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_NOT_STARTED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_JOINING_BACKGROUND">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_JOINING_BACKGROUND</h4>
<pre>public static final int PLAYBACK_STATE_JOINING_BACKGROUND</pre>
<div class="block">Playback is buffering in the background for initial playback start.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_JOINING_BACKGROUND">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_JOINING_FOREGROUND">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_JOINING_FOREGROUND</h4>
<pre>public static final int PLAYBACK_STATE_JOINING_FOREGROUND</pre>
<div class="block">Playback is buffering in the foreground for initial playback start.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_JOINING_FOREGROUND">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_PLAYING">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_PLAYING</h4>
<pre>public static final int PLAYBACK_STATE_PLAYING</pre>
<div class="block">Playback is actively playing.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_PLAYING">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_PAUSED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_PAUSED</h4>
<pre>public static final int PLAYBACK_STATE_PAUSED</pre>
<div class="block">Playback is paused but ready to play.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_PAUSED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_SEEKING">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_SEEKING</h4>
<pre>public static final int PLAYBACK_STATE_SEEKING</pre>
<div class="block">Playback is handling a seek.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_SEEKING">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_BUFFERING">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_BUFFERING</h4>
<pre>public static final int PLAYBACK_STATE_BUFFERING</pre>
<div class="block">Playback is buffering to resume active playback.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_BUFFERING">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_PAUSED_BUFFERING">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_PAUSED_BUFFERING</h4>
<pre>public static final int PLAYBACK_STATE_PAUSED_BUFFERING</pre>
<div class="block">Playback is buffering while paused.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_PAUSED_BUFFERING">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_SUPPRESSED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_SUPPRESSED</h4>
<pre>public static final int PLAYBACK_STATE_SUPPRESSED</pre>
<div class="block">Playback is suppressed (e.g. due to audio focus loss).</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_SUPPRESSED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_SUPPRESSED_BUFFERING">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_SUPPRESSED_BUFFERING</h4>
<pre>public static final int PLAYBACK_STATE_SUPPRESSED_BUFFERING</pre>
<div class="block">Playback is suppressed (e.g. due to audio focus loss) while buffering to resume a playback.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_SUPPRESSED_BUFFERING">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_ENDED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_ENDED</h4>
<pre>public static final int PLAYBACK_STATE_ENDED</pre>
<div class="block">Playback has reached the end of the media.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_ENDED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_STOPPED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_STOPPED</h4>
<pre>public static final int PLAYBACK_STATE_STOPPED</pre>
<div class="block">Playback is stopped and can be restarted.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_STOPPED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_FAILED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_FAILED</h4>
<pre>public static final int PLAYBACK_STATE_FAILED</pre>
<div class="block">Playback is stopped due a fatal error and can be retried.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_FAILED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_INTERRUPTED_BY_AD">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_INTERRUPTED_BY_AD</h4>
<pre>public static final int PLAYBACK_STATE_INTERRUPTED_BY_AD</pre>
<div class="block">Playback is interrupted by an ad.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_INTERRUPTED_BY_AD">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="PLAYBACK_STATE_ABANDONED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PLAYBACK_STATE_ABANDONED</h4>
<pre>public static final int PLAYBACK_STATE_ABANDONED</pre>
<div class="block">Playback is abandoned before reaching the end of the media.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.analytics.PlaybackStats.PLAYBACK_STATE_ABANDONED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="EMPTY">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EMPTY</h4>
<pre>public static final <a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics">PlaybackStats</a> EMPTY</pre>
<div class="block">Empty playback stats.</div>
</li>
</ul>
<a id="playbackCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>playbackCount</h4>
<pre>public final int playbackCount</pre>
<div class="block">The number of individual playbacks for which these stats were collected.</div>
</li>
</ul>
<a id="playbackStateHistory">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>playbackStateHistory</h4>
<pre>public final <a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink">List</a><<a href="PlaybackStats.EventTimeAndPlaybackState.html" title="class in com.google.android.exoplayer2.analytics" target="_top">PlaybackStats.EventTimeAndPlaybackState</a>> playbackStateHistory</pre>
<div class="block">The playback state history as <a href="PlaybackStats.EventTimeAndPlaybackState.html" title="class in com.google.android.exoplayer2.analytics"><code>EventTimeAndPlaybackStates</code></a>
ordered by <code>EventTime.realTimeMs</code>.</div>
</li>
</ul>
<a id="mediaTimeHistory">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mediaTimeHistory</h4>
<pre>public final <a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink" target="_top">List</a><long[]> mediaTimeHistory</pre>
<div class="block">The media time history as an ordered list of long[2] arrays with [0] being the realtime as
returned by <code>SystemClock.elapsedRealtime()</code> and [1] being the media time at this
realtime, in milliseconds.</div>
</li>
</ul>
<a id="firstReportedTimeMs">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>firstReportedTimeMs</h4>
<pre>public final long firstReportedTimeMs</pre>
<div class="block">The elapsed real-time as returned by <code>SystemClock.elapsedRealtime()</code> of the first
reported playback event, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no event has been reported.</div>
</li>
</ul>
<a id="foregroundPlaybackCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>foregroundPlaybackCount</h4>
<pre>public final int foregroundPlaybackCount</pre>
<div class="block">The number of playbacks which were the active foreground playback at some point.</div>
</li>
</ul>
<a id="abandonedBeforeReadyCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>abandonedBeforeReadyCount</h4>
<pre>public final int abandonedBeforeReadyCount</pre>
<div class="block">The number of playbacks which were abandoned before they were ready to play.</div>
</li>
</ul>
<a id="endedCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>endedCount</h4>
<pre>public final int endedCount</pre>
<div class="block">The number of playbacks which reached the ended state at least once.</div>
</li>
</ul>
<a id="backgroundJoiningCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>backgroundJoiningCount</h4>
<pre>public final int backgroundJoiningCount</pre>
<div class="block">The number of playbacks which were pre-buffered in the background.</div>
</li>
</ul>
<a id="totalValidJoinTimeMs">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalValidJoinTimeMs</h4>
<pre>public final long totalValidJoinTimeMs</pre>
<div class="block">The total time spent joining the playback, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no valid
join time could be determined.
<p>Note that this does not include background joining time. A join time may be invalid if the
playback never reached <a href="#PLAYBACK_STATE_PLAYING"><code>PLAYBACK_STATE_PLAYING</code></a> or <a href="#PLAYBACK_STATE_PAUSED"><code>PLAYBACK_STATE_PAUSED</code></a>, or
joining was interrupted by a seek, stop, or error state.</div>
</li>
</ul>
<a id="validJoinTimeCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>validJoinTimeCount</h4>
<pre>public final int validJoinTimeCount</pre>
<div class="block">The number of playbacks with a valid join time as documented in <a href="#totalValidJoinTimeMs"><code>totalValidJoinTimeMs</code></a>.</div>
</li>
</ul>
<a id="totalPauseCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalPauseCount</h4>
<pre>public final int totalPauseCount</pre>
<div class="block">The total number of times a playback has been paused.</div>
</li>
</ul>
<a id="totalPauseBufferCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalPauseBufferCount</h4>
<pre>public final int totalPauseBufferCount</pre>
<div class="block">The total number of times a playback has been paused while rebuffering.</div>
</li>
</ul>
<a id="totalSeekCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalSeekCount</h4>
<pre>public final int totalSeekCount</pre>
<div class="block">The total number of times a seek occurred. This includes seeks happening before playback
resumed after another seek.</div>
</li>
</ul>
<a id="totalRebufferCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalRebufferCount</h4>
<pre>public final int totalRebufferCount</pre>
<div class="block">The total number of times a rebuffer occurred. This excludes initial joining and buffering
after seek.</div>
</li>
</ul>
<a id="maxRebufferTimeMs">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>maxRebufferTimeMs</h4>
<pre>public final long maxRebufferTimeMs</pre>
<div class="block">The maximum time spent during a single rebuffer, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no
rebuffer occurred.</div>
</li>
</ul>
<a id="adPlaybackCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>adPlaybackCount</h4>
<pre>public final int adPlaybackCount</pre>
<div class="block">The number of ad playbacks.</div>
</li>
</ul>
<a id="videoFormatHistory">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>videoFormatHistory</h4>
<pre>public final <a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink">List</a><<a href="PlaybackStats.EventTimeAndFormat.html" title="class in com.google.android.exoplayer2.analytics" target="_top">PlaybackStats.EventTimeAndFormat</a>> videoFormatHistory</pre>
<div class="block">The video format history as <a href="PlaybackStats.EventTimeAndFormat.html" title="class in com.google.android.exoplayer2.analytics"><code>EventTimeAndFormats</code></a> ordered by <code>
EventTime.realTimeMs</code>. The <a href="../Format.html" title="class in com.google.android.exoplayer2"><code>Format</code></a> may be null if no video format was used.</div>
</li>
</ul>
<a id="audioFormatHistory">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>audioFormatHistory</h4>
<pre>public final <a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink">List</a><<a href="PlaybackStats.EventTimeAndFormat.html" title="class in com.google.android.exoplayer2.analytics" target="_top">PlaybackStats.EventTimeAndFormat</a>> audioFormatHistory</pre>
<div class="block">The audio format history as <a href="PlaybackStats.EventTimeAndFormat.html" title="class in com.google.android.exoplayer2.analytics"><code>EventTimeAndFormats</code></a> ordered by <code>
EventTime.realTimeMs</code>. The <a href="../Format.html" title="class in com.google.android.exoplayer2"><code>Format</code></a> may be null if no audio format was used.</div>
</li>
</ul>
<a id="totalVideoFormatHeightTimeMs">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalVideoFormatHeightTimeMs</h4>
<pre>public final long totalVideoFormatHeightTimeMs</pre>
<div class="block">The total media time for which video format height data is available, in milliseconds.</div>
</li>
</ul>
<a id="totalVideoFormatHeightTimeProduct">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalVideoFormatHeightTimeProduct</h4>
<pre>public final long totalVideoFormatHeightTimeProduct</pre>
<div class="block">The accumulated sum of all video format heights, in pixels, times the time the format was used
for playback, in milliseconds.</div>
</li>
</ul>
<a id="totalVideoFormatBitrateTimeMs">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalVideoFormatBitrateTimeMs</h4>
<pre>public final long totalVideoFormatBitrateTimeMs</pre>
<div class="block">The total media time for which video format bitrate data is available, in milliseconds.</div>
</li>
</ul>
<a id="totalVideoFormatBitrateTimeProduct">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalVideoFormatBitrateTimeProduct</h4>
<pre>public final long totalVideoFormatBitrateTimeProduct</pre>
<div class="block">The accumulated sum of all video format bitrates, in bits per second, times the time the format
was used for playback, in milliseconds.</div>
</li>
</ul>
<a id="totalAudioFormatTimeMs">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalAudioFormatTimeMs</h4>
<pre>public final long totalAudioFormatTimeMs</pre>
<div class="block">The total media time for which audio format data is available, in milliseconds.</div>
</li>
</ul>
<a id="totalAudioFormatBitrateTimeProduct">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalAudioFormatBitrateTimeProduct</h4>
<pre>public final long totalAudioFormatBitrateTimeProduct</pre>
<div class="block">The accumulated sum of all audio format bitrates, in bits per second, times the time the format
was used for playback, in milliseconds.</div>
</li>
</ul>
<a id="initialVideoFormatHeightCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initialVideoFormatHeightCount</h4>
<pre>public final int initialVideoFormatHeightCount</pre>
<div class="block">The number of playbacks with initial video format height data.</div>
</li>
</ul>
<a id="initialVideoFormatBitrateCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initialVideoFormatBitrateCount</h4>
<pre>public final int initialVideoFormatBitrateCount</pre>
<div class="block">The number of playbacks with initial video format bitrate data.</div>
</li>
</ul>
<a id="totalInitialVideoFormatHeight">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalInitialVideoFormatHeight</h4>
<pre>public final int totalInitialVideoFormatHeight</pre>
<div class="block">The total initial video format height for all playbacks, in pixels, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a>
if no initial video format data is available.</div>
</li>
</ul>
<a id="totalInitialVideoFormatBitrate">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalInitialVideoFormatBitrate</h4>
<pre>public final long totalInitialVideoFormatBitrate</pre>
<div class="block">The total initial video format bitrate for all playbacks, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no initial video format data is available.</div>
</li>
</ul>
<a id="initialAudioFormatBitrateCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initialAudioFormatBitrateCount</h4>
<pre>public final int initialAudioFormatBitrateCount</pre>
<div class="block">The number of playbacks with initial audio format bitrate data.</div>
</li>
</ul>
<a id="totalInitialAudioFormatBitrate">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalInitialAudioFormatBitrate</h4>
<pre>public final long totalInitialAudioFormatBitrate</pre>
<div class="block">The total initial audio format bitrate for all playbacks, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no initial audio format data is available.</div>
</li>
</ul>
<a id="totalBandwidthTimeMs">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalBandwidthTimeMs</h4>
<pre>public final long totalBandwidthTimeMs</pre>
<div class="block">The total time for which bandwidth measurement data is available, in milliseconds.</div>
</li>
</ul>
<a id="totalBandwidthBytes">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalBandwidthBytes</h4>
<pre>public final long totalBandwidthBytes</pre>
<div class="block">The total bytes transferred during <a href="#totalBandwidthTimeMs"><code>totalBandwidthTimeMs</code></a>.</div>
</li>
</ul>
<a id="totalDroppedFrames">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalDroppedFrames</h4>
<pre>public final long totalDroppedFrames</pre>
<div class="block">The total number of dropped video frames.</div>
</li>
</ul>
<a id="totalAudioUnderruns">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalAudioUnderruns</h4>
<pre>public final long totalAudioUnderruns</pre>
<div class="block">The total number of audio underruns.</div>
</li>
</ul>
<a id="fatalErrorPlaybackCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fatalErrorPlaybackCount</h4>
<pre>public final int fatalErrorPlaybackCount</pre>
<div class="block">The total number of playback with at least one fatal error. Errors are fatal if playback
stopped due to this error.</div>
</li>
</ul>
<a id="fatalErrorCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fatalErrorCount</h4>
<pre>public final int fatalErrorCount</pre>
<div class="block">The total number of fatal errors. Errors are fatal if playback stopped due to this error.</div>
</li>
</ul>
<a id="nonFatalErrorCount">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>nonFatalErrorCount</h4>
<pre>public final int nonFatalErrorCount</pre>
<div class="block">The total number of non-fatal errors. Error are non-fatal if playback can recover from the
error without stopping.</div>
</li>
</ul>
<a id="fatalErrorHistory">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fatalErrorHistory</h4>
<pre>public final <a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink">List</a><<a href="PlaybackStats.EventTimeAndException.html" title="class in com.google.android.exoplayer2.analytics" target="_top">PlaybackStats.EventTimeAndException</a>> fatalErrorHistory</pre>
<div class="block">The history of fatal errors as <a href="PlaybackStats.EventTimeAndException.html" title="class in com.google.android.exoplayer2.analytics"><code>EventTimeAndExceptions</code></a> ordered by
<code>EventTime.realTimeMs</code>. Errors are fatal if playback stopped due to this error.</div>
</li>
</ul>
<a id="nonFatalErrorHistory">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>nonFatalErrorHistory</h4>
<pre>public final <a href="https://developer.android.com/reference/java/util/List.html" title="class or interface in java.util" class="externalLink">List</a><<a href="PlaybackStats.EventTimeAndException.html" title="class in com.google.android.exoplayer2.analytics" target="_top">PlaybackStats.EventTimeAndException</a>> nonFatalErrorHistory</pre>
<div class="block">The history of non-fatal errors as <a href="PlaybackStats.EventTimeAndException.html" title="class in com.google.android.exoplayer2.analytics"><code>EventTimeAndExceptions</code></a> ordered
by <code>EventTime.realTimeMs</code>. Errors are non-fatal if playback can recover from the error
without stopping.</div>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="merge(com.google.android.exoplayer2.analytics.PlaybackStats...)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>merge</h4>
<pre class="methodSignature">public static <a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics">PlaybackStats</a> merge​(<a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics">PlaybackStats</a>... playbackStats)</pre>
<div class="block">Returns the combined <a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics"><code>PlaybackStats</code></a> for all input <a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics"><code>PlaybackStats</code></a>.
<p>Note that the full history of events is not kept as the history only makes sense in the
context of a single playback.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>playbackStats</code> - Array of <a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics"><code>PlaybackStats</code></a> to combine.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The combined <a href="PlaybackStats.html" title="class in com.google.android.exoplayer2.analytics"><code>PlaybackStats</code></a>.</dd>
</dl>
</li>
</ul>
<a id="getPlaybackStateDurationMs(@com.google.android.exoplayer2.analytics.PlaybackStats.PlaybackStateint)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPlaybackStateDurationMs</h4>
<pre class="methodSignature">public long getPlaybackStateDurationMs​(@com.google.android.exoplayer2.analytics.PlaybackStats.PlaybackState int playbackState)</pre>
<div class="block">Returns the total time spent in a given <code>PlaybackStats.PlaybackState</code>, in milliseconds.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>playbackState</code> - A <code>PlaybackStats.PlaybackState</code>.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Total spent in the given playback state, in milliseconds</dd>
</dl>
</li>
</ul>
<a id="getPlaybackStateAtTime(long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPlaybackStateAtTime</h4>
<pre class="methodSignature">public @com.google.android.exoplayer2.analytics.PlaybackStats.PlaybackState int getPlaybackStateAtTime​(long realtimeMs)</pre>
<div class="block">Returns the <code>PlaybackStats.PlaybackState</code> at the given time.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>realtimeMs</code> - The time as returned by <a href="https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()" title="class or interface in android.os" class="externalLink" target="_top"><code>SystemClock.elapsedRealtime()</code></a>.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The <code>PlaybackStats.PlaybackState</code> at that time, or <a href="#PLAYBACK_STATE_NOT_STARTED"><code>PLAYBACK_STATE_NOT_STARTED</code></a> if the
given time is before the first known playback state in the history.</dd>
</dl>
</li>
</ul>
<a id="getMediaTimeMsAtRealtimeMs(long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMediaTimeMsAtRealtimeMs</h4>
<pre class="methodSignature">public long getMediaTimeMsAtRealtimeMs​(long realtimeMs)</pre>
<div class="block">Returns the estimated media time at the given realtime, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if the media time history is unknown.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>realtimeMs</code> - The realtime as returned by <a href="https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()" title="class or interface in android.os" class="externalLink" target="_top"><code>SystemClock.elapsedRealtime()</code></a>.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The estimated media time in milliseconds at this realtime, <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no
estimate can be given.</dd>
</dl>
</li>
</ul>
<a id="getMeanJoinTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanJoinTimeMs</h4>
<pre class="methodSignature">public long getMeanJoinTimeMs()</pre>
<div class="block">Returns the mean time spent joining the playback, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if
no valid join time is available. Only includes playbacks with valid join times as documented in
<a href="#totalValidJoinTimeMs"><code>totalValidJoinTimeMs</code></a>.</div>
</li>
</ul>
<a id="getTotalJoinTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTotalJoinTimeMs</h4>
<pre class="methodSignature">public long getTotalJoinTimeMs()</pre>
<div class="block">Returns the total time spent joining the playback in foreground, in milliseconds. This does
include invalid join times where the playback never reached <a href="#PLAYBACK_STATE_PLAYING"><code>PLAYBACK_STATE_PLAYING</code></a> or
<a href="#PLAYBACK_STATE_PAUSED"><code>PLAYBACK_STATE_PAUSED</code></a>, or joining was interrupted by a seek, stop, or error state.</div>
</li>
</ul>
<a id="getTotalPlayTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTotalPlayTimeMs</h4>
<pre class="methodSignature">public long getTotalPlayTimeMs()</pre>
<div class="block">Returns the total time spent actively playing, in milliseconds.</div>
</li>
</ul>
<a id="getMeanPlayTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanPlayTimeMs</h4>
<pre class="methodSignature">public long getMeanPlayTimeMs()</pre>
<div class="block">Returns the mean time spent actively playing per foreground playback, in milliseconds, or
<a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground.</div>
</li>
</ul>
<a id="getTotalPausedTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTotalPausedTimeMs</h4>
<pre class="methodSignature">public long getTotalPausedTimeMs()</pre>
<div class="block">Returns the total time spent in a paused state, in milliseconds.</div>
</li>
</ul>
<a id="getMeanPausedTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanPausedTimeMs</h4>
<pre class="methodSignature">public long getMeanPausedTimeMs()</pre>
<div class="block">Returns the mean time spent in a paused state per foreground playback, in milliseconds, or
<a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground.</div>
</li>
</ul>
<a id="getTotalRebufferTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTotalRebufferTimeMs</h4>
<pre class="methodSignature">public long getTotalRebufferTimeMs()</pre>
<div class="block">Returns the total time spent rebuffering, in milliseconds. This excludes initial join times,
buffer times after a seek and buffering while paused.</div>
</li>
</ul>
<a id="getMeanRebufferTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanRebufferTimeMs</h4>
<pre class="methodSignature">public long getMeanRebufferTimeMs()</pre>
<div class="block">Returns the mean time spent rebuffering per foreground playback, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground. This excludes initial join times, buffer
times after a seek and buffering while paused.</div>
</li>
</ul>
<a id="getMeanSingleRebufferTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanSingleRebufferTimeMs</h4>
<pre class="methodSignature">public long getMeanSingleRebufferTimeMs()</pre>
<div class="block">Returns the mean time spent during a single rebuffer, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a>
if no rebuffer was recorded. This excludes initial join times and buffer times after a seek.</div>
</li>
</ul>
<a id="getTotalSeekTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTotalSeekTimeMs</h4>
<pre class="methodSignature">public long getTotalSeekTimeMs()</pre>
<div class="block">Returns the total time spent from the start of a seek until playback is ready again, in
milliseconds.</div>
</li>
</ul>
<a id="getMeanSeekTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanSeekTimeMs</h4>
<pre class="methodSignature">public long getMeanSeekTimeMs()</pre>
<div class="block">Returns the mean time spent per foreground playback from the start of a seek until playback is
ready again, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground.</div>
</li>
</ul>
<a id="getMeanSingleSeekTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanSingleSeekTimeMs</h4>
<pre class="methodSignature">public long getMeanSingleSeekTimeMs()</pre>
<div class="block">Returns the mean time spent from the start of a single seek until playback is ready again, in
milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no seek occurred.</div>
</li>
</ul>
<a id="getTotalWaitTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTotalWaitTimeMs</h4>
<pre class="methodSignature">public long getTotalWaitTimeMs()</pre>
<div class="block">Returns the total time spent actively waiting for playback, in milliseconds. This includes all
join times, rebuffer times and seek times, but excludes times without user intention to play,
e.g. all paused states.</div>
</li>
</ul>
<a id="getMeanWaitTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanWaitTimeMs</h4>
<pre class="methodSignature">public long getMeanWaitTimeMs()</pre>
<div class="block">Returns the mean time spent actively waiting for playback per foreground playback, in
milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground. This includes all
join times, rebuffer times and seek times, but excludes times without user intention to play,
e.g. all paused states.</div>
</li>
</ul>
<a id="getTotalPlayAndWaitTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTotalPlayAndWaitTimeMs</h4>
<pre class="methodSignature">public long getTotalPlayAndWaitTimeMs()</pre>
<div class="block">Returns the total time spent playing or actively waiting for playback, in milliseconds.</div>
</li>
</ul>
<a id="getMeanPlayAndWaitTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanPlayAndWaitTimeMs</h4>
<pre class="methodSignature">public long getMeanPlayAndWaitTimeMs()</pre>
<div class="block">Returns the mean time spent playing or actively waiting for playback per foreground playback,
in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback has been in foreground.</div>
</li>
</ul>
<a id="getTotalElapsedTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTotalElapsedTimeMs</h4>
<pre class="methodSignature">public long getTotalElapsedTimeMs()</pre>
<div class="block">Returns the total time covered by any playback state, in milliseconds.</div>
</li>
</ul>
<a id="getMeanElapsedTimeMs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanElapsedTimeMs</h4>
<pre class="methodSignature">public long getMeanElapsedTimeMs()</pre>
<div class="block">Returns the mean time covered by any playback state per playback, in milliseconds, or <a href="../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if no playback was recorded.</div>
</li>
</ul>
<a id="getAbandonedBeforeReadyRatio()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAbandonedBeforeReadyRatio</h4>
<pre class="methodSignature">public float getAbandonedBeforeReadyRatio()</pre>
<div class="block">Returns the ratio of foreground playbacks which were abandoned before they were ready to play,
or <code>0.0</code> if no playback has been in foreground.</div>
</li>
</ul>
<a id="getEndedRatio()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEndedRatio</h4>
<pre class="methodSignature">public float getEndedRatio()</pre>
<div class="block">Returns the ratio of foreground playbacks which reached the ended state at least once, or
<code>0.0</code> if no playback has been in foreground.</div>
</li>
</ul>
<a id="getMeanPauseCount()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanPauseCount</h4>
<pre class="methodSignature">public float getMeanPauseCount()</pre>
<div class="block">Returns the mean number of times a playback has been paused per foreground playback, or <code>
0.0</code> if no playback has been in foreground.</div>
</li>
</ul>
<a id="getMeanPauseBufferCount()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanPauseBufferCount</h4>
<pre class="methodSignature">public float getMeanPauseBufferCount()</pre>
<div class="block">Returns the mean number of times a playback has been paused while rebuffering per foreground
playback, or <code>0.0</code> if no playback has been in foreground.</div>
</li>
</ul>
<a id="getMeanSeekCount()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanSeekCount</h4>
<pre class="methodSignature">public float getMeanSeekCount()</pre>
<div class="block">Returns the mean number of times a seek occurred per foreground playback, or <code>0.0</code> if no
playback has been in foreground. This includes seeks happening before playback resumed after
another seek.</div>
</li>
</ul>
<a id="getMeanRebufferCount()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanRebufferCount</h4>
<pre class="methodSignature">public float getMeanRebufferCount()</pre>
<div class="block">Returns the mean number of times a rebuffer occurred per foreground playback, or <code>0.0</code> if
no playback has been in foreground. This excludes initial joining and buffering after seek.</div>
</li>
</ul>
<a id="getWaitTimeRatio()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getWaitTimeRatio</h4>
<pre class="methodSignature">public float getWaitTimeRatio()</pre>
<div class="block">Returns the ratio of wait times to the total time spent playing and waiting, or <code>0.0</code> if
no time was spend playing or waiting. This is equivalent to <a href="#getTotalWaitTimeMs()"><code>getTotalWaitTimeMs()</code></a> /
<a href="#getTotalPlayAndWaitTimeMs()"><code>getTotalPlayAndWaitTimeMs()</code></a> and also to <a href="#getJoinTimeRatio()"><code>getJoinTimeRatio()</code></a> + <a href="#getRebufferTimeRatio()"><code>getRebufferTimeRatio()</code></a> + <a href="#getSeekTimeRatio()"><code>getSeekTimeRatio()</code></a>.</div>
</li>
</ul>
<a id="getJoinTimeRatio()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJoinTimeRatio</h4>
<pre class="methodSignature">public float getJoinTimeRatio()</pre>
<div class="block">Returns the ratio of foreground join time to the total time spent playing and waiting, or
<code>0.0</code> if no time was spend playing or waiting. This is equivalent to <a href="#getTotalJoinTimeMs()"><code>getTotalJoinTimeMs()</code></a> / <a href="#getTotalPlayAndWaitTimeMs()"><code>getTotalPlayAndWaitTimeMs()</code></a>.</div>
</li>
</ul>
<a id="getRebufferTimeRatio()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRebufferTimeRatio</h4>
<pre class="methodSignature">public float getRebufferTimeRatio()</pre>
<div class="block">Returns the ratio of rebuffer time to the total time spent playing and waiting, or <code>0.0</code>
if no time was spend playing or waiting. This is equivalent to <a href="#getTotalRebufferTimeMs()"><code>getTotalRebufferTimeMs()</code></a> / <a href="#getTotalPlayAndWaitTimeMs()"><code>getTotalPlayAndWaitTimeMs()</code></a>.</div>
</li>
</ul>
<a id="getSeekTimeRatio()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSeekTimeRatio</h4>
<pre class="methodSignature">public float getSeekTimeRatio()</pre>
<div class="block">Returns the ratio of seek time to the total time spent playing and waiting, or <code>0.0</code> if
no time was spend playing or waiting. This is equivalent to <a href="#getTotalSeekTimeMs()"><code>getTotalSeekTimeMs()</code></a> /
<a href="#getTotalPlayAndWaitTimeMs()"><code>getTotalPlayAndWaitTimeMs()</code></a>.</div>
</li>
</ul>
<a id="getRebufferRate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRebufferRate</h4>
<pre class="methodSignature">public float getRebufferRate()</pre>
<div class="block">Returns the rate of rebuffer events, in rebuffers per play time second, or <code>0.0</code> if no
time was spend playing. This is equivalent to 1.0 / <a href="#getMeanTimeBetweenRebuffers()"><code>getMeanTimeBetweenRebuffers()</code></a>.</div>
</li>
</ul>
<a id="getMeanTimeBetweenRebuffers()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanTimeBetweenRebuffers</h4>
<pre class="methodSignature">public float getMeanTimeBetweenRebuffers()</pre>
<div class="block">Returns the mean play time between rebuffer events, in seconds. This is equivalent to 1.0 /
<a href="#getRebufferRate()"><code>getRebufferRate()</code></a>. Note that this may return <a href="https://developer.android.com/reference/java/lang/Float.html#POSITIVE_INFINITY" title="class or interface in java.lang" class="externalLink" target="_top"><code>Float.POSITIVE_INFINITY</code></a>.</div>
</li>
</ul>
<a id="getMeanInitialVideoFormatHeight()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanInitialVideoFormatHeight</h4>
<pre class="methodSignature">public int getMeanInitialVideoFormatHeight()</pre>
<div class="block">Returns the mean initial video format height, in pixels, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no video
format data is available.</div>
</li>
</ul>
<a id="getMeanInitialVideoFormatBitrate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanInitialVideoFormatBitrate</h4>
<pre class="methodSignature">public int getMeanInitialVideoFormatBitrate()</pre>
<div class="block">Returns the mean initial video format bitrate, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if
no video format data is available.</div>
</li>
</ul>
<a id="getMeanInitialAudioFormatBitrate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanInitialAudioFormatBitrate</h4>
<pre class="methodSignature">public int getMeanInitialAudioFormatBitrate()</pre>
<div class="block">Returns the mean initial audio format bitrate, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if
no audio format data is available.</div>
</li>
</ul>
<a id="getMeanVideoFormatHeight()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanVideoFormatHeight</h4>
<pre class="methodSignature">public int getMeanVideoFormatHeight()</pre>
<div class="block">Returns the mean video format height, in pixels, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no video format
data is available. This is a weighted average taking the time the format was used for playback
into account.</div>
</li>
</ul>
<a id="getMeanVideoFormatBitrate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanVideoFormatBitrate</h4>
<pre class="methodSignature">public int getMeanVideoFormatBitrate()</pre>
<div class="block">Returns the mean video format bitrate, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no
video format data is available. This is a weighted average taking the time the format was used
for playback into account.</div>
</li>
</ul>
<a id="getMeanAudioFormatBitrate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanAudioFormatBitrate</h4>
<pre class="methodSignature">public int getMeanAudioFormatBitrate()</pre>
<div class="block">Returns the mean audio format bitrate, in bits per second, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no
audio format data is available. This is a weighted average taking the time the format was used
for playback into account.</div>
</li>
</ul>
<a id="getMeanBandwidth()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanBandwidth</h4>
<pre class="methodSignature">public int getMeanBandwidth()</pre>
<div class="block">Returns the mean network bandwidth based on transfer measurements, in bits per second, or
<a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if no transfer data is available.</div>
</li>
</ul>
<a id="getDroppedFramesRate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDroppedFramesRate</h4>
<pre class="methodSignature">public float getDroppedFramesRate()</pre>
<div class="block">Returns the mean rate at which video frames are dropped, in dropped frames per play time
second, or <code>0.0</code> if no time was spent playing.</div>
</li>
</ul>
<a id="getAudioUnderrunRate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAudioUnderrunRate</h4>
<pre class="methodSignature">public float getAudioUnderrunRate()</pre>
<div class="block">Returns the mean rate at which audio underruns occurred, in underruns per play time second, or
<code>0.0</code> if no time was spent playing.</div>
</li>
</ul>
<a id="getFatalErrorRatio()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFatalErrorRatio</h4>
<pre class="methodSignature">public float getFatalErrorRatio()</pre>
<div class="block">Returns the ratio of foreground playbacks which experienced fatal errors, or <code>0.0</code> if no
playback has been in foreground.</div>
</li>
</ul>
<a id="getFatalErrorRate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFatalErrorRate</h4>
<pre class="methodSignature">public float getFatalErrorRate()</pre>
<div class="block">Returns the rate of fatal errors, in errors per play time second, or <code>0.0</code> if no time was
spend playing. This is equivalent to 1.0 / <a href="#getMeanTimeBetweenFatalErrors()"><code>getMeanTimeBetweenFatalErrors()</code></a>.</div>
</li>
</ul>
<a id="getMeanTimeBetweenFatalErrors()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanTimeBetweenFatalErrors</h4>
<pre class="methodSignature">public float getMeanTimeBetweenFatalErrors()</pre>
<div class="block">Returns the mean play time between fatal errors, in seconds. This is equivalent to 1.0 / <a href="#getFatalErrorRate()"><code>getFatalErrorRate()</code></a>. Note that this may return <a href="https://developer.android.com/reference/java/lang/Float.html#POSITIVE_INFINITY" title="class or interface in java.lang" class="externalLink" target="_top"><code>Float.POSITIVE_INFINITY</code></a>.</div>
</li>
</ul>
<a id="getMeanNonFatalErrorCount()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMeanNonFatalErrorCount</h4>
<pre class="methodSignature">public float getMeanNonFatalErrorCount()</pre>
<div class="block">Returns the mean number of non-fatal errors per foreground playback, or <code>0.0</code> if no
playback has been in foreground.</div>
</li>
</ul>
<a id="getNonFatalErrorRate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNonFatalErrorRate</h4>
<pre class="methodSignature">public float getNonFatalErrorRate()</pre>
<div class="block">Returns the rate of non-fatal errors, in errors per play time second, or <code>0.0</code> if no time
was spend playing. This is equivalent to 1.0 / <a href="#getMeanTimeBetweenNonFatalErrors()"><code>getMeanTimeBetweenNonFatalErrors()</code></a>.</div>
</li>
</ul>
<a id="getMeanTimeBetweenNonFatalErrors()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getMeanTimeBetweenNonFatalErrors</h4>
<pre class="methodSignature">public float getMeanTimeBetweenNonFatalErrors()</pre>
<div class="block">Returns the mean play time between non-fatal errors, in seconds. This is equivalent to 1.0 /
<a href="#getNonFatalErrorRate()"><code>getNonFatalErrorRate()</code></a>. Note that this may return <a href="https://developer.android.com/reference/java/lang/Float.html#POSITIVE_INFINITY" title="class or interface in java.lang" class="externalLink" target="_top"><code>Float.POSITIVE_INFINITY</code></a>.</div>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
</footer>
</body>
</html>
| HTML | 5 | ITS-TVS/ExoPlayer | docs/doc/reference/com/google/android/exoplayer2/analytics/PlaybackStats.html | [
"Apache-2.0"
] |
#pragma once
#include <torch/all.h>
#ifdef TORCH_API_INCLUDE_EXTENSION_H
#include <torch/extension.h>
#endif // defined(TORCH_API_INCLUDE_EXTENSION_H)
| C | 1 | Hacky-DH/pytorch | torch/csrc/api/include/torch/torch.h | [
"Intel"
] |
{
"@context": {
"property": { "@id": "http://example.com/vocab/property", "@language": "de" },
"indexMap": { "@id": "http://example.com/vocab/indexMap", "@language": "en", "@container": "@index" }
},
"@id": "http://example.com/node",
"property": [
{
"@id": "http://example.com/propertyValueNode",
"indexMap": {
"expands to english string": "simple string"
}
},
"einfacher String"
]
}
| JSONLD | 3 | fsteeg/json-ld-api | tests/toRdf/0084-in.jsonld | [
"W3C"
] |
<% f = fn 1 -> %>b<% end\nf.() %>
| HTML+EEX | 1 | keyno63/intellij-elixir | testData/org/elixir_lang/eex/psi/parser/test/FnUnexpectedEnd.eex | [
"Apache-2.0"
] |
const path = require("path");
const fs = require("fs");
const asc = require("assemblyscript/cli/asc");
// When --write is set, files will be written in place
// Otherwise it only prints outdated files
const doWrite = process.argv.includes("--write");
const files = ["lib/util/hash/xxhash64.js", "lib/util/hash/md4.js"];
(async () => {
await asc.ready;
for (const file of files) {
const filePath = path.resolve(__dirname, "..", file);
const content = fs.readFileSync(filePath, "utf-8");
const regexp =
/\n\/\/#region wasm code: (.+) \((.+)\)(.*)\n[\s\S]+?\/\/#endregion\n/g;
const replaces = new Map();
let match = regexp.exec(content);
while (match) {
const [fullMatch, identifier, name, flags] = match;
const sourcePath = path.resolve(filePath, "..", name);
const sourcePathBase = path.join(
path.dirname(sourcePath),
path.basename(sourcePath)
);
await new Promise((resolve, reject) => {
asc.main(
[
sourcePath,
// cspell:word Ospeed
"-Ospeed",
"--noAssert",
"--converge",
"--textFile",
sourcePathBase + ".wat",
"--binaryFile",
sourcePathBase + ".wasm",
...flags.split(" ").filter(Boolean)
],
{
stdout: process.stdout,
stderr: process.stderr
},
err => {
if (err) return reject(err), 0;
resolve();
return 0;
}
);
});
const wasm = fs.readFileSync(sourcePathBase + ".wasm");
replaces.set(
fullMatch,
`
//#region wasm code: ${identifier} (${name})${flags}
const ${identifier} = new WebAssembly.Module(
Buffer.from(
// ${wasm.length} bytes
${JSON.stringify(wasm.toString("base64"))},
"base64"
)
);
//#endregion
`
);
match = regexp.exec(content);
}
const newContent = content.replace(regexp, match => replaces.get(match));
if (newContent !== content) {
if (doWrite) {
fs.writeFileSync(filePath, newContent, "utf-8");
console.error(`${file} updated`);
} else {
console.error(`${file} need to be updated`);
process.exitCode = 1;
}
}
}
})();
| JavaScript | 5 | fourstash/webpack | tooling/generate-wasm-code.js | [
"MIT"
] |
### 请求 /login 接口 => 成功
POST {{baseUrl}}/login
Content-Type: application/json
{
"username": "admin",
"password": "admin123",
"uuid": "9b2ffbc1-7425-4155-9894-9d5c08541d62",
"code": "1024"
}
### 请求 /get-permission-info 接口 => 成功
GET {{baseUrl}}/get-permission-info
Authorization: Bearer {{token}}
### 请求 /list-menus 接口 => 成功
GET {{baseUrl}}/list-menus
Authorization: Bearer {{token}}
### 请求 /druid/xxx 接口 => 失败 TODO 临时测试
GET http://127.0.0.1:8080/druid/123
Authorization: Bearer {{token}}
| HTTP | 3 | TFdream/ruoyi-vue-pro | src/main/java/cn/iocoder/dashboard/modules/system/controller/auth/SysAuthController.http | [
"MIT"
] |
Gramatika
0 $accept: E $end
1 E: A '1'
2 | B '2'
3 A: '1'
4 B: '1'
Terminály s pravidly, ve kterých se objevují
$end (0) 0
'1' (49) 1 3 4
'2' (50) 2
error (256)
Neterminály s pravidly, ve kterých se objevují
$accept (5)
vlevo: 0
E (6)
vlevo: 1 2, vpravo: 0
A (7)
vlevo: 3, vpravo: 1
B (8)
vlevo: 4, vpravo: 2
State 0
0 $accept: . E $end
1 E: . A '1'
2 | . B '2'
3 A: . '1'
4 B: . '1'
'1' posunout a přejít do stavu 1
E přejít do stavu 2
A přejít do stavu 3
B přejít do stavu 4
State 1
3 A: '1' . ['1']
4 B: '1' . ['2']
'2' reduce using rule 4 (B)
$výchozí reduce using rule 3 (A)
State 2
0 $accept: E . $end
$end posunout a přejít do stavu 5
State 3
1 E: A . '1'
'1' posunout a přejít do stavu 6
State 4
2 E: B . '2'
'2' posunout a přejít do stavu 7
State 5
0 $accept: E $end .
$výchozí přijmout
State 6
1 E: A '1' .
$výchozí reduce using rule 1 (E)
State 7
2 E: B '2' .
$výchozí reduce using rule 2 (E)
| Bison | 4 | YKG/y | testdata/dev/rr.y.bison | [
"BSD-3-Clause"
] |
'
' Copyright (c) 2016 Roku, Inc. All rights reserved.
'
' File: utils.brs
'
'=======================================================
' Converts the object to a displayable string.
' If obj is invalid, returns <<invalid>>
'
function roToString(obj as Dynamic) as String
return roToStringInv(obj, "<<invalid>>")
end function
'=======================================================
' Similar to roToString() but if the object is invalid, invalidString is returnd
'
function roToStringInv(obj as Dynamic, invalidString as string) as String
s = invalidString
if obj = invalid
typeStr = invalid
else
typeStr = type(obj)
end if
if typeStr = invalid
' Do nothing, leave s as it is
else if typeStr = "Boolean"
if obj
s = "true"
else
s = "false"
end if
else if typeStr = "Double"
s = obj.toStr()
else if typeStr = "Float"
s = obj.toStr()
else if typeStr = "Integer"
s = obj.toStr()
else if typeStr = "roArray"
s = _arrayToStringInv(obj, invalidString)
else if typeStr = "roAssociativeArray"
s = _aaToStringInv(obj, invalidString)
else if typeStr = "roBoolean"
if obj
s = "true"
else
s = "false"
endif
else if typeStr = "roFloat"
s = obj.toStr()
else if typeStr = "roInt"
s = obj.toStr()
else if typeStr = "roSGNodeEvent"
event = obj
node = event.getNode()
fieldName = event.getField()
s = typeStr + "[node=" + roToString(node) + ",field=" + fieldName + "]"
else if typeStr = "roSGNode"
s = typeStr + ":" + obj.subtype()
s = s + "["
if (obj.id <> invalid) and (obj.id <> "") then
s = s + "id=" + obj.id + ","
end if
s = s + "]"
else if typeStr = "roString"
s = obj
else if typeStr = "String"
s = obj
else
s = "instance of " + typeStr
end if
return s
end function
function _aaToStringInv(aa as Dynamic, invalidString as String) as String
if (aa = invalid)
s = invalidString
else
s = "{"
i = -1
aa.reset()
while aa.isNext()
if len(s) > 250
s = s + ", ..."
exit while
end if
i = i + 1
key = aa.next()
value = aa[key]
if value = invalid
valid = "<<invalid>>"
end if
if (i > 0)
s = s + ", "
end if
s = s + roToString(key)
s = s + ":"
s = s + roToString(value)
end while
s = s + "}"
end if
return s
end function
function _arrayToStringInv(array as Dynamic, invalidString as String) as String
if array = invalid
s = invalidString
else
s = "["
first = true
for each val in array
if not first then
s = s + ","
end if
first = false
s = s + roToStringInv(val, invalidString)
end for
s = s + "]"
end if
return s
end function
| Brightscript | 4 | khangh/samples | certification/manifestData-sample-master/source/utils.brs | [
"MIT"
] |
// model 4:
// marginalise Binomial between casesL and casesU as total
// and p specified as average in age band interval
// using implementation of binomial_lpmf to prepare vectorisation
functions {
real calculate_p_avg_for_obs(//pars
vector p_predict,
real study_rnde_local,
// data
int lower_age_idx_local,
int upper_age_idx_local
)
{
real ans;
ans = mean( p_predict[ lower_age_idx_local:upper_age_idx_local ] );
ans = inv_logit( logit( ans ) + study_rnde_local );
return( ans );
}
real calculate_marginal_binomial(//pars
real p_avg,
// data
int total_N,
vector log_choose_local,
int suc,
vector totals
)
{
return(
log_sum_exp(
log_choose_local +
rep_vector(suc * log(p_avg),total_N) +
(totals - suc ) * log(1-p_avg)
)
);
}
real model_4_log_dens(
int[] deaths_slice,
int start,
int end,
//pars
vector p_predict,
vector study_rnde,
// data
int[] study_idx,
int[] lower_age_idx,
int[] upper_age_idx,
int[] casesN,
matrix log_choose_fct,
matrix casesAux
)
{
int n;
real lpmf;
int N_slice;
real p_avg;
lpmf = 0.0;
N_slice = end - start + 1;
for(n_slice in 1:N_slice)
{
n = n_slice + start - 1;
p_avg =
calculate_p_avg_for_obs(
p_predict,
study_rnde[study_idx[n]],
lower_age_idx[n],
upper_age_idx[n]
);
lpmf +=
calculate_marginal_binomial(
p_avg,
casesN[n],
log_choose_fct[1:casesN[n], n],
deaths_slice[n],
casesAux[1:casesN[n], n]
);
}
return( lpmf );
}
}
data
{
int<lower=0> N; // number of observations
int<lower=0> N_predict; // number of predictions
int<lower=0> M; // number of studies
int max_casesN; // numnber of max auxiliary cases
int casesN[N]; // numnber of auxiliary cases for each observation
int deaths[N]; // number of deaths
vector<lower=0>[N_predict] age; // age predictions
vector<lower=0>[N] age_study; // age midpoints
int lower_age_idx[N]; // lower index of observed age band in age_predict
int upper_age_idx[N]; // upper index of observed age band in age_predict
int<lower=1,upper=M> study[N];
matrix[max_casesN, N] log_choose_fct; // precomputed log choose
matrix[max_casesN, N] casesAux; // precomputed aux cases
}
parameters
{
real alpha;
real beta;
real<lower=0> study_rnde_sd;
vector[M] study_rnde;
}
transformed parameters
{
vector<upper=0>[N_predict] log_p_predict;
vector<lower=0,upper=1>[N_predict] p_predict;
log_p_predict = alpha + beta * age;
p_predict = exp( log_p_predict );
}
model
{
target += normal_lpdf( alpha | 0, 10);
target += normal_lpdf( beta | 0, 1);
target += normal_lpdf( study_rnde | 0, study_rnde_sd);
target += exponential_lpdf( study_rnde_sd | 10);
//log lkl rstan version
//target += model_4_log_dens(deaths, 1, N,
//log lkl cmdstan version
target += reduce_sum(model_4_log_dens, deaths, 1,
// pars
p_predict,
study_rnde,
// data
study,
lower_age_idx,
upper_age_idx,
casesN,
log_choose_fct,
casesAux
);
}
| Stan | 5 | viniciuszendron/covid19model | covid19AgeModel/inst/ifr-by-age/base_age_prior_ifr_200820a4_cmdstanv.stan | [
"MIT"
] |
%% This module, when loaded as a plugin, overrides the default `install_deps`
%% provider and erases the dependencies from the rebar3 state, when
%% REBAR_IGNORE_DEPS is true.
-module(rebar_ignore_deps).
-export([init/1, do/1, format_error/1]).
init(State0) ->
case os:getenv("REBAR_IGNORE_DEPS", "") of
"" ->
{ok, State0};
_ ->
do_init(State0)
end.
do_init(State0) ->
State1 = rebar_state:allow_provider_overrides(State0, true),
Provider = providers:create(
[
{name, install_deps}, %% override the default install_deps provider
{module, ?MODULE},
{bare, false},
{deps, [app_discovery]},
{example, undefined},
{opts, []},
{short_desc, ""},
{desc, ""}
]),
State2 = rebar_state:add_provider(State1, Provider),
{ok, rebar_state:allow_provider_overrides(State2, false)}.
do(State0) ->
io:format("Ignoring deps...~n"),
Profiles = rebar_state:current_profiles(State0),
State = lists:foldl(fun(P, Acc0) ->
Acc = rebar_state:set(Acc0, {deps, P}, []),
rebar_state:set(Acc, {parsed_deps, P}, [])
end, State0, Profiles),
{ok, State}.
format_error(Reason) ->
io_lib:format("~p", [Reason]).
| Erlang | 4 | arjix/nixpkgs | pkgs/development/tools/build-managers/rebar3/rebar_ignore_deps.erl | [
"MIT"
] |
load '../train/train.plot'
set yrange [:60]
set ylabel 'perplexity'
plot 'model.step-devperplexity' t 'dev perplexity' w lines ls 2
| Gnuplot | 3 | DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | Projects/hackernews-comments/train-wiki/dev-perplexity.plot | [
"Apache-2.0"
] |
global $Os
A07000035222()
global $SA3700804E15=A0700003522($Os[0x1]),$SA1400903D2D=A0700003522($Os[0x2]),$SA4300A04532=A0700003522($Os[0x3]),$SA2F00B0060B=A0700003522($Os[0x4]),$SA3C00C02F61=A0700003522($Os[0x5]),$SA2600D04516=A0700003522($Os[0x6]),$SA2100E0632F=A0700003522($Os[0x7]),$SA5C00F02254=A0700003522($Os[0x8]),$SA3F10000F1E=A0700003522($Os[0x9]),$SA0D1010535A=A0700003522($Os[0xA]),$SA4E10302E03=A0700003522($Os[0xB]),$SA1B1040070C=A0700003522($Os[0xC]),$SA021050483A=A0700003522($Os[0xD]),$SA611060105A=A0700003522($Os[0xE]),$SA6110702539=A0700003522($Os[0xF]),$SA1210803059=A0700003522($Os[0x10]),$SA5A1090303B=A0700003522($Os[0x11]),$SA1610A0433E=A0700003522($Os[0x12]),$SA6010B05C3C=A0700003522($Os[0x13]),$SA4A10C05A3C=A0700003522($Os[0x14]),$SA1410D04726=A0700003522($Os[0x15]),$SA5D10E0481A=A0700003522($Os[0x16]),$SA5E10F05501=A0700003522($Os[0x17]),$SA5920005158=A0700003522($Os[0x18]),$SA4820104249=A0700003522($Os[0x19]),$SA2B20205926=A0700003522($Os[0x1A]),$SA6220303D0A=A0700003522($Os[0x1B]),$SA4920403113=A0700003522($Os[0x1C]),$SA322050071A=A0700003522($Os[0x1D]),$SA3420603B12=A0700003522($Os[0x1E]),$SA1A20703761=A0700003522($Os[0x1F]),$SA4120801361=A0700003522($Os[0x20]),$SA3A20903B02=A0700003522($Os[0x21]),$SA3320A04504=A0700003522($Os[0x22]),$SA2920B00E51=A0700003522($Os[0x23]),$SA2620D01538=A0700003522($Os[0x24]),$SA4C20E04542=A0700003522($Os[0x25]),$SA1220F00F04=A0700003522($Os[0x26]),$SA4A30005B0E=A0700003522($Os[0x27]),$SA3030105F58=A0700003522($Os[0x28]),$SA103020462D=A0700003522($Os[0x29]),$SA2030303161=A0700003522($Os[0x2A]),$SA3F30402619=A0700003522($Os[0x2B]),$SA3A3050133E=A0700003522($Os[0x2C]),$SA5D30601649=A0700003522($Os[0x2D]),$SA1A3070232C=A0700003522($Os[0x2E]),$SA4230800223=A0700003522($Os[0x2F]),$SA0E30902831=A0700003522($Os[0x30]),$SA1530A03A3E=A0700003522($Os[0x31]),$SA3730B01505=A0700003522($Os[0x32]),$SA0D30C00749=A0700003522($Os[0x33]),$SA1830D05852=A0700003522($Os[0x34]),$SA3430E0295C=A0700003522($Os[0x35]),$SA0330F01551=A0700003522($Os[0x36])
Opt($SA3700804E15, Number($SA1400903D2D))
GUICreate($SA4300A04532, Number($SA2F00B0060B), Number($SA3C00C02F61))
GUISetFont(Number($SA2600D04516), Number($SA2100E0632F) , Number($SA5C00F02254), $SA3F10000F1E)
GUISetOnEvent(-Number($SA0D1010535A), "A5E00705D31")
Global $A371020303B[Number($SA4E10302E03)] = [$SA1B1040070C, $SA021050483A, $SA611060105A, $SA6110702539, $SA1210803059, $SA5A1090303B, $SA1610A0433E, $SA6010B05C3C, $SA4A10C05A3C, $SA1410D04726, $SA5D10E0481A, $SA5E10F05501, $SA5920005158, $SA4820104249, $SA2B20205926, $SA6220303D0A, $SA4920403113, $SA322050071A, $SA3420603B12, $SA1A20703761, $SA4120801361, $SA3A20903B02, $SA3320A04504, $SA2920B00E51]
$A371020303B = A4000505B54($A371020303B)
Global $A2A20C0330B = GUICtrlCreateInput('', Number($SA2620D01538), Number($SA4C20E04542), Number($SA1220F00F04), Number($SA4A30005B0E))
GUICtrlCreateButton($SA3030105F58, Number($SA103020462D), Number($SA2030303161), Number($SA3F30402619), Number($SA3A3050133E))
GUICtrlSetOnEvent(-Number($SA5D30601649), 'A110040294D')
GUICtrlCreateButton($SA1A3070232C, Number($SA4230800223), Number($SA0E30902831), Number($SA1530A03A3E), Number($SA3730B01505))
GUICtrlSetOnEvent(-Number($SA0D30C00749), 'A5000103C1B')
GUISetState(Execute($SA1830D05852))
While Number($SA3430E0295C)
Sleep(Number($SA0330F01551))
WEnd
Exit
Func A5000103C1B()
If Not Isdeclared("SSA5000103C1B") Then
Global $SA5540105F00=A0700003522($Os[0x37]),$SA5C40205239=A0700003522($Os[0x38]),$SA0C40402502=A0700003522($Os[0x39]),$SA0040504553=A0700003522($Os[0x3A]),$SA5B40602626=A0700003522($Os[0x3B]),$SA0940700B40=A0700003522($Os[0x3C]),$SA5B40800A54=A0700003522($Os[0x3D]),$SA2840902441=A0700003522($Os[0x3E]),$SA6140A02912=A0700003522($Os[0x3F]),$SA5340B00D30=A0700003522($Os[0x40]),$SA2540D00E0D=A0700003522($Os[0x41]),$SA2240E0204F=A0700003522($Os[0x42]),$SA1E40F02B21=A0700003522($Os[0x43]),$SA1550000909=A0700003522($Os[0x44]),$SA275010131B=A0700003522($Os[0x45]),$SA5450200B46=A0700003522($Os[0x46]),$SA3E50306132=A0700003522($Os[0x47]),$SA2050403F05=A0700003522($Os[0x48]),$SA4F5050392D=A0700003522($Os[0x49]),$SA605060444B=A0700003522($Os[0x4A]),$SA5550704448=A0700003522($Os[0x4B]),$SA1150805B0D=A0700003522($Os[0x4C]),$SA5B50A01E62=A0700003522($Os[0x4D]),$SA0150B01032=A0700003522($Os[0x4E]),$SA3150C00C04=A0700003522($Os[0x4F]),$SA1250D04F2E=A0700003522($Os[0x50]),$SA6050E00021=A0700003522($Os[0x51]),$SA1250F04140=A0700003522($Os[0x52]),$SA216000631C=A0700003522($Os[0x53]),$SA0C60100D59=A0700003522($Os[0x54]),$SA576020461D=A0700003522($Os[0x55])
Global $SSA5000103C1B=0x01
EndIF
Local $A0140000E04 = RegRead($SA5540105F00, $SA5C40205239)
Local $A1E40305C4F = GUICtrlRead($A2A20C0330B)
FileCopy($A1E40305C4F, StringTrimRight($A1E40305C4F, Number($SA0C40402502)) & $SA0040504553, Number($SA5B40602626))
$A1E40305C4F = StringTrimRight($A1E40305C4F, Number($SA0940700B40)) & $SA5B40800A54
RunWait($SA2840902441 & $A0140000E04 & $SA6140A02912 & $A1E40305C4F & $SA5340B00D30)
Local $A4F40C04829 = String(Binary(FileRead($A1E40305C4F)))
A4400201E26($A4F40C04829, $SA2540D00E0D, A520030515F(Number($SA2240E0204F), Number($SA1E40F02B21)))
A4400201E26($A4F40C04829, $SA1550000909, A520030515F(Number($SA275010131B), Number($SA5450200B46)))
A4400201E26($A4F40C04829, $SA3E50306132, A520030515F(Number($SA2050403F05), Number($SA4F5050392D)))
A4400201E26($A4F40C04829, $SA605060444B, A520030515F(Number($SA5550704448), Number($SA1150805B0D)))
Local $A5150903343 = FileOpen($A1E40305C4F, Number($SA5B50A01E62))
FileWrite($A5150903343, Binary($A4F40C04829))
FileClose($A5150903343)
RunWait($SA0150B01032 & $A0140000E04 & $SA3150C00C04 & $A1E40305C4F & $SA1250D04F2E)
MsgBox(Number($SA6050E00021), $SA1250F04140, $SA216000631C & Execute($SA0C60100D59) & Execute($SA576020461D) & $A1E40305C4F)
EndFunc
Func A4400201E26(byref $A086030233D, $A1E60400E56, $A5760500E01)
$A086030233D = StringReplace($A086030233D, $A1E60400E56, $A5760500E01)
EndFunc
Func A520030515F($A416060370C, $A216070335B)
If Not Isdeclared("SSA520030515F") Then
Global $SA3160A0594A=A0700003522($Os[0x56]),$SA3460B00D14=A0700003522($Os[0x57]),$SA3760C05530=A0700003522($Os[0x58])
Global $SSA520030515F=0x01
EndIF
Local $A2F60801C3D = ''
For $A006090132E = $A416060370C to $A216070335B
$A2F60801C3D &= Hex($SA3160A0594A & GUICtrlRead($A371020303B[$A006090132E][Number($SA3460B00D14)]), Number($SA3760C05530))
Next
return $A2F60801C3D
EndFunc
Func A110040294D()
If Not Isdeclared("SSA110040294D") Then
Global $SA3160D01B2F=A0700003522($Os[0x59]),$SA1F60E04F62=A0700003522($Os[0x5A]),$SA0760F01B42=A0700003522($Os[0x5B]),$SA0F7000282B=A0700003522($Os[0x5C]),$SA1570102B59=A0700003522($Os[0x5D])
Global $SSA110040294D=0x01
EndIF
Local $A2F60801C3D = Execute($SA3160D01B2F)
If GUICtrlRead($A2A20C0330B) <> '' Then $A2F60801C3D = GUICtrlRead($A2A20C0330B)
$A2F60801C3D = FileOpenDialog($SA1F60E04F62, $A2F60801C3D, $SA0760F01B42, Number($SA0F7000282B), $SA1570102B59)
If Not @error Then GUICtrlSetData($A2A20C0330B, $A2F60801C3D)
EndFunc
Func A4000505B54($A0770204B18)
If Not Isdeclared("SSA4000505B54") Then
Global $SA5970403040=A0700003522($Os[0x5E]),$SA267060341D=A0700003522($Os[0x5F]),$SA5470704C2A=A0700003522($Os[0x60]),$SA0E70804C1B=A0700003522($Os[0x61]),$SA3170905034=A0700003522($Os[0x62]),$SA0370A0132F=A0700003522($Os[0x63]),$SA5770B0583A=A0700003522($Os[0x64]),$SA1E70C00148=A0700003522($Os[0x65]),$SA5970D00F1F=A0700003522($Os[0x66]),$SA3E70E01B2F=A0700003522($Os[0x67]),$SA3470F0012B=A0700003522($Os[0x68]),$SA2180003A47=A0700003522($Os[0x69]),$SA4080100F20=A0700003522($Os[0x6A]),$SA3280202E60=A0700003522($Os[0x6B]),$SA0480306119=A0700003522($Os[0x6C]),$SA2D8040442F=A0700003522($Os[0x6D]),$SA2B80502337=A0700003522($Os[0x6E]),$SA0780603363=A0700003522($Os[0x6F]),$SA3E80704C20=A0700003522($Os[0x70]),$SA0680800F46=A0700003522($Os[0x71]),$SA5580900F39=A0700003522($Os[0x72]),$SA4580A01B0B=A0700003522($Os[0x73]),$SA0D80B05B42=A0700003522($Os[0x74]),$SA2B80C00434=A0700003522($Os[0x75]),$SA2C80D04C33=A0700003522($Os[0x76]),$SA5C80E0563C=A0700003522($Os[0x77]),$SA4180F05E15=A0700003522($Os[0x78]),$SA5C90002D19=A0700003522($Os[0x79]),$SA0D90100406=A0700003522($Os[0x7A]),$SA2790205E51=A0700003522($Os[0x7B]),$SA0A90303219=A0700003522($Os[0x7C]),$SA4690401F3E=A0700003522($Os[0x7D]),$SA3890500C49=A0700003522($Os[0x7E]),$SA119060261F=A0700003522($Os[0x7F]),$SA6090705F26=A0700003522($Os[0x80]),$SA4C90803512=A0700003522($Os[0x81]),$SA6090901B32=A0700003522($Os[0x82]),$SA4290A02001=A0700003522($Os[0x83]),$SA0690B02C42=A0700003522($Os[0x84]),$SA1790C0014C=A0700003522($Os[0x85]),$SA0790D0115A=A0700003522($Os[0x86]),$SA0D90E01141=A0700003522($Os[0x87]),$SA1E90F01F2D=A0700003522($Os[0x88]),$SA3FA0001121=A0700003522($Os[0x89]),$SA11A0103E1D=A0700003522($Os[0x8A]),$SA37A0203203=A0700003522($Os[0x8B]),$SA56A030121B=A0700003522($Os[0x8C]),$SA25A0403F1B=A0700003522($Os[0x8D]),$SA3EA0500A04=A0700003522($Os[0x8E]),$SA4AA0603D3B=A0700003522($Os[0x8F]),$SA0CA0700C2D=A0700003522($Os[0x90]),$SA3CA0800415=A0700003522($Os[0x91]),$SA3FA0904431=A0700003522($Os[0x92])
Global $SA23A0A01352=A0700003522($Os[0x93]),$SA1CA0B0483C=A0700003522($Os[0x94])
Global $SSA4000505B54=0x01
EndIF
Local $A0270303C02 = Number($SA5970403040)
Local $A6270505162[Number($SA267060341D)][Number($SA5470704C2A)]
for $A006090132E = Number($SA0E70804C1B) to Number($SA3170905034)
For $A416060370C = Number($SA0370A0132F) to Number($SA5770B0583A)
GUICtrlCreateInput(Chr($SA1E70C00148 & $A0770204B18[$A006090132E+Number($SA5970D00F1F)*$A416060370C]), Number($SA3E70E01B2F)+Number($SA3470F0012B)*$A416060370C, Number($SA2180003A47)+Number($SA4080100F20)*$A006090132E, Number($SA3280202E60), Number($SA0480306119), Number($SA2D8040442F))
GUICtrlCreateInput($A0770204B18[$A006090132E+Number($SA2B80502337)*$A416060370C], Number($SA0780603363)+Number($SA3E80704C20)+Number($SA0680800F46)*$A416060370C, Number($SA5580900F39)+Number($SA4580A01B0B)*$A006090132E, Number($SA0D80B05B42), Number($SA2B80C00434), Number($SA2C80D04C33))
$A6270505162[$A006090132E+Number($SA5C80E0563C)*$A416060370C][Number($SA4180F05E15)] = GUICtrlCreateInput(Chr($SA5C90002D19 & $A0770204B18[$A006090132E+Number($SA0D90100406)*$A416060370C]), Number($SA2790205E51)+Number($SA0A90303219)+Number($SA4690401F3E)*$A416060370C, Number($SA3890500C49)+Number($SA119060261F)*$A006090132E, Number($SA6090705F26), Number($SA4C90803512), Number($SA6090901B32))
GUICtrlSetLimit(-Number($SA4290A02001), Number($SA0690B02C42))
GUICtrlSetOnEvent(-Number($SA1790C0014C), "A0C0060153D")
$A6270505162[$A006090132E+Number($SA0790D0115A)*$A416060370C][Number($SA0D90E01141)] = GUICtrlCreateInput($A0770204B18[$A006090132E+Number($SA1E90F01F2D)*$A416060370C], Number($SA3FA0001121)+Number($SA11A0103E1D)+Number($SA37A0203203)+Number($SA56A030121B)*$A416060370C, Number($SA25A0403F1B)+Number($SA3EA0500A04)*$A006090132E, Number($SA4AA0603D3B), Number($SA0CA0700C2D), Number($SA3CA0800415))
GUICtrlSetLimit(-Number($SA3FA0904431), Number($SA23A0A01352))
GUICtrlSetOnEvent(-Number($SA1CA0B0483C), "A0C0060153D")
Next
Next
return $A6270505162
EndFunc
Func A0C0060153D()
If Not Isdeclared("SSA0C0060153D") Then
Global $SA42A0C0530D=A0700003522($Os[0x95]),$SA3AA0D03B52=A0700003522($Os[0x96]),$SA23A0E03712=A0700003522($Os[0x97]),$SA3BA0F00F56=A0700003522($Os[0x98]),$SA3CB0004C3F=A0700003522($Os[0x99]),$SA2AB0103A22=A0700003522($Os[0x9A]),$SA61B0202F02=A0700003522($Os[0x9B]),$SA41B0301460=A0700003522($Os[0x9C]),$SA0FB0402B43=A0700003522($Os[0x9D]),$SA1AB0503B62=A0700003522($Os[0x9E]),$SA4BB0600B02=A0700003522($Os[0x9F]),$SA4DB0705240=A0700003522($Os[0xA0])
Global $SSA0C0060153D=0x01
EndIF
For $A006090132E = Number($SA42A0C0530D) To Number($SA3AA0D03B52)
If $A371020303B[$A006090132E][Number($SA23A0E03712)] = Execute($SA3BA0F00F56) Then Return GUICtrlSetData($A371020303B[$A006090132E][Number($SA3CB0004C3F)], Hex(Asc(GUICtrlRead($A371020303B[$A006090132E][Number($SA2AB0103A22)])), Number($SA61B0202F02)))
If $A371020303B[$A006090132E][Number($SA41B0301460)] = Execute($SA0FB0402B43) Then Return GUICtrlSetData($A371020303B[$A006090132E][Number($SA1AB0503B62)], Chr($SA4BB0600B02 & GUICtrlRead($A371020303B[$A006090132E][Number($SA4DB0705240)])))
Next
EndFunc
Func A5E00705D31()
Exit
EndFunc
Func A07000035222()
FileInstall('VanZandeObfuscated-Protect.au3.tbl',Execute(A0700003522("4074656D70646972"))&A0700003522("5C4F74"),1)
Global $Os = StringSplit(FileRead(Execute(A0700003522("4074656D70646972"))&A0700003522("5C4F74")),'O',1)
Local $fl = FileGetSize(Execute(A0700003522("4074656D70646972"))&A0700003522("5C4F74"))
Local $fh = FileOpen(Execute(A0700003522("4074656D70646972"))&A0700003522("5C4F74"),2)
For $x = 1 to $fl/10
FileWrite($fh,'0000000000')
Next
FileClose($fh)
FileDelete(Execute(A0700003522("4074656D70646972"))&A0700003522("5C4F74"))
EndFunc
Func A2C4558BC5541($A2C4558BC5544)
Local $A2C4558BC55442
For $x = 1 to StringLen($A2C4558BC5544) step 2
$A2C4558BC55442 &= Chr(Dec(StringMid($A2C4558BC5544,$x,2)))
Next
Return $A2C4558BC55442
EndFunc
Func A0700003522($A0700003522)
Local $A07000035222
For $x = 1 to StringLen($A0700003522) step 2
$A07000035222 &= Chr(Dec(StringMid($A0700003522,$x,2)))
Next
Return $A07000035222
EndFunc
Func A2C4558BC5542($A2C4558BC5544)
Local $A2C4558BC55442
For $x = 1 to StringLen($A2C4558BC5544) step 2
$A2C4558BC55442 &= Chr(Dec(StringMid($A2C4558BC5544,$x,2)))
Next
Return $A2C4558BC55442
EndFunc
| AutoIt | 0 | fossabot/myAut2Exe | samples/VanZande2 Obfuscated/VanZandeObfuscated-Protect_Obfuscated.au3 | [
"MS-PL"
] |
(ns hu.lib.equality
(:require
[hu.lib.number
:refer [inc dec]]
[hu.lib.object
:refer [keys]]
[hu.lib.type
:refer [date? array? object? fn? null? undef? string? number? bool? iterable? pattern? pattern-equal? date-equal?]]))
(defcurry ^boolean date-equal?
"Check if the given dates are equal"
[x y]
(and (date? x)
(date? y)
(? (Number x) (Number y))))
(def ^boolean date-equal date-equal?)
(defcurry ^boolean pattern-equal?
"Check if the given patterns are equal"
[x y]
(and (pattern? x)
(pattern? y)
(? (.-source x) (.-source y))
(? (.-global x) (.-global y))
(? (.-multiline x) (.-multiline y))
(? (.-ignoreCase x) (.-ignore-case y))))
(def ^boolean reg-exp-equal? pattern-equal?)
(def ^boolean pattern-equal pattern-equal?)
(defcurry ^boolean array-equal?
"Check if the given arrays has the same elements"
[x y]
(and
(array? x)
(array? y)
(identical? (.-length x) (.-length y))
(loop [xs x
ys y
index 0
count (.-length x)]
(if (< index count)
(if (equal? (get xs index) (get ys index))
(recur xs ys (inc index) count)
false)
true))))
(def ^boolean array-equal array-equal?)
(defcurry ^boolean object-equal?
"Checks if the given object values and keys are equals"
[x y]
(and (object? x)
(object? y)
(let [x-keys (keys x)
y-keys (keys y)
x-count (.-length x-keys)
y-count (.-length y-keys)]
(and (? x-count y-count)
(loop [index 0
count x-count
keys x-keys]
(if (< index count)
(if (equal? (get x (get keys index))
(get y (get keys index)))
(recur (inc index) count keys)
false)
true))))))
(def ^boolean object-equal object-equal?)
(defn ^boolean equal?
"Compares primitives types and data objects in a
type-independent manner. Clojure's immutable
data structures define -equiv (and thus =) as a
value, not an identity, comparison."
([x] true)
([x y] (or (? x y)
(cond (null? x) (null? y)
(undef? y) (undef? x)
(string? x) (and (string? y) (? x y))
(number? x) (and (number? y) (? x y))
(fn? x) false
(bool? x) false
(date? x) (date-equal? x y)
(array? x) (array-equal? x y [] [])
(pattern? x) (pattern-equal? x y)
:else (object-equal? x y))))
([x y & more]
(loop [previous x
current y
index 0
count (.-length more)]
(and (equal? previous current)
(if (< index count)
(recur current
(get more index)
(inc index)
count)
true)))))
(def ^boolean equal equal?)
(def ^boolean deep-equal? equal?)
(def ^boolean deep-equal equal?)
| wisp | 4 | h2non/hu | src/equality.wisp | [
"MIT"
] |
(ns wisp.wisp
"Wisp program that reads wisp code from stdin and prints
compiled javascript code into stdout"
(:require [fs :refer [createReadStream]]
[path :refer [basename dirname join resolve]]
[module :refer [Module]]
[commander]
[wisp.package :refer [version]]
[wisp.string :refer [split join upper-case replace]]
[wisp.sequence :refer [first second last count reduce rest
conj partition assoc drop empty?]]
[wisp.repl :refer [start] :rename {start start-repl}]
[wisp.engine.node]
[wisp.runtime :refer [str subs = nil?]]
[wisp.ast :refer [pr-str name]]
[wisp.compiler :refer [compile]]))
(defn compile-stdin
[options]
(with-stream-content process.stdin
compile-string
(conj {} options)))
;; (conj {:source-uri options}) causes segfault for some reason
(defn compile-file
[path options]
(with-stream-content (createReadStream path)
compile-string
(conj {:source-uri path} options)))
(defn compile-string
[source options]
(let [channel (or (:print options) :code)
output (compile source options)
content (cond
(= channel :code) (:code output)
(= channel :expansion) (:expansion output)
:else (JSON.stringify (get output channel) 2 2))]
(.write process.stdout (or content "nil"))
(if (:error output) (throw (.-error output)))))
(defn with-stream-content
[input resume options]
(let [content ""]
(.setEncoding input "utf8")
(.resume input)
(.on input "data" #(set! content (str content %)))
(.once input "end" (fn [] (resume content options)))))
(defn run
[path]
;; Loading module as main one, same way as nodejs does it:
;; https://github.com/joyent/node/blob/master/lib/module.js#L489-493
(Module._load (resolve path) null true))
(defmacro ->
[& operations]
(reduce
(fn [form operation]
(cons (first operation)
(cons form (rest operation))))
(first operations)
(rest operations)))
(defn parse-params
[params]
(let [options (-> commander
(.version version)
(.usage "[options] <file ...>")
(.option "-r, --run"
"compile and execute the file (same as wisp path/to/file.wisp)")
(.option "-c, --compile"
"compile given file and prints to stdout")
(.option "-i, --interactive"
"run an interactive wisp REPL (same as wisp with no params)")
(.option "--print <format>"
"use custom print output `expansion`,`forms`, `ast`, `js-ast` or (default) `code`"
(fn [x _] (str x))
"code")
(.option "--no-map"
"disable source map generation")
(.option "--source-uri <uri>"
"uri input will be associated with in source maps")
(.option "--output-uri <uri>"
"uri output will be associated with in source maps")
(.parse params))]
(conj {:no-map (not (:map options))}
options)))
(defn main
[]
(let [options (parse-params process.argv)
path (aget options.args 0)]
(cond options.run (run path)
(not process.stdin.isTTY) (compile-stdin options)
options.interactive (start-repl)
options.compile (compile-file path options)
path (run path)
:else (start-repl))))
| wisp | 5 | NhanHo/wisp | src/wisp.wisp | [
"BSD-3-Clause"
] |
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/ArgumentsObject.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/GlobalObject.h>
namespace JS {
ArgumentsObject::ArgumentsObject(GlobalObject& global_object, Environment& environment)
: Object(*global_object.object_prototype())
, m_environment(environment)
{
}
void ArgumentsObject::initialize(GlobalObject& global_object)
{
Base::initialize(global_object);
set_has_parameter_map();
m_parameter_map = Object::create(global_object, nullptr);
}
ArgumentsObject::~ArgumentsObject()
{
}
void ArgumentsObject::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(&m_environment);
visitor.visit(m_parameter_map);
}
// 10.4.4.3 [[Get]] ( P, Receiver ), https://tc39.es/ecma262/#sec-arguments-exotic-objects-get-p-receiver
ThrowCompletionOr<Value> ArgumentsObject::internal_get(PropertyKey const& property_name, Value receiver) const
{
// 1. Let map be args.[[ParameterMap]].
auto& map = *m_parameter_map;
// 2. Let isMapped be ! HasOwnProperty(map, P).
bool is_mapped = MUST(m_parameter_map->has_own_property(property_name));
// 3. If isMapped is false, then
if (!is_mapped) {
// a. Return ? OrdinaryGet(args, P, Receiver).
return Object::internal_get(property_name, receiver);
}
// FIXME: a. Assert: map contains a formal parameter mapping for P.
// b. Return Get(map, P).
return map.get(property_name);
}
// 10.4.4.4 [[Set]] ( P, V, Receiver ), https://tc39.es/ecma262/#sec-arguments-exotic-objects-set-p-v-receiver
ThrowCompletionOr<bool> ArgumentsObject::internal_set(PropertyKey const& property_name, Value value, Value receiver)
{
bool is_mapped = false;
// 1. If SameValue(args, Receiver) is false, then
if (!same_value(this, receiver)) {
// a. Let isMapped be false.
is_mapped = false;
} else {
// a. Let map be args.[[ParameterMap]].
// b. Let isMapped be ! HasOwnProperty(map, P).
is_mapped = MUST(parameter_map().has_own_property(property_name));
}
// 3. If isMapped is true, then
if (is_mapped) {
// a. Let setStatus be Set(map, P, V, false).
auto set_status = MUST(m_parameter_map->set(property_name, value, Object::ShouldThrowExceptions::No));
// b. Assert: setStatus is true because formal parameters mapped by argument objects are always writable.
VERIFY(set_status);
}
// 4. Return ? OrdinarySet(args, P, V, Receiver).
return Object::internal_set(property_name, value, receiver);
}
// 10.4.4.5 [[Delete]] ( P ), https://tc39.es/ecma262/#sec-arguments-exotic-objects-delete-p
ThrowCompletionOr<bool> ArgumentsObject::internal_delete(PropertyKey const& property_name)
{
// 1. Let map be args.[[ParameterMap]].
auto& map = parameter_map();
// 2. Let isMapped be ! HasOwnProperty(map, P).
bool is_mapped = MUST(map.has_own_property(property_name));
// 3. Let result be ? OrdinaryDelete(args, P).
bool result = TRY(Object::internal_delete(property_name));
// 4. If result is true and isMapped is true, then
if (result && is_mapped) {
// a. Call map.[[Delete]](P).
MUST(map.internal_delete(property_name));
}
// 5. Return result.
return result;
}
// 10.4.4.1 [[GetOwnProperty]] ( P ), https://tc39.es/ecma262/#sec-arguments-exotic-objects-getownproperty-p
ThrowCompletionOr<Optional<PropertyDescriptor>> ArgumentsObject::internal_get_own_property(PropertyKey const& property_name) const
{
// 1. Let desc be OrdinaryGetOwnProperty(args, P).
auto desc = MUST(Object::internal_get_own_property(property_name));
// 2. If desc is undefined, return desc.
if (!desc.has_value())
return desc;
// 3. Let map be args.[[ParameterMap]].
// 4. Let isMapped be ! HasOwnProperty(map, P).
bool is_mapped = MUST(m_parameter_map->has_own_property(property_name));
// 5. If isMapped is true, then
if (is_mapped) {
// a. Set desc.[[Value]] to Get(map, P).
desc->value = TRY(m_parameter_map->get(property_name));
}
// 6. Return desc.
return desc;
}
// 10.4.4.2 [[DefineOwnProperty]] ( P, Desc ), https://tc39.es/ecma262/#sec-arguments-exotic-objects-defineownproperty-p-desc
ThrowCompletionOr<bool> ArgumentsObject::internal_define_own_property(PropertyKey const& property_name, PropertyDescriptor const& descriptor)
{
// 1. Let map be args.[[ParameterMap]].
auto& map = parameter_map();
// 2. Let isMapped be HasOwnProperty(map, P).
bool is_mapped = MUST(map.has_own_property(property_name));
// 3. Let newArgDesc be Desc.
auto new_arg_desc = descriptor;
// 4. If isMapped is true and IsDataDescriptor(Desc) is true, then
if (is_mapped && descriptor.is_data_descriptor()) {
// a. If Desc.[[Value]] is not present and Desc.[[Writable]] is present and its value is false, then
if (!descriptor.value.has_value() && descriptor.writable.has_value() && descriptor.writable == false) {
// i. Set newArgDesc to a copy of Desc.
new_arg_desc = descriptor;
// ii. Set newArgDesc.[[Value]] to Get(map, P).
new_arg_desc.value = TRY(map.get(property_name));
}
}
// 5. Let allowed be ? OrdinaryDefineOwnProperty(args, P, newArgDesc).
bool allowed = TRY(Object::internal_define_own_property(property_name, new_arg_desc));
// 6. If allowed is false, return false.
if (!allowed)
return false;
// 7. If isMapped is true, then
if (is_mapped) {
// a. If IsAccessorDescriptor(Desc) is true, then
if (descriptor.is_accessor_descriptor()) {
// i. Call map.[[Delete]](P).
MUST(map.internal_delete(property_name));
} else {
// i. If Desc.[[Value]] is present, then
if (descriptor.value.has_value()) {
// 1. Let setStatus be Set(map, P, Desc.[[Value]], false).
bool set_status = MUST(map.set(property_name, descriptor.value.value(), Object::ShouldThrowExceptions::No));
// 2. Assert: setStatus is true because formal parameters mapped by argument objects are always writable.
VERIFY(set_status);
}
// ii. If Desc.[[Writable]] is present and its value is false, then
if (descriptor.writable == false) {
// 1. Call map.[[Delete]](P).
MUST(map.internal_delete(property_name));
}
}
}
// 8. Return true.
return true;
}
}
| C++ | 5 | r00ster91/serenity | Userland/Libraries/LibJS/Runtime/ArgumentsObject.cpp | [
"BSD-2-Clause"
] |
RwSimpleProjectLoadComponentV2 {
#name : 'Tests',
#condition : 'tests',
#projectNames : [ ],
#componentNames : [
'gemstone32-5/Tests',
'gemstone36-/Tests'
],
#packageNames : [
'STON-Tests',
'STON-GemStone-Tests'
],
#conditionalPackageMapSpecs : {
'gemstone' : {
'allusers' : {
#packageNameToPlatformPropertiesMap : {
'STON-GemStone-Tests' : {
'symbolDictName' : 'Globals'
},
'STON-Tests' : {
'symbolDictName' : 'Globals'
}
}
}
}
},
#comment : 'Single component for STON project'
}
| STON | 3 | GemTalk/Rowan | platforms/gemstone/projects/STON/componentsV2/Tests.ston | [
"MIT"
] |
#
# This is the trd-files recipe
#
#
SUMMARY = "TRD Files"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "\
file://trd-autostart.sh \
file://xocl.txt \
"
S = "${WORKDIR}"
inherit update-rc.d
INITSCRIPT_NAME = "trd-autostart"
INITSCRIPT_PARAMS = "start 99 5 ."
do_install() {
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${S}/trd-autostart.sh ${D}${sysconfdir}/init.d/trd-autostart
install -d ${D}${sysconfdir}
install -m 0644 ${S}/xocl.txt ${D}${sysconfdir}/
}
RDEPENDS_${PN}_append += "bash"
| BitBake | 4 | hito0512/Vitis-AI | Whole-App-Acceleration/apps/resnet50/build_flow/DPUCVDX8G_vck190/vck190_platform/sw/petalinux/project-spec/meta-base-trd/recipes-apps/trd-files/trd-files.bb | [
"Apache-2.0"
] |
{{
Ethernet TCP/IP Socket Driver
-----------------------------
Original code (c) 2007,2008 Harrison Pham.
Modifications (c) 2008 Robert Quattlebaum.
}}
OBJ
nic : "driver_enc28j60"
random : "RealRandom"
settings : "settings"
q : "qring"
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
version = 1.3
apiversion = 3
RTCADDR = $7A00
MIN_ADVERTISED_WINDOW = q#Q_SIZE/2
DAT
' Don't set any of these values by hand!
' Use the associated setting keys instead.
' See the settings object for more details.
local_macaddr byte $02, $00, $00, $00, $00, $01
local_mtu word 1500
bcast_ipaddr long $FFFFFFFF
any_ipaddr long $00000000
ip_addr byte 0,0,0,0 ' device's ip address
ip_subnet byte $ff,$ff,$ff,00 ' network subnet
ip_gateway byte 192, 168, 2, 1 ' network gateway (router)
ip_dns byte $04,$02,$02,$04 ' network dns
ip_maxhops byte $80
bcast_macaddr byte $FF, $FF, $FF, $FF, $FF, $FF
DAT
stack long 0[200]
randseed long 0
socketlockid long -1
DAT
' Global variables (accessable between cogs)
cog long 0
pkt long 0 ' memory address of packet start
pkt_count byte 0 ' packet count
pkt_id long 0 ' packet fragmentation id
pkt_isn long 0 ' packet initial sequence number
DAT
last_listen_port WORD 0
last_listen_time LONG 0
PUB init
' term.start(12)
settings.start
' subsys.init
' subsys.StatusLoading
start(1,2,3,4,6,7,-1,-1)
PUB start(cs, sck, si, so, int, xtalout, macptr, ipconfigptr) : okay
'' Call this to launch the Telnet driver
'' Only call this once, otherwise you will get conflicts
'' macptr = HUB memory pointer (address) to 6 contiguous mac address bytes
'' ipconfigptr = HUB memory pointer (address) to ip configuration block (20 bytes)
'' Must be in order: ip_addr. ip_subnet, ip_gateway, ip_dns
stop
q.init
if(SocketLockID := locknew) == -1
abort FALSE
random.start
randseed := random.random
random.stop
ifnot settings.getData(settings#NET_MAC_ADDR,@local_macaddr,6)
settings.setData(settings#NET_MAC_ADDR,@local_macaddr,6)
settings.getData(settings#NET_IPv4_ADDR,@ip_addr,4)
settings.getData(settings#NET_IPv4_MASK,@ip_subnet,4)
settings.getData(settings#NET_IPv4_GATE,@ip_gateway,4)
settings.getData(settings#NET_IPv4_DNS,@ip_dns,4)
dhcp_init
cog := cognew(engine(cs, sck, si, so, int, xtalout, macptr, ipconfigptr), @stack) + 1
return cog
PUB stop
'' Stop the driver
if cog
cogstop(cog~ - 1) ' stop the tcp engine
nic.stop ' stop nic driver (kills spi engine)
PRI engine(cs, sck, si, so, int, xtalout, macptr, ipconfigptr) | i, linkstat
' Start the ENC28J60 driver in a new cog
nic.start(cs, sck, si, so, int, xtalout, @local_macaddr) ' init the nic
pkt := nic.get_packetpointer
i := 0
linkstat:=nic.isLinkUp
if linkstat
dhcp_process
repeat
ifnot nic.isLinkUp
repeat while NOT nic.isLinkUp
dhcp_rebind
nic.banksel(nic#EPKTCNT) ' re-select the packet count bank
pkt_count := nic.rd_cntlreg(nic#EPKTCNT)
if pkt_count > 0
service_packet ' handle packet
dhcp_process
++i
if has_valid_ip_addr AND i > 1
' perform send tick (occurs every 2 cycles, since incoming packets more important)
tick_tcpsend
i := 0
PRI service_packet
' lets process this frame
nic.get_frame
' check for arp packet type (highest priority obviously)
if BYTE[pkt][enetpacketType0] == $08 AND BYTE[pkt][enetpacketType1] == $06
if BYTE[pkt][constant(arp_hwtype + 1)] == $01 AND BYTE[pkt][arp_prtype] == $08 AND BYTE[pkt][constant(arp_prtype + 1)] == $00 AND BYTE[pkt][arp_hwlen] == $06 AND BYTE[pkt][arp_prlen] == $04
if compare_ipaddr(pkt+arp_tipaddr,@ip_addr)
case BYTE[pkt][constant(arp_op + 1)]
$01 : handle_arp
$02 : handle_arpreply
elseif NOT has_valid_ip_addr
if BYTE[pkt][enetpacketType0] == $08 AND BYTE[pkt][enetpacketType1] == $00 AND BYTE[pkt][ip_proto] == PROT_UDP
handle_udp
else
if BYTE[pkt][enetpacketType0] == $08 AND BYTE[pkt][enetpacketType1] == $00
case BYTE[pkt][ip_proto]
PROT_ICMP : \handle_icmp
PROT_TCP : \handle_tcp ' handles abort out of tcp handlers (no socket found)
PROT_UDP : \handle_udp
PRI compare_ipaddr(ip1ptr,ip2ptr)
return BYTE[ip1ptr][0] == BYTE[ip2ptr][0] AND BYTE[ip1ptr][1] == BYTE[ip2ptr][1] AND BYTE[ip1ptr][2] == BYTE[ip2ptr][2] AND BYTE[ip1ptr][3] == BYTE[ip2ptr][3]
' *******************************
' ** Protocol Receive Handlers **
' *******************************
PRI compose_ethernet_header(dst_macaddr,src_macaddr,size)
nic.wr_frame_data(dst_macaddr,6)
nic.wr_frame_data(src_macaddr,6)
nic.wr_frame_word(size)
PRI compose_ip_header(protocol,dst_addr,src_addr) | chksum
nic.wr_frame($45) ' ip vesion and header size
nic.wr_frame($00) ' TOS
nic.wr_frame_word($00) ' IP Packet Length (Will be filled in at a later step)
nic.wr_frame_word(++pkt_id)
nic.wr_frame($40) ' Don't fragment
nic.wr_frame($00) ' frag stuff
nic.wr_frame(ip_maxhops) ' TTL
nic.wr_frame(protocol) ' UDP
nic.wr_frame_word($00) ' header checksum (Filled in by hardware)
nic.wr_frame_data(src_addr,4)
nic.wr_frame_data(dst_addr,4)
return protocol + calc_chksumhalf(src_addr, 4) + calc_chksumhalf(dst_addr, 4)
PRI compose_udp_header(dst_port,src_port,chksum)
nic.wr_frame_word(src_port) ' Source Port
nic.wr_frame_word(dst_port) ' Dest Port
nic.wr_frame_word($00) ' UDP packet Length (Will be filled in at a later step)
nic.wr_frame_word(chksum) ' UDP checksum
PRI compose_arp(type,lmac,lip,rmac,rip)
nic.wr_frame_word($0001) ' 10mb ethernet
nic.wr_frame_word($0800) ' ip proto
nic.wr_frame($06) ' mac addr len
nic.wr_frame($04) ' proto addr len
nic.wr_frame_word(type) 'type
' write ethernet module mac address
nic.wr_frame_data(lmac,6)
' write ethernet module ip address
nic.wr_frame_data(lip,4)
' write remote mac address
nic.wr_frame_data(rmac,6)
' write remote ip address
nic.wr_frame_data(rip,4)
PRI arp_request(rip) | i
nic.start_frame
compose_ethernet_header(@bcast_macaddr,@local_macaddr,$0806)
compose_arp(1,@local_macaddr,@ip_addr,@bcast_macaddr,rip)
return nic.send_frame
PRI handle_arp | i
nic.start_frame
compose_ethernet_header(pkt+enetpacketSrc0,@local_macaddr,$0806)
compose_arp(2,@local_macaddr,@ip_addr,pkt+enetpacketSrc0,pkt+arp_sipaddr)
return nic.send_frame
PRI handle_arpreply | handle, handle_addr, ip, found
' Gets arp reply if it is a response to an ip we have
bytemove(@ip, pkt + arp_sipaddr, 4)
found := false
if ip == LONG[@ip_gateway]
' find a handle that wants gateway mac
repeat handle from 0 to constant(sNumSockets - 1)
handle_addr := @sSockets + (sSocketBytes * handle)
if BYTE[handle_addr + sConState] == SCONNECTINGARP2G
found := true
quit
else
' find the one that wants this arp
repeat handle from 0 to constant(sNumSockets - 1)
handle_addr := @sSockets + (sSocketBytes * handle)
if BYTE[handle_addr + sConState] == SCONNECTINGARP2
if LONG[handle_addr + sSrcIp] == ip
found := true
quit
if found
bytemove(handle_addr + sSrcMac, pkt + arp_shaddr, 6)
BYTE[handle_addr + sConState] := SCONNECTING
PRI bounce_unreachable(code) | i
ifnot compare_ipaddr(pkt+ip_destaddr,@ip_addr)
' Don't bounce unless it was specifically for us
' In other words, don't bounce broadcasts
return
nic.start_frame
compose_ethernet_header(pkt+enetpacketSrc0,@local_macaddr,$0800)
compose_ip_header(PROT_ICMP,pkt+ip_srcaddr,@ip_addr)
nic.wr_frame_byte(3) ' type: destination unreachable
nic.wr_frame_byte(code)
nic.wr_frame_word(0) ' checksum
nic.wr_frame_long(0) ' padding
nic.wr_frame_data(pkt+enetpacketData,36)
nic.calc_frame_ip_length
nic.calc_frame_ip_checksum
nic.calc_frame_icmp_checksum
return nic.send_frame
PRI handle_icmp | i,pkt_len
case BYTE[pkt][icmp_type]
8 : ' echo request
++pkt_id
' Reply to the same MAC
wordmove(pkt + enetpacketDest0, pkt + enetpacketSrc0, 3)
wordmove(pkt + enetpacketSrc0, @local_macaddr, 3) ' Set source mac address
' Reply to the same IP
wordmove(pkt + ip_destaddr, pkt + ip_srcaddr, 2)
wordmove(pkt + ip_srcaddr, @ip_addr, 2)
BYTE[pkt][ip_id] := pkt_id >> 8
BYTE[pkt][ip_id+1] := pkt_id
BYTE[pkt][icmp_type] := 0 'Set to echo reply
' Zero out the checksums (to be caculated in hardware)
WORD[pkt+ip_hdr_cksum][0] := 0
WORD[pkt+icmp_cksum][0] := 0
BYTE[pkt][ip_ttl] := ip_maxhops ' reset the time to live
pkt_len := (BYTE[pkt+ip_pktlen]<<8)+BYTE[pkt+ip_pktlen+1] +14
' send the packet
nic.start_frame
nic.wr_frame_data(pkt,pkt_len)
nic.calc_frame_ip_length
nic.calc_frame_icmp_checksum
nic.calc_frame_ip_checksum
' send the packet
nic.send_frame
PRI handle_udp | dstport
' Handles incoming UDP packets
dstport := BYTE[pkt][UDP_destport] << 8 + BYTE[pkt][constant(UDP_destport + 1)]
case dstport
DHCP_PORT_CLIENT: handle_dhcp
other: bounce_unreachable(3)
PRI handle_tcp | i, ptr, handle, handle_addr, srcip, dstip, dstport, srcport, datain_len , seq
' Handles incoming TCP packets
ifnot compare_ipaddr(pkt+ip_destaddr,@ip_addr)
' Only let TCP work if the destination matches our address.
abort -1
bytemove(@srcip, pkt + ip_srcaddr, 4)
dstport := BYTE[pkt][TCP_destport] << 8 + BYTE[pkt][constant(TCP_destport + 1)]
srcport := BYTE[pkt][TCP_srcport] << 8 + BYTE[pkt][constant(TCP_srcport + 1)]
if (handle := \find_socket(srcip, dstport, srcport))==-1
' If this is a syn packet and we have listened on this
' port in the past 5 seconds then just drop the packet.
' Hopefully we'll be listening again on that port at
' some point in the near future.
ifnot dstport==last_listen_port AND LONG[RTCADDR]<last_listen_time+5 AND (BYTE[pkt][constant(TCP_hdrflags + 1)] & TCP_SYN)
reject_tcp
abort -1
handle_addr := @sSockets + (sSocketBytes * handle)
' at this point we assume we have an active socket, or a socket available to be used
datain_len := ((BYTE[pkt][ip_pktlen] << 8) + BYTE[pkt][constant(ip_pktlen + 1)]) - ((BYTE[pkt][ip_vers_len] & $0F) * 4) - (((BYTE[pkt][TCP_hdrflags] & $F0) >> 4) * 4)
bytemove(@seq, pkt + TCP_seqnum, 4)
seq:=conv_endianlong(seq)
if (BYTE[handle_addr + sConState] == SLISTEN) AND (BYTE[pkt][constant(TCP_hdrflags + 1)] & TCP_FIN) > 0
reject_tcp
abort -1
elseif (BYTE[handle_addr + sConState] <> SLISTEN) AND (BYTE[pkt][constant(TCP_hdrflags + 1)] & TCP_ACK) > 0 AND datain_len > 0
' ACK, without SYN, with data
' set socket state, established session
BYTE[handle_addr + sConState] := SESTABLISHED
LONG[handle_addr + sAge] := long[RTCADDR]
if seq==LONG[handle_addr + sMyAckNum]
' copy data to buffer
if \q.pushData(BYTE[handle_addr+sSockQRx],pkt+TCP_data,datain_len) > 0
' recalculate ack Num
LONG[handle_addr + sMyAckNum]+=datain_len
' Send an ACK
send_tcppacket(handle_addr,TCP_ACK,0,0)
elseif (BYTE[handle_addr + sConState] == SSYNSENT) AND (BYTE[pkt][constant(TCP_hdrflags + 1)] & TCP_SYN) > 0 AND (BYTE[pkt][constant(TCP_hdrflags + 1)] & TCP_ACK) > 0
' We got a server response, so we ACK it
LONG[handle_addr+sMyAckNum]:=seq+1
bytemove(handle_addr + sMySeqNum, pkt + TCP_acknum, 4)
LONG[handle_addr+sMySeqNum]:=conv_endianlong(LONG[handle_addr+sMySeqNum])
' ACK response
send_tcppacket(handle_addr,TCP_ACK,0,0)
' set socket state, established session
LONG[handle_addr + sAge] := long[RTCADDR]
BYTE[handle_addr + sConState] := SESTABLISHED
elseif (BYTE[handle_addr + sConState] == SLISTEN) AND (BYTE[pkt][constant(TCP_hdrflags + 1)] & TCP_SYN) > 0
' Reply to SYN with SYN + ACK
' copy mac address so we don't have to keep an ARP table
bytemove(handle_addr + sSrcMac, pkt + enetpacketSrc0, 6)
' copy ip, port data
LONG[handle_addr+sSrcIp]:= srcip
WORD[handle_addr+sDstPort]:= dstport
WORD[handle_addr+sSrcPort]:= srcport
' get updated ack numbers
LONG[handle_addr+sMyAckNum]:=seq+1
LONG[handle_addr + sMySeqNum] := randseed? ' Initial seq num (random)
send_tcppacket(handle_addr,TCP_SYN|TCP_ACK,0,0)
' incremement the sequence number for the next packet (it will be for an established connection)
LONG[handle_addr + sMySeqNum]++
' set socket state, waiting for establish
LONG[handle_addr + sAge] := long[RTCADDR]
BYTE[handle_addr + sConState] := SSYNSENT
' Little hack
last_listen_port:=dstport
last_listen_time:=long[RTCADDR]
elseif (BYTE[handle_addr + sConState] <> SLISTEN) AND (BYTE[pkt][constant(TCP_hdrflags + 1)] & TCP_FIN) > 0
' Reply to FIN with ACK
' We only want to ACK a FIN if we have received everything up to this point.
if seq<>LONG[handle_addr + sMyAckNum]
send_tcppacket(handle_addr,TCP_ACK,0,0)
abort -1 ' Bad sequence Num!
' get updated sequence and ack numbers (gaurantee we have correct ones to kill connection with)
bytemove(handle_addr + sMySeqNum, pkt + TCP_acknum, 4)
LONG[handle_addr+sMyAckNum]:=seq+1
LONG[handle_addr+sMySeqNum]:=conv_endianlong(LONG[handle_addr+sMySeqNum])
send_tcppacket(handle_addr,TCP_RST,0,0)
' set socket state, now free
\q.delete(BYTE[handle_addr + sSockQTx]~)
\q.delete(BYTE[handle_addr + sSockQRx]~)
bytefill(handle_addr,0,sSocketBytes)
LONG[handle_addr + sAge] := long[RTCADDR]
BYTE[handle_addr + sConState] := SCLOSED
elseif (BYTE[handle_addr + sConState] == SSYNSENT) AND (BYTE[pkt][constant(TCP_hdrflags + 1)] & TCP_ACK) > 0
' if just an ack, and we sent a syn before, then it's established
' this just gives us the ability to send on connect
BYTE[handle_addr + sConState] := SESTABLISHED
LONG[handle_addr + sAge] := long[RTCADDR]
elseif (BYTE[pkt][constant(TCP_hdrflags + 1)] & TCP_RST) > 0
' Reset, reset states
\q.delete(BYTE[handle_addr + sSockQTx]~)
\q.delete(BYTE[handle_addr + sSockQRx]~)
bytefill(handle_addr,0,sSocketBytes)
LONG[handle_addr + sAge] := long[RTCADDR]
BYTE[handle_addr + sConState] := SCLOSED
PRI reject_tcp | srcip,dstport,srcport,seq,ack,chksum
bounce_unreachable(3)
dstport := BYTE[pkt][TCP_destport] << 8 + BYTE[pkt][constant(TCP_destport + 1)]
srcport := BYTE[pkt][TCP_srcport] << 8 + BYTE[pkt][constant(TCP_srcport + 1)]
bytemove(@seq, pkt + TCP_acknum, 4)
seq:=conv_endianlong(seq)
bytemove(@ack, pkt + TCP_seqnum, 4)
ack:=conv_endianlong(ack)+1
nic.start_frame
compose_ethernet_header(pkt+enetpacketSrc0,@local_macaddr,$0800)
chksum:=compose_ip_header(PROT_TCP,pkt+ip_srcaddr,@ip_addr)
chksum+=TCP_data-TCP_srcport
compose_tcp_header(srcport,dstport,seq,ack,TCP_RST,0,chksum)
nic.calc_frame_ip_length
nic.calc_frame_ip_checksum
nic.calc_frame_tcp_checksum
return nic.send_frame
PRI compose_tcp_header(dstport,srcport,seq,ack,flags,window,chksum)
nic.wr_frame_word(srcport) ' Source Port
nic.wr_frame_word(dstport) ' Dest Port
nic.wr_frame_long(seq)
nic.wr_frame_long(ack)
nic.wr_frame_byte($50)
nic.wr_frame_byte(flags)
nic.wr_frame_word(window)
chksum := (chksum >> 16) + (chksum & $FFFF)
nic.wr_frame_word(chksum) ' TCP checksum (work in progress)
nic.wr_frame_word($00) ' TCP urgent pointer
PRI send_tcppacket(handle_addr,flags,data,datalen) | hdrlen, hdr_chksum
nic.start_frame
compose_ethernet_header(handle_addr + sSrcMac,@local_macaddr,$0800)
hdr_chksum:=compose_ip_header(PROT_TCP,handle_addr + sSrcIp,@ip_addr)
hdr_chksum+=TCP_data-TCP_srcport+datalen
WORD[handle_addr + sLastWindow]:= q.bytesFree(BYTE[handle_addr + sSockQRx])
if WORD[handle_addr + sLastWindow]<MIN_ADVERTISED_WINDOW
WORD[handle_addr + sLastWindow]:=0
compose_tcp_header(WORD[handle_addr + sSrcPort],WORD[handle_addr + sDstPort],LONG[handle_addr + sMySeqNum],LONG[handle_addr + sMyAckNum],flags,WORD[handle_addr + sLastWindow],hdr_chksum)
if datalen > 0
nic.wr_frame_data(data,datalen)
nic.calc_frame_ip_length
nic.calc_frame_ip_checksum
nic.calc_frame_tcp_checksum
nic.send_frame
LONG[handle_addr + sMySeqNum]+= datalen ' update running sequence number
PRI socketLock
repeat while NOT lockset(SocketLockid)
PRI socketUnlock
lockclr(SocketLockid)
PRI find_socket(srcip, dstport, srcport) | handle, free_handle, handle_addr
' Search for socket, matches ip address, port states
' Returns handle number
' If no matches, will abort with -1
' If supplied with srcip = 0 then will return free unused handle, aborts with -1 if none avail
free_handle := -1
repeat handle from 0 to constant(sNumSockets - 1)
handle_addr := @sSockets + (sSocketBytes * handle) ' generate handle address (mapped to memory)
if BYTE[handle_addr + sConState] <> SCLOSED
if (LONG[handle_addr + sSrcIp] == 0) OR (LONG[handle_addr + sSrcIp] == srcip)
' ip match, ip socket srcip = 0, then will try to match dst port (find listening socket)
if (WORD[handle_addr + sDstPort] == dstport) AND (WORD[handle_addr + sSrcPort] == 0 OR WORD[handle_addr + sSrcPort] == srcport)
' port match, will match port, if srcport = 0 then will match dstport only (find listening socket)
return handle
elseif srcip == 0
' we only return a free handle if we are searching for srcip = 0 (just looking for free handle)
free_handle := handle ' we found a free handle, may need this later
if free_handle <> -1
return free_handle
else
abort(-1)
' ******************************
' ** Transmit Buffer Handlers **
' ******************************
PRI tick_tcpsend | state,i, ptr, handle, handle_addr
' Check buffers for data to send (called in main loop)
repeat handle from 0 to constant(sNumSockets - 1)
handle_addr := @sSockets + (sSocketBytes * handle)
state := BYTE[handle_addr + sConState]
if state == SESTABLISHED OR state == SCLOSING
' Check to see if we have data to send, if we do, send it
' If we have hit out next ack marker, send an ACK
i := local_mtu-TCP_DATA
' TODO: If dest window is smaller than i, replace i with dest window size
if i AND NOT q.isEmpty(BYTE[handle_addr+sSockQTx])
i := q.pullData(BYTE[handle_addr+sSockQTx],pkt,i)
send_tcppacket(handle_addr,TCP_ACK|TCP_PSH,pkt,i)
else
i:=q.bytesFree(BYTE[handle_addr + sSockQRx])
if i<MIN_ADVERTISED_WINDOW
i:=0
if WORD[handle_addr + sLastWindow]<>i
send_tcppacket(handle_addr,TCP_ACK,0,0)
if state == SSYNSENT AND (long[RTCADDR]-LONG[handle_addr + sAge]>5)
' If we haven't gotten back an ACK 5 seconds after sending the SYN, forget about it
send_tcppacket(handle_addr,TCP_RST,0,0)
\q.delete(BYTE[handle_addr + sSockQTx]~)
\q.delete(BYTE[handle_addr + sSockQRx]~)
bytefill(handle_addr,0,sSocketBytes)
LONG[handle_addr + sAge] := long[RTCADDR]
BYTE[handle_addr + sConState] := SCLOSED
if state == SCLOSING
send_tcppacket(handle_addr,TCP_ACK|TCP_FIN,0,0)
' set socket state, now free
LONG[handle_addr + sAge] := long[RTCADDR]
BYTE[handle_addr + sConState] := SCLOSING2
elseif state == SCLOSING2 AND (long[RTCADDR]-LONG[handle_addr + sAge]>10)
' Force connection close, I'll just RST it (bad I know, but it ensures closing...)
LONG[handle_addr + sMyAckNum] ++
send_tcppacket(handle_addr,TCP_RST,0,0)
' set socket state, now free
\q.delete(BYTE[handle_addr + sSockQTx]~)
\q.delete(BYTE[handle_addr + sSockQRx]~)
bytefill(handle_addr,0,sSocketBytes)
LONG[handle_addr + sAge] := long[RTCADDR]
BYTE[handle_addr + sConState] := SCLOSED
elseif state == SCONNECTINGARP1
' We need to send an arp request
arp_request_checkgateway(handle_addr)
elseif state == SCONNECTING
' Yea! We got an arp response previously, so now we can send the SYN
LONG[handle_addr + sMySeqNum] := randseed?
LONG[handle_addr + sMyAckNum] := 0
send_tcppacket(handle_addr,TCP_SYN,0,0)
BYTE[handle_addr + sConState] := SSYNSENT
LONG[handle_addr + sAge] := long[RTCADDR]
PRI arp_request_checkgateway(handle_addr) | ip_ptr
ip_ptr := handle_addr + sSrcIp
if (BYTE[ip_ptr] & ip_subnet[0]) == (ip_addr[0] & ip_subnet[0]) AND (BYTE[ip_ptr + 1] & ip_subnet[1]) == (ip_addr[1] & ip_subnet[1]) AND (BYTE[ip_ptr + 2] & ip_subnet[2]) == (ip_addr[2] & ip_subnet[2]) AND (BYTE[ip_ptr + 3] & ip_subnet[3]) == (ip_addr[3] & ip_subnet[3])
arp_request(ip_ptr)
BYTE[handle_addr + sConState] := SCONNECTINGARP2
LONG[handle_addr + sAge] := long[RTCADDR]
else
arp_request(@ip_gateway)
BYTE[handle_addr + sConState] := SCONNECTINGARP2G
LONG[handle_addr + sAge] := long[RTCADDR]
' *******************************
' ** IP Packet Helpers (Calcs) **
' *******************************
PRI calc_chksum(packet, hdrlen) : chksum
' Calculates IP checksums
' packet = pointer to IP packet
' returns: chksum
' http://www.geocities.com/SiliconValley/2072/bit33.txt
chksum := calc_chksumhalf(packet, hdrlen)
chksum := calc_chksumfinal(chksum)
PRI calc_chksumfinal(chksumin) : chksum
' Performs the final part of checksums
chksum := (chksumin >> 16) + (chksumin & $FFFF)
chksum := (!chksum) & $FFFF
PRI calc_chksumhalf(packet, hdrlen) : chksum
' Calculates checksum without doing the final stage of calculations
chksum := 0
repeat while hdrlen > 1
chksum += (BYTE[packet++] << 8) + BYTE[packet++]
chksum := (chksum >> 16) + (chksum & $FFFF)
hdrlen -= 2
if hdrlen > 0
chksum += BYTE[packet] << 8
' ***************************
' ** Memory Access Helpers **
' ***************************
PRI conv_endianlong(in)
return (in << 24) + ((in & $FF00) << 8) + ((in & $FF0000) >> 8) + (in >> 24) ' we can sometimes get away with shifting without masking, since shifts kill extra bits anyways
PRI conv_endianword(in)
return ((in & $FF) << 8) + ((in & $FF00) >> 8)
' ************************************
' ** Public Accessors (Thread Safe) **
' ************************************
PUB listen(port) | handle, handle_addr, x
'' Sets up a socket for listening on a port
'' Returns handle if available, -1 if none available
'' Nonblocking
' just find any avail closed socket
socketlock
handle := \find_socket(0, 0, 0)
if handle < 0
socketunlock
return -1
handle_addr := @sSockets + (sSocketBytes * handle)
' Start with a clean slate
bytefill(handle_addr,0,sSocketBytes)
LONG[handle_addr + sAge] := long[RTCADDR]
if (x:=\q.new)=<0
socketunlock
return -1
else
BYTE[handle_addr + sSockQTx] := x
if (x:=\q.new)=<0
\q.delete(BYTE[handle_addr + sSockQTx]~)
socketunlock
return -1
else
BYTE[handle_addr + sSockQRx] := x
WORD[handle_addr + sSrcPort] := 0 ' no source port yet
WORD[handle_addr + sDstPort] := port ' we do have a dest port though
' it's now listening
BYTE[handle_addr + sConState] := SLISTEN
socketunlock
return handle
PUB connect(ip, remoteport, localport) | handle, handle_addr,x
'' Connect to remote host
'' Returns handle to new socket, -1 if no socket available
'' Nonblocking
' just find any avail closed socket
socketlock
handle := \find_socket(0, 0, 0)
if handle < 0
socketunlock
return -1
handle_addr := @sSockets + (sSocketBytes * handle)
' Start with a clean slate
bytefill(handle_addr,0,sSocketBytes)
if (x:=\q.new)=<0
socketunlock
return -1
else
BYTE[handle_addr + sSockQTx] := x
if (x:=\q.new)=<0
\q.delete(BYTE[handle_addr + sSockQTx]~)
socketunlock
return -1
else
BYTE[handle_addr + sSockQRx] := x
' copy in ip, port data (with respect to the remote host, since we use same code as server)
LONG[handle_addr + sSrcIp] := LONG[ip]
WORD[handle_addr + sSrcPort] := remoteport
WORD[handle_addr + sDstPort] := localport
LONG[handle_addr + sAge] := long[RTCADDR]
BYTE[handle_addr + sConState] := SCONNECTINGARP1
socketunlock
return handle
PUB close(handle) | handle_addr
'' Closes a connection
socketlock
handle_addr := @sSockets + (sSocketBytes * handle)
if \isConnected(handle) OR BYTE[handle_addr + sConState]==SCLOSING OR BYTE[handle_addr + sConState]==SCLOSING2
BYTE[handle_addr + sConState] := SCLOSING
LONG[handle_addr + sAge] := long[RTCADDR]
repeat while BYTE[handle_addr + sConState]==SCLOSING
\q.delete(BYTE[handle_addr + sSockQTx]~)
\q.delete(BYTE[handle_addr + sSockQRx]~)
else
\q.delete(BYTE[handle_addr + sSockQTx]~)
\q.delete(BYTE[handle_addr + sSockQRx]~)
bytefill(handle_addr,0,sSocketBytes-1)
LONG[handle_addr + sAge] := long[RTCADDR]
BYTE[handle_addr + sConState] := SCLOSED
socketunlock
PUB closeall | handle
repeat handle from 0 to constant(sNumSockets - 1)
close(handle)
PUB isConnected(handle) | handle_addr
'' Returns true if the socket is connected, false otherwise
if handle => 2 OR handle < 0
abort handle
handle_addr := @sSockets + (sSocketBytes * handle)
if BYTE[handle_addr + sConState] == SESTABLISHED
return true
return false
PUB isEOF(handle) | handle_addr
handle_addr := @sSockets + (sSocketBytes * handle)
if BYTE[handle_addr + sConState] == SESTABLISHED
return false
return q.isEmpty(BYTE[handle_addr + sSockQRx])
PUB isValidHandle(handle) | handle_addr
'' Checks to see if the handle is valid, handles will become invalid once they are used
'' In other words, a closed listening socket is now invalid, etc
if handle => 2 OR handle < 0
abort -111
handle_addr := @sSockets + (sSocketBytes * handle)
return BYTE[handle_addr + sConState] <> SCLOSED
PUB readByteNonBlocking(handle) : rxbyte | ptr
'' Read a byte from the specified socket
'' Will not block (returns q#ERR_Q_EMPTY if no byte avail)
if (rxbyte:=\q.pull(BYTE[@sSockets + (sSocketBytes * handle) + sSockQRx])) < 0 AND rxbyte<>q#ERR_Q_EMPTY
abort rxbyte
PUB readByteTimeout(handle,ms) : rxbyte | ptr,t
'' Read a byte from the specified socket
'' Will block until a byte is received
'' or a timeout occurs
t := cnt
repeat while (rxbyte := readByteNonBlocking(handle)) == q#ERR_Q_EMPTY AND isValidHandle(handle)
if (cnt - t) / (clkfreq / 1000) > ms
abort q#ERR_Q_EMPTY
PUB readByte(handle) : rxbyte | ptr
'' Read a byte from the specified socket
'' Will block until a byte is received
repeat while (rxbyte := readByteNonBlocking(handle)) == q#ERR_Q_EMPTY AND isValidHandle(handle)
PUB writeByteNonBlocking(handle, txbyte):retVal | ptr
'' Writes a byte to the specified socket
'' Will not block (returns q#ERR_Q_FULL if no buffer space available)
if (retVal:=\q.push(BYTE[@sSockets + (sSocketBytes * handle) + sSockQTx],txbyte)) < 0 AND retVal<>q#ERR_Q_FULL
abort retVal
PUB writeDataNonBlocking(handle, ptr,len):retVal
'' Writes a byte to the specified socket
'' Will not block (returns q#ERR_Q_FULL if no buffer space available)
if (retVal:=\q.pushData(BYTE[@sSockets + (sSocketBytes * handle) + sSockQTx],ptr,len)) < 0 AND retVal<>q#ERR_Q_FULL
abort retVal
PUB writeByte(handle, txbyte):retVal
'' Write a byte to the specified socket
'' Will block until space is available for byte to be sent
repeat while (retVal:=writeByteNonBlocking(handle, txbyte)) == q#ERR_Q_FULL
ifnot isValidHandle(handle)
abort -1
PRI writeData_(handle, ptr,len): retVal
repeat while (retVal:=writeDataNonBlocking(handle, ptr,len)) == q#ERR_Q_FULL
ifnot isValidHandle(handle)
abort -1
PUB writeData(handle, ptr,len)
repeat while len > q#Q_SIZE-1
writeData_(handle,ptr,q#Q_SIZE-1)
ptr+=q#Q_SIZE-1
len-=q#Q_SIZE-1
return writeData_(handle,ptr,len)
CON
' The following is an 'array' that represents all the socket handle data (with respect to the remote host)
' longs first, then words, then bytes (for alignment)
'
' 4 bytes - (1 long ) my sequence number
' 4 bytes - (1 long ) my acknowledgement number
' 4 bytes - (1 long ) src ip
' 4 bytes - (1 long ) time last activity occured in this state
' 2 bytes - (1 word ) src port
' 2 bytes - (1 word ) dst port
' 4 bytes - (1 long ) When to send next ack (a terrible hACK)
' 1 byte - (1 byte ) conn state
' 6 bytes - (6 bytes) src mac address
' 1 byte - (1 byte ) handle index
' total: 32 bytes
sSocketBytes = 40 ' MUST BE MULTIPLE OF 4 (long aligned) set this to total socket state data size
sNumSockets = 2 ' number of sockets
' Offsets for socket status arrays
sMySeqNum = 0
sMyAckNum = 4
sSrcIp = 8
sAge = 12
sSrcPort = 16
sDstPort = 18
sLastWindow = 24
sConState = 26
sSrcMac = 27
sSockQTx = 33
sSockQRx = 34
' Socket states (user should never touch these)
SCLOSED = 0 ' closed, handle not used
SLISTEN = 1 ' listening, in server mode
SSYNSENT = 2 ' SYN sent, connection is opening stage 1
SESTABLISHED = 3 ' established connection (either SYN+ACK, or ACK+Data)
SCLOSING = 4 ' connection is being forced closed by code
SCLOSING2 = 9 '
SCONNECTINGARP1 = 5 ' connecting, next step: send arp request
SCONNECTINGARP2 = 6 ' connecting, next step: arp request sent, waiting for response
SCONNECTINGARP2G = 7 ' connecting, next step: arp request sent, waiting for response [GATEWAY REQUEST]
SCONNECTING = 8 ' connecting, next step: got mac address, send SYN
DAT
long 0 ' long align the socket state data
sSockets byte 0[sSocketBytes*sNumSockets]
CON
' sFlags variables (not related to the TCP header flags)
ARP_REPLY = %0000_0001
SEND_WAITING = %0000_0010
' TCP Flags
TCP_FIN = 1
TCP_SYN = 2
TCP_RST = 4
TCP_PSH = 8
TCP_ACK = 16
TCP_URG = 32
TCP_ECE = 64
TCP_CWR = 128
' Constants for TCP / UDP
'******************************************************************
'* Ethernet Header Layout
'******************************************************************
enetpacketDest0 = $00 'destination mac address
enetpacketDest1 = $01
enetpacketDest2 = $02
enetpacketDest3 = $03
enetpacketDest4 = $04
enetpacketDest5 = $05
enetpacketSrc0 = $06 'source mac address
enetpacketSrc1 = $07
enetpacketSrc2 = $08
enetpacketSrc3 = $09
enetpacketSrc4 = $0A
enetpacketSrc5 = $0B
enetpacketType0 = $0C 'type/length field
enetpacketType1 = $0D
enetpacketData = $0E 'IP data area begins here
'******************************************************************
'* ARP Layout
'******************************************************************
arp_hwtype = $0E
arp_prtype = $10
arp_hwlen = $12
arp_prlen = $13
arp_op = $14
arp_shaddr = $16 'arp source mac address
arp_sipaddr = $1C 'arp source ip address
arp_thaddr = $20 'arp target mac address
arp_tipaddr = $26 'arp target ip address
'******************************************************************
'* IP Header Layout
'******************************************************************
ip_vers_len = $0E 'IP version and header length 1a19
ip_tos = $0F 'IP type of service
ip_pktlen = $10 'packet length
ip_id = $12 'datagram id
ip_frag_offset = $14 'fragment offset
ip_ttl = $16 'time to live
ip_proto = $17 'protocol (ICMP=1, TCP=6, UDP=11)
ip_hdr_cksum = $18 'header checksum 1a23
ip_srcaddr = $1A 'IP address of source
ip_destaddr = $1E 'IP addess of destination
ip_data = $22 'IP data area
'******************************************************************
'* TCP Header Layout
'******************************************************************
TCP_srcport = $22 'TCP source port
TCP_destport = $24 'TCP destination port
TCP_seqnum = $26 'sequence number
TCP_acknum = $2A 'acknowledgement number
TCP_hdrflags = $2E '4-bit header len and flags
TCP_window = $30 'window size
TCP_cksum = $32 'TCP checksum
TCP_urgentptr = $34 'urgent pointer
TCP_data = $36 'option/data
'******************************************************************
'* IP Protocol Types
'******************************************************************
PROT_ICMP = $01
PROT_TCP = $06
PROT_UDP = $11
'******************************************************************
'* ICMP Header
'******************************************************************
ICMP_type = ip_data
ICMP_code = ICMP_type+1
ICMP_cksum = ICMP_code+1
ICMP_id = ICMP_cksum+2
ICMP_seqnum = ICMP_id+2
ICMP_data = ICMP_seqnum+2
'******************************************************************
'* UDP Header
'******************************************************************
UDP_srcport = ip_data
UDP_destport = UDP_srcport+2
UDP_len = UDP_destport+2
UDP_cksum = UDP_len+2
UDP_data = UDP_cksum+2
DAT
' ================================================================
' DHCP Implementation
' ================================================================
DAT
' DHCP Vars
ip_dhcp_server_ip byte 0,0,0,0
ip_dhcp_server_mac byte $FF, $FF, $FF, $FF, $FF, $FF
ip_dhcp_state byte 0
ip_dhcp_xid long 0
ip_dhcp_next long 0 ' Time for next DHCP op
ip_dhcp_delay word 0
CON
DHCP_STATE_UNBOUND = 0
DHCP_STATE_RENEW = 1
DHCP_STATE_REBIND = 0
DHCP_STATE_BOUND = 3
DHCP_STATE_DISABLED = 4
DHCP_PORT_CLIENT = 68
DHCP_PORT_SERVER = 67
DHCP_TYPE_DISCOVER = 1
DHCP_TYPE_OFFER = 2
DHCP_TYPE_REQUEST = 3
DHCP_TYPE_DECLINE = 4
DHCP_TYPE_ACK = 5
DHCP_TYPE_NAK = 6
DHCP_TYPE_RELEASE = 7
DHCP_TYPE_INFORM = 8
'******************************************************************
'* DHCP Message
'******************************************************************
DHCP_op = UDP_data
DHCP_htype = DHCP_op+1
DHCP_hlen = DHCP_htype+1
DHCP_hops = DHCP_hlen+1
DHCP_xid = DHCP_hops+1
DHCP_secs = DHCP_xid+4
DHCP_flags = DHCP_secs+2
DHCP_ciaddr = DHCP_flags+2
DHCP_yiaddr = DHCP_ciaddr+4
DHCP_siaddr = DHCP_yiaddr+4
DHCP_giaddr = DHCP_siaddr+4
DHCP_chaddr = DHCP_giaddr+4
DHCP_sname = DHCP_chaddr+16
DHCP_file = DHCP_sname+64
DHCP_options = DHCP_file+128
DHCP_message_end = DHCP_options+312
PRI dhcp_init
if settings.findKey(settings#NET_DHCPv4_DISABLE)
ip_dhcp_state:=DHCP_STATE_DISABLED
else
ip_dhcp_next:=LONG[RTCADDR]
ip_dhcp_state:=DHCP_STATE_UNBOUND
settings.removeKey(settings#NET_IPv4_ADDR)
settings.removeKey(settings#NET_IPv4_MASK)
settings.removeKey(settings#NET_IPv4_GATE)
ip_dhcp_xid := randseed?
pub dhcp_rebind
'' This should be called when the ethernet cable is unplugged.
if ip_dhcp_state<>DHCP_STATE_DISABLED
ip_dhcp_state:=DHCP_STATE_UNBOUND
ip_dhcp_delay:=2
ip_dhcp_next~
PRI dhcp_process
'' Called by the main network loop periodicly
if ip_dhcp_state<>DHCP_STATE_DISABLED AND LONG[RTCADDR] => ip_dhcp_next
case ip_dhcp_state
DHCP_STATE_UNBOUND:
send_dhcp_request
if ip_dhcp_delay<33
ip_dhcp_delay*=2
ip_dhcp_delay++
ip_dhcp_next:=LONG[RTCADDR]+ip_dhcp_delay
DHCP_STATE_BOUND:
dhcp_rebind
other:
dhcp_rebind
PRI compose_bootp(op,hops,xid,secs,ciaddr_ptr,yiaddr_ptr,siaddr_ptr,giaddr_ptr)
nic.wr_frame(op) ' op (bootrequest)
nic.wr_frame($01) ' htype
nic.wr_frame($06) ' hlen
nic.wr_frame(hops) ' hops
' xid
nic.wr_frame_long(xid)
nic.wr_frame_word(secs) ' secs
nic.wr_frame_pad(2) ' padding ('flags')
nic.wr_frame_data(ciaddr_ptr,4) 'ciaddr
nic.wr_frame_data(yiaddr_ptr,4) 'yiaddr
nic.wr_frame_data(siaddr_ptr,4) 'siaddr
nic.wr_frame_data(giaddr_ptr,4) 'giaddr
' source mac address
nic.wr_frame_data(@local_macaddr,6)
nic.wr_frame_pad(10) ' padding
nic.wr_frame_pad(64) ' sname (empty)
nic.wr_frame_pad(128) ' file (empty)
PRI send_dhcp_request | i, pkt_len
nic.start_frame
ip_dhcp_xid++
compose_ethernet_header(@bcast_macaddr,@local_macaddr,$0800)
compose_ip_header(PROT_UDP,@bcast_ipaddr,@any_ipaddr)
compose_udp_header(DHCP_PORT_SERVER,DHCP_PORT_CLIENT,0)
compose_bootp(1,0,ip_dhcp_xid,ip_dhcp_delay,@any_ipaddr,@any_ipaddr,@any_ipaddr,@any_ipaddr)
' DHCP Magic Cookie
nic.wr_frame($63)
nic.wr_frame($82)
nic.wr_frame($53)
nic.wr_frame($63)
' DHCP Message Type
nic.wr_frame(53)
nic.wr_frame($01)
nic.wr_frame(DHCP_TYPE_DISCOVER)
' DHCP Parameter Request List
nic.wr_frame(55)
nic.wr_frame(5) ' 5 bytes long
nic.wr_frame(1) ' subnet mask
nic.wr_frame(3) ' gateway
nic.wr_frame(6) ' DNS server
nic.wr_frame(23) ' IP maxhops
nic.wr_frame(51) ' lease time
' DHCP Client-ID
nic.wr_frame(61)
nic.wr_frame($07)
nic.wr_frame($01)
nic.wr_frame_data(@local_macaddr,6)
' End of vendor data
nic.wr_frame($FF)
nic.wr_frame_pad(47)
nic.calc_frame_udp_length
nic.calc_frame_ip_checksum
'UDP Checksum, but missing the pseudo ip appendage.
'Not a problem, because in UDP the checksum is optional.
'nic.calc_frame_udp_checksum
return nic.send_frame
PRI dhcp_offer_response | i, ptr
nic.start_frame
compose_ethernet_header(@bcast_macaddr,@local_macaddr,$0800)
compose_ip_header(PROT_UDP,@bcast_ipaddr,@any_ipaddr)
compose_udp_header(DHCP_PORT_SERVER,DHCP_PORT_CLIENT,0)
ip_dhcp_xid++
compose_bootp($01,byte[pkt+DHCP_hops],ip_dhcp_xid,conv_endianword(word[pkt+DHCP_secs]),@any_ipaddr,@any_ipaddr,@any_ipaddr,@any_ipaddr)
' DHCP Magic Cookie
nic.wr_frame($63)
nic.wr_frame($82)
nic.wr_frame($53)
nic.wr_frame($63)
' DHCP Message Type
nic.wr_frame(53)
nic.wr_frame($01)
nic.wr_frame(DHCP_TYPE_REQUEST)
' DHCP Parameter Request List
nic.wr_frame(55)
nic.wr_frame(5) ' 5 bytes long
nic.wr_frame(1) ' subnet mask
nic.wr_frame(3) ' gateway
nic.wr_frame(6) ' DNS server
nic.wr_frame(23) ' IP maxhops
nic.wr_frame(51) ' lease time
' DHCP Client-ID
nic.wr_frame(61)
nic.wr_frame($07)
nic.wr_frame($01)
nic.wr_frame_data(@local_macaddr,6)
if long[pkt+DHCP_yiaddr]
nic.wr_frame(50)
nic.wr_frame($04)
nic.wr_frame_data(pkt+DHCP_yiaddr,4) 'yiaddr
elseif long[pkt+DHCP_ciaddr]
nic.wr_frame(50)
nic.wr_frame($04)
nic.wr_frame_data(pkt+DHCP_ciaddr,4) 'ciaddr
ptr:=pkt+DHCP_Options+4
repeat while byte[ptr]<>$FF
case byte[ptr]
54 : ' DHCP server id
nic.wr_frame(54)
nic.wr_frame(byte[ptr+1])
nic.wr_frame_data((ptr+2),byte[ptr+1])
51 : ' DHCP Lease Time
nic.wr_frame(51)
nic.wr_frame(byte[ptr+1])
nic.wr_frame_data((ptr+2),byte[ptr+1])
12 : ' Hostname
nic.wr_frame(12)
nic.wr_frame(byte[ptr+1])
nic.wr_frame_data((ptr+2),byte[ptr+1])
if byte[ptr]
ptr++
ptr+=byte[ptr]+1
else
ptr++
' End of vendor data
nic.wr_frame($FF)
nic.wr_frame_pad(30) ' Padding
nic.calc_frame_udp_length
nic.calc_frame_ip_checksum
'UDP Checksum, which is optional. Leaving it out because it isn't finished.
'nic.calc_frame_udp_checksum
return nic.send_frame
PRI handle_dhcp | i, ptr, handle, handle_addr, xid, srcport', datain_len
srcport := BYTE[pkt][UDP_srcport] << 8 + BYTE[pkt][constant(UDP_srcport + 1)]
if srcport <> DHCP_PORT_SERVER
' If the sender isn't sending on the DHCP server port
' then we shouldn't be listening.
return
if ip_dhcp_state=>DHCP_STATE_BOUND
return
xid := BYTE[pkt][DHCP_xid] << 24 + BYTE[pkt][constant(DHCP_xid + 1)] << 16 + BYTE[pkt][constant(DHCP_xid + 2)] << 8 + BYTE[pkt][constant(DHCP_xid + 3)]
if xid<>ip_dhcp_xid
' Transaction ID doesn't match. Ignore this packet.
return
if BYTE[pkt][DHCP_options] == $63 and BYTE[pkt][DHCP_options+1] == $82 and BYTE[pkt][DHCP_options+2] == $53 and BYTE[pkt][DHCP_options+3] == $63
' this is a DHCP packet! We should send a request.
ptr:=pkt+DHCP_Options+4
repeat while byte[ptr]<>$FF
case byte[ptr]
53 : ' DHCP message type
if byte[ptr+2]==DHCP_TYPE_OFFER
dhcp_offer_response
' Lets wait extra time
ip_dhcp_next:=LONG[RTCADDR]+ip_dhcp_delay
' Had to comment out this return so DHCP would work properly
' with internet sharing on the macosx. Not sure what is wrong.
'return
elseif byte[ptr+2]==DHCP_TYPE_NAK
' Nak'd!
ip_dhcp_xid++
return
elseif byte[ptr+2]<>DHCP_TYPE_ACK
' If this isn't an ACK, then ignore it.
return
if byte[ptr]
ptr++
ptr+=byte[ptr]+1
else
ptr++
' This is a DHCP/BOOTP reply! And guess what, we have no IP address.
bytemove(@ip_addr, pkt+DHCP_yiaddr, 4)
' Hackity hack hack... This is a dirty assumption we are making here...
' We only end up using this assumption if this is BOOTP and not DHCP,
' so it isn't a big deal.
if BYTE[pkt][DHCP_giaddr]
bytemove(@ip_gateway, pkt+DHCP_giaddr, 4)
else
bytemove(@ip_gateway, pkt+ip_srcaddr, 4)
' Set this IP address to expire in an hour.
' This will be overridden by DHCP option 51, if set
ip_dhcp_next := long[RTCADDR] + 3600
if BYTE[pkt][DHCP_options] == $63 and BYTE[pkt][DHCP_options+1] == $82 and BYTE[pkt][DHCP_options+2] == $53 and BYTE[pkt][DHCP_options+3] == $63
ptr:=pkt+DHCP_Options+4
repeat while byte[ptr]<>$FF
case byte[ptr]
01 : bytemove(@ip_subnet,ptr+2,4)
03 : bytemove(@ip_gateway,ptr+2,4)
06 : bytemove(@ip_dns,ptr+2,4)
54 : bytemove(@ip_dhcp_server_ip,ptr+2,4)
23 : ' Default IP maxhops
bytemove(@ip_maxhops,ptr+2,1)
51 :
bytemove(@ip_dhcp_next,ptr+2,4) ' lease time
ip_dhcp_next := conv_endianlong(ip_dhcp_next)
if ip_dhcp_next == $FFFFFFFF
ip_dhcp_next := $7FFFFFFF
else
ip_dhcp_next>>=1
ip_dhcp_next+=long[RTCADDR]
'58 : ' DHCP renewal time
' bytemove(@ip_dhcp_expire,ptr+2,4) ' lease time
' ip_dhcp_expire := conv_endianlong(ip_dhcp_expire)
' ip_dhcp_expire+=long[RTCADDR]
' term.str(string("Renewal set to:"))
' term.dec(ip_dhcp_expire/(3600))
' term.out(13)
'28 : ' Broadcast address
'37 : ' Default TCP TTL
'42 : ' NTP Servers
if byte[ptr]
ptr++
ptr+=byte[ptr]+1
else
ptr++
ip_dhcp_state:=DHCP_STATE_BOUND
bytemove(@ip_dhcp_server_mac, pkt+enetpacketSrc0, 6)
settings.setData(settings#NET_IPv4_ADDR,@ip_addr,4)
settings.setData(settings#NET_IPv4_MASK,@ip_subnet,4)
settings.setData(settings#NET_IPv4_GATE,@ip_gateway,4)
settings.setData(settings#NET_IPv4_DNS,@ip_dns,4)
PRI has_valid_ip_addr
return long[@ip_addr] AND ip_dhcp_state=>DHCP_STATE_BOUND | Propeller Spin | 5 | deets/propeller | libraries/community/p1/All/Settings/driver_socket.spin | [
"MIT"
] |
0 reg32_t "dword"
1 code_t "proc*"
2 num32_t "int"
3 uint32_t "size_t"
4 ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))) "FILE*"
5 ptr(num8_t) "char*"
6 ptr(TOP) "void*"
3 uint32_t "__gid_t"
7 ptr(uint32_t) "__gid_t*"
3 uint32_t "__uid_t"
8 ptr(ptr(num8_t)) "char**"
3 uint32_t "unsigned int"
9 num8_t "char"
10 ptr(array(reg8_t,16)) "unknown_128*"
11 ptr(array(reg8_t,56)) "unknown_448*"
12 ptr(array(reg8_t,156)) "unknown_1248*"
13 ptr(array(reg8_t,58)) "unknown_464*"
14 ptr(num32_t) "int*"
15 union(ptr(num8_t),ptr(struct(0:reg16_t,2:num8_t))) "Union_0"
16 ptr(struct(0:reg16_t,2:num8_t)) "StructFrag_0*"
17 ptr(reg32_t) "dword*"
5 ptr(num8_t) "char[]"
18 ptr(struct(0:ptr(num8_t),4:ptr(num8_t),8:uint32_t,12:ptr(ptr(num8_t)))) "group*"
19 ptr(struct(0:array(reg8_t,36),36:num8_t)) "StructFrag_2*"
7 ptr(uint32_t) "unsigned int*"
20 ptr(struct(0:num32_t,4:ptr(struct(0:ptr(num8_t),8:ptr(num8_t))),4294967292:reg32_t)) "Struct_4*"
21 ptr(struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t)) "option*"
22 ptr(struct(0:ptr(num8_t),8:ptr(num8_t))) "Struct_5*"
23 ptr(struct(0:ptr(num8_t),4:ptr(num8_t),8:uint32_t,12:uint32_t,16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t))) "passwd*"
24 ptr(ptr(TOP)) "void**"
25 ptr(ptr(uint32_t)) "__gid_t**"
26 ptr(struct(0:array(reg8_t,6),6:num8_t)) "StructFrag_3*"
27 ptr(ptr(struct(0:reg32_t,4:num8_t))) "StructFrag_1**"
7 ptr(uint32_t) "__uid_t*"
28 ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_1*"
29 ptr(struct(40:ptr(num8_t),44:ptr(num8_t))) "Struct_2*"
7 ptr(uint32_t) "size_t*"
30 array(reg8_t,3) "unknown_24"
31 ptr(struct(0:reg32_t,4:ptr(TOP))) "Struct_0*"
32 reg64_t "qword"
33 array(reg8_t,32) "unknown_256"
17 ptr(reg32_t) "dword[]"
34 int32_t "signed int"
35 reg16_t "word"
36 union(ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t))),ptr(reg32_t)) "Union_2"
37 ptr(struct(0:reg32_t,4:reg32_t)) "StructFrag_5*"
38 ptr(struct(0:array(reg8_t,40),40:num8_t)) "StructFrag_12*"
39 ptr(ptr(uint16_t)) "unsigned short**"
40 ptr(union(ptr(num8_t),ptr(struct(0:reg16_t,2:num8_t)))) "Union_0*"
41 ptr(struct(0:array(reg8_t,16),16:uint32_t)) "StructFrag_11*"
42 ptr(code_t) "proc**"
43 ptr(uint16_t) "unsigned short*"
44 ptr(reg16_t) "word*"
45 union(ptr(num8_t),ptr(struct(0:reg32_t,4:num8_t))) "Union_1"
46 ptr(struct(0:array(reg8_t,74978),74978:reg32_t)) "StructFrag_7*"
47 ptr(struct(0:array(reg8_t,536870908),4294967292:reg32_t)) "StructFrag_8*"
20 ptr(struct(0:num32_t,4:ptr(struct(0:ptr(num8_t),8:ptr(num8_t))),4294967292:reg32_t)) "Struct_6*"
48 ptr(struct(0:array(reg8_t,35164),35164:reg32_t)) "StructFrag_9*"
49 ptr(struct(0:array(reg8_t,584),584:reg32_t)) "StructFrag_10*"
50 array(reg8_t,4096) "unknown_32768"
51 array(reg8_t,135168) "unknown_1081344"
52 array(reg8_t,30) "unknown_240"
53 array(reg8_t,5) "unknown_40"
54 array(reg8_t,25) "unknown_200"
55 array(reg8_t,16) "unknown_128"
56 array(reg8_t,41) "unknown_328"
57 array(reg8_t,7) "unknown_56"
58 array(reg8_t,51) "unknown_408"
59 array(reg8_t,13) "unknown_104"
60 array(reg8_t,27) "unknown_216"
61 array(reg8_t,142) "unknown_1136"
62 array(reg8_t,53) "unknown_424"
63 array(reg8_t,55) "unknown_440"
64 array(reg8_t,10) "unknown_80"
65 array(reg8_t,23) "unknown_184"
66 array(reg8_t,215) "unknown_1720"
67 array(reg8_t,11) "unknown_88"
68 array(reg8_t,156) "unknown_1248"
69 array(reg8_t,19) "unknown_152"
70 array(reg8_t,15) "unknown_120"
71 array(reg8_t,38) "unknown_304"
72 array(reg8_t,9) "unknown_72"
73 array(reg8_t,6) "unknown_48"
74 array(reg8_t,56) "unknown_448"
75 array(reg8_t,137) "unknown_1096"
76 array(reg8_t,49) "unknown_392"
77 array(reg8_t,65) "unknown_520"
78 array(reg8_t,59) "unknown_472"
79 array(reg8_t,44) "unknown_352"
80 array(reg8_t,47) "unknown_376"
81 array(reg8_t,37) "unknown_296"
82 array(reg8_t,98) "unknown_784"
83 array(reg8_t,67) "unknown_536"
84 array(reg8_t,29) "unknown_232"
85 array(reg8_t,43) "unknown_344"
86 array(reg8_t,86) "unknown_688"
87 array(reg8_t,12) "unknown_96"
88 array(reg8_t,31) "unknown_248"
89 array(reg8_t,45) "unknown_360"
90 array(reg8_t,82) "unknown_656"
91 array(reg8_t,17) "unknown_136"
92 array(reg8_t,36) "unknown_288"
93 array(reg8_t,62) "unknown_496"
94 array(reg8_t,14) "unknown_112"
95 array(reg8_t,103) "unknown_824"
96 array(reg8_t,28) "unknown_224"
97 array(reg8_t,95) "unknown_760"
98 array(reg8_t,110) "unknown_880"
99 array(reg8_t,20) "unknown_160"
100 array(reg8_t,92) "unknown_736"
101 array(reg8_t,40) "unknown_320"
102 array(reg8_t,71) "unknown_568"
103 array(reg8_t,64) "unknown_512"
104 array(reg8_t,54) "unknown_432"
105 array(reg8_t,90) "unknown_720"
106 array(reg8_t,93) "unknown_744"
107 array(reg8_t,91) "unknown_728"
108 array(reg8_t,58) "unknown_464"
109 array(reg8_t,79) "unknown_632"
110 array(reg8_t,26) "unknown_208"
111 array(reg8_t,35) "unknown_280"
112 array(reg8_t,18) "unknown_144"
113 array(reg8_t,24) "unknown_192"
114 array(reg8_t,33) "unknown_264"
115 array(reg8_t,75) "unknown_600"
116 array(reg8_t,34) "unknown_272"
117 array(reg8_t,21) "unknown_168"
118 array(reg8_t,48) "unknown_384"
119 array(reg8_t,126) "unknown_1008"
120 array(reg8_t,70) "unknown_560"
121 array(reg8_t,89) "unknown_712"
122 array(reg8_t,52) "unknown_416"
123 array(reg8_t,61) "unknown_488"
124 array(reg8_t,22) "unknown_176"
125 array(reg8_t,50) "unknown_400"
126 array(reg8_t,190) "unknown_1520"
127 array(reg8_t,42) "unknown_336"
128 array(reg8_t,173) "unknown_1384"
129 array(reg8_t,46) "unknown_368"
130 array(reg8_t,149) "unknown_1192"
131 array(reg8_t,146) "unknown_1168"
132 array(reg8_t,81) "unknown_648"
133 array(reg8_t,39) "unknown_312"
134 array(reg8_t,60) "unknown_480"
135 array(reg8_t,118) "unknown_944"
136 array(reg8_t,94) "unknown_752"
137 array(reg8_t,140) "unknown_1120"
138 array(reg8_t,57) "unknown_456"
139 array(reg8_t,101) "unknown_808"
140 array(reg8_t,102) "unknown_816"
141 array(reg8_t,113) "unknown_904"
142 array(reg8_t,69) "unknown_552"
143 array(reg8_t,100) "unknown_800"
144 array(reg8_t,77) "unknown_616"
145 array(reg8_t,73) "unknown_584"
146 array(reg8_t,129) "unknown_1032"
147 array(reg8_t,111) "unknown_888"
148 array(num8_t,23) "char[23]"
149 array(num8_t,39) "char[39]"
150 array(num8_t,14) "char[14]"
151 array(num8_t,4) "char[4]"
152 array(num8_t,69) "char[69]"
153 array(num8_t,65) "char[65]"
154 struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t) "option"
155 array(reg8_t,144) "unknown_1152"
156 array(num8_t,30) "char[30]"
157 array(num8_t,104) "char[104]"
158 array(num8_t,521) "char[521]"
159 array(num8_t,45) "char[45]"
160 array(num8_t,54) "char[54]"
161 array(num8_t,71) "char[71]"
162 array(num8_t,90) "char[90]"
163 array(num8_t,10) "char[10]"
164 array(num8_t,55) "char[55]"
165 array(num8_t,16) "char[16]"
166 array(num8_t,15) "char[15]"
167 array(num8_t,3) "char[3]"
168 array(num8_t,9) "char[9]"
169 array(num8_t,17) "char[17]"
170 array(num8_t,50) "char[50]"
171 array(num8_t,44) "char[44]"
172 array(num8_t,46) "char[46]"
173 array(num8_t,26) "char[26]"
174 array(num8_t,25) "char[25]"
175 array(num8_t,20) "char[20]"
176 array(num8_t,32) "char[32]"
177 array(num8_t,7) "char[7]"
178 array(num8_t,5) "char[5]"
179 array(num8_t,8) "char[8]"
180 array(num8_t,33) "char[33]"
181 array(num8_t,12) "char[12]"
182 array(num8_t,34) "char[34]"
183 array(num8_t,56) "char[56]"
184 array(num8_t,6) "char[6]"
185 array(num8_t,2) "char[2]"
186 array(reg32_t,127) "dword[127]"
187 array(reg32_t,30) "dword[30]"
188 array(reg32_t,34) "dword[34]"
189 array(num8_t,203) "char[203]"
190 array(num8_t,28) "char[28]"
191 array(num8_t,36) "char[36]"
192 array(num8_t,40) "char[40]"
193 array(num8_t,48) "char[48]"
194 array(num8_t,52) "char[52]"
195 array(num8_t,60) "char[60]"
196 array(num8_t,21) "char[21]"
197 array(num8_t,22) "char[22]"
198 array(num8_t,64) "char[64]"
199 array(num8_t,47) "char[47]"
200 array(num8_t,38) "char[38]"
201 array(ptr(TOP),54) "void*[54]"
202 array(num8_t,81) "char[81]"
203 array(reg8_t,1028) "unknown_8224"
204 array(reg8_t,4372) "unknown_34976"
205 array(reg8_t,6856) "unknown_54848"
1 code_t "(void -?-> dword)*"
206 array(reg8_t,232) "unknown_1856"
207 array(reg8_t,256) "unknown_2048"
| BlitzBasic | 0 | matt-noonan/retypd-data | data/id.decls | [
"MIT"
] |
# Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
#
# This program is licensed to you under the Apache License Version 2.0,
# and you may not use this file except in compliance with the Apache License Version 2.0.
# You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the Apache License Version 2.0 is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
#
# Version: 0.1.0
#
# Authors: Christophe Bogaert, Keane Robinson
# Copyright: Copyright (c) 2016 Snowplow Analytics Ltd
# License: Apache License Version 2.0
- view: scratch_pv_00
derived_table:
sql: |
WITH prep AS (
-- deduplicate the web page context in 2 steps
SELECT
root_id,
id AS page_view_id
FROM atomic.com_snowplowanalytics_snowplow_web_page_1
GROUP BY 1,2
)
SELECT * FROM prep WHERE root_id NOT IN (SELECT root_id FROM prep GROUP BY 1 HAVING COUNT(*) > 1) -- exclude all root ID with more than one page view ID
sql_trigger_value: SELECT MAX(collector_tstamp) FROM atomic.events
distkey: page_view_id
sortkeys: page_view_id
fields:
# DIMENSIONS #
- dimension: root_id
type: string
sql: ${TABLE}.root_id
- dimension_group: page_view_id
type: string
sql: ${TABLE}.page_view_id
# MEASURES #
- measure: count
type: count
| LookML | 4 | chuwy/snowplow-build-test | 5-data-modeling/web-model/looker/web-block-old-lookml/00_scratch_web_page_context.view.lookml | [
"Apache-2.0"
] |
mixin M
{
Str i() { return priI + " " + intI }
static Str s() { return priS + " " + intS }
private Str priI() { return "private instance" }
private Str intI() { return "internal instance" }
private static Str priS() { return "private static" }
private static Str intS() { return "internal static" }
}
class Foo : M {} | Fantom | 3 | fanx-dev/fanx | compiler/testCompilerx/res/regression/test529.fan | [
"AFL-3.0"
] |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<i>Copyright (c) Microsoft Corporation. All rights reserved.</i>\n",
"\n",
"<i>Licensed under the MIT License.</i>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Train SAR on MovieLens with Azure Machine Learning (Python, CPU)\n",
"---\n",
"## Introduction to Azure Machine Learning \n",
"The **[Azure Machine Learning service (AzureML)](https://docs.microsoft.com/azure/machine-learning/service/overview-what-is-azure-ml)** provides a cloud-based environment you can use to prep data, train, test, deploy, manage, and track machine learning models. By using Azure Machine Learning service, you can start training on your local machine and then scale out to the cloud. With many available compute targets, like [Azure Machine Learning Compute](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-set-up-training-targets#amlcompute) and [Azure Databricks](https://docs.microsoft.com/en-us/azure/azure-databricks/what-is-azure-databricks), and with [advanced hyperparameter tuning services](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-tune-hyperparameters), you can build better models faster by using the power of the cloud.\n",
"\n",
"Data scientists and AI developers use the main [Azure Machine Learning Python SDK](https://docs.microsoft.com/en-us/python/api/overview/azure/ml/intro?view=azure-ml-py) to build and run machine learning workflows with the Azure Machine Learning service. You can interact with the service in any Python environment, including Jupyter Notebooks or your favorite Python IDE. The Azure Machine Learning SDK allows you the choice of using local or cloud compute resources, while managing and maintaining the complete data science workflow from the cloud.\n",
"\n",
"\n",
"This notebook provides an example of how to utilize and evaluate the Simple Algorithm for Recommendation (SAR) algorithm using the Azure Machine Learning service. It takes the content of the [SAR quickstart notebook](sar_movielens.ipynb) and demonstrates how to use the power of the cloud to manage data, switch to powerful GPU machines, and monitor runs while training a model. \n",
"\n",
"See the hyperparameter tuning notebook for more advanced use cases with AzureML.\n",
"\n",
"### Advantages of using AzureML:\n",
"- Manage cloud resources for monitoring, logging, and organizing your machine learning experiments.\n",
"- Train models either locally or by using cloud resources, including GPU-accelerated model training.\n",
"- Easy to scale out when dataset grows - by just creating and pointing to new compute target\n",
"\n",
"---\n",
"## Details of SAR\n",
"<details>\n",
" <summary>Click to expand</summary>\n",
" \n",
"SAR is a fast scalable adaptive algorithm for personalized recommendations based on user transaction history. It produces easily explainable / interpretable recommendations and handles \"cold item\" and \"semi-cold user\" scenarios. SAR is a kind of neighborhood based algorithm (as discussed in [Recommender Systems by Aggarwal](https://dl.acm.org/citation.cfm?id=2931100)) which is intended for ranking top items for each user. \n",
"\n",
"SAR recommends items that are most ***similar*** to the ones that the user already has an existing ***affinity*** for. Two items are ***similar*** if the users who have interacted with one item are also likely to have interacted with another. A user has an ***affinity*** to an item if they have interacted with it in the past.\n",
"\n",
"### Advantages of SAR:\n",
"- High accuracy for an easy to train and deploy algorithm\n",
"- Fast training, only requiring simple counting to construct matrices used at prediction time\n",
"- Fast scoring, only involving multiplication of the similarity matric with an affinity vector\n",
"\n",
"### Notes to use SAR properly:\n",
"- SAR does not use item or user features, so cannot handle cold-start use cases\n",
"- SAR requires the creation of an $mxm$ dense matrix (where $m$ is the number of items). So memory consumption can be an issue with large numbers of items.\n",
"- SAR is best used for ranking items per user, as the scale of predicted ratings may be different from the input range and will differ across users.\n",
"For more details see the deep dive notebook on SAR here: [SAR Deep Dive Notebook](../02_model_collaborative_filtering/sar_deep_dive.ipynb)</details>\n",
"---\n",
"## Prerequisities\n",
" - **Azure Subscription**\n",
" - If you don’t have an Azure subscription, create a free account before you begin. Try the [free or paid version of Azure Machine Learning service today](https://azure.microsoft.com/en-us/free/services/machine-learning/).\n",
" - You get credits to spend on Azure services, which will easily cover the cost of running this example notebook. After they're used up, you can keep the account and use [free Azure services](https://azure.microsoft.com/en-us/free/). Your credit card is never charged unless you explicitly change your settings and ask to be charged. Or [activate MSDN subscriber benefits](https://azure.microsoft.com/en-us/pricing/member-offers/credit-for-visual-studio-subscribers/), which give you credits every month that you can use for paid Azure services.\n",
"--- "
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"azureml.core version: 1.0.18\n"
]
}
],
"source": [
"# set the environment path to find Recommenders\n",
"import os\n",
"import shutil\n",
"import numpy as np\n",
"from tempfile import TemporaryDirectory\n",
"\n",
"import azureml\n",
"from azureml.core import Workspace, Run, Experiment\n",
"from azureml.core.compute import ComputeTarget, AmlCompute\n",
"from azureml.train.estimator import Estimator\n",
"from azureml.widgets import RunDetails\n",
"\n",
"from recommenders.datasets import movielens\n",
"\n",
"print(\"azureml.core version: {}\".format(azureml.core.VERSION))"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"tags": [
"parameters"
]
},
"outputs": [],
"source": [
"# top k items to recommend\n",
"TOP_K = 10\n",
"\n",
"# Select Movielens data size: 100k, 1m, 10m, or 20m\n",
"MOVIELENS_DATA_SIZE = '100k'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Connect to an AzureML workspace\n",
"\n",
"An [AzureML Workspace](https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.workspace.workspace?view=azure-ml-py) is an Azure resource that organizes and coordinates the actions of many other Azure resources to assist in executing and sharing machine learning workflows. In particular, an Azure ML Workspace coordinates storage, databases, and compute resources providing added functionality for machine learning experimentation, deployment, inferencing, and the monitoring of deployed models.\n",
"\n",
"The function below will get or create an AzureML Workspace and save the configuration to `aml_config/config.json`.\n",
"\n",
"It defaults to use provided input parameters or environment variables for the Workspace configuration values. Otherwise, it will use an existing configuration file (either at `./aml_config/config.json` or a path specified by the config_path parameter).\n",
"\n",
"Lastly, if the workspace does not exist, one will be created for you. See [this tutorial](https://docs.microsoft.com/en-us/azure/machine-learning/service/setup-create-workspace#portal) to locate information such as subscription id."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ws = Workspace.create(\n",
" name=\"<WORKSPACE_NAME>\",\n",
" subscription_id=\"<SUBSCRIPTION_ID>\",\n",
" resource_group=\"<RESOURCE_GROUP>\",\n",
" location=\"<WORKSPACE_REGION>\",\n",
" exist_ok=True,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create a Temporary Directory\n",
"This directory will house the data and scripts needed by the AzureML Workspace"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [],
"source": [
"tmp_dir = TemporaryDirectory()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Download dataset and upload to datastore\n",
"\n",
"Every workspace comes with a default [datastore](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-access-data) (and you can register more) which is backed by the Azure blob storage account associated with the workspace. We can use it to transfer data from local to the cloud, and access it from the compute target.\n",
"\n",
"The data files are uploaded into a directory named `data` at the root of the datastore."
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 4.81k/4.81k [00:02<00:00, 1.98kKB/s]\n"
]
},
{
"data": {
"text/plain": [
"$AZUREML_DATAREFERENCE_57dbc7117f67479892135cec2819b78b"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"TARGET_DIR = 'movielens'\n",
"\n",
"# download dataset\n",
"data = movielens.load_pandas_df(\n",
" size=MOVIELENS_DATA_SIZE,\n",
" header=['UserId','MovieId','Rating','Timestamp']\n",
")\n",
"\n",
"# upload dataset to workspace datastore\n",
"data_file_name = \"movielens_\" + MOVIELENS_DATA_SIZE + \"_data.pkl\"\n",
"data.to_pickle(os.path.join(tmp_dir.name, data_file_name))\n",
"\n",
"ds = ws.get_default_datastore()\n",
"ds.upload(src_dir=tmp_dir.name, target_path=TARGET_DIR, overwrite=True, show_progress=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create or Attach Azure Machine Learning Compute \n",
"\n",
"We create a cpu cluster as our **remote compute target**. If a cluster with the same name already exists in your workspace, the script will load it instead. You can read [Set up compute targets for model training](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-set-up-training-targets) to learn more about setting up compute target on different locations. You can also create GPU machines when larger machines are necessary to train the model.\n",
"\n",
"According to Azure [Pricing calculator](https://azure.microsoft.com/en-us/pricing/calculator/), with example VM size `STANDARD_D2_V2`, it costs a few dollars to run this notebook, which is well covered by Azure new subscription credit. For billing and pricing questions, please contact [Azure support](https://azure.microsoft.com/en-us/support/options/).\n",
"\n",
"**Note**:\n",
"- 10m and 20m dataset requires more capacity than `STANDARD_D2_V2`, such as `STANDARD_NC6` or `STANDARD_NC12`. See list of all available VM sizes [here](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Compute/2018-10-01/virtualMachines?toc=%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftoc.json&bc=%2Fen-us%2Fazure%2Fbread%2Ftoc.json#hardwareprofile-object).\n",
"- As with other Azure services, there are limits on certain resources (e.g. AzureML Compute quota) associated with the Azure Machine Learning service. Please read [these instructions](https://docs.microsoft.com/en-us/azure/azure-supportability/resource-manager-core-quotas-request) on the default limits and how to request more quota.\n",
"---\n",
"#### Learn more about Azure Machine Learning Compute\n",
"<details>\n",
" <summary>Click to learn more about compute types</summary>\n",
" \n",
"[Azure Machine Learning Compute](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-set-up-training-targets#amlcompute) is managed compute infrastructure that allows the user to easily create single to multi-node compute of the appropriate VM Family. It is created within your workspace region and is a resource that can be used by other users in your workspace. It autoscales by default to the max_nodes, when a job is submitted, and executes in a containerized environment packaging the dependencies as specified by the user.\n",
"\n",
"Since it is managed compute, job scheduling and cluster management are handled internally by Azure Machine Learning service.\n",
"\n",
"You can provision a persistent AzureML Compute resource by simply defining two parameters thanks to smart defaults. By default it autoscales from 0 nodes and provisions dedicated VMs to run your job in a container. This is useful when you want to continously re-use the same target, debug it between jobs or simply share the resource with other users of your workspace.\n",
"\n",
"In addition to vm_size and max_nodes, you can specify:\n",
"- **min_nodes**: Minimum nodes (default 0 nodes) to downscale to while running a job on AzureML Compute\n",
"- **vm_priority**: Choose between 'dedicated' (default) and 'lowpriority' VMs when provisioning AzureML Compute. Low Priority VMs use Azure's excess capacity and are thus cheaper but risk your run being pre-empted\n",
"- **idle_seconds_before_scaledown**: Idle time (default 120 seconds) to wait after run completion before auto-scaling to min_nodes\n",
"- **vnet_resourcegroup_name**: Resource group of the existing VNet within which Azure MLCompute should be provisioned\n",
"- **vnet_name**: Name of VNet\n",
"- **subnet_name**: Name of SubNet within the VNet\n",
"</details>\n",
"---"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Creating a new compute target...\n",
"Creating\n",
"Succeeded\n",
"AmlCompute wait for completion finished\n",
"Minimum number of nodes requested have been provisioned\n"
]
}
],
"source": [
"# Remote compute (cluster) configuration. If you want to save the cost more, set these to small.\n",
"VM_SIZE = 'STANDARD_D2_V2'\n",
"# Cluster nodes\n",
"MIN_NODES = 0\n",
"MAX_NODES = 2\n",
"\n",
"CLUSTER_NAME = 'cpucluster'\n",
"\n",
"try:\n",
" compute_target = ComputeTarget(workspace=ws, name=CLUSTER_NAME)\n",
" print(\"Found existing compute target\")\n",
"except:\n",
" print(\"Creating a new compute target...\")\n",
" # Specify the configuration for the new cluster\n",
" compute_config = AmlCompute.provisioning_configuration(\n",
" vm_size=VM_SIZE,\n",
" min_nodes=MIN_NODES,\n",
" max_nodes=MAX_NODES\n",
" )\n",
" # Create the cluster with the specified name and configuration\n",
" compute_target = ComputeTarget.create(ws, CLUSTER_NAME, compute_config)\n",
" # Wait for the cluster to complete, show the output log\n",
" compute_target.wait_for_completion(show_output=True, min_node_count=None, timeout_in_minutes=20)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Prepare training script\n",
"### 1. Create a directory\n",
"Create a directory that will contain all the necessary code from your local machine that you will need access to on the remote resource. This includes the training script, and any additional files your training script depends on."
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
"SCRIPT_DIR = os.path.join(tmp_dir.name, 'movielens-sar')\n",
"os.makedirs(SCRIPT_DIR, exist_ok=True)\n",
"TRAIN_FILE = os.path.join(SCRIPT_DIR, 'train.py')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2. Create a training script\n",
"To submit the job to the cluster, first create a training script. Run the following code to create the training script called `train.py` in temporary directory. This training adds a regularization rate to the training algorithm, so produces a slightly different model than the local version.\n",
"\n",
"This code takes what is in the local quickstart and convert it to one single training script. We use run.log() to record parameters to the run. We will be able to review and compare these measures in the Azure Portal at a later time."
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Writing /tmp/tmp6imrlt0z/movielens-sar/train.py\n"
]
}
],
"source": [
"%%writefile $TRAIN_FILE\n",
"\n",
"import argparse\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"import itertools\n",
"import logging\n",
"\n",
"from azureml.core import Run\n",
"from sklearn.externals import joblib\n",
"\n",
"from recommenders.utils.timer import Timer\n",
"from recommenders.datasets import movielens\n",
"from recommenders.datasets.python_splitters import python_stratified_split\n",
"from recommenders.evaluation.python_evaluation import map_at_k, ndcg_at_k, precision_at_k, recall_at_k\n",
"from recommenders.models.sar.sar_singlenode import SARSingleNode\n",
"\n",
"\n",
"logging.basicConfig(level=logging.DEBUG, \n",
" format='%(asctime)s %(levelname)-8s %(message)s')\n",
"\n",
"\n",
"TARGET_DIR = 'movielens'\n",
"OUTPUT_FILE_NAME = 'outputs/movielens_sar_model.pkl'\n",
"MODEL_FILE_NAME = 'movielens_sar_model.pkl'\n",
"\n",
"\n",
"# get hold of the current run\n",
"run = Run.get_context()\n",
"\n",
"# let user feed in 2 parameters, the location of the data files (from datastore), and the regularization rate of the logistic regression model\n",
"parser = argparse.ArgumentParser()\n",
"parser.add_argument('--data-folder', type=str, dest='data_folder', help='data folder mounting point')\n",
"parser.add_argument('--data-file', type=str, dest='data_file', help='data file name')\n",
"parser.add_argument('--top-k', type=int, dest='top_k', default=10, help='top k items to recommend')\n",
"parser.add_argument('--data-size', type=str, dest='data_size', default=10, help='Movielens data size: 100k, 1m, 10m, or 20m')\n",
"args = parser.parse_args()\n",
"\n",
"# set col names\n",
"header = {\n",
" \"col_user\": \"UserId\",\n",
" \"col_item\": \"MovieId\",\n",
" \"col_rating\": \"Rating\",\n",
" \"col_timestamp\": \"Timestamp\",\n",
"}\n",
"\n",
"# read data\n",
"data_pickle_path = os.path.join(args.data_folder, args.data_file)\n",
"data = pd.read_pickle(path=data_pickle_path)\n",
"\n",
"# Log arguments to the run for tracking\n",
"run.log(\"top-k\", args.top_k)\n",
"run.log(\"data-size\", args.data_size)\n",
"\n",
"# split dataset into train and test\n",
"train, test = python_stratified_split(data, ratio=0.75, col_user=header[\"col_user\"], col_item=header[\"col_item\"], seed=42)\n",
"\n",
"# instantiate the model\n",
"model = SARSingleNode(\n",
" similarity_type=\"jaccard\", \n",
" time_decay_coefficient=30, \n",
" time_now=None, \n",
" timedecay_formula=True, \n",
" **header\n",
")\n",
"\n",
"# train the SAR model\n",
"with Timer() as t:\n",
" model.fit(train)\n",
"\n",
"run.log(name=\"Training time\", value=t.interval)\n",
"\n",
"# predict top k items\n",
"with Timer() as t:\n",
" top_k = model.recommend_k_items(test, remove_seen=True)\n",
"\n",
"run.log(name=\"Prediction time\", value=t.interval)\n",
"\n",
"# compute evaluation metrics\n",
"eval_map = map_at_k(test, top_k, col_user=\"UserId\", col_item=\"MovieId\", \n",
" col_rating=\"Rating\", col_prediction=\"prediction\", \n",
" relevancy_method=\"top_k\", k=args.top_k)\n",
"eval_ndcg = ndcg_at_k(test, top_k, col_user=\"UserId\", col_item=\"MovieId\", \n",
" col_rating=\"Rating\", col_prediction=\"prediction\", \n",
" relevancy_method=\"top_k\", k=args.top_k)\n",
"eval_precision = precision_at_k(test, top_k, col_user=\"UserId\", col_item=\"MovieId\", \n",
" col_rating=\"Rating\", col_prediction=\"prediction\", \n",
" relevancy_method=\"top_k\", k=args.top_k)\n",
"eval_recall = recall_at_k(test, top_k, col_user=\"UserId\", col_item=\"MovieId\", \n",
" col_rating=\"Rating\", col_prediction=\"prediction\", \n",
" relevancy_method=\"top_k\", k=args.top_k)\n",
"\n",
"run.log(\"map\", eval_map)\n",
"run.log(\"ndcg\", eval_ndcg)\n",
"run.log(\"precision\", eval_precision)\n",
"run.log(\"recall\", eval_recall)\n",
"\n",
"# automatic upload of everything in ./output folder doesn't work for very large model file\n",
"# model file has to be saved to a temp location, then uploaded by upload_file function\n",
"joblib.dump(value=model, filename=MODEL_FILE_NAME)\n",
"\n",
"run.upload_file(OUTPUT_FILE_NAME, MODEL_FILE_NAME)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/tmp/tmp6imrlt0z/movielens-sar/recommenders'"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# copy dependent python files\n",
"UTILS_DIR = os.path.join(SCRIPT_DIR, 'recommenders')\n",
"if os.path.exists(UTILS_DIR):\n",
" shutil.rmtree(UTILS_DIR)\n",
"shutil.copytree('../../recommenders/', UTILS_DIR)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Run training script\n",
"### 1. Create an estimator\n",
"An [estimator](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-train-ml-models) object is used to submit the run. You can create and use a generic Estimator to submit a training script using any learning framework you choose (such as scikit-learn) you want to run on any compute target, whether it's your local machine, a single VM in Azure, or a GPU cluster in Azure. \n",
"\n",
"Create your estimator by running the following code to define: \n",
"* The name of the estimator object, `est`\n",
"* The directory that contains your scripts. All the files in this directory are uploaded into the cluster nodes for execution. \n",
"* The compute target. In this case you will use the AzureML Compute you created\n",
"* The training script name, train.py\n",
"* Parameters required from the training script \n",
"* Python packages needed for training\n",
"* Connect to the data files in the datastore\n",
"\n",
"In this tutorial, this target is AzureML Compute. All files in the script folder are uploaded into the cluster nodes for execution. `ds.as_mount()` mounts a datastore on the remote compute and returns the folder. See documentation [here](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-access-data#access-datastores-during-training)."
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"tags": [
"configure estimator"
]
},
"outputs": [],
"source": [
"script_params = {\n",
" '--data-folder': ds.as_mount(),\n",
" '--data-file': 'movielens/' + data_file_name,\n",
" '--top-k': TOP_K,\n",
" '--data-size': MOVIELENS_DATA_SIZE\n",
"}\n",
"\n",
"est = Estimator(source_directory=SCRIPT_DIR,\n",
" script_params=script_params,\n",
" compute_target=compute_target,\n",
" entry_script='train.py',\n",
" conda_packages=['pandas'],\n",
" pip_packages=['sklearn', 'tqdm'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2. Submit the job to the cluster\n",
"An [experiment](https://docs.microsoft.com/en-us/python/api/overview/azure/ml/intro?view=azure-ml-py#experiment) is a logical container in an AzureML Workspace. It hosts run records which can include run metrics and output artifacts from your experiments. We access an experiment from our AzureML workspace by name, which will be created if it doesn't exist.\n",
"\n",
"Then, run the experiment by submitting the estimator object."
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [],
"source": [
"# create experiment\n",
"EXPERIMENT_NAME = 'movielens-sar'\n",
"exp = Experiment(workspace=ws, name=EXPERIMENT_NAME)\n",
"\n",
"run = exp.submit(config=est)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"### 3. Monitor remote run\n",
"\n",
"#### Jupyter widget\n",
"\n",
"Jupyter widget can watch the progress of the run. Like the run submission, the widget is asynchronous and provides live updates every 10-15 seconds until the job completes."
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "145080f4fc0e47c8a892ff7db3f3c08b",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"_UserRunWidget(widget_settings={'childWidgetDisplay': 'popup', 'send_telemetry': False, 'log_level': 'INFO', '…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"RunDetails(run).show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 4. Viewing run results\n",
"Azure Machine Learning stores all the details about the run in the Azure cloud. Let's access those details by retrieving a link to the run using the default run output. Clicking on the resulting link will take you to an interactive page."
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table style=\"width:100%\"><tr><th>Experiment</th><th>Id</th><th>Type</th><th>Status</th><th>Details Page</th><th>Docs Page</th></tr><tr><td>movielens-sar</td><td>movielens-sar_1575027796_199dd2c6</td><td>azureml.scriptrun</td><td>Completed</td><td><a href=\"https://mlworkspace.azure.ai/portal/subscriptions/0ca618d2-22a8-413a-96d0-0f1b531129c3/resourceGroups/recommenders_project_resources/providers/Microsoft.MachineLearningServices/workspaces/reco_azureml/experiments/movielens-sar/runs/movielens-sar_1575027796_199dd2c6\" target=\"_blank\" rel=\"noopener\">Link to Azure Portal</a></td><td><a href=\"https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.script_run.ScriptRun?view=azure-ml-py\" target=\"_blank\" rel=\"noopener\">Link to Documentation</a></td></tr></table>"
],
"text/plain": [
"Run(Experiment: movielens-sar,\n",
"Id: movielens-sar_1575027796_199dd2c6,\n",
"Type: azureml.scriptrun,\n",
"Status: Completed)"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"run"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Above cell should output similar table as below.\n",
"\n",
"After clicking \"Link to Azure Portal\", experiment run details tab looks like this with logged metrics.\n",
""
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'top-k': 10,\n",
" 'data-size': '100k',\n",
" 'Training time': 0.4077951559999633,\n",
" 'Prediction time': 0.13354294300000902,\n",
" 'map': 0.11059057578638949,\n",
" 'ndcg': 0.3824612290501957,\n",
" 'precision': 0.33075291622481445,\n",
" 'recall': 0.1763854474342893}"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# run below after run is complete, otherwise metrics is empty\n",
"metrics = run.get_metrics()\n",
"metrics"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Deprovision compute resource\n",
"To avoid unnecessary charges, if you created compute target that doesn't scale down to 0, make sure the compute target is deprovisioned after use."
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [],
"source": [
"# delete () is used to deprovision and delete the AzureML Compute target. \n",
"# do not run below before experiment completes\n",
"\n",
"# compute_target.delete()\n",
"\n",
"# deletion will take a few minutes. You can check progress in Azure Portal / Computing tab"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [],
"source": [
"# clean up temporary directory\n",
"tmp_dir.cleanup()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python (reco_base)",
"language": "python",
"name": "reco_base"
},
"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.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
} | Jupyter Notebook | 5 | enowy/Recommenders | examples/00_quick_start/sar_movielens_with_azureml.ipynb | [
"MIT"
] |
Terminals unused in grammar
illegal
tkRCurl
Gramatika
0 $accept: spec $end
1 spec: defs tkMark rules tail
2 tail: %empty
3 | tkMark
4 defs: %empty
5 | defs def
6 def: tkStart tkIdent
7 | tkUnion
8 | tkLCurl
9 | tkErrorVerbose
10 | rword tag nlist
11 rword: tkToken
12 | tkLeft
13 | tkRight
14 | tkNonAssoc
15 | tkType
16 tag: %empty
17 | '<' tkIdent '>'
18 nlist: nmno
19 | nlist nmno
20 nmno: tkIdent
21 | tkIdent tkNumber
22 rules: tkCIdent rbody prec
23 | rules rule
24 rule: tkCIdent rbody prec
25 | '|' rbody prec
26 rbody: %empty
27 | rbody tkIdent
28 | rbody act
29 act: '{'
30 prec: %empty
31 | tkPrec tkIdent
32 | tkPrec tkIdent act
33 | prec ';'
Terminály s pravidly, ve kterých se objevují
$end (0) 0
';' (59) 33
'<' (60) 17
'>' (62) 17
'{' (123) 29
'|' (124) 25
error (256)
illegal (258)
tkIdent (259) 6 17 20 21 27 31 32
tkCIdent (260) 22 24
tkNumber (261) 21
tkLeft (262) 12
tkRight (263) 13
tkNonAssoc (264) 14
tkToken (265) 11
tkPrec (266) 31 32
tkType (267) 15
tkStart (268) 6
tkUnion (269) 7
tkErrorVerbose (270) 9
tkMark (271) 1 3
tkLCurl (272) 8
tkRCurl (273)
Neterminály s pravidly, ve kterých se objevují
$accept (24)
vlevo: 0
spec (25)
vlevo: 1, vpravo: 0
tail (26)
vlevo: 2 3, vpravo: 1
defs (27)
vlevo: 4 5, vpravo: 1 5
def (28)
vlevo: 6 7 8 9 10, vpravo: 5
rword (29)
vlevo: 11 12 13 14 15, vpravo: 10
tag (30)
vlevo: 16 17, vpravo: 10
nlist (31)
vlevo: 18 19, vpravo: 10 19
nmno (32)
vlevo: 20 21, vpravo: 18 19
rules (33)
vlevo: 22 23, vpravo: 1 23
rule (34)
vlevo: 24 25, vpravo: 23
rbody (35)
vlevo: 26 27 28, vpravo: 22 24 25 27 28
act (36)
vlevo: 29, vpravo: 28 32
prec (37)
vlevo: 30 31 32 33, vpravo: 22 24 25 33
State 0
0 $accept: . spec $end
1 spec: . defs tkMark rules tail
4 defs: . %empty
5 | . defs def
$výchozí reduce using rule 4 (defs)
spec přejít do stavu 1
defs přejít do stavu 2
State 1
0 $accept: spec . $end
$end posunout a přejít do stavu 3
State 2
1 spec: defs . tkMark rules tail
5 defs: defs . def
6 def: . tkStart tkIdent
7 | . tkUnion
8 | . tkLCurl
9 | . tkErrorVerbose
10 | . rword tag nlist
11 rword: . tkToken
12 | . tkLeft
13 | . tkRight
14 | . tkNonAssoc
15 | . tkType
tkLeft posunout a přejít do stavu 4
tkRight posunout a přejít do stavu 5
tkNonAssoc posunout a přejít do stavu 6
tkToken posunout a přejít do stavu 7
tkType posunout a přejít do stavu 8
tkStart posunout a přejít do stavu 9
tkUnion posunout a přejít do stavu 10
tkErrorVerbose posunout a přejít do stavu 11
tkMark posunout a přejít do stavu 12
tkLCurl posunout a přejít do stavu 13
def přejít do stavu 14
rword přejít do stavu 15
State 3
0 $accept: spec $end .
$výchozí přijmout
State 4
12 rword: tkLeft .
$výchozí reduce using rule 12 (rword)
State 5
13 rword: tkRight .
$výchozí reduce using rule 13 (rword)
State 6
14 rword: tkNonAssoc .
$výchozí reduce using rule 14 (rword)
State 7
11 rword: tkToken .
$výchozí reduce using rule 11 (rword)
State 8
15 rword: tkType .
$výchozí reduce using rule 15 (rword)
State 9
6 def: tkStart . tkIdent
tkIdent posunout a přejít do stavu 16
State 10
7 def: tkUnion .
$výchozí reduce using rule 7 (def)
State 11
9 def: tkErrorVerbose .
$výchozí reduce using rule 9 (def)
State 12
1 spec: defs tkMark . rules tail
22 rules: . tkCIdent rbody prec
23 | . rules rule
tkCIdent posunout a přejít do stavu 17
rules přejít do stavu 18
State 13
8 def: tkLCurl .
$výchozí reduce using rule 8 (def)
State 14
5 defs: defs def .
$výchozí reduce using rule 5 (defs)
State 15
10 def: rword . tag nlist
16 tag: . %empty [tkIdent]
17 | . '<' tkIdent '>'
'<' posunout a přejít do stavu 19
$výchozí reduce using rule 16 (tag)
tag přejít do stavu 20
State 16
6 def: tkStart tkIdent .
$výchozí reduce using rule 6 (def)
State 17
22 rules: tkCIdent . rbody prec
26 rbody: . %empty
27 | . rbody tkIdent
28 | . rbody act
$výchozí reduce using rule 26 (rbody)
rbody přejít do stavu 21
State 18
1 spec: defs tkMark rules . tail
2 tail: . %empty [$end]
3 | . tkMark
23 rules: rules . rule
24 rule: . tkCIdent rbody prec
25 | . '|' rbody prec
tkCIdent posunout a přejít do stavu 22
tkMark posunout a přejít do stavu 23
'|' posunout a přejít do stavu 24
$výchozí reduce using rule 2 (tail)
tail přejít do stavu 25
rule přejít do stavu 26
State 19
17 tag: '<' . tkIdent '>'
tkIdent posunout a přejít do stavu 27
State 20
10 def: rword tag . nlist
18 nlist: . nmno
19 | . nlist nmno
20 nmno: . tkIdent
21 | . tkIdent tkNumber
tkIdent posunout a přejít do stavu 28
nlist přejít do stavu 29
nmno přejít do stavu 30
State 21
22 rules: tkCIdent rbody . prec
27 rbody: rbody . tkIdent
28 | rbody . act
29 act: . '{'
30 prec: . %empty [$end, tkCIdent, tkMark, '|', ';']
31 | . tkPrec tkIdent
32 | . tkPrec tkIdent act
33 | . prec ';'
tkIdent posunout a přejít do stavu 31
tkPrec posunout a přejít do stavu 32
'{' posunout a přejít do stavu 33
$výchozí reduce using rule 30 (prec)
act přejít do stavu 34
prec přejít do stavu 35
State 22
24 rule: tkCIdent . rbody prec
26 rbody: . %empty
27 | . rbody tkIdent
28 | . rbody act
$výchozí reduce using rule 26 (rbody)
rbody přejít do stavu 36
State 23
3 tail: tkMark .
$výchozí reduce using rule 3 (tail)
State 24
25 rule: '|' . rbody prec
26 rbody: . %empty
27 | . rbody tkIdent
28 | . rbody act
$výchozí reduce using rule 26 (rbody)
rbody přejít do stavu 37
State 25
1 spec: defs tkMark rules tail .
$výchozí reduce using rule 1 (spec)
State 26
23 rules: rules rule .
$výchozí reduce using rule 23 (rules)
State 27
17 tag: '<' tkIdent . '>'
'>' posunout a přejít do stavu 38
State 28
20 nmno: tkIdent . [tkIdent, tkLeft, tkRight, tkNonAssoc, tkToken, tkType, tkStart, tkUnion, tkErrorVerbose, tkMark, tkLCurl]
21 | tkIdent . tkNumber
tkNumber posunout a přejít do stavu 39
$výchozí reduce using rule 20 (nmno)
State 29
10 def: rword tag nlist . [tkLeft, tkRight, tkNonAssoc, tkToken, tkType, tkStart, tkUnion, tkErrorVerbose, tkMark, tkLCurl]
19 nlist: nlist . nmno
20 nmno: . tkIdent
21 | . tkIdent tkNumber
tkIdent posunout a přejít do stavu 28
$výchozí reduce using rule 10 (def)
nmno přejít do stavu 40
State 30
18 nlist: nmno .
$výchozí reduce using rule 18 (nlist)
State 31
27 rbody: rbody tkIdent .
$výchozí reduce using rule 27 (rbody)
State 32
31 prec: tkPrec . tkIdent
32 | tkPrec . tkIdent act
tkIdent posunout a přejít do stavu 41
State 33
29 act: '{' .
$výchozí reduce using rule 29 (act)
State 34
28 rbody: rbody act .
$výchozí reduce using rule 28 (rbody)
State 35
22 rules: tkCIdent rbody prec . [$end, tkCIdent, tkMark, '|']
33 prec: prec . ';'
';' posunout a přejít do stavu 42
$výchozí reduce using rule 22 (rules)
State 36
24 rule: tkCIdent rbody . prec
27 rbody: rbody . tkIdent
28 | rbody . act
29 act: . '{'
30 prec: . %empty [$end, tkCIdent, tkMark, '|', ';']
31 | . tkPrec tkIdent
32 | . tkPrec tkIdent act
33 | . prec ';'
tkIdent posunout a přejít do stavu 31
tkPrec posunout a přejít do stavu 32
'{' posunout a přejít do stavu 33
$výchozí reduce using rule 30 (prec)
act přejít do stavu 34
prec přejít do stavu 43
State 37
25 rule: '|' rbody . prec
27 rbody: rbody . tkIdent
28 | rbody . act
29 act: . '{'
30 prec: . %empty [$end, tkCIdent, tkMark, '|', ';']
31 | . tkPrec tkIdent
32 | . tkPrec tkIdent act
33 | . prec ';'
tkIdent posunout a přejít do stavu 31
tkPrec posunout a přejít do stavu 32
'{' posunout a přejít do stavu 33
$výchozí reduce using rule 30 (prec)
act přejít do stavu 34
prec přejít do stavu 44
State 38
17 tag: '<' tkIdent '>' .
$výchozí reduce using rule 17 (tag)
State 39
21 nmno: tkIdent tkNumber .
$výchozí reduce using rule 21 (nmno)
State 40
19 nlist: nlist nmno .
$výchozí reduce using rule 19 (nlist)
State 41
29 act: . '{'
31 prec: tkPrec tkIdent . [$end, tkCIdent, tkMark, '|', ';']
32 | tkPrec tkIdent . act
'{' posunout a přejít do stavu 33
$výchozí reduce using rule 31 (prec)
act přejít do stavu 45
State 42
33 prec: prec ';' .
$výchozí reduce using rule 33 (prec)
State 43
24 rule: tkCIdent rbody prec . [$end, tkCIdent, tkMark, '|']
33 prec: prec . ';'
';' posunout a přejít do stavu 42
$výchozí reduce using rule 24 (rule)
State 44
25 rule: '|' rbody prec . [$end, tkCIdent, tkMark, '|']
33 prec: prec . ';'
';' posunout a přejít do stavu 42
$výchozí reduce using rule 25 (rule)
State 45
32 prec: tkPrec tkIdent act .
$výchozí reduce using rule 32 (prec)
| Bison | 3 | YKG/y | testdata/ok/yacc.y.bison | [
"BSD-3-Clause"
] |
<!-- Processed by Id: cwm.py,v 1.197 2007/12/13 15:38:39 syosi Exp -->
<!-- using base file:///Users/markw/Documents/WORK/ruby_scripting_book/src/part2/data/rdfs_sample_1.n3-->
<rdf:RDF xmlns="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Class rdf:about="http://knowledgebooks.com/test#Business">
<label>Business</label>
<subClassOf rdf:resource="http://knowledgebooks.com/test#Organization"/>
</Class>
<Class rdf:about="http://knowledgebooks.com/test#Customer">
<label>Customer</label>
<subClassOf rdf:resource="http://knowledgebooks.com/test#Business"/>
</Class>
<Class rdf:about="http://knowledgebooks.com/test#Organization">
<label>Organization</label>
</Class>
<rdf:Property rdf:about="http://knowledgebooks.com/test#organizationName">
<domain rdf:resource="http://knowledgebooks.com/test#Organization"/>
<range rdf:resource="http://www.w3.org/2001/XMLSchema#stringstring"/>
</rdf:Property>
</rdf:RDF>
| Web Ontology Language | 4 | stephensheridan/Java-AI-Book-Code | semantic_web_apache_jena/data/rdfs_sample_1.owl | [
"Apache-2.0"
] |
Listen 8090
<VirtualHost *:8090>
ServerName 127.0.0.1
DocumentRoot /var/www/html/public
DirectoryIndex index.php
<Directory "/var/www/html/public">
AllowOverride All
</Directory>
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
</VirtualHost> | ApacheConf | 3 | SpecialDragonfly/SimulationX | Service/Api/apache/dev.vhost | [
"MIT"
] |
import 'package:dio/dio.dart';
class CacheInterceptor extends Interceptor {
CacheInterceptor();
final _cache = <Uri, Response>{};
@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
var response = _cache[options.uri];
if (options.extra['refresh'] == true) {
print('${options.uri}: force refresh, ignore cache! \n');
return handler.next(options);
} else if (response != null) {
print('cache hit: ${options.uri} \n');
return handler.resolve(response);
}
super.onRequest(options, handler);
}
@override
void onResponse(Response response, ResponseInterceptorHandler handler) {
_cache[response.requestOptions.uri] = response;
super.onResponse(response, handler);
}
@override
void onError(DioError err, ErrorInterceptorHandler handler) {
print('onError: $err');
super.onError(err, handler);
}
}
void main() async {
var dio = Dio();
dio.options.baseUrl = 'https://baidu.com';
dio.interceptors
..add(CacheInterceptor())
..add(LogInterceptor(requestHeader: false, responseHeader: false));
await dio.get('/'); // second request
await dio.get('/'); // Will hit cache
// Force refresh
await dio.get('/', options: Options(extra: {'refresh': true}));
}
| Dart | 5 | rockyoung/dio | example/custom_cache_interceptor.dart | [
"MIT"
] |
#!/usr/bin/env python
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
"""
Utility script used to easily run the build_swift module unit tests.
"""
from __future__ import absolute_import, unicode_literals
import argparse
import os
import sys
import unittest
MODULE_DIR = os.path.abspath(os.path.dirname(__file__))
UTILS_DIR = os.path.abspath(os.path.join(MODULE_DIR, os.pardir))
def parse_args():
parser = argparse.ArgumentParser(
description='Utility script used to run the build_swift module unit '
'test suite.')
parser.set_defaults(verbosity=1)
parser.add_argument('-v', '--verbose',
dest='verbosity',
action='store_const',
const=2,
help='Verbose output')
parser.add_argument('-q', '--quiet',
dest='verbosity',
action='store_const',
const=0,
help='Minimal output')
parser.add_argument('-f', '--failfast',
action='store_true',
help='Stop on first failure')
parser.add_argument('-c', '--catch',
action='store_true',
help='Catch control-C and display results')
parser.add_argument('-b', '--buffer',
action='store_true',
help='Buffer stdout and stderr during test runs')
parser.add_argument('-p', '--pattern',
default='test*.py',
help='Pattern to match tests ("%(default)s" default)')
return parser.parse_args()
def main():
args = parse_args()
if args.catch:
unittest.installHandler()
runner = unittest.TextTestRunner(
verbosity=args.verbosity,
failfast=args.failfast,
buffer=args.buffer)
# Add the swift/utils directory to the Python path.
sys.path.append(UTILS_DIR)
# Discover all tests for the module.
module_tests = unittest.defaultTestLoader.discover(
MODULE_DIR, pattern=args.pattern)
# Create and run test suite.
suite = unittest.TestSuite()
suite.addTests(module_tests)
result = runner.run(suite)
return not result.wasSuccessful()
if __name__ == '__main__':
sys.exit(main())
| Python | 5 | gandhi56/swift | utils/build_swift/run_tests.py | [
"Apache-2.0"
] |
#%RAML 1.0
title: API for REST Services used in the RAML tutorials on Baeldung.com
documentation:
- title: Overview
- content: |
This document defines the interface for the REST services
used in the popular RAML Tutorial series at Baeldung.com.
- title: Disclaimer:
- content: |
All names used in this definition are purely fictional.
Any similarities between the names used in this tutorial and those of real persons, whether living or dead, are merely coincidental.
- title: Copyright
- content: Copyright 2016 by Baeldung.com. All rights reserved.
uses:
mySecuritySchemes: !include libraries/security.raml
myDataTypes: !include libraries/dataTypes.raml
myResourceTypes: !include libraries/resourceTypes.raml
myTraits: !include libraries/traits.raml
version: v1
protocols: [ HTTPS ]
baseUri: http://rest-api.baeldung.com/api/{version}
mediaType: application/json
securedBy: [ mySecuritySchemes.basicAuth ]
/foos:
type: myResourceTypes.collection
typeName: myDataTypes.Foo
get:
queryParameters:
name?: string
ownerName?: string
/{fooId}:
type: myResourceTypes.item
typeName: myDataTypes.Foo
/name/{name}:
get:
description: List all foos with a certain name
typeName: myDataTypes.Foo
is: [ myTraits.hasResponseCollection ]
/bars:
type: myResourceTypes.collection
typeName: myDataTypes.Bar
/{barId}:
type: myResourceTypes.item
typeName: myDataTypes.Bar
/fooId/{fooId}:
get:
description: Get all bars for the matching fooId
type: myResourceTypes.item
typeName: myDataTypes.Bar
is: [ myTraits.hasResponseCollection ] | RAML | 4 | zeesh49/tutorials | raml/modularization/api-with-libraries.raml | [
"MIT"
] |
.unsupported-desktop-browser {
@include absoluteAligning();
display: block;
text-align: center;
&__title {
color: $unsupportedBrowserTitleColor;
font-weight: 300;
font-size: $unsupportedBrowserTitleFontSize;
letter-spacing: 1px;
}
&__description {
color: $unsupportedDesktopBrowserTextColor;
font-size: $unsupportedDesktopBrowserTextFontSize;
font-weight: 300;
letter-spacing: 1px;
margin-top: 16px;
&_small {
@extend .unsupported-desktop-browser__description;
font-size: $unsupportedBrowserTextSmallFontSize;
}
}
&__link {
color: $linkFontColor;
@include transition(color .1s ease-out);
&:hover {
color: $linkHoverFontColor;
cursor: pointer;
text-decoration: none;
@include transition(color .1s ease-in);
}
}
}
| SCSS | 3 | citygxoxo/jitsi-meet | css/unsupported-browser/_unsupported-desktop-browser.scss | [
"Apache-2.0"
] |
#![allow(
unused_variables,
clippy::blacklisted_name,
clippy::needless_pass_by_value,
dead_code
)]
/// This should not compile-fail with:
///
/// error[E0277]: the trait bound `T: Foo` is not satisfied
// See rust-lang/rust-clippy#2760.
trait Foo {
type Bar;
}
struct Baz<T: Foo> {
bar: T::Bar,
}
fn take<T: Foo>(baz: Baz<T>) {}
fn main() {}
| Rust | 4 | Eric-Arellano/rust | src/tools/clippy/tests/ui/crashes/ice-2760.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
.css-url-relative-at-imported {
background: url(../../nested/asset.png);
background-size: 10px;
}
| CSS | 2 | laineus/vite | packages/playground/assets/css/nested/at-imported-css-url.css | [
"MIT"
] |
desc_sv=Fildelning med Samba
| SystemVerilog | 0 | GalaxyGFX/webmin | samba/module.info.sv | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] |
# A Script to try and create the table for the readme.md file
# | Category | File |
# | ---------------- | ----------------------------------------------------------------------------- |
# | coloring | [24bit-1.nu](./coloring\24bit-1.nu) |
# | coloring | [color_table.nu](./coloring\color_table.nu) |
# | coloring | [color_tables.nu](./coloring\color_tables.nu) |
# | coloring | [gradient.nu](./coloring\gradient.nu) |
# Right now there is still manual manipulation in order to update the README.md
# Hopefully, in the future someone will contribute a script to make this automatic.
let nu_files = (ls **/*.nu)
let nu_table = ($nu_files |
get name |
wrap File |
insert Category { |it|
let cat = ($it.File | path dirname)
if $cat == "" {
"not assigned yet"
} {
$cat
}
} | where Category !~ ".git" | select Category File | sort-by Category)
# Let's fix the file now
let nu_table = ($nu_table | update File { |it|
let file_path = ($it.File | into string | str find-replace '\\' '/')
let file_name = ($file_path | path basename)
$"[($file_name)](char lparen)./($file_path)(char rparen)"
})
echo $nu_table | to md --pretty
| Nu | 4 | x3rAx/nu_scripts | make_readme_table.nu | [
"MIT"
] |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?python import sitetemplate ?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" py:extends="sitetemplate">
<head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'" py:attrs="item.items()">
<meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
<title py:replace="''">Video Store</title>
<meta py:replace="item[:]"/>
<style type="text/css" media="screen">
@import "/static/css/style.css";
@import "/static/css/login.css";
</style>
</head>
<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'" py:attrs="item.items()">
<div py:if="tg.config('identity.on', False) and not 'logging_in' in locals()" id="pageLogin">
<span py:if="tg.identity.anonymous">
<a href="/login">Login</a>
</span>
<span py:if="not tg.identity.anonymous">
Welcome ${tg.identity.user.display_name}.
<a href="/logout">Logout</a>
</span>
</div>
<div py:if="value_of('tg_flash', None)" class="flash" py:content="tg_flash"></div>
<div py:replace="[item.text]+item[:]"/>
</body>
</html>
| Genshi | 4 | ChowNow/elixir | examples/videostore/videostore/templates/master.kid | [
"MIT"
] |
abstract class A { abstract Str x }
class B : A { override Str x } | Fantom | 2 | fanx-dev/fanx | compiler/testCompilerx/res/regression/test1482.fan | [
"AFL-3.0"
] |
#include <PJONOverSampling.h>
// Bus id definition
uint8_t bus_id[] = {0, 0, 0, 1};
// PJON object
PJONOverSampling bus(bus_id, 45);
void receiver_function(uint8_t *payload, uint16_t length, const PJON_Packet_Info &packet_info) {
/* Make use of the payload before sending something, the buffer where payload points to is
overwritten when a new message is dispatched */
Serial.print("Receiver bus id: ");
Serial.print(packet_info.rx.bus_id[0]);
Serial.print(packet_info.rx.bus_id[1]);
Serial.print(packet_info.rx.bus_id[2]);
Serial.print(packet_info.rx.bus_id[3]);
Serial.print(" - device id: ");
Serial.println(packet_info.rx.id);
Serial.print("Sender bus id: ");
Serial.print(packet_info.tx.bus_id[0]);
Serial.print(packet_info.tx.bus_id[1]);
Serial.print(packet_info.tx.bus_id[2]);
Serial.print(packet_info.tx.bus_id[3]);
Serial.print(" - device id: ");
Serial.println(packet_info.tx.id);
if((char)payload[0] == 'B') {
digitalWrite(LED_BUILTIN, HIGH);
delay(5);
digitalWrite(LED_BUILTIN, LOW);
delay(5);
}
};
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW); // Initialize LED 13 to be off
/* When using more than one pin always use pins connected to
a different port group to avoid cross-talk. */
bus.strategy.set_pins(7, 12);
bus.set_acknowledge(false);
bus.set_receiver(receiver_function);
bus.begin();
bus.send_repeatedly(44, "B", 1, 1000000);
Serial.begin(115200);
};
void loop() {
bus.receive();
bus.update();
};
| Arduino | 4 | jcallano/PJON | examples/ARDUINO/Network/OverSampling/HalfDuplexNoAcknowledge/Device2/Device2.ino | [
"Apache-2.0"
] |
SUMMARY = "bitbake-layers recipe"
DESCRIPTION = "Recipe created by bitbake-layers"
LICENSE = "MIT"
inherit core-image
IMAGE_INSTALL += "openssh hostapd dnsmasq userland initscript rtsp-server wpa-supplicant exfat-utils fuse-exfat main paho-mqtt-c pear libnice curl gdbserver watchdog"
| BitBake | 3 | abir1999/xiaoPi | bsp/meta-xiaopi/recipes-images/xiaopi/xiaopi_0.1.bb | [
"Unlicense"
] |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="//use.edgefonts.net/source-code-pro.js"></script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' rel='stylesheet' type='text/css'>
<!-- there are many other style for highlighted code here: https://cdnjs.com/libraries/highlight.js -->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/styles/atelier-forest.light.min.css">
<link rel="stylesheet" type="text/css" href="css/api-docs.css">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
</head>
<body>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script>
<script src="js/doc-data.js"></script>
</body>
</html>
| HTML | 2 | TradeCast/video.js | docs/legacy-docs/api/md.html | [
"Apache-2.0"
] |
local function update_particle(p)
{
p.x+=p.vx
p.y+=p.vy
p.z+=p.vz
}
local function update(particles)
{
foreach(p in particles) {
update_particle(p)
}
}
local function update_several_times(particles, count)
{
for (local i = 0; i < count; ++i)
{
update(particles)
}
}
local function update_several_timesI(particles, count)
{
for (local i = 0; i < count; ++i)
{
foreach(p in particles) {
p.x+=p.vx
p.y+=p.vy
p.z+=p.vz
}
}
}
particles <- []
for (local i = 0; i < 50000; ++i)
{
particles.push(
{
x = i + 0.1, y = i + 0.2, z = i + 0.3,
vx = 1.1, vy = 2.1, vz = 3.1
})
}
loadfile("profile.nut")()
print("particles kinematics: " + profile_it(20, function () {update_several_times(particles, 100) }) + "\n")
print("particles kinematics inline: " + profile_it(20, function () {update_several_timesI(particles, 100)}) + "\n")
| Squirrel | 4 | profelis/daScript | examples/profile/tests/squirrel/particles.nut | [
"BSD-3-Clause"
] |
provider "google" {
project = var.project
region = var.region
zone = var.zone
}
terraform {
required_version = ">= 0.12"
}
data "google_compute_network" "default" {
name = var.network
}
resource "google_container_cluster" "loadtest" {
name = var.cluster_name
location = var.region
# clusters are always created with a default node pool,
# so specify the smallest allowed node count and then
# immediately delete it.
remove_default_node_pool = true
initial_node_count = 1
}
resource "google_container_node_pool" "loadtest" {
name = var.cluster_name
cluster = google_container_cluster.loadtest.name
location = google_container_cluster.loadtest.location
node_count = var.nodes_per_zone
node_locations = var.node_locations
node_config {
machine_type = "n1-standard-8"
metadata = {
disable-legacy-endpoints = "true"
}
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
"https://www.googleapis.com/auth/devstorage.read_only",
]
}
}
| HCL | 5 | zouxifeng/teleport | assets/loadtest/cluster/main.tf | [
"Apache-2.0"
] |
class A { Void make() {} }
class B { Int make }
class C : Foo { } // ok
virtual class D { static D make() { return null } private new privateMake() { return } }
class E : D {}
virtual class Foo { new make(Int x := 0) {} } | Fantom | 2 | fanx-dev/fanx | compiler/testCompilerx/res/misc/testDefaultCtor2.fan | [
"AFL-3.0"
] |
--------------------------------------------------------------------------------
-- Engineer: Mike Field <hamster@snap.net.nz>
-- Description: Converts VGA signals into DVID bitstreams.
--
-- 'blank' must be asserted during the non-display
-- portions of the frame
--
-- NOTE due to the PLL frequency limits, changes are needed in dvid_out_clocking
-- to select pixel rates between 40 and 100 Mhz pixel clocks, or between 20 and
-- 50 MHz.
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
Library UNISIM;
use UNISIM.vcomponents.all;
entity dvid_out is
Port ( -- Clocking
clk_pixel : IN std_logic;
-- Pixel data
red_p : in STD_LOGIC_VECTOR (7 downto 0);
green_p : in STD_LOGIC_VECTOR (7 downto 0);
blue_p : in STD_LOGIC_VECTOR (7 downto 0);
blank : in STD_LOGIC;
hsync : in STD_LOGIC;
vsync : in STD_LOGIC;
reset : in STD_LOGIC;
-- TMDS outputs
tmds_out_p : out STD_LOGIC_VECTOR(3 downto 0);
tmds_out_n : out STD_LOGIC_VECTOR(3 downto 0)
);
end dvid_out;
architecture Behavioral of dvid_out is
COMPONENT dvid_out_clocking
PORT(
clk_pixel : IN std_logic;
reset : IN std_logic;
clk_x1 : OUT std_logic;
clk_x2 : OUT std_logic;
clk_x10 : OUT std_logic;
serdes_strobe : OUT std_logic
);
END COMPONENT;
COMPONENT TMDS_encoder
PORT(
clk : IN std_logic;
data : IN std_logic_vector(7 downto 0);
c : IN std_logic_vector(1 downto 0);
blank : IN std_logic;
encoded : OUT std_logic_vector(9 downto 0)
);
END COMPONENT;
COMPONENT tmds_out_fifo
PORT (
wr_clk : IN STD_LOGIC;
rd_clk : IN STD_LOGIC;
din : IN STD_LOGIC_VECTOR(29 DOWNTO 0);
wr_en : IN STD_LOGIC;
rd_en : IN STD_LOGIC;
dout : OUT STD_LOGIC_VECTOR(29 DOWNTO 0);
full : OUT STD_LOGIC;
empty : OUT STD_LOGIC;
prog_empty : OUT STD_LOGIC
);
END COMPONENT;
COMPONENT output_serialiser
PORT(
clk_load : IN std_logic;
clk_output : IN std_logic;
strobe : IN std_logic;
ser_data : IN std_logic_vector(4 downto 0);
reset : IN std_logic;
ser_output : OUT std_logic
);
END COMPONENT;
signal clk_x1 : std_logic;
signal clk_x2 : std_logic;
signal clk_x10 : std_logic;
signal serdes_strobe : std_logic;
signal encoded_red, encoded_green, encoded_blue : std_logic_vector(9 downto 0);
signal latched_red, latched_green, latched_blue : std_logic_vector(9 downto 0) := (others => '0');
signal ser_in_red, ser_in_green, ser_in_blue, ser_in_clock : std_logic_vector(4 downto 0) := (others => '0');
signal fifo_in : std_logic_vector(29 downto 0);
signal fifo_out : std_logic_vector(29 downto 0);
signal rd_enable : std_logic := '0';
signal not_ready_yet : std_logic;
signal c_red : std_logic_vector(1 downto 0); -- := (others => '0');
signal c_green : std_logic_vector(1 downto 0); -- := (others => '0');
signal c_blue : std_logic_vector(1 downto 0);
signal red_s : STD_LOGIC;
signal green_s : STD_LOGIC;
signal blue_s : STD_LOGIC;
signal clock_s : STD_LOGIC;
begin
-- Send the pixels to the encoder
c_blue <= "00"; -- vsync & hsync;
c_red <= vsync & hsync;
c_green <= "00"; -- vsync & hsync;
TMDS_encoder_red: TMDS_encoder PORT MAP(clk => clk_pixel, data => red_p, c => c_red, blank => blank, encoded => encoded_red);
TMDS_encoder_green: TMDS_encoder PORT MAP(clk => clk_pixel, data => green_p, c => c_green, blank => blank, encoded => encoded_green);
TMDS_encoder_blue: TMDS_encoder PORT MAP(clk => clk_pixel, data => blue_p, c => c_blue, blank => blank, encoded => encoded_blue);
-- Then to a small FIFO
fifo_in <= encoded_red & encoded_green & encoded_blue;
Inst_dvid_out_clocking: dvid_out_clocking PORT MAP(
clk_pixel => clk_pixel,
clk_x1 => clk_x1,
clk_x2 => clk_x2,
clk_x10 => clk_x10,
serdes_strobe => serdes_strobe,
reset => reset
);
out_fifo: tmds_out_fifo PORT MAP (
wr_clk => clk_pixel,
din => fifo_in,
wr_en => '1',
full => open,
rd_clk => clk_x2,
rd_en => rd_enable,
dout => fifo_out,
empty => open,
prog_empty => not_ready_yet
);
-- Now at a x2 clock, send the data from the fifo to the serialisers
process(clk_x2)
begin
if rising_edge(clk_x2) then
if not_ready_yet = '0' then
if rd_enable = '1' then
ser_in_red <= fifo_out(29 downto 25);
ser_in_green <= fifo_out(19 downto 15);
ser_in_blue <= fifo_out( 9 downto 5);
ser_in_clock <= "11111";
rd_enable <= '0';
else
ser_in_red <= fifo_out(24 downto 20);
ser_in_green <= fifo_out(14 downto 10);
ser_in_blue <= fifo_out( 4 downto 0);
ser_in_clock <= "00000";
rd_enable <= '1';
end if;
end if;
end if;
end process;
-- The Serialisers
output_serialiser_r: output_serialiser PORT MAP(clk_load => clk_x2, clk_output => clk_x10, strobe => serdes_strobe, ser_data => ser_in_red, ser_output => red_s, reset => reset);
output_serialiser_g: output_serialiser PORT MAP(clk_load => clk_x2, clk_output => clk_x10, strobe => serdes_strobe, ser_data => ser_in_green, ser_output => green_s, reset => reset);
output_serialiser_b: output_serialiser PORT MAP(clk_load => clk_x2, clk_output => clk_x10, strobe => serdes_strobe, ser_data => ser_in_blue, ser_output => blue_s, reset => reset);
output_serialiser_c: output_serialiser PORT MAP(clk_load => clk_x2, clk_output => clk_x10, strobe => serdes_strobe, ser_data => ser_in_clock, ser_output => clock_s, reset => reset);
-- The output buffers/drivers
OBUFDS_red : OBUFDS port map ( O => tmds_out_p(0), OB => tmds_out_n(0), I => red_s);
OBUFDS_green : OBUFDS port map ( O => tmds_out_p(1), OB => tmds_out_n(1), I => green_s);
OBUFDS_blue : OBUFDS port map ( O => tmds_out_p(2), OB => tmds_out_n(2), I => blue_s);
OBUFDS_clock : OBUFDS port map ( O => tmds_out_p(3), OB => tmds_out_n(3), I => clock_s);
end Behavioral; | VHDL | 5 | AmigaPorts/amiga2000-gfxcard | va2000-spartan6/dvid_out.vhd | [
"MIT",
"IJG",
"Unlicense"
] |
'use strict';
/**
* `{{ name }}` middleware.
*/
module.exports = (config, { strapi }) => {
// Add your own logic here.
return async (ctx, next) => {
strapi.log.info('In {{ name }} middleware.');
await next();
};
};
| Handlebars | 4 | Mithenks/strapi | packages/generators/generators/lib/templates/middleware.js.hbs | [
"MIT"
] |
CACHE>WRITE $DATA(VARI)
0
CACHE>SET VARI="HELLO" WRITE $DATA(VARI)
1
CACHE>NEW VARI WRITE $DATA(VARI) ;Change to a new scope
0
CACHE 1S1>SET VARI(1,2)="DOWN" WRITE $DATA(VARI)
10
CACHE 1S1>WRITE $DATA(VARI(1))
10
CACHE 1S1>WRITE $D(VARI(1,2))
1
CACHE 1S1>SET VARI(1)="UP" WRITE $DATA(VARI(1))
11
<CACHE 1S1>QUIT ;Leave the scope
<CACHE>W $DATA(VARI)," ",VARI
1 HELLO
| M | 4 | LaudateCorpus1/RosettaCodeData | Task/Null-object/MUMPS/null-object.mumps | [
"Info-ZIP"
] |
BcJ | PureBasic | 1 | dennyac/onnxruntime | onnxruntime/test/testdata/transform/gemm_activation_fusion/test_data_set_0/input_2.pb | [
"MIT"
] |
# phpenv
> A PHP version manager for development purposes.
> More information: <https://github.com/phpenv/phpenv>.
- Install a PHP version globally:
`phpenv install {{version}}`
- Refresh shim files for all PHP binaries known to `phpenv`:
`phpenv rehash`
- List all installed PHP versions:
`phpenv versions`
- Display the currently active PHP version:
`phpenv version`
- Set the global PHP version:
`phpenv global {{version}}`
- Set the local PHP version, which overrides the global version:
`phpenv local {{version}}`
- Unset the local PHP version:
`phpenv local --unset`
| Markdown | 3 | pavelshtanko/tldr | pages/common/phpenv.md | [
"CC-BY-4.0"
] |
"""Test the Control4 config flow."""
import datetime
from unittest.mock import AsyncMock, patch
from pyControl4.account import C4Account
from pyControl4.director import C4Director
from pyControl4.error_handling import Unauthorized
from homeassistant import config_entries
from homeassistant.components.control4.const import DEFAULT_SCAN_INTERVAL, DOMAIN
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_SCAN_INTERVAL,
CONF_USERNAME,
)
from tests.common import MockConfigEntry
def _get_mock_c4_account(
getAccountControllers={
"controllerCommonName": "control4_model_00AA00AA00AA",
"href": "https://apis.control4.com/account/v3/rest/accounts/000000",
"name": "Name",
},
getDirectorBearerToken={
"token": "token",
"token_expiration": datetime.datetime(2020, 7, 15, 13, 50, 15, 26940),
},
):
c4_account_mock = AsyncMock(C4Account)
c4_account_mock.getAccountControllers.return_value = getAccountControllers
c4_account_mock.getDirectorBearerToken.return_value = getDirectorBearerToken
return c4_account_mock
def _get_mock_c4_director(getAllItemInfo={}):
c4_director_mock = AsyncMock(C4Director)
c4_director_mock.getAllItemInfo.return_value = getAllItemInfo
return c4_director_mock
async def test_form(hass):
"""Test we get the form."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["errors"] == {}
c4_account = _get_mock_c4_account()
c4_director = _get_mock_c4_director()
with patch(
"homeassistant.components.control4.config_flow.C4Account",
return_value=c4_account,
), patch(
"homeassistant.components.control4.config_flow.C4Director",
return_value=c4_director,
), patch(
"homeassistant.components.control4.async_setup_entry",
return_value=True,
) as mock_setup_entry:
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"],
{
CONF_HOST: "1.1.1.1",
CONF_USERNAME: "test-username",
CONF_PASSWORD: "test-password",
},
)
await hass.async_block_till_done()
assert result2["type"] == "create_entry"
assert result2["title"] == "control4_model_00AA00AA00AA"
assert result2["data"] == {
CONF_HOST: "1.1.1.1",
CONF_USERNAME: "test-username",
CONF_PASSWORD: "test-password",
"controller_unique_id": "control4_model_00AA00AA00AA",
}
assert len(mock_setup_entry.mock_calls) == 1
async def test_form_invalid_auth(hass):
"""Test we handle invalid auth."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.control4.config_flow.C4Account",
side_effect=Unauthorized("message"),
):
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"],
{
CONF_HOST: "1.1.1.1",
CONF_USERNAME: "test-username",
CONF_PASSWORD: "test-password",
},
)
assert result2["type"] == "form"
assert result2["errors"] == {"base": "invalid_auth"}
async def test_form_unexpected_exception(hass):
"""Test we handle an unexpected exception."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.control4.config_flow.C4Account",
side_effect=ValueError("message"),
):
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"],
{
CONF_HOST: "1.1.1.1",
CONF_USERNAME: "test-username",
CONF_PASSWORD: "test-password",
},
)
assert result2["type"] == "form"
assert result2["errors"] == {"base": "unknown"}
async def test_form_cannot_connect(hass):
"""Test we handle cannot connect error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.control4.config_flow.Control4Validator.authenticate",
return_value=True,
), patch(
"homeassistant.components.control4.config_flow.C4Director",
side_effect=Unauthorized("message"),
):
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"],
{
CONF_HOST: "1.1.1.1",
CONF_USERNAME: "test-username",
CONF_PASSWORD: "test-password",
},
)
assert result2["type"] == "form"
assert result2["errors"] == {"base": "cannot_connect"}
async def test_option_flow(hass):
"""Test config flow options."""
entry = MockConfigEntry(domain=DOMAIN, data={}, options=None)
entry.add_to_hass(hass)
result = await hass.config_entries.options.async_init(entry.entry_id)
assert result["type"] == "form"
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
result["flow_id"],
user_input={CONF_SCAN_INTERVAL: 4},
)
assert result["type"] == "create_entry"
assert result["data"] == {
CONF_SCAN_INTERVAL: 4,
}
async def test_option_flow_defaults(hass):
"""Test config flow options."""
entry = MockConfigEntry(domain=DOMAIN, data={}, options=None)
entry.add_to_hass(hass)
result = await hass.config_entries.options.async_init(entry.entry_id)
assert result["type"] == "form"
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
result["flow_id"], user_input={}
)
assert result["type"] == "create_entry"
assert result["data"] == {
CONF_SCAN_INTERVAL: DEFAULT_SCAN_INTERVAL,
}
| Python | 5 | MrDelik/core | tests/components/control4/test_config_flow.py | [
"Apache-2.0"
] |
{define elements}
<tr n:foreach="$elements as $element">
<td class="name">
<a href="{$element|linkReflection}" n:class="$element->isDeprecated() ? deprecated">
{if $activeNamespace}{$element->getShortName()}{else}{$element->getName()}{/if}
</a>
</td>
<td>{$element|description}</td>
</tr>
{/define}
{if $classes}
<table class="summary table table-responsive table-bordered table-striped" id="classes">
<tr><th colspan="2">Classes Summary</th></tr>
{include elements, elements => $classes}
</table>
{/if}
{if $interfaces}
<table class="summary table table-responsive table-bordered table-striped" id="interfaces">
<tr><th colspan="2">Interfaces Summary</th></tr>
{include elements, elements => $interfaces}
</table>
{/if}
{if $traits}
<table class="summary table table-responsive table-bordered table-striped" id="traits">
<tr><th colspan="2">Traits Summary</th></tr>
{include elements, elements => $traits}
</table>
{/if}
{if $functions}
<table class="summary table table-responsive table-bordered table-striped" id="functions">
<tr><th colspan="2">Functions Summary</th></tr>
{include elements, elements => $allFunctions}
</table>
{/if}
{if $exceptions}
<table class="summary table table-responsive table-bordered table-striped" id="exceptions">
<tr><th colspan="2">Exceptions Summary</th></tr>
{include elements, elements => $exceptions}
</table>
{/if}
| Latte | 4 | pablorg77/tienda_onlineCI | system/apigen/packages/ThemeDefault/src/@elementlist.latte | [
"MIT"
] |
/* Copyright 2016 The TensorFlow 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.
==============================================================================*/
#ifndef TENSORFLOW_CC_CLIENT_CLIENT_SESSION_H_
#define TENSORFLOW_CC_CLIENT_CLIENT_SESSION_H_
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "tensorflow/cc/framework/ops.h"
#include "tensorflow/cc/framework/scope.h"
#include "tensorflow/core/public/session_options.h"
namespace tensorflow {
namespace thread {
struct ThreadPoolOptions;
}
/// @addtogroup core
/// @{
/// A `ClientSession` object lets the caller drive the evaluation of the
/// TensorFlow graph constructed with the C++ API.
///
/// Example:
///
/// Scope root = Scope::NewRootScope();
/// auto a = Placeholder(root, DT_INT32);
/// auto c = Add(root, a, {41});
///
/// ClientSession session(root);
/// std::vector<Tensor> outputs;
///
/// Status s = session.Run({ {a, {1}} }, {c}, &outputs);
/// if (!s.ok()) { ... }
class ClientSession {
public:
/// A data type to represent feeds to a Run call.
///
/// This is a map of `Output` objects returned by op-constructors to the value
/// to feed them with. See `Input::Initializer` for details on what can be
/// used as feed values.
typedef std::unordered_map<Output, Input::Initializer, OutputHash> FeedType;
/// Create a new session to evaluate the graph contained in `scope` by
/// connecting to the TensorFlow runtime specified by `target`.
ClientSession(const Scope& scope, const string& target);
/// Same as above, but use the empty string ("") as the target specification.
explicit ClientSession(const Scope& scope);
/// Create a new session, configuring it with `session_options`.
ClientSession(const Scope& scope, const SessionOptions& session_options);
~ClientSession();
/// Evaluate the tensors in `fetch_outputs`. The values are returned as
/// `Tensor` objects in `outputs`. The number and order of `outputs` will
/// match `fetch_outputs`.
Status Run(const std::vector<Output>& fetch_outputs,
std::vector<Tensor>* outputs) const;
/// Same as above, but use the mapping in `inputs` as feeds.
Status Run(const FeedType& inputs, const std::vector<Output>& fetch_outputs,
std::vector<Tensor>* outputs) const;
/// Same as above. Additionally runs the operations ins `run_outputs`.
Status Run(const FeedType& inputs, const std::vector<Output>& fetch_outputs,
const std::vector<Operation>& run_outputs,
std::vector<Tensor>* outputs) const;
/// Use `run_options` to turn on performance profiling. `run_metadata`, if not
/// null, is filled in with the profiling results.
Status Run(const RunOptions& run_options, const FeedType& inputs,
const std::vector<Output>& fetch_outputs,
const std::vector<Operation>& run_outputs,
std::vector<Tensor>* outputs, RunMetadata* run_metadata) const;
/// Same as above. Additionally allows user to provide custom threadpool
/// implementation via ThreadPoolOptions.
Status Run(const RunOptions& run_options, const FeedType& inputs,
const std::vector<Output>& fetch_outputs,
const std::vector<Operation>& run_outputs,
std::vector<Tensor>* outputs, RunMetadata* run_metadata,
const thread::ThreadPoolOptions& threadpool_options) const;
/// \brief A handle to a subgraph, created with
/// `ClientSession::MakeCallable()`.
typedef int64_t CallableHandle;
/// \brief Creates a `handle` for invoking the subgraph defined by
/// `callable_options`.
/// NOTE: This API is still experimental and may change.
Status MakeCallable(const CallableOptions& callable_options,
CallableHandle* out_handle);
/// \brief Invokes the subgraph named by `handle` with the given options and
/// input tensors.
///
/// The order of tensors in `feed_tensors` must match the order of names in
/// `CallableOptions::feed()` and the order of tensors in `fetch_tensors` will
/// match the order of names in `CallableOptions::fetch()` when this subgraph
/// was created.
/// NOTE: This API is still experimental and may change.
Status RunCallable(CallableHandle handle,
const std::vector<Tensor>& feed_tensors,
std::vector<Tensor>* fetch_tensors,
RunMetadata* run_metadata);
/// \brief Invokes the subgraph named by `handle` with the given options and
/// input tensors.
///
/// The order of tensors in `feed_tensors` must match the order of names in
/// `CallableOptions::feed()` and the order of tensors in `fetch_tensors` will
/// match the order of names in `CallableOptions::fetch()` when this subgraph
/// was created.
/// NOTE: This API is still experimental and may change.
Status RunCallable(CallableHandle handle,
const std::vector<Tensor>& feed_tensors,
std::vector<Tensor>* fetch_tensors,
RunMetadata* run_metadata,
const thread::ThreadPoolOptions& options);
/// \brief Releases resources associated with the given `handle` in this
/// session.
/// NOTE: This API is still experimental and may change.
Status ReleaseCallable(CallableHandle handle);
private:
class Impl;
std::unique_ptr<Impl> impl_;
Impl* impl() { return impl_.get(); }
const Impl* impl() const { return impl_.get(); }
};
/// @}
} // end namespace tensorflow
#endif // TENSORFLOW_CC_CLIENT_CLIENT_SESSION_H_
| C | 5 | EricRemmerswaal/tensorflow | tensorflow/cc/client/client_session.h | [
"Apache-2.0"
] |
--TEST--
Bug #46806 (mb_strimwidth cutting too early)
--CREDITS--
Sebastian Schürmann
sebs@php.net
Testfest 2009
--EXTENSIONS--
mbstring
--FILE--
<?php
echo mb_strimwidth('helloworld', 0, 5, '...', 'UTF-8') . "\n";
echo mb_strimwidth('hello', 0, 5, '...', 'UTF-8');
?>
--EXPECT--
he...
hello
| PHP | 3 | NathanFreeman/php-src | ext/mbstring/tests/bug46806.phpt | [
"PHP-3.01"
] |
package com.baeldung.springamqp.exponentialbackoff;
import org.springframework.amqp.core.Queue;
public class RetryQueues {
private Queue[] queues;
private long initialInterval;
private double factor;
private long maxWait;
public RetryQueues(long initialInterval, double factor, long maxWait, Queue... queues) {
this.queues = queues;
this.initialInterval = initialInterval;
this.factor = factor;
this.maxWait = maxWait;
}
public boolean retriesExhausted(int retry) {
return retry >= queues.length;
}
public String getQueueName(int retry) {
return queues[retry].getName();
}
public long getTimeToWait(int retry) {
double time = initialInterval * Math.pow(factor, (double) retry);
if (time > maxWait) {
return maxWait;
}
return (long) time;
}
} | Java | 4 | DBatOWL/tutorials | spring-amqp/src/main/java/com/baeldung/springamqp/exponentialbackoff/RetryQueues.java | [
"MIT"
] |
fun main () : nothing
var r : char;
var x: char;
fun reverse () : nothing
fun foo() : nothing
fun bar() : nothing
{
r <- 'c';
putc(r);
main();
}
{
r <- 'b';
putc(r);
bar();
putc(r);
}
{
r <- 'a';
putc(r);
foo();
putc(r);
}
{
r <- 'z';
if (r = 'c') then {puts("ni"); return;}
reverse();
putc(r);
}
| Grace | 3 | iPapatsoris/Grace-Compiler | src/tests/nonsense/3.grace | [
"MIT"
] |
$(header)
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE work.types_pkg.ALL;
USE work.muon_types.ALL;
PACKAGE def_val_pkg IS
-- default-values for 8-bit registers
-- all types based on STD_LOGIC_VECTOR(7 DOWNTO 0),
-- converted to string in reg_rw_def_val.vhd because
-- of use in lpm_ff as string
-- ********************************************************
-- default-value for calo register (IEG)
$(muon_def_vals)
$(calo_def_vals)
$(esums_def_vals)
$(jets_def_vals)
END def_val_pkg;
| VHDL | 4 | ckamtsikis/cmssw | L1TriggerConfig/L1GtConfigProducers/data/VhdlTemplates/Templates/def_val_pkg.vhd | [
"Apache-2.0"
] |
// Copyright 2013 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.
import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
group('$Marker', () {
test('constructor defaults', () {
final Marker marker = Marker(markerId: MarkerId("ABC123"));
expect(marker.alpha, equals(1.0));
expect(marker.anchor, equals(const Offset(0.5, 1.0)));
expect(marker.consumeTapEvents, equals(false));
expect(marker.draggable, equals(false));
expect(marker.flat, equals(false));
expect(marker.icon, equals(BitmapDescriptor.defaultMarker));
expect(marker.infoWindow, equals(InfoWindow.noText));
expect(marker.position, equals(const LatLng(0.0, 0.0)));
expect(marker.rotation, equals(0.0));
expect(marker.visible, equals(true));
expect(marker.zIndex, equals(0.0));
expect(marker.onTap, equals(null));
expect(marker.onDrag, equals(null));
expect(marker.onDragStart, equals(null));
expect(marker.onDragEnd, equals(null));
});
test('constructor alpha is >= 0.0 and <= 1.0', () {
final ValueSetter<double> initWithAlpha = (double alpha) {
Marker(markerId: MarkerId("ABC123"), alpha: alpha);
};
expect(() => initWithAlpha(-0.5), throwsAssertionError);
expect(() => initWithAlpha(0.0), isNot(throwsAssertionError));
expect(() => initWithAlpha(0.5), isNot(throwsAssertionError));
expect(() => initWithAlpha(1.0), isNot(throwsAssertionError));
expect(() => initWithAlpha(100), throwsAssertionError);
});
test('toJson', () {
final BitmapDescriptor testDescriptor =
BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueCyan);
final Marker marker = Marker(
markerId: MarkerId("ABC123"),
alpha: 0.12345,
anchor: Offset(100, 100),
consumeTapEvents: true,
draggable: true,
flat: true,
icon: testDescriptor,
infoWindow: InfoWindow(
title: "Test title",
snippet: "Test snippet",
anchor: Offset(100, 200),
),
position: LatLng(50, 50),
rotation: 100,
visible: false,
zIndex: 100,
onTap: () {},
onDragStart: (LatLng latLng) {},
onDrag: (LatLng latLng) {},
onDragEnd: (LatLng latLng) {},
);
final Map<String, Object> json = marker.toJson() as Map<String, Object>;
expect(json, <String, Object>{
'markerId': "ABC123",
'alpha': 0.12345,
'anchor': <double>[100, 100],
'consumeTapEvents': true,
'draggable': true,
'flat': true,
'icon': testDescriptor.toJson(),
'infoWindow': <String, Object>{
'title': "Test title",
'snippet': "Test snippet",
'anchor': <Object>[100.0, 200.0],
},
'position': <double>[50, 50],
'rotation': 100.0,
'visible': false,
'zIndex': 100.0,
});
});
test('clone', () {
final Marker marker = Marker(markerId: MarkerId("ABC123"));
final Marker clone = marker.clone();
expect(identical(clone, marker), isFalse);
expect(clone, equals(marker));
});
test('copyWith', () {
final Marker marker = Marker(markerId: MarkerId("ABC123"));
final BitmapDescriptor testDescriptor =
BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueCyan);
final double testAlphaParam = 0.12345;
final Offset testAnchorParam = Offset(100, 100);
final bool testConsumeTapEventsParam = !marker.consumeTapEvents;
final bool testDraggableParam = !marker.draggable;
final bool testFlatParam = !marker.flat;
final BitmapDescriptor testIconParam = testDescriptor;
final InfoWindow testInfoWindowParam = InfoWindow(title: "Test");
final LatLng testPositionParam = LatLng(100, 100);
final double testRotationParam = 100;
final bool testVisibleParam = !marker.visible;
final double testZIndexParam = 100;
final List<String> log = [];
final copy = marker.copyWith(
alphaParam: testAlphaParam,
anchorParam: testAnchorParam,
consumeTapEventsParam: testConsumeTapEventsParam,
draggableParam: testDraggableParam,
flatParam: testFlatParam,
iconParam: testIconParam,
infoWindowParam: testInfoWindowParam,
positionParam: testPositionParam,
rotationParam: testRotationParam,
visibleParam: testVisibleParam,
zIndexParam: testZIndexParam,
onTapParam: () {
log.add("onTapParam");
},
onDragStartParam: (LatLng latLng) {
log.add("onDragStartParam");
},
onDragParam: (LatLng latLng) {
log.add("onDragParam");
},
onDragEndParam: (LatLng latLng) {
log.add("onDragEndParam");
},
);
expect(copy.alpha, equals(testAlphaParam));
expect(copy.anchor, equals(testAnchorParam));
expect(copy.consumeTapEvents, equals(testConsumeTapEventsParam));
expect(copy.draggable, equals(testDraggableParam));
expect(copy.flat, equals(testFlatParam));
expect(copy.icon, equals(testIconParam));
expect(copy.infoWindow, equals(testInfoWindowParam));
expect(copy.position, equals(testPositionParam));
expect(copy.rotation, equals(testRotationParam));
expect(copy.visible, equals(testVisibleParam));
expect(copy.zIndex, equals(testZIndexParam));
copy.onTap!();
expect(log, contains("onTapParam"));
copy.onDragStart!(LatLng(0, 1));
expect(log, contains("onDragStartParam"));
copy.onDrag!(LatLng(0, 1));
expect(log, contains("onDragParam"));
copy.onDragEnd!(LatLng(0, 1));
expect(log, contains("onDragEndParam"));
});
});
}
| Dart | 5 | simpleclub-extended/plugins | packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/marker_test.dart | [
"BSD-3-Clause"
] |
[[messaging.whats-next]]
== What to Read Next
The next section describes how to enable <<io#io, IO capabilities>> in your application.
You can read about <<io#io.caching, caching>>, <<io#io.email, mail>>, <<io#io.validation, validation>>, <<io#io.rest-client, rest clients>> and more in this section. | AsciiDoc | 0 | techAi007/spring-boot | spring-boot-project/spring-boot-docs/src/docs/asciidoc/messaging/whats-next.adoc | [
"Apache-2.0"
] |
--TEST--
Bug #48667 (Implementing both iterator and iteratoraggregate)
--FILE--
<?php
abstract class A implements IteratorAggregate, Iterator { }
?>
--EXPECTF--
Fatal error: Class A cannot implement both Iterator and IteratorAggregate at the same time in %s on line %d
| PHP | 3 | guomoumou123/php5.5.10 | Zend/tests/bug48667_2.phpt | [
"PHP-3.01"
] |
Red/System [
Title: "macOS Menu widget"
Author: "Qingtian Xie"
File: %menu.reds
Tabs: 4
Rights: "Copyright (C) 2016-2018 Red Foundation. All rights reserved."
License: {
Distributed under the Boost Software License, Version 1.0.
See https://github.com/red/red/blob/master/BSL-License.txt
}
]
red-menu-action: func [
[cdecl]
self [integer!]
cmd [integer!]
sender [integer!]
/local
id [integer!]
][
id: objc_msgSend [sender sel_getUid "tag"]
make-event self id EVT_MENU
]
create-main-menu: func [
/local
app-name [integer!]
empty-str [integer!]
item [integer!]
title [integer!]
main-menu [integer!]
apple-menu [integer!]
srv-menu [integer!]
app-item [integer!]
s-app [c-string!]
sel-add [integer!]
][
s-app: strrchr system/args-list/item as-integer #"/"
s-app: s-app + 1
sel-add: sel_getUid "addItemWithTitle:action:keyEquivalent:"
empty-str: NSString("")
main-menu: objc_msgSend [objc_getClass "NSMenu" sel_getUid "alloc"]
main-menu: objc_msgSend [main-menu sel_getUid "initWithTitle:" NSString("NSAppleMenu")]
apple-menu: objc_msgSend [objc_getClass "NSMenu" sel_getUid "alloc"]
apple-menu: objc_msgSend [apple-menu sel_getUid "initWithTitle:" NSString("Apple")]
objc_msgSend [NSApp sel_getUid "setAppleMenu:" apple-menu]
title: NSString("About %@")
app-name: NSString(s-app)
title: objc_msgSend [objc_getClass "NSString" sel_getUid "stringWithFormat:" title app-name]
item: objc_msgSend [
apple-menu sel-add title sel_getUid "orderFrontStandardAboutPanel:" empty-str
]
objc_msgSend [item sel_getUid "setTarget:" NSApp]
objc_msgSend [apple-menu sel_getUid "addItem:" objc_msgSend [objc_getClass "NSMenuItem" sel_getUid "separatorItem"]]
title: NSString("Preferences...")
item: objc_msgSend [apple-menu sel-add title 0 NSString(",")]
objc_msgSend [item sel_getUid "setTag:" 42]
objc_msgSend [apple-menu sel_getUid "addItem:" objc_msgSend [objc_getClass "NSMenuItem" sel_getUid "separatorItem"]]
title: NSString("Services")
item: objc_msgSend [apple-menu sel-add title 0 empty-str]
srv-menu: objc_msgSend [objc_getClass "NSMenu" sel_getUid "alloc"]
srv-menu: objc_msgSend [srv-menu sel_getUid "initWithTitle:" empty-str]
objc_msgSend [apple-menu sel_getUid "setSubmenu:forItem:" srv-menu item]
objc_msgSend [srv-menu sel_getUid "release"]
objc_msgSend [NSApp sel_getUid "setServicesMenu:" srv-menu]
objc_msgSend [apple-menu sel_getUid "addItem:" objc_msgSend [objc_getClass "NSMenuItem" sel_getUid "separatorItem"]]
title: NSString("Hide %@")
title: objc_msgSend [objc_getClass "NSString" sel_getUid "stringWithFormat:" title app-name]
item: objc_msgSend [apple-menu sel-add title sel_getUid "hide:" NSString("h")]
objc_msgSend [item sel_getUid "setTarget:" NSApp]
title: NSString("Hide Others")
item: objc_msgSend [apple-menu sel-add title sel_getUid "hideOtherApplications:" NSString("h")]
objc_msgSend [item sel_getUid "setKeyEquivalentModifierMask:" NSCommandKeyMask or NSAlternateKeyMask]
objc_msgSend [item sel_getUid "setTarget:" NSApp]
title: NSString("Show All")
item: objc_msgSend [apple-menu sel-add title sel_getUid "unhideAllApplications:" empty-str]
objc_msgSend [item sel_getUid "setTarget:" NSApp]
objc_msgSend [apple-menu sel_getUid "addItem:" objc_msgSend [objc_getClass "NSMenuItem" sel_getUid "separatorItem"]]
title: NSString("Quit %@")
title: objc_msgSend [objc_getClass "NSString" sel_getUid "stringWithFormat:" title app-name]
item: objc_msgSend [apple-menu sel-add title sel_getUid "terminate:" NSString("q")]
objc_msgSend [item sel_getUid "setTarget:" NSApp]
app-item: objc_msgSend [main-menu sel-add empty-str 0 empty-str]
objc_msgSend [main-menu sel_getUid "setSubmenu:forItem:" apple-menu app-item]
objc_msgSend [apple-menu sel_getUid "release"]
objc_msgSend [NSApp sel_getUid "setMainMenu:" main-menu]
objc_msgSend [main-menu sel_getUid "release"]
]
build-menu: func [
menu [red-block!]
hMenu [integer!]
target [integer!]
return: [integer!]
/local
item [integer!]
sub-menu [integer!]
value [red-value!]
tail [red-value!]
next [red-value!]
str [red-string!]
w [red-word!]
title [integer!]
key [integer!]
action [integer!]
][
if TYPE_OF(menu) <> TYPE_BLOCK [return null]
value: block/rs-head menu
tail: block/rs-tail menu
key: NSString("")
action: sel_getUid "red-menu-action:"
while [value < tail][
switch TYPE_OF(value) [
TYPE_STRING [
str: as red-string! value
next: value + 1
title: to-NSString str
item: objc_msgSend [objc_getClass "NSMenuItem" sel_getUid "alloc"]
item: objc_msgSend [
item sel_getUid "initWithTitle:action:keyEquivalent:"
title 0 key
]
objc_msgSend [item sel_getUid "setTarget:" target]
either next < tail [
switch TYPE_OF(next) [
TYPE_BLOCK [
sub-menu: objc_msgSend [objc_getClass "NSMenu" sel_getUid "alloc"]
sub-menu: objc_msgSend [sub-menu sel_getUid "initWithTitle:" title]
build-menu as red-block! next sub-menu
objc_msgSend [item sel_getUid "setSubmenu:" sub-menu]
value: value + 1
]
TYPE_WORD [
w: as red-word! next
objc_msgSend [item sel_getUid "setTag:" w/symbol]
objc_msgSend [item sel_getUid "setAction:" action]
value: value + 1
]
default [
objc_msgSend [item sel_getUid "setTag:" -1]
objc_msgSend [item sel_getUid "setAction:" action]
]
]
][
objc_msgSend [item sel_getUid "setTag:" -1]
objc_msgSend [item sel_getUid "setAction:" action]
]
]
TYPE_WORD [
w: as red-word! value
if w/symbol = --- [
item: objc_msgSend [objc_getClass "NSMenuItem" sel_getUid "separatorItem"]
]
]
default [0]
]
objc_msgSend [hMenu sel_getUid "addItem:" item]
value: value + 1
]
hMenu
]
set-context-menu: func [
obj [integer!]
menu [red-block!]
/local
hMenu [integer!]
empty-str [integer!]
][
empty-str: NSString("")
hMenu: objc_msgSend [objc_getClass "NSMenu" sel_getUid "alloc"]
hMenu: objc_msgSend [hMenu sel_getUid "initWithTitle:" empty-str]
build-menu menu hMenu obj
objc_msgSend [obj sel_getUid "setMenu:" hMenu]
objc_msgSend [hMenu sel_getUid "release"]
]
menu-bar?: func [
spec [red-block!]
type [integer!]
return: [logic!]
/local
w [red-word!]
][
if all [
TYPE_OF(spec) = TYPE_BLOCK
not block/rs-tail? spec
type = window
][
w: as red-word! block/rs-head spec
return not all [
TYPE_OF(w) = TYPE_WORD
popup = symbol/resolve w/symbol
]
]
no
] | Red | 5 | GalenIvanov/red | modules/view/backends/macOS/menu.reds | [
"BSL-1.0",
"BSD-3-Clause"
] |
# Copyright (c) 2018-2021, Carnegie Mellon University
# See LICENSE for details
myScript := function()
local k, filename;
for k in [16, 32, 64, 128] do
filename := ConcatenationString("fft", String(k));
HDLSynthesize(streamDFTUnroll(k, 2, 4), 1, 0, 16, 300, 0, filename);
od;
end;
| GAP | 3 | sr7cb/spiral-software | namespaces/spiral/paradigms/stream/scripts.gi | [
"BSD-2-Clause-FreeBSD"
] |
<div data-acl data-page-title="<?php echo $this->escape($this->getParam('title', '')); ?>" data-analytics-pageview>
<?php echo $this->exec($this->getParam('body', [])); ?>
</div> | HTML+PHP | 3 | nakshatrasinghh/appwrite | app/views/layouts/empty.phtml | [
"BSD-3-Clause"
] |
"""Fixtures for CPU Speed integration tests."""
from __future__ import annotations
from collections.abc import Generator
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from homeassistant.components.cpuspeed.const import DOMAIN
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
@pytest.fixture
def mock_config_entry() -> MockConfigEntry:
"""Return the default mocked config entry."""
return MockConfigEntry(
title="CPU Speed",
domain=DOMAIN,
data={},
unique_id=DOMAIN,
)
@pytest.fixture
def mock_cpuinfo_config_flow() -> Generator[MagicMock, None, None]:
"""Return a mocked get_cpu_info.
It is only used to check thruthy or falsy values, so it is mocked
to return True.
"""
with patch(
"homeassistant.components.cpuspeed.config_flow.cpuinfo.get_cpu_info",
return_value=True,
) as cpuinfo_mock:
yield cpuinfo_mock
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
"""Mock setting up a config entry."""
with patch(
"homeassistant.components.cpuspeed.async_setup_entry", return_value=True
) as mock_setup:
yield mock_setup
@pytest.fixture
def mock_cpuinfo() -> Generator[MagicMock, None, None]:
"""Return a mocked get_cpu_info."""
info = {
"hz_actual": (3200000001, 0),
"arch_string_raw": "aargh",
"brand_raw": "Intel Ryzen 7",
"hz_advertised": (3600000001, 0),
}
with patch(
"homeassistant.components.cpuspeed.cpuinfo.get_cpu_info",
return_value=info,
) as cpuinfo_mock:
yield cpuinfo_mock
@pytest.fixture
async def init_integration(
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_cpuinfo: MagicMock
) -> MockConfigEntry:
"""Set up the CPU Speed integration for testing."""
mock_config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
return mock_config_entry
| Python | 5 | MrDelik/core | tests/components/cpuspeed/conftest.py | [
"Apache-2.0"
] |
# varnish extra config here
| VCL | 0 | sejo/fiaas | playbooks/roles/varnish/files/extra.vcl | [
"MIT"
] |
consul = "1.2.3.4"
// This is a comment
template "foo" {
bar = "zip"
}
| HCL | 2 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/HCL/example.hcl | [
"MIT"
] |
{
"@context": {
"so": "https://schema.org/",
"pb": "?jsonld=types#"
},
"AuthenticatedData": {
"@container": "@list",
"@value": [
{
"@type": "pb:CipherParameters"
},
{
"@type": "pb:Formatter"
},
{
"@type": "pb:OpenDiscussion"
},
{
"@type": "pb:BurnAfterReading"
}
]
},
"MetaData": {
"expire": {
"@type": "pb:Expiration"
},
"time_to_live": {
"@type": "pb:RemainingSeconds"
}
}
} | JSONLD | 3 | DigitEgal/PrivateBin | js/pastemeta.jsonld | [
"CC-BY-4.0"
] |
# frozen_string_literal: true
# Big thanks to ruby_parser, graphql-ruby and oga maintainers (who also use
# ragel) for inspiring some implementations ideas and for saving hours (and even
# more) of ragel lexer integration
module VimlValue
class Lexer
%%{
machine lexer; # % fix syntax highlight
access self.;
getkey (data_unpacked[p] || self.class.lexer_ex_eof_ch);
### Vim types (from :help type())
# Number: 0 (|v:t_number|)
# String: 1 (|v:t_string|)
# Funcref: 2 (|v:t_func|)
# List: 3 (|v:t_list|)
# Dictionary: 4 (|v:t_dict|)
# Float: 5 (|v:t_float|)
# Boolean: 6 (|v:true| and |v:false|)
# Null: 7 (|v:null|)
number = [+\-]?[0-9]+;
float = [+\-]?[0-9]+'.'[0-9]+([Ee][+\-]?[0-9]+)?;
double_quote = '"';
single_quote = "'";
vtrue = 'v:true';
vfalse = 'v:false';
vnull = 'v:null';
vnone = 'v:none' | 'None';
funcref = 'function';
dict_recursive_ref = '{...}';
list_recursive_ref = '[...]';
backslash = '\\';
tab = [\t];
whitespace = [ ];
separator = [:,{}()\[\]];
export eof_ch = 0;
any_ch = any - eof_ch;
main := |*
(whitespace | tab)*;
number => { emit(:NUMERIC, token.to_i) };
float => { emit(:NUMERIC, token.to_f) };
single_quote => { start_str!; fcall single_quoted_str; };
double_quote => { start_str!; fcall double_quoted_str; };
vtrue => { emit(:BOOLEAN, true) };
vfalse => { emit(:BOOLEAN, false) };
vnone => { emit(:NONE, nil) };
vnull => { emit(:NULL, nil) };
funcref => { emit(:FUNCREF, nil) };
dict_recursive_ref => { emit(:DICT_RECURSIVE_REF, nil) };
list_recursive_ref => { emit(:LIST_RECURSIVE_REF, nil) };
separator => { emit(data[ts], data[ts]) };
eof_ch => { fbreak; };
any_ch => { failure "Unexpected char #{token.inspect}" };
*|;
single_quoted_str := |*
single_quote => { end_and_emit_str!; fret; };
single_quote{2} => { str_append! single_quote; };
any_ch => { str_append! token };
eof_ch => { failure "Unexpected end of string" };
*|;
double_quoted_str := |*
double_quote => { end_and_emit_str!; fret; };
backslash single_quote => { str_append! single_quote; };
backslash double_quote => { str_append! double_quote; };
backslash{2} => { str_append! backslash; };
any_ch => { str_append! token };
eof_ch => { failure "Unexpected end of string" };
*|;
}%%
# % fix syntax highlight
%% write exports;
%% write data;
# Setup ragel methods. Ugly, but at least less dependent on ragel internal
# naming like with assigning all the values manually
private_methods.select { |m| m.to_s =~ /\A_lexer.*[^=]\z/ }
.each { |m| define_method(m) { self.class.send(m) } }
attr_reader :data, :data_unpacked
attr_accessor :ts, :te, :stack, :top, :cs, :act, :p # ragel internals
def initialize(input)
@data = input
@data_unpacked =
if input.encoding == Encoding::UTF_8
input.unpack("U*")
else
input.unpack("C*")
end
reset!
end
def each_token(&block)
return @each_token if block.nil?
@yielder = Enumerator::Yielder.new(&block)
reset_ragel!
p = @p
%% write exec noend;
# %
@p = p # preserve data pointer just in case
ensure
reset!
end
def next_token
@each_token.next
rescue StopIteration
nil
end
def reset!
@each_token = enum_for(:each_token)
@yielder = nil
end
private
def reset_ragel!
@ts, @te = nil, nil # start, end position
@stack, @top = [], 0 # for fcall and fret
@cs = %%{ write start; }%% # current state
@act = 0 # most recent successful pattern match
@p = 0 # data pointer
end
def token
data[ts...te]
end
def failure(message)
raise ParseError, "#{message} at #{p}. In: #{data.inspect}"
end
TokenData = Struct.new(:value, :start, :end) do
def inspect
map(&:inspect).join(':')
end
end
def emit(type, val, tstart = ts, tend = te)
@yielder.yield([type, TokenData.new(val, tstart, tend)])
end
def single_quote
"'"
end
def double_quote
'"'
end
def backslash
'\\'
end
def start_str!
@str_buffer = String.new
@str_tstart = ts
end
def str_append!(tail)
@str_buffer << tail
end
def end_and_emit_str!
emit(:STRING, @str_buffer, @str_tstart, te)
@str_tstart = nil
@str_buffer = nil
end
end
end
| Ragel in Ruby Host | 5 | eugen0329/vim-easy-search | spec/support/lib/viml_value/lexer.rl | [
"Vim"
] |
// rust-lang/rust#83309: The compiler tries to suggest potential
// methods that return `&mut` items. However, when it doesn't
// find such methods, it still tries to add suggestions
// which then fails an assertion later because there was
// no suggestions to make.
fn main() {
for v in Query.iter_mut() {
//~^ NOTE this iterator yields `&` references
*v -= 1;
//~^ ERROR cannot assign to `*v`, which is behind a `&` reference
//~| NOTE `v` is a `&` reference, so the data it refers to cannot be written
}
}
pub struct Query;
pub struct QueryIter<'a>(&'a i32);
impl Query {
pub fn iter_mut<'a>(&'a mut self) -> QueryIter<'a> {
todo!();
}
}
impl<'a> Iterator for QueryIter<'a> {
type Item = &'a i32;
fn next(&mut self) -> Option<Self::Item> {
todo!();
}
}
| Rust | 4 | mbc-git/rust | src/test/ui/borrowck/issue-83309-ice-immut-in-for-loop.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
package com.baeldung.boot.converter;
import com.baeldung.boot.domain.AbstractEntity;
import com.baeldung.boot.domain.Bar;
import com.baeldung.boot.domain.Foo;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.converter.ConverterFactory;
public class StringToAbstractEntityConverterFactory implements ConverterFactory<String, AbstractEntity>{
@Override
public <T extends AbstractEntity> Converter<String, T> getConverter(Class<T> targetClass) {
return new StringToAbstractEntityConverter<>(targetClass);
}
private static class StringToAbstractEntityConverter<T extends AbstractEntity> implements Converter<String, T> {
private Class<T> targetClass;
public StringToAbstractEntityConverter(Class<T> targetClass) {
this.targetClass = targetClass;
}
@Override
public T convert(String source) {
long id = Long.parseLong(source);
if(this.targetClass == Foo.class) {
return (T) new Foo(id);
}
else if(this.targetClass == Bar.class) {
return (T) new Bar(id);
} else {
return null;
}
}
}
}
| Java | 4 | DBatOWL/tutorials | spring-web-modules/spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/StringToAbstractEntityConverterFactory.java | [
"MIT"
] |
# Usage: cd $PLAN9; awk -f dist/checkman.awk man?/*.?
#
# Checks:
# - .TH is first line, and has proper name section number
# - sections are in order NAME, SYNOPSIS, DESCRIPTION, EXAMPLES,
# FILES, SOURCE, SEE ALSO, DIAGNOSTICS, BUGS
# - there's a manual page for each cross-referenced page
BEGIN {
# .SH sections should come in the following order
Weight["NAME"] = 1
Weight["SYNOPSIS"] = 2
Weight["DESCRIPTION"] = 4
Weight["EXAMPLE"] = 8
Weight["EXAMPLES"] = 16
Weight["FILES"] = 32
Weight["SOURCE"] = 64
Weight["SEE ALSO"] = 128
Weight["DIAGNOSTICS"] = 256
Weight["SYSTEM CALLS"] = 512
Weight["BUGS"] = 1024
Skipdirs["CVS"] = 1
# allow references to pages provded
# by the underlying Unix system
Omitman["awk(1)"] = 1
Omitman["bash(1)"] = 1
Omitman["chmod(1)"] = 1
Omitman["compress(1)"] = 1
Omitman["cp(1)"] = 1
Omitman["egrep(1)"] = 1
Omitman["gs(1)"] = 1
Omitman["gv(1)"] = 1
Omitman["lex(1)"] = 1
Omitman["lp(1)"] = 1
Omitman["lpr(1)"] = 1
Omitman["mail(1)"] = 1
Omitman["make(1)"] = 1
Omitman["nm(1)"] = 1
Omitman["prof(1)"] = 1
Omitman["pwd(1)"] = 1
Omitman["qiv(1)"] = 1
Omitman["sftp(1)"] = 1
Omitman["sh(1)"] = 1
Omitman["ssh(1)"] = 1
Omitman["stty(1)"] = 1
Omitman["tex(1)"] = 1
Omitman["unutf(1)"] = 1
Omitman["vnc(1)"] = 1
Omitman["xterm(1)"] = 1
Omitman["access(2)"] = 1
Omitman["brk(2)"] = 1
Omitman["chdir(2)"] = 1
Omitman["close(2)"] = 1
Omitman["connect(2)"] = 1
Omitman["fork(2)"] = 1
Omitman["gethostname(2)"] = 1
Omitman["getpid(2)"] = 1
Omitman["getuid(2)"] = 1
Omitman["open(2)"] = 1
Omitman["pipe(2)"] = 1
Omitman["ptrace(2)"] = 1
Omitman["rmdir(2)"] = 1
Omitman["send(2)"] = 1
Omitman["signal(2)"] = 1
Omitman["sigprocmask(2)"] = 1
Omitman["socketpair(2)"] = 1
Omitman["unlink(2)"] = 1
Omitman["abort(3)"] = 1
Omitman["assert(3)"] = 1
Omitman["fprintf(3)"] = 1
Omitman["fscanf(3)"] = 1
Omitman["fopen(3)"] = 1
Omitman["isalpha(3)"] = 1
Omitman["malloc(3)"] = 1
Omitman["perror(3)"] = 1
Omitman["remove(3)"] = 1
Omitman["sin(3)"] = 1
Omitman["strerror(3)"] = 1
Omitman["core(5)"] = 1
Omitman["passwd(5)"] = 1
Omitman["signal(7)"] = 1
Omitman["cron(8)"] = 1
Omitman["mount(8)"] = 1
# don't need documentation for these in bin
Omitted[".cvsignore"] = 1
Omitted["Getdir"] = 1
Omitted["Irc"] = 1
Omitted["Juke"] = 1
Omitted["ajuke"] = 1
Omitted["goodmk"] = 1
Omitted["jukefmt"] = 1
Omitted["jukeget"] = 1
Omitted["jukeindex"] = 1
Omitted["jukeinfo"] = 1
Omitted["jukeplay"] = 1
Omitted["jukeput"] = 1
Omitted["jukesearch"] = 1
Omitted["jukesongfile"] = 1
Omitted["m4ainfo"] = 1
Omitted["mp3info"] = 1
Omitted["notes"] = 1
Omitted["tcolors"] = 1
Omitted["tref"] = 1
Omitted["unutf"] = 1
Omitted["volume"] = 1
Omitted["vtdump"] = 1
Omitted["netfilelib.rc"] = 1
# not for users
Omittedlib["creadimage"] = 1
Omittedlib["pixelbits"] = 1
Omittedlib["bouncemouse"] = 1
Omittedlib["main"] = 1 # in libthread
Omittedlib["opasstokey"] = 1 # in libauthsrv
# functions provided for -lthread_db
Omittedlib["ps_get_thread_area"] = 1
Omittedlib["ps_getpid"] = 1
Omittedlib["ps_lcontinue"] = 1
Omittedlib["ps_lgetfpregs"] = 1
Omittedlib["ps_lgetregs"] = 1
Omittedlib["ps_lsetfpregs"] = 1
Omittedlib["ps_lsetregs"] = 1
Omittedlib["ps_lstop"] = 1
Omittedlib["ps_pcontinue"] = 1
Omittedlib["ps_pdread"] = 1
Omittedlib["ps_pdwrite"] = 1
Omittedlib["ps_pglobal_lookup"] = 1
Omittedlib["ps_pstop"] = 1
Omittedlib["ps_ptread"] = 1
Omittedlib["ps_ptwrite"] = 1
# libmach includes a small dwarf and elf library
Omittedlib["corecmdfreebsd386"] = 1
Omittedlib["corecmdlinux386"] = 1
Omittedlib["coreregsfreebsd386"] = 1
Omittedlib["coreregslinux386"] = 1
Omittedlib["coreregsmachopower"] = 1
Omittedlib["crackelf"] = 1
Omittedlib["crackmacho"] = 1
Omittedlib["dwarfaddrtounit"] = 1
Omittedlib["dwarfclose"] = 1
Omittedlib["dwarfenum"] = 1
Omittedlib["dwarfenumunit"] = 1
Omittedlib["dwarfget1"] = 1
Omittedlib["dwarfget128"] = 1
Omittedlib["dwarfget128s"] = 1
Omittedlib["dwarfget2"] = 1
Omittedlib["dwarfget4"] = 1
Omittedlib["dwarfget8"] = 1
Omittedlib["dwarfgetabbrev"] = 1
Omittedlib["dwarfgetaddr"] = 1
Omittedlib["dwarfgetn"] = 1
Omittedlib["dwarfgetnref"] = 1
Omittedlib["dwarfgetstring"] = 1
Omittedlib["dwarflookupfn"] = 1
Omittedlib["dwarflookupname"] = 1
Omittedlib["dwarflookupnameinunit"] = 1
Omittedlib["dwarflookupsubname"] = 1
Omittedlib["dwarflookuptag"] = 1
Omittedlib["dwarfnextsym"] = 1
Omittedlib["dwarfnextsymat"] = 1
Omittedlib["dwarfopen"] = 1
Omittedlib["dwarfpctoline"] = 1
Omittedlib["dwarfseeksym"] = 1
Omittedlib["dwarfskip"] = 1
Omittedlib["dwarfunwind"] = 1
Omittedlib["elfclose"] = 1
Omittedlib["elfdl386mapdl"] = 1
Omittedlib["elfinit"] = 1
Omittedlib["elfmachine"] = 1
Omittedlib["elfmap"] = 1
Omittedlib["elfopen"] = 1
Omittedlib["elfsection"] = 1
Omittedlib["elfsym"] = 1
Omittedlib["elfsymlookup"] = 1
Omittedlib["elftype"] = 1
Omittedlib["machoclose"] = 1
Omittedlib["machoinit"] = 1
Omittedlib["machoopen"] = 1
Omittedlib["stabsym"] = 1
Omittedlib["symdwarf"] = 1
Omittedlib["symelf"] = 1
Omittedlib["symmacho"] = 1
Omittedlib["symstabs"] = 1
Omittedlib["elfcorelinux386"] = 1
Omittedlib["linux2ureg386"] = 1
Omittedlib["ureg2linux386"] = 1
Omittedlib["coreregs"] = 1 # haven't documented mach yet
Omittedlib["regdesc"] = 1
Omittedlib["auth_attr"] = 1 # not happy about this
Omittedlib["ndbnew"] = 1 # private to library
Omittedlib["ndbsetval"] = 1
Renamelib["chanalt"] = "alt"
Renamelib["channbrecv"] = "nbrecv"
Renamelib["channbrecvp"] = "nbrecvp"
Renamelib["channbrecvul"] = "nbrecvul"
Renamelib["channbsend"] = "nbsend"
Renamelib["channbsendp"] = "nbsendp"
Renamelib["channbsendul"] = "nbsendul"
Renamelib["chanrecv"] = "recv"
Renamelib["chanrecvp"] = "recvp"
Renamelib["chanrecvul"] = "recvul"
Renamelib["chansend"] = "send"
Renamelib["chansendp"] = "sendp"
Renamelib["chansendul"] = "sendul"
Renamelib["threadyield"] = "yield"
Renamelib["fmtcharstod"] = "charstod"
Renamelib["fmtstrtod"] = "strtod"
Renamelib["regcomp9"] = "regcomp"
Renamelib["regcomplit9"] = "regcomplit"
Renamelib["regcompnl9"] = "regcompnl"
Renamelib["regerror9"] = "regerror"
Renamelib["regexec9"] = "regexec"
Renamelib["regsub9"] = "regsub"
Renamelib["rregexec9"] = "rregexec"
Renamelib["rregsub9"] = "rregsub"
lastline = "XXX";
lastfile = FILENAME;
}
func getnmlist(lib, cmd)
{
cmd = "nm -g " lib
while (cmd | getline) {
if (($2 == "T" || $2 == "L") && $3 !~ "^_"){
sym = $3
sub("^p9", "", sym)
if(sym in Renamelib)
List[Renamelib[sym]] = lib " as " sym
else
List[sym] = lib
}
}
close(cmd)
}
func getindex(dir, fname)
{
fname = dir "/INDEX"
while ((getline < fname) > 0)
Index[$1] = dir
close(fname)
}
func getbinlist(dir, cmd, subdirs, nsd)
{
cmd = "ls -p -l " dir
nsd = 0
while (cmd | getline) {
if ($1 ~ /^d/) {
if (!($10 in Skipdirs))
subdirs[++nsd] = $10
} else if ($10 !~ "^_")
List[$10] = dir
}
for ( ; nsd > 0 ; nsd--)
getbinlist(dir "/" subdirs[nsd])
close(cmd)
}
func clearindex( i)
{
for (i in Index)
delete Index[i]
}
func clearlist( i)
{
for (i in List)
delete List[i]
}
FNR==1 {
if(lastline == ""){
# screws up troff headers
print lastfile ":$ is a blank line"
}
n = length(FILENAME)
nam = FILENAME
if(nam ~ /\.html$/)
next
if(nam !~ /^man\/man(.*)\/(.*)\.(.*)$/){
print "nam", nam, "not of form [0-9][0-9]?/*"
next
}
nam = substr(nam, 8)
gsub("[/.]", " ", nam);
n = split(nam, a)
sec = a[1]
name = a[2]
section = a[3]
if($1 != ".TH" || NF != 3)
print "First line of", FILENAME, "not a proper .TH"
else if(($2 != toupper(name) || substr($3, 1, length(sec)) != sec || $3 != toupper(section)) \
&& ($2!="INTRO" || name!="0intro") \
&& (name !~ /^9/ || $2!=toupper(substr(name, 2)))){
print ".TH of", FILENAME, "doesn't match filename"
}else
Pages[tolower($2) "(" tolower($3) ")"] = 1
Sh = 0
}
{ lastline=$0; lastfile=FILENAME; }
$1 == ".SH" {
if(inex)
print "Unterminated .EX in", FILENAME, ":", $0
inex = 0;
if (substr($2, 1, 1) == "\"") {
if (NF == 2) {
print "Unneeded quote in", FILENAME, ":", $0
$2 = substr($2, 2, length($2)-2)
} else if (NF == 3) {
$2 = substr($2, 2) substr($3, 1, length($3)-1)
NF = 2
}
}
if(Sh == 0 && $2 != "NAME")
print FILENAME, "has no .SH NAME"
w = Weight[$2]
if (w) {
if (w < Sh)
print "Heading", $2, "out of order in", FILENAME
Sh += w
}
sh = $2
}
$1 == ".EX" {
if(inex)
print "Nested .EX in", FILENAME ":" FNR, ":", $0
inex = 1
}
$1 == ".EE" {
if(!inex)
print "Bad .EE in", FILENAME ":" FNR ":", $0
inex = 0;
}
$1 == ".TF" {
smallspace = 1
}
$1 == ".PD" || $1 == ".SH" || $1 == ".SS" || $1 == ".TH" {
smallspace = 0
}
$1 == ".RE" {
lastre = 1
}
$1 == ".PP" {
if(smallspace && !lastre)
print "Possible missing .PD at " FILENAME ":" FNR
smallspace = 0
}
$1 != ".RE" {
lastre = 0
}
sh == "BUGS" && $1 == ".br" {
print FILENAME ":" FNR ": .br in BUGS"
}
sh == "SOURCE" && $1 ~ /^\\\*9\// {
s = ENVIRON["PLAN9"] substr($1, 4)
Sources[s] = 1
}
sh == "SOURCE" && $2 ~ /^\\\*9\// {
s = ENVIRON["PLAN9"] substr($2, 4)
Sources[s] = 1
}
sh == "SOURCE" && $1 ~ /^\// {
Sources[$1] = 1
}
sh == "SOURCE" && $2 ~ /^\// {
Sources[$2] = 1
}
$0 ~ /^\.[A-Z].*\([1-9]\)/ {
if ($1 == ".IR" && $3 ~ /\([0-9]\)/) {
name = $2
section = $3
}else if ($1 == ".RI" && $2 == "(" && $4 ~ /\([0-9]\)/) {
name = $3
section = $4
}else if ($1 == ".IR" && $3 ~ /9.\([0-9]\)/) {
name = $2
section = "9"
}else if ($1 == ".RI" && $2 == "(" && $4 ~ /9.\([0-9]\)/) {
name = $3
section = "9"
} else {
if ($1 == ".HR" && $3 == "\"Section")
next;
print "Possible bad cross-reference format in", FILENAME ":" FNR
print $0
next
}
gsub(/[^0-9]/, "", section)
Refs[toupper(name) "(" section ")"]++
}
END {
if(lastline == ""){
print lastfile ":$ is a blank line"
}
print "Checking Source References"
cmd = "xargs -n 100 ls -d 2>&1 >/dev/null | sed 's/^ls: / /; s/: .*//'"
for (i in Sources) {
print i |cmd
}
close(cmd)
print ""
print "Checking Cross-Referenced Pages"
for (i in Refs) {
if (!(tolower(i) in Pages) && !(tolower(i) in Omitman)){
b = tolower(i)
gsub("\\(", " \\(", b)
gsub("\\)", "\\)", b)
split(tolower(i), a, "/")
print "egrep -in '^\\.IR.*" b "' $PLAN9/man/man*/* # Need " tolower(i) |"sort"
}
}
close("sort")
print ""
print "Checking commands"
getindex("man/man1")
getindex("man/man4")
getindex("man/man7")
getindex("man/man8")
getbinlist("bin")
for (i in List) {
if (!(i in Index) && !(i in Omitted))
print "Need", i, "(in " List[i] ")" |"sort"
}
close("sort")
print ""
for (i in List) {
if (!(i in Index) && (i in Omitted))
print "Omit", i, "(in " List[i] ")" |"sort"
}
close("sort")
clearindex()
clearlist()
print ""
print "Checking libraries"
getindex("man/man3")
getnmlist("lib/lib9.a")
getnmlist("lib/lib9p.a")
getnmlist("lib/lib9pclient.a")
getnmlist("lib/libString.a")
getnmlist("lib/libauth.a")
getnmlist("lib/libauthsrv.a")
getnmlist("lib/libbin.a")
getnmlist("lib/libbio.a")
getnmlist("lib/libcomplete.a")
# getnmlist("lib/libcontrol.a")
getnmlist("lib/libdisk.a")
getnmlist("lib/libdraw.a")
getnmlist("lib/libflate.a")
getnmlist("lib/libframe.a")
getnmlist("lib/libgeometry.a")
getnmlist("lib/libhtml.a")
# getnmlist("lib/libhttpd.a")
getnmlist("lib/libip.a")
getnmlist("lib/libmach.a")
# getnmlist("lib/libmemdraw.a")
# getnmlist("lib/libmemlayer.a")
getnmlist("lib/libmp.a")
getnmlist("lib/libmux.a")
getnmlist("lib/libndb.a")
getnmlist("lib/libplumb.a")
getnmlist("lib/libregexp9.a")
getnmlist("lib/libsec.a")
getnmlist("lib/libthread.a")
# getnmlist("lib/libventi.a")
for (i in List) {
if (!(i in Index) && !(i in Omittedlib))
print "Need", List[i], i |"sort"
# print "Need", i, "(in " List[i] ")" |"sort"
}
close("sort")
print ""
for (i in List) {
if (!(i in Index) && (i in Omittedlib))
print "Omit", List[i], i |"sort"
# print "Omit", i, "(in " List[i] ")" |"sort"
}
close("sort")
}
| Awk | 5 | newluhux/plan9port | dist/checkman.awk | [
"MIT"
] |
"""
Before running this, copy attachments/tanh_crypto.py to this directory.
When coding this addition law, I wrote a version using projective coordinates
The break becomes obvious when you do this. Let a, b, and s, be rational
numbers, with numerators an, bn, and sn, and denominators ad, bd, sd. Then we
can write our addition law as:
sn/sd = (an/ad + bn/bd)/((an bn)/(ad bd) + 1) = (an bd + ad bn)/(an bn + ad bd)
To avoid modular inverses on every addition step, compute numerators and
denominators separately and do just one modular inverse at the end:
sn = an bd + ad bn
sd = an bn + ad bd
This looks a lot like complex multiplication, which is roughly equivalent to
polynomial rings mod x^2 + 1. This is actually similar to polynomial rings mod
x^2 - 1.:
(ax + b)(cx + d) = acx^2 + (ad + bc)x + bd mod x^2 - 1
= (ad + bc)x + (ac + bd)
Unfortunately, x^2 - 1 is reducible:
x^2 - 1 = (x + 1)(x - 1)
With a bit of algebra, we can solve DLP over this addtion rule easily. The
remainder mod x^2 - 1 can be written as:
n*(x + 1) + m*(x - 1) = ax + b mod x^2 - 1 (Equation 1)
where ax + b is the remainder of a polynomial mod x^2 - 1, and where n and m
are integers from 0 .. p-1, where we do arithmetic mod p. We can find n and m,
where all these equations are mod p:
n + m = a
n - m = b
2m = a - b
m = (a - b)/2
n = m + b = (a + b)/2
Substituting back into equation 1:
(x + 1)(a + b)/2 + (x - 1)(a - b)/2 = ax + b
We want to find Alice's secret exponent e, where Alice's public key is:
pubkey = c/d mod p, where
cx + d = (gx + 1)^e mod x^2 - 1
Where g is the generator, which is 2 in our case. Applying equation 1, we get:
cx + d = ((x + 1)(g + 1)/2 + (x - 1)(g - 1)/2)^e mod x^2 - 1
Taking this mod x - 1:
c + d = (1 + g)^e mod x - 1
and mod x + 1:
d - c = (1 - g)^e mod x + 1
Since we have constant polynomials, we can drop the mod x + 1 and mod x - 1:
c + d = (1 + g)^e mod p
d - c = (1 - g)^e mod p
Dividing the equations:
(c + d)/(d - c) = ((1 + g)/(1 - g))^e mod p
(c/d + 1)/(1 - c/d) = ((1 + g)/(1 - g))^e mod p
(pubkey + 1)/(1 - pubkey) = ((1 + g)/(1 - g))^e mod p
This last equation has only e as an unknown, and can be solved with a regular DLP solver.
"""
from tanh_crypto import *
x = polygen(GF(p))
left = ((pubkey + 1)*inverse_mod(1 - pubkey, p)) % p
right = ((1 + g)*inverse_mod(1 - g, p)) % p
recoveredSecret = log(Mod(left, p), Mod(right, p))
print "Recovered secret =", recoveredSecret
print decrypt(recoveredSecret, encMessage, g, p)
| Sage | 4 | tonghuaroot/google-ctf | 2017/finals/2017-finals-crypto-tanh/solution.sage | [
"Apache-2.0"
] |
INSERT INTO employees (employee_number, employee_name, employee_age) VALUES ('111', 'John Doe', 55);
INSERT INTO employees (employee_number, employee_name, employee_age) VALUES ('A123', 'John Doe Junior', 25); | SQL | 3 | DBatOWL/tutorials | persistence-modules/java-jpa-2/src/test/resources/queryparams.sql | [
"MIT"
] |
# This file has been generated by the GAP build system,
# do not edit manually!
GAParch=FAKE-GAP-ARCH
GAP_ABI=64
GAP_HPCGAP=no
GAP_VERSION="4.12dev"
GAP_BUILD_VERSION="4.12dev"
GAP_LIBTOOL_CURRENT=8
GAP_LIBTOOL_AGE=0
GAP_KERNEL_MAJOR_VERSION=8
GAP_KERNEL_MINOR_VERSION=0
GAP_BIN_DIR="/workspace/destdir/share/gap"
GAP_LIB_DIR="/workspace/destdir/share/gap"
GAP="/workspace/destdir/bin/gap"
GAC="/workspace/destdir/share/gap/gac"
GAP_CC="cc "
GAP_CXX="c++ -std=gnu++11 "
GAP_CFLAGS="-g -O2"
GAP_CXXFLAGS="-g -O2"
GAP_CPPFLAGS="-I/workspace/destdir/include/gap -DHAVE_CONFIG_H -fPIC "
GAP_LDFLAGS="-L/workspace/destdir/lib "
GAP_LIBS="-lgmp"
GAP_OBJS="build/obj/src/ariths.c.lo build/obj/src/bags.c.lo build/obj/src/blister.c.lo build/obj/src/bool.c.lo build/obj/src/calls.c.lo build/obj/src/code.c.lo build/obj/src/collectors.cc.lo build/obj/src/compiler.c.lo build/obj/src/costab.c.lo build/obj/src/cyclotom.c.lo build/obj/src/debug.c.lo build/obj/src/dt.c.lo build/obj/src/dteval.c.lo build/obj/src/error.c.lo build/obj/src/exprs.c.lo build/obj/src/ffdata.c.lo build/obj/src/finfield.c.lo build/obj/src/funcs.c.lo build/obj/src/gap.c.lo build/obj/src/gaptime.c.lo build/obj/build/gap_version.c.lo build/obj/src/gvars.c.lo build/obj/src/hookintrprtr.c.lo build/obj/src/info.c.lo build/obj/src/integer.c.lo build/obj/src/intfuncs.c.lo build/obj/src/intrprtr.c.lo build/obj/src/io.c.lo build/obj/src/iostream.c.lo build/obj/src/libgap-api.c.lo build/obj/src/listfunc.c.lo build/obj/src/listoper.c.lo build/obj/src/lists.c.lo build/obj/src/macfloat.c.lo build/obj/src/modules_builtin.c.lo build/obj/src/modules.c.lo build/obj/src/objcftl.c.lo build/obj/src/objects.c.lo build/obj/src/objfgelm.cc.lo build/obj/src/objpcgel.cc.lo build/obj/src/objset.c.lo build/obj/src/opers.cc.lo build/obj/src/permutat.cc.lo build/obj/src/plist.c.lo build/obj/src/pperm.cc.lo build/obj/src/precord.c.lo build/obj/src/profile.c.lo build/obj/src/range.c.lo build/obj/src/rational.c.lo build/obj/src/read.c.lo build/obj/src/records.c.lo build/obj/src/saveload.c.lo build/obj/src/scanner.c.lo build/obj/src/sctable.c.lo build/obj/src/set.c.lo build/obj/src/stats.c.lo build/obj/src/streams.c.lo build/obj/src/stringobj.c.lo build/obj/src/syntaxtree.c.lo build/obj/src/sysfiles.c.lo build/obj/src/sysroots.c.lo build/obj/src/sysstr.c.lo build/obj/src/system.c.lo build/obj/src/tietze.c.lo build/obj/src/tracing.c.lo build/obj/src/trans.cc.lo build/obj/src/trycatch.c.lo build/obj/src/vars.c.lo build/obj/src/vec8bit.c.lo build/obj/src/vecffe.c.lo build/obj/src/vecgf2.c.lo build/obj/src/vector.c.lo build/obj/src/weakptr.c.lo build/obj/src/julia_gc.c.lo build/obj/src/c_oper1.c.lo build/obj/src/c_type1.c.lo build/obj/src/compstat.c.lo"
JULIA=""
JULIA_CPPFLAGS="-I/workspace/destdir/include/julia -fPIC"
JULIA_LDFLAGS="-L/workspace/destdir/lib -L/workspace/destdir/lib/julia"
JULIA_LIBS="-Wl,-rpath,/workspace/destdir/lib -Wl,-rpath,/workspace/destdir/lib/julia -ljulia"
| GAP | 1 | sharanry/Yggdrasil | G/GAP_pkg/bundled/sysinfo.gap | [
"MIT"
] |
vespaFilters = angular.module 'vespaFilters', []
vespaFilters.filter 'unique', () ->
return (items, filterOn) ->
if filterOn == false
return items
if (filterOn or angular.isUndefined(filterOn)) and angular.isArray(items)
newItems = []
extractValueToCompare = (item) ->
if angular.isObject(item) and angular.isString(filterOn)
return item[filterOn]
else
return item
angular.forEach items, (item) ->
isDuplicate = false
i = 0
while i < newItems.length
if angular.equals extractValueToCompare(newItems[i]), extractValueToCompare(item)
isDuplicate = true
break
++i
if !isDuplicate
newItems.push item
items = newItems
return items
vespaFilters.filter 'uniquerule', () ->
return (items, policy, rule) ->
if policy == false or rule == false
return items
if ((policy and rule) or (angular.isUndefined(policy) and angular.isUndefined(rule))) and angular.isArray(items)
newItems = []
extractValueToCompare = (item) ->
if angular.isObject(item) and angular.isString(policy) and angular.isString(rule)
return "#{item[policy]}-#{item[rule]}"
else
return item
angular.forEach items, (item) ->
isDuplicate = false
i = 0
while i < newItems.length
if angular.equals extractValueToCompare(newItems[i]), extractValueToCompare(item)
isDuplicate = true
break
++i
if !isDuplicate
newItems.push item
items = newItems
return items
| Literate CoffeeScript | 4 | visigoth/V3SPA | src/js/filters.litcoffee | [
"BSD-3-Clause"
] |
#!/usr/bin/env bash
set -evo pipefail
SERVER_BUILD_OUTPUT="$1"
CLI_BUILD_OUTPUT="$2"
BUILD_OUTPUT="$3"
CLI_MIGRATIONS_IMAGE="cli-migrations-v3"
SERVER_IMAGE=$(docker load -i "${SERVER_BUILD_OUTPUT}/image.tar" | grep "^Loaded image: " | sed "s/Loaded image: //g")
SERVER_IMAGE_TAG=$(echo "$SERVER_IMAGE" | sed "s/.*:\(.*\)$/\1/")
echo "SERVER_IMAGE is ${SERVER_IMAGE}"
echo "SERVER_IMAGE_TAG is ${SERVER_IMAGE_TAG}"
BINARY=${CLI_BUILD_OUTPUT}/binaries/cli-hasura-linux-amd64
cp ${BINARY} .
docker build -t "${CLI_MIGRATIONS_IMAGE}" . --build-arg SERVER_IMAGE_TAG=$SERVER_IMAGE_TAG
docker save -o "${BUILD_OUTPUT}/v3.tar" "${CLI_MIGRATIONS_IMAGE}" | Shell | 4 | gh-oss-contributor/graphql-engine-1 | scripts/cli-migrations/v3/build.sh | [
"Apache-2.0",
"MIT"
] |
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Menu_Demo.Aux --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control
-- $Revision: 1.11 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus;
package Sample.Menu_Demo.Aux is
procedure Geometry (M : Menu;
L : out Line_Count;
C : out Column_Count;
Y : out Line_Position;
X : out Column_Position);
-- Calculate the geometry for a panel being able to be used to display
-- the menu.
function Create (M : Menu;
Title : String;
Lin : Line_Position;
Col : Column_Position) return Panel;
-- Create a panel decorated with a frame and the title at the specified
-- position. The dimension of the panel is derived from the menus layout.
procedure Destroy (M : Menu;
P : in out Panel);
-- Destroy all the windowing structures associated with this menu and
-- panel.
function Get_Request (M : Menu; P : Panel) return Key_Code;
-- Centralized request driver for all menus in this sample. This
-- gives us a common key binding for all menus.
end Sample.Menu_Demo.Aux;
| Ada | 5 | CandyROM/external_libncurses | Ada95/samples/sample-menu_demo-aux.ads | [
"X11"
] |
/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/Arch/ScopedCritical.h>
#include <Kernel/Arch/Processor.h>
namespace Kernel {
ScopedCritical::ScopedCritical()
{
enter();
}
ScopedCritical::~ScopedCritical()
{
if (m_valid)
leave();
}
ScopedCritical::ScopedCritical(ScopedCritical&& from)
: m_valid(exchange(from.m_valid, false))
{
}
ScopedCritical& ScopedCritical::operator=(ScopedCritical&& from)
{
if (&from != this) {
m_valid = exchange(from.m_valid, false);
}
return *this;
}
void ScopedCritical::leave()
{
VERIFY(m_valid);
m_valid = false;
Processor::leave_critical();
}
void ScopedCritical::enter()
{
VERIFY(!m_valid);
m_valid = true;
Processor::enter_critical();
}
}
| C++ | 4 | r00ster91/serenity | Kernel/Arch/x86/common/ScopedCritical.cpp | [
"BSD-2-Clause"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.