const std = @import("std.zig");
const assert = std.debug.assert;
const io = std.io;
const mem = std.mem;
const os = std.os;
const fs = std.fs;
pub const CoffHeaderFlags = packed struct {
/// Image only, Windows CE, and Microsoft Windows NT and later.
/// This indicates that the file does not contain base relocations
/// and must therefore be loaded at its preferred base address.
/// If the base address is not available, the loader reports an error.
/// The default behavior of the linker is to strip base relocations
/// from executable (EXE) files.
RELOCS_STRIPPED: u1 = 0,
/// Image only. This indicates that the image file is valid and can be run.
/// If this flag is not set, it indicates a linker error.
EXECUTABLE_IMAGE: u1 = 0,
/// COFF line numbers have been removed. This flag is deprecated and should be zero.
LINE_NUMS_STRIPPED: u1 = 0,
/// COFF symbol table entries for local symbols have been removed.
/// This flag is deprecated and should be zero.
LOCAL_SYMS_STRIPPED: u1 = 0,
/// Obsolete. Aggressively trim working set.
/// This flag is deprecated for Windows 2000 and later and must be zero.
AGGRESSIVE_WS_TRIM: u1 = 0,
/// Application can handle > 2-GB addresses.
LARGE_ADDRESS_AWARE: u1 = 0,
/// This flag is reserved for future use.
RESERVED: u1 = 0,
/// Little endian: the least significant bit (LSB) precedes the
/// most significant bit (MSB) in memory. This flag is deprecated and should be zero.
BYTES_REVERSED_LO: u1 = 0,
/// Machine is based on a 32-bit-word architecture.
@"32BIT_MACHINE": u1 = 0,
/// Debugging information is removed from the image file.
DEBUG_STRIPPED: u1 = 0,
/// If the image is on removable media, fully load it and copy it to the swap file.
REMOVABLE_RUN_FROM_SWAP: u1 = 0,
/// If the image is on network media, fully load it and copy it to the swap file.
NET_RUN_FROM_SWAP: u1 = 0,
/// The image file is a system file, not a user program.
SYSTEM: u1 = 0,
/// The image file is a dynamic-link library (DLL).
/// Such files are considered executable files for almost all purposes,
/// although they cannot be directly run.
DLL: u1 = 0,
/// The file should be run only on a uniprocessor machine.
UP_SYSTEM_ONLY: u1 = 0,
/// Big endian: the MSB precedes the LSB in memory. This flag is deprecated and should be zero.
BYTES_REVERSED_HI: u1 = 0,
};
pub const CoffHeader = extern struct {
/// The number that identifies the type of target machine.
machine: MachineType,
/// The number of sections. This indicates the size of the section table, which immediately follows the headers.
number_of_sections: u16,
/// The low 32 bits of the number of seconds since 00:00 January 1, 1970 (a C run-time time_t value),
/// which indicates when the file was created.
time_date_stamp: u32,
/// The file offset of the COFF symbol table, or zero if no COFF symbol table is present.
/// This value should be zero for an image because COFF debugging information is deprecated.
pointer_to_symbol_table: u32,
/// The number of entries in the symbol table.
/// This data can be used to locate the string table, which immediately follows the symbol table.
/// This value should be zero for an image because COFF debugging information is deprecated.
number_of_symbols: u32,
/// The size of the optional header, which is required for executable files but not for object files.
/// This value should be zero for an object file. For a description of the header format, see Optional Header (Image Only).
size_of_optional_header: u16,
/// The flags that indicate the attributes of the file.
flags: CoffHeaderFlags,
};
// OptionalHeader.magic values
// see https://msdn.microsoft.com/en-us/library/windows/desktop/ms680339(v=vs.85).aspx
pub const IMAGE_NT_OPTIONAL_HDR32_MAGIC = 0x10b;
pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC = 0x20b;
pub const DllFlags = packed struct {
_reserved_0: u5 = 0,
/// Image can handle a high entropy 64-bit virtual address space.
HIGH_ENTROPY_VA: u1 = 0,
/// DLL can be relocated at load time.
DYNAMIC_BASE: u1 = 0,
/// Code Integrity checks are enforced.
FORCE_INTEGRITY: u1 = 0,
/// Image is NX compatible.
NX_COMPAT: u1 = 0,
/// Isolation aware, but do not isolate the image.
NO_ISOLATION: u1 = 0,
/// Does not use structured exception (SE) handling. No SE handler may be called in this image.
NO_SEH: u1 = 0,
/// Do not bind the image.
NO_BIND: u1 = 0,
/// Image must execute in an AppContainer.
APPCONTAINER: u1 = 0,
/// A WDM driver.
WDM_DRIVER: u1 = 0,
/// Image supports Control Flow Guard.
GUARD_CF: u1 = 0,
/// Terminal Server aware.
TERMINAL_SERVER_AWARE: u1 = 0,
};
pub const Subsystem = enum(u16) {
/// An unknown subsystem
UNKNOWN = 0,
/// Device drivers and native Windows processes
NATIVE = 1,
/// The Windows graphical user interface (GUI) subsystem
WINDOWS_GUI = 2,
/// The Windows character subsystem
WINDOWS_CUI = 3,
/// The OS/2 character subsystem
OS2_CUI = 5,
/// The Posix character subsystem
POSIX_CUI = 7,
/// Native Win9x driver
NATIVE_WINDOWS = 8,
/// Windows CE
WINDOWS_CE_GUI = 9,
/// An Extensible Firmware Interface (EFI) application
EFI_APPLICATION = 10,
/// An EFI driver with boot services
EFI_BOOT_SERVICE_DRIVER = 11,
/// An EFI driver with run-time services
EFI_RUNTIME_DRIVER = 12,
/// An EFI ROM image
EFI_ROM = 13,
/// XBOX
XBOX = 14,
/// Windows boot application
WINDOWS_BOOT_APPLICATION = 16,
};
pub const OptionalHeader = extern struct {
magic: u16,
major_linker_version: u8,
minor_linker_version: u8,
size_of_code: u32,
size_of_initialized_data: u32,
size_of_uninitialized_data: u32,
address_of_entry_point: u32,
base_of_code: u32,
};
pub const OptionalHeaderPE32 = extern struct {
magic: u16,
major_linker_version: u8,
minor_linker_version: u8,
size_of_code: u32,
size_of_initialized_data: u32,
size_of_uninitialized_data: u32,
address_of_entry_point: u32,
base_of_code: u32,
base_of_data: u32,
image_base: u32,
section_alignment: u32,
file_alignment: u32,
major_operating_system_version: u16,
minor_operating_system_version: u16,
major_image_version: u16,
minor_image_version: u16,
major_subsystem_version: u16,
minor_subsystem_version: u16,
win32_version_value: u32,
size_of_image: u32,
size_of_headers: u32,
checksum: u32,
subsystem: Subsystem,
dll_flags: DllFlags,
size_of_stack_reserve: u32,
size_of_stack_commit: u32,
size_of_heap_reserve: u32,
size_of_heap_commit: u32,
loader_flags: u32,
number_of_rva_and_sizes: u32,
};
pub const OptionalHeaderPE64 = extern struct {
magic: u16,
major_linker_version: u8,
minor_linker_version: u8,
size_of_code: u32,
size_of_initialized_data: u32,
size_of_uninitialized_data: u32,
address_of_entry_point: u32,
base_of_code: u32,
image_base: u64,
section_alignment: u32,
file_alignment: u32,
major_operating_system_version: u16,
minor_operating_system_version: u16,
major_image_version: u16,
minor_image_version: u16,
major_subsystem_version: u16,
minor_subsystem_version: u16,
win32_version_value: u32,
size_of_image: u32,
size_of_headers: u32,
checksum: u32,
subsystem: Subsystem,
dll_flags: DllFlags,
size_of_stack_reserve: u64,
size_of_stack_commit: u64,
size_of_heap_reserve: u64,
size_of_heap_commit: u64,
loader_flags: u32,
number_of_rva_and_sizes: u32,
};
pub const IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16;
pub const DirectoryEntry = enum(u16) {
/// Export Directory
EXPORT = 0,
/// Import Directory
IMPORT = 1,
/// Resource Directory
RESOURCE = 2,
/// Exception Directory
EXCEPTION = 3,
/// Security Directory
SECURITY = 4,
/// Base Relocation Table
BASERELOC = 5,
/// Debug Directory
DEBUG = 6,
/// Architecture Specific Data
ARCHITECTURE = 7,
/// RVA of GP
GLOBALPTR = 8,
/// TLS Directory
TLS = 9,
/// Load Configuration Directory
LOAD_CONFIG = 10,
/// Bound Import Directory in headers
BOUND_IMPORT = 11,
/// Import Address Table
IAT = 12,
/// Delay Load Import Descriptors
DELAY_IMPORT = 13,
/// COM Runtime descriptor
COM_DESCRIPTOR = 14,
};
pub const ImageDataDirectory = extern struct {
virtual_address: u32,
size: u32,
};
pub const BaseRelocationDirectoryEntry = extern struct {
/// The image base plus the page RVA is added to each offset to create the VA where the base relocation must be applied.
page_rva: u32,
/// The total number of bytes in the base relocation block, including the Page RVA and Block Size fields and the Type/Offset fields that follow.
block_size: u32,
};
pub const BaseRelocation = packed struct {
/// Stored in the remaining 12 bits of the WORD, an offset from the starting address that was specified in the Page RVA field for the block.
/// This offset specifies where the base relocation is to be applied.
offset: u12,
/// Stored in the high 4 bits of the WORD, a value that indicates the type of base relocation to be applied.
@"type": BaseRelocationType,
};
pub const BaseRelocationType = enum(u4) {
/// The base relocation is skipped. This type can be used to pad a block.
ABSOLUTE = 0,
/// The base relocation adds the high 16 bits of the difference to the 16-bit field at offset. The 16-bit field represents the high value of a 32-bit word.
HIGH = 1,
/// The base relocation adds the low 16 bits of the difference to the 16-bit field at offset. The 16-bit field represents the low half of a 32-bit word.
LOW = 2,
/// The base relocation applies all 32 bits of the difference to the 32-bit field at offset.
HIGHLOW = 3,
/// The base relocation adds the high 16 bits of the difference to the 16-bit field at offset.
/// The 16-bit field represents the high value of a 32-bit word.
/// The low 16 bits of the 32-bit value are stored in the 16-bit word that follows this base relocation.
/// This means that this base relocation occupies two slots.
HIGHADJ = 4,
/// When the machine type is MIPS, the base relocation applies to a MIPS jump instruction.
MIPS_JMPADDR = 5,
/// This relocation is meaningful only when the machine type is ARM or Thumb.
/// The base relocation applies the 32-bit address of a symbol across a consecutive MOVW/MOVT instruction pair.
// ARM_MOV32 = 5,
/// This relocation is only meaningful when the machine type is RISC-V.
/// The base relocation applies to the high 20 bits of a 32-bit absolute address.
// RISCV_HIGH20 = 5,
/// Reserved, must be zero.
RESERVED = 6,
/// This relocation is meaningful only when the machine type is Thumb.
/// The base relocation applies the 32-bit address of a symbol to a consecutive MOVW/MOVT instruction pair.
THUMB_MOV32 = 7,
/// This relocation is only meaningful when the machine type is RISC-V.
/// The base relocation applies to the low 12 bits of a 32-bit absolute address formed in RISC-V I-type instruction format.
// RISCV_LOW12I = 7,
/// This relocation is only meaningful when the machine type is RISC-V.
/// The base relocation applies to the low 12 bits of a 32-bit absolute address formed in RISC-V S-type instruction format.
RISCV_LOW12S = 8,
/// This relocation is only meaningful when the machine type is LoongArch 32-bit.
/// The base relocation applies to a 32-bit absolute address formed in two consecutive instructions.
// LOONGARCH32_MARK_LA = 8,
/// This relocation is only meaningful when the machine type is LoongArch 64-bit.
/// The base relocation applies to a 64-bit absolute address formed in four consecutive instructions.
// LOONGARCH64_MARK_LA = 8,
/// The relocation is only meaningful when the machine type is MIPS.
/// The base relocation applies to a MIPS16 jump instruction.
MIPS_JMPADDR16 = 9,
/// The base relocation applies the difference to the 64-bit field at offset.
DIR64 = 10,
};
pub const DebugDirectoryEntry = extern struct {
characteristics: u32,
time_date_stamp: u32,
major_version: u16,
minor_version: u16,
@"type": DebugType,
size_of_data: u32,
address_of_raw_data: u32,
pointer_to_raw_data: u32,
};
pub const DebugType = enum(u32) {
UNKNOWN = 0,
COFF = 1,
CODEVIEW = 2,
FPO = 3,
MISC = 4,
EXCEPTION = 5,
FIXUP = 6,
OMAP_TO_SRC = 7,
OMAP_FROM_SRC = 8,
BORLAND = 9,
RESERVED10 = 10,
VC_FEATURE = 12,
POGO = 13,
ILTCG = 14,
MPX = 15,
REPRO = 16,
EX_DLLCHARACTERISTICS = 20,
};
pub const ImportDirectoryEntry = extern struct {
/// The RVA of the import lookup table.
/// This table contains a name or ordinal for each import.
/// (The name "Characteristics" is used in Winnt.h, but no longer describes this field.)
import_lookup_table_rva: u32,
/// The stamp that is set to zero until the image is bound.
/// After the image is bound, this field is set to the time/data stamp of the DLL.
time_date_stamp: u32,
/// The index of the first forwarder reference.
forwarder_chain: u32,
/// The address of an ASCII string that contains the name of the DLL.
/// This address is relative to the image base.
name_rva: u32,
/// The RVA of the import address table.
/// The contents of this table are identical to the contents of the import lookup table until the image is bound.
import_address_table_rva: u32,
};
pub const ImportLookupEntry32 = struct {
pub const ByName = packed struct {
name_table_rva: u31,
flag: u1 = 0,
};
pub const ByOrdinal = packed struct {
ordinal_number: u16,
unused: u15 = 0,
flag: u1 = 1,
};
const mask = 0x80000000;
pub fn getImportByName(raw: u32) ?ByName {
if (mask & raw != 0) return null;
return @bitCast(ByName, raw);
}
pub fn getImportByOrdinal(raw: u32) ?ByOrdinal {
if (mask & raw == 0) return null;
return @bitCast(ByOrdinal, raw);
}
};
pub const ImportLookupEntry64 = struct {
pub const ByName = packed struct {
name_table_rva: u31,
unused: u32 = 0,
flag: u1 = 0,
};
pub const ByOrdinal = packed struct {
ordinal_number: u16,
unused: u47 = 0,
flag: u1 = 1,
};
const mask = 0x8000000000000000;
pub fn getImportByName(raw: u64) ?ByName {
if (mask & raw != 0) return null;
return @bitCast(ByName, raw);
}
pub fn getImportByOrdinal(raw: u64) ?ByOrdinal {
if (mask & raw == 0) return null;
return @bitCast(ByOrdinal, raw);
}
};
/// Every name ends with a NULL byte. IF the NULL byte does not fall on
/// 2byte boundary, the entry structure is padded to ensure 2byte alignment.
pub const ImportHintNameEntry = extern struct {
/// An index into the export name pointer table.
/// A match is attempted first with this value. If it fails, a binary search is performed on the DLL's export name pointer table.
hint: u16,
/// Pointer to NULL terminated ASCII name.
/// Variable length...
name: [1]u8,
};
pub const SectionHeader = extern struct {
name: [8]u8,
virtual_size: u32,
virtual_address: u32,
size_of_raw_data: u32,
pointer_to_raw_data: u32,
pointer_to_relocations: u32,
pointer_to_linenumbers: u32,
number_of_relocations: u16,
number_of_linenumbers: u16,
flags: SectionHeaderFlags,
pub fn getName(self: *align(1) const SectionHeader) ?[]const u8 {
if (self.name[0] == '/') return null;
const len = std.mem.indexOfScalar(u8, &self.name, @as(u8, 0)) orelse self.name.len;
return self.name[0..len];
}
pub fn getNameOffset(self: SectionHeader) ?u32 {
if (self.name[0] != '/') return null;
const len = std.mem.indexOfScalar(u8, &self.name, @as(u8, 0)) orelse self.name.len;
const offset = std.fmt.parseInt(u32, self.name[1..len], 10) catch unreachable;
return offset;
}
/// Applicable only to section headers in COFF objects.
pub fn getAlignment(self: SectionHeader) ?u16 {
if (self.flags.ALIGN == 0) return null;
return std.math.powi(u16, 2, self.flags.ALIGN - 1) catch unreachable;
}
pub fn setAlignment(self: *SectionHeader, new_alignment: u16) void {
assert(new_alignment > 0 and new_alignment <= 8192);
self.flags.ALIGN = std.math.log2(new_alignment);
}
pub fn isCode(self: SectionHeader) bool {
return self.flags.CNT_CODE == 0b1;
}
pub fn isComdat(self: SectionHeader) bool {
return self.flags.LNK_COMDAT == 0b1;
}
};
pub const SectionHeaderFlags = packed struct {
_reserved_0: u3 = 0,
/// The section should not be padded to the next boundary.
/// This flag is obsolete and is replaced by IMAGE_SCN_ALIGN_1BYTES.
/// This is valid only for object files.
TYPE_NO_PAD: u1 = 0,
_reserved_1: u1 = 0,
/// The section contains executable code.
CNT_CODE: u1 = 0,
/// The section contains initialized data.
CNT_INITIALIZED_DATA: u1 = 0,
/// The section contains uninitialized data.
CNT_UNINITIALIZED_DATA: u1 = 0,
/// Reserved for future use.
LNK_OTHER: u1 = 0,
/// The section contains comments or other information.
/// The .drectve section has this type.
/// This is valid for object files only.
LNK_INFO: u1 = 0,
_reserverd_2: u1 = 0,
/// The section will not become part of the image.
/// This is valid only for object files.
LNK_REMOVE: u1 = 0,
/// The section contains COMDAT data.
/// For more information, see COMDAT Sections (Object Only).
/// This is valid only for object files.
LNK_COMDAT: u1 = 0,
_reserved_3: u2 = 0,
/// The section contains data referenced through the global pointer (GP).
GPREL: u1 = 0,
/// Reserved for future use.
MEM_PURGEABLE: u1 = 0,
/// Reserved for future use.
MEM_16BIT: u1 = 0,
/// Reserved for future use.
MEM_LOCKED: u1 = 0,
/// Reserved for future use.
MEM_PRELOAD: u1 = 0,
/// Takes on multiple values according to flags:
/// pub const IMAGE_SCN_ALIGN_1BYTES: u32 = 0x100000;
/// pub const IMAGE_SCN_ALIGN_2BYTES: u32 = 0x200000;
/// pub const IMAGE_SCN_ALIGN_4BYTES: u32 = 0x300000;
/// pub const IMAGE_SCN_ALIGN_8BYTES: u32 = 0x400000;
/// pub const IMAGE_SCN_ALIGN_16BYTES: u32 = 0x500000;
/// pub const IMAGE_SCN_ALIGN_32BYTES: u32 = 0x600000;
/// pub const IMAGE_SCN_ALIGN_64BYTES: u32 = 0x700000;
/// pub const IMAGE_SCN_ALIGN_128BYTES: u32 = 0x800000;
/// pub const IMAGE_SCN_ALIGN_256BYTES: u32 = 0x900000;
/// pub const IMAGE_SCN_ALIGN_512BYTES: u32 = 0xA00000;
/// pub const IMAGE_SCN_ALIGN_1024BYTES: u32 = 0xB00000;
/// pub const IMAGE_SCN_ALIGN_2048BYTES: u32 = 0xC00000;
/// pub const IMAGE_SCN_ALIGN_4096BYTES: u32 = 0xD00000;
/// pub const IMAGE_SCN_ALIGN_8192BYTES: u32 = 0xE00000;
ALIGN: u4 = 0,
/// The section contains extended relocations.
LNK_NRELOC_OVFL: u1 = 0,
/// The section can be discarded as needed.
MEM_DISCARDABLE: u1 = 0,
/// The section cannot be cached.
MEM_NOT_CACHED: u1 = 0,
/// The section is not pageable.
MEM_NOT_PAGED: u1 = 0,
/// The section can be shared in memory.
MEM_SHARED: u1 = 0,
/// The section can be executed as code.
MEM_EXECUTE: u1 = 0,
/// The section can be read.
MEM_READ: u1 = 0,
/// The section can be written to.
MEM_WRITE: u1 = 0,
};
pub const Symbol = struct {
name: [8]u8,
value: u32,
section_number: SectionNumber,
@"type": SymType,
storage_class: StorageClass,
number_of_aux_symbols: u8,
pub fn sizeOf() usize {
return 18;
}
pub fn getName(self: *const Symbol) ?[]const u8 {
if (std.mem.eql(u8, self.name[0..4], "\x00\x00\x00\x00")) return null;
const len = std.mem.indexOfScalar(u8, &self.name, @as(u8, 0)) orelse self.name.len;
return self.name[0..len];
}
pub fn getNameOffset(self: Symbol) ?u32 {
if (!std.mem.eql(u8, self.name[0..4], "\x00\x00\x00\x00")) return null;
const offset = std.mem.readIntLittle(u32, self.name[4..8]);
return offset;
}
};
pub const SectionNumber = enum(u16) {
/// The symbol record is not yet assigned a section.
/// A value of zero indicates that a reference to an external symbol is defined elsewhere.
/// A value of non-zero is a common symbol with a size that is specified by the value.
UNDEFINED = 0,
/// The symbol has an absolute (non-relocatable) value and is not an address.
ABSOLUTE = 0xffff,
/// The symbol provides general type or debugging information but does not correspond to a section.
/// Microsoft tools use this setting along with .file records (storage class FILE).
DEBUG = 0xfffe,
_,
};
pub const SymType = packed struct {
complex_type: ComplexType,
base_type: BaseType,
};
pub const BaseType = enum(u8) {
/// No type information or unknown base type. Microsoft tools use this setting
NULL = 0,
/// No valid type; used with void pointers and functions
VOID = 1,
/// A character (signed byte)
CHAR = 2,
/// A 2-byte signed integer
SHORT = 3,
/// A natural integer type (normally 4 bytes in Windows)
INT = 4,
/// A 4-byte signed integer
LONG = 5,
/// A 4-byte floating-point number
FLOAT = 6,
/// An 8-byte floating-point number
DOUBLE = 7,
/// A structure
STRUCT = 8,
/// A union
UNION = 9,
/// An enumerated type
ENUM = 10,
/// A member of enumeration (a specified value)
MOE = 11,
/// A byte; unsigned 1-byte integer
BYTE = 12,
/// A word; unsigned 2-byte integer
WORD = 13,
/// An unsigned integer of natural size (normally, 4 bytes)
UINT = 14,
/// An unsigned 4-byte integer
DWORD = 15,
};
pub const ComplexType = enum(u8) {
/// No derived type; the symbol is a simple scalar variable.
NULL = 0,
/// The symbol is a pointer to base type.
POINTER = 16,
/// The symbol is a function that returns a base type.
FUNCTION = 32,
/// The symbol is an array of base type.
ARRAY = 48,
};
pub const StorageClass = enum(u8) {
/// A special symbol that represents the end of function, for debugging purposes.
END_OF_FUNCTION = 0xff,
/// No assigned storage class.
NULL = 0,
/// The automatic (stack) variable. The Value field specifies the stack frame offset.
AUTOMATIC = 1,
/// A value that Microsoft tools use for external symbols.
/// The Value field indicates the size if the section number is IMAGE_SYM_UNDEFINED (0).
/// If the section number is not zero, then the Value field specifies the offset within the section.
EXTERNAL = 2,
/// The offset of the symbol within the section.
/// If the Value field is zero, then the symbol represents a section name.
STATIC = 3,
/// A register variable.
/// The Value field specifies the register number.
REGISTER = 4,
/// A symbol that is defined externally.
EXTERNAL_DEF = 5,
/// A code label that is defined within the module.
/// The Value field specifies the offset of the symbol within the section.
LABEL = 6,
/// A reference to a code label that is not defined.
UNDEFINED_LABEL = 7,
/// The structure member. The Value field specifies the n th member.
MEMBER_OF_STRUCT = 8,
/// A formal argument (parameter) of a function. The Value field specifies the n th argument.
ARGUMENT = 9,
/// The structure tag-name entry.
STRUCT_TAG = 10,
/// A union member. The Value field specifies the n th member.
MEMBER_OF_UNION = 11,
/// The Union tag-name entry.
UNION_TAG = 12,
/// A Typedef entry.
TYPE_DEFINITION = 13,
/// A static data declaration.
UNDEFINED_STATIC = 14,
/// An enumerated type tagname entry.
ENUM_TAG = 15,
/// A member of an enumeration. The Value field specifies the n th member.
MEMBER_OF_ENUM = 16,
/// A register parameter.
REGISTER_PARAM = 17,
/// A bit-field reference. The Value field specifies the n th bit in the bit field.
BIT_FIELD = 18,
/// A .bb (beginning of block) or .eb (end of block) record.
/// The Value field is the relocatable address of the code location.
BLOCK = 100,
/// A value that Microsoft tools use for symbol records that define the extent of a function: begin function (.bf ), end function ( .ef ), and lines in function ( .lf ).
/// For .lf records, the Value field gives the number of source lines in the function.
/// For .ef records, the Value field gives the size of the function code.
FUNCTION = 101,
/// An end-of-structure entry.
END_OF_STRUCT = 102,
/// A value that Microsoft tools, as well as traditional COFF format, use for the source-file symbol record.
/// The symbol is followed by auxiliary records that name the file.
FILE = 103,
/// A definition of a section (Microsoft tools use STATIC storage class instead).
SECTION = 104,
/// A weak external. For more information, see Auxiliary Format 3: Weak Externals.
WEAK_EXTERNAL = 105,
/// A CLR token symbol. The name is an ASCII string that consists of the hexadecimal value of the token.
/// For more information, see CLR Token Definition (Object Only).
CLR_TOKEN = 107,
};
pub const FunctionDefinition = struct {
/// The symbol-table index of the corresponding .bf (begin function) symbol record.
tag_index: u32,
/// The size of the executable code for the function itself.
/// If the function is in its own section, the SizeOfRawData in the section header is greater or equal to this field,
/// depending on alignment considerations.
total_size: u32,
/// The file offset of the first COFF line-number entry for the function, or zero if none exists.
pointer_to_linenumber: u32,
/// The symbol-table index of the record for the next function.
/// If the function is the last in the symbol table, this field is set to zero.
pointer_to_next_function: u32,
unused: [2]u8,
};
pub const SectionDefinition = struct {
/// The size of section data; the same as SizeOfRawData in the section header.
length: u32,
/// The number of relocation entries for the section.
number_of_relocations: u16,
/// The number of line-number entries for the section.
number_of_linenumbers: u16,
/// The checksum for communal data. It is applicable if the IMAGE_SCN_LNK_COMDAT flag is set in the section header.
checksum: u32,
/// One-based index into the section table for the associated section. This is used when the COMDAT selection setting is 5.
number: u16,
/// The COMDAT selection number. This is applicable if the section is a COMDAT section.
selection: ComdatSelection,
unused: [3]u8,
};
pub const FileDefinition = struct {
/// An ANSI string that gives the name of the source file.
/// This is padded with nulls if it is less than the maximum length.
file_name: [18]u8,
pub fn getFileName(self: *const FileDefinition) []const u8 {
const len = std.mem.indexOfScalar(u8, &self.file_name, @as(u8, 0)) orelse self.file_name.len;
return self.file_name[0..len];
}
};
pub const WeakExternalDefinition = struct {
/// The symbol-table index of sym2, the symbol to be linked if sym1 is not found.
tag_index: u32,
/// A value of IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY indicates that no library search for sym1 should be performed.
/// A value of IMAGE_WEAK_EXTERN_SEARCH_LIBRARY indicates that a library search for sym1 should be performed.
/// A value of IMAGE_WEAK_EXTERN_SEARCH_ALIAS indicates that sym1 is an alias for sym2.
flag: WeakExternalFlag,
unused: [10]u8,
};
// https://github.com/tpn/winsdk-10/blob/master/Include/10.0.16299.0/km/ntimage.h
pub const WeakExternalFlag = enum(u32) {
SEARCH_NOLIBRARY = 1,
SEARCH_LIBRARY = 2,
SEARCH_ALIAS = 3,
ANTI_DEPENDENCY = 4,
};
pub const ComdatSelection = enum(u8) {
/// Not a COMDAT section.
NONE = 0,
/// If this symbol is already defined, the linker issues a "multiply defined symbol" error.
NODUPLICATES = 1,
/// Any section that defines the same COMDAT symbol can be linked; the rest are removed.
ANY = 2,
/// The linker chooses an arbitrary section among the definitions for this symbol.
/// If all definitions are not the same size, a "multiply defined symbol" error is issued.
SAME_SIZE = 3,
/// The linker chooses an arbitrary section among the definitions for this symbol.
/// If all definitions do not match exactly, a "multiply defined symbol" error is issued.
EXACT_MATCH = 4,
/// The section is linked if a certain other COMDAT section is linked.
/// This other section is indicated by the Number field of the auxiliary symbol record for the section definition.
/// This setting is useful for definitions that have components in multiple sections
/// (for example, code in one and data in another), but where all must be linked or discarded as a set.
/// The other section this section is associated with must be a COMDAT section, which can be another
/// associative COMDAT section. An associative COMDAT section's section association chain can't form a loop.
/// The section association chain must eventually come to a COMDAT section that doesn't have IMAGE_COMDAT_SELECT_ASSOCIATIVE set.
ASSOCIATIVE = 5,
/// The linker chooses the largest definition from among all of the definitions for this symbol.
/// If multiple definitions have this size, the choice between them is arbitrary.
LARGEST = 6,
};
pub const DebugInfoDefinition = struct {
unused_1: [4]u8,
/// The actual ordinal line number (1, 2, 3, and so on) within the source file, corresponding to the .bf or .ef record.
linenumber: u16,
unused_2: [6]u8,
/// The symbol-table index of the next .bf symbol record.
/// If the function is the last in the symbol table, this field is set to zero.
/// It is not used for .ef records.
pointer_to_next_function: u32,
unused_3: [2]u8,
};
pub const MachineType = enum(u16) {
Unknown = 0x0,
/// Matsushita AM33
AM33 = 0x1d3,
/// x64
X64 = 0x8664,
/// ARM little endian
ARM = 0x1c0,
/// ARM64 little endian
ARM64 = 0xaa64,
/// ARM Thumb-2 little endian
ARMNT = 0x1c4,
/// EFI byte code
EBC = 0xebc,
/// Intel 386 or later processors and compatible processors
I386 = 0x14c,
/// Intel Itanium processor family
IA64 = 0x200,
/// Mitsubishi M32R little endian
M32R = 0x9041,
/// MIPS16
MIPS16 = 0x266,
/// MIPS with FPU
MIPSFPU = 0x366,
/// MIPS16 with FPU
MIPSFPU16 = 0x466,
/// Power PC little endian
POWERPC = 0x1f0,
/// Power PC with floating point support
POWERPCFP = 0x1f1,
/// MIPS little endian
R4000 = 0x166,
/// RISC-V 32-bit address space
RISCV32 = 0x5032,
/// RISC-V 64-bit address space
RISCV64 = 0x5064,
/// RISC-V 128-bit address space
RISCV128 = 0x5128,
/// Hitachi SH3
SH3 = 0x1a2,
/// Hitachi SH3 DSP
SH3DSP = 0x1a3,
/// Hitachi SH4
SH4 = 0x1a6,
/// Hitachi SH5
SH5 = 0x1a8,
/// Thumb
Thumb = 0x1c2,
/// MIPS little-endian WCE v2
WCEMIPSV2 = 0x169,
pub fn fromTargetCpuArch(arch: std.Target.Cpu.Arch) MachineType {
return switch (arch) {
.arm => .ARM,
.powerpc => .POWERPC,
.riscv32 => .RISCV32,
.thumb => .Thumb,
.i386 => .I386,
.aarch64 => .ARM64,
.riscv64 => .RISCV64,
.x86_64 => .X64,
// there's cases we don't (yet) handle
else => unreachable,
};
}
pub fn toTargetCpuArch(machine_type: MachineType) ?std.Target.Cpu.Arch {
return switch (machine_type) {
.ARM => .arm,
.POWERPC => .powerpc,
.RISCV32 => .riscv32,
.Thumb => .thumb,
.I386 => .i386,
.ARM64 => .aarch64,
.RISCV64 => .riscv64,
.X64 => .x86_64,
// there's cases we don't (yet) handle
else => null,
};
}
};
pub const CoffError = error{
InvalidPEMagic,
InvalidPEHeader,
InvalidMachine,
MissingPEHeader,
MissingCoffSection,
MissingStringTable,
};
// Official documentation of the format: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
pub const Coff = struct {
allocator: mem.Allocator,
data: []const u8 = undefined,
is_image: bool = false,
coff_header_offset: usize = 0,
guid: [16]u8 = undefined,
age: u32 = undefined,
pub fn deinit(self: *Coff) void {
self.allocator.free(self.data);
}
/// Takes ownership of `data`.
pub fn parse(self: *Coff, data: []const u8) !void {
self.data = data;
const pe_pointer_offset = 0x3C;
const pe_magic = "PE\x00\x00";
var stream = std.io.fixedBufferStream(self.data);
const reader = stream.reader();
try stream.seekTo(pe_pointer_offset);
const coff_header_offset = try reader.readIntLittle(u32);
try stream.seekTo(coff_header_offset);
var buf: [4]u8 = undefined;
try reader.readNoEof(&buf);
self.is_image = mem.eql(u8, pe_magic, &buf);
// Do some basic validation upfront
if (self.is_image) {
self.coff_header_offset = coff_header_offset + 4;
const coff_header = self.getCoffHeader();
if (coff_header.size_of_optional_header == 0) return error.MissingPEHeader;
}
// JK: we used to check for architecture here and throw an error if not x86 or derivative.
// However I am willing to take a leap of faith and let aarch64 have a shot also.
}
pub fn getPdbPath(self: *Coff, buffer: []u8) !usize {
assert(self.is_image);
const header = blk: {
if (self.getSectionByName(".buildid")) |hdr| {
break :blk hdr;
} else if (self.getSectionByName(".rdata")) |hdr| {
break :blk hdr;
} else {
return error.MissingCoffSection;
}
};
const data_dirs = self.getDataDirectories();
const debug_dir = data_dirs[@enumToInt(DirectoryEntry.DEBUG)];
const file_offset = debug_dir.virtual_address - header.virtual_address + header.pointer_to_raw_data;
var stream = std.io.fixedBufferStream(self.data);
const reader = stream.reader();
try stream.seekTo(file_offset);
// Find the correct DebugDirectoryEntry, and where its data is stored.
// It can be in any section.
const debug_dir_entry_count = debug_dir.size / @sizeOf(DebugDirectoryEntry);
var i: u32 = 0;
blk: while (i < debug_dir_entry_count) : (i += 1) {
const debug_dir_entry = try reader.readStruct(DebugDirectoryEntry);
if (debug_dir_entry.type == .CODEVIEW) {
for (self.getSectionHeaders()) |*section| {
const section_start = section.virtual_address;
const section_size = section.virtual_size;
const rva = debug_dir_entry.address_of_raw_data;
const offset = rva - section_start;
if (section_start <= rva and offset < section_size and debug_dir_entry.size_of_data <= section_size - offset) {
try stream.seekTo(section.pointer_to_raw_data + offset);
break :blk;
}
}
}
}
var cv_signature: [4]u8 = undefined; // CodeView signature
try reader.readNoEof(cv_signature[0..]);
// 'RSDS' indicates PDB70 format, used by lld.
if (!mem.eql(u8, &cv_signature, "RSDS"))
return error.InvalidPEMagic;
try reader.readNoEof(self.guid[0..]);
self.age = try reader.readIntLittle(u32);
// Finally read the null-terminated string.
var byte = try reader.readByte();
i = 0;
while (byte != 0 and i < buffer.len) : (i += 1) {
buffer[i] = byte;
byte = try reader.readByte();
}
if (byte != 0 and i == buffer.len)
return error.NameTooLong;
return @as(usize, i);
}
pub fn getCoffHeader(self: Coff) CoffHeader {
return @ptrCast(*align(1) const CoffHeader, self.data[self.coff_header_offset..][0..@sizeOf(CoffHeader)]).*;
}
pub fn getOptionalHeader(self: Coff) OptionalHeader {
assert(self.is_image);
const offset = self.coff_header_offset + @sizeOf(CoffHeader);
return @ptrCast(*align(1) const OptionalHeader, self.data[offset..][0..@sizeOf(OptionalHeader)]).*;
}
pub fn getOptionalHeader32(self: Coff) OptionalHeaderPE32 {
assert(self.is_image);
const offset = self.coff_header_offset + @sizeOf(CoffHeader);
return @ptrCast(*align(1) const OptionalHeaderPE32, self.data[offset..][0..@sizeOf(OptionalHeaderPE32)]).*;
}
pub fn getOptionalHeader64(self: Coff) OptionalHeaderPE64 {
assert(self.is_image);
const offset = self.coff_header_offset + @sizeOf(CoffHeader);
return @ptrCast(*align(1) const OptionalHeaderPE64, self.data[offset..][0..@sizeOf(OptionalHeaderPE64)]).*;
}
pub fn getImageBase(self: Coff) u64 {
const hdr = self.getOptionalHeader();
return switch (hdr.magic) {
IMAGE_NT_OPTIONAL_HDR32_MAGIC => self.getOptionalHeader32().image_base,
IMAGE_NT_OPTIONAL_HDR64_MAGIC => self.getOptionalHeader64().image_base,
else => unreachable, // We assume we have validated the header already
};
}
pub fn getNumberOfDataDirectories(self: Coff) u32 {
const hdr = self.getOptionalHeader();
return switch (hdr.magic) {
IMAGE_NT_OPTIONAL_HDR32_MAGIC => self.getOptionalHeader32().number_of_rva_and_sizes,
IMAGE_NT_OPTIONAL_HDR64_MAGIC => self.getOptionalHeader64().number_of_rva_and_sizes,
else => unreachable, // We assume we have validated the header already
};
}
pub fn getDataDirectories(self: *const Coff) []align(1) const ImageDataDirectory {
const hdr = self.getOptionalHeader();
const size: usize = switch (hdr.magic) {
IMAGE_NT_OPTIONAL_HDR32_MAGIC => @sizeOf(OptionalHeaderPE32),
IMAGE_NT_OPTIONAL_HDR64_MAGIC => @sizeOf(OptionalHeaderPE64),
else => unreachable, // We assume we have validated the header already
};
const offset = self.coff_header_offset + @sizeOf(CoffHeader) + size;
return @ptrCast([*]align(1) const ImageDataDirectory, self.data[offset..])[0..self.getNumberOfDataDirectories()];
}
pub fn getSymtab(self: *const Coff) ?Symtab {
const coff_header = self.getCoffHeader();
if (coff_header.pointer_to_symbol_table == 0) return null;
const offset = coff_header.pointer_to_symbol_table;
const size = coff_header.number_of_symbols * Symbol.sizeOf();
return .{ .buffer = self.data[offset..][0..size] };
}
pub fn getStrtab(self: *const Coff) ?Strtab {
const coff_header = self.getCoffHeader();
if (coff_header.pointer_to_symbol_table == 0) return null;
const offset = coff_header.pointer_to_symbol_table + Symbol.sizeOf() * coff_header.number_of_symbols;
const size = mem.readIntLittle(u32, self.data[offset..][0..4]);
return Strtab{ .buffer = self.data[offset..][0..size] };
}
pub fn getSectionHeaders(self: *const Coff) []align(1) const SectionHeader {
const coff_header = self.getCoffHeader();
const offset = self.coff_header_offset + @sizeOf(CoffHeader) + coff_header.size_of_optional_header;
return @ptrCast([*]align(1) const SectionHeader, self.data.ptr + offset)[0..coff_header.number_of_sections];
}
pub fn getSectionName(self: *const Coff, sect_hdr: *align(1) const SectionHeader) []const u8 {
const name = sect_hdr.getName() orelse blk: {
const strtab = self.getStrtab().?;
const name_offset = sect_hdr.getNameOffset().?;
break :blk strtab.get(name_offset);
};
return name;
}
pub fn getSectionByName(self: *const Coff, comptime name: []const u8) ?*align(1) const SectionHeader {
for (self.getSectionHeaders()) |*sect| {
if (mem.eql(u8, self.getSectionName(sect), name)) {
return sect;
}
}
return null;
}
// Return an owned slice full of the section data
pub fn getSectionDataAlloc(self: *const Coff, comptime name: []const u8, allocator: mem.Allocator) ![]u8 {
const sec = self.getSectionByName(name) orelse return error.MissingCoffSection;
const out_buff = try allocator.alloc(u8, sec.virtual_size);
mem.copy(u8, out_buff, self.data[sec.pointer_to_raw_data..][0..sec.virtual_size]);
return out_buff;
}
};
pub const Symtab = struct {
buffer: []const u8,
pub fn len(self: Symtab) usize {
return @divExact(self.buffer.len, Symbol.sizeOf());
}
pub const Tag = enum {
symbol,
func_def,
debug_info,
weak_ext,
file_def,
sect_def,
};
pub const Record = union(Tag) {
symbol: Symbol,
debug_info: DebugInfoDefinition,
func_def: FunctionDefinition,
weak_ext: WeakExternalDefinition,
file_def: FileDefinition,
sect_def: SectionDefinition,
};
/// Lives as long as Symtab instance.
pub fn at(self: Symtab, index: usize, tag: Tag) Record {
const offset = index * Symbol.sizeOf();
const raw = self.buffer[offset..][0..Symbol.sizeOf()];
return switch (tag) {
.symbol => .{ .symbol = asSymbol(raw) },
.debug_info => .{ .debug_info = asDebugInfo(raw) },
.func_def => .{ .func_def = asFuncDef(raw) },
.weak_ext => .{ .weak_ext = asWeakExtDef(raw) },
.file_def => .{ .file_def = asFileDef(raw) },
.sect_def => .{ .sect_def = asSectDef(raw) },
};
}
fn asSymbol(raw: []const u8) Symbol {
return .{
.name = raw[0..8].*,
.value = mem.readIntLittle(u32, raw[8..12]),
.section_number = @intToEnum(SectionNumber, mem.readIntLittle(u16, raw[12..14])),
.@"type" = @bitCast(SymType, mem.readIntLittle(u16, raw[14..16])),
.storage_class = @intToEnum(StorageClass, raw[16]),
.number_of_aux_symbols = raw[17],
};
}
fn asDebugInfo(raw: []const u8) DebugInfoDefinition {
return .{
.unused_1 = raw[0..4].*,
.linenumber = mem.readIntLittle(u16, raw[4..6]),
.unused_2 = raw[6..12].*,
.pointer_to_next_function = mem.readIntLittle(u32, raw[12..16]),
.unused_3 = raw[16..18].*,
};
}
fn asFuncDef(raw: []const u8) FunctionDefinition {
return .{
.tag_index = mem.readIntLittle(u32, raw[0..4]),
.total_size = mem.readIntLittle(u32, raw[4..8]),
.pointer_to_linenumber = mem.readIntLittle(u32, raw[8..12]),
.pointer_to_next_function = mem.readIntLittle(u32, raw[12..16]),
.unused = raw[16..18].*,
};
}
fn asWeakExtDef(raw: []const u8) WeakExternalDefinition {
return .{
.tag_index = mem.readIntLittle(u32, raw[0..4]),
.flag = @intToEnum(WeakExternalFlag, mem.readIntLittle(u32, raw[4..8])),
.unused = raw[8..18].*,
};
}
fn asFileDef(raw: []const u8) FileDefinition {
return .{
.file_name = raw[0..18].*,
};
}
fn asSectDef(raw: []const u8) SectionDefinition {
return .{
.length = mem.readIntLittle(u32, raw[0..4]),
.number_of_relocations = mem.readIntLittle(u16, raw[4..6]),
.number_of_linenumbers = mem.readIntLittle(u16, raw[6..8]),
.checksum = mem.readIntLittle(u32, raw[8..12]),
.number = mem.readIntLittle(u16, raw[12..14]),
.selection = @intToEnum(ComdatSelection, raw[14]),
.unused = raw[15..18].*,
};
}
pub const Slice = struct {
buffer: []const u8,
num: usize,
count: usize = 0,
/// Lives as long as Symtab instance.
pub fn next(self: *Slice) ?Symbol {
if (self.count >= self.num) return null;
const sym = asSymbol(self.buffer[0..Symbol.sizeOf()]);
self.count += 1;
self.buffer = self.buffer[Symbol.sizeOf()..];
return sym;
}
};
pub fn slice(self: Symtab, start: usize, end: ?usize) Slice {
const offset = start * Symbol.sizeOf();
const llen = if (end) |e| e * Symbol.sizeOf() else self.buffer.len;
const num = @divExact(llen - offset, Symbol.sizeOf());
return Slice{ .buffer = self.buffer[offset..][0..llen], .num = num };
}
};
pub const Strtab = struct {
buffer: []const u8,
pub fn get(self: Strtab, off: u32) []const u8 {
assert(off < self.buffer.len);
return mem.sliceTo(@ptrCast([*:0]const u8, self.buffer.ptr + off), 0);
}
};


Alerts, annotations, widget creation, and more — all activity related to you and your dashboards will be displayed here.
{{item.message}}


A developer blog
So today I read an article that suggested every developer should have a developer blog. Something about how it encourages one to properly research and understand the stuff you blog about. I've previously had a developer blog but they do require effort to keep them going. It was at Java Splab. Feel free to look at it, but it's pretty dated now. I mention it here for posterity.
So I'm going to give it another go, and see how far I get. At the very least it's been fun learning how GitHub pages work.
Why Splab?
When I was a young 'un, I was quite into my surfing. One of the surfing magazines I subscribed to had a column called Daily Splab, or something to that effect, and it always stuck with me as a great term to describe a brain dump of sorts, of a current topic of interest, or experience.
Who are you?
I'm a middle aged software developer living in Cape Town, South Africa, and as of 2008 I've been the lead platform developer for a small startup called CentraStage, in the UK. Since around 2009'ish, we've hosted our infrastructure on the AWS platform, and it's been a great experience. In August 2014 we were acquired by a US PSA company called Autotask, and it's continued to be a great experience under their watch. They've allowed us to do what we do best, and I hope to use this blog as a way to document stuff I've learned, stuff we've done, and basically just capture my thoughts as a sort of syslog of my mind. Amazon has done an awesome job with AWS, and I hope somebody else finds it useful as well.


Class DBSStatusHandle
java.lang.Object
DBSStatusHandle
- public class DBSStatusHandle
- extends java.lang.Object
This class handles different status types and their effect on characters.
Like DBSTypeHandle
, this is a completely static class.
- Version:
- 0.1 Java
- Author:
- Evan Hildreth, root -1 Entertainment
|
Method Summary |
static boolean |
Act(int status,
DBSCharacter inflicted)
Does stuff to the character based on status inflicted. |
static boolean |
IsLegalStatus(int status)
returns true if status is a given status in this class |
static java.lang.String |
Name(int status)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KO
public static final int KO
- See Also:
- Constant Field Values
Normal
public static final int Normal
- See Also:
- Constant Field Values
Poison
public static final int Poison
- See Also:
- Constant Field Values
Sleep
public static final int Sleep
- See Also:
- Constant Field Values
TotNumStatus
public static final int TotNumStatus
- See Also:
- Constant Field Values
DBSStatusHandle
public DBSStatusHandle()
Act
public static boolean Act(int status,
DBSCharacter inflicted)
- Does stuff to the character based on status inflicted. Returns whether
or not character is allowed to have a turn.
- Parameters:
status
- Status inflicted (use public constants)inflicted
- DBSCharacter
inflicted with said status
- Returns:
- If inflicted can have a turn
IsLegalStatus
public static boolean IsLegalStatus(int status)
- returns true if status is a given status in this class
Name
public static java.lang.String Name(int status)


These links demonstrate the non-servlet handling capabilities of Jetty. Handlers would be used instead of servlets if requests need to be modified or more complex handling than that offered by the servlet API is needed:


Please turn JavaScript on to use this site, then refresh the page.
Chat
Chat
Change name
User list
About
Chat
Back
Loading...
Send
Change name
Back
Send
Saved
User list
Back
About
Back
Chat
Version
1.0.1
Author
Denis Meyer
CallToPower Software
All rights reserved.


We collected 65000 matches using Dota2 API. We cleaned the data set during our collection process.
Valve (Dota2 Publisher) provides a strong Web API for developers to fetch both match and player data. For this project, we built a local python script which calls the Dota2 Web API and save each results into a local file.
However, there are lot of factors that would affect the data set that we expected. Therefore, We filtered out the invalid and inappropiate data during our collection.
The match details we fetched with the Web API include every single match generated (not completed). Therefore, there are quite a lot matches with absent players, little match duration or zero skills and item build. We identified these matches as invalid matches during our collection process, and added arguments to detect invalid matches.
In addition to invalid games, we also encountered a lot of private matches, which are mostly practice matches (does not count for win or lose) and local matches which we have no access to. We also filtered out these matches.
There are currently 23 modes of game in Dota2. However, not all of them are typical. For example, only two players play against each other in the "Mid Only" mode, which cannot fit into our data. In addition, entertaining modes like "Ability Draft" or "All Random Death Match" can also negatively affect our data set.
Therefore the final 7 modes we selected is:
· All Pick : Players can select any hero from a pool of 115 heros.
· Ranked All Pick : Ranked Matches. Players can select any hero from a pool of 115 heros.
· Captain’s Mode : The most common mode used in professional matches. Each team would have a captain. Two teams ban and pick heros from a pool of 115 heros with a specific order.
· Random Draft : Each player can select a hero from from a pool of 50 random heros.
· Captains Draft : Similar to Captain's Mode. But with a pool of 50 random heros.
· Single Draft : Players will be given 3 heros randomly. They can only choose one hero from the three.
· All Random : Each player will be randomly assigned a hero. They can have only one chance to re-random.
These seven modes are the most common and typical game modes in Dota2, which we believe can be used safely to be combined into our data set.
We built two models in total - "Logistic Regression" and "Nerual Network" - to help predict the winning side. And for the final production, we choose the one with higher accuracy.
DotA2 has a player matching mechanism that will automatically match the players with similar competition level (also called “matchmaking ranking”) together in a match. By assuming every player in a match can play the game equally well, we can simplify our prediction for the match result by solely focusing on hero selection (the role each player chooses in a match). More specifically, our analysis aims to capture the effect of the following three types of input on the match outcome: which heroes are playing in a given match, which heroes are being played together as a lineup of five, and which lineup of five opposing heroes they are competing against.
Under such assumption, we designed our feature vector as follows: since there are 120 heroes in total in DotA2 and we want to distinguish hero selection on either the “Radiant” or “Dire” side, the input feature vector is constructed as a binary vector x ∈ R (120x2) encoding the presence or absence of a hero in the match. The first half of the feature vector (X1 ...X120) represents the Radiant side and the second half (X121…X240) represents the Dire side. More specifically, the first half of the feature vector is constructed as follows:
Similarly, the second half of the feature vector is constructed as follows:
Drawing on existing literature of sports analytics, we experimented with two machine learning models for predicting DotA2 match outcomes: Logistic Regression and Neural Networks. We finally decided to use Neural Networks because it has been shown to be most effective at our prediction task.
After randomly splitting the entire dataset (65,921 matches) into training (46,144 matches) and test dataset (19,777 matches), we first tried logistic regression model on the training data and followed up with 10-fold cross validation to check if the result holds up more precisely. The logistic regression model aims to minimize the following cost function:
The model accuracy on the test data is around 59.1%. This is further affirmed by an accuracy of 59.3% obtained through 10-fold cross validation. However, a test error of 41% is not sufficient for our prediction task. We therefore proceeded to experiment with the Neural Network model.
We experimented with different configurations of neural networks to find the optimal approach. For our purpose, the most successful neural net used three layers, 12 and 6 neurons in the first two layers with the rectifier (‘relu’) activation function and the sigmoid function on the output layer. Relu has been commonly used as an activation function because it performed better than sigmoid activation functions in deep NNs (Glorot, Bordes, and Bengio, 2011). Sigmoid function is used to ensure our network output is between 0 and 1 and easy to map to either the Radiant or the Dire class. The network architecture is shown below.
After training the model for 150 epochs, our neural network successfully achieved an accuracy of 73% on test data. The train and test accuracy for all 150 epochs is plotted in the chart below. We can see that the model is showing comparable skills on both the train and test data, indicating that our neural net has not overfit the data.
References
Glorot, X., Bordes, A., and Bengio, Y. (2011). Deep sparse rectifier networks. In AISTATS, vol. 15 (pp. 315323).
Song, K., Zhang, T., & Ma, C. (2015). Predicting the winning side of DotA2.
Kalyanaraman (2015). To win or not to win? A prediction model to determine the outcome of a DotA2 match
There are still plenty of improvements that can make our prediction more accurate.
Currently, the model we built can help us predicting the winning side of a game before the game starts. However, we would like to build a more powerful model that can predict the winning side during a match in real-time, which can also take player's level into account. There are several factors that we need to take into account to improve our model.
For the current model we built, we are assuming that each player in a match is playing equally (with the same abilities to play any hero). However, in real world matches, player's ability to play each hero varies. For example, one plays quite good at Anitimage will probably perform poorly playing Lion. The positions and heros a player is good at should therefore be taken into consideration to analyze the result of a match.
For our future study, we expect to take the player's past hero experience into account when building our model, so the model could more accurately predict the winning side.
Items and skills are also the key factors that can influnce win or lose. For example, the wrong item build on a specific hero might be the main reason of losing the game. Therefore, we hope that through item and skill analysis, we could reduce the impact of hero drafts on the final results. Or in other words, the draft should not be used to predict the winning side alone.
To achieve real-time prediction, we would like to gamify the prediction process. For example, we would like to use the Dota2 map as the background and monitor the match through hero icons moving over the map.
This process would require that our model should take the item and skill as both factors and outputs. Therefore, gamification is our ultimate goal for Dota2 prediction.


Convenience methods for processing and testing tables. One set of utility methods for list-like tables and another for hash-like tables.
In all methods below, the term ‘list’ or ‘hash’ refers to a Lua table. Lua tables can be list-like, ordered by integers, or hash-like, unordered collections of key-value pairs.1 They can also be a combination of both types at once. However, the methods here are designed only for pure list- or hash-like tables. Also, all list-like tables are assumed to start at 1, which is the norm in Lua.
Unless otherwise specified, all listutils functions process lists in the order
list[1]
to list[#list]
. To access these methods, use require 'listutils'
.
foreach(func, list)
Applies a function to every item in a list. No return value.
foreach_withindex(func, list)
Like foreach
except that the inner function receives two arguments:
an item from the list and the items’s index, in that order. No return
value.
map(func, list)
Returns a new list containing the result of applying a function to every item in a list.
foldl(func, accumulator, list)
Returns a single value produced by repeatedly applying a function to
the items in a list. The function receives two arguments and should
return a single value. The initial arguments are accumulator
and
list[1]
. The return value of each function call becomes the first of
the two values for subsequent calls.
reduce
is provided as an alias for foldl
.
foldr(func, accumulator, list)
Returns a single value produced by repeatedly applying a function to
the items in a list in the order list[#list]
to list[1]
. The
function receives two arguments and should return a single result. The
first two arguments are accumulator
and list[#last]
. The return
value of each function call becomes the first of the two values for
subsequent calls.
filter(func, list)
Returns a new list containing all items from a list which return true
for a function.
partition(func, list)
Returns two new lists, the first containing all the items from a list
that return true
for a function and the second containing all the
items that return false
.
all(func, list)
Returns false
if any item in a list returns false
for a function.
Otherwise, returns true
.
Thus, all
returns true
if called on an empty list.
any(func, list)
Returns true
if any item in a list returns true
for a function.
Otherwise, returns false
.
Thus, any
returns false
if called on an empty list.
member(element, list)
Returns true
if any of the items in a list are equal to an element.
Otherwise, returns false
. member
uses ==
to test for equality.
zip(list1, list2)
Returns a new list composed of sublists of pairs of items formed by
joining the first item in list1
with the first item in list2
and so
on. If the two lists are of unequal length, the return value will only
extend as far as the shorter of the two; extra values in either lists
are ignored.
stitch(list1, list2)
Returns a hash-like table using list1
for keys and list2
for
values. If the two lists are of unequal length, the return value will
only have as many pairs as the shorter of the two; extra values are
ignored.
max(list)
Returns the largest item in list. Items are compared using >
, so for
all intents and purposes, the function is only designed for numbers.
Returns nil if given an empty list.
min(list)
Returns the smallest item in list. Items are compared using <
, so for
all intents and purposes, the function is only designed for numbers.
Returns nil if given an empty list.
sum(list)
Returns a sum of the contents of a list. The method uses +
, so the
list should only contain numbers. Returns 0 if the list is empty.
product(list)
Returns a product of the contents of a list. The method uses *
, so
the list should only contain numbers. Returns 1 if the list is empty.
To access these methods, use require 'hashutils'
.
foreach(func, hash)
Applies a function to the key, value pairs in a hash. The function receives two arguments each iteration: a key and a value, in that order. No return value.
map(func, hash)
Returns a table formed by applying a function to the key, value pairs
in a hash. Unlike map
in listutils, the function receives three
arguments: a key, a value, and the table that map
will eventually
return. As a result this map
is more flexible than the one in
listutils. It can return a hash-like table, a list-like table, or
a mixed table.
reduce(func, accumulator, hash)
Returns a single value produced by repeatedly applying a function to
the key, value pairs in a hash. The function receives three arguments
and should return a single value. Each call to the function receives an
accumulator, a key, and a value, in that order. The initial function
call receives the original accumulator argument passed to reduce
.
Each subsequent call receives the result of the previous call as the
current accumulator.
filter(func, hash)
Returns a new hash containing all key, value pairs from a hash which
return true
for a function.
partition(func, hash)
Returns two new hashes, the first containing all key, value pairs from
a hash that return true
for a function and the second containing all
key, value pairs that return false
.
all(func, hash)
Returns false
if any item in a hash returns false
for a function.
Otherwise, returns true
.
Thus, all
returns true
if called on an empty hash.
any(func, hash)
Returns true
if any item in a hash returns true
for a function.
Otherwise, returns false
.
Thus, any
returns false
if called on an empty hash.
iskey(element, hash)
Returns true
if any key in a hash is equal to an element. Otherwise,
returns false
. iskey
uses ==
to test for equality.
isval(element, hash)
Returns true
if any value in a hash is equal to an element.
Otherwise, returns false
. isval
uses ==
to test for equality.
keys(hash)
Returns a list-like table containing the keys from a hash.
values(hash)
Returns a list-like table containing the values from a hash.
The module provides four informational functions that return strings. Both sub-modules export the same four functions.
version() -- 2.2.1
author() -- Peter Aronoff
url() -- https://github.com/telemachus/tableutils
license() -- BSD 3-Clause
I think I first got the idea for a utility library like this from Underscore.js. But I also looked at Penlight and Underscore for Lua. (There are two versions of Underscore for Lua, and both appear to be unmaintained. The older one is Marcus Irven’s underscore.lua, and a more recent one is JT Archie’s underscore-lua. Irven’s version hasn’t been updated in six years, and it was never uploaded to LuaRocks. Archie’s was uploaded to LuaRocks, but it is explicitly deprecated in favor of Moses. In any case, I was only aware of Irven’s version when writing tableutils. I discovered Archie’s version much later.) I also took some ideas from Perl’s built-in methods and those found in List::Util. After writing tableutils, I discovered Moses, a “utility library for functional programming in Lua”.
All mistakes are mine. See version history for release details.
© 2013-2018 Peter Aronoff. BSD 3-Clause license; see the license for details.
This isn’t quite true. The truth is that all Lua tables are unordered collections of key-value pairs. However, if the keys are consecutive integers, then it is easy enough to treat such a table as if it were ordered.↩


It provides an action which captures activity in the desired Kubernetes Pod using Sysdig Platform.
For example, imagine that Sysdig Falco detects that a container just spawned a shell. You can use this action to start capturing system calls which are happening in that shell so that you can see which commands or network stuff your attacker is using. Once you have downloaded the scap file, you can use Sysdig Inspect to analyze the activity and its correlations or even to get more details for your forensics reports.


- Reviewed last night’s simulations, see yesterday’s post.
Simulated data testing:
Fitting the general model well on the parrotfish tree even with clear simulated data seems hard. Simulating with alpha(intramandibulars) = .01, and others = 20, and fitting general model and the alpha-only independent model (release of constraint model). The release model MLE recovers reasonable values: alpha(intra) = 1.7, alpha(others) = 21.8, while the general model fit is clearly struggling even with SANN.
[table id=3 /]
May help to try seeding with optima of the sub-models. This is expressed in the bootstraps of course, where the release model produces rather clear distributions (all with 80 reps):
though the general model is much more confused:
Repeating with more replicates, but should try the remaining submodels. This obviously shows up in the model comparison by bootstrapped likelihood ratio:
Note how crucial it is we did the test distribution. Without it, we’d think this a rather clear rejection of the variable alphas model in place of the general model.
MCMCs
MCMCs on these models. Having difficulty with undefined Hastings ratios, probably on out-of-bound proposals, though not sure why those aren’t being caught. Good to know the MLE runs with the same likelihood function.
MCMC errors are occurring in MCMCMC, dropping the heated chains function for the moment works fine. Some difficulty in recombining chain intervals in the coupling, will need a close look. FIXME.
Running long MCMCs on alpha (on zero, n8) and general (on one, n15) models. Combines 16 chains (minus burnin), of 1e5 reps. Simulated_mcmc.R example and sim_general_mcmc.R examples.
Ooh, much faster when not merging multiple chains. let’s run 16 x 1e6.
Max Likelihood + bootstraps
- Piecewise initialized simulated annealing from the submodels: Works! Also note: the aggressive SANN is still needed to get convergence:
> gen_fit <- smart_multiType(data=sim_trait, tree=labrid$tree,
+ regimes=intramandibular,Xo=NULL, alpha = .1,
+ sigma = .1, theta=NULL)
[1] "alpha: 3.02538925492894e-07" "alpha: 0.0585819705289946"
[1] "sigma: 0.00166254126803767" "sigma: 2.90960629757019"
[1] "theta: 1.23973641541187" "theta: 1.84059077604827"
>
> print(getParameters.multiOU(gen_fit))
alpha1 alpha2 theta1 theta2 sigma1 sigma2
0.756620314 3.758072410 13.732765801 4.853751270 0.006160961 3.913957909
Xo
4.667250491
>
>
> sann_fit <- smart_multiType(data=sim_trait, tree=labrid$tree,
+ regimes=intramandibular,Xo=NULL, alpha = .1,
+ sigma = .1, theta=NULL,
+ method ="SANN", control=list(maxit=80000,temp=25,tmax=50))
[1] "alpha: 0.271749815040882" "alpha: 20.4096202543866"
[1] "sigma: 0.0037342888296498" "sigma: 5.5349835595542"
[1] "theta: 4.81905476727201" "theta: 4.58842972148977"
>
> print(getParameters.multiOU(sann_fit))
alpha1 alpha2 theta1 theta2 sigma1 sigma2 Xo
0.2609878 21.9790836 -5.5837586 4.6213975 17.9955025 9.6907227 7.3360959
>
Should probably compare likelihoods of all models as well to check convergence.
Hmm, likelihood of sann_fit isn’t actually better than the very far off combo of nelder-mead? Change SANN starting temp?
Seems to be lack of power. Seeding from a theta-only estimate doesn’t help at all in this case, as chooses wildly different theta. meanwhile, sigma model is doing slightly better anyway:
Each model fit creates reasonably tight bootstraps around its MLE estimates:
(plotted on different axes due the large difference in y max).
Fixing “fixed” parameter style/ brownie. has no alpha value stored, so can’t simulate. FIXED.
Try on larger (labrid? simulated?) tree, will need a reasonable painting defined as well. Seems to be a convergence problem, but more power may help tame the ridges.
Database projects
TreeBASE
iEvoBio talk accepted!
Johan Nylander’s advice: try readNexus() from phylobase package. Unfortunately no go so far. Can’t handle urls so download the file (needs wget interface). See today’s update onissue tracker.
RPLoS
Wrote an R function implementing CrossRef API for use in rplos.
Oooh, PLoS and Mendeley have combined forces in the competition to use their APIs. Wonder if they’ll be very responsive to feature requests on the API itself…


Hello.
I am developing a node for KNIME and when I try to run my eclipse-project with this node the following error messages occur:
!ENTRY org.eclipse.ui.workbench 4 2 2012-10-30 18:17:18.437
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".
!STACK 0
java.lang.NullPointerException
... and a stack trace. Does anyone had met such error before?


River Crossing Model
/* Impose an ordering on the State. */
open util/ordering[State]
/* Farmer and his possessions are objects. */
abstract sig Object { eats: set Object }
one sig Farmer, Fox, Chicken, Grain extends Object {}
/* Defines what eats what and the farmer is not around. */
fact { eats = Fox->Chicken + Chicken->Grain}
/* Stores the objects at near and far side of river. */
sig State { near, far: set Object }
/* In the initial state, all objects are on the near side. */
fact { first.near = Object && no first.far }
/* At most one item to move from 'from' to 'to' */
pred crossRiver [from, from', to, to': set Object] {
one x: from | {
from' = from - x - Farmer - from'.eats
to' = to + x + Farmer
}
}
/* crossRiver transitions between states */
fact {
all s: State, s': s.next {
Farmer in s.near =>
crossRiver [s.near, s'.near, s.far, s'.far]
else
crossRiver [s.far, s'.far, s.near, s'.near]
}
}
/* the farmer moves everything to the far side of the river. */
run { last.far=Object } for exactly 8 State


LIFE BEATS
LIFE BEATS
The Digital Blood Bank
We have created this platform "Life Beats" for the one who can easily commnicate directly with the person who wants to donate the blood and for the person who wants blood easily from blood bank or can directly get connected with the Donor from our website. Our main role is acting intermediate between the person who wants blood and the person who want to donate the blood. Let's Help together saving one's life as Life is the most important part for Us.
Note : Login or Sign-up is required for further process for requesting or donating.


Wanna manage your appointments like a pro? Sign up today to gain full access to our appointment manager service!
Sign Up


{% extends "base.html" %} {% block body %}
The recommended citation for TweetSets (i.e., the software) is:
Justin Littman. (2018). TweetSets. Zenodo. https://doi.org/10.5281/zenodo.1289426
For more guidance on citing TweetSets, see TweetSets in Zenodo.
Datasets that have been publicly released, e.g., in a data repository, will have a public link. Refer to the public version for guidance on citing.
The public link is available in the dataset details on the dataset list page or on the source dataset tab for your dataset.


cma.fitness_functions2
module documentationcma
versatile container for test objective functions.
For the time being this is probably best used like:
from cma.fitness_functions2 import ff
Tested with:
import cma, cma.fitness_functions2 cma.ff2 = cma.fitness_functions2 cma.ff2.__dict__ dff, dff2 = dir(cma.ff), dir(cma.ff2) for f in dff2: if f in dff and f not in ('BBOB', 'epslow', 'fun_as_arg') and not f.startswith('_'): try: getattr(cma.ff, f)(aa([1.,2,3])) == getattr(cma.ff2, f)(aa([1.,2,3])) except: try: assert getattr(cma.ff, f)(aa([1.,2,3]), cma.ff.sphere) == getattr(cma.ff2, f)(aa([1.,2,3]), cma.ff2.sphere) except: assert all(getattr(cma.ff, f)(aa([1.,2,3]), cma.ff.sphere) == getattr(cma.ff2, f)(aa([1.,2,3]), cma.ff2.sphere))
| Function | somenan | returns sometimes np.NaN, otherwise fun(x) |
| Function | epslow | Undocumented |
| Function | rand | Random test objective function |
| Function | linear | Undocumented |
| Function | lineard | Undocumented |
| Function | sphere | Sphere (squared norm) test objective function |
| Function | subspace_sphere | Undocumented |
| Function | pnorm | Undocumented |
| Function | grad_sphere | Undocumented |
| Function | grad_to_one | Undocumented |
| Function | sphere_pos | Sphere (squared norm) test objective function |
| Function | spherewithoneconstraint | Undocumented |
| Function | elliwithoneconstraint | Undocumented |
| Function | spherewithnconstraints | Undocumented |
| Function | noisysphere | noise=10 does not work with default popsize, cma.NoiseHandler(dimension, 1e7) helps |
| Function | spherew | Sphere (squared norm) with sum x_i = 1 test objective function |
| Function | epslowsphere | TODO: define as wrapper |
| Function | partsphere | Sphere (squared norm) test objective function |
| Function | sectorsphere | asymmetric Sphere (squared norm) test objective function |
| Function | cornersphere | Sphere (squared norm) test objective function constraint to the corner |
| Function | cornerelli | Undocumented |
| Function | cornerellirot | Undocumented |
| Function | normalSkew | Undocumented |
| Function | noiseC | Undocumented |
| Function | noise | Undocumented |
| Function | cigar | Cigar test objective function |
| Function | grad_cigar | Undocumented |
| Function | diagonal_cigar | Undocumented |
| Function | tablet | Tablet test objective function |
| Function | grad_tablet | Undocumented |
| Function | cigtab | Cigtab test objective function |
| Function | cigtab2 | cigtab with 5% long and short axes. |
| Function | twoaxes | Cigtab test objective function |
| Function | ellirot | Undocumented |
| Function | hyperelli | Undocumented |
| Function | halfelli | Undocumented |
| Function | elli | Ellipsoid test objective function |
| Function | grad_elli | Undocumented |
| Function | fun_as_arg | fun_as_arg(x, fun, *more_args) calls fun(x, *more_args). |
| Function | grad_numerical | symmetric gradient |
| Function | elliconstraint | ellipsoid test objective function with "constraints" |
| Function | rosen | Rosenbrock test objective function |
| Function | grad_rosen | Undocumented |
| Function | rosen_chained | Undocumented |
| Function | diffpow | Diffpow test objective function |
| Function | rosenelli | Undocumented |
| Function | ridge | Undocumented |
| Function | ridgecircle | happy cat by HG Beyer |
| Function | happycat | Undocumented |
| Function | flat | Undocumented |
| Function | ackley | default domain is [-32.768, 32.768]^n |
| Function | branin | Undocumented |
| Function | goldsteinprice | Undocumented |
| Function | griewank | Undocumented |
| Function | rastrigin | Rastrigin test objective function |
| Function | schaffer | Schaffer function x0 in [-100..100] |
| Function | schwefelelli | Undocumented |
| Function | schwefelmult | multimodal Schwefel function with domain -500..500 |
| Function | schwefel2_22 | Schwefel 2.22 function |
| Function | optprob | Undocumented |
| Function | lincon | ridge like linear function with one linear constraint |
| Function | rosen_nesterov | needs exponential number of steps in a non-increasing f-sequence. |
| Function | powel_singular | Undocumented |
| Function | styblinski_tang | in [-5, 5] found also in Lazar and Jarre 2016, optimum in f(-2.903534...)=0 |
| Function | trid | Undocumented |
| Function | bukin | Bukin function from Wikipedia, generalized simplistically from 2-D. |
| Function | zerosum | abs(sum xi) has an n-1 dimensionsal solution space. |
| Function | _median | Undocumented |
| Function | _iqr | Undocumented |
fun_as_arg(x, fun, *more_args) calls fun(x, *more_args).
Use case:
fmin(cma.fun_as_arg, args=(fun,), gradf=grad_numerical)
calls fun_as_args(x, args) and grad_numerical(x, fun, args=args)
needs exponential number of steps in a non-increasing f-sequence.
x_0 = (-1,1,...,1) See Jarre (2011) "On Nesterov's Smooth Chebyshev-Rosenbrock Function"
Bukin function from Wikipedia, generalized simplistically from 2-D.
http://en.wikipedia.org/wiki/Test_functions_for_optimization
abs(sum xi) has an n-1 dimensionsal solution space.
http://infinity77.net/global_optimization/test_functions_nd_Z.html#go_benchmark.ZeroSum https://github.com/CMA-ES/c-cmaes/issues/19#issue-323799789


Delay, ambiguity over ECL removal threatening Nawaz's life: Marriyum Aurangzeb
by Rameez KhanLAHORE: Pakistan Muslim League-Nawaz (PML-N) Secretary Information Marriyum Aurangzeb said on Monday that the delay caused by the ambiguity surrounding removal of Nawaz Sharif’s name from the Exit Control List (ECL) is posing serious danger to his life.
In a statement, Marriyum said PML-N supremo’s doctors have warned that repeated dosage of high potency steroids to stabilise his platelets for travel are an added risk to his life. She said that the board of doctors put together by the PTI government itself had recommended that Nawaz be treated abroad.
The provincial minister of health too endorsed the notion in a press conference yesterday, she added.
Furthermore, she said that the uncertainty as when will Nawaz’s name be removed from ECL, has led to an uncertainty among the doctors regarding the right time to administer the steroids.
She also pointed out that the air-ambulance too can only be scheduled after there is a clear date and time of travel decided, following removal of Nawaz’s name from the ECL.
The former information minister said, “The negative effects caused by the delay in transporting Nawaz to an overseas medical facility are complicating his already worsening health.”
Nawaz’s departure from the country was postponed on Monday as the PML-N supremo’s name is yet to be removed from the ECL by authorities.
The former premier was set to depart for London via Doha today along with his brother Shehbaz Sharif and family physician Dr Adnan Khan.
However, his ticket has now been cancelled. Nawaz was scheduled to return to Pakistan on November 27 and his travel summary was sent to the law ministry.
The high courts of Lahore and Islamabad had earlier granted bail to the ailing former premier.


Jonathan L. Walker
Democrat
Office Operations Supervisor, U.S. Census Bureau
B.A. University of Michigan (1970) J.D. Wayne State University (1977)
80904
I have been an Advocate for people suffering from Intellectual and Developmental Disabilities through my work with The Arc. Representing the Colorado State Public Defenders, I sat on the DVOMB, developing treatment standards for Domestic Violence Offenders. From 2008 -2012, I was the Judicial Representative, appointed by Justice Bender, to that same DVOMB and worked on revising the Standards for treatment
None
Arc of the Pikes Peak Region : Board Member 1999-2006, 2008-2017; Board President, 13 years (two 3 year terms plus 1 yr.), 2 more 3 year terms. United Way of P.P. Region, committee member (allocations, other committes, 2000 - 2009); Urban League, P.P. Region Board, 2008-2010. Colorado Domestic Offender Management Board 2000-2003 Public Defender representative, 2008-2012, Judicial representative. From 2007 until 2017, I was a County Court Judge in the 4th Judicial District, appointed by Governor Ritter. I was retained in two retention elections.
I am a staunch advocate of citizen-lead redistricting. Especially since working on the 2020 Census, where I've learned the importance of the "one person/one vote" concept and have been appalled by the "gerrymandering" which has diluted that concept for purely partisan interests in the past few years.
In my first 20 years of legal practice in Michigan, I was a Civil Litigator and served as a Mediator in a multitude of civil matters involving everything from airline disasters and auto crashes to environmental cases. The goal of a Mediator, of course is to assist the parties to reach a consensus. I was also a Hearing Officer for the Michigan Civil Rights Commission. As a Colorado County Court Judge for ten years, my mission was to be fair and impartial and to listen to both sides of each dispute.
As a Trial Lawyer, Mediator, Public Defender and a Judge for forty-three years; my skillset was problem solving. Litigation is, in fact, using logic and reason to resolve a problem.
Male


This website was developed at the department of Haemotology, Aalborg University Hospital.
If you encounter any issues or bugs using either the hemaClass website or the hemaClass R-package, or if you have suggestions for improvements please do not hesitate to report it to us at GitHub. You are also very welcome to send us questions or comments via e-mail.
Note: The website does not support uploading
.CEL
files in Internet Explorer 9 and older. Please, use a newer
or different browser.
For more information about our group go to www.blodet.dk.
Forskningens Hus (Science and Innovation Center)
Aalborg University Hospital
Department of Haematology
Sdr. Skovvej 15
DK-9000 Aalborg
DENMARK
Telephone: +45 97 66 38 64
Fax: +45 97 66 63 23
E-mail<EMAIL_ADDRESS>Website: blodet.dk
This work has been supported by the National Experimental Partnership


Three Jokers Artist Says Ending Is 'Gutsiest Thing' in Batman's 80 Years
by Jon ArvedonJason Fabok has just set some pretty high expectations for his and Geoff Johns' upcoming DC Black Label miniseries Batman: Three Jokers.

Three Jokers is a story that's over four years in the making, as the seeds were first planted in Johns and Fabok's Justice League #42 in June 2015. In that issue, Batman used the newly acquired powers of the Mobius Chair to ask two questions: Who really killed his parents, and what was The Joker’s real name? However, it wasn't until eight months later – the day Justice League #50 and DC Universe: Rebirth #1 hit stands -- that we finally got our answer as to what the Mobius Chair told Batman: "There are three."
Click the button below to start this article in quick view.
In June, Fabok revealed he was hard at work on the miniseries and that the interior art was taking him twice as long as any of his previous projects, writing, "I want to give the readers my everything."
Batman: Three Jokers #1, by Geoff Johns and Jason Fabok, has yet to receive a release date. However, judging by Fabok's tweet, it's likely readers can expect the first of the three 46-page issues to arrive some time in 2020.
https://schema.orgBreadcrumbListListItem1Homehttps://www.cbr.com/ListItem2Comicshttps://www.cbr.com/category/comics/ListItem3Comic Newshttps://www.cbr.com/category/comics/news/ListItem4Three Jokers Artist Says Ending Is 'Gutsiest Thing' in Batman's 80 Yearshttps://www.cbr.com/batman-three-jokers-gutsy/


Notice blocks
By default dactl has a couple of special classes which will turn a paragraph into a notice block when added to it. Read on for information on how to use it.
How to create a notice block
Creating notices from your paragraphs works the same way as creating leading post paragraphs.
You need to add a correct class after the paragraph:
1 2 3 | Sea otters [hold each other’s paws](https://www.youtube.com/watch?v=eTvX-CkfqRo) when they sleep so they don’t drift apart. That is a fact, look it up on Wikipedia if you don't believe me. {: .notice} |
Available options
Regular notice block
{: .notice}
Sea otters hold each other’s paws when they sleep so they don’t drift apart.
That is a fact, look it up on Wikipedia if you don’t believe me.
Alert notice block
{: .notice-alert}
If one examines the capitalist paradigm of context, one is faced with a choice: either accept textual narrative or conclude that reality serves to exploit the Other.
Success notice block
{: .notice-success}
If one examines the capitalist paradigm of context, one is faced with a choice: either accept textual narrative or conclude that reality serves to exploit the Other.
Multi-paragraph notice blocks
The easiest solution I found to wrapping more than paragraph into a notice is just inserting it into a markdown-enabled div
tag, like this:
1 2 3 4 5 6 7 8 9 | <div class="notice" markdown="1"> If one examines the capitalist paradigm of context, one is faced with a choice: either accept textual narrative or conclude that reality serves to exploit the Other. A number of dematerialisms concerning textual objectivism exist. However, if textual narrative holds, we have to choose between precultural theory and the conceptual paradigm of consensus. </div> |
Which, when processed by kramdown, shows up like this:
If one examines the capitalist paradigm of context, one is faced with a choice: either accept textual narrative or conclude that reality serves to exploit the Other.
A number of dematerialisms concerning textual objectivism exist. However, if textual narrative holds, we have to choose between precultural theory and the conceptual paradigm of consensus.


Parameter Example From Craigs Blog¶
Taken from Craigs Blog (http://csut017.wordpress.com/2009/05/12/dynamic-build-parameters-some-examples)
Copied here for reference and also because the layout on that page is for one reason or another very weird.
A Very Basic Configuration¶
To keep things simple, I’m only going to work with a very simple configuration (ccnet.config). This is the base config:
1<cruisecontrol>
2 <project name="Test Project">
3 <description>A demonstration project to show the features of the dynamic build parameters.</description>
4 <sourcecontrol type="svn">
5 <trunkUrl>svn://svn.mycompany.com/firstproject/trunk</trunkUrl>
6 <workingDirectory>C:\SourceControl\FirstProject\</workingDirectory>
7 </sourcecontrol>
8 <triggers>
9 <intervalTrigger />
10 </triggers>
11 <tasks>
12 <nant>
13 <buildFile>App.build</buildFile>
14 <targetList>
15 <target>Dev</target>
16 </targetList>
17 <buildArgs>-D:reason=testing</buildArgs>
18 </nant>
19 <gendarme>
20 <assemblies>
21 <assemblyMatch expr="*.dll"/>
22 </assemblies>
23 <limit>100</limit>
24 </gendarme>
25 </tasks>
26 <publishers>
27 <rss />
28 <xmllogger />
29 </publishers>
30 </project>
31</cruisecontrol>
This project uses Subversion as the source code repository, using a repository called firstproject. It has the default interval trigger (checks for modifications every 60 seconds). When a build is triggered it will run an NAnt build script called App.Build and then perform a Gendarme analysis. Finally it will generate an RSS feed and log the XML results (so the dashboard can use it.)
Basically I’m going to add three dynamic parameters:
Define the target to build
Change the reason for the build (a buildArg for the NAnt script)
And vary the limit on the Gendarme analysis
And to finish things off, I’ll show how the same project can be used to generate different builds via a schedule.
So, let’s get the show on the road.
Defining a Target¶
The first parameter I want to vary is the build type. This is a target in the NAnt script, and I’m going to allow three different targets: Dev, Test and Prod (this could also be done as a buildArg, but I want to leave that for later!)
The first thing to do is to add the parameter to the project. Parameters are defined at the project level for two reasons:
It saves duplicates if the parameter needs to be used in multiple places
It makes it simpler for the server to work out which parameters need to be sent to the client (thus it is faster)
Since the build target can only be one of three values, I’m going to define a range parameter:
1<parameters>
2 <rangeParameter name="Type">
3 <description>The type of build to perform.</description>
4 <allowedValues>
5 <value>Dev</value>
6 <value>Test</value>
7 <value>Prod</value>
8 </allowedValues>
9 <default>Dev</default>
10 </rangeParameter>
11</parameters>
All parameters must be defined within a parameters block within the project. As a minimum definition, each parameter must have a name – which is what is sent to the client.
This definition defines a parameter called “Type”, it is a range parameter with three possible values: “Dev”, “Test” and “Prod”. Finally, the default value is “Dev”. When a force build is triggered, the user will be displayed a combo box (or a drop down list depending on the client) with these three values in it, and “Dev” will be the initial selection.
The next step is to use the parameter in a task (currently they are limited to tasks and publishers, this may change if there is enough support for it.) The following shows how I would modify the <nant> task to use the parameter:
1<nant>
2 <!-- Omitted to save space -->
3 <dynamicValues>
4 <directValue parameter="Type"
5 property="targetList.target[0]">
6 <default>Dev</default>
7 </directValue>
8 </dynamicValues>
9</nant>
This simply says replace the first target in the targetList with the parameter value. This is a direct replacement – the entire value will be replaced with whatever value was selected for Type.
Note that there is also a default value here. This is used for when a value has not been selected (i.e. when the interval trigger detects changes).
This is a very simple example of a pre-defined value that entirely replaces the existing value. Now, let’s see some of the other parameter types.
A Numeric Parameter – Gendarme Limit¶
The next thing I’ll show is how to use a numeric parameter value. Again, this needs to be defined at the project level in the parameters block:
1<parameters>
2 <!-- Omitted to save space -->
3 <numericParameter name="GendarmeLimit">
4 <description>The limit of Gendarme errors.</description>
5 <minimum>50</minimum>
6 <maximum>500</maximum>
7 <default>100</default>
8 </numericParameter>
9</parameters>
This says we want to also have a GendarmeLimit parameter, this is a numeric value and must be between 50 and 500. The default value will be 100.
To use this, it is the same as the target type, just add a direct replacement dynamic value:
1<gendarme>
2 <!-- Omitted to save space -->
3 <dynamicValues>
4 <directValue parameter="GendarmeLimit"
5 property="limit">
6 <default>100</default>
7 </directValue>
8 </dynamicValues>
9</gendarme>
Note, the value will automatically be converted into the correct data type for use in the task. If there is a data type mismatch (e.g. a test value is put into a numeric property), then the build will fail with an error.
Now, let’s add one more parameter – one that doesn’t use direct replacement.
A Build Reason¶
This is a bit of a contrived example, but here we are going to pass a reason for the build into the NAnt task.
First, let’s define the parameter:
1<parameters>
2 <!-- Omitted to save space -->
3 <textParameter name="Reason">
4 <description>Reason for the build being forced.</description>
5 <minimum>10</minimum>
6 <maximum>255</maximum>
7 <required>true</required>
8 </textParameter>
9</parameters>
This is a text parameter with a minimum length of 10 and a maximum length of 255.
This time, to use the parameter we are going to use a replacementValue:
1<nant>
2 <!-- Omitted to save space -->
3 <dynamicValues>
4 <!-- Omitted to save space -->
5 <replacementValue property="buildArgs">
6 <format>-D:"{0}"</format>
7 <parameters>
8 <namedValue name="Reason"
9 value="Triggered" />
10 </parameters>
11 </replacementValue>
12 </dynamicValues>
13</nant>
This has the same property attribute, but otherwise is very different. A standard .NET format string is required (internally this is literally passed onto string.Format()!) And there is also a list of parameters to use. As you might have guessed, this dynamic value can use multiple parameters. If a property needs to use more than one parameter, then this is the syntax that is required.
Note for the parameters a namedValue is used. The name is the name of the parameter, while the value is the default value. This is needed because there can be multiple parameters, each with its own default value!
Scheduling A Prod Build¶
The final item I’ll cover is how to use parameters together with triggers. In this case, I’m going to schedule a build every night that uses the Prod target.
This is fairly easy to do, all we need to do is add a new parameterTrigger that contains the schedule trigger. The following shows how to do this:
1<triggers>
2 <intervalTrigger />
3 <parameterTrigger>
4 <trigger type="scheduleTrigger">
5 <time>1:00</time>
6 <buildCondition>ForceBuild</buildCondition>
7 </trigger>
8 <parameters>
9 <namedValue name="Type"
10 value="Prod"/>
11 <namedValue name="Reason"
12 value="Scheduled"/>
13 <namedValue name="GendarmeLimit"
14 value="500"/>
15 </parameters>
16 </parameterTrigger>
17</triggers>
This will schedule a build every night at 1am and pass in “Prod” for the Type, “Scheduled” for the Reason and 500 for the GendarmeLimit.
The Final Configuration
Hopefully this has provided a quick introduction to how parameters and dynamic values can be used. If you can think of how this can be improved, let me know and I’ll see what I can do.
And to finish up, here is the complete configuration:
1<cruisecontrol>
2 <project name="Test Project">
3 <description>A demonstration project to show the features of the dynamic build parameters.</description>
4 <sourcecontrol type="svn">
5 <trunkUrl>svn://svn.mycompany.com/firstproject/trunk</trunkUrl>
6 <workingDirectory>C:\SourceControl\FirstProject\</workingDirectory>
7 </sourcecontrol>
8 <triggers>
9 <intervalTrigger />
10 <parameterTrigger>
11 <trigger type="scheduleTrigger">
12 <time>1:00</time>
13 <buildCondition>ForceBuild</buildCondition>
14 </trigger>
15 <parameters>
16 <namedValue name="Type"
17 value="Prod"/>
18 <namedValue name="Reason"
19 value="Scheduled"/>
20 <namedValue name="GendarmeLimit"
21 value="500"/>
22 </parameters>
23 </parameterTrigger>
24 </triggers>
25 <tasks>
26 <nant>
27 <buildFile>App.build</buildFile>
28 <targetList>
29 <target>Dev</target>
30 </targetList>
31 <buildArgs>-D:reason=testing</buildArgs>
32 <dynamicValues>
33 <directValue parameter="Type"
34 property="targetList.target[0]">
35 <default>Dev</default>
36 </directValue>
37 <replacementValue property="buildArgs">
38 <format>-D:"{0}"</format>
39 <parameters>
40 <namedValue name="Reason"
41 value="Triggered" />
42 </parameters>
43 </replacementValue>
44 </dynamicValues>
45 </nant>
46 <gendarme>
47 <assemblies>
48 <assemblyMatch expr="*.dll"/>
49 </assemblies>
50 <limit>100</limit>
51 <dynamicValues>
52 <directValue parameter="GendarmeLimit"
53 property="limit">
54 <default>100</default>
55 </directValue>
56 </dynamicValues>
57 </gendarme>
58 </tasks>
59 <publishers>
60 <rss />
61 <xmllogger />
62 </publishers>
63 <parameters>
64 <rangeParameter name="Type">
65 <description>The type of build to perform.</description>
66 <allowedValues>
67 <value>Dev</value>
68 <value>Test</value>
69 <value>Prod</value>
70 </allowedValues>
71 <default>Dev</default>
72 </rangeParameter>
73 <numericParameter name="GendarmeLimit">
74 <description>The limit of Gendarme errors.</description>
75 <minimum>50</minimum>
76 <maximum>500</maximum>
77 <default>100</default>
78 </numericParameter>
79 <textParameter name="Reason">
80 <description>Reason for the build being forced.</description>
81 <minimum>10</minimum>
82 <maximum>255</maximum>
83 <required>true</required>
84 </textParameter>
85 </parameters>
86 </project>
87</cruisecontrol>


Micro-g Neutral Buoyancy Experiment Design Teams (Micro-g NExT) challenges undergraduate students to design, build, and test a tool or device that addresses an authentic, current space exploration challenge. The overall experience includes hands-on engineering design, test operations, and public outreach. Test operations are conducted in the simulated microgravity environment of the NASA Johnson Space Center Neutral Buoyancy Laboratory (NBL). Teams will propose design and prototyping of a tool or simulant identified by NASA engineers as necessary in space exploration missions. Professional NBL divers will test the tools and students will direct the divers from the Test Conductor Room of the NBL facility. Micro-g NExT provides a unique opportunity to contribute to NASA's missions. The Micro-g NExT challenges focus on aspects of the Artemis mission.
Designed an autonomous surface vehicle capable of assisting astronauts in distress in a marine time environment, through location and delivery of crew survival aids.
ProposalDesigned a Mini-arm-end-effector for NASA’s recently designed robotic “Mini-Arm”
ProposalDesigned a zip tie cutters which is able to cut zip ties of a variety of widths and compositions while minimizing damage to the wires, and simultaneously retaining the zip tie.
ProposalDesigned a Subsurface Sampling device tool which has the ability to extract subsurface samples in microgravity conditions while minimizing cross contamination between the samples.
Proposal


Ruby Classes
Classes are an important component of Ruby programming. They can be used to model real objects that have properties and behavior. In Ruby the properties are called instance variables. The behavior happens in methods. With these, one can simulate almost anything.
When a new class is instantiated a new object is created. The class will have a method that is run when this happens. This is the initialize method. Parameters can be passed to this method and in its code, instance variables can be set.
The other methods of a class can be public or private. Public methods can be accessed outside the class. Private methods can only be accessed from inside the class.
Let me give an example of this to illustrate these principles. Let's say I wanted to model a horse. I would give the horse instance variables for name, color, breed, and mood. When I create a new horse I would pass the specific values of the horse I was modeling.
# Our horse class Class Horse def initialize(name, breed, mood) @name = name @breed = breed @mood = mood end end # instantiate our horse rico = Horse.new("Rico, "Quater Horse", "sleepy")
We now have our horse, rico, but he can't do anything yet. So we need to add some methods. Let do that now. We will give the horse class some public methods that we, as the rider, can access. And we'll create some private methods that only the horse can access.
# Our horse class Class Horse def initialize(name, breed, mood) @name = name @breed = breed @mood = mood end def ask_to( something ) walk if something = "walk" trot if something = "trot" canter if something = "canter" stop if something = "whoa" end def talk puts "Hi my name is #{@name}. I am a {#mood} {#breed}." end def give_treat @mood = "happy" end private def walk puts "I'm walking." end def trot if @mood == "happy" puts "I'm trotting. Don't we look smart." else walk end end def canter if @mood == "happy" puts "I'm cantering. Hold on!" else trot end end def stop puts "Ok, I'm stopped." @mood = "sleepy" end end # instantiate our horse rico = Horse.new("Rico, "Quater Horse", "sleepy") # ask rico to walk rico.ask_to("walk") #=> gives "I'm walking." rico.ask_to("trot") #=> gives "I'm walking." What?? rico.talk #=> gives "Hi my name is Rico. I am a sleepy Quarter Horse." # Let's fix that rico.give_treat rico.ask_to("trot") #=> gives "I'm trotting. Don't we look smart." That's better!
From this example we can see that our horse, rico will walk for us when we ask. But he will not trot for us and we cannot make him, as that is a private method that he controls. However, if we give him a treat, his mood will change and we can ask him to trot and he will do so. Notice that when we ask him to stop, his mood will change back to sleepy again!


Phone: +521 33 1322 3131
Age: 22
Nationality: Mexican
Location: Guadalajara, Jal.
Email<EMAIL_ADDRESS>General Certificate of Education
2011 - 2014
IT Technician
2011 - 2014
B.A Computational Engineering
2015 - Current
| Time | Where | Role |
|---|---|---|
| 4 years | Domino's Pizza | Customer Service |
| Current | IBM | Student |
2 months at eSupport project
+521<PHONE_NUMBER>
<EMAIL_ADDRESS>+521<PHONE_NUMBER>
israelmartinezj@gmail.com