code
stringlengths
5
1.01M
repo_name
stringlengths
5
84
path
stringlengths
4
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
5
1.01M
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
// Copyright 2014 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Implementations of the Asan system interceptors. These are simple // pass-throughs to the original functions for the purpose of Asan // compatibility. #include "windows.h" extern "C" { BOOL WINAPI asan_ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) { return ::ReadFile(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped); } BOOL WINAPI asan_ReadFileEx( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) { return ::ReadFileEx(hFile, lpBuffer, nNumberOfBytesToRead, lpOverlapped, lpCompletionRoutine); } BOOL WINAPI asan_WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped) { return ::WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped); } BOOL WINAPI asan_WriteFileEx( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) { return ::WriteFileEx(hFile, lpBuffer, nNumberOfBytesToWrite, lpOverlapped, lpCompletionRoutine); } long WINAPI asan_InterlockedCompareExchange(long volatile* Destination, long Exchange, long Comperand) { return ::InterlockedCompareExchange(Destination, Exchange, Comperand); } long WINAPI asan_InterlockedIncrement(long* lpAddend) { return ::InterlockedIncrement(lpAddend); } long WINAPI asan_InterlockedDecrement(long* lpAddend) { return ::InterlockedDecrement(lpAddend); } long WINAPI asan_InterlockedExchange(long volatile* Target, long Value) { return ::InterlockedExchange(Target, Value); } long WINAPI asan_InterlockedExchangeAdd(long volatile* Addend, long Value) { return ::InterlockedExchangeAdd(Addend, Value); } } // extern "C"
sebmarchand/syzygy
syzygy/agent/memprof/system_interceptors.cc
C++
apache-2.0
2,923
[ 30522, 1013, 1013, 9385, 2297, 8224, 4297, 1012, 2035, 2916, 9235, 1012, 1013, 1013, 1013, 1013, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1013, 1013, 2017, 2089, 2025, 2224, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
export interface ReactionsById_me_reactions_reactionKind { __typename: "ReactionKind"; /** * Id */ id: number; /** * Name of reaction example is like or dislike */ name: string; } export interface ReactionsById_me_reactions_study { __typename: "Study"; briefTitle: string; } export interface ReactionsById_me_reactions { __typename: "Reaction"; /** * id of reaction kind */ reactionKindId: number; /** * Type of reaction such as downvote */ reactionKind: ReactionsById_me_reactions_reactionKind; study: ReactionsById_me_reactions_study; nctId: string; } export interface ReactionsById_me { __typename: "User"; /** * Id */ id: number; /** * Email */ email: string; /** * First name */ firstName: string | null; /** * Last name */ lastName: string | null; reactions: ReactionsById_me_reactions[] | null; } export interface ReactionsById { /** * Current logged in user */ me: ReactionsById_me | null; } export interface ReactionsByIdVariables { reactionKindId: string; }
clinwiki-org/clinwiki
front/src/services/study/model/ReactionsById.ts
TypeScript
mit
1,081
[ 30522, 9167, 8278, 9597, 3762, 3593, 1035, 2033, 1035, 9597, 1035, 4668, 18824, 1063, 1035, 1035, 2828, 18442, 1024, 1000, 4668, 18824, 1000, 1025, 1013, 1008, 1008, 1008, 8909, 1008, 1013, 8909, 1024, 2193, 1025, 1013, 1008, 1008, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
//***************************************************************************** // // hw_hibernate.h - Defines and Macros for the Hibernation module. // // Copyright (c) 2007-2015 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // This is part of revision 2.1.2.111 of the Tiva Firmware Development Package. // //***************************************************************************** #ifndef __HW_HIBERNATE_H__ #define __HW_HIBERNATE_H__ //***************************************************************************** // // The following are defines for the Hibernation module register addresses. // //***************************************************************************** #define HIB_RTCC 0x400FC000 // Hibernation RTC Counter #define HIB_RTCM0 0x400FC004 // Hibernation RTC Match 0 #define HIB_RTCLD 0x400FC00C // Hibernation RTC Load #define HIB_CTL 0x400FC010 // Hibernation Control #define HIB_IM 0x400FC014 // Hibernation Interrupt Mask #define HIB_RIS 0x400FC018 // Hibernation Raw Interrupt Status #define HIB_MIS 0x400FC01C // Hibernation Masked Interrupt // Status #define HIB_IC 0x400FC020 // Hibernation Interrupt Clear #define HIB_RTCT 0x400FC024 // Hibernation RTC Trim #define HIB_RTCSS 0x400FC028 // Hibernation RTC Sub Seconds #define HIB_IO 0x400FC02C // Hibernation IO Configuration #define HIB_DATA 0x400FC030 // Hibernation Data #define HIB_CALCTL 0x400FC300 // Hibernation Calendar Control #define HIB_CAL0 0x400FC310 // Hibernation Calendar 0 #define HIB_CAL1 0x400FC314 // Hibernation Calendar 1 #define HIB_CALLD0 0x400FC320 // Hibernation Calendar Load 0 #define HIB_CALLD1 0x400FC324 // Hibernation Calendar Load #define HIB_CALM0 0x400FC330 // Hibernation Calendar Match 0 #define HIB_CALM1 0x400FC334 // Hibernation Calendar Match 1 #define HIB_LOCK 0x400FC360 // Hibernation Lock #define HIB_TPCTL 0x400FC400 // HIB Tamper Control #define HIB_TPSTAT 0x400FC404 // HIB Tamper Status #define HIB_TPIO 0x400FC410 // HIB Tamper I/O Control #define HIB_TPLOG0 0x400FC4E0 // HIB Tamper Log 0 #define HIB_TPLOG1 0x400FC4E4 // HIB Tamper Log 1 #define HIB_TPLOG2 0x400FC4E8 // HIB Tamper Log 2 #define HIB_TPLOG3 0x400FC4EC // HIB Tamper Log 3 #define HIB_TPLOG4 0x400FC4F0 // HIB Tamper Log 4 #define HIB_TPLOG5 0x400FC4F4 // HIB Tamper Log 5 #define HIB_TPLOG6 0x400FC4F8 // HIB Tamper Log 6 #define HIB_TPLOG7 0x400FC4FC // HIB Tamper Log 7 #define HIB_PP 0x400FCFC0 // Hibernation Peripheral // Properties #define HIB_CC 0x400FCFC8 // Hibernation Clock Control //***************************************************************************** // // The following are defines for the bit fields in the HIB_RTCC register. // //***************************************************************************** #define HIB_RTCC_M 0xFFFFFFFF // RTC Counter #define HIB_RTCC_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_RTCM0 register. // //***************************************************************************** #define HIB_RTCM0_M 0xFFFFFFFF // RTC Match 0 #define HIB_RTCM0_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_RTCLD register. // //***************************************************************************** #define HIB_RTCLD_M 0xFFFFFFFF // RTC Load #define HIB_RTCLD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_CTL register. // //***************************************************************************** #define HIB_CTL_WRC 0x80000000 // Write Complete/Capable #define HIB_CTL_RETCLR 0x40000000 // GPIO Retention/Clear #define HIB_CTL_OSCSEL 0x00080000 // Oscillator Select #define HIB_CTL_OSCDRV 0x00020000 // Oscillator Drive Capability #define HIB_CTL_OSCBYP 0x00010000 // Oscillator Bypass #define HIB_CTL_VBATSEL_M 0x00006000 // Select for Low-Battery // Comparator #define HIB_CTL_VBATSEL_1_9V 0x00000000 // 1.9 Volts #define HIB_CTL_VBATSEL_2_1V 0x00002000 // 2.1 Volts (default) #define HIB_CTL_VBATSEL_2_3V 0x00004000 // 2.3 Volts #define HIB_CTL_VBATSEL_2_5V 0x00006000 // 2.5 Volts #define HIB_CTL_BATCHK 0x00000400 // Check Battery Status #define HIB_CTL_BATWKEN 0x00000200 // Wake on Low Battery #define HIB_CTL_VDD3ON 0x00000100 // VDD Powered #define HIB_CTL_VABORT 0x00000080 // Power Cut Abort Enable #define HIB_CTL_CLK32EN 0x00000040 // Clocking Enable #define HIB_CTL_PINWEN 0x00000010 // External Wake Pin Enable #define HIB_CTL_RTCWEN 0x00000008 // RTC Wake-up Enable #define HIB_CTL_HIBREQ 0x00000002 // Hibernation Request #define HIB_CTL_RTCEN 0x00000001 // RTC Timer Enable //***************************************************************************** // // The following are defines for the bit fields in the HIB_IM register. // //***************************************************************************** #define HIB_IM_VDDFAIL 0x00000080 // VDD Fail Interrupt Mask #define HIB_IM_RSTWK 0x00000040 // Reset Pad I/O Wake-Up Interrupt // Mask #define HIB_IM_PADIOWK 0x00000020 // Pad I/O Wake-Up Interrupt Mask #define HIB_IM_WC 0x00000010 // External Write Complete/Capable // Interrupt Mask #define HIB_IM_EXTW 0x00000008 // External Wake-Up Interrupt Mask #define HIB_IM_LOWBAT 0x00000004 // Low Battery Voltage Interrupt // Mask #define HIB_IM_RTCALT0 0x00000001 // RTC Alert 0 Interrupt Mask //***************************************************************************** // // The following are defines for the bit fields in the HIB_RIS register. // //***************************************************************************** #define HIB_RIS_VDDFAIL 0x00000080 // VDD Fail Raw Interrupt Status #define HIB_RIS_RSTWK 0x00000040 // Reset Pad I/O Wake-Up Raw // Interrupt Status #define HIB_RIS_PADIOWK 0x00000020 // Pad I/O Wake-Up Raw Interrupt // Status #define HIB_RIS_WC 0x00000010 // Write Complete/Capable Raw // Interrupt Status #define HIB_RIS_EXTW 0x00000008 // External Wake-Up Raw Interrupt // Status #define HIB_RIS_LOWBAT 0x00000004 // Low Battery Voltage Raw // Interrupt Status #define HIB_RIS_RTCALT0 0x00000001 // RTC Alert 0 Raw Interrupt Status //***************************************************************************** // // The following are defines for the bit fields in the HIB_MIS register. // //***************************************************************************** #define HIB_MIS_VDDFAIL 0x00000080 // VDD Fail Interrupt Mask #define HIB_MIS_RSTWK 0x00000040 // Reset Pad I/O Wake-Up Interrupt // Mask #define HIB_MIS_PADIOWK 0x00000020 // Pad I/O Wake-Up Interrupt Mask #define HIB_MIS_WC 0x00000010 // Write Complete/Capable Masked // Interrupt Status #define HIB_MIS_EXTW 0x00000008 // External Wake-Up Masked // Interrupt Status #define HIB_MIS_LOWBAT 0x00000004 // Low Battery Voltage Masked // Interrupt Status #define HIB_MIS_RTCALT0 0x00000001 // RTC Alert 0 Masked Interrupt // Status //***************************************************************************** // // The following are defines for the bit fields in the HIB_IC register. // //***************************************************************************** #define HIB_IC_VDDFAIL 0x00000080 // VDD Fail Interrupt Clear #define HIB_IC_RSTWK 0x00000040 // Reset Pad I/O Wake-Up Interrupt // Clear #define HIB_IC_PADIOWK 0x00000020 // Pad I/O Wake-Up Interrupt Clear #define HIB_IC_WC 0x00000010 // Write Complete/Capable Interrupt // Clear #define HIB_IC_EXTW 0x00000008 // External Wake-Up Interrupt Clear #define HIB_IC_LOWBAT 0x00000004 // Low Battery Voltage Interrupt // Clear #define HIB_IC_RTCALT0 0x00000001 // RTC Alert0 Masked Interrupt // Clear //***************************************************************************** // // The following are defines for the bit fields in the HIB_RTCT register. // //***************************************************************************** #define HIB_RTCT_TRIM_M 0x0000FFFF // RTC Trim Value #define HIB_RTCT_TRIM_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_RTCSS register. // //***************************************************************************** #define HIB_RTCSS_RTCSSM_M 0x7FFF0000 // RTC Sub Seconds Match #define HIB_RTCSS_RTCSSC_M 0x00007FFF // RTC Sub Seconds Count #define HIB_RTCSS_RTCSSM_S 16 #define HIB_RTCSS_RTCSSC_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_IO register. // //***************************************************************************** #define HIB_IO_IOWRC 0x80000000 // I/O Write Complete #define HIB_IO_WURSTEN 0x00000010 // Reset Wake Source Enable #define HIB_IO_WUUNLK 0x00000001 // I/O Wake Pad Configuration // Enable //***************************************************************************** // // The following are defines for the bit fields in the HIB_DATA register. // //***************************************************************************** #define HIB_DATA_RTD_M 0xFFFFFFFF // Hibernation Module NV Data #define HIB_DATA_RTD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_CALCTL register. // //***************************************************************************** #define HIB_CALCTL_CAL24 0x00000004 // Calendar Mode #define HIB_CALCTL_CALEN 0x00000001 // RTC Calendar/Counter Mode Select //***************************************************************************** // // The following are defines for the bit fields in the HIB_CAL0 register. // //***************************************************************************** #define HIB_CAL0_VALID 0x80000000 // Valid Calendar Load #define HIB_CAL0_AMPM 0x00400000 // AM/PM Designation #define HIB_CAL0_HR_M 0x001F0000 // Hours #define HIB_CAL0_MIN_M 0x00003F00 // Minutes #define HIB_CAL0_SEC_M 0x0000003F // Seconds #define HIB_CAL0_HR_S 16 #define HIB_CAL0_MIN_S 8 #define HIB_CAL0_SEC_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_CAL1 register. // //***************************************************************************** #define HIB_CAL1_VALID 0x80000000 // Valid Calendar Load #define HIB_CAL1_DOW_M 0x07000000 // Day of Week #define HIB_CAL1_YEAR_M 0x007F0000 // Year Value #define HIB_CAL1_MON_M 0x00000F00 // Month #define HIB_CAL1_DOM_M 0x0000001F // Day of Month #define HIB_CAL1_DOW_S 24 #define HIB_CAL1_YEAR_S 16 #define HIB_CAL1_MON_S 8 #define HIB_CAL1_DOM_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_CALLD0 register. // //***************************************************************************** #define HIB_CALLD0_AMPM 0x00400000 // AM/PM Designation #define HIB_CALLD0_HR_M 0x001F0000 // Hours #define HIB_CALLD0_MIN_M 0x00003F00 // Minutes #define HIB_CALLD0_SEC_M 0x0000003F // Seconds #define HIB_CALLD0_HR_S 16 #define HIB_CALLD0_MIN_S 8 #define HIB_CALLD0_SEC_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_CALLD1 register. // //***************************************************************************** #define HIB_CALLD1_DOW_M 0x07000000 // Day of Week #define HIB_CALLD1_YEAR_M 0x007F0000 // Year Value #define HIB_CALLD1_MON_M 0x00000F00 // Month #define HIB_CALLD1_DOM_M 0x0000001F // Day of Month #define HIB_CALLD1_DOW_S 24 #define HIB_CALLD1_YEAR_S 16 #define HIB_CALLD1_MON_S 8 #define HIB_CALLD1_DOM_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_CALM0 register. // //***************************************************************************** #define HIB_CALM0_AMPM 0x00400000 // AM/PM Designation #define HIB_CALM0_HR_M 0x001F0000 // Hours #define HIB_CALM0_MIN_M 0x00003F00 // Minutes #define HIB_CALM0_SEC_M 0x0000003F // Seconds #define HIB_CALM0_HR_S 16 #define HIB_CALM0_MIN_S 8 #define HIB_CALM0_SEC_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_CALM1 register. // //***************************************************************************** #define HIB_CALM1_DOM_M 0x0000001F // Day of Month #define HIB_CALM1_DOM_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_LOCK register. // //***************************************************************************** #define HIB_LOCK_HIBLOCK_M 0xFFFFFFFF // HIbernate Lock #define HIB_LOCK_HIBLOCK_KEY 0xA3359554 // Hibernate Lock Key #define HIB_LOCK_HIBLOCK_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPCTL register. // //***************************************************************************** #define HIB_TPCTL_WAKE 0x00000800 // Wake from Hibernate on a Tamper // Event #define HIB_TPCTL_MEMCLR_M 0x00000300 // HIB Memory Clear on Tamper Event #define HIB_TPCTL_MEMCLR_NONE 0x00000000 // Do not Clear HIB memory on // tamper event #define HIB_TPCTL_MEMCLR_LOW32 0x00000100 // Clear Lower 32 Bytes of HIB // memory on tamper event #define HIB_TPCTL_MEMCLR_HIGH32 0x00000200 // Clear upper 32 Bytes of HIB // memory on tamper event #define HIB_TPCTL_MEMCLR_ALL 0x00000300 // Clear all HIB memory on tamper // event #define HIB_TPCTL_TPCLR 0x00000010 // Tamper Event Clear #define HIB_TPCTL_TPEN 0x00000001 // Tamper Module Enable //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPSTAT register. // //***************************************************************************** #define HIB_TPSTAT_STATE_M 0x0000000C // Tamper Module Status #define HIB_TPSTAT_STATE_DISABLED \ 0x00000000 // Tamper disabled #define HIB_TPSTAT_STATE_CONFIGED \ 0x00000004 // Tamper configured #define HIB_TPSTAT_STATE_ERROR 0x00000008 // Tamper pin event occurred #define HIB_TPSTAT_XOSCST 0x00000002 // External Oscillator Status #define HIB_TPSTAT_XOSCFAIL 0x00000001 // External Oscillator Failure //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPIO register. // //***************************************************************************** #define HIB_TPIO_GFLTR3 0x08000000 // TMPR3 Glitch Filtering #define HIB_TPIO_PUEN3 0x04000000 // TMPR3 Internal Weak Pull-up // Enable #define HIB_TPIO_LEV3 0x02000000 // TMPR3 Trigger Level #define HIB_TPIO_EN3 0x01000000 // TMPR3 Enable #define HIB_TPIO_GFLTR2 0x00080000 // TMPR2 Glitch Filtering #define HIB_TPIO_PUEN2 0x00040000 // TMPR2 Internal Weak Pull-up // Enable #define HIB_TPIO_LEV2 0x00020000 // TMPR2 Trigger Level #define HIB_TPIO_EN2 0x00010000 // TMPR2 Enable #define HIB_TPIO_GFLTR1 0x00000800 // TMPR1 Glitch Filtering #define HIB_TPIO_PUEN1 0x00000400 // TMPR1 Internal Weak Pull-up // Enable #define HIB_TPIO_LEV1 0x00000200 // TMPR1 Trigger Level #define HIB_TPIO_EN1 0x00000100 // TMPR1Enable #define HIB_TPIO_GFLTR0 0x00000008 // TMPR0 Glitch Filtering #define HIB_TPIO_PUEN0 0x00000004 // TMPR0 Internal Weak Pull-up // Enable #define HIB_TPIO_LEV0 0x00000002 // TMPR0 Trigger Level #define HIB_TPIO_EN0 0x00000001 // TMPR0 Enable //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPLOG0 register. // //***************************************************************************** #define HIB_TPLOG0_TIME_M 0xFFFFFFFF // Tamper Log Calendar Information #define HIB_TPLOG0_TIME_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPLOG1 register. // //***************************************************************************** #define HIB_TPLOG1_XOSC 0x00010000 // Status of external 32 #define HIB_TPLOG1_TRIG3 0x00000008 // Status of TMPR[3] Trigger #define HIB_TPLOG1_TRIG2 0x00000004 // Status of TMPR[2] Trigger #define HIB_TPLOG1_TRIG1 0x00000002 // Status of TMPR[1] Trigger #define HIB_TPLOG1_TRIG0 0x00000001 // Status of TMPR[0] Trigger //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPLOG2 register. // //***************************************************************************** #define HIB_TPLOG2_TIME_M 0xFFFFFFFF // Tamper Log Calendar Information #define HIB_TPLOG2_TIME_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPLOG3 register. // //***************************************************************************** #define HIB_TPLOG3_XOSC 0x00010000 // Status of external 32 #define HIB_TPLOG3_TRIG3 0x00000008 // Status of TMPR[3] Trigger #define HIB_TPLOG3_TRIG2 0x00000004 // Status of TMPR[2] Trigger #define HIB_TPLOG3_TRIG1 0x00000002 // Status of TMPR[1] Trigger #define HIB_TPLOG3_TRIG0 0x00000001 // Status of TMPR[0] Trigger //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPLOG4 register. // //***************************************************************************** #define HIB_TPLOG4_TIME_M 0xFFFFFFFF // Tamper Log Calendar Information #define HIB_TPLOG4_TIME_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPLOG5 register. // //***************************************************************************** #define HIB_TPLOG5_XOSC 0x00010000 // Status of external 32 #define HIB_TPLOG5_TRIG3 0x00000008 // Status of TMPR[3] Trigger #define HIB_TPLOG5_TRIG2 0x00000004 // Status of TMPR[2] Trigger #define HIB_TPLOG5_TRIG1 0x00000002 // Status of TMPR[1] Trigger #define HIB_TPLOG5_TRIG0 0x00000001 // Status of TMPR[0] Trigger //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPLOG6 register. // //***************************************************************************** #define HIB_TPLOG6_TIME_M 0xFFFFFFFF // Tamper Log Calendar Information #define HIB_TPLOG6_TIME_S 0 //***************************************************************************** // // The following are defines for the bit fields in the HIB_TPLOG7 register. // //***************************************************************************** #define HIB_TPLOG7_XOSC 0x00010000 // Status of external 32 #define HIB_TPLOG7_TRIG3 0x00000008 // Status of TMPR[3] Trigger #define HIB_TPLOG7_TRIG2 0x00000004 // Status of TMPR[2] Trigger #define HIB_TPLOG7_TRIG1 0x00000002 // Status of TMPR[1] Trigger #define HIB_TPLOG7_TRIG0 0x00000001 // Status of TMPR[0] Trigger //***************************************************************************** // // The following are defines for the bit fields in the HIB_PP register. // //***************************************************************************** #define HIB_PP_TAMPER 0x00000002 // Tamper Pin Presence #define HIB_PP_WAKENC 0x00000001 // Wake Pin Presence //***************************************************************************** // // The following are defines for the bit fields in the HIB_CC register. // //***************************************************************************** #define HIB_CC_SYSCLKEN 0x00000001 // RTCOSC to System Clock Enable #endif // __HW_HIBERNATE_H__
Aghosh993/Athena
arch/tivaware_tm4c/inc/hw_hibernate.h
C
lgpl-3.0
25,680
[ 30522, 1013, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env bash # Copyright (c) 2020 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 set -euo pipefail # NOTE: This script must be sourced in order to work correctly # Temporarily stop verbose logging to prevent leaking CONDUIT_TOKEN set +x : "${CONDUIT_TOKEN:=}" # Remove export property from CONDUIT_TOKEN so it is not accidentally logged export -n CONDUIT_TOKEN if [ -z "${CONDUIT_TOKEN}" ]; then echo "Error: CONDUIT_TOKEN was not set" exit 1 fi # Resume verbose logging set -x
Bitcoin-ABC/bitcoin-abc
contrib/source-control-tools/sanitize-conduit-token.sh
Shell
mit
630
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 24234, 1001, 9385, 1006, 1039, 1007, 12609, 1996, 2978, 3597, 2378, 9797, 1001, 5500, 2104, 1996, 10210, 4007, 6105, 1010, 2156, 1996, 10860, 1001, 5371, 24731, 2030, 8299, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/******************************************************************************* * Copyright (c) 2011 Nokia Corporation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Comarch team - initial API and implementation *******************************************************************************/ package org.ned.client.view.style; public class NEDStyleToolbox { public static final int BACKGROUND_START_COLOR = 0x9fd056; public static final int BACKGROUND_END_COLOR = 0x69b510; public static final int MAIN_FONT_COLOR = 0x7b7b7b; public static final int BLUE = 0x0000FF; public static final int MAIN_BG_COLOR = 0xe1e1e1; public static final int DARK_GREY = 0x7b7b7b; public static final int WHITE = 0xffffff; public static final int TRANSPARENT = 0x0; }
nokiaeducationdelivery/ned-mobile-client
java/src/org/ned/client/view/style/NEDStyleToolbox.java
Java
epl-1.0
1,032
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*========================================================================= * * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ // // Created by Jean-Marie Mirebeau on 05/03/2014. // // #ifndef itkStructureTensorImageFilter_h #define itkStructureTensorImageFilter_h #include "itkCastImageFilter.h" #include "itkGradientRecursiveGaussianImageFilter.h" #include "itkAddImageFilter.h" #include "itkVectorIndexSelectionCastImageFilter.h" #include "itkGradientImageFilter.h" #include "itkSymmetricSecondRankTensor.h" namespace itk { /** * \class StructureTensorImageFilter * * \brief Computes the structure tensor. * * Implementation of the structure tensor, defined by * * \f[K_\rho (\nabla u_\sigma \otimes \nabla u_\sigma),\f] * * where \f$K_\rho\f$ denotes the gaussian kernel of standard deviation \f$\rho\f$, * and \f$u_\sigma := K_\sigma * u\f$. * * \ingroup AnisotropicDiffusionLBR */ template <typename TImage, typename TTensorImage = Image<SymmetricSecondRankTensor<typename TImage::PixelType, TImage::ImageDimension>, TImage::ImageDimension>> class StructureTensorImageFilter : public ImageToImageFilter<TImage, TTensorImage> { public: ITK_DISALLOW_COPY_AND_MOVE(StructureTensorImageFilter); using Self = StructureTensorImageFilter; using Superclass = ImageToImageFilter<TImage, TImage>; using Pointer = SmartPointer<Self>; using ConstPointer = SmartPointer<const Self>; /// Method for creation through the object factory. itkNewMacro(Self); /// Run-time type information (and related methods). itkTypeMacro(StructureTensorImageFilter, Superclass); using InputImageDimensionType = typename Superclass::InputImageType::ImageDimensionType; static constexpr InputImageDimensionType InputImageDimension = Superclass::InputImageType::ImageDimension; using ImageType = TImage; using PixelType = typename ImageType::PixelType; using TensorImageType = TTensorImage; using TensorType = typename TensorImageType::PixelType; using ScalarType = typename TensorType::ComponentType; using ScalarImageType = Image<ScalarType, InputImageDimension>; /// Parameter \f$\sigma\f$ of the structure tensor definition. itkSetMacro(NoiseScale, ScalarType); /// Parameter \f$\rho\f$ of the structure tensor definition. itkSetMacro(FeatureScale, ScalarType); /// Rescales all structure tensors by a common factor, so that the maximum trace is 1. itkSetMacro(RescaleForUnitMaximumTrace, bool); itkGetConstMacro(NoiseScale, ScalarType); itkGetConstMacro(FeatureScale, ScalarType); itkGetConstMacro(RescaleForUnitMaximumTrace, bool); itkGetConstMacro(PostRescaling, ScalarType); /// Global rescaling constant used. protected: void GenerateData() override; ScalarType m_FeatureScale; ScalarType m_NoiseScale; bool m_RescaleForUnitMaximumTrace{ false }; ScalarType m_PostRescaling; bool m_UseGradientRecursiveGaussianImageFilter{ true }; struct DispatchBase {}; template <bool> struct Dispatch : public DispatchBase {}; void IntermediateFilter(const Dispatch<true> &); void IntermediateFilter(const Dispatch<false> &); typename TensorImageType::Pointer m_IntermediateResult; using CovariantVectorType = CovariantVector<ScalarType, InputImageDimension>; using CovariantImageType = Image<CovariantVectorType, InputImageDimension>; struct OuterFunctor { TensorType operator()(const CovariantVectorType & u) const { TensorType m; for (InputImageDimensionType i = 0; i < InputImageDimension; ++i) { for (InputImageDimensionType j = i; j < InputImageDimension; ++j) { m(i, j) = u[i] * u[j]; } } return m; } }; struct TraceFunctor { ScalarType operator()(const TensorType & t) const { return t.GetTrace(); } }; struct ScaleFunctor { ScalarType scaling; TensorType operator()(const TensorType & t) const { return t * scaling; } }; StructureTensorImageFilter(); }; } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION # include "itkStructureTensorImageFilter.hxx" #endif #endif
InsightSoftwareConsortium/ITKAnisotropicDiffusionLBR
include/itkStructureTensorImageFilter.h
C
apache-2.0
4,847
[ 30522, 1013, 1008, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*************************************************************************** Copyright (c) 2016, EPAM SYSTEMS INC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ****************************************************************************/ package com.epam.dlab.dto.keyload; import javax.ws.rs.core.Response; import java.util.Arrays; public enum KeyLoadStatus { NONE("none", null, Response.Status.NOT_FOUND), NEW("new", null, Response.Status.ACCEPTED), SUCCESS("success", "ok", Response.Status.OK), ERROR("error", "err", Response.Status.INTERNAL_SERVER_ERROR); private String status; private String value; private Response.Status httpStatus; KeyLoadStatus(String status, String value, Response.Status httpStatus) { this.status = status; this.value = value; this.httpStatus = httpStatus; } public String getStatus() { return status; } public Response.Status getHttpStatus() { return httpStatus; } public static boolean isSuccess(String value) { return SUCCESS.value.equals(value); } public static String getStatus(boolean successed) { return successed ? SUCCESS.status : ERROR.status; } public static KeyLoadStatus findByStatus(String status) { return Arrays.stream(values()).reduce(NONE, (result, next) -> next.status.equalsIgnoreCase(status) ? next : result); } }
epam/DLab
services/dlab-model/src/main/java/com/epam/dlab/dto/keyload/KeyLoadStatus.java
Java
apache-2.0
1,894
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.coolweather.android.util; import okhttp3.OkHttpClient; import okhttp3.Request; /** * Created by wang on 2017/4/25 0025. */ public class HttpUtil { public static void sendOkHttpRequest(String address, okhttp3.Callback callback) { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder().url(address).build(); client.newCall(request).enqueue(callback); } }
gan-wang/coolweather
app/src/main/java/com/coolweather/android/util/HttpUtil.java
Java
apache-2.0
430
[ 30522, 7427, 4012, 1012, 4658, 28949, 1012, 30524, 1008, 2580, 2011, 7418, 2006, 2418, 1013, 1018, 1013, 2423, 4002, 17788, 1012, 1008, 1013, 2270, 2465, 8299, 21823, 2140, 1063, 2270, 10763, 11675, 4604, 6559, 11039, 25856, 2890, 15500, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
window.hideAlert = function () { $('#alertMessage').addClass("hidden"); $('#alertMessage').text(""); }; window.showAlert = function (msg) { $('#alertMessage').text(msg); $('#alertMessage').addClass("alert-danger"); $('#alertMessage').removeClass("hidden"); $('#alertMessage').fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100); }; window.showInfo = function (msg) { $('#alertMessage').text(msg); $('#alertMessage').removeClass("alert-danger"); $('#alertMessage').removeClass("hidden"); $('#alertMessage').fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100); }; window.dataErrorAlert = function (data) { switch (data.idError) { case "InvalidFile": showAlert(Resources["InvalidFile"]); break; case "InvalidReg": showAlert(Resources["WrongRegExpMessage"]); break; case "NotFound": showAlert(Resources["NoSearchResultsMessage"]); break; case "InvalidPassword": showAlert(Resources["UnlockInvalidPassword"]); break; default: showAlert(data.idError); break; } }; window.handleError = function (xhr, exception) { hideLoader(); $('#workButton').removeClass("hidden"); var msg = ''; if (xhr.status === 0) { msg = 'Not connect.\n Verify Network.'; } else if (xhr.status == 404) { msg = 'Requested page not found. [404]'; } else if (xhr.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error.\n' + xhr.responseText; } showAlert(msg); };
asposebarcode/Aspose_BarCode_NET
Demos/src/Aspose.BarCode.Live.Demos.UI/Scripts/Shared/Alert.js
JavaScript
mit
1,886
[ 30522, 3332, 1012, 5342, 9453, 5339, 1027, 3853, 1006, 1007, 1063, 1002, 1006, 1005, 1001, 9499, 7834, 3736, 3351, 1005, 1007, 1012, 5587, 26266, 1006, 1000, 5023, 1000, 1007, 1025, 1002, 1006, 1005, 1001, 9499, 7834, 3736, 3351, 1005, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Basics Toast is a Rack application that hooks into Ruby on Rails providing a REST interface for ActiveRecord models. For each model a HTTP interface can be configured. Using Toast's configuration DSL one declares which of its attributes are exposed, which are readable and/or writable using white lists. Web Service Provider Web Service Consumer ----------------- ----------------- | Toast | <--HTTP/REST--> | AJAX app, | ----------------- | mobile app, | | | \ | Java app, etc.| ----------- ----------- ----------- ----------------- | Model A | | Model B | | Model C | ----------- ----------- ---------- Toast dispatches any request to the right model class by using naming conventions. That way a model can be exposed on the web by a simple configuration file under `config/toast-api/coconut.rb`: {% highlight ruby %} expose(Coconut) { readables :color, :weight via_get { # for GET /coconut/ID allow do |user, coconut, uri_params| user.is_admin? end } collection(:all) { via_get { # for GET /coconuts allow do |user, coconut, uri_params| user.is_admin? end } } } {% endhighlight %} This exposes the model Coconut. Toast would respond like this: GET /coconuts --> 200 OK --> [{"self":"https://www.example.com/coconuts/1","color":...,"weight":...}, {"self":"https://www.example.com/coconuts/2","color":...,"weight":...}, {"self":"https://www.example.com/coconuts/3","color":...,"weight":...}] given there are 3 rows in the table _coconuts_. Note that this request translates to the ActiveRecord call `Coconut.all`, hence the exposition of the `all` collection. Each of the URIs in the response will fetch the respective Coconut instances: GET /coconut/2 --> 200 OK --> {"self": "https://www.example.com/coconuts/2", "color": "brown", "weight": 2.1} `color` and `weight` were declared in the `readables` list. That means these attributes are exposed via GET requests, but not updatable by PATCH requests. To allow that attributes must be declared writable: {% highlight ruby %} expose(Coconut) { readables :color writables :weight } {% endhighlight %} POST and DELETE operations must be allowed explicitly: {% highlight ruby %} expose(Coconut) { readables :color, :weight via_get { # for GET /coconut/ID allow do |user, coconut, uri_params| user.is_admin? end } via_delete { # for DELETE /coconut/ID allow do |user, coconut, uri_params| user.is_admin? end } collection(:all) { via_get { # for GET /coconuts allow do |user, coconut, uri_params| user.is_admin? end } via_post { # for POST /coconuts allow do |user, coconut, uri_params| user.is_admin? end } } } {% endhighlight %} The above permits to POST a new record (== `Coconut.create(...)` and to DELETE single instances (== `Coconnut.find(id).destroy`): POST /coconuts <-- {"color": "yellow", "weight": 42.0} --> 201 Created --> {"self": "https://www.example.com/coconuts/4", "color": "yellow", "weight": 42.0} DELETE /coconut/3 --> 200 OK Nonetheless exposing associations will render your entire data model (or parts of it) a complete web-service. Associations will be represented as URIs via which the associated resource(s) can be fetched: {% highlight ruby %} class Coconut < ActiveRecord::Base belongs_to :tree has_many :consumers end {% endhighlight %} together with `config/toast-api/coconut.rb`: {% highlight ruby %} expose(Coconut) { readables :color, :weight association(:tree) { via_get { allow do |*args| true end } } association(:consumers) { via_get { allow do |user, coconut, uri_params| user.role == 'admin' end } via_post { allow do |user, coconut, uri_params| user.role == 'admin' end } } } {% endhighlight %} GET /coconut/2 --> 200 OK --> {"self": "https://www.example.com/coconuts/2", "tree": "https://www.example.com/coconuts/2/tree", "consumers": "https://www.example.com/consumers", "color": "brown", "weight": 2.1} ## Representation Toast's JSON representation is very minimal. As you can see above it does not have any qualification of the properties. Data and links and even structured property value are possible. There are other standards like [HAL](http://stateless.co/hal_specification.html), [Siren](https://github.com/kevinswiber/siren), [Collection+JSON](http://amundsen.com/media-types/collection/) or [JSON API](http://jsonapi.org) on that matter you may also consider. Toast's key ideas and distinguishing features are: Simplicity and Opaque URIs. The JSON representation was guided by the idea that any client(/-programmer) must know the representation of each resource by documentation anyway, so there is no need to nest links in a 'links' sub structure like JSON API does. The only rules for Toast's JSON representation are: * The `self` property is the canonical URI (see below) of the model/resource * Link properties are named like ActiveRecord associations in the model and are not in non-canonical form * Data properties are named as the corresponding attributes of the model. They can contain any type and also structured data (serialized by AR or self constructed). ## URIs Toast treats URIs generally as opaque strings, meaning that it only uses complete URLs and has no concept of "URL templates" for processing. Such templates may only appear in the documentation. The canonical form of a URI for a model/resource is: `https://<HOST>/<PATH>/<RESOURCE>/<ID>?<PARAMS>`, where * `https://<HOST>` is FQDN. * `<PATH>` is an optional path segment, * `<RESOURCE>` is name of the resource/model * `<ID>` is a string of digits: `[0-9]+`, * `<PARAMS>` is an optional list of query parameters Association URIs composed like: `<CANONICAL>/<ASSOCIATION>?<PARAMS>`, where * `<CANONICAL>` is as defined above * `<ASSOCIATION>` is the name a models association (`has_many`, `belongs_to`, ...) Root collection URIs are also provided: `https://<HOST>/<PATH>/<RESOURCES>?<PARAMS>`. The string `<RESOURCES>` is named after a class method of a model that returns a relation to a collection of instances of the same model. ## Association Treatment Model instances link each other and construct a web of model instances/resources. The web is conveyed by URIs that can be traversed by GET request. All model association that are exposed appear in the JSON response as a URL, nothing else (embedding can be achieved through regular data properties). Association properties never change when associations change, because they don't use the canonical URI form. They can be used to issue a * a POST request to create a new resource + linking to the base resource, * a DELETE request to delete a model instance/resource, * a LINK request in order to link existing model instances/resources using a second canonical URI or * a UNLINK request in order to remove a association/link between model instances/resources without deleting a model instance/resource. All these actions are directly mapped to the corresponding ActiveRecord calls on associations.
robokopp/toast
docs/introduction.md
Markdown
mit
7,511
[ 30522, 1001, 24078, 15174, 2003, 30524, 2005, 2169, 2944, 1037, 8299, 8278, 2064, 2022, 26928, 1012, 2478, 15174, 1005, 1055, 9563, 16233, 2140, 2028, 18806, 2029, 1997, 2049, 12332, 2024, 6086, 1010, 2029, 2024, 3191, 3085, 1998, 1013, 203...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# # Copyright (c) 2012, NuoDB, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of NuoDB, Inc. nor the names of its contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL NUODB, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # require 'active_record/connection_adapters/nuodb_adapter'
scarey/nuodb-drivers
ruby/activerecord-nuodb-adapter/lib/activerecord-nuodb-adapter.rb
Ruby
bsd-3-clause
1,595
[ 30522, 1001, 1001, 9385, 1006, 1039, 1007, 2262, 1010, 16371, 7716, 2497, 1010, 4297, 1012, 1001, 2035, 2916, 9235, 1012, 1001, 1001, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302, 1001, 14080, 1010, 2024, 7936, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import React from 'react'; import {Link} from 'react-router'; import '../../styles/about-page.css'; // Since this component is simple and static, there's no parent container for it. const AboutPage = () => { return ( <div> <h2 className="alt-header">About</h2> <p> This example app is part of the <a href="https://github.com/coryhouse/react-slingshot">React-Slingshot starter kit</a>. </p> <p> <Link to="/badlink">Click this bad link</Link> to see the 404 page. </p> </div> ); }; export default AboutPage;
Takaitra/RecipeRunt
web/src/components/pages/AboutPage.js
JavaScript
apache-2.0
574
[ 30522, 12324, 10509, 2013, 1005, 10509, 1005, 1025, 12324, 1063, 4957, 1065, 2013, 1005, 10509, 1011, 2799, 2099, 1005, 1025, 12324, 1005, 1012, 1012, 1013, 1012, 1012, 1013, 6782, 1013, 2055, 1011, 3931, 1012, 20116, 2015, 1005, 1025, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?xml version="1.0" ?><!DOCTYPE TS><TS language="it" version="2.1"> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About profitcoin</source> <translation type="unfinished"/> </message> <message> <location line="+39"/> <source>&lt;b&gt;profitcoin&lt;/b&gt; version</source> <translation type="unfinished"/> </message> <message> <location line="+41"/> <source>Copyright © 2009-2014 The Bitcoin developers Copyright © 2014 Profitcoin team Copyright © 2014 The profitcoin developers</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source> <translation> Questo è un software sperimentale. Distribuito sotto la licenza software MIT/X11, vedi il file COPYING incluso oppure su http://www.opensource.org/licenses/mit-license.php. Questo prodotto include software sviluppato dal progetto OpenSSL per l&apos;uso del Toolkit OpenSSL (http://www.openssl.org/), software crittografico scritto da Eric Young (eay@cryptsoft.com) e software UPnP scritto da Thomas Bernard.</translation> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>Double-click to edit address or label</source> <translation>Fai doppio click per modificare o cancellare l&apos;etichetta</translation> </message> <message> <location line="+27"/> <source>Create a new address</source> <translation>Crea un nuovo indirizzo</translation> </message> <message> <location line="+14"/> <source>Copy the currently selected address to the system clipboard</source> <translation>Copia l&apos;indirizzo attualmente selezionato nella clipboard</translation> </message> <message> <location line="-11"/> <source>&amp;New Address</source> <translation type="unfinished"/> </message> <message> <location line="-46"/> <source>These are your profitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <source>&amp;Copy Address</source> <translation>&amp;Copia l&apos;indirizzo</translation> </message> <message> <location line="+11"/> <source>Show &amp;QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Sign a message to prove you own a profitcoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Delete the currently selected address from the list</source> <translation>Cancella l&apos;indirizzo attualmente selezionato dalla lista</translation> </message> <message> <location line="-14"/> <source>Verify a message to ensure it was signed with a specified profitcoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>&amp;Delete</source> <translation>&amp;Cancella</translation> </message> <message> <location filename="../addressbookpage.cpp" line="+65"/> <source>Copy &amp;Label</source> <translation>Copia &amp;l&apos;etichetta</translation> </message> <message> <location line="+2"/> <source>&amp;Edit</source> <translation>&amp;Modifica</translation> </message> <message> <location line="+250"/> <source>Export Address Book Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Testo CSV (*.csv)</translation> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+144"/> <source>Label</source> <translation>Etichetta</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Indirizzo</translation> </message> <message> <location line="+36"/> <source>(no label)</source> <translation>(nessuna etichetta)</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation>Finestra passphrase</translation> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation>Inserisci la passphrase</translation> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation>Nuova passphrase</translation> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation>Ripeti la passphrase</translation> </message> <message> <location line="+33"/> <source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>For staking only</source> <translation type="unfinished"/> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+35"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation>Inserisci la passphrase per il portamonete.&lt;br/&gt;Per piacere usare unapassphrase di &lt;b&gt;10 o più caratteri casuali&lt;/b&gt;, o &lt;b&gt;otto o più parole&lt;/b&gt;.</translation> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation>Cifra il portamonete</translation> </message> <message> <location line="+7"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>Quest&apos;operazione necessita della passphrase per sbloccare il portamonete.</translation> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation>Sblocca il portamonete</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>Quest&apos;operazione necessita della passphrase per decifrare il portamonete,</translation> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation>Decifra il portamonete</translation> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation>Cambia la passphrase</translation> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>Inserisci la vecchia e la nuova passphrase per il portamonete.</translation> </message> <message> <location line="+46"/> <source>Confirm wallet encryption</source> <translation>Conferma la cifratura del portamonete</translation> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR COINS&lt;/b&gt;!</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation>Si è sicuri di voler cifrare il portamonete?</translation> </message> <message> <location line="+15"/> <source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source> <translation>IMPORTANTE: qualsiasi backup del portafoglio effettuato precedentemente dovrebbe essere sostituito con il file del portafoglio criptato appena generato. Per ragioni di sicurezza, i backup precedenti del file del portafoglio non criptato diventeranno inservibili non appena si inizi ad usare il nuovo portafoglio criptato.</translation> </message> <message> <location line="+103"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation>Attenzione: tasto Blocco maiuscole attivo.</translation> </message> <message> <location line="-133"/> <location line="+60"/> <source>Wallet encrypted</source> <translation>Portamonete cifrato</translation> </message> <message> <location line="-58"/> <source>profitcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+44"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation>Cifratura del portamonete fallita</translation> </message> <message> <location line="-56"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>Cifratura del portamonete fallita a causa di un errore interno. Il portamonete non è stato cifrato.</translation> </message> <message> <location line="+7"/> <location line="+50"/> <source>The supplied passphrases do not match.</source> <translation>Le passphrase inserite non corrispondono.</translation> </message> <message> <location line="-38"/> <source>Wallet unlock failed</source> <translation>Sblocco del portamonete fallito</translation> </message> <message> <location line="+1"/> <location line="+12"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>La passphrase inserita per la decifrazione del portamonete è errata.</translation> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation>Decifrazione del portamonete fallita</translation> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation>Passphrase del portamonete modificata con successo.</translation> </message> </context> <context> <name>ProfitcoinGUI</name> <message> <location filename="../profitcoingui.cpp" line="+282"/> <source>Sign &amp;message...</source> <translation>Firma il &amp;messaggio...</translation> </message> <message> <location line="+251"/> <source>Synchronizing with network...</source> <translation>Sto sincronizzando con la rete...</translation> </message> <message> <location line="-319"/> <source>&amp;Overview</source> <translation>&amp;Sintesi</translation> </message> <message> <location line="+1"/> <source>Show general overview of wallet</source> <translation>Mostra lo stato generale del portamonete</translation> </message> <message> <location line="+17"/> <source>&amp;Transactions</source> <translation>&amp;Transazioni</translation> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation>Cerca nelle transazioni</translation> </message> <message> <location line="+5"/> <source>&amp;Address Book</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Edit the list of stored addresses and labels</source> <translation type="unfinished"/> </message> <message> <location line="-13"/> <source>&amp;Receive coins</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show the list of addresses for receiving payments</source> <translation type="unfinished"/> </message> <message> <location line="-7"/> <source>&amp;Send coins</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>E&amp;xit</source> <translation>&amp;Esci</translation> </message> <message> <location line="+1"/> <source>Quit application</source> <translation>Chiudi applicazione</translation> </message> <message> <location line="+6"/> <source>Show information about profitcoin</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation>Informazioni su &amp;Qt</translation> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation>Mostra informazioni su Qt</translation> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation>&amp;Opzioni...</translation> </message> <message> <location line="+4"/> <source>&amp;Encrypt Wallet...</source> <translation>&amp;Cifra il portamonete...</translation> </message> <message> <location line="+3"/> <source>&amp;Backup Wallet...</source> <translation>&amp;Backup Portamonete...</translation> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation>&amp;Cambia la passphrase...</translation> </message> <message numerus="yes"> <location line="+259"/> <source>~%n block(s) remaining</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source> <translation type="unfinished"/> </message> <message> <location line="-256"/> <source>&amp;Export...</source> <translation type="unfinished"/> </message> <message> <location line="-64"/> <source>Send coins to a profitcoin address</source> <translation type="unfinished"/> </message> <message> <location line="+47"/> <source>Modify configuration options for profitcoin</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Export the data in the current tab to a file</source> <translation type="unfinished"/> </message> <message> <location line="-14"/> <source>Encrypt or decrypt wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup wallet to another location</source> <translation>Backup portamonete in un&apos;altra locazione</translation> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation>Cambia la passphrase per la cifratura del portamonete</translation> </message> <message> <location line="+10"/> <source>&amp;Debug window</source> <translation>Finestra &amp;Debug</translation> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation>Apri la console di degugging e diagnostica</translation> </message> <message> <location line="-5"/> <source>&amp;Verify message...</source> <translation>&amp;Verifica messaggio...</translation> </message> <message> <location line="-202"/> <source>profitcoin</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet</source> <translation>Portamonete</translation> </message> <message> <location line="+180"/> <source>&amp;About profitcoin</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation>&amp;Mostra/Nascondi</translation> </message> <message> <location line="+9"/> <source>Unlock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>&amp;Lock Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Lock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>&amp;File</source> <translation>&amp;File</translation> </message> <message> <location line="+8"/> <source>&amp;Settings</source> <translation>&amp;Impostazioni</translation> </message> <message> <location line="+8"/> <source>&amp;Help</source> <translation>&amp;Aiuto</translation> </message> <message> <location line="+12"/> <source>Tabs toolbar</source> <translation>Barra degli strumenti &quot;Tabs&quot;</translation> </message> <message> <location line="+8"/> <source>Actions toolbar</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+9"/> <source>[testnet]</source> <translation>[testnet]</translation> </message> <message> <location line="+0"/> <location line="+60"/> <source>profitcoin client</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+75"/> <source>%n active connection(s) to profitcoin network</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+40"/> <source>Downloaded %1 blocks of transaction history.</source> <translation type="unfinished"/> </message> <message> <location line="+413"/> <source>Staking.&lt;br&gt;Your weight is %1&lt;br&gt;Network weight is %2&lt;br&gt;Expected time to earn reward is %3</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Not staking because wallet is locked</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because wallet is offline</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because wallet is syncing</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because you don&apos;t have mature coins</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-403"/> <source>%n second(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="-312"/> <source>About profitcoin card</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show information about profitcoin card</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>&amp;Unlock Wallet...</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+297"/> <source>%n minute(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n hour(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Up to date</source> <translation>Aggiornato</translation> </message> <message> <location line="+7"/> <source>Catching up...</source> <translation>In aggiornamento...</translation> </message> <message> <location line="+10"/> <source>Last received block was generated %1.</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Sent transaction</source> <translation>Transazione inviata</translation> </message> <message> <location line="+1"/> <source>Incoming transaction</source> <translation>Transazione ricevuta</translation> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation>Data: %1 Quantità: %2 Tipo: %3 Indirizzo: %4 </translation> </message> <message> <location line="+100"/> <location line="+15"/> <source>URI handling</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <location line="+15"/> <source>URI can not be parsed! This can be caused by an invalid profitcoin address or malformed URI parameters.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>Il portamonete è &lt;b&gt;cifrato&lt;/b&gt; e attualmente &lt;b&gt;sbloccato&lt;/b&gt;</translation> </message> <message> <location line="+10"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>Il portamonete è &lt;b&gt;cifrato&lt;/b&gt; e attualmente &lt;b&gt;bloccato&lt;/b&gt;</translation> </message> <message> <location line="+25"/> <source>Backup Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+76"/> <source>%n second(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n minute(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n hour(s)</source> <translation><numerusform>%n ora</numerusform><numerusform>%n ore</numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s)</source> <translation><numerusform>%n giorno</numerusform><numerusform>%n giorni</numerusform></translation> </message> <message> <location line="+18"/> <source>Not staking</source> <translation type="unfinished"/> </message> <message> <location filename="../profitcoin.cpp" line="+109"/> <source>A fatal error occurred. profitcoin can no longer continue safely and will quit.</source> <translation type="unfinished"/> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+90"/> <source>Network Alert</source> <translation>Avviso di rete</translation> </message> </context> <context> <name>CoinControlDialog</name> <message> <location filename="../forms/coincontroldialog.ui" line="+14"/> <source>Coin Control</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Quantity:</source> <translation>Quantità:</translation> </message> <message> <location line="+32"/> <source>Bytes:</source> <translation>Byte:</translation> </message> <message> <location line="+48"/> <source>Amount:</source> <translation>Importo:</translation> </message> <message> <location line="+32"/> <source>Priority:</source> <translation>Priorità:</translation> </message> <message> <location line="+48"/> <source>Fee:</source> <translation>Commissione:</translation> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation>Low Output:</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="+551"/> <source>no</source> <translation>no</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="+51"/> <source>After Fee:</source> <translation>Dopo Commissione:</translation> </message> <message> <location line="+35"/> <source>Change:</source> <translation>Resto:</translation> </message> <message> <location line="+69"/> <source>(un)select all</source> <translation>(de)seleziona tutto</translation> </message> <message> <location line="+13"/> <source>Tree mode</source> <translation>Modalità Albero</translation> </message> <message> <location line="+16"/> <source>List mode</source> <translation>Modalità Lista</translation> </message> <message> <location line="+45"/> <source>Amount</source> <translation>Importo</translation> </message> <message> <location line="+5"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Address</source> <translation>Indirizzo</translation> </message> <message> <location line="+5"/> <source>Date</source> <translation>Data</translation> </message> <message> <location line="+5"/> <source>Confirmations</source> <translation>Conferme:</translation> </message> <message> <location line="+3"/> <source>Confirmed</source> <translation>Confermato</translation> </message> <message> <location line="+5"/> <source>Priority</source> <translation>Priorità</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="-515"/> <source>Copy address</source> <translation>Copia l&apos;indirizzo</translation> </message> <message> <location line="+1"/> <source>Copy label</source> <translation>Copia l&apos;etichetta</translation> </message> <message> <location line="+1"/> <location line="+26"/> <source>Copy amount</source> <translation>Copia l&apos;importo</translation> </message> <message> <location line="-25"/> <source>Copy transaction ID</source> <translation>Copia l&apos;ID transazione</translation> </message> <message> <location line="+24"/> <source>Copy quantity</source> <translation>Copia quantità</translation> </message> <message> <location line="+2"/> <source>Copy fee</source> <translation>Copia commissione</translation> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation>Copia dopo commissione</translation> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation>Copia byte</translation> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation>Copia priorità</translation> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation>Copia low output</translation> </message> <message> <location line="+1"/> <source>Copy change</source> <translation>Copia resto</translation> </message> <message> <location line="+317"/> <source>highest</source> <translation>massima</translation> </message> <message> <location line="+1"/> <source>high</source> <translation>alta</translation> </message> <message> <location line="+1"/> <source>medium-high</source> <translation>medio-alta</translation> </message> <message> <location line="+1"/> <source>medium</source> <translation>media</translation> </message> <message> <location line="+4"/> <source>low-medium</source> <translation>medio-bassa</translation> </message> <message> <location line="+1"/> <source>low</source> <translation>bassa</translation> </message> <message> <location line="+1"/> <source>lowest</source> <translation>infima</translation> </message> <message> <location line="+155"/> <source>DUST</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>yes</source> <translation>si</translation> </message> <message> <location line="+10"/> <source>This label turns red, if the transaction size is bigger than 10000 bytes. This means a fee of at least %1 per kb is required. Can vary +/- 1 Byte per input.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transactions with higher priority get more likely into a block. This label turns red, if the priority is smaller than &quot;medium&quot;. This means a fee of at least %1 per kb is required.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This label turns red, if any recipient receives an amount smaller than %1. This means a fee of at least %2 is required. Amounts below 0.546 times the minimum relay fee are shown as DUST.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This label turns red, if the change is smaller than %1. This means a fee of at least %2 is required.</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <location line="+66"/> <source>(no label)</source> <translation>(nessuna etichetta)</translation> </message> <message> <location line="-9"/> <source>change from %1 (%2)</source> <translation>resto da %1 (%2)</translation> </message> <message> <location line="+1"/> <source>(change)</source> <translation>(resto)</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation>Modifica l&apos;indirizzo</translation> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation>&amp;Etichetta</translation> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation>&amp;Indirizzo</translation> </message> <message> <location line="+10"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation type="unfinished"/> </message> <message> <location filename="../editaddressdialog.cpp" line="+20"/> <source>New receiving address</source> <translation>Nuovo indirizzo di ricezione</translation> </message> <message> <location line="+4"/> <source>New sending address</source> <translation>Nuovo indirizzo d&apos;invio</translation> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation>Modifica indirizzo di ricezione</translation> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation>Modifica indirizzo d&apos;invio</translation> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>L&apos;indirizzo inserito &quot;%1&quot; è già in rubrica.</translation> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid profitcoin address.</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation>Impossibile sbloccare il portamonete.</translation> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation>Generazione della nuova chiave non riuscita.</translation> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+420"/> <location line="+12"/> <source>profitcoin-Qt</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>version</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>UI options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation type="unfinished"/> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation>Opzioni</translation> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation>&amp;Principale</translation> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation>Paga la &amp;commissione</translation> </message> <message> <location line="+31"/> <source>Reserved amount does not participate in staking and is therefore spendable at any time.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Reserve</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Automatically start profitcoin after logging in to the system.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Start profitcoin on system login</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Detach databases at shutdown</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>&amp;Network</source> <translation>Rete</translation> </message> <message> <location line="+6"/> <source>Automatically open the profitcoin client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation>Mappa le porte tramite l&apos;&amp;UPnP</translation> </message> <message> <location line="+7"/> <source>Connect to the profitcoin network through a SOCKS proxy (e.g. when connecting through Tor).</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS proxy:</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Proxy &amp;IP:</source> <translation>&amp;IP del proxy:</translation> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation>&amp;Porta:</translation> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation>Porta del proxy (es. 9050)</translation> </message> <message> <location line="+7"/> <source>SOCKS &amp;Version:</source> <translation>SOCKS &amp;Version:</translation> </message> <message> <location line="+13"/> <source>SOCKS version of the proxy (e.g. 5)</source> <translation>Versione SOCKS del proxy (es. 5)</translation> </message> <message> <location line="+36"/> <source>&amp;Window</source> <translation>&amp;Finestra</translation> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation>Mostra solo un&apos;icona nel tray quando si minimizza la finestra</translation> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation>&amp;Minimizza sul tray invece che sulla barra delle applicazioni</translation> </message> <message> <location line="+7"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation>Riduci ad icona, invece di uscire dall&apos;applicazione quando la finestra viene chiusa. Quando questa opzione è attivata, l&apos;applicazione verrà chiusa solo dopo aver selezionato Esci nel menu.</translation> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation>M&amp;inimizza alla chiusura</translation> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation>&amp;Mostra</translation> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation>&amp;Lingua Interfaccia Utente:</translation> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting profitcoin.</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation>&amp;Unità di misura degli importi in:</translation> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation>Scegli l&apos;unità di suddivisione predefinita per l&apos;interfaccia e per l&apos;invio di monete</translation> </message> <message> <location line="+9"/> <source>Whether to show profitcoin addresses in the transaction list or not.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Display addresses in transaction list</source> <translation>&amp;Mostra gli indirizzi nella lista delle transazioni</translation> </message> <message> <location line="+7"/> <source>Whether to show coin control features or not.</source> <translation>Mostrare/non mostrare le funzionalita&apos; di controllo della moneta.</translation> </message> <message> <location line="+3"/> <source>Display coin &amp;control features (experts only!)</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation>&amp;OK</translation> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation>&amp;Cancella</translation> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation type="unfinished"/> </message> <message> <location filename="../optionsdialog.cpp" line="+55"/> <source>default</source> <translation>predefinito</translation> </message> <message> <location line="+149"/> <location line="+9"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting profitcoin.</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation>L&apos;indirizzo proxy che hai fornito è invalido.</translation> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation>Modulo</translation> </message> <message> <location line="+33"/> <location line="+231"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the profitcoin network after a connection is established, but this process has not completed yet.</source> <translation type="unfinished"/> </message> <message> <location line="-160"/> <source>Stake:</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Unconfirmed:</source> <translation type="unfinished"/> </message> <message> <location line="-107"/> <source>Wallet</source> <translation>Portamonete</translation> </message> <message> <location line="+49"/> <source>Spendable:</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Your current spendable balance</source> <translation>Saldo spendibile attuale</translation> </message> <message> <location line="+71"/> <source>Immature:</source> <translation>Immaturo:</translation> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation>Importo scavato che non è ancora maturato</translation> </message> <message> <location line="+20"/> <source>Total:</source> <translation>Totale:</translation> </message> <message> <location line="+16"/> <source>Your current total balance</source> <translation>Saldo totale attuale</translation> </message> <message> <location line="+46"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>&lt;b&gt;Transazioni recenti&lt;/b&gt;</translation> </message> <message> <location line="-108"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>Total of coins that was staked, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location filename="../overviewpage.cpp" line="+113"/> <location line="+1"/> <source>out of sync</source> <translation>fuori sincrono</translation> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation type="unfinished"/> </message> <message> <location line="+56"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>Label:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Message:</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation type="unfinished"/> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation type="unfinished"/> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation>Nome del client</translation> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <location line="+23"/> <location filename="../rpcconsole.cpp" line="+348"/> <source>N/A</source> <translation>N/D</translation> </message> <message> <location line="-217"/> <source>Client version</source> <translation>Versione client</translation> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation>&amp;Informazione</translation> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation>Versione OpenSSL in uso</translation> </message> <message> <location line="+49"/> <source>Startup time</source> <translation>Tempo di avvio</translation> </message> <message> <location line="+29"/> <source>Network</source> <translation>Rete</translation> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation>Numero connessioni</translation> </message> <message> <location line="+23"/> <source>On testnet</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Block chain</source> <translation>Block chain</translation> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation>Numero attuale di blocchi</translation> </message> <message> <location line="+23"/> <source>Estimated total blocks</source> <translation>Numero totale stimato di blocchi</translation> </message> <message> <location line="+23"/> <source>Last block time</source> <translation>Ora dell blocco piu recente</translation> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation>&amp;Apri</translation> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Show the profitcoin-Qt help message to get a list with possible profitcoin command-line options.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation>&amp;Console</translation> </message> <message> <location line="-260"/> <source>Build date</source> <translation>Data di creazione</translation> </message> <message> <location line="-104"/> <source>profitcoin - Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>profitcoin Core</source> <translation type="unfinished"/> </message> <message> <location line="+279"/> <source>Debug log file</source> <translation>File log del Debug</translation> </message> <message> <location line="+7"/> <source>Open the profitcoin debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation type="unfinished"/> </message> <message> <location line="+102"/> <source>Clear console</source> <translation>Svuota console</translation> </message> <message> <location filename="../rpcconsole.cpp" line="-33"/> <source>Welcome to the profitcoin RPC console.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation>Usa le frecce direzionali per navigare la cronologia, and &lt;b&gt;Ctrl-L&lt;/b&gt; per cancellarla.</translation> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>Scrivi &lt;b&gt;help&lt;/b&gt; per un riassunto dei comandi disponibili</translation> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+182"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation>Spedisci Profitcoin</translation> </message> <message> <location line="+76"/> <source>Coin Control Features</source> <translation>Funzionalità di Coin Control</translation> </message> <message> <location line="+20"/> <source>Inputs...</source> <translation>Input...</translation> </message> <message> <location line="+7"/> <source>automatically selected</source> <translation>selezionato automaticamente</translation> </message> <message> <location line="+19"/> <source>Insufficient funds!</source> <translation>Fondi insufficienti!</translation> </message> <message> <location line="+77"/> <source>Quantity:</source> <translation>Quantità:</translation> </message> <message> <location line="+22"/> <location line="+35"/> <source>0</source> <translation type="unfinished"/> </message> <message> <location line="-19"/> <source>Bytes:</source> <translation>Byte:</translation> </message> <message> <location line="+51"/> <source>Amount:</source> <translation>Importo:</translation> </message> <message> <location line="+22"/> <location line="+86"/> <location line="+86"/> <location line="+32"/> <source>0.00 hack</source> <translation type="unfinished"/> </message> <message> <location line="-191"/> <source>Priority:</source> <translation>Priorità:</translation> </message> <message> <location line="+19"/> <source>medium</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Fee:</source> <translation>Commissione:</translation> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation>Low Output:</translation> </message> <message> <location line="+19"/> <source>no</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>After Fee:</source> <translation>Dopo Commissione:</translation> </message> <message> <location line="+35"/> <source>Change</source> <translation type="unfinished"/> </message> <message> <location line="+50"/> <source>custom change address</source> <translation type="unfinished"/> </message> <message> <location line="+106"/> <source>Send to multiple recipients at once</source> <translation>Spedisci a diversi beneficiari in una volta sola</translation> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation>&amp;Aggiungi beneficiario</translation> </message> <message> <location line="+20"/> <source>Remove all transaction fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation>Cancella &amp;tutto</translation> </message> <message> <location line="+28"/> <source>Balance:</source> <translation>Saldo:</translation> </message> <message> <location line="+16"/> <source>123.456 hack</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Confirm the send action</source> <translation>Conferma la spedizione</translation> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation>&amp;Spedisci</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-173"/> <source>Enter a profitcoin address (e.g. EakqhrmwJuHG22WirpfBvQMMUuisWZNzrP)</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Copy quantity</source> <translation>Copia quantità</translation> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation>Copia l&apos;importo</translation> </message> <message> <location line="+1"/> <source>Copy fee</source> <translation>Copia commissione</translation> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation>Copia dopo commissione</translation> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation>Copia byte</translation> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation>Copia priorità</translation> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation>Copia low output</translation> </message> <message> <location line="+1"/> <source>Copy change</source> <translation>Copia resto</translation> </message> <message> <location line="+86"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation>Conferma la spedizione di profitcoin</translation> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source> and </source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The recipient address is not valid, please recheck.</source> <translation>L&apos;indirizzo del beneficiario non è valido, per cortesia controlla.</translation> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation>L&apos;importo da pagare dev&apos;essere maggiore di 0.</translation> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation>L&apos;importo è superiore al saldo attuale</translation> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation>Il totale è superiore al saldo attuale includendo la commissione %1.</translation> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation>Trovato un indirizzo doppio, si può spedire solo una volta a ciascun indirizzo in una singola operazione.</translation> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="+251"/> <source>WARNING: Invalid profitcoin address</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>(no label)</source> <translation>(nessuna etichetta)</translation> </message> <message> <location line="+4"/> <source>WARNING: unknown change address</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation>&amp;Importo:</translation> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation>Paga &amp;a:</translation> </message> <message> <location line="+24"/> <location filename="../sendcoinsentry.cpp" line="+25"/> <source>Enter a label for this address to add it to your address book</source> <translation>Inserisci un&apos;etichetta per questo indirizzo, per aggiungerlo nella rubrica</translation> </message> <message> <location line="+9"/> <source>&amp;Label:</source> <translation>&amp;Etichetta</translation> </message> <message> <location line="+18"/> <source>The address to send the payment to (e.g. EakqhrmwJuHG22WirpfBvQMMUuisWZNzrP)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Choose address from address book</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation>Incollare l&apos;indirizzo dagli appunti</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a profitcoin address (e.g. EakqhrmwJuHG22WirpfBvQMMUuisWZNzrP)</source> <translation type="unfinished"/> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation>Firme - Firma / Verifica un messaggio</translation> </message> <message> <location line="+13"/> <location line="+124"/> <source>&amp;Sign Message</source> <translation>&amp;Firma il messaggio</translation> </message> <message> <location line="-118"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation>Puoi firmare messeggi con i tuoi indirizzi per dimostrare che sono tuoi. Fai attenzione a non firmare niente di vago, visto che gli attacchi di phishing potrebbero cercare di spingerti a mettere la tua firma su di loro. Firma solo dichiarazioni completamente dettagliate con cui sei d&apos;accordo.</translation> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. EakqhrmwJuHG22WirpfBvQMMUuisWZNzrP)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+203"/> <source>Choose an address from the address book</source> <translation type="unfinished"/> </message> <message> <location line="-193"/> <location line="+203"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="-193"/> <source>Paste address from clipboard</source> <translation>Incollare l&apos;indirizzo dagli appunti</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+12"/> <source>Enter the message you want to sign here</source> <translation>Inserisci qui il messaggio che vuoi firmare</translation> </message> <message> <location line="+24"/> <source>Copy the current signature to the system clipboard</source> <translation>Copia la firma corrente nella clipboard</translation> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this profitcoin address</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Reset all sign message fields</source> <translation>Reimposta tutti i campi della firma</translation> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation>Cancella &amp;tutto</translation> </message> <message> <location line="-87"/> <location line="+70"/> <source>&amp;Verify Message</source> <translation>&amp;Verifica Messaggio</translation> </message> <message> <location line="-64"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation>Inserisci l&apos;indirizzo per la firma, il messaggio (verifica di copiare esattamente anche i ritorni a capo, gli spazi, le tabulazioni, etc) e la firma qui sotto, per verificare il messaggio. Verifica che il contenuto della firma non sia più grande di quello del messaggio per evitare attacchi di tipo man-in-the-middle.</translation> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. EakqhrmwJuHG22WirpfBvQMMUuisWZNzrP)</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified profitcoin address</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Reset all verify message fields</source> <translation>Reimposta tutti i campi della verifica messaggio</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a profitcoin address (e.g. EakqhrmwJuHG22WirpfBvQMMUuisWZNzrP)</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation>Clicca &quot;Firma il messaggio&quot; per ottenere la firma</translation> </message> <message> <location line="+3"/> <source>Enter profitcoin signature</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation>L&apos;indirizzo inserito non è valido.</translation> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation>Per favore controlla l&apos;indirizzo e prova ancora</translation> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation>L&apos;indirizzo profitcoin inserito non è associato a nessuna chiave.</translation> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation>Sblocco del portafoglio annullato.</translation> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation>La chiave privata per l&apos;indirizzo inserito non è disponibile.</translation> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation>Firma messaggio fallita.</translation> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation>Messaggio firmato.</translation> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation>Non è stato possibile decodificare la firma.</translation> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation>Per favore controlla la firma e prova ancora.</translation> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation>La firma non corrisponde al sunto del messaggio.</translation> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation>Verifica messaggio fallita.</translation> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation>Messaggio verificato.</translation> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+19"/> <source>Open until %1</source> <translation>Aperto fino a %1</translation> </message> <message numerus="yes"> <location line="-2"/> <source>Open for %n block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+8"/> <source>conflicted</source> <translation>in conflitto</translation> </message> <message> <location line="+2"/> <source>%1/offline</source> <translation>%1/offline</translation> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation>%1/non confermato</translation> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation>%1 conferme</translation> </message> <message> <location line="+18"/> <source>Status</source> <translation>Stato</translation> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation><numerusform>, trasmesso attraverso %n nodo</numerusform><numerusform>, trasmesso attraverso %n nodi</numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation>Data</translation> </message> <message> <location line="+7"/> <source>Source</source> <translation>Sorgente</translation> </message> <message> <location line="+0"/> <source>Generated</source> <translation>Generato</translation> </message> <message> <location line="+5"/> <location line="+17"/> <source>From</source> <translation>Da</translation> </message> <message> <location line="+1"/> <location line="+22"/> <location line="+58"/> <source>To</source> <translation>A</translation> </message> <message> <location line="-77"/> <location line="+2"/> <source>own address</source> <translation>proprio indirizzo</translation> </message> <message> <location line="-2"/> <source>label</source> <translation>etichetta</translation> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation>Credito</translation> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation><numerusform>matura in %n ulteriore blocco</numerusform><numerusform>matura in altri %n blocchi</numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation>non accettate</translation> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation>Debito</translation> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation>Commissione transazione</translation> </message> <message> <location line="+16"/> <source>Net amount</source> <translation>Importo netto</translation> </message> <message> <location line="+6"/> <source>Message</source> <translation>Messaggio</translation> </message> <message> <location line="+2"/> <source>Comment</source> <translation>Commento</translation> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation>ID della transazione</translation> </message> <message> <location line="+3"/> <source>Generated coins must mature 510 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Debug information</source> <translation>Informazione di debug</translation> </message> <message> <location line="+8"/> <source>Transaction</source> <translation>Transazione</translation> </message> <message> <location line="+5"/> <source>Inputs</source> <translation>Input</translation> </message> <message> <location line="+23"/> <source>Amount</source> <translation>Importo</translation> </message> <message> <location line="+1"/> <source>true</source> <translation>vero</translation> </message> <message> <location line="+0"/> <source>false</source> <translation>falso</translation> </message> <message> <location line="-211"/> <source>, has not been successfully broadcast yet</source> <translation>, non è stato ancora trasmesso con successo</translation> </message> <message> <location line="+35"/> <source>unknown</source> <translation>sconosciuto</translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation>Dettagli sulla transazione</translation> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation>Questo pannello mostra una descrizione dettagliata della transazione</translation> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+226"/> <source>Date</source> <translation>Data</translation> </message> <message> <location line="+0"/> <source>Type</source> <translation>Tipo</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Indirizzo</translation> </message> <message> <location line="+0"/> <source>Amount</source> <translation>Importo</translation> </message> <message> <location line="+60"/> <source>Open until %1</source> <translation>Aperto fino a %1</translation> </message> <message> <location line="+12"/> <source>Confirmed (%1 confirmations)</source> <translation>Confermato (%1 conferme)</translation> </message> <message numerus="yes"> <location line="-15"/> <source>Open for %n more block(s)</source> <translation><numerusform>Aperto per %n altro blocco</numerusform><numerusform>Aperto per altri %n blocchi</numerusform></translation> </message> <message> <location line="+6"/> <source>Offline</source> <translation>Offline</translation> </message> <message> <location line="+3"/> <source>Unconfirmed</source> <translation>Non confermato:</translation> </message> <message> <location line="+3"/> <source>Confirming (%1 of %2 recommended confirmations)</source> <translation>In conferma (%1 di %2 conferme raccomandate)</translation> </message> <message> <location line="+6"/> <source>Conflicted</source> <translation>In conflitto</translation> </message> <message> <location line="+3"/> <source>Immature (%1 confirmations, will be available after %2)</source> <translation>Immaturo (%1 conferme, sarà disponibile fra %2)</translation> </message> <message> <location line="+3"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation>Questo blocco non è stato ricevuto da altri nodi e probabilmente non sarà accettato!</translation> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation>Generati, ma non accettati</translation> </message> <message> <location line="+42"/> <source>Received with</source> <translation>Ricevuto tramite</translation> </message> <message> <location line="+2"/> <source>Received from</source> <translation>Ricevuto da</translation> </message> <message> <location line="+3"/> <source>Sent to</source> <translation>Spedito a</translation> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation>Pagamento a te stesso</translation> </message> <message> <location line="+2"/> <source>Mined</source> <translation>Ottenuto dal mining</translation> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation>(N / a)</translation> </message> <message> <location line="+190"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation>Stato della transazione. Passare con il mouse su questo campo per vedere il numero di conferme.</translation> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation>Data e ora in cui la transazione è stata ricevuta.</translation> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation>Tipo di transazione.</translation> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation>Indirizzo di destinazione della transazione.</translation> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation>Importo rimosso o aggiunto al saldo.</translation> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+55"/> <location line="+16"/> <source>All</source> <translation>Tutti</translation> </message> <message> <location line="-15"/> <source>Today</source> <translation>Oggi</translation> </message> <message> <location line="+1"/> <source>This week</source> <translation>Questa settimana</translation> </message> <message> <location line="+1"/> <source>This month</source> <translation>Questo mese</translation> </message> <message> <location line="+1"/> <source>Last month</source> <translation>Il mese scorso</translation> </message> <message> <location line="+1"/> <source>This year</source> <translation>Quest&apos;anno</translation> </message> <message> <location line="+1"/> <source>Range...</source> <translation>Intervallo...</translation> </message> <message> <location line="+11"/> <source>Received with</source> <translation>Ricevuto tramite</translation> </message> <message> <location line="+2"/> <source>Sent to</source> <translation>Spedito a</translation> </message> <message> <location line="+2"/> <source>To yourself</source> <translation>A te</translation> </message> <message> <location line="+1"/> <source>Mined</source> <translation>Ottenuto dal mining</translation> </message> <message> <location line="+1"/> <source>Other</source> <translation>Altro</translation> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation>Inserisci un indirizzo o un&apos;etichetta da cercare</translation> </message> <message> <location line="+7"/> <source>Min amount</source> <translation>Importo minimo</translation> </message> <message> <location line="+34"/> <source>Copy address</source> <translation>Copia l&apos;indirizzo</translation> </message> <message> <location line="+1"/> <source>Copy label</source> <translation>Copia l&apos;etichetta</translation> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation>Copia l&apos;importo</translation> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation>Copia l&apos;ID transazione</translation> </message> <message> <location line="+1"/> <source>Edit label</source> <translation>Modifica l&apos;etichetta</translation> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation>Mostra i dettagli della transazione</translation> </message> <message> <location line="+144"/> <source>Export Transaction Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Testo CSV (*.csv)</translation> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation>Confermato</translation> </message> <message> <location line="+1"/> <source>Date</source> <translation>Data</translation> </message> <message> <location line="+1"/> <source>Type</source> <translation>Tipo</translation> </message> <message> <location line="+1"/> <source>Label</source> <translation>Etichetta</translation> </message> <message> <location line="+1"/> <source>Address</source> <translation>Indirizzo</translation> </message> <message> <location line="+1"/> <source>Amount</source> <translation>Importo</translation> </message> <message> <location line="+1"/> <source>ID</source> <translation>ID</translation> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <source>Range:</source> <translation>Intervallo:</translation> </message> <message> <location line="+8"/> <source>to</source> <translation>a</translation> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+206"/> <source>Sending...</source> <translation type="unfinished"/> </message> </context> <context> <name>profitcoin-core</name> <message> <location filename="../profitcoinstrings.cpp" line="+33"/> <source>profitcoin version</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Usage:</source> <translation>Utilizzo:</translation> </message> <message> <location line="+1"/> <source>Send command to -server or profitcoind</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>List commands</source> <translation>Lista comandi </translation> </message> <message> <location line="+1"/> <source>Get help for a command</source> <translation>Aiuto su un comando </translation> </message> <message> <location line="+2"/> <source>Options:</source> <translation>Opzioni: </translation> </message> <message> <location line="+2"/> <source>Specify configuration file (default: profitcoin.conf)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Specify pid file (default: profitcoind.pid)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify wallet file (within data directory)</source> <translation>Specifica il file portafoglio (nella cartella dati)</translation> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation>Specifica la cartella dati </translation> </message> <message> <location line="+2"/> <source>Set database cache size in megabytes (default: 25)</source> <translation>Imposta la dimensione cache del database in megabyte (predefinita: 25)</translation> </message> <message> <location line="+1"/> <source>Set database disk log size in megabytes (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Listen for connections on &lt;port&gt; (default: 15714 or testnet: 25714)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation>Mantieni al massimo &lt;n&gt; connessioni ai peer (predefinite: 125)</translation> </message> <message> <location line="+3"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation>Connessione ad un nodo per ricevere l&apos;indirizzo del peer, e disconnessione</translation> </message> <message> <location line="+1"/> <source>Specify your own public address</source> <translation>Specifica il tuo indirizzo pubblico</translation> </message> <message> <location line="+5"/> <source>Bind to given address. Use [host]:port notation for IPv6</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Stake your coins to support network and gain reward (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation>Soglia di disconnessione dei peer di cattiva qualità (predefinita: 100)</translation> </message> <message> <location line="+1"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation>Numero di secondi di sospensione che i peer di cattiva qualità devono trascorrere prima di riconnettersi (predefiniti: 86400)</translation> </message> <message> <location line="-44"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation>Errore riscontrato durante l&apos;impostazione della porta RPC %u per l&apos;ascolto su IPv4: %s</translation> </message> <message> <location line="+51"/> <source>Detach block and address databases. Increases shutdown time (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+109"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source> <translation type="unfinished"/> </message> <message> <location line="-87"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 15715 or testnet: 25715)</source> <translation type="unfinished"/> </message> <message> <location line="-11"/> <source>Accept command line and JSON-RPC commands</source> <translation>Accetta da linea di comando e da comandi JSON-RPC </translation> </message> <message> <location line="+101"/> <source>Error: Transaction creation failed </source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>Error: Wallet locked, unable to create transaction </source> <translation type="unfinished"/> </message> <message> <location line="-8"/> <source>Importing blockchain data file.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Importing bootstrap blockchain data file.</source> <translation type="unfinished"/> </message> <message> <location line="-88"/> <source>Run in the background as a daemon and accept commands</source> <translation>Esegui in background come demone e accetta i comandi </translation> </message> <message> <location line="+1"/> <source>Use the test network</source> <translation>Utilizza la rete di prova </translation> </message> <message> <location line="-24"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation>Accetta connessioni dall&apos;esterno (predefinito: 1 se no -proxy o -connect)</translation> </message> <message> <location line="-38"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation>Errore riscontrato durante l&apos;impostazione della porta RPC %u per l&apos;ascolto su IPv6, tornando su IPv4: %s</translation> </message> <message> <location line="+117"/> <source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source> <translation type="unfinished"/> </message> <message> <location line="-20"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation>Attenzione: -paytxfee è molto alta. Questa è la commissione che si paga quando si invia una transazione.</translation> </message> <message> <location line="+61"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong profitcoin will not work properly.</source> <translation type="unfinished"/> </message> <message> <location line="-31"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation>Attenzione: errore di lettura di wallet.dat! Tutte le chiave lette correttamente, ma i dati delle transazioni o le voci in rubrica potrebbero mancare o non essere corretti.</translation> </message> <message> <location line="-18"/> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation>Attenzione: wallet.dat corrotto, dati salvati! Il wallet.dat originale salvato come wallet.{timestamp}.bak in %s; se il tuo bilancio o le transazioni non sono corrette dovresti ripristinare da un backup.</translation> </message> <message> <location line="-30"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation>Tenta di recuperare le chiavi private da un wallet.dat corrotto</translation> </message> <message> <location line="+4"/> <source>Block creation options:</source> <translation>Opzioni creazione blocco:</translation> </message> <message> <location line="-62"/> <source>Connect only to the specified node(s)</source> <translation>Connetti solo al nodo specificato</translation> </message> <message> <location line="+4"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation>Scopri proprio indirizzo IP (predefinito: 1 se in ascolto e no -externalip)</translation> </message> <message> <location line="+94"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation>Impossibile mettersi in ascolto su una porta. Usa -listen=0 se vuoi usare questa opzione.</translation> </message> <message> <location line="-90"/> <source>Find peers using DNS lookup (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Sync checkpoints policy (default: strict)</source> <translation type="unfinished"/> </message> <message> <location line="+83"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Invalid amount for -reservebalance=&lt;amount&gt;</source> <translation type="unfinished"/> </message> <message> <location line="-82"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation>Buffer di ricezione massimo per connessione, &lt;n&gt;*1000 byte (predefinito: 5000)</translation> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation>Buffer di invio massimo per connessione, &lt;n&gt;*1000 byte (predefinito: 1000)</translation> </message> <message> <location line="-16"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation>Connetti solo a nodi nella rete &lt;net&gt; (IPv4, IPv6 o Tor)</translation> </message> <message> <location line="+28"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Output extra network debugging information</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Prepend debug output with timestamp</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>SSL options: (see the Profitcoin Wiki for SSL setup instructions)</source> <translation>Opzioni SSL: (vedi il wiki di Profitcoin per le istruzioni di configurazione SSL)</translation> </message> <message> <location line="-74"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation type="unfinished"/> </message> <message> <location line="+41"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation>Invia le informazioni di trace/debug alla console invece che al file debug.log</translation> </message> <message> <location line="+1"/> <source>Send trace/debug info to debugger</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation>Imposta dimensione minima del blocco in bytes (predefinita: 0)</translation> </message> <message> <location line="-29"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation>Riduci il file debug.log all&apos;avvio del client (predefinito: 1 se non impostato -debug)</translation> </message> <message> <location line="-42"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation>Specifica il timeout di connessione in millisecondi (predefinito: 5000)</translation> </message> <message> <location line="+109"/> <source>Unable to sign checkpoint, wrong checkpointkey? </source> <translation type="unfinished"/> </message> <message> <location line="-80"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation>Usa UPnP per mappare la porta in ascolto (predefinito: 0)</translation> </message> <message> <location line="-1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation>Usa UPnP per mappare la porta in ascolto (predefinito: 1 when listening)</translation> </message> <message> <location line="-25"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <source>Username for JSON-RPC connections</source> <translation>Nome utente per connessioni JSON-RPC </translation> </message> <message> <location line="+47"/> <source>Verifying database integrity...</source> <translation type="unfinished"/> </message> <message> <location line="+57"/> <source>WARNING: syncronized checkpoint violation detected, but skipped!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: Disk space is low!</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation>Attenzione: questa versione è obsoleta, aggiornamento necessario!</translation> </message> <message> <location line="-48"/> <source>wallet.dat corrupt, salvage failed</source> <translation>wallet.dat corrotto, salvataggio fallito</translation> </message> <message> <location line="-54"/> <source>Password for JSON-RPC connections</source> <translation>Password per connessioni JSON-RPC </translation> </message> <message> <location line="-84"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=profitcoinrpc rpcpassword=%s (you do not need to remember this password) The username and password MUST NOT be the same. If the file does not exist, create it with owner-readable-only file permissions. It is also recommended to set alertnotify so you are notified of problems; for example: alertnotify=echo %%s | mail -s &quot;profitcoin Alert&quot; admin@foo.com </source> <translation type="unfinished"/> </message> <message> <location line="+51"/> <source>Find peers using internet relay chat (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>Consenti connessioni JSON-RPC dall&apos;indirizzo IP specificato </translation> </message> <message> <location line="+1"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation>Inviare comandi al nodo in esecuzione su &lt;ip&gt; (predefinito: 127.0.0.1)</translation> </message> <message> <location line="+1"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>Esegui il comando quando il miglior block cambia(%s nel cmd è sostituito dall&apos;hash del blocco)</translation> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation>Esegui comando quando una transazione del portafoglio cambia (%s in cmd è sostituito da TxID)</translation> </message> <message> <location line="+3"/> <source>Require a confirmations for change (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Upgrade wallet to latest format</source> <translation>Aggiorna il wallet all&apos;ultimo formato</translation> </message> <message> <location line="+1"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation>Impostare la quantità di chiavi di riserva a &lt;n&gt; (predefinita: 100)</translation> </message> <message> <location line="+1"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>Ripeti analisi della catena dei blocchi per cercare le transazioni mancanti dal portamonete </translation> </message> <message> <location line="+2"/> <source>How many blocks to check at startup (default: 2500, 0 = all)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>How thorough the block verification is (0-6, default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Imports blocks from external blk000?.dat file</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>Utilizzare OpenSSL (https) per le connessioni JSON-RPC </translation> </message> <message> <location line="+1"/> <source>Server certificate file (default: server.cert)</source> <translation>File certificato del server (predefinito: server.cert)</translation> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation>Chiave privata del server (predefinito: server.pem)</translation> </message> <message> <location line="+1"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation type="unfinished"/> </message> <message> <location line="+53"/> <source>Error: Wallet unlocked for staking only, unable to create transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source> <translation type="unfinished"/> </message> <message> <location line="-158"/> <source>This help message</source> <translation>Questo messaggio di aiuto </translation> </message> <message> <location line="+95"/> <source>Wallet %s resides outside data directory %s.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot obtain a lock on data directory %s. profitcoin is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="-98"/> <source>profitcoin</source> <translation type="unfinished"/> </message> <message> <location line="+140"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation>Impossibile collegarsi alla %s su questo computer (bind returned error %d, %s)</translation> </message> <message> <location line="-130"/> <source>Connect through socks proxy</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation>Consenti ricerche DNS per aggiungere nodi e collegare </translation> </message> <message> <location line="+122"/> <source>Loading addresses...</source> <translation>Caricamento indirizzi...</translation> </message> <message> <location line="-15"/> <source>Error loading blkindex.dat</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>Errore caricamento wallet.dat: Wallet corrotto</translation> </message> <message> <location line="+4"/> <source>Error loading wallet.dat: Wallet requires newer version of profitcoin</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Wallet needed to be rewritten: restart profitcoin to complete</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error loading wallet.dat</source> <translation>Errore caricamento wallet.dat</translation> </message> <message> <location line="-16"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation>Indirizzo -proxy non valido: &apos;%s&apos;</translation> </message> <message> <location line="-1"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation>Rete sconosciuta specificata in -onlynet: &apos;%s&apos;</translation> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation>Versione -socks proxy sconosciuta richiesta: %i</translation> </message> <message> <location line="+4"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation>Impossibile risolvere -bind address: &apos;%s&apos;</translation> </message> <message> <location line="+2"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation>Impossibile risolvere indirizzo -externalip: &apos;%s&apos;</translation> </message> <message> <location line="-24"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>Importo non valido per -paytxfee=&lt;amount&gt;: &apos;%s&apos;</translation> </message> <message> <location line="+44"/> <source>Error: could not start node</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Sending...</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Invalid amount</source> <translation>Importo non valido</translation> </message> <message> <location line="+1"/> <source>Insufficient funds</source> <translation>Fondi insufficienti</translation> </message> <message> <location line="-34"/> <source>Loading block index...</source> <translation>Caricamento dell&apos;indice del blocco...</translation> </message> <message> <location line="-103"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>Elérendő csomópont megadása and attempt to keep the connection open</translation> </message> <message> <location line="+122"/> <source>Unable to bind to %s on this computer. profitcoin is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="-97"/> <source>Fee per KB to add to transactions you send</source> <translation type="unfinished"/> </message> <message> <location line="+55"/> <source>Invalid amount for -mininput=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Loading wallet...</source> <translation>Caricamento portamonete...</translation> </message> <message> <location line="+8"/> <source>Cannot downgrade wallet</source> <translation>Non è possibile retrocedere il wallet</translation> </message> <message> <location line="+1"/> <source>Cannot initialize keypool</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot write default address</source> <translation>Non è possibile scrivere l&apos;indirizzo predefinito</translation> </message> <message> <location line="+1"/> <source>Rescanning...</source> <translation>Ripetere la scansione...</translation> </message> <message> <location line="+5"/> <source>Done loading</source> <translation>Caricamento completato</translation> </message> <message> <location line="-167"/> <source>To use the %s option</source> <translation>Per usare la opzione %s</translation> </message> <message> <location line="+14"/> <source>Error</source> <translation>Errore</translation> </message> <message> <location line="+6"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation>Devi settare rpcpassword=&lt;password&gt; nel file di configurazione: %s Se il file non esiste, crealo con i permessi di amministratore</translation> </message> </context> </TS>
profitcoinproject/profitcoin
src/qt/locale/profitcoin_it.ts
TypeScript
mit
119,594
[ 30522, 1026, 1029, 20950, 2544, 1027, 1000, 1015, 1012, 1014, 1000, 1029, 1028, 1026, 999, 9986, 13874, 24529, 1028, 1026, 24529, 2653, 1027, 1000, 2009, 1000, 2544, 1027, 1000, 1016, 1012, 1015, 1000, 1028, 1026, 6123, 1028, 1026, 2171, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * @name FRadios * @abstract * @author * @version 1.0 */ class FRadios extends ObjetoHTML{ //function FRadios($nombre=null,$idObjeto=null,$titulo=null,$valorPorDefecto=null,$claseEstilo=null,$filas=null,$columnas=null){ function FRadios($idObjeto, $nombre, $propiedades, $tipoSalida, $accionPlus){ $this->setIdObjeto($idObjeto); $this->setNombre($nombre); $this->setPropiedades($propiedades); $this->setTipoSalida($tipoSalida); $this->setAccionPlus($accionPlus); } function toHTML(){ $total=""; $propiedades=$this->getPropiedades(); $estilo=""; if (isset($propiedades["error"])){ if (strcmp(strtolower($propiedades["error"]),"true")==0){ $estilo.=($propiedades["error"]==true?"error ":""); } } $otrosAtributos=""; foreach($propiedades as $a => $i){ switch($a){ case "opciones":case "tipo":case "campo":case "id":case "nombre":case "titulo":case "requerido":case "valorPorDefecto":case "error":break; default: $otrosAtributos.=" ".$a."='".$i."'"; } } $estilo.="contenedorCampoFormulario".$propiedades["tipo"]." campoFormulario"; $total="<fieldset id='".$this->getIdObjeto()."' class='".$estilo."Radios' >".(isset($propiedades["titulo"])?"<legend class='etiquetaFormulario etiquetaFormularioRadio'>".$propiedades["titulo"]."</legend>":""); foreach($propiedades["opciones"] as $nom=>$valor){ $total.="<div id='".$this->getIdObjeto()."Contenedor' class='".$estilo."Radio' > <input onpress='variable_".$this->getIdObjeto()."Campo=".$valor."' id='".$propiedades["id"]."' type='radio' name='".$this->getNombre()."' value='".$valor."' > <span class='campoFormularioNombreRadio'>".$nom."</span> </div>"; } $total.="</fieldset>"; //echo $total; exit(0); return $total; } } ?>
ideSoluciones/ideLibrerias
ideComponentes/XMLFormulario/ObjetoHTML.1.FRadios.php
PHP
agpl-3.0
1,854
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1030, 2171, 25312, 20617, 2015, 1008, 1030, 10061, 1008, 1030, 3166, 1008, 1030, 2544, 1015, 1012, 1014, 1008, 1013, 2465, 25312, 20617, 2015, 8908, 27885, 15759, 11631, 21246, 2140, 1063, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#region Copyright (c) 2011 Atif Aziz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion // ReSharper disable once CheckNamespace namespace Elmah.Fabmail { using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net; using MoreLinq; partial class StackTraceHtmlFragments : IStackTraceFormatter<string> { public string BeforeType { get; set; } public string AfterType { get; set; } public string BeforeMethod { get; set; } public string AfterMethod { get; set; } public string BeforeParameterType { get; set; } public string AfterParameterType { get; set; } public string BeforeParameterName { get; set; } public string AfterParameterName { get; set; } public string BeforeFile { get; set; } public string AfterFile { get; set; } public string BeforeLine { get; set; } public string AfterLine { get; set; } public string BeforeFrame { get; set; } public string AfterFrame { get; set; } public string BeforeParameters { get; set; } public string AfterParameters { get; set; } string IStackTraceFormatter<string>.Text(string text) => string.IsNullOrEmpty(text) ? string.Empty : WebUtility.HtmlEncode(text); string IStackTraceFormatter<string>.Type(string markup) => BeforeType + markup + AfterType; string IStackTraceFormatter<string>.Method(string markup) => BeforeMethod + markup + AfterMethod; string IStackTraceFormatter<string>.ParameterType(string markup) => BeforeParameterType + markup + AfterParameterType; string IStackTraceFormatter<string>.ParameterName(string markup) => BeforeParameterName + markup + AfterParameterName; string IStackTraceFormatter<string>.File(string markup) => BeforeFile + markup + AfterFile; string IStackTraceFormatter<string>.Line(string markup) => BeforeLine + markup + AfterLine; string IStackTraceFormatter<string>.BeforeFrame => BeforeFrame ?? string.Empty; string IStackTraceFormatter<string>.AfterFrame => AfterFrame ?? string.Empty; string IStackTraceFormatter<string>.BeforeParameters => BeforeParameters ?? string.Empty; string IStackTraceFormatter<string>.AfterParameters => AfterParameters ?? string.Empty; } partial interface IStackTraceFormatter<T> { T Text (string text); T Type (T markup); T Method (T markup); T ParameterType (T markup); T ParameterName (T markup); T File (T markup); T Line (T markup); T BeforeFrame { get; } T AfterFrame { get; } T BeforeParameters { get; } T AfterParameters { get; } } static partial class StackTraceFormatter { static readonly StackTraceHtmlFragments DefaultStackTraceHtmlFragments = new StackTraceHtmlFragments(); public static string FormatHtml(string text, IStackTraceFormatter<string> formatter) { return string.Concat(Format(text, formatter ?? DefaultStackTraceHtmlFragments)); } public static IEnumerable<T> Format<T>(string text, IStackTraceFormatter<T> formatter) { Debug.Assert(text != null); var frames = StackTraceParser.Parse ( text, (idx, len, txt) => new { Index = idx, End = idx + len, Text = txt, Markup = formatter.Text(txt), }, (t, m) => new { Type = new { t.Index, t.End, Markup = formatter.Type(t.Markup) }, Method = new { m.Index, m.End, Markup = formatter.Method(m.Markup) } }, (t, n) => new { Type = new { t.Index, t.End, Markup = formatter.ParameterType(t.Markup) }, Name = new { n.Index, n.End, Markup = formatter.ParameterName(n.Markup) } }, (p, ps) => new { List = p, Parameters = ps.ToArray() }, (f, l) => new { File = f.Text.Length > 0 ? new { f.Index, f.End, Markup = formatter.File(f.Markup) } : null, Line = l.Text.Length > 0 ? new { l.Index, l.End, Markup = formatter.Line(l.Markup) } : null, }, (f, tm, p, fl) => from tokens in new[] { new[] { new { f.Index, End = f.Index, Markup = formatter.BeforeFrame }, tm.Type, tm.Method, new { p.List.Index, End = p.List.Index, Markup = formatter.BeforeParameters }, }, from pe in p.Parameters from e in new[] { pe.Type, pe.Name } select e, new[] { new { Index = p.List.End, p.List.End, Markup = formatter.AfterParameters }, fl.File, fl.Line, new { Index = f.End, f.End, Markup = formatter.AfterFrame }, }, } from token in tokens where token != null select token ); return from token in Enumerable.Repeat(new { Index = 0, End = 0, Markup = default(T) }, 1) .Concat(from tokens in frames from token in tokens select token) .Pairwise((prev, curr) => new { Previous = prev, Current = curr }) from m in new[] { formatter.Text(text.Substring(token.Previous.End, token.Current.Index - token.Previous.End)), token.Current.Markup, } select m; } } }
elmah/Fabmail
src/App_Packages/StackTraceFormatter/StackTraceFormatter.cs
C#
apache-2.0
7,333
[ 30522, 1001, 2555, 9385, 1006, 1039, 1007, 2249, 2012, 10128, 21196, 1012, 2035, 2916, 9235, 1012, 1013, 1013, 1013, 1013, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1013, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at # McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ The No Age scheduler is based on the Heapset scheduler, though it does not take age into account. .. warning:: This scheduler does not take the age into account, making it **unusable** in simulations where the *timeAdvance* function can return (exactly) 0. If unsure, do **not** use this scheduler, but the more general Heapset scheduler. The heap will contain only the timestamps of events that should happen. One of the dictionaries will contain the actual models that transition at the specified time. The second dictionary than contains a reverse relation: it maps the models to their time_next. This reverse relation is necessary to know the *old* time_next value of the model. Because as soon as the model has its time_next changed, its previously scheduled time will be unknown. This 'previous time' is **not** equal to the *timeLast*, as it might be possible that the models wait time was interrupted. For a schedule, the model is added to the dictionary at the specified time_next. In case it is the first element at this location in the dictionary, we also add the timestamp to the heap. This way, the heap only contains *unique* timestamps and thus the actual complexity is reduced to the number of *different* timestamps. Furthermore, the reverse relation is also updated. Unscheduling is done similarly by simply removing the element from the dictionary. Rescheduling is a slight optimisation of unscheduling, followed by scheduling. This scheduler does still schedule models that are inactive (their time_next is infinity), though this does not influence the complexity. The complexity is not affected due to infinity being a single element in the heap that is always present. Since a heap has O(log(n)) complexity, this one additional element does not have a serious impact. The main advantage over the Activity Heap is that it never gets dirty and thus doesn't require periodical cleanup. The only part that gets dirty is the actual heap, which only contains small tuples. Duplicates of these will also be reduced to a single element, thus memory consumption should not be a problem in most cases. This scheduler is ideal in situations where most transitions happen at exactly the same time, as we can then profit from the internal structure and simply return the mapped elements. It results in sufficient efficiency in most other cases, mainly due to the code base being a lot smaller then the Activity Heap. """ from heapq import heappush, heappop from pypdevs.logger import * class SchedulerNA(object): """ Scheduler class itself """ def __init__(self, models, epsilon, total_models): """ Constructor :param models: all models in the simulation """ self.heap = [] self.reverse = [None] * total_models self.mapped = {} self.infinite = float('inf') # Init the basic 'inactive' entry here, to prevent scheduling in the heap itself self.mapped[self.infinite] = set() self.epsilon = epsilon for m in models: self.schedule(m) def schedule(self, model): """ Schedule a model :param model: the model to schedule """ try: self.mapped[model.time_next[0]].add(model) except KeyError: self.mapped[model.time_next[0]] = set([model]) heappush(self.heap, model.time_next[0]) try: self.reverse[model.model_id] = model.time_next[0] except IndexError: self.reverse.append(model.time_next[0]) def unschedule(self, model): """ Unschedule a model :param model: model to unschedule """ try: self.mapped[self.reverse[model.model_id]].remove(model) except KeyError: pass self.reverse[model.model_id] = None def massReschedule(self, reschedule_set): """ Reschedule all models provided. Equivalent to calling unschedule(model); schedule(model) on every element in the iterable. :param reschedule_set: iterable containing all models to reschedule """ #NOTE the usage of exceptions is a lot better for the PyPy JIT and nets a noticable speedup # as the JIT generates guard statements for an 'if' for model in reschedule_set: model_id = model.model_id try: self.mapped[self.reverse[model_id]].remove(model) except KeyError: # Element simply not present, so don't need to unschedule it pass self.reverse[model_id] = tn = model.time_next[0] try: self.mapped[tn].add(model) except KeyError: # Create a tuple with a single entry and use it to initialize the mapped entry self.mapped[tn] = set((model, )) heappush(self.heap, tn) def readFirst(self): """ Returns the time of the first model that has to transition :returns: timestamp of the first model """ first = self.heap[0] while len(self.mapped[first]) == 0: del self.mapped[first] heappop(self.heap) first = self.heap[0] # The age was stripped of return (first, 1) def getImminent(self, time): """ Returns a list of all models that transition at the provided time, with the specified epsilon deviation allowed. :param time: timestamp to check for models .. warning:: For efficiency, this method only checks the **first** elements, so trying to invoke this function with a timestamp higher than the value provided with the *readFirst* method, will **always** return an empty set. """ t, age = time imm_children = set() try: first = self.heap[0] if (abs(first - t) < self.epsilon): #NOTE this would change the original set, though this doesn't matter as it is no longer used imm_children = self.mapped.pop(first) heappop(self.heap) first = self.heap[0] while (abs(first - t) < self.epsilon): imm_children |= self.mapped.pop(first) heappop(self.heap) first = self.heap[0] except IndexError: pass return imm_children
kdheepak89/pypdevs
pypdevs/schedulers/schedulerNA.py
Python
apache-2.0
7,125
[ 30522, 1001, 9385, 2297, 19518, 1010, 12504, 1998, 2640, 6845, 1006, 5796, 19422, 1007, 2012, 1001, 17919, 2118, 1998, 1996, 2118, 1997, 14003, 1006, 8299, 1024, 1013, 1013, 5796, 19422, 1012, 20116, 1012, 17919, 1012, 6187, 1013, 1007, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "db.h" #include "kernel.h" #include "checkpoints.h" #include "txdb-bdb.h" #include "util.h" #include "main.h" #include <boost/version.hpp> #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> #ifndef WIN32 #include "sys/stat.h" #endif using namespace std; using namespace boost; void MakeMockTXDB() { // In practice this won't do anything because the test framework always initializes // an in-memory BDB via bitdb.MakeMock() first, as we use BDB for addresses and wallets. if (!bitdb.IsMock()) bitdb.MakeMock(); } // // CTxDB // bool CTxDB::ReadTxIndex(uint256 hash, CTxIndex& txindex) { assert(!fClient); txindex.SetNull(); return Read(make_pair(string("tx"), hash), txindex); } bool CTxDB::UpdateTxIndex(uint256 hash, const CTxIndex& txindex) { assert(!fClient); return Write(make_pair(string("tx"), hash), txindex); } bool CTxDB::AddTxIndex(const CTransaction& tx, const CDiskTxPos& pos, int nHeight) { assert(!fClient); // Add to tx index uint256 hash = tx.GetHash(); CTxIndex txindex(pos, tx.vout.size()); return Write(make_pair(string("tx"), hash), txindex); } bool CTxDB::EraseTxIndex(const CTransaction& tx) { assert(!fClient); uint256 hash = tx.GetHash(); return Erase(make_pair(string("tx"), hash)); } bool CTxDB::ContainsTx(uint256 hash) { assert(!fClient); return Exists(make_pair(string("tx"), hash)); } bool CTxDB::ReadDiskTx(uint256 hash, CTransaction& tx, CTxIndex& txindex) { assert(!fClient); tx.SetNull(); if (!ReadTxIndex(hash, txindex)) return false; return (tx.ReadFromDisk(txindex.pos)); } bool CTxDB::ReadDiskTx(uint256 hash, CTransaction& tx) { CTxIndex txindex; return ReadDiskTx(hash, tx, txindex); } bool CTxDB::ReadDiskTx(COutPoint outpoint, CTransaction& tx, CTxIndex& txindex) { return ReadDiskTx(outpoint.hash, tx, txindex); } bool CTxDB::ReadDiskTx(COutPoint outpoint, CTransaction& tx) { CTxIndex txindex; return ReadDiskTx(outpoint.hash, tx, txindex); } bool CTxDB::WriteBlockIndex(const CDiskBlockIndex& blockindex) { return Write(make_pair(string("blockindex"), blockindex.GetBlockHash()), blockindex); } bool CTxDB::ReadHashBestChain(uint256& hashBestChain) { return Read(string("hashBestChain"), hashBestChain); } bool CTxDB::WriteHashBestChain(uint256 hashBestChain) { return Write(string("hashBestChain"), hashBestChain); } bool CTxDB::ReadBestInvalidTrust(CBigNum& bnBestInvalidTrust) { return Read(string("bnBestInvalidTrust"), bnBestInvalidTrust); } bool CTxDB::WriteBestInvalidTrust(CBigNum bnBestInvalidTrust) { return Write(string("bnBestInvalidTrust"), bnBestInvalidTrust); } bool CTxDB::ReadSyncCheckpoint(uint256& hashCheckpoint) { return Read(string("hashSyncCheckpoint"), hashCheckpoint); } bool CTxDB::WriteSyncCheckpoint(uint256 hashCheckpoint) { return Write(string("hashSyncCheckpoint"), hashCheckpoint); } bool CTxDB::ReadCheckpointPubKey(string& strPubKey) { return Read(string("strCheckpointPubKey"), strPubKey); } bool CTxDB::WriteCheckpointPubKey(const string& strPubKey) { return Write(string("strCheckpointPubKey"), strPubKey); } bool CTxDB::ReadModifierUpgradeTime(unsigned int& nUpgradeTime) { return Read(string("nUpgradeTime"), nUpgradeTime); } bool CTxDB::WriteModifierUpgradeTime(const unsigned int& nUpgradeTime) { return Write(string("nUpgradeTime"), nUpgradeTime); } CBlockIndex static * InsertBlockIndex(uint256 hash) { if (hash == 0) return NULL; // Return existing map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) return (*mi).second; // Create new CBlockIndex* pindexNew = new CBlockIndex(); if (!pindexNew) throw runtime_error("LoadBlockIndex() : new CBlockIndex failed"); mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first; pindexNew->SetHash(((*mi).first)); return pindexNew; } bool CTxDB::LoadBlockIndex() { if (!LoadBlockIndexGuts()) return false; if (fRequestShutdown) return true; // Calculate nChainTrust vector<pair<int, CBlockIndex*> > vSortedByHeight; vSortedByHeight.reserve(mapBlockIndex.size()); BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex) { CBlockIndex* pindex = item.second; vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex)); } sort(vSortedByHeight.begin(), vSortedByHeight.end()); BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight) { CBlockIndex* pindex = item.second; pindex->bnChainTrust = (pindex->pprev ? pindex->pprev->bnChainTrust : 0) + pindex->GetBlockTrust(); // calculate stake modifier checksum pindex->nStakeModifierChecksum = GetStakeModifierChecksum(pindex); if (!CheckStakeModifierCheckpoints(pindex->nHeight, pindex->nStakeModifierChecksum)) return error("CTxDB::LoadBlockIndex() : Failed stake modifier checkpoint height=%d, modifier=0x%016" PRI64x, pindex->nHeight, pindex->nStakeModifier); } // Load hashBestChain pointer to end of best chain if (!ReadHashBestChain(hashBestChain)) { if (pindexGenesisBlock == NULL) return true; return error("CTxDB::LoadBlockIndex() : hashBestChain not loaded"); } if (!mapBlockIndex.count(hashBestChain)) return error("CTxDB::LoadBlockIndex() : hashBestChain not found in the block index"); pindexBest = mapBlockIndex[hashBestChain]; nBestHeight = pindexBest->nHeight; bnBestChainTrust = pindexBest->bnChainTrust; printf("LoadBlockIndex(): hashBestChain=%s height=%d trust=%s date=%s\n", hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainTrust.ToString().c_str(), DateTimeStrFormat("%x %H:%M:%S", pindexBest->GetBlockTime()).c_str()); // load hashSyncCheckpoint if (!ReadSyncCheckpoint(Checkpoints::hashSyncCheckpoint)) return error("CTxDB::LoadBlockIndex() : hashSyncCheckpoint not loaded"); printf("LoadBlockIndex(): synchronized checkpoint %s\n", Checkpoints::hashSyncCheckpoint.ToString().c_str()); // Load bnBestInvalidTrust, OK if it doesn't exist CBigNum bnBestInvalidTrust; ReadBestInvalidTrust(bnBestInvalidTrust); bnBestInvalidTrust = bnBestInvalidTrust; // Verify blocks in the best chain #ifdef ANDROID int nCheckLevel = GetArg("-checklevel", 0); int nCheckDepth = GetArg( "-checkblocks", 50); #else int nCheckLevel = GetArg("-checklevel", 1); int nCheckDepth = GetArg( "-checkblocks", 2500); #endif if (nCheckDepth == 0) nCheckDepth = 1000000000; // suffices until the year 19000 if (nCheckDepth > nBestHeight) nCheckDepth = nBestHeight; printf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel); CBlockIndex* pindexFork = NULL; map<pair<unsigned int, unsigned int>, CBlockIndex*> mapBlockPos; for (CBlockIndex* pindex = pindexBest; pindex && pindex->pprev; pindex = pindex->pprev) { if (fRequestShutdown || pindex->nHeight < nBestHeight-nCheckDepth) break; CBlock block; if (!block.ReadFromDisk(pindex)) return error("LoadBlockIndex() : block.ReadFromDisk failed"); // check level 1: verify block validity // check level 7: verify block signature too if (nCheckLevel>0 && !block.CheckBlock(true, true, (nCheckLevel>6))) { printf("LoadBlockIndex() : *** found bad block at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); pindexFork = pindex->pprev; } // check level 2: verify transaction index validity if (nCheckLevel>1) { pair<unsigned int, unsigned int> pos = make_pair(pindex->nFile, pindex->nBlockPos); mapBlockPos[pos] = pindex; BOOST_FOREACH(const CTransaction &tx, block.vtx) { uint256 hashTx = tx.GetHash(); CTxIndex txindex; if (ReadTxIndex(hashTx, txindex)) { // check level 3: checker transaction hashes if (nCheckLevel>2 || pindex->nFile != txindex.pos.nFile || pindex->nBlockPos != txindex.pos.nBlockPos) { // either an error or a duplicate transaction CTransaction txFound; if (!txFound.ReadFromDisk(txindex.pos)) { printf("LoadBlockIndex() : *** cannot read mislocated transaction %s\n", hashTx.ToString().c_str()); pindexFork = pindex->pprev; } else if (txFound.GetHash() != hashTx) // not a duplicate tx { printf("LoadBlockIndex(): *** invalid tx position for %s\n", hashTx.ToString().c_str()); pindexFork = pindex->pprev; } } // check level 4: check whether spent txouts were spent within the main chain unsigned int nOutput = 0; if (nCheckLevel>3) { BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent) { if (!txpos.IsNull()) { pair<unsigned int, unsigned int> posFind = make_pair(txpos.nFile, txpos.nBlockPos); if (!mapBlockPos.count(posFind)) { printf("LoadBlockIndex(): *** found bad spend at %d, hashBlock=%s, hashTx=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str(), hashTx.ToString().c_str()); pindexFork = pindex->pprev; } // check level 6: check whether spent txouts were spent by a valid transaction that consume them if (nCheckLevel>5) { CTransaction txSpend; if (!txSpend.ReadFromDisk(txpos)) { printf("LoadBlockIndex(): *** cannot read spending transaction of %s:%i from disk\n", hashTx.ToString().c_str(), nOutput); pindexFork = pindex->pprev; } else if (!txSpend.CheckTransaction()) { printf("LoadBlockIndex(): *** spending transaction of %s:%i is invalid\n", hashTx.ToString().c_str(), nOutput); pindexFork = pindex->pprev; } else { bool fFound = false; BOOST_FOREACH(const CTxIn &txin, txSpend.vin) if (txin.prevout.hash == hashTx && txin.prevout.n == nOutput) fFound = true; if (!fFound) { printf("LoadBlockIndex(): *** spending transaction of %s:%i does not spend it\n", hashTx.ToString().c_str(), nOutput); pindexFork = pindex->pprev; } } } } nOutput++; } } } // check level 5: check whether all prevouts are marked spent if (nCheckLevel>4) { BOOST_FOREACH(const CTxIn &txin, tx.vin) { CTxIndex txindex; if (ReadTxIndex(txin.prevout.hash, txindex)) if (txindex.vSpent.size()-1 < txin.prevout.n || txindex.vSpent[txin.prevout.n].IsNull()) { printf("LoadBlockIndex(): *** found unspent prevout %s:%i in %s\n", txin.prevout.hash.ToString().c_str(), txin.prevout.n, hashTx.ToString().c_str()); pindexFork = pindex->pprev; } } } } } } if (pindexFork && !fRequestShutdown) { // Reorg back to the fork printf("LoadBlockIndex() : *** moving best chain pointer back to block %d\n", pindexFork->nHeight); CBlock block; if (!block.ReadFromDisk(pindexFork)) return error("LoadBlockIndex() : block.ReadFromDisk failed"); CTxDB txdb; block.SetBestChain(txdb, pindexFork); } return true; } bool CTxDB::LoadBlockIndexGuts() { // Get database cursor Dbc* pcursor = GetCursor(); if (!pcursor) return false; // Load mapBlockIndex unsigned int fFlags = DB_SET_RANGE; while (true) { // Read next record CDataStream ssKey(SER_DISK, CLIENT_VERSION); if (fFlags == DB_SET_RANGE) ssKey << make_pair(string("blockindex"), uint256(0)); CDataStream ssValue(SER_DISK, CLIENT_VERSION); int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags); fFlags = DB_NEXT; if (ret == DB_NOTFOUND) break; else if (ret != 0) return false; // Unserialize try { string strType; ssKey >> strType; if (strType == "blockindex" && !fRequestShutdown) { CDiskBlockIndex diskindex; ssValue >> diskindex; uint256 blockHash = diskindex.GetBlockHash(); // Construct block index object CBlockIndex* pindexNew = InsertBlockIndex(blockHash); pindexNew->pprev = InsertBlockIndex(diskindex.hashPrev); pindexNew->pnext = InsertBlockIndex(diskindex.hashNext); pindexNew->nFile = diskindex.nFile; pindexNew->nBlockPos = diskindex.nBlockPos; pindexNew->nHeight = diskindex.nHeight; pindexNew->nMint = diskindex.nMint; pindexNew->nMoneySupply = diskindex.nMoneySupply; pindexNew->nFlags = diskindex.nFlags; pindexNew->nStakeModifier = diskindex.nStakeModifier; pindexNew->prevoutStake = diskindex.prevoutStake; pindexNew->nStakeTime = diskindex.nStakeTime; pindexNew->hashProofOfStake = diskindex.hashProofOfStake; pindexNew->nVersion = diskindex.nVersion; pindexNew->hashMerkleRoot = diskindex.hashMerkleRoot; pindexNew->nTime = diskindex.nTime; pindexNew->nBits = diskindex.nBits; pindexNew->nNonce = diskindex.nNonce; // Watch for genesis block if (pindexGenesisBlock == NULL && blockHash == (!fTestNet ? hashGenesisBlock : hashGenesisBlockTestNet)) pindexGenesisBlock = pindexNew; if (!pindexNew->CheckIndex()) return error("LoadBlockIndex() : CheckIndex failed at %d", pindexNew->nHeight); // build setStakeSeen if (pindexNew->IsProofOfStake()) setStakeSeen.insert(make_pair(pindexNew->prevoutStake, pindexNew->nStakeTime)); } else { break; // if shutdown requested or finished loading block index } } // try catch (std::exception &e) { return error("%s() : deserialize error", BOOST_CURRENT_FUNCTION); } } pcursor->close(); return true; }
ultracoindev/ultracoin
src/txdb-bdb.cpp
C++
mit
16,544
[ 30522, 1013, 1013, 9385, 1006, 1039, 1007, 2268, 1011, 2230, 20251, 6182, 17823, 22591, 3406, 1013, 1013, 9385, 1006, 1039, 1007, 2268, 1011, 2262, 1996, 2978, 3597, 2378, 9797, 1013, 1013, 5500, 2104, 1996, 10210, 1013, 1060, 14526, 4007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php // The name of this module define("_MI_MEDIAWIKI_NAME", "MediaWiki"); // A brief description of this module define("_MI_MEDIAWIKI_DESC", "MediaWiki For XOOPS Community"); // Configs define("_MI_MEDIAWIKI_STYLE", "Interface style"); define("_MI_MEDIAWIKI_STYLE_DESC", "Xoops style, MediaWiki style, or user selectable"); define("_MI_MEDIAWIKI_BLOCK_SIDEBAR", "MediaWiki Sidebar"); define("_MI_MEDIAWIKI_BLOCK_RECENTCHANGES", "MediaWiki Recent changes"); define("_MI_MEDIAWIKI_BLOCK_TOP", "Most revisions"); define("_MI_MEDIAWIKI_BLOCK_HOT", "Hot contents"); ?>
Devanshg/Mediawiki
language/english/modinfo.php
PHP
gpl-2.0
568
[ 30522, 1026, 1029, 25718, 1013, 1013, 1996, 2171, 1997, 2023, 11336, 9375, 1006, 1000, 1035, 2771, 1035, 2865, 9148, 3211, 1035, 2171, 1000, 1010, 1000, 2865, 9148, 3211, 1000, 1007, 1025, 1013, 1013, 1037, 4766, 6412, 1997, 2023, 11336, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * This file is part of x48, an emulator of the HP-48sx Calculator. * Copyright (C) 1994 Eddie C. Dost (ecd@dressler.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* $Log: device.h,v $ * Revision 1.7 1995/01/11 18:20:01 ecd * major update to support HP48 G/GX * * Revision 1.6 1994/11/28 02:19:22 ecd * played with the out register * * Revision 1.6 1994/11/28 02:19:22 ecd * played with the out register * * Revision 1.5 1994/11/02 14:51:27 ecd * added some function declarations * * Revision 1.4 1994/10/05 08:33:22 ecd * remove addr queue * * Revision 1.3 1994/09/30 12:32:49 ecd * added DISP_INSTR_OFF for faster and better display * * Revision 1.2 1994/09/13 16:58:42 ecd * changed to plain X11 * * Revision 1.1 1994/08/26 11:09:18 ecd * Initial revision * * * * $Id: device.h,v 1.7 1995/01/11 18:20:01 ecd Exp ecd $ */ #ifndef _DEVICE_H #define _DEVICE_H 1 #include "global.h" #define DISP_INSTR_OFF 0x10 #define ANN_LEFT 0x81 #define ANN_RIGHT 0x82 #define ANN_ALPHA 0x84 #define ANN_BATTERY 0x88 #define ANN_BUSY 0x90 #define ANN_IO 0xa0 typedef struct device_t { int display_touched; char contrast_touched; char disp_test_touched; char crc_touched; char power_status_touched; char power_ctrl_touched; char mode_touched; char ann_touched; char baud_touched; char card_ctrl_touched; char card_status_touched; char ioc_touched; char tcs_touched; char rcs_touched; char rbr_touched; char tbr_touched; char sreq_touched; char ir_ctrl_touched; char base_off_touched; char lcr_touched; char lbr_touched; char scratch_touched; char base_nibble_touched; char unknown_touched; char t1_ctrl_touched; char t2_ctrl_touched; char unknown2_touched; char t1_touched; char t2_touched; int speaker_counter; } device_t; extern device_t device; extern void check_devices __ProtoType__((void)); #if 0 extern void check_out_register __ProtoType__((void)); #endif extern void update_display __ProtoType__((void)); extern void redraw_display __ProtoType__((void)); extern void disp_draw_nibble __ProtoType__((word_20 addr, word_4 val)); extern void menu_draw_nibble __ProtoType__((word_20 addr, word_4 val)); extern void draw_annunc __ProtoType__((void)); extern void redraw_annunc __ProtoType__((void)); #endif /* !_DEVICE_H */
shagr4th/droid48
app/src/main/jni/device.h
C
gpl-3.0
3,131
[ 30522, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1060, 18139, 1010, 2019, 7861, 20350, 1997, 1996, 6522, 1011, 4466, 2015, 2595, 10250, 19879, 4263, 1012, 1008, 9385, 1006, 1039, 1007, 2807, 5752, 1039, 1012, 9998, 2102, 1006, 14925, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright (C) 2004 Jacquelin POTIER <jacquelin.potier@free.fr> Dynamic aspect ratio code Copyright (C) 2004 Jacquelin POTIER <jacquelin.potier@free.fr> originally based from APISpy32 v2.1 from Yariv Kaplan @ WWW.INTERNALS.COM This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //----------------------------------------------------------------------------- // Object: exported structs (needed for overriding api) //----------------------------------------------------------------------------- #pragma once #include <windows.h> #include "registers.h" // assume that structs share between WinAPIOverride and the FakeAPI dll // will have the same alignment #pragma pack(push) #pragma pack(4) typedef struct tagPrePostApiCallHookInfos { PBYTE Rbp; PBYTE ReturnAddress; HMODULE CallingModuleHandle; BOOL OverridingModulesFiltersSuccessfullyChecked; }PRE_POST_API_CALL_HOOK_INFOS,*PPRE_POST_API_CALL_HOOK_INFOS; #pragma pack(pop) #ifdef _WIN64 // StackParameters : adjusted stack parameters (no shadow for x64, only parameters passed through stack) typedef BOOL (__stdcall *pfPreApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,XMM_REGISTERS* pBeforeCallXmmRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop pre api call chain functions // StackParameters : adjusted stack parameters (no shadow for x64, only parameters passed through stack) typedef BOOL (__stdcall *pfPostApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,XMM_REGISTERS* pBeforeCallXmmRegisters,REGISTERS* pAfterCallRegisters,XMM_REGISTERS* pAfterCallXmmRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop calling post api call chain functions #else typedef BOOL (__stdcall *pfPreApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop pre api call chain functions typedef BOOL (__stdcall *pfPostApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,REGISTERS* pAfterCallRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop calling post api call chain functions #endif typedef BOOL (__stdcall *pfCOMObjectCreationCallBack)(CLSID* pClsid,IID* pIid,PVOID pInterface,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos);// return FALSE to stop calling post api call chain functions typedef BOOL (__stdcall *pfCOMObjectDeletionCallBack)(CLSID* pClsid,PVOID pIUnknownInterface,PVOID pInterfaceReturnedAtObjectCreation,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos);// return FALSE to stop calling post api call chain functions
uholeschak/ediabaslib
Tools/Win32Override/_Common_Files/ExportedStructs.h
C
gpl-3.0
3,256
[ 30522, 1013, 1008, 9385, 1006, 1039, 1007, 2432, 14855, 2278, 22197, 2378, 8962, 3771, 1026, 14855, 2278, 22197, 2378, 1012, 8962, 3771, 1030, 2489, 1012, 10424, 1028, 8790, 7814, 6463, 3642, 9385, 1006, 1039, 1007, 2432, 14855, 2278, 22197...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.twitter.io import java.io.IOException import org.junit.runner.RunWith import org.scalatest.FunSuite import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) class BufInputStreamTest extends FunSuite { private[this] val fileString = "Test_All_Tests\nTest_java_io_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_ByteArrayInputStream\nTest_java_io_ByteArrayOutputStream\nTest_java_io_DataInputStream\n" private[this] val fileBuf = Buf.ByteArray(fileString.getBytes) test("Constructor") { val is = new BufInputStream(fileBuf) assert(is.available() == fileString.length()) } test("available") { val is = new BufInputStream(fileBuf) assert(is.available() == fileString.length(), "Returned incorrect number of available bytes") } test("close") { val is = new BufInputStream(fileBuf) val i = is.read() assert(i != -1) try { is.close() } catch { case e: IOException => fail("Test 1: Failed to close the input stream.") } try { val j = is.read() assert(j != -1) } catch { case e: Exception => fail("Test 2: Should be able to read from closed stream.") } } test("markI") { val is = new BufInputStream(fileBuf) // Test for method void java.io.ByteArrayInputStream.mark(int) val array1 = new Array[Byte](100) val array2 = new Array[Byte](100) try { is.skip(3000) is.mark(1000) is.read(array1, 0, array1.length) is.reset() is.read(array2, 0, array2.length) is.reset() val s1 = new String(array1, 0, array1.length) val s2 = new String(array2, 0, array2.length) assert(s1.equals(s2), "Failed to mark correct position") } catch { case e: Exception => fail("Exception during mark test") } } test("markSupported") { val is = new BufInputStream(fileBuf) assert(is.markSupported(), "markSupported returned incorrect value") } test("read one") { val is = new BufInputStream(fileBuf) val c = is.read() is.reset() assert(c == fileString.charAt(0), "read returned incorrect char %s %s".format(c, fileString.charAt(0))) } test("read") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](20) is.skip(50) is.mark(100) is.read(array, 0, array.length) val s1 = new String(array, 0, array.length) val s2 = fileString.substring(50, 70) assert(s1.equals(s2), "Failed to read correct data.") } test("read into null array") { val is = new BufInputStream(fileBuf) intercept[NullPointerException] { is.read(null, 0, 1) fail("NullPointerException expected.") } } test("read into offset < 0") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](20) intercept[IndexOutOfBoundsException] { is.read(array , -1, 1) fail("IndexOutOfBoundsException expected.") } } test("read negative len bytes") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](20) intercept[IllegalArgumentException] { is.read(array , 1, -1) fail("IllegalArgumentException expected.") } } test("read beyond end of array") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](20) intercept[IndexOutOfBoundsException] { is.read(array, 1, array.length) fail("IndexOutOfBoundsException expected.") } intercept[IndexOutOfBoundsException] { is.read(array, array.length, array.length) fail("IndexOutOfBoundsException expected.") } } test("reset") { val is = new BufInputStream(fileBuf) // Test for method void java.io.ByteArrayInputStream.reset() val array1 = new Array[Byte](10) val array2 = new Array[Byte](10) is.mark(200) is.read(array1, 0, 10) is.reset() is.read(array2, 0, 10) is.reset() val s1 = new String(array1, 0, array1.length) val s2 = new String(array2, 0, array2.length) assert(s1.equals(s2), "Reset failed") } test("skip") { val is = new BufInputStream(fileBuf) val array1 = new Array[Byte](10) is.skip(100) is.read(array1, 0, array1.length) val s1 = new String(array1, 0, array1.length) val s2 = fileString.substring(100, 110) assert(s1.equals(s2), "Failed to skip to correct position") } test("read len=0 from non-empty stream should return 0") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](1) assert(is.read(array, 0, 0) == 0) } test("read len >= 0 from exhausted stream should return -1") { val is = new BufInputStream(fileBuf) val array = new Array[Byte](10000) val c = is.read(array, 0, array.length) assert(c == fileBuf.length, "Stream should have been exhausted") assert(is.read(array, c, 0) == -1, "Stream should have repored exhaustion") assert(is.read(array, c, array.length - c) == -1, "Stream should have repored exhaustion") } }
n054/util
util-core/src/test/scala/com/twitter/io/BufInputStreamTest.scala
Scala
apache-2.0
4,959
[ 30522, 7427, 4012, 1012, 10474, 1012, 22834, 12324, 9262, 1012, 22834, 1012, 22834, 10288, 24422, 12324, 8917, 1012, 12022, 4183, 1012, 5479, 1012, 2448, 24415, 12324, 8917, 1012, 26743, 22199, 1012, 4569, 28880, 2063, 12324, 8917, 1012, 2674...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# AUTOGENERATED FILE FROM balenalib/colibri-imx6-fedora:36-build # http://bugs.python.org/issue19846 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 RUN dnf install -y \ python3-pip \ python3-dbus \ && dnf clean all # install "virtualenv", since the vast majority of users of this image will want it RUN pip3 install -U --no-cache-dir --ignore-installed pip setuptools \ && pip3 install --no-cache-dir virtualenv RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'As of January 1st, 2020, Python 2 was end-of-life, we will change the latest tag for Balenalib Python base image to Python 3.x and drop support for Python 2 soon. So after 1st July, 2020, all the balenalib Python latest tag will point to the latest Python 3 version and no changes, or fixes will be made to balenalib Python 2 base image. If you are using Python 2 for your application, please upgrade to Python 3 before 1st July.' > /.balena/messages/python-deprecation-warning CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \ && echo "Running test-stack@python" \ && chmod +x test-stack@python.sh \ && bash test-stack@python.sh \ && rm -rf test-stack@python.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Fedora 36 \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.6.15, Pip v21.3.1, Setuptools v60.5.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo $'#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
resin-io-library/base-images
balena-base-images/python/colibri-imx6/fedora/36/3.6.15/build/Dockerfile
Dockerfile
apache-2.0
2,440
[ 30522, 1001, 8285, 6914, 16848, 5371, 2013, 28352, 8189, 29521, 1013, 27441, 23736, 1011, 10047, 2595, 2575, 1011, 7349, 6525, 1024, 4029, 1011, 3857, 1001, 8299, 1024, 1013, 1013, 12883, 1012, 18750, 1012, 8917, 1013, 3277, 16147, 2620, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * @brief Tests a slow version of MCMC for Occupancy grids * @author Brian Peasley * @date ? */ #include "OccupancyGrid/MCMC.h" #include "OccupancyGrid/cvmat_serialization.h" #include "OccupancyGrid/visualiser.h" #include "OccupancyGrid/loadOccupancyGrid.h" #include <opencv2/opencv.hpp> #include <boost/program_options.hpp> namespace po = boost::program_options; using namespace std; using namespace gtsam; Visualiser global_vis_; /// Main int main(int argc, char *argv[]) { cv::namedWindow("c", cv::WINDOW_NORMAL); // parse arguments /////////////////////////////////////////// // Declare the supported options. po::options_description desc("Run dual decomposition"); desc.add_options() ("help", "produce help message") ("width", po::value<double>(), "Width") ("height", po::value<double>(), "Height") ("resolution", po::value<double>()->required(), "Size of square cell in the map") ("dir", po::value<std::string>()->default_value("Data/player_sim_with_reflectance"), "Data directory") ("clock", po::value<double>()->default_value(400), "Max clock") ; po::positional_options_description pos; pos.add("resolution", 1); po::variables_map vm; po::store(po::command_line_parser(argc, argv).options(desc).positional(pos).run(), vm); po::notify(vm); std::string directory = vm["dir"].as<std::string>(); double max_clock = CLOCKS_PER_SEC * vm["clock"].as<double>(); // end of parse arguments //////////////////////////////////// OccupancyGrid occupancyGrid = loadOccupancyGrid(vm); global_vis_.init(occupancyGrid.height(), occupancyGrid.width()); //run metropolis OccupancyGrid::Marginals occupancyMarginals = runSlowMetropolis(occupancyGrid, 300000, max_clock); // write the result char marginalsOutput[1000]; sprintf(marginalsOutput, "Data/Metropolis_Marginals.txt"); FILE* fptr = fopen(marginalsOutput, "w"); fprintf(fptr, "%lu %lu\n", occupancyGrid.width(), occupancyGrid.height()); for (size_t i = 0; i < occupancyMarginals.size(); i++) { fprintf(fptr, "%lf ", occupancyMarginals[i]); } fclose(fptr); std::stringstream ss; ss << directory << "/SICKSlowMetropolis.png"; global_vis_.save(ss.str()); }
wecacuee/modern-occupancy-grid
tests/testSICKSlowMetropolis.cpp
C++
apache-2.0
2,216
[ 30522, 1013, 1008, 1008, 1008, 1030, 4766, 5852, 1037, 4030, 2544, 1997, 11338, 12458, 2005, 1051, 9468, 6279, 11656, 8370, 2015, 1008, 1030, 3166, 4422, 26072, 3051, 1008, 1030, 3058, 1029, 1008, 1013, 1001, 2421, 1000, 1051, 9468, 6279, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
const mix = require('laravel-mix'); mix .js('resources/assets/app.js', 'public/js') .extract(['vue', 'lodash']) ;
FiguredLimited/vue-mc
demo/webpack.mix.js
JavaScript
mit
123
[ 30522, 9530, 3367, 4666, 1027, 5478, 1006, 1005, 13679, 15985, 1011, 4666, 1005, 1007, 1025, 4666, 1012, 1046, 2015, 1006, 1005, 4219, 1013, 7045, 1013, 10439, 1012, 1046, 2015, 1005, 1010, 1005, 2270, 1013, 1046, 2015, 1005, 1007, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 1997-2008 Morgan Stanley All rights reserved. // See .../src/LICENSE for terms of distribution // // /////////////////////////////////////////////////////////////////////////////// #include <MSGUI/MSRadioBox.H> MSRadioBox::MSRadioBox(MSWidget *owner_,const char *title_) : MSActionBox(owner_,title_) { _activeButton=0; } MSRadioBox::MSRadioBox(MSWidget *owner_,const MSStringVector& title_) : MSActionBox(owner_,title_) { _activeButton=0; } MSRadioBox::~MSRadioBox(void) {} const MSSymbol& MSRadioBox::symbol(void) { static MSSymbol sym ("MSRadioBox"); return sym; } const MSSymbol& MSRadioBox::widgetType(void) const { return symbol(); } void MSRadioBox::arm(MSRadioButton *radioButton_) { disarm(); _activeButton=radioButton_; if (activeButton()!=0) activeButton()->state(MSTrue); } void MSRadioBox::disarm(void) { if (activeButton()!=0) activeButton()->state(MSFalse); _activeButton=0; } void MSRadioBox::firstMapNotify(void) { MSNodeItem *hp=childListHead(); MSNodeItem *np=hp; MSLayoutEntry *entry; MSRadioButton *radioButton; unsigned count=0; while ((np=np->next())!=hp) { entry=(MSLayoutEntry *)np->data(); radioButton=(MSRadioButton *)entry->widget(); if (radioButton->state()==MSTrue) { if (count==0) _activeButton=radioButton; count++; } if (count>1) radioButton->state(MSFalse); } if (count==0&&(np=np->next())!=hp) { entry=(MSLayoutEntry *)np->data(); radioButton=(MSRadioButton *)entry->widget(); radioButton->state(MSTrue); _activeButton=radioButton; } MSActionBox::firstMapNotify(); } void MSRadioBox::activeButton(MSRadioButton *radioButton_, MSBoolean callback_) { radioButton_->arm(callback_); }
rdm/aplus-fsf
src/MSGUI/MSRadioBox.C
C++
gpl-2.0
1,875
[ 30522, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8" /> <base href="../../../" /> <script src="list.js"></script> <script src="page.js"></script> <link type="text/css" rel="stylesheet" href="page.css" /> </head> <body> [page:Object3D] &rarr; [page:Light] &rarr; <h1>平行光([name])</h1> <p class="desc"> 平行光是沿着特定方向发射的光。这种光的表现像是无限远,从它发出的光线都是平行的。常常用平行光来模拟太阳光 的效果; 太阳足够远,因此我们可以认为太阳的位置是无限远,所以我们认为从太阳发出的光线也都是平行的。<br /><br /> 平行光可以投射阴影 - 跳转至 [page:DirectionalLightShadow] 查看更多细节。 </p> <h2>关于位置、目标和旋转说明</h2> <p> Three.js 的平行光常见的困惑是设置旋转没有效果。这是因为 three.js 的平行光类似与其他引擎的"目标平行光"。 <br /><br /> 这意味着它的方向是从一个平行光的位置 [page:Object3D.position position] 到 [page:.target target]的位置。 (而不是一个只有旋转分量的'自由平行光')。<br /><br /> 这样做的原因是为了让光线投射阴影。 - the [page:.shadow shadow] 摄像机需要一个位置来计算阴影。<br /><br /> 有关更新目标的详细信息,请参阅 [page:.target target] 下面的目标属性。 </p> <h2>示例</h2> <p> [example:canvas_morphtargets_horse morphtargets / horse ]<br /> [example:misc_controls_fly controls / fly ]<br /> [example:webvr_cubes cubes ]<br /> [example:webgl_effects_parallaxbarrier effects / parallaxbarrier ]<br /> [example:webgl_effects_stereo effects / stereo ]<br /> [example:webgl_geometry_extrude_splines geometry / extrude / splines ]<br /> [example:webgl_materials_bumpmap materials / bumpmap ]<br /> [example:webgl_materials_cubemap_balls_reflection materials / cubemap / balls / reflection ] </p> <code> // White directional light at half intensity shining from the top. var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 ); scene.add( directionalLight ); </code> <h2>构造器</h2> <h3>[name]( [param:Integer color], [param:Float intensity] )</h3> <p> [page:Integer color] - (可选参数) 16进制表示光的颜色。 缺省值为 0xffffff (白色)。<br /> [page:Float intensity] - (可选参数) 光照的强度。缺省值为1。<br /><br /> 创建一个新的 [name]。 </p> <h2>属性</h2> 公共属性请查看基类 [page:Light Light]。 <h3>[property:Boolean castShadow]</h3> <p> 如果设置为 *true* 该平行光会产生动态阴影。 警告: 这样做的代价比较高而且需要一直调整到阴影看起来正确. 查看 [page:DirectionalLightShadow] 了解详细信息。该属性默认为 *false*。 </p> <h3>[property:Boolean isDirectionalLight]</h3> <p> 用来校验这个类或者派生类是不是平行光.默认是 *true*。<br /><br /> 不应该去改变这个变量,因为内部使用这个变量做了些优化的工作。 </p> <h3>[property:Vector3 position]</h3> <p> 假如这个值设置等于 [page:Object3D.DefaultUp] (0, 1, 0),那么光线将会从上往下照射。 </p> <h3>[property:DirectionalLightShadow shadow]</h3> <p> 这个 [page:DirectionalLightShadow] 对象用来计算该平行光产生的阴影。 </p> <h3>[property:Object3D target]</h3> <p> 平行光的方向是从它的位置到目标位置。默认的目标位置为原点 *(0,0,0)*。<br /> 注意: 对于目标的位置,要将其更改为除缺省值之外的任何位置,它必须被添加到 [page:Scene scene] 场景中去。 </p> <code> scene.add( light.target ); </code> <p> 这使得属性target中的 [page:Object3D.matrixWorld matrixWorld] 会每帧自动更新。 <br /><br /> 它也可以设置target为场景中的其他对象(任意拥有 [page:Object3D.position position] 属性的对象), 示例如下: </p> <code> var targetObject = new THREE.Object3D(); scene.add(targetObject); light.target = targetObject; </code> <p> 完成上述操作后,平行光现在就可以追踪到目标对像了。 </p> <h2>方法</h2> 公共方法请查看基类 [page:Light Light]。 <h3>[method:DirectionalLight copy]( [param:DirectionalLight source] )</h3> <p> 复制 source 的值到这个平行光源对象。 </p> <h2>源码</h2> [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] </body> </html>
hsimpson/three.js
docs/api/zh/lights/DirectionalLight.html
HTML
mit
4,626
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 1062, 2232, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1013, 1028, 1026, 2918, 17850, 12879, 1027, 1000, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.7"/> <title>FlatBuffers: Use in C++</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); $(window).load(resizeHeight); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">FlatBuffers </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.7 --> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('md__cpp_usage.html','');}); </script> <div id="doc-content"> <div class="header"> <div class="headertitle"> <div class="title">Use in C++ </div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><p>Assuming you have written a schema using the above language in say <code>mygame.fbs</code> (FlatBuffer Schema, though the extension doesn't matter), you've generated a C++ header called <code>mygame_generated.h</code> using the compiler (e.g. <code>flatc -c mygame.fbs</code>), you can now start using this in your program by including the header. As noted, this header relies on <code>flatbuffers/flatbuffers.h</code>, which should be in your include path.</p> <h3>Writing in C++</h3> <p>To start creating a buffer, create an instance of <code>FlatBufferBuilder</code> which will contain the buffer as it grows:</p> <div class="fragment"><div class="line">FlatBufferBuilder fbb;</div> </div><!-- fragment --><p>Before we serialize a Monster, we need to first serialize any objects that are contained there-in, i.e. we serialize the data tree using depth first, pre-order traversal. This is generally easy to do on any tree structures. For example:</p> <div class="fragment"><div class="line"><span class="keyword">auto</span> name = fbb.CreateString(<span class="stringliteral">&quot;MyMonster&quot;</span>);</div> <div class="line"></div> <div class="line"><span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> inv[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };</div> <div class="line"><span class="keyword">auto</span> inventory = fbb.CreateVector(inv, 10);</div> </div><!-- fragment --><p><code>CreateString</code> and <code>CreateVector</code> serialize these two built-in datatypes, and return offsets into the serialized data indicating where they are stored, such that <code>Monster</code> below can refer to them.</p> <p><code>CreateString</code> can also take an <code>std::string</code>, or a <code>const char *</code> with an explicit length, and is suitable for holding UTF-8 and binary data if needed.</p> <p><code>CreateVector</code> can also take an <code>std::vector</code>. The offset it returns is typed, i.e. can only be used to set fields of the correct type below. To create a vector of struct objects (which will be stored as contiguous memory in the buffer, use <code>CreateVectorOfStructs</code> instead.</p> <p>To create a vector of nested objects (e.g. tables, strings or other vectors) collect their offsets in a temporary array/vector, then call <code>CreateVector</code> on that (see e.g. the array of strings example in <code>test.cpp</code> <code>CreateFlatBufferTest</code>).</p> <div class="fragment"><div class="line">Vec3 vec(1, 2, 3);</div> </div><!-- fragment --><p><code>Vec3</code> is the first example of code from our generated header. Structs (unlike tables) translate to simple structs in C++, so we can construct them in a familiar way.</p> <p>We have now serialized the non-scalar components of of the monster example, so we could create the monster something like this:</p> <div class="fragment"><div class="line"><span class="keyword">auto</span> mloc = CreateMonster(fbb, &amp;vec, 150, 80, name, inventory, Color_Red, 0, Any_NONE);</div> </div><!-- fragment --><p>Note that we're passing <code>150</code> for the <code>mana</code> field, which happens to be the default value: this means the field will not actually be written to the buffer, since we'll get that value anyway when we query it. This is a nice space savings, since it is very common for fields to be at their default. It means we also don't need to be scared to add fields only used in a minority of cases, since they won't bloat up the buffer sizes if they're not actually used.</p> <p>We do something similarly for the union field <code>test</code> by specifying a <code>0</code> offset and the <code>NONE</code> enum value (part of every union) to indicate we don't actually want to write this field. You can use <code>0</code> also as a default for other non-scalar types, such as strings, vectors and tables.</p> <p>Tables (like <code>Monster</code>) give you full flexibility on what fields you write (unlike <code>Vec3</code>, which always has all fields set because it is a <code>struct</code>). If you want even more control over this (i.e. skip fields even when they are not default), instead of the convenient <code>CreateMonster</code> call we can also build the object field-by-field manually:</p> <div class="fragment"><div class="line">MonsterBuilder mb(fbb);</div> <div class="line">mb.add_pos(&amp;vec);</div> <div class="line">mb.add_hp(80);</div> <div class="line">mb.add_name(name);</div> <div class="line">mb.add_inventory(inventory);</div> <div class="line"><span class="keyword">auto</span> mloc = mb.Finish();</div> </div><!-- fragment --><p>We start with a temporary helper class <code>MonsterBuilder</code> (which is defined in our generated code also), then call the various <code>add_</code> methods to set fields, and <code>Finish</code> to complete the object. This is pretty much the same code as you find inside <code>CreateMonster</code>, except we're leaving out a few fields. Fields may also be added in any order, though orderings with fields of the same size adjacent to each other most efficient in size, due to alignment. You should not nest these Builder classes (serialize your data in pre-order).</p> <p>Regardless of whether you used <code>CreateMonster</code> or <code>MonsterBuilder</code>, you now have an offset to the root of your data, and you can finish the buffer using:</p> <div class="fragment"><div class="line">FinishMonsterBuffer(fbb, mloc);</div> </div><!-- fragment --><p>The buffer is now ready to be stored somewhere, sent over the network, be compressed, or whatever you'd like to do with it. You can access the start of the buffer with <code>fbb.GetBufferPointer()</code>, and it's size from <code>fbb.GetSize()</code>.</p> <p><code>samples/sample_binary.cpp</code> is a complete code sample similar to the code above, that also includes the reading code below.</p> <h3>Reading in C++</h3> <p>If you've received a buffer from somewhere (disk, network, etc.) you can directly start traversing it using:</p> <div class="fragment"><div class="line"><span class="keyword">auto</span> monster = GetMonster(buffer_pointer);</div> </div><!-- fragment --><p><code>monster</code> is of type <code>Monster *</code>, and points to somewhere <em>inside</em> your buffer (root object pointers are not the same as <code>buffer_pointer</code> !). If you look in your generated header, you'll see it has convenient accessors for all fields, e.g.</p> <div class="fragment"><div class="line">assert(monster-&gt;hp() == 80);</div> <div class="line">assert(monster-&gt;mana() == 150); <span class="comment">// default</span></div> <div class="line">assert(strcmp(monster-&gt;name()-&gt;c_str(), <span class="stringliteral">&quot;MyMonster&quot;</span>) == 0);</div> </div><!-- fragment --><p>These should all be true. Note that we never stored a <code>mana</code> value, so it will return the default.</p> <p>To access sub-objects, in this case the <code>Vec3</code>:</p> <div class="fragment"><div class="line"><span class="keyword">auto</span> pos = monster-&gt;pos();</div> <div class="line">assert(pos);</div> <div class="line">assert(pos-&gt;z() == 3);</div> </div><!-- fragment --><p>If we had not set the <code>pos</code> field during serialization, it would be <code>NULL</code>.</p> <p>Similarly, we can access elements of the inventory array:</p> <div class="fragment"><div class="line"><span class="keyword">auto</span> inv = monster-&gt;inventory();</div> <div class="line">assert(inv);</div> <div class="line">assert(inv-&gt;Get(9) == 9);</div> </div><!-- fragment --><h3>Storing maps / dictionaries in a FlatBuffer</h3> <p>FlatBuffers doesn't support maps natively, but there is support to emulate their behavior with vectors and binary search, which means you can have fast lookups directly from a FlatBuffer without having to unpack your data into a <code>std::map</code> or similar.</p> <p>To use it:</p><ul> <li>Designate one of the fields in a table as they "key" field. You do this by setting the <code>key</code> attribute on this field, e.g. <code>name:string (key)</code>. You may only have one key field, and it must be of string or scalar type.</li> <li>Write out tables of this type as usual, collect their offsets in an array or vector.</li> <li>Instead of <code>CreateVector</code>, call <code>CreateVectorOfSortedTables</code>, which will first sort all offsets such that the tables they refer to are sorted by the key field, then serialize it.</li> <li>Now when you're accessing the FlatBuffer, you can use <code>Vector::LookupByKey</code> instead of just <code>Vector::Get</code> to access elements of the vector, e.g.: <code>myvector-&gt;LookupByKey("Fred")</code>, which returns a pointer to the corresponding table type, or <code>nullptr</code> if not found. <code>LookupByKey</code> performs a binary search, so should have a similar speed to <code>std::map</code>, though may be faster because of better caching. <code>LookupByKey</code> only works if the vector has been sorted, it will likely not find elements if it hasn't been sorted.</li> </ul> <h3>Direct memory access</h3> <p>As you can see from the above examples, all elements in a buffer are accessed through generated accessors. This is because everything is stored in little endian format on all platforms (the accessor performs a swap operation on big endian machines), and also because the layout of things is generally not known to the user.</p> <p>For structs, layout is deterministic and guaranteed to be the same accross platforms (scalars are aligned to their own size, and structs themselves to their largest member), and you are allowed to access this memory directly by using <code>sizeof()</code> and <code>memcpy</code> on the pointer to a struct, or even an array of structs.</p> <p>To compute offsets to sub-elements of a struct, make sure they are a structs themselves, as then you can use the pointers to figure out the offset without having to hardcode it. This is handy for use of arrays of structs with calls like <code>glVertexAttribPointer</code> in OpenGL or similar APIs.</p> <p>It is important to note is that structs are still little endian on all machines, so only use tricks like this if you can guarantee you're not shipping on a big endian machine (an <code>assert(FLATBUFFERS_LITTLEENDIAN)</code> would be wise).</p> <h3>Access of untrusted buffers</h3> <p>The generated accessor functions access fields over offsets, which is very quick. These offsets are not verified at run-time, so a malformed buffer could cause a program to crash by accessing random memory.</p> <p>When you're processing large amounts of data from a source you know (e.g. your own generated data on disk), this is acceptable, but when reading data from the network that can potentially have been modified by an attacker, this is undesirable.</p> <p>For this reason, you can optionally use a buffer verifier before you access the data. This verifier will check all offsets, all sizes of fields, and null termination of strings to ensure that when a buffer is accessed, all reads will end up inside the buffer.</p> <p>Each root type will have a verification function generated for it, e.g. for <code>Monster</code>, you can call:</p> <div class="fragment"><div class="line"><span class="keywordtype">bool</span> ok = VerifyMonsterBuffer(Verifier(buf, len));</div> </div><!-- fragment --><p>if <code>ok</code> is true, the buffer is safe to read.</p> <p>Besides untrusted data, this function may be useful to call in debug mode, as extra insurance against data being corrupted somewhere along the way.</p> <p>While verifying a buffer isn't "free", it is typically faster than a full traversal (since any scalar data is not actually touched), and since it may cause the buffer to be brought into cache before reading, the actual overhead may be even lower than expected.</p> <p>In specialized cases where a denial of service attack is possible, the verifier has two additional constructor arguments that allow you to limit the nesting depth and total amount of tables the verifier may encounter before declaring the buffer malformed.</p> <h2>Text &amp; schema parsing</h2> <p>Using binary buffers with the generated header provides a super low overhead use of FlatBuffer data. There are, however, times when you want to use text formats, for example because it interacts better with source control, or you want to give your users easy access to data.</p> <p>Another reason might be that you already have a lot of data in JSON format, or a tool that generates JSON, and if you can write a schema for it, this will provide you an easy way to use that data directly.</p> <p>(see the schema documentation for some specifics on the JSON format accepted).</p> <p>There are two ways to use text formats:</p> <h3>Using the compiler as a conversion tool</h3> <p>This is the preferred path, as it doesn't require you to add any new code to your program, and is maximally efficient since you can ship with binary data. The disadvantage is that it is an extra step for your users/developers to perform, though you might be able to automate it. </p><pre class="fragment">flatc -b myschema.fbs mydata.json </pre><p>This will generate the binary file <code>mydata_wire.bin</code> which can be loaded as before.</p> <h3>Making your program capable of loading text directly</h3> <p>This gives you maximum flexibility. You could even opt to support both, i.e. check for both files, and regenerate the binary from text when required, otherwise just load the binary.</p> <p>This option is currently only available for C++, or Java through JNI.</p> <p>As mentioned in the section "Building" above, this technique requires you to link a few more files into your program, and you'll want to include <code>flatbuffers/idl.h</code>.</p> <p>Load text (either a schema or json) into an in-memory buffer (there is a convenient <code>LoadFile()</code> utility function in <code>flatbuffers/util.h</code> if you wish). Construct a parser:</p> <div class="fragment"><div class="line">flatbuffers::Parser parser;</div> </div><!-- fragment --><p>Now you can parse any number of text files in sequence:</p> <div class="fragment"><div class="line">parser.Parse(text_file.c_str());</div> </div><!-- fragment --><p>This works similarly to how the command-line compiler works: a sequence of files parsed by the same <code>Parser</code> object allow later files to reference definitions in earlier files. Typically this means you first load a schema file (which populates <code>Parser</code> with definitions), followed by one or more JSON files.</p> <p>As optional argument to <code>Parse</code>, you may specify a null-terminated list of include paths. If not specified, any include statements try to resolve from the current directory.</p> <p>If there were any parsing errors, <code>Parse</code> will return <code>false</code>, and <code>Parser::err</code> contains a human readable error string with a line number etc, which you should present to the creator of that file.</p> <p>After each JSON file, the <code>Parser::fbb</code> member variable is the <code>FlatBufferBuilder</code> that contains the binary buffer version of that file, that you can access as described above.</p> <p><code>samples/sample_text.cpp</code> is a code sample showing the above operations.</p> <h3>Threading</h3> <p>Reading a FlatBuffer does not touch any memory outside the original buffer, and is entirely read-only (all const), so is safe to access from multiple threads even without synchronisation primitives.</p> <p>Creating a FlatBuffer is not thread safe. All state related to building a FlatBuffer is contained in a FlatBufferBuilder instance, and no memory outside of it is touched. To make this thread safe, either do not share instances of FlatBufferBuilder between threads (recommended), or manually wrap it in synchronisation primites. There's no automatic way to accomplish this, by design, as we feel multithreaded construction of a single buffer will be rare, and synchronisation overhead would be costly. </p> </div></div><!-- contents --> </div><!-- doc-content --> <!-- Google Analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-49880327-7', 'auto'); ga('send', 'pageview'); </script> </body> </html>
radent/flatbuffers
docs/html/md__cpp_usage.html
HTML
apache-2.0
18,427
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
class AddVersionDone < ActiveRecord::Migration def up add_column :versions, :is_done, :boolean end def down remove_column :versions, :is_done end end
nmeylan/RORganize
db/migrate/20140623191731_add_version_done.rb
Ruby
gpl-3.0
167
[ 30522, 2465, 5587, 27774, 5280, 2063, 1026, 3161, 2890, 27108, 2094, 1024, 1024, 9230, 13366, 2039, 5587, 1035, 5930, 1024, 4617, 1010, 1024, 2003, 1035, 2589, 1010, 1024, 22017, 20898, 2203, 13366, 2091, 6366, 1035, 5930, 1024, 4617, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.erm.controller; import com.erm.ejb.PersonaFacadeLocal; import com.erm.model.Municipio; import com.erm.model.NivelEducativo; import com.erm.model.Ocupacion; import com.erm.model.Parentesco; import com.erm.model.Persona; import com.erm.model.TipoDoc; import java.io.Serializable; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.faces.application.FacesMessage; import javax.inject.Named; import javax.faces.context.FacesContext; import javax.faces.view.ViewScoped; import javax.inject.Inject; import org.primefaces.event.SelectEvent; @ViewScoped @Named public class PersonaController implements Serializable { @EJB private PersonaFacadeLocal personaEJB; private List<Persona> lstpersona; private Persona selpersona; private List<Persona> listpersona; private Persona personaseleccionada; @Inject private Persona persona; @Inject private Municipio municipio; @Inject private TipoDoc tipodoc; @Inject private Ocupacion ocupacion; @Inject private Parentesco parentesco; @Inject private NivelEducativo niveleducativo; @PostConstruct public void init() { lstpersona = personaEJB.findAll(); } //getter y setter public List<Persona> getListpersona() { return listpersona; } public void setListpersona(List<Persona> listpersona) { this.listpersona = listpersona; } public Persona getSelpersona() { return selpersona; } public void setSelpersona(Persona selpersona) { this.selpersona = selpersona; } public List<Persona> getLstpersona() { return lstpersona; } public void setLstpersona(List<Persona> lstpersona) { this.lstpersona = lstpersona; } public Persona getPersona() { return persona; } public void setPersona(Persona persona) { this.persona = persona; } public Municipio getMunicipio() { return municipio; } public void setMunicipio(Municipio municipio) { this.municipio = municipio; } public Ocupacion getOcupacion() { return ocupacion; } public void setOcupacion(Ocupacion ocupacion) { this.ocupacion = ocupacion; } public Parentesco getParentesco() { return parentesco; } public void setParentesco(Parentesco parentesco) { this.parentesco = parentesco; } public NivelEducativo getNiveleducativo() { return niveleducativo; } public void setNiveleducativo(NivelEducativo niveleducativo) { this.niveleducativo = niveleducativo; } public Persona getPersonaseleccionada() { return personaseleccionada; } public void setPersonaseleccionada(Persona personaseleccionada) { this.personaseleccionada = personaseleccionada; } // Metodos public void setlistpersona(List<Persona> listpersona) { this.listpersona = listpersona; } public void registrar() { try { personaEJB.create(persona); lstpersona = personaEJB.findAll(); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", "Registro Exitoso.")); } catch (Exception e) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!", "Registro Falló.")); } } public void buscar(SelectEvent event){ Persona p1 = (Persona)event.getObject(); } public static int calcularEdad(String fecha) { String datetext = fecha; try { Calendar birth = new GregorianCalendar(); Calendar today = new GregorianCalendar(); int age = 0; int factor = 0; Date birthDate = new SimpleDateFormat("dd-MM-yyyy").parse(datetext); Date currentDate = new Date(); //current date birth.setTime(birthDate); today.setTime(currentDate); if (today.get(Calendar.MONTH) <= birth.get(Calendar.MONTH)) { if (today.get(Calendar.MONTH) == birth.get(Calendar.MONTH)) { if (today.get(Calendar.DATE) > birth.get(Calendar.DATE)) { factor = -1; //Aun no celebra su cumpleaños } } else { factor = -1; //Aun no celebra su cumpleaños } } age = (today.get(Calendar.YEAR) - birth.get(Calendar.YEAR)) + factor; return age; } catch (ParseException e) { return -1; } } }
LUISGA64/ERM_WEB
src/main/java/com/erm/controller/PersonaController.java
Java
mit
5,038
[ 30522, 7427, 4012, 1012, 9413, 2213, 1012, 11486, 1025, 12324, 4012, 1012, 9413, 2213, 1012, 1041, 3501, 2497, 1012, 16115, 7011, 21869, 4135, 9289, 1025, 12324, 4012, 1012, 9413, 2213, 1012, 2944, 1012, 14163, 8713, 11514, 3695, 1025, 1232...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/******************************************************************************* * IMS (It Makes Sense) -- NUS WSD System * Copyright (c) 2013 National University of Singapore. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ package sg.edu.nus.comp.nlp.ims.implement; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.ArrayList; import java.util.Collections; import java.util.Hashtable; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; import sg.edu.nus.comp.nlp.ims.classifiers.CLibLinearEvaluator; import sg.edu.nus.comp.nlp.ims.classifiers.IEvaluator; import sg.edu.nus.comp.nlp.ims.corpus.*; import sg.edu.nus.comp.nlp.ims.feature.*; import sg.edu.nus.comp.nlp.ims.instance.*; import sg.edu.nus.comp.nlp.ims.io.*; import sg.edu.nus.comp.nlp.ims.lexelt.*; import sg.edu.nus.comp.nlp.ims.util.*; /** * main interface of test. * * @author zhongzhi * */ public class CTester { // default instance extractor class name protected static final String INSTANCEEXTRACTOR = CInstanceExtractor.class .getName(); // default feature extractor class name protected static final String FEATUREEXTRACTOR = CFeatureExtractorCombination.class .getName(); // default corpus class name protected static final String CORPUS = CLexicalCorpus.class.getName(); // evaluator protected IEvaluator m_Evaluator = new CLibLinearEvaluator(); // writer protected IResultWriter m_Writer = new CResultWriter(); // results protected ArrayList<Object> m_Results = new ArrayList<Object>(); // instance extractor class name protected String m_InstanceExtractorName = INSTANCEEXTRACTOR; // feature extractor class name protected String m_FeatureExtractorName = FEATUREEXTRACTOR; // corpus class name protected String m_CorpusName = CORPUS; // delimiter protected String m_Delimiter = null; // sentence split protected boolean m_Split = false; // tokenized protected boolean m_Tokenized = false; // lemmatized protected boolean m_Lemmatized = false; // pos tagged protected boolean m_POSTagged = false; /** * test xml file * * @param p_XmlFile * test file * @throws Exception * test exception */ public void test(String p_XmlFile) throws Exception { Reader reader = new InputStreamReader(new FileInputStream(p_XmlFile)); this.test(reader); reader.close(); } /** * test a xml file with given lexelt ids for each test instance * * @param p_XmlFile * test file * @param p_LexeltFile * lexelt id of each instances * @throws Exception * test exception */ public void test(String p_XmlFile, String p_LexeltFile) throws Exception { String line = null; StringTokenizer tokenizer = null; Hashtable<String, ArrayList<String>> instanceLexeltIDs = new Hashtable<String, ArrayList<String>>(); BufferedReader lexeltReader = new BufferedReader(new InputStreamReader( new FileInputStream(p_LexeltFile))); while ((line = lexeltReader.readLine()) != null) { tokenizer = new StringTokenizer(line); if (tokenizer.countTokens() < 2) { lexeltReader.close(); } String id = tokenizer.nextToken(); ArrayList<String> lexeltIDs = new ArrayList<String>(); while (tokenizer.hasMoreTokens()) { lexeltIDs.add(tokenizer.nextToken()); } instanceLexeltIDs.put(id, lexeltIDs); } lexeltReader.close(); Reader reader = new InputStreamReader(new FileInputStream(p_XmlFile)); this.test(reader, instanceLexeltIDs); reader.close(); } /** * test * * @param p_XmlReader * test file reader * @throws Exception * test exceptoin */ public void test(Reader p_XmlReader) throws Exception { this.test(p_XmlReader, null); } /** * test * * @param p_XmlReader * test file reader * @param p_InstanceLexeltIDs * instace lexelt ids * @throws Exception * test exception */ public void test(Reader p_XmlReader, Hashtable<String, ArrayList<String>> p_InstanceLexeltIDs) throws Exception { IInstanceExtractor instExtractor = (IInstanceExtractor) Class.forName( this.m_InstanceExtractorName).newInstance(); IFeatureExtractor featExtractor = (IFeatureExtractor) Class.forName( this.m_FeatureExtractorName).newInstance(); ACorpus corpus = (ACorpus) Class.forName(this.m_CorpusName) .newInstance(); if (this.m_Delimiter != null) { corpus.setDelimiter(this.m_Delimiter); } corpus.setSplit(this.m_Split); corpus.setTokenized(this.m_Tokenized); corpus.setPOSTagged(this.m_POSTagged); corpus.setLemmatized(this.m_Lemmatized); corpus.load(p_XmlReader); if (this.m_Writer != null && CPlainCorpusResultWriter.class.isInstance(this.m_Writer)) { ((CPlainCorpusResultWriter)this.m_Writer).setCorpus(corpus); } instExtractor.setCorpus(corpus); instExtractor.setFeatureExtractor(featExtractor); Hashtable<String, ILexelt> lexelts = new Hashtable<String, ILexelt>(); while (instExtractor.hasNext()) { IInstance instance = instExtractor.next(); String lexeltID = instance.getLexeltID(); if (p_InstanceLexeltIDs != null) { if (p_InstanceLexeltIDs.containsKey(instance.getID())) { ArrayList<String> ids = p_InstanceLexeltIDs.get(instance .getID()); for (int i = 0; i < ids.size(); i++) { lexeltID = ids.get(i); if (!lexelts.containsKey(lexeltID)) { lexelts.put(lexeltID, new CLexelt(lexeltID)); } lexelts.get(lexeltID).addInstance(instance); } } else { throw new Exception("instance \"" + instance.getID() + "\" is not defined in lexelt file."); } } else { if (!lexelts.containsKey(lexeltID)) { lexelts.put(lexeltID, new CLexelt(lexeltID)); } lexelts.get(lexeltID).addInstance(instance); } } ArrayList<String> lexeltIDs = new ArrayList<String>(); lexeltIDs.addAll(lexelts.keySet()); Collections.sort(lexeltIDs); for (String lexeltID : lexeltIDs) { System.err.println(lexeltID); Object lexelt = lexelts.remove(lexeltID); this.m_Results.add(this.m_Evaluator.evaluate(lexelt)); } } /** * get results * * @return results */ public ArrayList<Object> getResults() { return this.m_Results; } /** * whether the input is already split * @param p_Split whether split */ public void setSplit(boolean p_Split) { this.m_Split = p_Split; } /** * whether sentences are already tokenized * @param p_Tokenized whether tokenized */ public void setTokenized(boolean p_Tokenized) { this.m_Tokenized = p_Tokenized; } /** * whether the pos info is provided * @param p_POSTagged whether pos tagged */ public void setPOSTagged(boolean p_POSTagged) { this.m_POSTagged = p_POSTagged; } /** * whether the lemma info is provided * @param p_Lemmatized whether lemmatized */ public void setLemmatized(boolean p_Lemmatized) { this.m_Lemmatized = p_Lemmatized; } /** * set the delimiter * @param p_Delimiter delimiter */ public void setDelimiter(String p_Delimiter) { this.m_Delimiter = p_Delimiter; } /** * set evaluator * * @param p_Evaluator * evaluator */ public void setEvaluator(IEvaluator p_Evaluator) { this.m_Evaluator = p_Evaluator; } /** * set writer * * @param p_Writer * writer */ public void setWriter(IResultWriter p_Writer) { this.m_Writer = p_Writer; } /** * set the corpus class name * * @param p_Name * corpus class name */ public void setCorpusClassName(String p_Name) { this.m_CorpusName = p_Name; } /** * set the instance extractor name * * @param p_Name * instance extractor name */ public void setInstanceExtractorName(String p_Name) { this.m_InstanceExtractorName = p_Name; } /** * set the feature extractor name * * @param p_Name * feature extractor name */ public void setFeatureExtractorName(String p_Name) { this.m_FeatureExtractorName = p_Name; } /** * write result * * @throws IOException * exception while write */ public void write() throws IOException { this.m_Writer.write(this.m_Results); } /** * clear results */ public void clear() { this.m_Results.clear(); } /** * @param p_Args * arguments */ public static void main(String[] p_Args) { try { String generalOptions = "Usage: testPath modelDir statisticDir saveDir\n" + "\t-i class name of Instance Extractor(default sg.edu.nus.comp.nlp.ims.instance.CInstanceExtractor)\n" + "\t-f class name of Feature Extractor(default sg.edu.nus.comp.nlp.ims.feature.CFeatureExtractorCombination)\n" + "\t-c class name of Corpus(default sg.edu.nus.comp.nlp.ims.corpus.CLexicalCorpus)\n" + "\t-e class name of Evaluator(default sg.edu.nus.comp.nlp.ims.classifiers.CLibLinearEvaluator)\n" + "\t-r class name of Result Writer(default sg.edu.nus.comp.nlp.ims.io.CResultWriter)\n" + "\t-lexelt path of lexelt file\n" + "\t-is path of index.sense(option)\n" + "\t-prop path of prop.xml for JWNL\n" + "\t-split 1/0 whether the corpus is sentence splitted(default 0)\n" + "\t-ssm path of sentence splitter model\n" + "\t-token 1/0 whether the corpus is tokenized(default 0)\n" + "\t-pos 1/0 whether the pos tag is provided in corpus(default 0)\n" + "\t-ptm path POS tagger model\n" + "\t-dict path of dictionary for opennlp POS tagger(option)\n" + "\t-tagdict path of tagdict for POS tagger(option)\n" + "\t-lemma 1/0 whether the lemma is provided in the corpus(default 0)\n" + "\t-delimiter the delimiter to separate tokens, lemmas and POS tags (default \"/\")\n" + "\t-type type of testPath\n" + "\t\tdirectory: test all xml files under directory testPath\n" + "\t\tlist: test all files listed in file testPath\n" + "\t\tfile(default): test file testPath\n"; CArgumentManager argmgr = new CArgumentManager(p_Args); if (argmgr.size() != 4) { // check arguments throw new IllegalArgumentException(generalOptions); } CTester tester = new CTester(); String type = "file"; File testPath = new File(argmgr.get(0)); String modelDir = argmgr.get(1); String statDir = argmgr.get(2); String saveDir = argmgr.get(3); String evaluatorName = CLibLinearEvaluator.class.getName(); String writerName = CResultWriter.class.getName(); String lexeltFile = null; if (argmgr.has("lexelt")) { lexeltFile = argmgr.get("lexelt"); } if (argmgr.has("type")) { type = argmgr.get("type"); } // initial JWordNet if (!argmgr.has("prop")) { System.err.println("prop.xml file for JWNL has not been set."); throw new IllegalArgumentException(generalOptions); } CJWNL.initial(new FileInputStream(argmgr.get("prop"))); // set sentence splitter if (argmgr.has("split") && Integer.parseInt(argmgr.get("split")) == 1) { tester.setSplit(true); } if (argmgr.has("ssm")) { COpenNLPSentenceSplitter.setDefaultModel(argmgr.get("ssm")); } if (argmgr.has("token") && Integer.parseInt(argmgr.get("token")) == 1) { tester.setTokenized(true); } // set pos tagger if (argmgr.has("pos") && Integer.parseInt(argmgr.get("pos")) == 1) { tester.setPOSTagged(true); tester.setTokenized(true); } if (argmgr.has("ptm")) { COpenNLPPOSTagger.setDefaultModel(argmgr.get("ptm")); } if (argmgr.has("dict")) { COpenNLPPOSTagger.setDefaultDictionary(argmgr.get("dict")); } if (argmgr.has("tagdict")) { COpenNLPPOSTagger.setDefaultPOSDictionary(argmgr.get("tagdict")); } if (argmgr.has("lemma") && Integer.parseInt(argmgr.get("lemma")) == 1) { tester.setLemmatized(true); tester.setTokenized(true); } if (argmgr.has("delimiter")) { tester.setDelimiter(argmgr.get("delimiter")); } // set evaluator if (argmgr.has("e")) { evaluatorName = argmgr.get("e"); } IEvaluator evaluator = (IEvaluator) Class.forName(evaluatorName) .newInstance(); if (argmgr.has("l") && argmgr.has("permanent")) { evaluator.setOptions(new String[]{"-m", modelDir, "-s", statDir, "-l", argmgr.get("l"), "-permanent", argmgr.get("permanent")}); } else if (argmgr.has("l")) { evaluator.setOptions(new String[]{"-m", modelDir, "-s", statDir, "-l", argmgr.get("l")}); } else { evaluator.setOptions(new String[]{"-m", modelDir, "-s", statDir}); } evaluator.setOptions(new String[] { "-m", modelDir, "-s", statDir }); if (argmgr.has("is")) { ISenseIndex senseIndex = new CWordNetSenseIndex(argmgr .get("is")); evaluator.setSenseIndex(senseIndex); } // set result writer if (argmgr.has("r")) { writerName = argmgr.get("r"); } IResultWriter writer = (IResultWriter) Class.forName(writerName) .newInstance(); writer.setOptions(new String[] { "-s", saveDir }); tester.setEvaluator(evaluator); tester.setWriter(writer); if (argmgr.has("i")) { tester.setInstanceExtractorName(argmgr.get("i")); } if (argmgr.has("f")) { tester.setFeatureExtractorName(argmgr.get("f")); } if (argmgr.has("c")) { tester.setCorpusClassName(argmgr.get("c")); } Pattern xmlPattern = Pattern.compile("([^\\/]*)\\.xml$"); Matcher matcher = null; ArrayList<File> testFiles = new ArrayList<File>(); if (type.equals("list")) { // in file String line = null; BufferedReader reader = new BufferedReader(new InputStreamReader( new FileInputStream(testPath))); while ((line = reader.readLine()) != null) { testFiles.add(new File(line)); } reader.close(); } else if (type.equals("directory")) { if (!testPath.exists() || !testPath.isDirectory()) { throw new Exception("Error: cannot not find test path " + testPath.getName() + "!\n"); } File[] files = testPath.listFiles(); for (File file : files) { matcher = xmlPattern.matcher(file.getAbsolutePath()); if (matcher.find()) { testFiles.add(file); } } } else { testFiles.add(testPath); } for (File testFile : testFiles) { System.err.println("testing " + testFile.getAbsolutePath()); if (lexeltFile != null) { tester.test(testFile.getAbsolutePath(), lexeltFile); } else { tester.test(testFile.getAbsolutePath()); } System.err.println("writing results"); tester.write(); tester.clear(); } } catch (Exception e) { e.printStackTrace(); } } }
jgrivolla/dkpro-wsd-gpl
de.tudarmstadt.ukp.dkpro.wsd.supervised.ims-gpl/src/main/java/sg/edu/nus/comp/nlp/ims/implement/CTester.java
Java
gpl-3.0
15,772
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
namespace GitUI.Properties { /// <summary> /// DESIGNER USAGE INFO! /// /// This partial class helps to modify the Resources.resx using the designer AND having some custom /// code inside the designer generated Resources class. /// The only thing to do whenever the Designer is used is to add the partial class modifier in Resources.Designer.cs /// which is not generated by the designer code generator. /// /// As soon as the preprocessor if statements are no longer necessary this class can / should be removed. /// </summary> internal partial class Resources { public static System.Drawing.Bitmap loadingpanel { get { return loadingpanel_animated; } } } }
glen-nicol/gitextensions
GitUI/Properties/Resources.Custom.cs
C#
gpl-3.0
790
[ 30522, 3415, 15327, 21025, 8525, 2072, 1012, 5144, 1063, 1013, 1013, 1013, 1026, 12654, 1028, 1013, 1013, 1013, 5859, 8192, 18558, 999, 1013, 1013, 1013, 1013, 1013, 1013, 2023, 7704, 2465, 7126, 2000, 19933, 1996, 4219, 1012, 24501, 2595, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror", "../xml/xml", "../meta"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { var htmlMode = CodeMirror.getMode(cmCfg, "text/html"); var htmlModeMissing = htmlMode.name == "null" function getMode(name) { if (CodeMirror.findModeByName) { var found = CodeMirror.findModeByName(name); if (found) name = found.mime || found.mimes[0]; } var mode = CodeMirror.getMode(cmCfg, name); return mode.name == "null" ? null : mode; } // Should characters that affect highlighting be highlighted separate? // Does not include characters that will be output (such as `1.` and `-` for lists) if (modeCfg.highlightFormatting === undefined) modeCfg.highlightFormatting = false; // Maximum number of nested blockquotes. Set to 0 for infinite nesting. // Excess `>` will emit `error` token. if (modeCfg.maxBlockquoteDepth === undefined) modeCfg.maxBlockquoteDepth = 0; // Should underscores in words open/close em/strong? if (modeCfg.underscoresBreakWords === undefined) modeCfg.underscoresBreakWords = true; // Use `fencedCodeBlocks` to configure fenced code blocks. false to // disable, string to specify a precise regexp that the fence should // match, and true to allow three or more backticks or tildes (as // per CommonMark). // Turn on task lists? ("- [ ] " and "- [x] ") if (modeCfg.taskLists === undefined) modeCfg.taskLists = false; // Turn on strikethrough syntax if (modeCfg.strikethrough === undefined) modeCfg.strikethrough = false; // Allow token types to be overridden by user-provided token types. if (modeCfg.tokenTypeOverrides === undefined) modeCfg.tokenTypeOverrides = {}; var tokenTypes = { header: "header", code: "comment", quote: "quote", list1: "variable-2", list2: "variable-3", list3: "keyword", hr: "hr", image: "image", imageAltText: "image-alt-text", imageMarker: "image-marker", formatting: "formatting", linkInline: "link", linkEmail: "link", linkText: "link", linkHref: "string", em: "em", strong: "strong", strikethrough: "strikethrough" }; for (var tokenType in tokenTypes) { if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) { tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType]; } } var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/ , ulRE = /^[*\-+]\s+/ , olRE = /^[0-9]+([.)])\s+/ , taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE , atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/ , setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/ , textRE = /^[^#!\[\]*_\\<>` "'(~]+/ , fencedCodeRE = new RegExp("^(" + (modeCfg.fencedCodeBlocks === true ? "~~~+|```+" : modeCfg.fencedCodeBlocks) + ")[ \\t]*([\\w+#\-]*)"); function switchInline(stream, state, f) { state.f = state.inline = f; return f(stream, state); } function switchBlock(stream, state, f) { state.f = state.block = f; return f(stream, state); } function lineIsEmpty(line) { return !line || !/\S/.test(line.string) } // Blocks function blankLine(state) { // Reset linkTitle state state.linkTitle = false; // Reset EM state state.em = false; // Reset STRONG state state.strong = false; // Reset strikethrough state state.strikethrough = false; // Reset state.quote state.quote = 0; // Reset state.indentedCode state.indentedCode = false; if (htmlModeMissing && state.f == htmlBlock) { state.f = inlineNormal; state.block = blockNormal; } // Reset state.trailingSpace state.trailingSpace = 0; state.trailingSpaceNewLine = false; // Mark this line as blank state.prevLine = state.thisLine state.thisLine = null return null; } function blockNormal(stream, state) { var sol = stream.sol(); var prevLineIsList = state.list !== false, prevLineIsIndentedCode = state.indentedCode; state.indentedCode = false; if (prevLineIsList) { if (state.indentationDiff >= 0) { // Continued list if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block state.indentation -= state.indentationDiff; } state.list = null; } else if (state.indentation > 0) { state.list = null; } else { // No longer a list state.list = false; } } var match = null; if (state.indentationDiff >= 4) { stream.skipToEnd(); if (prevLineIsIndentedCode || lineIsEmpty(state.prevLine)) { state.indentation -= 4; state.indentedCode = true; return tokenTypes.code; } else { return null; } } else if (stream.eatSpace()) { return null; } else if ((match = stream.match(atxHeaderRE)) && match[1].length <= 6) { state.header = match[1].length; if (modeCfg.highlightFormatting) state.formatting = "header"; state.f = state.inline; return getType(state); } else if (!lineIsEmpty(state.prevLine) && !state.quote && !prevLineIsList && !prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) { state.header = match[0].charAt(0) == '=' ? 1 : 2; if (modeCfg.highlightFormatting) state.formatting = "header"; state.f = state.inline; return getType(state); } else if (stream.eat('>')) { state.quote = sol ? 1 : state.quote + 1; if (modeCfg.highlightFormatting) state.formatting = "quote"; stream.eatSpace(); return getType(state); } else if (stream.peek() === '[') { return switchInline(stream, state, footnoteLink); } else if (stream.match(hrRE, true)) { state.hr = true; return tokenTypes.hr; } else if ((lineIsEmpty(state.prevLine) || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) { var listType = null; if (stream.match(ulRE, true)) { listType = 'ul'; } else { stream.match(olRE, true); listType = 'ol'; } state.indentation = stream.column() + stream.current().length; state.list = true; // While this list item's marker's indentation // is less than the deepest list item's content's indentation, // pop the deepest list item indentation off the stack. while (state.listStack && stream.column() < state.listStack[state.listStack.length - 1]) { state.listStack.pop(); } // Add this list item's content's indentation to the stack state.listStack.push(state.indentation); if (modeCfg.taskLists && stream.match(taskListRE, false)) { state.taskList = true; } state.f = state.inline; if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType]; return getType(state); } else if (modeCfg.fencedCodeBlocks && (match = stream.match(fencedCodeRE, true))) { state.fencedChars = match[1] // try switching mode state.localMode = getMode(match[2]); if (state.localMode) state.localState = CodeMirror.startState(state.localMode); state.f = state.block = local; if (modeCfg.highlightFormatting) state.formatting = "code-block"; state.code = -1 return getType(state); } return switchInline(stream, state, state.inline); } function htmlBlock(stream, state) { var style = htmlMode.token(stream, state.htmlState); if (!htmlModeMissing) { var inner = CodeMirror.innerMode(htmlMode, state.htmlState) if ((inner.mode.name == "xml" && inner.state.tagStart === null && (!inner.state.context && inner.state.tokenize.isInText)) || (state.md_inside && stream.current().indexOf(">") > -1)) { state.f = inlineNormal; state.block = blockNormal; state.htmlState = null; } } return style; } function local(stream, state) { if (state.fencedChars && stream.match(state.fencedChars, false)) { state.localMode = state.localState = null; state.f = state.block = leavingLocal; return null; } else if (state.localMode) { return state.localMode.token(stream, state.localState); } else { stream.skipToEnd(); return tokenTypes.code; } } function leavingLocal(stream, state) { stream.match(state.fencedChars); state.block = blockNormal; state.f = inlineNormal; state.fencedChars = null; if (modeCfg.highlightFormatting) state.formatting = "code-block"; state.code = 1 var returnType = getType(state); state.code = 0 return returnType; } // Inline function getType(state) { var styles = []; if (state.formatting) { styles.push(tokenTypes.formatting); if (typeof state.formatting === "string") state.formatting = [state.formatting]; for (var i = 0; i < state.formatting.length; i++) { styles.push(tokenTypes.formatting + "-" + state.formatting[i]); if (state.formatting[i] === "header") { styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header); } // Add `formatting-quote` and `formatting-quote-#` for blockquotes // Add `error` instead if the maximum blockquote nesting depth is passed if (state.formatting[i] === "quote") { if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) { styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote); } else { styles.push("error"); } } } } if (state.taskOpen) { styles.push("meta"); return styles.length ? styles.join(' ') : null; } if (state.taskClosed) { styles.push("property"); return styles.length ? styles.join(' ') : null; } if (state.linkHref) { styles.push(tokenTypes.linkHref, "url"); } else { // Only apply inline styles to non-url text if (state.strong) { styles.push(tokenTypes.strong); } if (state.em) { styles.push(tokenTypes.em); } if (state.strikethrough) { styles.push(tokenTypes.strikethrough); } if (state.linkText) { styles.push(tokenTypes.linkText); } if (state.code) { styles.push(tokenTypes.code); } if (state.image) { styles.push(tokenTypes.image); } if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); } if (state.imageMarker) { styles.push(tokenTypes.imageMarker); } } if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); } if (state.quote) { styles.push(tokenTypes.quote); // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) { styles.push(tokenTypes.quote + "-" + state.quote); } else { styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth); } } if (state.list !== false) { var listMod = (state.listStack.length - 1) % 3; if (!listMod) { styles.push(tokenTypes.list1); } else if (listMod === 1) { styles.push(tokenTypes.list2); } else { styles.push(tokenTypes.list3); } } if (state.trailingSpaceNewLine) { styles.push("trailing-space-new-line"); } else if (state.trailingSpace) { styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b")); } return styles.length ? styles.join(' ') : null; } function handleText(stream, state) { if (stream.match(textRE, true)) { return getType(state); } return undefined; } function inlineNormal(stream, state) { var style = state.text(stream, state); if (typeof style !== 'undefined') return style; if (state.list) { // List marker (*, +, -, 1., etc) state.list = null; return getType(state); } if (state.taskList) { var taskOpen = stream.match(taskListRE, true)[1] !== "x"; if (taskOpen) state.taskOpen = true; else state.taskClosed = true; if (modeCfg.highlightFormatting) state.formatting = "task"; state.taskList = false; return getType(state); } state.taskOpen = false; state.taskClosed = false; if (state.header && stream.match(/^#+$/, true)) { if (modeCfg.highlightFormatting) state.formatting = "header"; return getType(state); } // Get sol() value now, before character is consumed var sol = stream.sol(); var ch = stream.next(); // Matches link titles present on next line if (state.linkTitle) { state.linkTitle = false; var matchCh = ch; if (ch === '(') { matchCh = ')'; } matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh; if (stream.match(new RegExp(regex), true)) { return tokenTypes.linkHref; } } // If this block is changed, it may need to be updated in GFM mode if (ch === '`') { var previousFormatting = state.formatting; if (modeCfg.highlightFormatting) state.formatting = "code"; stream.eatWhile('`'); var count = stream.current().length if (state.code == 0) { state.code = count return getType(state) } else if (count == state.code) { // Must be exact var t = getType(state) state.code = 0 return t } else { state.formatting = previousFormatting return getType(state) } } else if (state.code) { return getType(state); } if (ch === '\\') { stream.next(); if (modeCfg.highlightFormatting) { var type = getType(state); var formattingEscape = tokenTypes.formatting + "-escape"; return type ? type + " " + formattingEscape : formattingEscape; } } if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) { state.imageMarker = true; state.image = true; if (modeCfg.highlightFormatting) state.formatting = "image"; return getType(state); } if (ch === '[' && state.imageMarker) { state.imageMarker = false; state.imageAltText = true if (modeCfg.highlightFormatting) state.formatting = "image"; return getType(state); } if (ch === ']' && state.imageAltText) { if (modeCfg.highlightFormatting) state.formatting = "image"; var type = getType(state); state.imageAltText = false; state.image = false; state.inline = state.f = linkHref; return type; } if (ch === '[' && stream.match(/[^\]]*\](\(.*\)| ?\[.*?\])/, false) && !state.image) { state.linkText = true; if (modeCfg.highlightFormatting) state.formatting = "link"; return getType(state); } if (ch === ']' && state.linkText && stream.match(/\(.*?\)| ?\[.*?\]/, false)) { if (modeCfg.highlightFormatting) state.formatting = "link"; var type = getType(state); state.linkText = false; state.inline = state.f = linkHref; return type; } if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) { state.f = state.inline = linkInline; if (modeCfg.highlightFormatting) state.formatting = "link"; var type = getType(state); if (type){ type += " "; } else { type = ""; } return type + tokenTypes.linkInline; } if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) { state.f = state.inline = linkInline; if (modeCfg.highlightFormatting) state.formatting = "link"; var type = getType(state); if (type){ type += " "; } else { type = ""; } return type + tokenTypes.linkEmail; } if (ch === '<' && stream.match(/^(!--|\w)/, false)) { var end = stream.string.indexOf(">", stream.pos); if (end != -1) { var atts = stream.string.substring(stream.start, end); if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true; } stream.backUp(1); state.htmlState = CodeMirror.startState(htmlMode); return switchBlock(stream, state, htmlBlock); } if (ch === '<' && stream.match(/^\/\w*?>/)) { state.md_inside = false; return "tag"; } var ignoreUnderscore = false; if (!modeCfg.underscoresBreakWords) { if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) { var prevPos = stream.pos - 2; if (prevPos >= 0) { var prevCh = stream.string.charAt(prevPos); if (prevCh !== '_' && prevCh.match(/(\w)/, false)) { ignoreUnderscore = true; } } } } if (ch === '*' || (ch === '_' && !ignoreUnderscore)) { if (sol && stream.peek() === ' ') { // Do nothing, surrounded by newline and space } else if (state.strong === ch && stream.eat(ch)) { // Remove STRONG if (modeCfg.highlightFormatting) state.formatting = "strong"; var t = getType(state); state.strong = false; return t; } else if (!state.strong && stream.eat(ch)) { // Add STRONG state.strong = ch; if (modeCfg.highlightFormatting) state.formatting = "strong"; return getType(state); } else if (state.em === ch) { // Remove EM if (modeCfg.highlightFormatting) state.formatting = "em"; var t = getType(state); state.em = false; return t; } else if (!state.em) { // Add EM state.em = ch; if (modeCfg.highlightFormatting) state.formatting = "em"; return getType(state); } } else if (ch === ' ') { if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces if (stream.peek() === ' ') { // Surrounded by spaces, ignore return getType(state); } else { // Not surrounded by spaces, back up pointer stream.backUp(1); } } } if (modeCfg.strikethrough) { if (ch === '~' && stream.eatWhile(ch)) { if (state.strikethrough) {// Remove strikethrough if (modeCfg.highlightFormatting) state.formatting = "strikethrough"; var t = getType(state); state.strikethrough = false; return t; } else if (stream.match(/^[^\s]/, false)) {// Add strikethrough state.strikethrough = true; if (modeCfg.highlightFormatting) state.formatting = "strikethrough"; return getType(state); } } else if (ch === ' ') { if (stream.match(/^~~/, true)) { // Probably surrounded by space if (stream.peek() === ' ') { // Surrounded by spaces, ignore return getType(state); } else { // Not surrounded by spaces, back up pointer stream.backUp(2); } } } } if (ch === ' ') { if (stream.match(/ +$/, false)) { state.trailingSpace++; } else if (state.trailingSpace) { state.trailingSpaceNewLine = true; } } return getType(state); } function linkInline(stream, state) { var ch = stream.next(); if (ch === ">") { state.f = state.inline = inlineNormal; if (modeCfg.highlightFormatting) state.formatting = "link"; var type = getType(state); if (type){ type += " "; } else { type = ""; } return type + tokenTypes.linkInline; } stream.match(/^[^>]+/, true); return tokenTypes.linkInline; } function linkHref(stream, state) { // Check if space, and return NULL if so (to avoid marking the space) if(stream.eatSpace()){ return null; } var ch = stream.next(); if (ch === '(' || ch === '[') { state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]", 0); if (modeCfg.highlightFormatting) state.formatting = "link-string"; state.linkHref = true; return getType(state); } return 'error'; } var linkRE = { ")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/, "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/ } function getLinkHrefInside(endChar) { return function(stream, state) { var ch = stream.next(); if (ch === endChar) { state.f = state.inline = inlineNormal; if (modeCfg.highlightFormatting) state.formatting = "link-string"; var returnState = getType(state); state.linkHref = false; return returnState; } stream.match(linkRE[endChar]) state.linkHref = true; return getType(state); }; } function footnoteLink(stream, state) { if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) { state.f = footnoteLinkInside; stream.next(); // Consume [ if (modeCfg.highlightFormatting) state.formatting = "link"; state.linkText = true; return getType(state); } return switchInline(stream, state, inlineNormal); } function footnoteLinkInside(stream, state) { if (stream.match(/^\]:/, true)) { state.f = state.inline = footnoteUrl; if (modeCfg.highlightFormatting) state.formatting = "link"; var returnType = getType(state); state.linkText = false; return returnType; } stream.match(/^([^\]\\]|\\.)+/, true); return tokenTypes.linkText; } function footnoteUrl(stream, state) { // Check if space, and return NULL if so (to avoid marking the space) if(stream.eatSpace()){ return null; } // Match URL stream.match(/^[^\s]+/, true); // Check for link title if (stream.peek() === undefined) { // End of line, set flag to check next line state.linkTitle = true; } else { // More content on line, check if link title stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true); } state.f = state.inline = inlineNormal; return tokenTypes.linkHref + " url"; } var mode = { startState: function() { return { f: blockNormal, prevLine: null, thisLine: null, block: blockNormal, htmlState: null, indentation: 0, inline: inlineNormal, text: handleText, formatting: false, linkText: false, linkHref: false, linkTitle: false, code: 0, em: false, strong: false, header: 0, hr: false, taskList: false, list: false, listStack: [], quote: 0, trailingSpace: 0, trailingSpaceNewLine: false, strikethrough: false, fencedChars: null }; }, copyState: function(s) { return { f: s.f, prevLine: s.prevLine, thisLine: s.thisLine, block: s.block, htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState), indentation: s.indentation, localMode: s.localMode, localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null, inline: s.inline, text: s.text, formatting: false, linkTitle: s.linkTitle, code: s.code, em: s.em, strong: s.strong, strikethrough: s.strikethrough, header: s.header, hr: s.hr, taskList: s.taskList, list: s.list, listStack: s.listStack.slice(0), quote: s.quote, indentedCode: s.indentedCode, trailingSpace: s.trailingSpace, trailingSpaceNewLine: s.trailingSpaceNewLine, md_inside: s.md_inside, fencedChars: s.fencedChars }; }, token: function(stream, state) { // Reset state.formatting state.formatting = false; if (stream != state.thisLine) { var forceBlankLine = state.header || state.hr; // Reset state.header and state.hr state.header = 0; state.hr = false; if (stream.match(/^\s*$/, true) || forceBlankLine) { blankLine(state); if (!forceBlankLine) return null state.prevLine = null } state.prevLine = state.thisLine state.thisLine = stream // Reset state.taskList state.taskList = false; // Reset state.trailingSpace state.trailingSpace = 0; state.trailingSpaceNewLine = false; state.f = state.block; var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length; state.indentationDiff = Math.min(indentation - state.indentation, 4); state.indentation = state.indentation + state.indentationDiff; if (indentation > 0) return null; } return state.f(stream, state); }, innerMode: function(state) { if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode}; if (state.localState) return {state: state.localState, mode: state.localMode}; return {state: state, mode: mode}; }, blankLine: blankLine, getType: getType, fold: "markdown" }; return mode; }, "xml"); CodeMirror.defineMIME("text/x-markdown", "markdown"); });
leungwensen/d2recharts
dist/lib/codemirror-5.18.2/mode/markdown/markdown.js
JavaScript
mit
26,589
[ 30522, 1013, 1013, 3642, 14503, 29165, 1010, 9385, 1006, 1039, 1007, 2011, 16266, 22895, 2031, 15185, 23941, 1998, 2500, 1013, 1013, 5500, 2104, 2019, 10210, 6105, 1024, 8299, 1024, 1013, 1013, 3642, 14503, 29165, 1012, 5658, 1013, 6105, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.timepedia.chronoscope.client.event; import org.timepedia.chronoscope.client.XYPlot; import org.timepedia.exporter.client.Export; import org.timepedia.exporter.client.ExportPackage; import org.timepedia.exporter.client.Exportable; /** * Fired by plot implementations when click occurs on chart which is not handled * by a marker or by a focus-on-point click event. */ @ExportPackage("chronoscope") public class ChartClickEvent extends PlotEvent<ChartClickHandler> implements Exportable { public static Type<ChartClickHandler> TYPE = new Type<ChartClickHandler>(); private int x; @Export /** * X coordinate of click event relative to left border of plot area. */ public double getX() { return x - getPlot().getBounds().x; } /** * Y coordinate of click event relative to top border of plot area. */ @Export public double getY() { return y - getPlot().getBounds().y; } private int y; public ChartClickEvent(XYPlot plot, int x, int y) { super(plot); this.x = x; this.y = y; } public Type getAssociatedType() { return TYPE; } protected void dispatch(ChartClickHandler chartClickHandler) { chartClickHandler.onChartClick(this); } }
KunjanSharma/gwt-chronoscope
chronoscope-api/src/main/java/org/timepedia/chronoscope/client/event/ChartClickEvent.java
Java
lgpl-2.1
1,231
[ 30522, 7427, 8917, 1012, 2051, 5669, 2401, 1012, 10381, 4948, 2891, 16186, 1012, 7396, 1012, 2724, 1025, 12324, 8917, 1012, 2051, 5669, 2401, 1012, 10381, 4948, 2891, 16186, 1012, 7396, 1012, 1060, 22571, 10994, 1025, 12324, 8917, 1012, 205...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
class Dorsale::BillingMachine::PdfFileGenerator < Dorsale::Service attr_reader :document def initialize(document) @document = document # I have no idea why I need to do that, # if I don't do that, CarrierWare do not stores the file. # The reload() method don't work either. # The problem appears only on server, not in console. # I think CarrierWave do not work anymore after first save. @document = document.class.find(document.id) if document.persisted? end def call document.pdf_file = file document.save! if document.persisted? document end private def pdf_klass if document.is_a?(::Dorsale::BillingMachine::Invoice) return ::Dorsale::BillingMachine.invoice_pdf_model end if document.is_a?(::Dorsale::BillingMachine::Quotation) return ::Dorsale::BillingMachine.quotation_pdf_model end end def pdf_data @pdf_data ||= pdf_klass.new(document).tap(&:build).render_with_attachments end def file @file ||= StringIO.new(pdf_data) end class StringIO < ::StringIO def original_filename @original_filename ||= "#{SecureRandom.uuid}.pdf" end end end
agilidee/dorsale
app/services/dorsale/billing_machine/pdf_file_generator.rb
Ruby
mit
1,170
[ 30522, 2465, 12759, 2063, 1024, 1024, 25640, 22911, 14014, 1024, 1024, 11135, 8873, 23115, 24454, 8844, 1026, 12759, 2063, 1024, 1024, 2326, 2012, 16344, 1035, 8068, 1024, 6254, 13366, 3988, 4697, 1006, 6254, 1007, 1030, 6254, 1027, 6254, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<? defined('C5_EXECUTE') or die("Access Denied."); /** * @package Workflow * @author Andrew Embler <andrew@concrete5.org> * @copyright Copyright (c) 2003-2012 concrete5. (http://www.concrete5.org) * @license http://www.concrete5.org/license/ MIT License * */ class ChangePagePermissionsPageWorkflowRequest extends Concrete5_Model_ChangePagePermissionsPageWorkflowRequest {}
mrogelja/website-concrete5
concrete/models/workflow/request/requests/change_page_permissions.php
PHP
mit
389
[ 30522, 1026, 1029, 4225, 1006, 1005, 1039, 2629, 1035, 15389, 1005, 1007, 2030, 3280, 1006, 1000, 3229, 6380, 1012, 1000, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 7427, 2147, 12314, 1008, 1030, 3166, 4080, 7861, 16213, 1026, 4080, 1030, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("07-SelectionSort")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("07-SelectionSort")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("915d8f05-e65f-4292-ba32-dae9b5e36e6e")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
svetlai/TelerikAcademy
Programming-with-C#/C#-Part-2/01-Arrays/07-SelectionSort/Properties/AssemblyInfo.cs
C#
mit
1,408
[ 30522, 2478, 2291, 1012, 9185, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 21624, 8043, 7903, 2229, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 6970, 11923, 2121, 7903, 2229, 1025, 1013, 1013, 2236, 2592, 2055, 2019, 3320, 2003, 4758, 2083, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2006 The Closure Compiler Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.javascript.jscomp; import static com.google.javascript.jscomp.ProcessClosurePrimitives.BASE_CLASS_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.CLASS_NAMESPACE_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.CLOSURE_DEFINES_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.DUPLICATE_NAMESPACE_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.EXPECTED_OBJECTLIT_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.FUNCTION_NAMESPACE_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.GOOG_BASE_CLASS_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.INVALID_ARGUMENT_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.INVALID_CLOSURE_CALL_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.INVALID_CSS_RENAMING_MAP; import static com.google.javascript.jscomp.ProcessClosurePrimitives.INVALID_DEFINE_NAME_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.INVALID_PROVIDE_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.INVALID_STYLE_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.LATE_PROVIDE_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.MISSING_DEFINE_ANNOTATION; import static com.google.javascript.jscomp.ProcessClosurePrimitives.MISSING_PROVIDE_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.NON_STRING_PASSED_TO_SET_CSS_NAME_MAPPING_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.NULL_ARGUMENT_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.TOO_MANY_ARGUMENTS_ERROR; import static com.google.javascript.jscomp.ProcessClosurePrimitives.WEAK_NAMESPACE_TYPE; import static com.google.javascript.jscomp.ProcessClosurePrimitives.XMODULE_REQUIRE_ERROR; import com.google.javascript.jscomp.CompilerOptions.LanguageMode; import com.google.javascript.rhino.Node; /** * Tests for {@link ProcessClosurePrimitives}. * */ public final class ProcessClosurePrimitivesTest extends Es6CompilerTestCase { private String additionalCode; private String additionalEndCode; private boolean addAdditionalNamespace; private boolean preserveGoogRequires; private boolean banGoogBase; public ProcessClosurePrimitivesTest() { enableLineNumberCheck(true); } @Override protected void setUp() { additionalCode = null; additionalEndCode = null; addAdditionalNamespace = false; preserveGoogRequires = false; banGoogBase = false; compareJsDoc = false; } @Override protected CompilerOptions getOptions() { CompilerOptions options = super.getOptions(); if (banGoogBase) { options.setWarningLevel( DiagnosticGroups.USE_OF_GOOG_BASE, CheckLevel.ERROR); } return options; } @Override public CompilerPass getProcessor(final Compiler compiler) { if ((additionalCode == null) && (additionalEndCode == null)) { return new ProcessClosurePrimitives( compiler, null, CheckLevel.ERROR, preserveGoogRequires); } else { return new CompilerPass() { @Override public void process(Node externs, Node root) { // Process the original code. new ProcessClosurePrimitives( compiler, null, CheckLevel.OFF, preserveGoogRequires) .process(externs, root); // Inject additional code at the beginning. if (additionalCode != null) { SourceFile file = SourceFile.fromCode("additionalcode", additionalCode); Node scriptNode = root.getFirstChild(); Node newScriptNode = new CompilerInput(file).getAstRoot(compiler); if (addAdditionalNamespace) { newScriptNode.getFirstChild() .putBooleanProp(Node.IS_NAMESPACE, true); } while (newScriptNode.getLastChild() != null) { Node lastChild = newScriptNode.getLastChild(); newScriptNode.removeChild(lastChild); scriptNode.addChildBefore(lastChild, scriptNode.getFirstChild()); } } // Inject additional code at the end. if (additionalEndCode != null) { SourceFile file = SourceFile.fromCode("additionalendcode", additionalEndCode); Node scriptNode = root.getFirstChild(); Node newScriptNode = new CompilerInput(file).getAstRoot(compiler); if (addAdditionalNamespace) { newScriptNode.getFirstChild() .putBooleanProp(Node.IS_NAMESPACE, true); } while (newScriptNode.getFirstChild() != null) { Node firstChild = newScriptNode.getFirstChild(); newScriptNode.removeChild(firstChild); scriptNode.addChildToBack(firstChild); } } // Process the tree a second time. new ProcessClosurePrimitives( compiler, null, CheckLevel.ERROR, preserveGoogRequires) .process(externs, root); } }; } } @Override public int getNumRepetitions() { return 1; } public void testSimpleProvides() { test("goog.provide('foo');", "var foo={};"); test("goog.provide('foo.bar');", "var foo={}; foo.bar={};"); test("goog.provide('foo.bar.baz');", "var foo={}; foo.bar={}; foo.bar.baz={};"); test("goog.provide('foo.bar.baz.boo');", "var foo={}; foo.bar={}; foo.bar.baz={}; foo.bar.baz.boo={};"); test("goog.provide('goog.bar');", "goog.bar={};"); // goog is special-cased } public void testMultipleProvides() { test("goog.provide('foo.bar'); goog.provide('foo.baz');", "var foo={}; foo.bar={}; foo.baz={};"); test("goog.provide('foo.bar.baz'); goog.provide('foo.boo.foo');", "var foo={}; foo.bar={}; foo.bar.baz={}; foo.boo={}; foo.boo.foo={};"); test("goog.provide('foo.bar.baz'); goog.provide('foo.bar.boo');", "var foo={}; foo.bar={}; foo.bar.baz={}; foo.bar.boo={};"); test("goog.provide('foo.bar.baz'); goog.provide('goog.bar.boo');", "var foo={}; foo.bar={}; foo.bar.baz={}; goog.bar={}; " + "goog.bar.boo={};"); } public void testRemovalOfProvidedObjLit() { test("goog.provide('foo'); foo = 0;", "var foo = 0;"); test("goog.provide('foo'); foo = {a: 0};", "var foo = {a: 0};"); test("goog.provide('foo'); foo = function(){};", "var foo = function(){};"); test("goog.provide('foo'); var foo = 0;", "var foo = 0;"); test("goog.provide('foo'); var foo = {a: 0};", "var foo = {a: 0};"); test("goog.provide('foo'); var foo = function(){};", "var foo = function(){};"); test("goog.provide('foo.bar.Baz'); foo.bar.Baz=function(){};", "var foo={}; foo.bar={}; foo.bar.Baz=function(){};"); test("goog.provide('foo.bar.moo'); foo.bar.moo={E:1,S:2};", "var foo={}; foo.bar={}; foo.bar.moo={E:1,S:2};"); test("goog.provide('foo.bar.moo'); foo.bar.moo={E:1}; foo.bar.moo={E:2};", "var foo={}; foo.bar={}; foo.bar.moo={E:1}; foo.bar.moo={E:2};"); testEs6("goog.provide('foo'); var foo = class {}", "var foo = class {}"); } public void testProvidedDeclaredFunctionError() { testError("goog.provide('foo'); function foo(){}", FUNCTION_NAMESPACE_ERROR); } public void testProvidedDeclaredClassError() { testErrorEs6("goog.provide('foo'); class foo {}", CLASS_NAMESPACE_ERROR); } public void testRemovalMultipleAssignment1() { test("goog.provide('foo'); foo = 0; foo = 1", "var foo = 0; foo = 1;"); } public void testRemovalMultipleAssignment2() { test("goog.provide('foo'); var foo = 0; foo = 1", "var foo = 0; foo = 1;"); } public void testRemovalMultipleAssignment3() { test("goog.provide('foo'); foo = 0; var foo = 1", "foo = 0; var foo = 1;"); } public void testRemovalMultipleAssignment4() { test("goog.provide('foo.bar'); foo.bar = 0; foo.bar = 1", "var foo = {}; foo.bar = 0; foo.bar = 1"); } public void testNoRemovalFunction1() { test("goog.provide('foo'); function f(){foo = 0}", "var foo = {}; function f(){foo = 0}"); } public void testNoRemovalFunction2() { test("goog.provide('foo'); function f(){var foo = 0}", "var foo = {}; function f(){var foo = 0}"); } public void testRemovalMultipleAssignmentInIf1() { test("goog.provide('foo'); if (true) { var foo = 0 } else { foo = 1 }", "if (true) { var foo = 0 } else { foo = 1 }"); } public void testRemovalMultipleAssignmentInIf2() { test("goog.provide('foo'); if (true) { foo = 0 } else { var foo = 1 }", "if (true) { foo = 0 } else { var foo = 1 }"); } public void testRemovalMultipleAssignmentInIf3() { test("goog.provide('foo'); if (true) { foo = 0 } else { foo = 1 }", "if (true) { var foo = 0 } else { foo = 1 }"); } public void testRemovalMultipleAssignmentInIf4() { test("goog.provide('foo.bar');" + "if (true) { foo.bar = 0 } else { foo.bar = 1 }", "var foo = {}; if (true) { foo.bar = 0 } else { foo.bar = 1 }"); } public void testMultipleDeclarationError1() { String rest = "if (true) { foo.bar = 0 } else { foo.bar = 1 }"; test("goog.provide('foo.bar');" + "var foo = {};" + rest, "var foo = {};" + "var foo = {};" + rest); } public void testMultipleDeclarationError2() { test( LINE_JOINER.join( "goog.provide('foo.bar');", "if (true) { var foo = {}; foo.bar = 0 } else { foo.bar = 1 }"), LINE_JOINER.join( "var foo = {};", "if (true) {", " var foo = {}; foo.bar = 0", "} else {", " foo.bar = 1", "}")); } public void testMultipleDeclarationError3() { test( LINE_JOINER.join( "goog.provide('foo.bar');", "if (true) { foo.bar = 0 } else { var foo = {}; foo.bar = 1 }"), LINE_JOINER.join( "var foo = {};", "if (true) {", " foo.bar = 0", "} else {", " var foo = {}; foo.bar = 1", "}")); } public void testProvideAfterDeclarationError() { test("var x = 42; goog.provide('x');", "var x = 42; var x = {}"); } public void testProvideErrorCases() { testError("goog.provide();", NULL_ARGUMENT_ERROR); testError("goog.provide(5);", INVALID_ARGUMENT_ERROR); testError("goog.provide([]);", INVALID_ARGUMENT_ERROR); testError("goog.provide({});", INVALID_ARGUMENT_ERROR); testError("goog.provide('foo', 'bar');", TOO_MANY_ARGUMENTS_ERROR); testError("goog.provide('foo'); goog.provide('foo');", DUPLICATE_NAMESPACE_ERROR); testError("goog.provide('foo.bar'); goog.provide('foo'); goog.provide('foo');", DUPLICATE_NAMESPACE_ERROR); testErrorEs6("goog.provide(`template`);", INVALID_ARGUMENT_ERROR); testErrorEs6("goog.provide(tagged`template`);", INVALID_ARGUMENT_ERROR); testErrorEs6("goog.provide(`${template}Sub`);", INVALID_ARGUMENT_ERROR); } public void testProvideErrorCases2() { test("goog.provide('foo'); /** @type {Object} */ var foo = {};", "var foo={};", null, WEAK_NAMESPACE_TYPE); test("goog.provide('foo'); /** @type {!Object} */ var foo = {};", "var foo={};", null, WEAK_NAMESPACE_TYPE); test("goog.provide('foo.bar'); /** @type {Object} */ foo.bar = {};", "var foo={};foo.bar={};", null, WEAK_NAMESPACE_TYPE); test("goog.provide('foo.bar'); /** @type {!Object} */ foo.bar = {};", "var foo={};foo.bar={};", null, WEAK_NAMESPACE_TYPE); test("goog.provide('foo'); /** @type {Object.<string>} */ var foo = {};", "var foo={};"); } public void testProvideValidObjectType() { test("goog.provide('foo'); /** @type {Object.<string>} */ var foo = {};", "var foo={};"); } public void testRemovalOfRequires() { test("goog.provide('foo'); goog.require('foo');", "var foo={};"); test("goog.provide('foo.bar'); goog.require('foo.bar');", "var foo={}; foo.bar={};"); test("goog.provide('foo.bar.baz'); goog.require('foo.bar.baz');", "var foo={}; foo.bar={}; foo.bar.baz={};"); test("goog.provide('foo'); var x = 3; goog.require('foo'); something();", "var foo={}; var x = 3; something();"); testSame("foo.require('foo.bar');"); } public void testPreserveGoogRequires() { preserveGoogRequires = true; test("goog.provide('foo'); goog.require('foo');", "var foo={}; goog.require('foo');"); test("goog.provide('foo'); goog.require('foo'); var a = {};", "var foo = {}; goog.require('foo'); var a = {};"); } public void testRequireErrorCases() { testError("goog.require();", NULL_ARGUMENT_ERROR); testError("goog.require(5);", INVALID_ARGUMENT_ERROR); testError("goog.require([]);", INVALID_ARGUMENT_ERROR); testError("goog.require({});", INVALID_ARGUMENT_ERROR); testErrorEs6("goog.require(`template`);", INVALID_ARGUMENT_ERROR); testErrorEs6("goog.require(tagged`template`);", INVALID_ARGUMENT_ERROR); testErrorEs6("goog.require(`${template}Sub`);", INVALID_ARGUMENT_ERROR); } public void testLateProvides() { testError("goog.require('foo'); goog.provide('foo');", LATE_PROVIDE_ERROR); testError("goog.require('foo.bar'); goog.provide('foo.bar');", LATE_PROVIDE_ERROR); testError("goog.provide('foo.bar'); goog.require('foo'); goog.provide('foo');", LATE_PROVIDE_ERROR); } public void testMissingProvides() { testError("goog.require('foo');", MISSING_PROVIDE_ERROR); testError("goog.provide('foo'); goog.require('Foo');", MISSING_PROVIDE_ERROR); testError("goog.provide('foo'); goog.require('foo.bar');", MISSING_PROVIDE_ERROR); testError("goog.provide('foo'); var EXPERIMENT_FOO = true; " + "if (EXPERIMENT_FOO) {goog.require('foo.bar');}", MISSING_PROVIDE_ERROR); } public void testAddDependency() { test("goog.addDependency('x.js', ['A', 'B'], []);", "0"); Compiler compiler = getLastCompiler(); assertTrue(compiler.getTypeRegistry().isForwardDeclaredType("A")); assertTrue(compiler.getTypeRegistry().isForwardDeclaredType("B")); assertFalse(compiler.getTypeRegistry().isForwardDeclaredType("C")); } public void testForwardDeclarations() { test("goog.forwardDeclare('A.B')", ""); Compiler compiler = getLastCompiler(); assertTrue(compiler.getTypeRegistry().isForwardDeclaredType("A.B")); assertFalse(compiler.getTypeRegistry().isForwardDeclaredType("C.D")); testError("goog.forwardDeclare();", ProcessClosurePrimitives.INVALID_FORWARD_DECLARE); testError("goog.forwardDeclare('A.B', 'C.D');", ProcessClosurePrimitives.INVALID_FORWARD_DECLARE); testErrorEs6("goog.forwardDeclare(`template`);", ProcessClosurePrimitives.INVALID_FORWARD_DECLARE); testErrorEs6("goog.forwardDeclare(`${template}Sub`);", ProcessClosurePrimitives.INVALID_FORWARD_DECLARE); } public void testValidSetCssNameMapping() { test("goog.setCssNameMapping({foo:'bar',\"biz\":'baz'});", ""); CssRenamingMap map = getLastCompiler().getCssRenamingMap(); assertNotNull(map); assertEquals("bar", map.get("foo")); assertEquals("baz", map.get("biz")); } public void testValidSetCssNameMappingWithType() { test("goog.setCssNameMapping({foo:'bar',\"biz\":'baz'}, 'BY_PART');", ""); CssRenamingMap map = getLastCompiler().getCssRenamingMap(); assertNotNull(map); assertEquals("bar", map.get("foo")); assertEquals("baz", map.get("biz")); test("goog.setCssNameMapping({foo:'bar',biz:'baz','biz-foo':'baz-bar'}," + " 'BY_WHOLE');", ""); map = getLastCompiler().getCssRenamingMap(); assertNotNull(map); assertEquals("bar", map.get("foo")); assertEquals("baz", map.get("biz")); assertEquals("baz-bar", map.get("biz-foo")); } public void testSetCssNameMappingByShortHand() { testErrorEs6("goog.setCssNameMapping({shortHandFirst, shortHandSecond});", NON_STRING_PASSED_TO_SET_CSS_NAME_MAPPING_ERROR); } public void testSetCssNameMappingByTemplate() { testErrorEs6("goog.setCssNameMapping({foo: `bar`});", NON_STRING_PASSED_TO_SET_CSS_NAME_MAPPING_ERROR); testErrorEs6("goog.setCssNameMapping({foo: `${vari}bar`});", NON_STRING_PASSED_TO_SET_CSS_NAME_MAPPING_ERROR); } public void testSetCssNameMappingNonStringValueReturnsError() { // Make sure the argument is an object literal. testError("var BAR = {foo:'bar'}; goog.setCssNameMapping(BAR);", EXPECTED_OBJECTLIT_ERROR); testError("goog.setCssNameMapping([]);", EXPECTED_OBJECTLIT_ERROR); testError("goog.setCssNameMapping(false);", EXPECTED_OBJECTLIT_ERROR); testError("goog.setCssNameMapping(null);", EXPECTED_OBJECTLIT_ERROR); testError("goog.setCssNameMapping(undefined);", EXPECTED_OBJECTLIT_ERROR); // Make sure all values of the object literal are string literals. testError("var BAR = 'bar'; goog.setCssNameMapping({foo:BAR});", NON_STRING_PASSED_TO_SET_CSS_NAME_MAPPING_ERROR); testError("goog.setCssNameMapping({foo:6});", NON_STRING_PASSED_TO_SET_CSS_NAME_MAPPING_ERROR); testError("goog.setCssNameMapping({foo:false});", NON_STRING_PASSED_TO_SET_CSS_NAME_MAPPING_ERROR); testError("goog.setCssNameMapping({foo:null});", NON_STRING_PASSED_TO_SET_CSS_NAME_MAPPING_ERROR); testError("goog.setCssNameMapping({foo:undefined});", NON_STRING_PASSED_TO_SET_CSS_NAME_MAPPING_ERROR); } public void testSetCssNameMappingValidity() { // Make sure that the keys don't have -'s test("goog.setCssNameMapping({'a': 'b', 'a-a': 'c'})", "", null, INVALID_CSS_RENAMING_MAP); // In full mode, we check that map(a-b)=map(a)-map(b) test("goog.setCssNameMapping({'a': 'b', 'a-a': 'c'}, 'BY_WHOLE')", "", null, INVALID_CSS_RENAMING_MAP); // Unknown mapping type testError("goog.setCssNameMapping({foo:'bar'}, 'UNKNOWN');", INVALID_STYLE_ERROR); } public void testBadCrossModuleRequire() { test( createModuleStar( "", "goog.provide('goog.ui');", "goog.require('goog.ui');"), new String[] { "", "goog.ui = {};", "" }, null, XMODULE_REQUIRE_ERROR); } public void testGoodCrossModuleRequire1() { test( createModuleStar( "goog.provide('goog.ui');", "", "goog.require('goog.ui');"), new String[] { "goog.ui = {};", "", "", }); } public void testGoodCrossModuleRequire2() { test( createModuleStar( "", "", "goog.provide('goog.ui'); goog.require('goog.ui');"), new String[] { "", "", "goog.ui = {};", }); } // Tests providing additional code with non-overlapping var namespace. public void testSimpleAdditionalProvide() { additionalCode = "goog.provide('b.B'); b.B = {};"; test("goog.provide('a.A'); a.A = {};", "var b={};b.B={};var a={};a.A={};"); } // Same as above, but with the additional code added after the original. public void testSimpleAdditionalProvideAtEnd() { additionalEndCode = "goog.provide('b.B'); b.B = {};"; test("goog.provide('a.A'); a.A = {};", "var a={};a.A={};var b={};b.B={};"); } // Tests providing additional code with non-overlapping dotted namespace. public void testSimpleDottedAdditionalProvide() { additionalCode = "goog.provide('a.b.B'); a.b.B = {};"; test("goog.provide('c.d.D'); c.d.D = {};", "var a={};a.b={};a.b.B={};var c={};c.d={};c.d.D={};"); } // Tests providing additional code with overlapping var namespace. public void testOverlappingAdditionalProvide() { additionalCode = "goog.provide('a.B'); a.B = {};"; test("goog.provide('a.A'); a.A = {};", "var a={};a.B={};a.A={};"); } // Tests providing additional code with overlapping var namespace. public void testOverlappingAdditionalProvideAtEnd() { additionalEndCode = "goog.provide('a.B'); a.B = {};"; test("goog.provide('a.A'); a.A = {};", "var a={};a.A={};a.B={};"); } // Tests providing additional code with overlapping dotted namespace. public void testOverlappingDottedAdditionalProvide() { additionalCode = "goog.provide('a.b.B'); a.b.B = {};"; test("goog.provide('a.b.C'); a.b.C = {};", "var a={};a.b={};a.b.B={};a.b.C={};"); } // Tests that a require of additional code generates no error. public void testRequireOfAdditionalProvide() { additionalCode = "goog.provide('b.B'); b.B = {};"; test("goog.require('b.B'); goog.provide('a.A'); a.A = {};", "var b={};b.B={};var a={};a.A={};"); } // Tests that a require not in additional code generates (only) one error. public void testMissingRequireWithAdditionalProvide() { additionalCode = "goog.provide('b.B'); b.B = {};"; testError("goog.require('b.C'); goog.provide('a.A'); a.A = {};", MISSING_PROVIDE_ERROR); } // Tests that a require in additional code generates no error. public void testLateRequire() { additionalEndCode = "goog.require('a.A');"; test("goog.provide('a.A'); a.A = {};", "var a={};a.A={};"); } // Tests a case where code is reordered after processing provides and then // provides are processed again. public void testReorderedProvides() { additionalCode = "a.B = {};"; // as if a.B was after a.A originally addAdditionalNamespace = true; test("goog.provide('a.A'); a.A = {};", "var a={};a.B={};a.A={};"); } // Another version of above. public void testReorderedProvides2() { additionalEndCode = "a.B = {};"; addAdditionalNamespace = true; test("goog.provide('a.A'); a.A = {};", "var a={};a.A={};a.B={};"); } // Provide a name before the definition of the class providing the // parent namespace. public void testProvideOrder1() { additionalEndCode = ""; addAdditionalNamespace = false; // TODO(johnlenz): This test confirms that the constructor (a.b) isn't // improperly removed, but this result isn't really what we want as the // reassign of a.b removes the definition of "a.b.c". test( LINE_JOINER.join( "goog.provide('a.b');", "goog.provide('a.b.c');", "a.b.c;", "a.b = function(x,y) {};"), LINE_JOINER.join( "var a = {};", "a.b = {};", "a.b.c = {};", "a.b.c;", "a.b = function(x,y) {};")); } // Provide a name after the definition of the class providing the // parent namespace. public void testProvideOrder2() { additionalEndCode = ""; addAdditionalNamespace = false; // TODO(johnlenz): This test confirms that the constructor (a.b) isn't // improperly removed, but this result isn't really what we want as // namespace placeholders for a.b and a.b.c remain. test( LINE_JOINER.join( "goog.provide('a.b');", "goog.provide('a.b.c');", "a.b = function(x,y) {};", "a.b.c;"), LINE_JOINER.join( "var a = {};", "a.b = {};", "a.b.c = {};", "a.b = function(x,y) {};", "a.b.c;")); } // Provide a name after the definition of the class providing the // parent namespace. public void testProvideOrder3a() { test( LINE_JOINER.join( "goog.provide('a.b');", "a.b = function(x,y) {};", "goog.provide('a.b.c');", "a.b.c;"), LINE_JOINER.join( "var a = {};", "a.b = function(x,y) {};", "a.b.c = {};", "a.b.c;")); } public void testProvideOrder3b() { additionalEndCode = ""; addAdditionalNamespace = false; // This tests a cleanly provided name, below a function namespace. test( LINE_JOINER.join( "goog.provide('a.b');", "a.b = function(x,y) {};", "goog.provide('a.b.c');", "a.b.c;"), LINE_JOINER.join( "var a = {};", "a.b = function(x,y) {};", "a.b.c = {};", "a.b.c;")); } public void testProvideOrder4a() { test( LINE_JOINER.join( "goog.provide('goog.a');", "goog.provide('goog.a.b');", "if (x) {", " goog.a.b = 1;", "} else {", " goog.a.b = 2;", "}"), LINE_JOINER.join( "goog.a={};", "if(x)", " goog.a.b=1;", "else", " goog.a.b=2;")); } public void testProvideOrder4b() { additionalEndCode = ""; addAdditionalNamespace = false; // This tests a cleanly provided name, below a namespace. test( LINE_JOINER.join( "goog.provide('goog.a');", "goog.provide('goog.a.b');", "if (x) {", " goog.a.b = 1;", "} else {", " goog.a.b = 2;", "}"), LINE_JOINER.join( "goog.a={};", "if(x)", " goog.a.b=1;", "else", " goog.a.b=2;")); } public void testInvalidProvide() { test("goog.provide('a.class');", "var a = {}; a.class = {};"); testError("goog.provide('class.a');", INVALID_PROVIDE_ERROR); testError("goog.provide('a.class');", INVALID_PROVIDE_ERROR, LanguageMode.ECMASCRIPT3); testError("goog.provide('class.a');", INVALID_PROVIDE_ERROR, LanguageMode.ECMASCRIPT3); } public void testInvalidRequire() { test("goog.provide('a.b'); goog.require('a.b');", "var a = {}; a.b = {};"); testError("goog.provide('a.b'); var x = x || goog.require('a.b');", INVALID_CLOSURE_CALL_ERROR); testError("goog.provide('a.b'); x = goog.require('a.b');", INVALID_CLOSURE_CALL_ERROR); testError("goog.provide('a.b'); function f() { goog.require('a.b'); }", INVALID_CLOSURE_CALL_ERROR); } public void testValidGoogMethod() { testSame("function f() { goog.isDef('a.b'); }"); testSame("function f() { goog.inherits(a, b); }"); testSame("function f() { goog.exportSymbol(a, b); }"); test("function f() { goog.setCssNameMapping({}); }", "function f() {}"); testSame("x || goog.isDef('a.b');"); testSame("x || goog.inherits(a, b);"); testSame("x || goog.exportSymbol(a, b);"); testSame("x || void 0"); } private static final String METHOD_FORMAT = "function Foo() {} Foo.prototype.method = function() { %s };"; private static final String FOO_INHERITS = "goog.inherits(Foo, BaseFoo);"; public void testInvalidGoogBase1() { testError("goog.base(this, 'method');", GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase2() { testError("function Foo() {}" + "Foo.method = function() {" + " goog.base(this, 'method');" + "};", GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase3() { testError(String.format(METHOD_FORMAT, "goog.base();"), GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase4() { testError(String.format(METHOD_FORMAT, "goog.base(this, 'bar');"), GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase5() { testError(String.format(METHOD_FORMAT, "goog.base('foo', 'method');"), GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase6() { testError(String.format(METHOD_FORMAT, "goog.base.call(null, this, 'method');"), GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase6b() { testError(String.format(METHOD_FORMAT, "goog.base.call(this, 'method');"), GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase7() { testError("function Foo() { goog.base(this); }", GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase8() { testError("var Foo = function() { goog.base(this); }", GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase9() { testError("var goog = {}; goog.Foo = function() { goog.base(this); }", GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase10() { testErrorEs6("class Foo extends BaseFoo { constructor() { goog.base(this); } }", GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase11() { testErrorEs6("class Foo extends BaseFoo { someMethod() { goog.base(this, 'someMethod'); } }", GOOG_BASE_CLASS_ERROR); } public void testValidGoogBase1() { test(String.format(METHOD_FORMAT, "goog.base(this, 'method');"), String.format(METHOD_FORMAT, "Foo.superClass_.method.call(this)")); } public void testValidGoogBase2() { test(String.format(METHOD_FORMAT, "goog.base(this, 'method', 1, 2);"), String.format(METHOD_FORMAT, "Foo.superClass_.method.call(this, 1, 2)")); } public void testValidGoogBase3() { test(String.format(METHOD_FORMAT, "return goog.base(this, 'method');"), String.format(METHOD_FORMAT, "return Foo.superClass_.method.call(this)")); } public void testValidGoogBase4() { test("function Foo() { goog.base(this, 1, 2); }" + FOO_INHERITS, "function Foo() { BaseFoo.call(this, 1, 2); } " + FOO_INHERITS); } public void testValidGoogBase5() { test("var Foo = function() { goog.base(this, 1); };" + FOO_INHERITS, "var Foo = function() { BaseFoo.call(this, 1); }; " + FOO_INHERITS); } public void testValidGoogBase6() { test("var goog = {}; goog.Foo = function() { goog.base(this); }; " + "goog.inherits(goog.Foo, goog.BaseFoo);", "var goog = {}; goog.Foo = function() { goog.BaseFoo.call(this); }; " + "goog.inherits(goog.Foo, goog.BaseFoo);"); } public void testBanGoogBase() { banGoogBase = true; testError( "function Foo() { goog.base(this, 1, 2); }" + FOO_INHERITS, ProcessClosurePrimitives.USE_OF_GOOG_BASE); } public void testInvalidBase1() { testError( "var Foo = function() {};" + FOO_INHERITS + "Foo.base(this, 'method');", BASE_CLASS_ERROR); } public void testInvalidBase2() { testError("function Foo() {}" + FOO_INHERITS + "Foo.method = function() {" + " Foo.base(this, 'method');" + "};", BASE_CLASS_ERROR); } public void testInvalidBase3() { testError(String.format(FOO_INHERITS + METHOD_FORMAT, "Foo.base();"), BASE_CLASS_ERROR); } public void testInvalidBase4() { testError(String.format(FOO_INHERITS + METHOD_FORMAT, "Foo.base(this, 'bar');"), BASE_CLASS_ERROR); } public void testInvalidBase5() { testError(String.format(FOO_INHERITS + METHOD_FORMAT, "Foo.base('foo', 'method');"), BASE_CLASS_ERROR); } public void testInvalidBase7() { testError("function Foo() { Foo.base(this); };" + FOO_INHERITS, BASE_CLASS_ERROR); } public void testInvalidBase8() { testError("var Foo = function() { Foo.base(this); };" + FOO_INHERITS, BASE_CLASS_ERROR); } public void testInvalidBase9() { testError("var goog = {}; goog.Foo = function() { goog.Foo.base(this); };" + FOO_INHERITS, BASE_CLASS_ERROR); } public void testInvalidBase10() { testError("function Foo() { Foo.base(this); }" + FOO_INHERITS, BASE_CLASS_ERROR); } public void testInvalidBase11() { testError("function Foo() { Foo.base(this, 'method'); }" + FOO_INHERITS, BASE_CLASS_ERROR); } public void testInvalidBase12() { testError("function Foo() { Foo.base(this, 1, 2); }" + FOO_INHERITS, BASE_CLASS_ERROR); } public void testInvalidBase13() { testError( "function Bar(){ Bar.base(this, 'constructor'); }" + "goog.inherits(Bar, Goo);" + "function Foo(){ Bar.base(this, 'constructor'); }" + FOO_INHERITS, BASE_CLASS_ERROR); } public void testInvalidGoogBase14() { testErrorEs6("class Foo extends BaseFoo { constructor() { Foo.base(this); } }", GOOG_BASE_CLASS_ERROR); } public void testInvalidGoogBase14b() { testErrorEs6("class Foo extends BaseFoo { method() { Foo.base(this, 'method'); } }", GOOG_BASE_CLASS_ERROR); } public void testValidBase1() { test(FOO_INHERITS + String.format(METHOD_FORMAT, "Foo.base(this, 'method');"), FOO_INHERITS + String.format(METHOD_FORMAT, "Foo.superClass_.method.call(this)")); } public void testValidBase2() { test(FOO_INHERITS + String.format(METHOD_FORMAT, "Foo.base(this, 'method', 1, 2);"), FOO_INHERITS + String.format(METHOD_FORMAT, "Foo.superClass_.method.call(this, 1, 2)")); } public void testValidBase3() { test(FOO_INHERITS + String.format(METHOD_FORMAT, "return Foo.base(this, 'method');"), FOO_INHERITS + String.format(METHOD_FORMAT, "return Foo.superClass_.method.call(this)")); } public void testValidBase4() { test("function Foo() { Foo.base(this, 'constructor', 1, 2); }" + FOO_INHERITS, "function Foo() { BaseFoo.call(this, 1, 2); } " + FOO_INHERITS); } public void testValidBase5() { test("var Foo = function() { Foo.base(this, 'constructor', 1); };" + FOO_INHERITS, "var Foo = function() { BaseFoo.call(this, 1); }; " + FOO_INHERITS); } public void testValidBase6() { test("var goog = {}; goog.Foo = function() {" + "goog.Foo.base(this, 'constructor'); }; " + "goog.inherits(goog.Foo, goog.BaseFoo);", "var goog = {}; goog.Foo = function() { goog.BaseFoo.call(this); }; " + "goog.inherits(goog.Foo, goog.BaseFoo);"); } public void testValidBase7() { // No goog.inherits, so this is probably a different 'base' function. testSame("" + "var a = function() {" + " a.base(this, 'constructor');" + "};"); } public void testImplicitAndExplicitProvide() { test("var goog = {}; " + "goog.provide('goog.foo.bar'); goog.provide('goog.foo');", "var goog = {}; goog.foo = {}; goog.foo.bar = {};"); } public void testImplicitProvideInIndependentModules() { testModule( new String[] { "", "goog.provide('apps.A');", "goog.provide('apps.B');" }, new String[] { "var apps = {};", "apps.A = {};", "apps.B = {};", }); } public void testImplicitProvideInIndependentModules2() { testModule( new String[] { "goog.provide('apps');", "goog.provide('apps.foo.A');", "goog.provide('apps.foo.B');" }, new String[] { "var apps = {}; apps.foo = {};", "apps.foo.A = {};", "apps.foo.B = {};", }); } public void testImplicitProvideInIndependentModules3() { testModule( new String[] { "var goog = {};", "goog.provide('goog.foo.A');", "goog.provide('goog.foo.B');" }, new String[] { "var goog = {}; goog.foo = {};", "goog.foo.A = {};", "goog.foo.B = {};", }); } public void testProvideInIndependentModules1() { testModule( new String[] { "goog.provide('apps');", "goog.provide('apps.foo');", "goog.provide('apps.foo.B');" }, new String[] { "var apps = {}; apps.foo = {};", "", "apps.foo.B = {};", }); } public void testProvideInIndependentModules2() { // TODO(nicksantos): Make this an error. testModule( new String[] { "goog.provide('apps');", "goog.provide('apps.foo'); apps.foo = {};", "goog.provide('apps.foo.B');" }, new String[] { "var apps = {};", "apps.foo = {};", "apps.foo.B = {};", }); } public void testProvideInIndependentModules2b() { // TODO(nicksantos): Make this an error. testModule( new String[] { "goog.provide('apps');", "goog.provide('apps.foo'); apps.foo = function() {};", "goog.provide('apps.foo.B');" }, new String[] { "var apps = {};", "apps.foo = function() {};", "apps.foo.B = {};", }); } public void testProvideInIndependentModules3() { testModule( new String[] { "goog.provide('apps');", "goog.provide('apps.foo.B');", "goog.provide('apps.foo'); goog.require('apps.foo');" }, new String[] { "var apps = {}; apps.foo = {};", "apps.foo.B = {};", "", }); } public void testProvideInIndependentModules3b() { // TODO(nicksantos): Make this an error. testModule( new String[] { "goog.provide('apps');", "goog.provide('apps.foo.B');", "goog.provide('apps.foo'); apps.foo = function() {}; " + "goog.require('apps.foo');" }, new String[] { "var apps = {};", "apps.foo.B = {};", "apps.foo = function() {};", }); } public void testProvideInIndependentModules4() { // Regression test for bug 261: // http://code.google.com/p/closure-compiler/issues/detail?id=261 testModule( new String[] { "goog.provide('apps');", "goog.provide('apps.foo.bar.B');", "goog.provide('apps.foo.bar.C');" }, new String[] { "var apps = {};apps.foo = {};apps.foo.bar = {}", "apps.foo.bar.B = {};", "apps.foo.bar.C = {};", }); } public void testRequireOfBaseGoog() { testError("goog.require('goog');", MISSING_PROVIDE_ERROR); } public void testSourcePositionPreservation() { test("goog.provide('foo.bar.baz');", "var foo = {};" + "foo.bar = {};" + "foo.bar.baz = {};"); Node root = getLastCompiler().getRoot(); Node fooDecl = findQualifiedNameNode("foo", root); Node fooBarDecl = findQualifiedNameNode("foo.bar", root); Node fooBarBazDecl = findQualifiedNameNode("foo.bar.baz", root); assertEquals(1, fooDecl.getLineno()); assertEquals(14, fooDecl.getCharno()); assertEquals(1, fooBarDecl.getLineno()); assertEquals(18, fooBarDecl.getCharno()); assertEquals(1, fooBarBazDecl.getLineno()); assertEquals(22, fooBarBazDecl.getCharno()); } public void testNoStubForProvidedTypedef() { test("goog.provide('x'); /** @typedef {number} */ var x;", "var x;"); } public void testNoStubForProvidedTypedef2() { test("goog.provide('x.y'); /** @typedef {number} */ x.y;", "var x = {}; x.y;"); } public void testNoStubForProvidedTypedef4() { test("goog.provide('x.y.z'); /** @typedef {number} */ x.y.z;", "var x = {}; x.y = {}; x.y.z;"); } public void testProvideRequireSameFile() { test("goog.provide('x');\ngoog.require('x');", "var x = {};"); } public void testDefineCases() { String jsdoc = "/** @define {number} */\n"; test(jsdoc + "goog.define('name', 1);", jsdoc + "var name = 1"); test(jsdoc + "goog.define('ns.name', 1);", jsdoc + "ns.name = 1"); } public void testDefineErrorCases() { String jsdoc = "/** @define {number} */\n"; testError("goog.define('name', 1);", MISSING_DEFINE_ANNOTATION); testError(jsdoc + "goog.define('name.2', 1);", INVALID_DEFINE_NAME_ERROR); testError(jsdoc + "goog.define();", NULL_ARGUMENT_ERROR); testError(jsdoc + "goog.define('value');", NULL_ARGUMENT_ERROR); testError(jsdoc + "goog.define(5);", INVALID_ARGUMENT_ERROR); testErrorEs6(jsdoc + "goog.define(`templateName`, 1);", INVALID_ARGUMENT_ERROR); testErrorEs6(jsdoc + "goog.define(`${template}Name`, 1);", INVALID_ARGUMENT_ERROR); } public void testDefineValues() { testSame("var CLOSURE_DEFINES = {'FOO': 'string'};"); testSame("var CLOSURE_DEFINES = {'FOO': true};"); testSame("var CLOSURE_DEFINES = {'FOO': false};"); testSame("var CLOSURE_DEFINES = {'FOO': 1};"); testSame("var CLOSURE_DEFINES = {'FOO': 0xABCD};"); testSame("var CLOSURE_DEFINES = {'FOO': -1};"); } public void testDefineValuesErrors() { testError("var CLOSURE_DEFINES = {'FOO': a};", CLOSURE_DEFINES_ERROR); testError("var CLOSURE_DEFINES = {'FOO': 0+1};", CLOSURE_DEFINES_ERROR); testError("var CLOSURE_DEFINES = {'FOO': 'value' + 'value'};", CLOSURE_DEFINES_ERROR); testError("var CLOSURE_DEFINES = {'FOO': !true};", CLOSURE_DEFINES_ERROR); testError("var CLOSURE_DEFINES = {'FOO': -true};", CLOSURE_DEFINES_ERROR); testErrorEs6("var CLOSURE_DEFINES = {SHORTHAND};", CLOSURE_DEFINES_ERROR); testErrorEs6("var CLOSURE_DEFINES = {'TEMPLATE': `template`};", CLOSURE_DEFINES_ERROR); testErrorEs6("var CLOSURE_DEFINES = {'TEMPLATE': `${template}Sub`};", CLOSURE_DEFINES_ERROR); } }
mbebenita/closure-compiler
test/com/google/javascript/jscomp/ProcessClosurePrimitivesTest.java
Java
apache-2.0
42,234
[ 30522, 1013, 1008, 1008, 9385, 2294, 1996, 8503, 21624, 6048, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 30524, 5371, 3272, 1999, 12646, 2007, 1996, 6105, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- title: "A Curated List of Algorithms Resources" permalink: /algorithms-curated/ layout: single author_profile: true toc: true --- ## General * [Introduction to Algorithms - MIT 6.006 2011](https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-videos/) * [Design and Analysis of Algorithms - MIT 6.046J 2015](https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-design-and-analysis-of-algorithms-spring-2015/lecture-videos/) * [Introduction to Algorithms - MIT 6.046J 2005](https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/video-lectures/) * [Advanced Algorithms - MIT 6.854J 2008](https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-854j-advanced-algorithms-fall-2008/lecture-notes/) * [Randomized Algorithms - MIT 6.856J 2002](https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-856j-randomized-algorithms-fall-2002/lecture-notes/) * [Distributed Algorithms - MIT 6.852J 2009](https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-852j-distributed-algorithms-fall-2009/lecture-notes/) * [Introduction to Algorithms - York College CS 360](http://faculty.ycp.edu/~dbabcock/PastCourses/cs360/lectures/index.html) * [Skiena's Algorithms Lectures](https://www3.cs.stonybrook.edu/~algorith/video-lectures/) * [Discrete Mathematics in Computer Science - Dartmouth College](https://math.dartmouth.edu/archive/m19w03/public_html/) * [Parallel and Sequential Data Structures and Algorithms - Carnegie Mellon University](http://www.cs.cmu.edu/afs/cs/academic/class/15210-f12/www/schedule.html). Since summer of 2013, the course is taught from the book [ Algorithm Design: Parallel and Sequential](https://drive.google.com/file/d/0B4z2gzEmkDDCb0NBSlFWYnBDNEk/view). * [Algorithms and Data Structures - McGill University COMP 251](http://www.cim.mcgill.ca/~langer/251.html) * [Design and Analysis of Computer Algorithms - University of Maryland CMSC 451](http://www.cs.umd.edu/class/fall2017/cmsc451-0101/lectures.shtml) * [Algorithms: Design and Analysis](https://lagunita.stanford.edu/courses/course-v1:Engineering+Algorithms1+SelfPaced/about) * [Algorithms: Design and Analysis II](https://lagunita.stanford.edu/courses/course-v1:Engineering+Algorithms2+SelfPaced/about) * [Algorithms, Part I](https://www.coursera.org/learn/algorithms-part1) * [Algorithms, Part II](https://www.coursera.org/learn/algorithms-part2) * [Algorithms - Jeff Erickson](http://jeffe.cs.illinois.edu/teaching/algorithms/) * [OpenDSA](https://www.ida.liu.se/opendsa/OpenDSA/Books/Everything/html/) * [Uri Zwick - Tel Aviv University](http://www.cs.tau.ac.il/~zwick/) * [Approximation Algorithms - Chandra Chekuri](https://courses.engr.illinois.edu/cs598csc/sp2011/) * [Tim Roughgarden Lectures](https://www.youtube.com/channel/UCcH4Ga14Y4ELFKrEYM1vXCg) * [Algorithms - Carnegie Mellon University 15-451/651 2012](https://www.cs.cmu.edu/~avrim/451f12/) ## Practice * [BRILLIANT](https://brilliant.org/courses/#computer-science-advanced) * [LeetCode](https://leetcode.com/) * [Code Monk](https://www.hackerearth.com/practice/codemonk/) * [CodeChef](https://www.codechef.com) * [SPOJ](https://www.spoj.com/) * [HackerRank](https://www.hackerrank.com/domains/algorithms) ## Blogs * [Vaidehi Joshi](https://dev.to/vaidehijoshi) * [Coding Recipes](http://codingrecipies.blogspot.com/) ## Solutions * [CLRS Solutions](https://walkccc.github.io/CLRS/) * [ladamalina/coursera-algo](https://github.com/ladamalina/coursera-algo) * [aistrate/AlgorithmsSedgewick](https://github.com/aistrate/AlgorithmsSedgewick) * [rhapsodyai/AlgorithmDesignManual](https://github.com/rhapsodyai/Textbooks) * [reneargento/algorithms-sedgewick-wayne](https://github.com/reneargento/algorithms-sedgewick-wayne) * [Quiz 2 - MIT 6.006 Fall 07](/assets/docs/algorithms-curated/Quiz 2 - MIT 6.006 Fall 07.pdf) * [Quiz 2 - MIT 6.006 Spring 08](/assets/docs/algorithms-curated/Quiz 2 - MIT 6.006 Spring 08.pdf) * [All Exercises and Solutions - Ecole Polytechnique](/assets/docs/algorithms-curated/All Exercises and Solutions - Ecole Polytechnique.pdf) * [Practice Problems Solutions - Dalhousie University CSCI 3110](/assets/docs/algorithms-curated/Practice Problems Solutions - Dalhousie University CSCI 3110.pdf) * [Homeworks and Handouts - University of Maryland CMSC 451](http://www.cs.umd.edu/class/fall2017/cmsc451-0101/handouts.shtml) * [Algorithms and Complexity - KTH DD2354](http://www.csc.kth.se/utbildning/kth/kurser/DD2354/algokomp10/) * [SSQ/Coursera-Stanford-Algorithms-Specialization](https://github.com/SSQ/Coursera-Stanford-Algorithms-Specialization/blob/master/README.md) * [yusufcakal/algorithms](https://github.com/yusufcakal/algorithms) * [deepak-malik/Data-Structures-In-Java](https://github.com/deepak-malik/Data-Structures-In-Java) * [Erdos-Graph-Framework/Erdos](https://github.com/Erdos-Graph-Framework/Erdos) * [pedrovgs/Algorithms](https://github.com/pedrovgs/Algorithms) * [jeandersonbc/algorithms-and-ds](https://github.com/jeandersonbc/algorithms-and-ds) * [psjava/psjava](https://github.com/psjava/psjava) * [asmolich/algorithms](https://github.com/asmolich/algorithms) * [phishman3579/java-algorithms-implementation](https://github.com/phishman3579/java-algorithms-implementation) * [jpa99/Algorithms](https://github.com/jpa99/Algorithms) * [skseth/algorithms](https://github.com/skseth/algorithms) * [harshitkgupta/algorithms](https://github.com/harshitkgupta?utf8=%E2%9C%93&tab=repositories&q=algorithms&type=&language=) * [teddyrendahl/stanford-algs](https://github.com/teddyrendahl/stanford-algs) * [sestus/algorithms-stanford](https://github.com/sestus/algorithms-stanford) * [LeslieK/AlgoClass](https://github.com/LeslieK/AlgoClass) * [vkostyukov/scalacaster](https://github.com/vkostyukov/scalacaster) * [pathikrit/scalgos](https://github.com/pathikrit/scalgos) * [shaiwalsachdev/Algorithms---Stanford-University](https://github.com/shaiwalsachdev/Algorithms---Stanford-University) * [Ziang-Lu/Coursera-Algorithms](https://github.com/Ziang-Lu/Coursera-Algorithms) * [HuangLiPang/Stanford-University-Algorithms](https://github.com/HuangLiPang/Stanford-University-Algorithms) * [fgarcialainez/Stanford-Algorithms-1](https://github.com/fgarcialainez/Stanford-Algorithms-1) * [fgarcialainez/Stanford-Algorithms-2](https://github.com/fgarcialainez/Stanford-Algorithms-2) ## Asymptotic Analysis * [A Gentle Introduction to Algorithm Complexity Analysis](http://discrete.gr/complexity/) * [Master Theorem](/assets/docs/algorithms-curated/Master Theorem - Brilliant.pdf) * [Assignment 1 Solutions - Dalhousie University CSCI 3110](/assets/docs/algorithms-curated/Assignment 1 Solutions - Dalhousie University CSCI 3110.pdf) * [Assignment 2 Solutions - Dalhousie University CSCI 3110](/assets/docs/algorithms-curated/Assignment 2 Solutions - Dalhousie University CSCI 3110.pdf) * [Worst-Case Analysis of Set Union Algorithms - Tarjan](/assets/docs/algorithms-curated/Worst-Case Analysis of Set Union Algorithms - Tarjan.pdf) ## Divide-and-Conquer * [Solving Divide-and-Conquer Recurrences - Adamchik](/assets/docs/algorithms-curated/Solving Divide-and-Conquer Recurrences - Adamchik.pdf) * [Finding the Closest Pair of Points on the Plane](https://www.youtube.com/watch?v=xi-WF07rAQw) * [Assignment 6 Solutions - Dalhousie University CSCI 3110](/assets/docs/algorithms-curated/Assignment 6 Solutions - Dalhousie University CSCI 3110.pdf) ## Probability * [Probabilistic Analysis - York College](/assets/docs/algorithms-curated/Probabilistic Analysis - York College.pdf) ## Selection * [Finding Second Largest Element in an Array - University of Maryland](/assets/docs/algorithms-curated/Finding Second Largest Element in an Array - University of Maryland.pdf) * [Kth Smallest Element](/assets/docs/algorithms-curated/Kth Smallest Element - Quora.pdf) * [Assignment 7 Solutions - Dalhousie University CSCI 3110](/assets/docs/algorithms-curated/Assignment 7 Solutions - Dalhousie University CSCI 3110.pdf) ## Graphs ### General * [Topological Sort](/assets/docs/algorithms-curated/Topological Sort.pdf) * [Solving 2-List Coloring (by Reducing to 2-SAT)](/assets/docs/algorithms-curated/Solving 2-List Coloring - Gil.pdf) * [Episode 24 - 2SAT](https://www.youtube.com/watch?v=0nNYy3rltgA) * [Graph Contraction and Connectivity - Carnegie Mellon University](/assets/docs/algorithms-curated/Graph Contraction and Connectivity - Carnegie Mellon University.pdf) * [Assignment 3 Solutions - Dalhousie University CSCI 3110](/assets/docs/algorithms-curated/Assignment 3 Solutions - Dalhousie University CSCI 3110.pdf) * [Assignment 4 Solutions - Dalhousie University CSCI 3110](/assets/docs/algorithms-curated/Assignment 4 Solutions - Dalhousie University CSCI 3110.pdf) * [Assignment 5 Solutions - Dalhousie University CSCI 3110](/assets/docs/algorithms-curated/Assignment 5 Solutions - Dalhousie University CSCI 3110.pdf) * [Everything about Bottleneck Spanning Tree](http://flashing-thoughts.blogspot.com/2010/06/everything-about-bottleneck-spanning.html) * [Spanning Trees Exercises Solutions - Ecole Polytechnique](/assets/docs/algorithms-curated/Spanning Trees Exercises Solutions - Ecole Polytechnique.pdf) * [B Trees - University of Craiova](/assets/docs/algorithms-curated/B Trees - University of Craiova.pdf) * [Depth-First Search and Linear Graph Algorithms - Tarjan](/assets/docs/algorithms-curated/DFS - Tarjan.pdf) ### Shortest Paths * [A Note on Practical Construction Of Maximum Bandwidth Paths - Malpani+Chen](/assets/docs/algorithms-curated/A Note on Practical Construction Of Maximum Bandwidth Paths - Malpani+Chen.pdf) * [A Practical Shortest Path Problem with Linear Expected Time - Goldberg](/assets/docs/algorithms-curated/A Practical Shortest Path Problem with Linear Expected Time - Goldberg.pdf) * [Bottleneck Spanning Tree Homework - Cheng](/assets/docs/algorithms-curated/Bottleneck Spanning Tree Homework - Cheng.pdf) * [Faster Algorithms for the Shortest Path Problem](/assets/docs/algorithms-curated/Faster Algorithms for the Shortest Path Problem.pdf) * [Graph Algorithms II](/assets/docs/algorithms-curated/Graph Algorithms II.pdf) * [Implementations of Dijkstra's Algorithm Based on Multi-Level Buckets - Goldberg+Silverstein](/assets/docs/algorithms-curated/Implementations of Dijkstra's Algorithm Based on Multi-Level Buckets - Goldberg+Silverstein.pdf) * [Rec 16 - MIT 6.006 Spring 11](/assets/docs/algorithms-curated/Rec 16 - MIT 6.006 Spring 11.pdf) * [On the Bottleneck Shortest Path Problem - Kaibel+Peinhardt](/assets/docs/algorithms-curated/On the Bottleneck Shortest Path Problem - Kaibel+Peinhardt.pdf) * [Practical Efficiency of the Linear-time Algorithm for the Single Source Shortest Path Problem - Asano+Imai](/assets/docs/algorithms-curated/Practical Efficiency of the Linear-time Algorithm for the Single Source Shortest Path Problem - Asano+Imai.pdf) * [Undirected Single Source Shortest Paths in Linear Time - Thorup](/assets/docs/algorithms-curated/Undirected Single Source Shortest Paths in Linear Time - Thorup.pdf) * [T-joins and Applications](/assets/docs/algorithms-curated/T-joins and Applications - Chekuri.pdf) * [Shortest Path Algorithms - Goddyn](/assets/docs/algorithms-curated/Shortest Path Algorithms - Goddyn.pdf) * [Shortest Paths - Ahuja](/assets/docs/algorithms-curated/Shortest Paths - Ahuja.pdf) * [Dijkstra's Algorithm with Simple Buckets - MIT 15.082J](/assets/docs/algorithms-curated/Dijkstra's Algorithm with Simple Buckets - MIT 15.082J.pdf) * [Modifying Dijkstra's Algorithm for Edge Weights Drawn from Range](/assets/docs/algorithms-curated/Modifying Dijkstra's Algorithm for Edge Weights Drawn from Range.pdf) * [Dijkstra's Algorithm for Edge Weights in Range](/assets/docs/algorithms-curated/Dijkstra's Algorithm for Edge Weights in Range.pdf) * [Accelerating Johnson's All-Pairs Shortest Paths Algorithm on GPU](/assets/docs/algorithms-curated/Accelerating Johnson's APSP Algorithm on GPU.pdf) * [Solving All Pairs Shortest Paths in Parallel](https://moorejs.github.io/APSP-in-parallel/) ### Matroids * [Matroid Optimization - MIT 18.433](/assets/docs/algorithms-curated/Matroid Optimization - MIT 18.433.pdf) * [Matroid Intersection - MIT 18.433](/assets/docs/algorithms-curated/Matroids - Johnson.pdf) * [Matroids - Johnson](/assets/docs/algorithms-curated/Matroids - Johnson.pdf) ### Circuits * [Circuits](/assets/docs/algorithms-curated/Circuits.pdf) ## Hashing * [Probability Calculations in Hashing](/assets/docs/algorithms-curated/Probability Calculations in Hashing.pdf) * [Hashing - Bebis](/assets/docs/algorithms-curated/Hashing - Bebis.pdf) * [Universal Hashing- Minimizing Collisions](/assets/docs/algorithms-curated/Universal Hashing- Minimizing Collisions.pdf) * [Universal Classes of Hash Functions - Carter+Wegman](/assets/docs/algorithms-curated/Universal Classes of Hash Functions - Carter+Wegman.pdf) ## Dynamic Programming * [MWIS in a Tree - Chen+Kuo+Sheu](/assets/docs/algorithms-curated/MWIS in a Tree - Chen+Kuo+Sheu.pdf) * [The Knapsack Problem - MIT 6.006](/assets/docs/algorithms-curated/The Knapsack Problem - MIT 6.006.pdf) * [Optimal BST - Carnegie Mellon University](/assets/docs/algorithms-curated/Optimal BST - Carnegie Mellon University.pdf) * [Optimal BST - University of Craiova](/assets/docs/algorithms-curated/Optimal BST - University of Craiova.pdf) * [Space-Efficient Alignment - Carnegie Mellon University](/assets/docs/algorithms-curated/Space-Efficient Alignment - Carnegie Mellon University.pdf) * [Exercise3+4 Solutions - CTH](/assets/docs/algorithms-curated/Exercise3+4 Solutions - CTH.pdf) * [Dynamic Programming I - Carnegie Mellon University](/assets/docs/algorithms-curated/Dynamic Programming I - Carnegie Mellon University.pdf) ## Strings * [Faster Suffix Sorting - Larsson+Sadakane](/assets/docs/algorithms-curated/Faster Suffix Sorting - Larsson+Sadakane.pdf) * [How the Burrows-Wheeler Transform Works](/assets/docs/algorithms-curated/How the Burrows-Wheeler Transform Works.pdf) * [Suffix tree. Basics. Building in O(nlogn)](https://codeforces.com/blog/entry/11337) * [Great resource for string algorithms](http://www-igm.univ-mlv.fr/~lecroq/string/node1.html) * [Suffix tree. Ukkonen's algorithm](https://codeforces.com/blog/entry/16780) * [Trie - University of Craiova](/assets/docs/algorithms-curated/Trie - University of Craiova.pdf) ## NP-Complete * [What are the Differences between NP, NP-Complete and NP-Hard - Stack Overflow](/assets/docs/algorithms-curated/What are the Differences between NP, NP-Complete and NP-Hard - Stack Overflow.pdf) * [The Traveling Salesman Problem - University of Crete](/assets/docs/algorithms-curated/The Traveling Salesman Problem - University of Crete.pdf) * [Traveling Salesperson: The Most Misunderstood Problem](http://www.nomachetejuggling.com/2012/09/14/traveling-salesman-the-most-misunderstood-problem/) * [Polynomial Time Approximation Schemes for Euclidean Traveling Salesman and other Geometric Problems - Arora](/assets/docs/algorithms-curated/Polynomial Time Approximation Schemes for Euclidean Traveling Salesman and other Geometric Problems - Arora.pdf) * [Notes on NP Completeness - Schwartz](/assets/docs/algorithms-curated/Notes on NP Completeness - Schwartz.pdf) * [Maximum Matching in Bipartite and Non-Bipartite Graphs - Zwick](/assets/docs/algorithms-curated/Maximum Matching in Bipartite and Non-Bipartite Graphs - Zwick.pdf) * [Maximum Independent Set Problem - Chekuri](/assets/docs/algorithms-curated/Maximum Independent Set Problem - Chekuri.pdf) * [The Traveling Salesperson Problem - Chekuri](/assets/docs/algorithms-curated/The Traveling Salesperson Problem - Chekuri.pdf) * [The Traveling Salesperson Problem - Roughgarden](/assets/docs/algorithms-curated/The Traveling Salesperson Problem - Roughgarden.pdf) * [The An-Kleinberg-Shmoys Algorithm for the TSP - Carnegie Mellon University](/assets/docs/algorithms-curated/The An-Kleinberg-Shmoys Algorithm for the TSP - Carnegie Mellon University.pdf) * [Design and Analysis of Algorithms (#24) - Panigrahi](/assets/docs/algorithms-curated/Design and Analysis of Algorithms (24) - Panigrahi.pdf) * [Approximating the Minimum Degree Spanning Tree - Furer](/assets/docs/algorithms-curated/Approximating the Minimum Degree Spanning Tree - Furer.pdf) * [The P vs. NP Problem - Cook](/assets/docs/algorithms-curated/The P vs. NP Problem - Cook.pdf) * [Dynamic Programming for Minimum Steiner Trees](/assets/docs/algorithms-curated/Dynamic Programming for Minimum Steiner Trees.pdf) * [Steiner Tree NP-Completeness Proof - Santuari](/assets/docs/algorithms-curated/Steiner Tree NP-Completeness Proof - Santuari.pdf) * [Graph Algorithms - Panigraphi](/assets/docs/algorithms-curated/Graph Algorithms - Panigraphi.pdf) * [Combinatorial Optimization - MIT 18.453](/assets/docs/algorithms-curated/Combinatorial Optimization - MIT 18.453.pdf) * [Steiner Trees - Utrecht University](/assets/docs/algorithms-curated/Steiner Trees - Utrecht University.pdf) * [Efficient algorithms for Steiner Tree Problem - Meng](/assets/docs/algorithms-curated/Efficient algorithms for Steiner Tree Problem - Meng.pdf) * [Comparing Between Different Approaches to Solve the 0/1 Knapsack Problem](/assets/docs/algorithms-curated/Knapsack - Shaheen+Sleit.pdf) * [Longest Path in a DAG - Khan](/assets/docs/algorithms-curated/Longest Path in a DAG - Khan.pdf) * [How Easy is Local Search - Johnson+Papadimitriou+Yannkakis](/assets/docs/algorithms-curated/How Easy is Local Search.pdf) * [The Capacitated Max K-Cut Problem - Gaur+Krishnamurti+Kohli](/assets/docs/algorithms-curated/The Capacitated Max K-Cut Problem - Gaur+Krishnamurti+Kohli.pdf) * [An Overview of What We Can and Cannot Do with Local Search - Christopoulos+Zissimopoulos](/assets/docs/algorithms-curated/Local Search - Christopoulos+Zissimopoulos.pdf) * [Approximation Algorithms - Dinitz](/assets/docs/algorithms-curated/Approximation Algorithms - Dinitz.pdf) * [Approximation Algorithms (2011) - Chekuri](/assets/docs/algorithms-curated/Approximation Algorithms (2011) - Chekuri.pdf) * [Lec-24 Traveling Salesman Problem(TSP) - IIT Madras](https://www.youtube.com/watch?v=-cLsEHP0qt0) * [Design and Analysis of Algorithms (#16) - Panigrahi](/assets/docs/algorithms-curated/Design and Analysis of Algorithms (16) - Panigrahi.pdf) * [Approximation Algorithms (2011) - Chekuri](/assets/docs/algorithms-curated/Approximation Algorithms (2011) - Chekuri.pdf) * [Greedy Approximation - University of Maryland](/assets/docs/algorithms-curated/Greedy Approximation - University of Maryland.pdf) * [Approximation Algorithms - University of Maryland](/assets/docs/algorithms-curated/Approximation Algorithms - University of Maryland.pdf) * [Approximation Algorithms - Zadeh](/assets/docs/algorithms-curated/Approximation Algorithms - Zadeh.pdf) * [Approximation Algorithms - Warnow](/assets/docs/algorithms-curated/Approximation Algorithms - Warnow.pdf) * [TSP Heuristics - Leading Methods, Implementations and Latest Advances](/assets/docs/algorithms-curated/TSP Heuristics - Leading Methods, Implementations and Latest Advances.pdf) {: .notice} Lectures 24 through 27 are all related to TSP. * [Heuristic Approaches to Solve TSP - Abid+Iqbal](/assets/docs/algorithms-curated/Heuristic Approaches to Solve TSP - Abid+Iqbal.pdf) ## Other Curated Lists * [Data Structures and Algorithms](https://discuss.codechef.com/questions/48877/data-structures-and-algorithms) * [All of the good tutorials found on codeforces](https://codeforces.com/blog/entry/57282) * [Good Blog Post Resources about Algorithm and Data Structures](https://codeforces.com/blog/entry/13529) * [Awesome Competitive Programming](https://github.com/lnishan/awesome-competitive-programming) * [Awesome Algorithms](https://github.com/tayllan/awesome-algorithms) * [Algorithm Courses](http://people.cs.pitt.edu/~kirk/algorithmcourses/index.html) * [prakhar1989/awesome-courses](https://github.com/prakhar1989/awesome-courses)
asarkar/non-compos-mentis
site/_pages/algorithms-curated.md
Markdown
gpl-3.0
20,083
[ 30522, 1011, 1011, 1011, 2516, 1024, 1000, 1037, 17940, 2862, 1997, 13792, 4219, 1000, 2566, 9067, 19839, 1024, 1013, 13792, 1011, 17940, 1013, 9621, 1024, 2309, 3166, 1035, 6337, 1024, 2995, 2000, 2278, 1024, 2995, 1011, 1011, 1011, 1001, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; namespace gov.va.medora.mdo.dao { public interface IEncounterDao { Appointment[] getAppointments(); Appointment[] getAppointments(string pid); Appointment[] getFutureAppointments(); Appointment[] getFutureAppointments(string pid); Appointment[] getAppointments(int pastDays, int futureDays); Appointment[] getAppointments(string pid, int pastDays, int futureDays); Appointment[] getMentalHealthAppointments(); string getAppointmentText(string apptId); string getAppointmentText(string pid, string apptId); Adt[] getInpatientMoves(string fromDate, string toDate); Adt[] getInpatientMovesByCheckinId(string checkinId); Adt[] getInpatientMoves(); Adt[] getInpatientMoves(string pid); Adt[] getInpatientMoves(string fromDate, string toDate, string iterLength); // Depreciate to lookupHospitalLocations HospitalLocation[] lookupLocations(string target, string direction); StringDictionary lookupHospitalLocations(string target); string getLocationId(string locationName); HospitalLocation[] getWards(); HospitalLocation[] getClinics(string target, string direction); InpatientStay[] getStaysForWard(string wardId); Drg[] getDRGRecords(); Visit[] getOutpatientVisits(); Visit[] getOutpatientVisits(string pid); Visit[] getVisits(string fromDate, string toDate); Visit[] getVisits(string pid, string fromDate, string toDate); Visit[] getVisitsForDay(string theDate); Visit[] getMentalHealthVisits(); InpatientStay[] getAdmissions(); InpatientStay[] getAdmissions(string pid); string getServiceConnectedCategory(string initialCategory, string locationIen, bool outpatient); string getOutpatientEncounterReport(string fromDate, string toDate, int nrpts); string getOutpatientEncounterReport(string pid, string fromDate, string toDate, int nrpts); string getAdmissionsReport(string fromDate, string toDate, int nrpts); string getAdmissionsReport(string pid, string fromDate, string toDate, int nrpts); string getExpandedAdtReport(string fromDate, string toDate, int nrpts); string getExpandedAdtReport(string pid, string fromDate, string toDate, int nrpts); string getDischargesReport(string fromDate, string toDate, int nrpts); string getDischargesReport(string pid, string fromDate, string toDate, int nrpts); string getTransfersReport(string fromDate, string toDate, int nrpts); string getTransfersReport(string pid, string fromDate, string toDate, int nrpts); string getFutureClinicVisitsReport(string fromDate, string toDate, int nrpts); string getFutureClinicVisitsReport(string pid, string fromDate, string toDate, int nrpts); string getPastClinicVisitsReport(string fromDate, string toDate, int nrpts); string getPastClinicVisitsReport(string pid, string fromDate, string toDate, int nrpts); string getTreatingSpecialtyReport(string fromDate, string toDate, int nrpts); string getTreatingSpecialtyReport(string pid, string fromDate, string toDate, int nrpts); string getCareTeamReport(); string getCareTeamReport(string pid); string getDischargeDiagnosisReport(string fromDate, string toDate, int nrpts); string getDischargeDiagnosisReport(string pid, string fromDate, string toDate, int nrpts); IcdReport[] getIcdProceduresReport(string fromDate, string toDate, int nrpts); IcdReport[] getIcdProceduresReport(string pid, string fromDate, string toDate, int nrpts); IcdReport[] getIcdSurgeryReport(string fromDate, string toDate, int nrpts); IcdReport[] getIcdSurgeryReport(string pid, string fromDate, string toDate, int nrpts); string getCompAndPenReport(string fromDate, string toDate, int nrpts); string getCompAndPenReport(string pid, string fromDate, string toDate, int nrpts); DictionaryHashList getSpecialties(); DictionaryHashList getTeams(); Adt[] getInpatientDischarges(string pid); InpatientStay[] getStayMovementsByDateRange(string fromDate, string toDate); InpatientStay getStayMovements(string checkinId); Site[] getSiteDivisions(string siteId); PatientCareTeam getPatientCareTeamMembers(string station); } }
VHAINNOVATIONS/RAPTOR
OtherComponents/MDWSvistalayer/MDWS Source/mdo/mdo/src/mdo/dao/IEncounterDao.cs
C#
apache-2.0
4,557
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 2291, 1012, 6407, 1012, 7772, 1025, 2478, 2291, 1012, 3793, 1025, 3415, 15327, 18079, 1012, 12436, 1012, 19960, 6525, 1012, 9108, 2080, 1012, 4830, 2080, 1063, 2270, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Struct template reverse_fold_tree</title> <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> <link rel="up" href="../../proto/reference.html#header.boost.proto.transform.fold_tree_hpp" title="Header &lt;boost/proto/transform/fold_tree.hpp&gt;"> <link rel="prev" href="fold_tree/impl.html" title="Struct template impl"> <link rel="next" href="reverse_fold_tree/impl.html" title="Struct template impl"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> <td align="center"><a href="../../../../index.html">Home</a></td> <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="fold_tree/impl.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.transform.fold_tree_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reverse_fold_tree/impl.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="refentry"> <a name="boost.proto.reverse_fold_tree"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Struct template reverse_fold_tree</span></h2> <p>boost::proto::reverse_fold_tree — A <a class="link" href="../../PrimitiveTransform.html" title="Concept PrimitiveTransform">PrimitiveTransform</a> that recursively applies the <code class="computeroutput"><a class="link" href="reverse_fold.html" title="Struct template reverse_fold">proto::reverse_fold&lt;&gt;</a></code> transform to sub-trees that all share a common tag type.</p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../proto/reference.html#header.boost.proto.transform.fold_tree_hpp" title="Header &lt;boost/proto/transform/fold_tree.hpp&gt;">boost/proto/transform/fold_tree.hpp</a>&gt; </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Sequence<span class="special">,</span> <span class="keyword">typename</span> State0<span class="special">,</span> <span class="keyword">typename</span> Fun<span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="reverse_fold_tree.html" title="Struct template reverse_fold_tree">reverse_fold_tree</a> <span class="special">:</span> <span class="keyword"></span> <a class="link" href="transform.html" title="Struct template transform">proto::transform</a><span class="special">&lt;</span> <span class="identifier">reverse_fold_tree</span><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">,</span> <span class="identifier">State0</span><span class="special">,</span> <span class="identifier">Fun</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="special">{</span> <span class="comment">// member classes/structs/unions</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <a class="link" href="../../Expr.html" title="Concept Expr">Expr</a><span class="special">,</span> <span class="keyword">typename</span> State<span class="special">,</span> <span class="keyword">typename</span> Data<span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="reverse_fold_tree/impl.html" title="Struct template impl">impl</a> <span class="special">:</span> <span class="keyword"></span> <a class="link" href="reverse_fold.html" title="Struct template reverse_fold">proto::reverse_fold</a><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">,</span> <span class="identifier">State0</span><span class="special">,</span> <span class="identifier">recurse_if_</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Expr</span><span class="special">::</span><span class="identifier">proto_tag</span><span class="special">,</span> <span class="identifier">Fun</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="special">::</span><span class="keyword">template</span> <span class="identifier">impl</span><span class="special">&lt;</span><span class="identifier">Expr</span><span class="special">,</span> <span class="identifier">State</span><span class="special">,</span> <span class="identifier">Data</span><span class="special">&gt;</span> <span class="special">{</span> <span class="special">}</span><span class="special">;</span> <span class="special">}</span><span class="special">;</span></pre></div> <div class="refsect1"> <a name="id-1.3.34.5.48.5.4"></a><h2>Description</h2> <p> <code class="computeroutput">proto::reverse_fold_tree&lt;&gt;</code> is useful for flattening trees into lists; for example, you might use <code class="computeroutput">proto::reverse_fold_tree&lt;&gt;</code> to flatten an expression tree like <code class="computeroutput">a | b | c</code> into a Fusion list like <code class="computeroutput">cons(a, cons(b, cons(c)))</code>. </p> <p> <code class="computeroutput">proto::reverse_fold_tree&lt;&gt;</code> is easily understood in terms of a <code class="computeroutput">recurse_if_&lt;&gt;</code> helper, defined as follows: </p> <pre class="programlisting"> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Tag</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Fun</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">recurse_if_</span> <span class="special">:</span> <a class="link" href="if_.html" title="Struct template if_">proto::if_</a><span class="special">&lt;</span> <span class="comment">// If the current node has type type "Tag" ...</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span><a class="link" href="tag_of.html" title="Struct template tag_of">proto::tag_of</a><span class="special">&lt;</span><a class="link" href="_.html" title="Struct _">proto::_</a><span class="special">&gt;</span><span class="special">,</span> <span class="identifier">Tag</span><span class="special">&gt;</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="comment">// ... recurse, otherwise ...</span> <a class="link" href="reverse_fold.html" title="Struct template reverse_fold">proto::reverse_fold</a><span class="special">&lt;</span><a class="link" href="_.html" title="Struct _">proto::_</a><span class="special">,</span> <a class="link" href="_state.html" title="Struct _state">proto::_state</a><span class="special">,</span> <span class="identifier">recurse_if_</span><span class="special">&lt;</span><span class="identifier">Tag</span><span class="special">,</span> <span class="identifier">Fun</span><span class="special">&gt;</span> <span class="special">&gt;</span><span class="special">,</span> <span class="comment">// ... apply the Fun transform.</span> <span class="identifier">Fun</span> <span class="special">&gt;</span> <span class="special">{</span><span class="special">}</span><span class="special">;</span></pre> <p> </p> <p> With <code class="computeroutput">recurse_if_&lt;&gt;</code> as defined above, <code class="computeroutput">proto::reverse_fold_tree&lt;Sequence, State0, Fun&gt;()(expr, state, data)</code> is equivalent to: </p> <pre class="programlisting"><a class="link" href="reverse_fold.html" title="Struct template reverse_fold">proto::reverse_fold</a><span class="special">&lt;</span> <span class="identifier">Sequence</span><span class="special">,</span> <span class="identifier">State0</span><span class="special">,</span> <span class="identifier">recurse_if_</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Expr</span><span class="special">::</span><span class="identifier">proto_tag</span><span class="special">,</span> <span class="identifier">Fun</span><span class="special">&gt;</span> <span class="special">&gt;</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">expr</span><span class="special">,</span> <span class="identifier">state</span><span class="special">,</span> <span class="identifier">data</span><span class="special">)</span><span class="special">.</span></pre> <p> It has the effect of folding a tree back-to-front, recursing into child nodes that share a tag type with the parent node. </p> </div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright © 2008 Eric Niebler<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="fold_tree/impl.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.transform.fold_tree_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reverse_fold_tree/impl.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
davehorton/drachtio-server
deps/boost_1_77_0/doc/html/boost/proto/reverse_fold_tree.html
HTML
mit
11,042
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 5890, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include <iostream> #include <vector> using namespace std; const int MOD = 10007; class SegmentTree { struct STNode { int sum; int prefix; int suffix; int product; STNode() : sum(0), prefix(0), suffix(0), product(0) {} }; int size; vector<STNode> tree; void update(int index, int val, int root, int left, int right); int lson(int x) { return x << 1; } int rson(int x) { return (x << 1) | 1; } public: SegmentTree(int n) : size(n), tree(n<<2) {} void update(int index, int val) { update(index, val, 1, 0, size-1); } int query() { return tree[1].sum; } }; void SegmentTree::update(int index, int val, int root, int left, int right) { if (left == index && left == right) { tree[root].sum = tree[root].prefix = tree[root].suffix = tree[root].product = val % MOD; } else { int mid = left + (right-left)/2; if (index <= mid) update(index, val, lson(root), left, mid); else update(index, val, rson(root), mid+1, right); tree[root].sum = (tree[lson(root)].sum + tree[rson(root)].sum + tree[lson(root)].suffix * tree[rson(root)].prefix) % MOD; tree[root].prefix = (tree[lson(root)].prefix + tree[lson(root)].product * tree[rson(root)].prefix) % MOD; tree[root].suffix = (tree[rson(root)].suffix + tree[lson(root)].suffix * tree[rson(root)].product) % MOD; tree[root].product = (tree[lson(root)].product * tree[rson(root)].product) % MOD; } } int main(void) { ios::sync_with_stdio(false); cin.tie(nullptr); int n, q; cin >> n >> q; SegmentTree st(n); for (int i = 0; i < q; ++i) { int a, b; cin >> a >> b; st.update(a-1, b); cout << st.query() << '\n'; } cout << flush; return 0; }
buptlxb/hihoCoder
solutions/1116/calculate.cpp
C++
apache-2.0
1,824
[ 30522, 1001, 2421, 1026, 16380, 25379, 1028, 1001, 2421, 1026, 9207, 1028, 2478, 3415, 15327, 2358, 2094, 1025, 9530, 3367, 20014, 16913, 1027, 6694, 2581, 1025, 2465, 6903, 13334, 1063, 2358, 6820, 6593, 2358, 3630, 3207, 1063, 20014, 7680...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php include_once('include/database.php'); date_default_timezone_set(TIMEZONE); class Site { var $database; var $num_active_users; //Number of active users viewing site var $num_active_guests; //Number of active guests viewing site var $num_members; //Number of signed-up users var $num_trees; //Number of family trees function Site($database) { $this->database = $database; /** * Only query database to find out number of members * when getNumMembers() is called for the first time, * until then, default value set. */ $this->num_members = -1; /* Number of trees */ $this->num_trees = -1; if(TRACK_VISITORS){ /* Calculate number of users at site */ $this->calcNumActiveUsers(); /* Calculate number of guests at site */ $this->calcNumActiveGuests(); } } /** * getNumMembers - Returns the number of signed-up users * of the website, banned members not included. The first * time the function is called on page load, the database * is queried, on subsequent calls, the stored result * is returned. This is to improve efficiency, effectively * not querying the database when no call is made. */ function getNumMembers(){ if($this->num_members < 0){ $q = "SELECT * FROM ".TBL_USERS; $result = $this->database->query($q); $this->num_members = mysql_numrows($result); } return $this->num_members; } /** * getNumTrees - Returns the number of family trees * of the website. The first time the function is * called on page load, the database is queried, * on subsequent calls, the stored result is returned. * This is to improve efficiency, effectively * not querying the database when no call is made. */ function getNumTrees(){ if($this->num_trees < 0){ $q = "SELECT * FROM ".TBL_FAMILY; $result = $this->database->query($q); $this->num_trees = mysql_numrows($result); } return $this->num_trees; } /** * calcNumActiveUsers - Finds out how many active users * are viewing site and sets class variable accordingly. */ function calcNumActiveUsers(){ /* Calculate number of users at site */ $q = "SELECT * FROM ".TBL_ACTIVE_USERS; $result = $this->database->query($q); $this->num_active_users = mysql_numrows($result); } /** * calcNumActiveGuests - Finds out how many active guests * are viewing site and sets class variable accordingly. */ function calcNumActiveGuests(){ /* Calculate number of guests at site */ $q = "SELECT * FROM ".TBL_ACTIVE_GUESTS; $result = $this->database->query($q); $this->num_active_guests = mysql_numrows($result); } /* * cleanOutput - ensures safe data entry, and accepts either strings or arrays. * If the array is multidimensional, it will recursively loop through the array * and make all points of data safe for entry. */ function cleanOutput($array) { if(is_array($array)) { foreach($array as $key => $value) { if(is_array($array[$key])) { $array[$key] = $this->filterParameters($array[$key]); } if(is_string($array[$key])) { $array[$key] = mysql_real_escape_string($array[$key]); } } } if(is_string($array)) { $array = mysql_real_escape_string($array); } return $array; } /** * getDomainAndDir */ function getDomainAndDir() { $pageURL = 'http'; if (isset($_SERVER["HTTPS"])) { if ($_SERVER["HTTPS"] == "on") { $pageURL .= 's'; } } $pageURL .= '://'; if (isset($_SERVER["SERVER_PORT"])) { if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } } // Return the domain and directories, but exlude the filename return substr($pageURL, 0, strripos($pageURL, '/')+1); } }; $site = new Site($database); ?>
monipupi/-genealogy-site-karta
giminestinklapis/site.php
PHP
gpl-2.0
4,042
[ 30522, 1026, 1029, 25718, 2421, 1035, 2320, 1006, 1005, 2421, 1013, 7809, 1012, 25718, 1005, 1007, 1025, 3058, 1035, 12398, 1035, 2051, 15975, 1035, 2275, 1006, 2051, 15975, 1007, 1025, 2465, 2609, 1063, 13075, 1002, 7809, 1025, 13075, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>checker: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.12.0 / checker - 8.7.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> checker <small> 8.7.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-03-02 09:40:27 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-02 09:40:27 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.12.0 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.05.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.05.0 Official 4.05.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/checker&quot; license: &quot;LGPL 2.1&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Checker&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.7&quot; &amp; &lt; &quot;8.8~&quot;} ] tags: [ &quot;keyword: checker&quot; &quot;keyword: dominos&quot; &quot;keyword: puzzles&quot; &quot;category: Miscellaneous/Logical Puzzles and Entertainment&quot; ] authors: [ &quot;Gérard Huet&quot; ] bug-reports: &quot;https://github.com/coq-contribs/checker/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/checker.git&quot; synopsis: &quot;The Mutilated Checkerboard&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/checker/archive/v8.7.0.tar.gz&quot; checksum: &quot;md5=1d7e3dec6037b8a46be81aebbe83f925&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-checker.8.7.0 coq.8.12.0</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.12.0). The following dependencies couldn&#39;t be met: - coq-checker -&gt; coq &lt; 8.8~ -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-checker.8.7.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
coq-bench/coq-bench.github.io
clean/Linux-x86_64-4.05.0-2.0.1/released/8.12.0/checker/8.7.0.html
HTML
mit
6,716
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 30524, 2025, 11892, 100, 1026, 1013, 2516, 1028, 1026, 4957, 2128, 2140, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Arctium mixtum subsp. mixtum SUBSPECIES #### Status ACCEPTED #### According to NUB Generator [autonym] #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Arctium/Arctium mixtum/Arctium mixtum mixtum/README.md
Markdown
apache-2.0
173
[ 30522, 1001, 8115, 16398, 4666, 11667, 24807, 1012, 4666, 11667, 11056, 1001, 1001, 1001, 1001, 3570, 3970, 1001, 1001, 1001, 1001, 2429, 2000, 16371, 2497, 13103, 1031, 8285, 4890, 2213, 1033, 1001, 1001, 1001, 1001, 2405, 1999, 19701, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
object rec{ def main(args: Array[String]){ def factorial(num: Int): BigInt={ if(num<=1){ 1 } else{ num*factorial(num-1) } } print("Factorial of 4 is: "+factorial(4)) } }
Jargon4072/DS-ALGO_implementations
scala/rec.scala
Scala
gpl-3.0
227
[ 30522, 4874, 28667, 1063, 13366, 2364, 1006, 12098, 5620, 1024, 9140, 1031, 5164, 1033, 1007, 1063, 13366, 5387, 4818, 1006, 16371, 2213, 1024, 20014, 1007, 1024, 2502, 18447, 1027, 1063, 2065, 1006, 16371, 2213, 1026, 1027, 1015, 1007, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #define MYSQL_SERVER 1 #include "sql_priv.h" #include "probes_mysql.h" #include "key.h" // key_copy #include "sql_plugin.h" #include <m_ctype.h> #include <my_bit.h> #include <myisampack.h> #include "ha_myisam.h" #include <stdarg.h> #include "myisamdef.h" #include "rt_index.h" #include "sql_table.h" // tablename_to_filename #include "sql_class.h" // THD #include <algorithm> using std::min; using std::max; ulonglong myisam_recover_options; static ulong opt_myisam_block_size; /* Interface to mysqld, to check system tables supported by SE */ static bool myisam_is_supported_system_table(const char *db, const char *table_name, bool is_sql_layer_system_table); /* bits in myisam_recover_options */ const char *myisam_recover_names[] = { "DEFAULT", "BACKUP", "FORCE", "QUICK", "OFF", NullS}; TYPELIB myisam_recover_typelib= {array_elements(myisam_recover_names)-1,"", myisam_recover_names, NULL}; const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal", "nulls_ignored", NullS}; TYPELIB myisam_stats_method_typelib= { array_elements(myisam_stats_method_names) - 1, "", myisam_stats_method_names, NULL}; static MYSQL_SYSVAR_ULONG(block_size, opt_myisam_block_size, PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_RQCMDARG, "Block size to be used for MyISAM index pages", NULL, NULL, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH); static MYSQL_SYSVAR_ULONG(data_pointer_size, myisam_data_pointer_size, PLUGIN_VAR_RQCMDARG, "Default pointer size to be used for MyISAM tables", NULL, NULL, 6, 2, 7, 1); #define MB (1024*1024) static MYSQL_SYSVAR_ULONGLONG(max_sort_file_size, myisam_max_temp_length, PLUGIN_VAR_RQCMDARG, "Don't use the fast sort index method to created " "index if the temporary file would get bigger than this", NULL, NULL, LONG_MAX/MB*MB, 0, MAX_FILE_SIZE, MB); static MYSQL_SYSVAR_SET(recover_options, myisam_recover_options, PLUGIN_VAR_OPCMDARG|PLUGIN_VAR_READONLY, "Syntax: myisam-recover-options[=option[,option...]], where option can be " "DEFAULT, BACKUP, FORCE, QUICK, or OFF", NULL, NULL, 0, &myisam_recover_typelib); static MYSQL_THDVAR_ULONG(repair_threads, PLUGIN_VAR_RQCMDARG, "If larger than 1, when repairing a MyISAM table all indexes will be " "created in parallel, with one thread per index. The value of 1 " "disables parallel repair", NULL, NULL, 1, 1, ULONG_MAX, 1); static MYSQL_THDVAR_ULONGLONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG, "The buffer that is allocated when sorting the index when doing " "a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE", NULL, NULL, 8192 * 1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), SIZE_T_MAX, 1); static MYSQL_SYSVAR_BOOL(use_mmap, opt_myisam_use_mmap, PLUGIN_VAR_NOCMDARG, "Use memory mapping for reading and writing MyISAM tables", NULL, NULL, FALSE); static MYSQL_SYSVAR_ULONGLONG(mmap_size, myisam_mmap_size, PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_READONLY, "Restricts the total memory " "used for memory mapping of MySQL tables", NULL, NULL, SIZE_T_MAX, MEMMAP_EXTRA_MARGIN, SIZE_T_MAX, 1); static MYSQL_THDVAR_ENUM(stats_method, PLUGIN_VAR_RQCMDARG, "Specifies how MyISAM index statistics collection code should " "treat NULLs. Possible values of name are NULLS_UNEQUAL (default " "behavior for 4.1 and later), NULLS_EQUAL (emulate 4.0 behavior), " "and NULLS_IGNORED", NULL, NULL, MI_STATS_METHOD_NULLS_NOT_EQUAL, &myisam_stats_method_typelib); #ifndef DBUG_OFF /** Causes the thread to wait in a spin lock for a query kill signal. This function is used by the test frame work to identify race conditions. The signal is caught and ignored and the thread is not killed. */ static void debug_wait_for_kill(const char *info) { DBUG_ENTER("debug_wait_for_kill"); const char *prev_info; THD *thd; thd= current_thd; prev_info= thd_proc_info(thd, info); while(!thd->killed) my_sleep(1000); DBUG_PRINT("info", ("Exit debug_wait_for_kill")); thd_proc_info(thd, prev_info); DBUG_VOID_RETURN; } #endif /***************************************************************************** ** MyISAM tables *****************************************************************************/ static handler *myisam_create_handler(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root) { return new (mem_root) ha_myisam(hton, table); } // collect errors printed by mi_check routines static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, const char *fmt, va_list args) { THD* thd = (THD*)param->thd; Protocol *protocol= thd->protocol; size_t length, msg_length; char msgbuf[MI_MAX_MSG_BUF]; char name[NAME_LEN*2+2]; msg_length= my_vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); msgbuf[sizeof(msgbuf) - 1] = 0; // healthy paranoia DBUG_PRINT(msg_type,("message: %s",msgbuf)); if (!thd->vio_ok()) { sql_print_error("%s", msgbuf); return; } if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR | T_AUTO_REPAIR)) { my_message(ER_NOT_KEYFILE,msgbuf,MYF(MY_WME)); return; } length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) - name); /* TODO: switch from protocol to push_warning here. The main reason we didn't it yet is parallel repair. Due to following trace: mi_check_print_msg/push_warning/sql_alloc/my_pthread_getspecific_ptr. Also we likely need to lock mutex here (in both cases with protocol and push_warning). */ if (param->need_print_msg_lock) mysql_mutex_lock(&param->print_msg_mutex); protocol->prepare_for_resend(); protocol->store(name, length, system_charset_info); protocol->store(param->op_name, system_charset_info); protocol->store(msg_type, system_charset_info); protocol->store(msgbuf, msg_length, system_charset_info); if (protocol->write()) sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n", msgbuf); if (param->need_print_msg_lock) mysql_mutex_unlock(&param->print_msg_mutex); return; } /* Convert TABLE object to MyISAM key and column definition SYNOPSIS table2myisam() table_arg in TABLE object. keydef_out out MyISAM key definition. recinfo_out out MyISAM column definition. records_out out Number of fields. DESCRIPTION This function will allocate and initialize MyISAM key and column definition for further use in mi_create or for a check for underlying table conformance in merge engine. The caller needs to free *recinfo_out after use. Since *recinfo_out and *keydef_out are allocated with a my_multi_malloc, *keydef_out is freed automatically when *recinfo_out is freed. RETURN VALUE 0 OK !0 error code */ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, MI_COLUMNDEF **recinfo_out, uint *records_out) { uint i, j, recpos, minpos, fieldpos, temp_length, length; enum ha_base_keytype type= HA_KEYTYPE_BINARY; uchar *record; KEY *pos; MI_KEYDEF *keydef; MI_COLUMNDEF *recinfo, *recinfo_pos; HA_KEYSEG *keyseg; TABLE_SHARE *share= table_arg->s; uint options= share->db_options_in_use; DBUG_ENTER("table2myisam"); if (!(my_multi_malloc(MYF(MY_WME), recinfo_out, (share->fields * 2 + 2) * sizeof(MI_COLUMNDEF), keydef_out, share->keys * sizeof(MI_KEYDEF), &keyseg, (share->key_parts + share->keys) * sizeof(HA_KEYSEG), NullS))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* purecov: inspected */ keydef= *keydef_out; recinfo= *recinfo_out; pos= table_arg->key_info; for (i= 0; i < share->keys; i++, pos++) { keydef[i].flag= ((uint16) pos->flags & (HA_NOSAME | HA_FULLTEXT | HA_SPATIAL)); keydef[i].key_alg= pos->algorithm == HA_KEY_ALG_UNDEF ? (pos->flags & HA_SPATIAL ? HA_KEY_ALG_RTREE : HA_KEY_ALG_BTREE) : pos->algorithm; keydef[i].block_length= pos->block_size; keydef[i].seg= keyseg; keydef[i].keysegs= pos->user_defined_key_parts; for (j= 0; j < pos->user_defined_key_parts; j++) { Field *field= pos->key_part[j].field; type= field->key_type(); keydef[i].seg[j].flag= pos->key_part[j].key_part_flag; if (options & HA_OPTION_PACK_KEYS || (pos->flags & (HA_PACK_KEY | HA_BINARY_PACK_KEY | HA_SPACE_PACK_USED))) { if (pos->key_part[j].length > 8 && (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_NUM || (type == HA_KEYTYPE_BINARY && !field->zero_pack()))) { /* No blobs here */ if (j == 0) keydef[i].flag|= HA_PACK_KEY; if (!(field->flags & ZEROFILL_FLAG) && (field->type() == MYSQL_TYPE_STRING || field->type() == MYSQL_TYPE_VAR_STRING || ((int) (pos->key_part[j].length - field->decimals())) >= 4)) keydef[i].seg[j].flag|= HA_SPACE_PACK; } else if (j == 0 && (!(pos->flags & HA_NOSAME) || pos->key_length > 16)) keydef[i].flag|= HA_BINARY_PACK_KEY; } keydef[i].seg[j].type= (int) type; keydef[i].seg[j].start= pos->key_part[j].offset; keydef[i].seg[j].length= pos->key_part[j].length; keydef[i].seg[j].bit_start= keydef[i].seg[j].bit_end= keydef[i].seg[j].bit_length= 0; keydef[i].seg[j].bit_pos= 0; keydef[i].seg[j].language= field->charset_for_protocol()->number; if (field->real_maybe_null()) { keydef[i].seg[j].null_bit= field->null_bit; keydef[i].seg[j].null_pos= field->null_offset(); } else { keydef[i].seg[j].null_bit= 0; keydef[i].seg[j].null_pos= 0; } if (field->type() == MYSQL_TYPE_BLOB || field->type() == MYSQL_TYPE_GEOMETRY) { keydef[i].seg[j].flag|= HA_BLOB_PART; /* save number of bytes used to pack length */ keydef[i].seg[j].bit_start= (uint) (field->pack_length() - portable_sizeof_char_ptr); } else if (field->type() == MYSQL_TYPE_BIT) { keydef[i].seg[j].bit_length= ((Field_bit *) field)->bit_len; keydef[i].seg[j].bit_start= ((Field_bit *) field)->bit_ofs; keydef[i].seg[j].bit_pos= (uint) (((Field_bit *) field)->bit_ptr - (uchar*) table_arg->record[0]); } } keyseg+= pos->user_defined_key_parts; } if (table_arg->found_next_number_field) keydef[share->next_number_index].flag|= HA_AUTO_KEY; record= table_arg->record[0]; recpos= 0; recinfo_pos= recinfo; while (recpos < (uint) share->reclength) { Field **field, *found= 0; minpos= share->reclength; length= 0; for (field= table_arg->field; *field; field++) { if ((fieldpos= (*field)->offset(record)) >= recpos && fieldpos <= minpos) { /* skip null fields */ if (!(temp_length= (*field)->pack_length_in_rec())) continue; /* Skip null-fields */ if (! found || fieldpos < minpos || (fieldpos == minpos && temp_length < length)) { minpos= fieldpos; found= *field; length= temp_length; } } } DBUG_PRINT("loop", ("found: 0x%lx recpos: %d minpos: %d length: %d", (long) found, recpos, minpos, length)); if (recpos != minpos) { // Reserved space (Null bits?) memset(recinfo_pos, 0, sizeof(*recinfo_pos)); recinfo_pos->type= (int) FIELD_NORMAL; recinfo_pos++->length= (uint16) (minpos - recpos); } if (!found) break; if (found->flags & BLOB_FLAG) recinfo_pos->type= (int) FIELD_BLOB; else if (found->type() == MYSQL_TYPE_VARCHAR) recinfo_pos->type= FIELD_VARCHAR; else if (!(options & HA_OPTION_PACK_RECORD)) recinfo_pos->type= (int) FIELD_NORMAL; else if (found->zero_pack()) recinfo_pos->type= (int) FIELD_SKIP_ZERO; else recinfo_pos->type= (int) ((length <= 3 || (found->flags & ZEROFILL_FLAG)) ? FIELD_NORMAL : found->type() == MYSQL_TYPE_STRING || found->type() == MYSQL_TYPE_VAR_STRING ? FIELD_SKIP_ENDSPACE : FIELD_SKIP_PRESPACE); if (found->real_maybe_null()) { recinfo_pos->null_bit= found->null_bit; recinfo_pos->null_pos= found->null_offset(); } else { recinfo_pos->null_bit= 0; recinfo_pos->null_pos= 0; } (recinfo_pos++)->length= (uint16) length; recpos= minpos + length; DBUG_PRINT("loop", ("length: %d type: %d", recinfo_pos[-1].length,recinfo_pos[-1].type)); } *records_out= (uint) (recinfo_pos - recinfo); DBUG_RETURN(0); } /* Check for underlying table conformance SYNOPSIS check_definition() t1_keyinfo in First table key definition t1_recinfo in First table record definition t1_keys in Number of keys in first table t1_recs in Number of records in first table t2_keyinfo in Second table key definition t2_recinfo in Second table record definition t2_keys in Number of keys in second table t2_recs in Number of records in second table strict in Strict check switch table in handle to the table object DESCRIPTION This function compares two MyISAM definitions. By intention it was done to compare merge table definition against underlying table definition. It may also be used to compare dot-frm and MYI definitions of MyISAM table as well to compare different MyISAM table definitions. For merge table it is not required that number of keys in merge table must exactly match number of keys in underlying table. When calling this function for underlying table conformance check, 'strict' flag must be set to false, and converted merge definition must be passed as t1_*. Otherwise 'strict' flag must be set to 1 and it is not required to pass converted dot-frm definition as t1_*. For compatibility reasons we relax some checks, specifically: - 4.0 (and earlier versions) always set key_alg to 0. - 4.0 (and earlier versions) have the same language for all keysegs. RETURN VALUE 0 - Equal definitions. 1 - Different definitions. TODO - compare FULLTEXT keys; - compare SPATIAL keys; - compare FIELD_SKIP_ZERO which is converted to FIELD_NORMAL correctly (should be corretly detected in table2myisam). */ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo, uint t1_keys, uint t1_recs, MI_KEYDEF *t2_keyinfo, MI_COLUMNDEF *t2_recinfo, uint t2_keys, uint t2_recs, bool strict, TABLE *table_arg) { uint i, j; DBUG_ENTER("check_definition"); my_bool mysql_40_compat= table_arg && table_arg->s->frm_version < FRM_VER_TRUE_VARCHAR; if ((strict ? t1_keys != t2_keys : t1_keys > t2_keys)) { DBUG_PRINT("error", ("Number of keys differs: t1_keys=%u, t2_keys=%u", t1_keys, t2_keys)); DBUG_RETURN(1); } if (t1_recs != t2_recs) { DBUG_PRINT("error", ("Number of recs differs: t1_recs=%u, t2_recs=%u", t1_recs, t2_recs)); DBUG_RETURN(1); } for (i= 0; i < t1_keys; i++) { HA_KEYSEG *t1_keysegs= t1_keyinfo[i].seg; HA_KEYSEG *t2_keysegs= t2_keyinfo[i].seg; if (t1_keyinfo[i].flag & HA_FULLTEXT && t2_keyinfo[i].flag & HA_FULLTEXT) continue; else if (t1_keyinfo[i].flag & HA_FULLTEXT || t2_keyinfo[i].flag & HA_FULLTEXT) { DBUG_PRINT("error", ("Key %d has different definition", i)); DBUG_PRINT("error", ("t1_fulltext= %d, t2_fulltext=%d", test(t1_keyinfo[i].flag & HA_FULLTEXT), test(t2_keyinfo[i].flag & HA_FULLTEXT))); DBUG_RETURN(1); } if (t1_keyinfo[i].flag & HA_SPATIAL && t2_keyinfo[i].flag & HA_SPATIAL) continue; else if (t1_keyinfo[i].flag & HA_SPATIAL || t2_keyinfo[i].flag & HA_SPATIAL) { DBUG_PRINT("error", ("Key %d has different definition", i)); DBUG_PRINT("error", ("t1_spatial= %d, t2_spatial=%d", test(t1_keyinfo[i].flag & HA_SPATIAL), test(t2_keyinfo[i].flag & HA_SPATIAL))); DBUG_RETURN(1); } if ((!mysql_40_compat && t1_keyinfo[i].key_alg != t2_keyinfo[i].key_alg) || t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs) { DBUG_PRINT("error", ("Key %d has different definition", i)); DBUG_PRINT("error", ("t1_keysegs=%d, t1_key_alg=%d", t1_keyinfo[i].keysegs, t1_keyinfo[i].key_alg)); DBUG_PRINT("error", ("t2_keysegs=%d, t2_key_alg=%d", t2_keyinfo[i].keysegs, t2_keyinfo[i].key_alg)); DBUG_RETURN(1); } for (j= t1_keyinfo[i].keysegs; j--;) { uint8 t1_keysegs_j__type= t1_keysegs[j].type; /* Table migration from 4.1 to 5.1. In 5.1 a *TEXT key part is always HA_KEYTYPE_VARTEXT2. In 4.1 we had only the equivalent of HA_KEYTYPE_VARTEXT1. Since we treat both the same on MyISAM level, we can ignore a mismatch between these types. */ if ((t1_keysegs[j].flag & HA_BLOB_PART) && (t2_keysegs[j].flag & HA_BLOB_PART)) { if ((t1_keysegs_j__type == HA_KEYTYPE_VARTEXT2) && (t2_keysegs[j].type == HA_KEYTYPE_VARTEXT1)) t1_keysegs_j__type= HA_KEYTYPE_VARTEXT1; /* purecov: tested */ else if ((t1_keysegs_j__type == HA_KEYTYPE_VARBINARY2) && (t2_keysegs[j].type == HA_KEYTYPE_VARBINARY1)) t1_keysegs_j__type= HA_KEYTYPE_VARBINARY1; /* purecov: inspected */ } if ((!mysql_40_compat && t1_keysegs[j].language != t2_keysegs[j].language) || t1_keysegs_j__type != t2_keysegs[j].type || t1_keysegs[j].null_bit != t2_keysegs[j].null_bit || t1_keysegs[j].length != t2_keysegs[j].length || t1_keysegs[j].start != t2_keysegs[j].start) { DBUG_PRINT("error", ("Key segment %d (key %d) has different " "definition", j, i)); DBUG_PRINT("error", ("t1_type=%d, t1_language=%d, t1_null_bit=%d, " "t1_length=%d", t1_keysegs[j].type, t1_keysegs[j].language, t1_keysegs[j].null_bit, t1_keysegs[j].length)); DBUG_PRINT("error", ("t2_type=%d, t2_language=%d, t2_null_bit=%d, " "t2_length=%d", t2_keysegs[j].type, t2_keysegs[j].language, t2_keysegs[j].null_bit, t2_keysegs[j].length)); DBUG_RETURN(1); } } } for (i= 0; i < t1_recs; i++) { MI_COLUMNDEF *t1_rec= &t1_recinfo[i]; MI_COLUMNDEF *t2_rec= &t2_recinfo[i]; /* FIELD_SKIP_ZERO can be changed to FIELD_NORMAL in mi_create, see NOTE1 in mi_create.c */ if ((t1_rec->type != t2_rec->type && !(t1_rec->type == (int) FIELD_SKIP_ZERO && t1_rec->length == 1 && t2_rec->type == (int) FIELD_NORMAL)) || t1_rec->length != t2_rec->length || t1_rec->null_bit != t2_rec->null_bit) { DBUG_PRINT("error", ("Field %d has different definition", i)); DBUG_PRINT("error", ("t1_type=%d, t1_length=%d, t1_null_bit=%d", t1_rec->type, t1_rec->length, t1_rec->null_bit)); DBUG_PRINT("error", ("t2_type=%d, t2_length=%d, t2_null_bit=%d", t2_rec->type, t2_rec->length, t2_rec->null_bit)); DBUG_RETURN(1); } } DBUG_RETURN(0); } extern "C" { volatile int *killed_ptr(MI_CHECK *param) { /* In theory Unsafe conversion, but should be ok for now */ return (int*) &(((THD *)(param->thd))->killed); } void mi_check_print_error(MI_CHECK *param, const char *fmt,...) { param->error_printed|=1; param->out_flag|= O_DATA_LOST; va_list args; va_start(args, fmt); mi_check_print_msg(param, "error", fmt, args); va_end(args); } void mi_check_print_info(MI_CHECK *param, const char *fmt,...) { va_list args; va_start(args, fmt); mi_check_print_msg(param, "info", fmt, args); va_end(args); } void mi_check_print_warning(MI_CHECK *param, const char *fmt,...) { param->warning_printed=1; param->out_flag|= O_DATA_LOST; va_list args; va_start(args, fmt); mi_check_print_msg(param, "warning", fmt, args); va_end(args); } /** Report list of threads (and queries) accessing a table, thread_id of a thread that detected corruption, ource file name and line number where this corruption was detected, optional extra information (string). This function is intended to be used when table corruption is detected. @param[in] file MI_INFO object. @param[in] message Optional error message. @param[in] sfile Name of source file. @param[in] sline Line number in source file. @return void */ void _mi_report_crashed(MI_INFO *file, const char *message, const char *sfile, uint sline) { THD *cur_thd; LIST *element; char buf[1024]; mysql_mutex_lock(&file->s->intern_lock); if ((cur_thd= (THD*) file->in_use.data)) sql_print_error("Got an error from thread_id=%lu, %s:%d", cur_thd->thread_id, sfile, sline); else sql_print_error("Got an error from unknown thread, %s:%d", sfile, sline); if (message) sql_print_error("%s", message); for (element= file->s->in_use; element; element= list_rest(element)) { THD *thd= (THD*) element->data; sql_print_error("%s", thd ? thd_security_context(thd, buf, sizeof(buf), 0) : "Unknown thread accessing table"); } mysql_mutex_unlock(&file->s->intern_lock); } } ha_myisam::ha_myisam(handlerton *hton, TABLE_SHARE *table_arg) :handler(hton, table_arg), file(0), int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_FILE_BASED | HA_CAN_GEOMETRY | HA_NO_TRANSACTIONS | HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS | HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT | HA_CAN_REPAIR), can_enable_indexes(1) {} handler *ha_myisam::clone(const char *name, MEM_ROOT *mem_root) { ha_myisam *new_handler= static_cast <ha_myisam *>(handler::clone(name, mem_root)); if (new_handler) new_handler->file->state= file->state; return new_handler; } static const char *ha_myisam_exts[] = { ".MYI", ".MYD", NullS }; const char **ha_myisam::bas_ext() const { return ha_myisam_exts; } /** @brief Check if the given db.tablename is a system table for this SE. @param db Database name to check. @param table_name table name to check. @param is_sql_layer_system_table if the supplied db.table_name is a SQL layer system table. @note Currently, only MYISAM engine supports all the SQL layer system tables, and hence it returns true, when is_sql_layer_system_table is set. @note In case there is a need to define MYISAM specific system database, then please see reference implementation in ha_example.cc. @return @retval TRUE Given db.table_name is supported system table. @retval FALSE Given db.table_name is not a supported system table. */ static bool myisam_is_supported_system_table(const char *db, const char *table_name, bool is_sql_layer_system_table) { // Does MYISAM support "ALL" SQL layer system tables ? if (is_sql_layer_system_table) return true; /* Currently MYISAM does not support any other SE specific system tables. If in future it does, please see ha_example.cc for reference implementation */ return false; } const char *ha_myisam::index_type(uint key_number) { return ((table->key_info[key_number].flags & HA_FULLTEXT) ? "FULLTEXT" : (table->key_info[key_number].flags & HA_SPATIAL) ? "SPATIAL" : (table->key_info[key_number].algorithm == HA_KEY_ALG_RTREE) ? "RTREE" : "BTREE"); } /* Name is here without an extension */ int ha_myisam::open(const char *name, int mode, uint test_if_locked) { MI_KEYDEF *keyinfo; MI_COLUMNDEF *recinfo= 0; uint recs; uint i; /* If the user wants to have memory mapped data files, add an open_flag. Do not memory map temporary tables because they are expected to be inserted and thus extended a lot. Memory mapping is efficient for files that keep their size, but very inefficient for growing files. Using an open_flag instead of calling mi_extra(... HA_EXTRA_MMAP ...) after mi_open() has the advantage that the mapping is not repeated for every open, but just done on the initial open, when the MyISAM share is created. Everytime the server requires to open a new instance of a table it calls this method. We will always supply HA_OPEN_MMAP for a permanent table. However, the MyISAM storage engine will ignore this flag if this is a secondary open of a table that is in use by other threads already (if the MyISAM share exists already). */ if (!(test_if_locked & HA_OPEN_TMP_TABLE) && opt_myisam_use_mmap) test_if_locked|= HA_OPEN_MMAP; if (!(file=mi_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER))) return (my_errno ? my_errno : -1); if (!table->s->tmp_table) /* No need to perform a check for tmp table */ { if ((my_errno= table2myisam(table, &keyinfo, &recinfo, &recs))) { /* purecov: begin inspected */ DBUG_PRINT("error", ("Failed to convert TABLE object to MyISAM " "key and column definition")); goto err; /* purecov: end */ } if (check_definition(keyinfo, recinfo, table->s->keys, recs, file->s->keyinfo, file->s->rec, file->s->base.keys, file->s->base.fields, true, table)) { /* purecov: begin inspected */ my_errno= HA_ERR_CRASHED; goto err; /* purecov: end */ } } if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE)) (void) mi_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0); info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED)) (void) mi_extra(file, HA_EXTRA_WAIT_LOCK, 0); if (!table->s->db_record_offset) int_table_flags|=HA_REC_NOT_IN_SEQ; if (file->s->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD)) int_table_flags|=HA_HAS_CHECKSUM; for (i= 0; i < table->s->keys; i++) { plugin_ref parser= table->key_info[i].parser; if (table->key_info[i].flags & HA_USES_PARSER) file->s->keyinfo[i].parser= (struct st_mysql_ftparser *)plugin_decl(parser)->info; table->key_info[i].block_size= file->s->keyinfo[i].block_length; } my_errno= 0; goto end; err: this->close(); end: /* Both recinfo and keydef are allocated by my_multi_malloc(), thus only recinfo must be freed. */ if (recinfo) my_free(recinfo); return my_errno; } int ha_myisam::close(void) { MI_INFO *tmp=file; file=0; return mi_close(tmp); } int ha_myisam::write_row(uchar *buf) { ha_statistic_increment(&SSV::ha_write_count); /* If we have an auto_increment column and we are writing a changed row or a new row, then update the auto_increment value in the record. */ if (table->next_number_field && buf == table->record[0]) { int error; if ((error= update_auto_increment())) return error; } return mi_write(file,buf); } int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt) { if (!file) return HA_ADMIN_INTERNAL_ERROR; int error; MI_CHECK param; MYISAM_SHARE* share = file->s; const char *old_proc_info=thd->proc_info; thd_proc_info(thd, "Checking table"); myisamchk_init(&param); param.thd = thd; param.op_name = "check"; param.db_name= table->s->db.str; param.table_name= table->alias; param.testflag = check_opt->flags | T_CHECK | T_SILENT; param.stats_method= (enum_mi_stats_method)THDVAR(thd, stats_method); if (!(table->db_stat & HA_READ_ONLY)) param.testflag|= T_STATISTICS; param.using_global_keycache = 1; if (!mi_is_crashed(file) && (((param.testflag & T_CHECK_ONLY_CHANGED) && !(share->state.changed & (STATE_CHANGED | STATE_CRASHED | STATE_CRASHED_ON_REPAIR)) && share->state.open_count == 0) || ((param.testflag & T_FAST) && (share->state.open_count == (uint) (share->global_changed ? 1 : 0))))) return HA_ADMIN_ALREADY_DONE; error = chk_status(&param, file); // Not fatal error = chk_size(&param, file); if (!error) error |= chk_del(&param, file, param.testflag); if (!error) error = chk_key(&param, file); if (!error) { if ((!(param.testflag & T_QUICK) && ((share->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) || (param.testflag & (T_EXTEND | T_MEDIUM)))) || mi_is_crashed(file)) { uint old_testflag=param.testflag; param.testflag|=T_MEDIUM; if (!(error= init_io_cache(&param.read_cache, file->dfile, my_default_record_cache_size, READ_CACHE, share->pack.header_length, 1, MYF(MY_WME)))) { error= chk_data_link(&param, file, param.testflag & T_EXTEND); end_io_cache(&(param.read_cache)); } param.testflag= old_testflag; } } if (!error) { if ((share->state.changed & (STATE_CHANGED | STATE_CRASHED_ON_REPAIR | STATE_CRASHED | STATE_NOT_ANALYZED)) || (param.testflag & T_STATISTICS) || mi_is_crashed(file)) { file->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; mysql_mutex_lock(&share->intern_lock); share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED | STATE_CRASHED_ON_REPAIR); if (!(table->db_stat & HA_READ_ONLY)) error=update_state_info(&param,file,UPDATE_TIME | UPDATE_OPEN_COUNT | UPDATE_STAT); mysql_mutex_unlock(&share->intern_lock); info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE | HA_STATUS_CONST); } } else if (!mi_is_crashed(file) && !thd->killed) { mi_mark_crashed(file); file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; } thd_proc_info(thd, old_proc_info); return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK; } /* analyze the key distribution in the table As the table may be only locked for read, we have to take into account that two threads may do an analyze at the same time! */ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt) { int error=0; MI_CHECK param; MYISAM_SHARE* share = file->s; myisamchk_init(&param); param.thd = thd; param.op_name= "analyze"; param.db_name= table->s->db.str; param.table_name= table->alias; param.testflag= (T_FAST | T_CHECK | T_SILENT | T_STATISTICS | T_DONT_CHECK_CHECKSUM); param.using_global_keycache = 1; param.stats_method= (enum_mi_stats_method)THDVAR(thd, stats_method); if (!(share->state.changed & STATE_NOT_ANALYZED)) return HA_ADMIN_ALREADY_DONE; error = chk_key(&param, file); if (!error) { mysql_mutex_lock(&share->intern_lock); error=update_state_info(&param,file,UPDATE_STAT); mysql_mutex_unlock(&share->intern_lock); } else if (!mi_is_crashed(file) && !thd->killed) mi_mark_crashed(file); return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK; } int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) { int error; MI_CHECK param; ha_rows start_records; if (!file) return HA_ADMIN_INTERNAL_ERROR; myisamchk_init(&param); param.thd = thd; param.op_name= "repair"; param.testflag= ((check_opt->flags & ~(T_EXTEND)) | T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM | (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT)); param.sort_buffer_length= THDVAR(thd, sort_buffer_size); start_records=file->state->records; while ((error=repair(thd,param,0)) && param.retry_repair) { param.retry_repair=0; if (test_all_bits(param.testflag, (uint) (T_RETRY_WITHOUT_QUICK | T_QUICK))) { param.testflag&= ~T_RETRY_WITHOUT_QUICK; sql_print_information("Retrying repair of: '%s' without quick", table->s->path.str); continue; } param.testflag&= ~T_QUICK; if ((param.testflag & T_REP_BY_SORT)) { param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP; sql_print_information("Retrying repair of: '%s' with keycache", table->s->path.str); continue; } break; } if (!error && start_records != file->state->records && !(check_opt->flags & T_VERY_SILENT)) { char llbuff[22],llbuff2[22]; sql_print_information("Found %s of %s rows when repairing '%s'", llstr(file->state->records, llbuff), llstr(start_records, llbuff2), table->s->path.str); } return error; } int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt) { int error; if (!file) return HA_ADMIN_INTERNAL_ERROR; MI_CHECK param; myisamchk_init(&param); param.thd = thd; param.op_name= "optimize"; param.testflag= (check_opt->flags | T_SILENT | T_FORCE_CREATE | T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX); param.sort_buffer_length= THDVAR(thd, sort_buffer_size); if ((error= repair(thd,param,1)) && param.retry_repair) { sql_print_warning("Warning: Optimize table got errno %d on %s.%s, retrying", my_errno, param.db_name, param.table_name); param.testflag&= ~T_REP_BY_SORT; error= repair(thd,param,1); } return error; } int ha_myisam::repair(THD *thd, MI_CHECK &param, bool do_optimize) { int error=0; uint local_testflag=param.testflag; bool optimize_done= !do_optimize, statistics_done=0; bool has_old_locks= thd->locked_tables_mode || file->lock_type != F_UNLCK; const char *old_proc_info=thd->proc_info; char fixed_name[FN_REFLEN]; MYISAM_SHARE* share = file->s; ha_rows rows= file->state->records; DBUG_ENTER("ha_myisam::repair"); param.db_name= table->s->db.str; param.table_name= table->alias; param.tmpfile_createflag = O_RDWR | O_TRUNC; param.using_global_keycache = 1; param.thd= thd; param.tmpdir= &mysql_tmpdir_list; param.out_flag= 0; strmov(fixed_name,file->filename); // Release latches since this can take a long time ha_release_temporary_latches(thd); // Don't lock tables if we have used LOCK TABLE or already locked. if (!has_old_locks && mi_lock_database(file, table->s->tmp_table ? F_EXTRA_LCK : F_WRLCK)) { char errbuf[MYSYS_STRERROR_SIZE]; mi_check_print_error(&param, ER(ER_CANT_LOCK), my_errno, my_strerror(errbuf, sizeof(errbuf), my_errno)); DBUG_RETURN(HA_ADMIN_FAILED); } if (!do_optimize || ((file->state->del || share->state.split != file->state->records) && (!(param.testflag & T_QUICK) || !(share->state.changed & STATE_NOT_OPTIMIZED_KEYS)))) { ulonglong key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ? mi_get_mask_all_keys_active(share->base.keys) : share->state.key_map); uint testflag=param.testflag; #ifdef HAVE_MMAP bool remap= test(share->file_map); /* mi_repair*() functions family use file I/O even if memory mapping is available. Since mixing mmap I/O and file I/O may cause various artifacts, memory mapping must be disabled. */ if (remap) mi_munmap_file(file); #endif if (mi_test_if_sort_rep(file,file->state->records,key_map,0) && (local_testflag & T_REP_BY_SORT)) { local_testflag|= T_STATISTICS; param.testflag|= T_STATISTICS; // We get this for free statistics_done=1; if (THDVAR(thd, repair_threads)>1) { char buf[40]; /* TODO: respect myisam_repair_threads variable */ my_snprintf(buf, 40, "Repair with %d threads", my_count_bits(key_map)); thd_proc_info(thd, buf); error = mi_repair_parallel(&param, file, fixed_name, param.testflag & T_QUICK); thd_proc_info(thd, "Repair done"); // to reset proc_info, as // it was pointing to local buffer } else { thd_proc_info(thd, "Repair by sorting"); error = mi_repair_by_sort(&param, file, fixed_name, param.testflag & T_QUICK); } } else { thd_proc_info(thd, "Repair with keycache"); param.testflag &= ~T_REP_BY_SORT; error= mi_repair(&param, file, fixed_name, param.testflag & T_QUICK); } #ifdef HAVE_MMAP if (remap) mi_dynmap_file(file, file->state->data_file_length); #endif param.testflag=testflag; optimize_done=1; } if (!error) { if ((local_testflag & T_SORT_INDEX) && (share->state.changed & STATE_NOT_SORTED_PAGES)) { optimize_done=1; thd_proc_info(thd, "Sorting index"); error=mi_sort_index(&param,file,fixed_name); } if (!statistics_done && (local_testflag & T_STATISTICS)) { if (share->state.changed & STATE_NOT_ANALYZED) { optimize_done=1; thd_proc_info(thd, "Analyzing"); error = chk_key(&param, file); } else local_testflag&= ~T_STATISTICS; // Don't update statistics } } thd_proc_info(thd, "Saving state"); if (!error) { if ((share->state.changed & STATE_CHANGED) || mi_is_crashed(file)) { share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED | STATE_CRASHED_ON_REPAIR); file->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; } /* the following 'if', thought conceptually wrong, is a useful optimization nevertheless. */ if (file->state != &file->s->state.state) file->s->state.state = *file->state; if (file->s->base.auto_key) update_auto_increment_key(&param, file, 1); if (optimize_done) error = update_state_info(&param, file, UPDATE_TIME | UPDATE_OPEN_COUNT | (local_testflag & T_STATISTICS ? UPDATE_STAT : 0)); info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE | HA_STATUS_CONST); if (rows != file->state->records && ! (param.testflag & T_VERY_SILENT)) { char llbuff[22],llbuff2[22]; mi_check_print_warning(&param,"Number of rows changed from %s to %s", llstr(rows,llbuff), llstr(file->state->records,llbuff2)); } } else { mi_mark_crashed_on_repair(file); file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; update_state_info(&param, file, 0); } thd_proc_info(thd, old_proc_info); if (!has_old_locks) mi_lock_database(file,F_UNLCK); DBUG_RETURN(error ? HA_ADMIN_FAILED : !optimize_done ? HA_ADMIN_ALREADY_DONE : HA_ADMIN_OK); } /* Assign table indexes to a specific key cache. */ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt) { KEY_CACHE *new_key_cache= check_opt->key_cache; const char *errmsg= 0; int error= HA_ADMIN_OK; ulonglong map; TABLE_LIST *table_list= table->pos_in_table_list; DBUG_ENTER("ha_myisam::assign_to_keycache"); table->keys_in_use_for_query.clear_all(); if (table_list->process_index_hints(table)) DBUG_RETURN(HA_ADMIN_FAILED); map= ~(ulonglong) 0; if (!table->keys_in_use_for_query.is_clear_all()) /* use all keys if there's no list specified by the user through hints */ map= table->keys_in_use_for_query.to_ulonglong(); if ((error= mi_assign_to_key_cache(file, map, new_key_cache))) { char buf[STRING_BUFFER_USUAL_SIZE]; my_snprintf(buf, sizeof(buf), "Failed to flush to index file (errno: %d)", error); errmsg= buf; error= HA_ADMIN_CORRUPT; } if (error != HA_ADMIN_OK) { /* Send error to user */ MI_CHECK param; myisamchk_init(&param); param.thd= thd; param.op_name= "assign_to_keycache"; param.db_name= table->s->db.str; param.table_name= table->s->table_name.str; param.testflag= 0; mi_check_print_error(&param, errmsg); } DBUG_RETURN(error); } /* Preload pages of the index file for a table into the key cache. */ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) { int error; const char *errmsg; ulonglong map; TABLE_LIST *table_list= table->pos_in_table_list; my_bool ignore_leaves= table_list->ignore_leaves; char buf[MYSQL_ERRMSG_SIZE]; DBUG_ENTER("ha_myisam::preload_keys"); table->keys_in_use_for_query.clear_all(); if (table_list->process_index_hints(table)) DBUG_RETURN(HA_ADMIN_FAILED); map= ~(ulonglong) 0; /* Check validity of the index references */ if (!table->keys_in_use_for_query.is_clear_all()) /* use all keys if there's no list specified by the user through hints */ map= table->keys_in_use_for_query.to_ulonglong(); mi_extra(file, HA_EXTRA_PRELOAD_BUFFER_SIZE, (void *) &thd->variables.preload_buff_size); if ((error= mi_preload(file, map, ignore_leaves))) { switch (error) { case HA_ERR_NON_UNIQUE_BLOCK_SIZE: errmsg= "Indexes use different block sizes"; break; case HA_ERR_OUT_OF_MEM: errmsg= "Failed to allocate buffer"; break; default: my_snprintf(buf, sizeof(buf), "Failed to read from index file (errno: %d)", my_errno); errmsg= buf; } error= HA_ADMIN_FAILED; goto err; } DBUG_RETURN(HA_ADMIN_OK); err: { MI_CHECK param; myisamchk_init(&param); param.thd= thd; param.op_name= "preload_keys"; param.db_name= table->s->db.str; param.table_name= table->s->table_name.str; param.testflag= 0; mi_check_print_error(&param, errmsg); DBUG_RETURN(error); } } /* Disable indexes, making it persistent if requested. SYNOPSIS disable_indexes() mode mode of operation: HA_KEY_SWITCH_NONUNIQ disable all non-unique keys HA_KEY_SWITCH_ALL disable all keys HA_KEY_SWITCH_NONUNIQ_SAVE dis. non-uni. and make persistent HA_KEY_SWITCH_ALL_SAVE dis. all keys and make persistent IMPLEMENTATION HA_KEY_SWITCH_NONUNIQ is not implemented. HA_KEY_SWITCH_ALL_SAVE is not implemented. RETURN 0 ok HA_ERR_WRONG_COMMAND mode not implemented. */ int ha_myisam::disable_indexes(uint mode) { int error; if (mode == HA_KEY_SWITCH_ALL) { /* call a storage engine function to switch the key map */ error= mi_disable_indexes(file); } else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE) { mi_extra(file, HA_EXTRA_NO_KEYS, 0); info(HA_STATUS_CONST); // Read new key info error= 0; } else { /* mode not implemented */ error= HA_ERR_WRONG_COMMAND; } return error; } /* Enable indexes, making it persistent if requested. SYNOPSIS enable_indexes() mode mode of operation: HA_KEY_SWITCH_NONUNIQ enable all non-unique keys HA_KEY_SWITCH_ALL enable all keys HA_KEY_SWITCH_NONUNIQ_SAVE en. non-uni. and make persistent HA_KEY_SWITCH_ALL_SAVE en. all keys and make persistent DESCRIPTION Enable indexes, which might have been disabled by disable_index() before. The modes without _SAVE work only if both data and indexes are empty, since the MyISAM repair would enable them persistently. To be sure in these cases, call handler::delete_all_rows() before. IMPLEMENTATION HA_KEY_SWITCH_NONUNIQ is not implemented. HA_KEY_SWITCH_ALL_SAVE is not implemented. RETURN 0 ok !=0 Error, among others: HA_ERR_CRASHED data or index is non-empty. Delete all rows and retry. HA_ERR_WRONG_COMMAND mode not implemented. */ int ha_myisam::enable_indexes(uint mode) { int error; DBUG_EXECUTE_IF("wait_in_enable_indexes", debug_wait_for_kill("wait_in_enable_indexes"); ); if (mi_is_all_keys_active(file->s->state.key_map, file->s->base.keys)) { /* All indexes are enabled already. */ return 0; } if (mode == HA_KEY_SWITCH_ALL) { error= mi_enable_indexes(file); /* Do not try to repair on error, as this could make the enabled state persistent, but mode==HA_KEY_SWITCH_ALL forbids it. */ } else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE) { THD *thd=current_thd; MI_CHECK param; const char *save_proc_info=thd->proc_info; thd_proc_info(thd, "Creating index"); myisamchk_init(&param); param.op_name= "recreating_index"; param.testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK | T_CREATE_MISSING_KEYS); param.myf_rw&= ~MY_WAIT_IF_FULL; param.sort_buffer_length= THDVAR(thd, sort_buffer_size); param.stats_method= (enum_mi_stats_method)THDVAR(thd, stats_method); param.tmpdir=&mysql_tmpdir_list; if ((error= (repair(thd,param,0) != HA_ADMIN_OK)) && param.retry_repair) { sql_print_warning("Warning: Enabling keys got errno %d on %s.%s, retrying", my_errno, param.db_name, param.table_name); /* Repairing by sort failed. Now try standard repair method. Still we want to fix only index file. If data file corruption was detected (T_RETRY_WITHOUT_QUICK), we shouldn't do much here. Let implicit repair do this job. */ if (!(param.testflag & T_RETRY_WITHOUT_QUICK)) { param.testflag&= ~T_REP_BY_SORT; error= (repair(thd,param,0) != HA_ADMIN_OK); } /* If the standard repair succeeded, clear all error messages which might have been set by the first repair. They can still be seen with SHOW WARNINGS then. */ if (! error) thd->clear_error(); } info(HA_STATUS_CONST); thd_proc_info(thd, save_proc_info); } else { /* mode not implemented */ error= HA_ERR_WRONG_COMMAND; } return error; } /* Test if indexes are disabled. SYNOPSIS indexes_are_disabled() no parameters RETURN 0 indexes are not disabled 1 all indexes are disabled [2 non-unique indexes are disabled - NOT YET IMPLEMENTED] */ int ha_myisam::indexes_are_disabled(void) { return mi_indexes_are_disabled(file); } /* prepare for a many-rows insert operation e.g. - disable indexes (if they can be recreated fast) or activate special bulk-insert optimizations SYNOPSIS start_bulk_insert(rows) rows Rows to be inserted 0 if we don't know NOTICE Do not forget to call end_bulk_insert() later! */ void ha_myisam::start_bulk_insert(ha_rows rows) { DBUG_ENTER("ha_myisam::start_bulk_insert"); THD *thd= current_thd; ulong size= min(thd->variables.read_buff_size, (ulong) (table->s->avg_row_length*rows)); DBUG_PRINT("info",("start_bulk_insert: rows %lu size %lu", (ulong) rows, size)); /* don't enable row cache if too few rows */ if (! rows || (rows > MI_MIN_ROWS_TO_USE_WRITE_CACHE)) mi_extra(file, HA_EXTRA_WRITE_CACHE, (void*) &size); can_enable_indexes= mi_is_all_keys_active(file->s->state.key_map, file->s->base.keys); /* Only disable old index if the table was empty and we are inserting a lot of rows. Note that in end_bulk_insert() we may truncate the table if enable_indexes() failed, thus it's essential that indexes are disabled ONLY for an empty table. */ if (file->state->records == 0 && can_enable_indexes && (!rows || rows >= MI_MIN_ROWS_TO_DISABLE_INDEXES)) mi_disable_non_unique_index(file,rows); else if (!file->bulk_insert && (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT)) { mi_init_bulk_insert(file, thd->variables.bulk_insert_buff_size, rows); } DBUG_VOID_RETURN; } /* end special bulk-insert optimizations, which have been activated by start_bulk_insert(). SYNOPSIS end_bulk_insert() no arguments RETURN 0 OK != 0 Error */ int ha_myisam::end_bulk_insert() { mi_end_bulk_insert(file); int err=mi_extra(file, HA_EXTRA_NO_CACHE, 0); if (!err) { if (can_enable_indexes) { /* Truncate the table when enable index operation is killed. After truncating the table we don't need to enable the indexes, because the last repair operation is aborted after setting the indexes as active and trying to recreate them. */ if (((err= enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE)) != 0) && current_thd->killed) { delete_all_rows(); /* not crashed, despite being killed during repair */ file->s->state.changed&= ~(STATE_CRASHED|STATE_CRASHED_ON_REPAIR); } } } return err; } bool ha_myisam::check_and_repair(THD *thd) { int error=0; int marked_crashed; HA_CHECK_OPT check_opt; DBUG_ENTER("ha_myisam::check_and_repair"); check_opt.init(); check_opt.flags= T_MEDIUM | T_AUTO_REPAIR; // Don't use quick if deleted rows if (!file->state->del && (myisam_recover_options & HA_RECOVER_QUICK)) check_opt.flags|=T_QUICK; sql_print_warning("Checking table: '%s'",table->s->path.str); const CSET_STRING query_backup= thd->query_string; thd->set_query(table->s->table_name.str, (uint) table->s->table_name.length, system_charset_info); if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt)) { sql_print_warning("Recovering table: '%s'",table->s->path.str); check_opt.flags= ((myisam_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) | (marked_crashed ? 0 : T_QUICK) | (myisam_recover_options & HA_RECOVER_FORCE ? 0 : T_SAFE_REPAIR) | T_AUTO_REPAIR); if (repair(thd, &check_opt)) error=1; } thd->set_query(query_backup); DBUG_RETURN(error); } bool ha_myisam::is_crashed() const { return (file->s->state.changed & STATE_CRASHED || (my_disable_locking && file->s->state.open_count)); } int ha_myisam::update_row(const uchar *old_data, uchar *new_data) { ha_statistic_increment(&SSV::ha_update_count); return mi_update(file,old_data,new_data); } int ha_myisam::delete_row(const uchar *buf) { ha_statistic_increment(&SSV::ha_delete_count); return mi_delete(file,buf); } C_MODE_START ICP_RESULT index_cond_func_myisam(void *arg) { ha_myisam *h= (ha_myisam*)arg; if (h->end_range && h->compare_key_icp(h->end_range) > 0) return ICP_OUT_OF_RANGE; /* caller should return HA_ERR_END_OF_FILE already */ return (ICP_RESULT) test(h->pushed_idx_cond->val_int()); } C_MODE_END int ha_myisam::index_init(uint idx, bool sorted) { active_index=idx; if (pushed_idx_cond_keyno == idx) mi_set_index_cond_func(file, index_cond_func_myisam, this); return 0; } int ha_myisam::index_end() { active_index=MAX_KEY; //pushed_idx_cond_keyno= MAX_KEY; mi_set_index_cond_func(file, NULL, 0); in_range_check_pushed_down= FALSE; ds_mrr.dsmrr_close(); return 0; } int ha_myisam::rnd_end() { ds_mrr.dsmrr_close(); return 0; } int ha_myisam::index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str); DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_key_count); int error=mi_rkey(file, buf, active_index, key, keypart_map, find_flag); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_INDEX_READ_ROW_DONE(error); return error; } int ha_myisam::index_read_idx_map(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { DBUG_ASSERT(pushed_idx_cond == NULL); DBUG_ASSERT(pushed_idx_cond_keyno == MAX_KEY); MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str); ha_statistic_increment(&SSV::ha_read_key_count); int error=mi_rkey(file, buf, index, key, keypart_map, find_flag); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_INDEX_READ_ROW_DONE(error); return error; } int ha_myisam::index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map) { MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str); DBUG_ENTER("ha_myisam::index_read_last"); DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_key_count); int error=mi_rkey(file, buf, active_index, key, keypart_map, HA_READ_PREFIX_LAST); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_INDEX_READ_ROW_DONE(error); DBUG_RETURN(error); } int ha_myisam::index_next(uchar *buf) { MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str); DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_next_count); int error=mi_rnext(file,buf,active_index); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_INDEX_READ_ROW_DONE(error); return error; } int ha_myisam::index_prev(uchar *buf) { MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str); DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_prev_count); int error=mi_rprev(file,buf, active_index); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_INDEX_READ_ROW_DONE(error); return error; } int ha_myisam::index_first(uchar *buf) { MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str); DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_first_count); int error=mi_rfirst(file, buf, active_index); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_INDEX_READ_ROW_DONE(error); return error; } int ha_myisam::index_last(uchar *buf) { MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str); DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_last_count); int error=mi_rlast(file, buf, active_index); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_INDEX_READ_ROW_DONE(error); return error; } int ha_myisam::index_next_same(uchar *buf, const uchar *key __attribute__((unused)), uint length __attribute__((unused))) { int error; DBUG_ASSERT(inited==INDEX); MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str); ha_statistic_increment(&SSV::ha_read_next_count); do { error= mi_rnext_same(file,buf); } while (error == HA_ERR_RECORD_DELETED); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_INDEX_READ_ROW_DONE(error); return error; } int ha_myisam::rnd_init(bool scan) { if (scan) return mi_scan_init(file); return mi_reset(file); // Free buffers } int ha_myisam::rnd_next(uchar *buf) { MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str, TRUE); ha_statistic_increment(&SSV::ha_read_rnd_next_count); int error=mi_scan(file, buf); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_READ_ROW_DONE(error); return error; } int ha_myisam::restart_rnd_next(uchar *buf, uchar *pos) { return rnd_pos(buf,pos); } int ha_myisam::rnd_pos(uchar *buf, uchar *pos) { MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str, FALSE); ha_statistic_increment(&SSV::ha_read_rnd_count); int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length)); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_READ_ROW_DONE(error); return error; } void ha_myisam::position(const uchar *record) { my_off_t row_position= mi_position(file); my_store_ptr(ref, ref_length, row_position); } int ha_myisam::info(uint flag) { MI_ISAMINFO misam_info; char name_buff[FN_REFLEN]; (void) mi_status(file,&misam_info,flag); if (flag & HA_STATUS_VARIABLE) { stats.records= misam_info.records; stats.deleted= misam_info.deleted; stats.data_file_length= misam_info.data_file_length; stats.index_file_length= misam_info.index_file_length; stats.delete_length= misam_info.delete_length; stats.check_time= (ulong) misam_info.check_time; stats.mean_rec_length= misam_info.mean_reclength; } if (flag & HA_STATUS_CONST) { TABLE_SHARE *share= table->s; stats.max_data_file_length= misam_info.max_data_file_length; stats.max_index_file_length= misam_info.max_index_file_length; stats.create_time= misam_info.create_time; /* We want the value of stats.mrr_length_per_rec to be platform independent. The size of the chunk at the end of the join buffer used for MRR needs is calculated now basing on the values passed in the stats structure. The remaining part of the join buffer is used for records. A different number of records in the buffer results in a different number of buffer refills and in a different order of records in the result set. */ stats.mrr_length_per_rec= misam_info.reflength + 8; // 8=max(sizeof(void *)) ref_length= misam_info.reflength; share->db_options_in_use= misam_info.options; stats.block_size= myisam_block_size; /* record block size */ /* Update share. lock_shared_ha_data is slighly abused here, since there is no other way of locking the TABLE_SHARE. */ lock_shared_ha_data(); share->keys_in_use.set_prefix(share->keys); share->keys_in_use.intersect_extended(misam_info.key_map); share->keys_for_keyread.intersect(share->keys_in_use); share->db_record_offset= misam_info.record_offset; unlock_shared_ha_data(); if (share->key_parts) memcpy((char*) table->key_info[0].rec_per_key, (char*) misam_info.rec_per_key, sizeof(table->key_info[0].rec_per_key[0])*share->key_parts); /* Set data_file_name and index_file_name to point at the symlink value if table is symlinked (Ie; Real name is not same as generated name) */ data_file_name= index_file_name= 0; fn_format(name_buff, file->filename, "", MI_NAME_DEXT, MY_APPEND_EXT | MY_UNPACK_FILENAME); if (strcmp(name_buff, misam_info.data_file_name)) data_file_name=misam_info.data_file_name; fn_format(name_buff, file->filename, "", MI_NAME_IEXT, MY_APPEND_EXT | MY_UNPACK_FILENAME); if (strcmp(name_buff, misam_info.index_file_name)) index_file_name=misam_info.index_file_name; } if (flag & HA_STATUS_ERRKEY) { errkey = misam_info.errkey; my_store_ptr(dup_ref, ref_length, misam_info.dupp_key_pos); } if (flag & HA_STATUS_TIME) stats.update_time = (ulong) misam_info.update_time; if (flag & HA_STATUS_AUTO) stats.auto_increment_value= misam_info.auto_increment; return 0; } int ha_myisam::extra(enum ha_extra_function operation) { if (operation == HA_EXTRA_MMAP && !opt_myisam_use_mmap) return 0; return mi_extra(file, operation, 0); } int ha_myisam::reset(void) { /* Reset MyISAM specific part for index condition pushdown */ DBUG_ASSERT(pushed_idx_cond == NULL); DBUG_ASSERT(pushed_idx_cond_keyno == MAX_KEY); mi_set_index_cond_func(file, NULL, 0); ds_mrr.reset(); return mi_reset(file); } /* To be used with WRITE_CACHE and EXTRA_CACHE */ int ha_myisam::extra_opt(enum ha_extra_function operation, ulong cache_size) { return mi_extra(file, operation, (void*) &cache_size); } int ha_myisam::delete_all_rows() { return mi_delete_all_rows(file); } /* Intended to support partitioning. Allows a particular partition to be truncated. */ int ha_myisam::truncate() { int error= delete_all_rows(); return error ? error : reset_auto_increment(0); } int ha_myisam::reset_auto_increment(ulonglong value) { file->s->state.auto_increment= value; return 0; } int ha_myisam::delete_table(const char *name) { return mi_delete_table(name); } int ha_myisam::external_lock(THD *thd, int lock_type) { file->in_use.data= thd; return mi_lock_database(file, !table->s->tmp_table ? lock_type : ((lock_type == F_UNLCK) ? F_UNLCK : F_EXTRA_LCK)); } THR_LOCK_DATA **ha_myisam::store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type) { if (lock_type != TL_IGNORE && file->lock.type == TL_UNLOCK) file->lock.type=lock_type; *to++= &file->lock; return to; } void ha_myisam::update_create_info(HA_CREATE_INFO *create_info) { ha_myisam::info(HA_STATUS_AUTO | HA_STATUS_CONST); if (!(create_info->used_fields & HA_CREATE_USED_AUTO)) { create_info->auto_increment_value= stats.auto_increment_value; } create_info->data_file_name=data_file_name; create_info->index_file_name=index_file_name; } int ha_myisam::create(const char *name, register TABLE *table_arg, HA_CREATE_INFO *ha_create_info) { int error; uint create_flags= 0, records, i; char buff[FN_REFLEN]; MI_KEYDEF *keydef; MI_COLUMNDEF *recinfo; MI_CREATE_INFO create_info; TABLE_SHARE *share= table_arg->s; uint options= share->db_options_in_use; DBUG_ENTER("ha_myisam::create"); for (i= 0; i < share->keys; i++) { if (table_arg->key_info[i].flags & HA_USES_PARSER) { create_flags|= HA_CREATE_RELIES_ON_SQL_LAYER; break; } } if ((error= table2myisam(table_arg, &keydef, &recinfo, &records))) DBUG_RETURN(error); /* purecov: inspected */ memset(&create_info, 0, sizeof(create_info)); create_info.max_rows= share->max_rows; create_info.reloc_rows= share->min_rows; create_info.with_auto_increment= share->next_number_key_offset == 0; create_info.auto_increment= (ha_create_info->auto_increment_value ? ha_create_info->auto_increment_value -1 : (ulonglong) 0); create_info.data_file_length= ((ulonglong) share->max_rows * share->avg_row_length); create_info.language= share->table_charset->number; #ifdef HAVE_READLINK if (my_use_symdir) { create_info.data_file_name= ha_create_info->data_file_name; create_info.index_file_name= ha_create_info->index_file_name; } else #endif /* HAVE_READLINK */ { if (ha_create_info->data_file_name) push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN, WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED), "DATA DIRECTORY"); if (ha_create_info->index_file_name) push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN, WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED), "INDEX DIRECTORY"); } if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE) create_flags|= HA_CREATE_TMP_TABLE; if (ha_create_info->options & HA_CREATE_KEEP_FILES) create_flags|= HA_CREATE_KEEP_FILES; if (options & HA_OPTION_PACK_RECORD) create_flags|= HA_PACK_RECORD; if (options & HA_OPTION_CHECKSUM) create_flags|= HA_CREATE_CHECKSUM; if (options & HA_OPTION_DELAY_KEY_WRITE) create_flags|= HA_CREATE_DELAY_KEY_WRITE; /* TODO: Check that the following fn_format is really needed */ error= mi_create(fn_format(buff, name, "", "", MY_UNPACK_FILENAME|MY_APPEND_EXT), share->keys, keydef, records, recinfo, 0, (MI_UNIQUEDEF*) 0, &create_info, create_flags); my_free(recinfo); DBUG_RETURN(error); } int ha_myisam::rename_table(const char * from, const char * to) { return mi_rename(from,to); } void ha_myisam::get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, ulonglong *nb_reserved_values) { ulonglong nr; int error; uchar key[MI_MAX_KEY_LENGTH]; if (!table->s->next_number_key_offset) { // Autoincrement at key-start ha_myisam::info(HA_STATUS_AUTO); *first_value= stats.auto_increment_value; /* MyISAM has only table-level lock, so reserves to +inf */ *nb_reserved_values= ULONGLONG_MAX; return; } /* it's safe to call the following if bulk_insert isn't on */ mi_flush_bulk_insert(file, table->s->next_number_index); (void) extra(HA_EXTRA_KEYREAD); key_copy(key, table->record[0], table->key_info + table->s->next_number_index, table->s->next_number_key_offset); error= mi_rkey(file, table->record[1], (int) table->s->next_number_index, key, make_prev_keypart_map(table->s->next_number_keypart), HA_READ_PREFIX_LAST); if (error) nr= 1; else { /* Get data from record[1] */ nr= ((ulonglong) table->next_number_field-> val_int_offset(table->s->rec_buff_length)+1); } extra(HA_EXTRA_NO_KEYREAD); *first_value= nr; /* MySQL needs to call us for next row: assume we are inserting ("a",null) here, we return 3, and next this statement will want to insert ("b",null): there is no reason why ("b",3+1) would be the good row to insert: maybe it already exists, maybe 3+1 is too large... */ *nb_reserved_values= 1; } /* Find out how many rows there is in the given range SYNOPSIS records_in_range() inx Index to use min_key Start of range. Null pointer if from first key max_key End of range. Null pointer if to last key NOTES min_key.flag can have one of the following values: HA_READ_KEY_EXACT Include the key in the range HA_READ_AFTER_KEY Don't include key in range max_key.flag can have one of the following values: HA_READ_BEFORE_KEY Don't include key in range HA_READ_AFTER_KEY Include all 'end_key' values in the range RETURN HA_POS_ERROR Something is wrong with the index tree. 0 There is no matching keys in the given range number > 0 There is approximately 'number' matching rows in the range. */ ha_rows ha_myisam::records_in_range(uint inx, key_range *min_key, key_range *max_key) { return (ha_rows) mi_records_in_range(file, (int) inx, min_key, max_key); } int ha_myisam::ft_read(uchar *buf) { int error; if (!ft_handler) return -1; thread_safe_increment(table->in_use->status_var.ha_read_next_count, &LOCK_status); // why ? error=ft_handler->please->read_next(ft_handler,(char*) buf); table->status=error ? STATUS_NOT_FOUND: 0; return error; } uint ha_myisam::checksum() const { return (uint)file->state->checksum; } bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes) { uint options= table->s->db_options_in_use; if (info->auto_increment_value != stats.auto_increment_value || info->data_file_name != data_file_name || info->index_file_name != index_file_name || table_changes == IS_EQUAL_NO || table_changes & IS_EQUAL_PACK_LENGTH) // Not implemented yet return COMPATIBLE_DATA_NO; if ((options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM | HA_OPTION_DELAY_KEY_WRITE)) != (info->table_options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM | HA_OPTION_DELAY_KEY_WRITE))) return COMPATIBLE_DATA_NO; return COMPATIBLE_DATA_YES; } extern int mi_panic(enum ha_panic_function flag); int myisam_panic(handlerton *hton, ha_panic_function flag) { return mi_panic(flag); } static int myisam_init(void *p) { handlerton *myisam_hton; #ifdef HAVE_PSI_INTERFACE init_myisam_psi_keys(); #endif /* Set global variables based on startup options */ if (myisam_recover_options) ha_open_options|=HA_OPEN_ABORT_IF_CRASHED; else myisam_recover_options= HA_RECOVER_OFF; myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size); myisam_hton= (handlerton *)p; myisam_hton->state= SHOW_OPTION_YES; myisam_hton->db_type= DB_TYPE_MYISAM; myisam_hton->create= myisam_create_handler; myisam_hton->panic= myisam_panic; myisam_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES; myisam_hton->is_supported_system_table= myisam_is_supported_system_table; return 0; } /**************************************************************************** * MyISAM MRR implementation: use DS-MRR ***************************************************************************/ int ha_myisam::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint mode, HANDLER_BUFFER *buf) { return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf); } int ha_myisam::multi_range_read_next(char **range_info) { return ds_mrr.dsmrr_next(range_info); } ha_rows ha_myisam::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, uint *flags, Cost_estimate *cost) { /* This call is here because there is no location where this->table would already be known. TODO: consider moving it into some per-query initialization call. */ ds_mrr.init(this, table); return ds_mrr.dsmrr_info_const(keyno, seq, seq_init_param, n_ranges, bufsz, flags, cost); } ha_rows ha_myisam::multi_range_read_info(uint keyno, uint n_ranges, uint keys, uint *bufsz, uint *flags, Cost_estimate *cost) { ds_mrr.init(this, table); return ds_mrr.dsmrr_info(keyno, n_ranges, keys, bufsz, flags, cost); } /* MyISAM MRR implementation ends */ /* Index condition pushdown implementation*/ Item *ha_myisam::idx_cond_push(uint keyno_arg, Item* idx_cond_arg) { /* Check if the key contains a blob field. If it does then MyISAM should not accept the pushed index condition since MyISAM will not read the blob field from the index entry during evaluation of the pushed index condition and the BLOB field might be part of the range evaluation done by the ICP code. */ const KEY *key= &table_share->key_info[keyno_arg]; for (uint k= 0; k < key->user_defined_key_parts; ++k) { const KEY_PART_INFO *key_part= &key->key_part[k]; if (key_part->key_part_flag & HA_BLOB_PART) { /* Let the server handle the index condition */ return idx_cond_arg; } } pushed_idx_cond_keyno= keyno_arg; pushed_idx_cond= idx_cond_arg; in_range_check_pushed_down= TRUE; if (active_index == pushed_idx_cond_keyno) mi_set_index_cond_func(file, index_cond_func_myisam, this); return NULL; } static struct st_mysql_sys_var* myisam_sysvars[]= { MYSQL_SYSVAR(block_size), MYSQL_SYSVAR(data_pointer_size), MYSQL_SYSVAR(max_sort_file_size), MYSQL_SYSVAR(recover_options), MYSQL_SYSVAR(repair_threads), MYSQL_SYSVAR(sort_buffer_size), MYSQL_SYSVAR(use_mmap), MYSQL_SYSVAR(mmap_size), MYSQL_SYSVAR(stats_method), 0 }; struct st_mysql_storage_engine myisam_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION }; mysql_declare_plugin(myisam) { MYSQL_STORAGE_ENGINE_PLUGIN, &myisam_storage_engine, "MyISAM", "MySQL AB", "MyISAM storage engine", PLUGIN_LICENSE_GPL, myisam_init, /* Plugin Init */ NULL, /* Plugin Deinit */ 0x0100, /* 1.0 */ NULL, /* status variables */ myisam_sysvars, /* system variables */ NULL, 0, } mysql_declare_plugin_end; #ifdef HAVE_QUERY_CACHE /** @brief Register a named table with a call back function to the query cache. @param thd The thread handle @param table_key A pointer to the table name in the table cache @param key_length The length of the table name @param[out] engine_callback The pointer to the storage engine call back function, currently 0 @param[out] engine_data Engine data will be set to 0. @note Despite the name of this function, it is used to check each statement before it is cached and not to register a table or callback function. @see handler::register_query_cache_table @return The error code. The engine_data and engine_callback will be set to 0. @retval TRUE Success @retval FALSE An error occured */ my_bool ha_myisam::register_query_cache_table(THD *thd, char *table_name, uint table_name_len, qc_engine_callback *engine_callback, ulonglong *engine_data) { DBUG_ENTER("ha_myisam::register_query_cache_table"); /* No call back function is needed to determine if a cached statement is valid or not. */ *engine_callback= 0; /* No engine data is needed. */ *engine_data= 0; if (file->s->concurrent_insert) { /* If a concurrent INSERT has happened just before the currently processed SELECT statement, the total size of the table is unknown. To determine if the table size is known, the current thread's snap shot of the table size with the actual table size are compared. If the table size is unknown the SELECT statement can't be cached. When concurrent inserts are disabled at table open, mi_open() does not assign a get_status() function. In this case the local ("current") status is never updated. We would wrongly think that we cannot cache the statement. */ ulonglong actual_data_file_length; ulonglong current_data_file_length; /* POSIX visibility rules specify that "2. Whatever memory values a thread can see when it unlocks a mutex <...> can also be seen by any thread that later locks the same mutex". In this particular case, concurrent insert thread had modified the data_file_length in MYISAM_SHARE before it has unlocked (or even locked) structure_guard_mutex. So, here we're guaranteed to see at least that value after we've locked the same mutex. We can see a later value (modified by some other thread) though, but it's ok, as we only want to know if the variable was changed, the actual new value doesn't matter */ actual_data_file_length= file->s->state.state.data_file_length; current_data_file_length= file->save_state.data_file_length; if (current_data_file_length != actual_data_file_length) { /* Don't cache current statement. */ DBUG_RETURN(FALSE); } } /* This query execution might have started after the query cache was flushed by a concurrent INSERT. In this case, don't cache this statement as the data file length difference might not be visible yet if the tables haven't been unlocked by the concurrent insert thread. */ if (file->state->uncacheable) DBUG_RETURN(FALSE); /* It is ok to try to cache current statement. */ DBUG_RETURN(TRUE); } #endif
tangtang2013/MySQL-Research
storage/myisam/ha_myisam.cc
C++
gpl-2.0
77,068
[ 30522, 1013, 1008, 9385, 1006, 1039, 1007, 2456, 1010, 2262, 1010, 14721, 1998, 1013, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Linq; using TransactSqlAnalyzer.Tests; namespace TransactSqlAnalyzer.Rules.Tests { [TestClass] public class DeleteWithoutWhereRuleTests : TestBase { [TestMethod] public void WithoutWhere_Warns() { // Arrange var rule = new DeleteWithoutWhereRule(); var sqlStatement = "DELETE FROM BigTable"; var script = Analyzer.Parse(sqlStatement); // Act var results = rule.Evaluate(sqlStatement, script); // Assert Assert.IsTrue(results.Count == 1); Assert.AreEqual(results.Single().Rule, rule); } [TestMethod] public void WithWhere_Passes() { // Arrange var rule = new DeleteWithoutWhereRule(); var sqlStatement = "DELETE FROM BigTable WHERE Owner = 15"; var script = Analyzer.Parse(sqlStatement); // Act var results = rule.Evaluate(sqlStatement, script); // Assert Assert.IsTrue(results.Count == 0); } } }
ifbeginend/TransactSqlAnalyzer
Source/TransactSqlAnalyzer.Rules.Tests/DeleteWithoutWhereRuleTests.cs
C#
mit
1,156
[ 30522, 2478, 7513, 1012, 26749, 8525, 20617, 1012, 3231, 3406, 27896, 1012, 3131, 22199, 2075, 1025, 2478, 2291, 1012, 11409, 4160, 1025, 2478, 9099, 18908, 2015, 4160, 16695, 2135, 6290, 1012, 5852, 1025, 3415, 15327, 9099, 18908, 2015, 41...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>EXAMPLE 1</title> <!-- include base pure.css file --> <link rel="stylesheet" href="https://unpkg.com/purecss@0.6.2/build/pure-min.css" integrity="sha384-UQiGfs9ICog+LwheBSRCt1o5cbyKIHbwjWscjemyBMT9YCUMZffs6UqUTd0hObXD" crossorigin="anonymous"> <!-- include responsive grids (didn't keep the IE8 fallback) --> <!-- http://purecss.io/start/#responsive-grids --> <link rel="stylesheet" href="https://unpkg.com/purecss@0.6.2/build/grids-responsive-min.css"> <!-- note that you can also do it this way <link rel="stylesheet" href="https://cdn.jsdelivr.net/g/pure@0.6.2(base-min.css+grids-min.css+grids-responsive-min.css+buttons-min.css)"> --> <style> .pure-g { outline: 3px solid yellow; } .pure-g > div { height: 350px; text-align: center; } .pure-g > div:first-child { background-color: lightblue; } .pure-g > div:last-child { background-color: salmon; } .buttons { padding: 10px 0; outline: 2px white dotted; } </style> </head> <body> <h1>EXAMPLE 1</h1> <div class="pure-g"> <div class="pure-u-lg-4-5 pure-u-sm-1-2 pure-u-2-3"> <p>this left panel should go from 4/5 to 1/2 to 2/3</p> <br /> <div class="buttons"> <p>~ buttons ~</p> <a class="pure-button" href="#">A Pure Button</a> <a class="pure-button pure-button-active" href="#">An Active Button</a> <a class="pure-button pure-button-primary" href="#">A Primary Button</a> </div> </div> <div class="pure-u-lg-1-5 pure-u-sm-1-2 pure-u-1-3"> <p>this right panel should go from 1/5 to 1/2 to 1/3</p> </div> </div> </body> </html>
kevinmmcraig/kevinmmcraig.github.io
examples/1.html
HTML
mit
1,881
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 2516, 1028, 2742, 1015, 1026, 1013, 2516, 1028...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * The MIT License * * Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Yahoo! Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package hudson.util; import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.*; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import org.junit.Ignore; import org.junit.Test; import org.jvnet.hudson.test.Issue; public class ArgumentListBuilderTest { @Test public void assertEmptyMask() { ArgumentListBuilder builder = new ArgumentListBuilder(); builder.add("arg"); builder.add("other", "arguments"); assertFalse("There should not be any masked arguments", builder.hasMaskedArguments()); boolean[] array = builder.toMaskArray(); assertNotNull("The mask array should not be null", array); assertThat("The mask array was incorrect", array, is(new boolean[] { false, false, false })); } @Test public void assertLastArgumentIsMasked() { ArgumentListBuilder builder = new ArgumentListBuilder(); builder.add("arg"); builder.addMasked("ismasked"); assertTrue("There should be masked arguments", builder.hasMaskedArguments()); boolean[] array = builder.toMaskArray(); assertNotNull("The mask array should not be null", array); assertThat("The mask array was incorrect", array, is(new boolean[] { false, true })); } @Test public void assertSeveralMaskedArguments() { ArgumentListBuilder builder = new ArgumentListBuilder(); builder.add("arg"); builder.addMasked("ismasked"); builder.add("non masked arg"); builder.addMasked("ismasked2"); assertTrue("There should be masked arguments", builder.hasMaskedArguments()); boolean[] array = builder.toMaskArray(); assertNotNull("The mask array should not be null", array); assertThat("The mask array was incorrect", array, is(new boolean[] { false, true, false, true })); } @Test public void assertPrependAfterAddingMasked() { ArgumentListBuilder builder = new ArgumentListBuilder(); builder.addMasked("ismasked"); builder.add("arg"); builder.prepend("first", "second"); assertTrue("There should be masked arguments", builder.hasMaskedArguments()); boolean[] array = builder.toMaskArray(); assertNotNull("The mask array should not be null", array); assertThat("The mask array was incorrect", array, is(new boolean[] { false, false, true, false })); } @Test public void assertPrependBeforeAddingMasked() { ArgumentListBuilder builder = new ArgumentListBuilder(); builder.prepend("first", "second"); builder.addMasked("ismasked"); builder.add("arg"); assertTrue("There should be masked arguments", builder.hasMaskedArguments()); boolean[] array = builder.toMaskArray(); assertNotNull("The mask array should not be null", array); assertThat("The mask array was incorrect", array, is(new boolean[] { false, false, true, false })); } @Test public void testToWindowsCommand() { ArgumentListBuilder builder = new ArgumentListBuilder(). add("ant.bat").add("-Dfoo1=abc"). // nothing special, no quotes add("-Dfoo2=foo bar").add("-Dfoo3=/u*r").add("-Dfoo4=/us?"). // add quotes add("-Dfoo10=bar,baz"). add("-Dfoo5=foo;bar^baz").add("-Dfoo6=<xml>&here;</xml>"). // add quotes add("-Dfoo7=foo|bar\"baz"). // add quotes and "" for " add("-Dfoo8=% %QED% %comspec% %-%(%.%"). // add quotes, and extra quotes for %Q and %c add("-Dfoo9=%'''%%@%"); // no quotes as none of the % are followed by a letter // By default, does not escape %VAR% assertThat(builder.toWindowsCommand().toCommandArray(), is(new String[] { "cmd.exe", "/C", "\"ant.bat", "-Dfoo1=abc", "\"-Dfoo2=foo bar\"", "\"-Dfoo3=/u*r\"", "\"-Dfoo4=/us?\"", "\"-Dfoo10=bar,baz\"", "\"-Dfoo5=foo;bar^baz\"", "\"-Dfoo6=<xml>&here;</xml>\"", "\"-Dfoo7=foo|bar\"\"baz\"", "\"-Dfoo8=% %QED% %comspec% %-%(%.%\"", "-Dfoo9=%'''%%@%", "&&", "exit", "%%ERRORLEVEL%%\"" })); // Pass flag to escape %VAR% assertThat(builder.toWindowsCommand(true).toCommandArray(), is(new String[] { "cmd.exe", "/C", "\"ant.bat", "-Dfoo1=abc", "\"-Dfoo2=foo bar\"", "\"-Dfoo3=/u*r\"", "\"-Dfoo4=/us?\"", "\"-Dfoo10=bar,baz\"", "\"-Dfoo5=foo;bar^baz\"", "\"-Dfoo6=<xml>&here;</xml>\"", "\"-Dfoo7=foo|bar\"\"baz\"", "\"-Dfoo8=% %\"Q\"ED% %\"c\"omspec% %-%(%.%\"", "-Dfoo9=%'''%%@%", "&&", "exit", "%%ERRORLEVEL%%\"" })); // Try to hide password builder.add("-Dpassword=hidden", true); // By default, does not escape %VAR% assertThat(builder.toWindowsCommand().toString(), is("cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" \"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" \"-Dfoo6=<xml>&here;</xml>\" \"-Dfoo7=foo|bar\"\"baz\" \"\"-Dfoo8=% %QED% %comspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** && exit %%ERRORLEVEL%%\"" )); // Pass flag to escape %VAR% assertThat(builder.toWindowsCommand(true).toString(), is("cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" \"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" \"-Dfoo6=<xml>&here;</xml>\" \"-Dfoo7=foo|bar\"\"baz\" \"\"-Dfoo8=% %\"Q\"ED% %\"c\"omspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** && exit %%ERRORLEVEL%%\"")); } @Test @Ignore("It's only for reproduce JENKINS-28790 issue. It's added to testToWindowsCommand") @Issue("JENKINS-28790") public void testToWindowsCommandMasked() { ArgumentListBuilder builder = new ArgumentListBuilder(). add("ant.bat").add("-Dfoo1=abc"). // nothing special, no quotes add("-Dfoo2=foo bar").add("-Dfoo3=/u*r").add("-Dfoo4=/us?"). // add quotes add("-Dfoo10=bar,baz"). add("-Dfoo5=foo;bar^baz").add("-Dfoo6=<xml>&here;</xml>"). // add quotes add("-Dfoo7=foo|bar\"baz"). // add quotes and "" for " add("-Dfoo8=% %QED% %comspec% %-%(%.%"). // add quotes, and extra quotes for %Q and %c add("-Dfoo9=%'''%%@%"). // no quotes as none of the % are followed by a letter add("-Dpassword=hidden", true); // By default, does not escape %VAR% assertThat(builder.toWindowsCommand().toString(), is("cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" \"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" \"-Dfoo6=<xml>&here;</xml>\" \"-Dfoo7=foo|bar\"\"baz\" \"\"-Dfoo8=% %QED% %comspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** && exit %%ERRORLEVEL%%\"" )); // Pass flag to escape %VAR% assertThat(builder.toWindowsCommand(true).toString(), is("cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" \"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" \"-Dfoo6=<xml>&here;</xml>\" \"-Dfoo7=foo|bar\"\"baz\" \"\"-Dfoo8=% %\"Q\"ED% %\"c\"omspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** && exit %%ERRORLEVEL%%\"")); } @Test public void assertMaskOnClone() { ArgumentListBuilder builder = new ArgumentListBuilder(); builder.add("arg1"); builder.addMasked("masked1"); builder.add("arg2"); ArgumentListBuilder clone = builder.clone(); assertTrue("There should be masked arguments", clone.hasMaskedArguments()); boolean[] array = clone.toMaskArray(); assertNotNull("The mask array should not be null", array); assertThat("The mask array was incorrect", array, is(builder.toMaskArray())); } private static final Map<String, String> KEY_VALUES = new LinkedHashMap<String, String>() {{ put("key1", "value1"); put("key2", "value2"); put("key3", "value3"); }}; private static final Set<String> MASKS = new HashSet<String>() {{ add("key2"); }}; @Test public void assertKeyValuePairsWithMask() { ArgumentListBuilder builder = new ArgumentListBuilder(); builder.addKeyValuePairs(null, KEY_VALUES, MASKS); assertTrue("There should be masked arguments", builder.hasMaskedArguments()); boolean[] array = builder.toMaskArray(); assertNotNull("The mask array should not be null", array); assertThat("The mask array was incorrect", array, is(new boolean[] { false, true, false })); } @Test public void assertKeyValuePairs() { ArgumentListBuilder builder = new ArgumentListBuilder(); builder.addKeyValuePairs(null, KEY_VALUES); assertFalse("There should not be any masked arguments", builder.hasMaskedArguments()); boolean[] array = builder.toMaskArray(); assertNotNull("The mask array should not be null", array); assertThat("The mask array was incorrect", array, is(new boolean[] { false, false, false })); } @Test public void addKeyValuePairsFromPropertyString() throws IOException { final Map<String, String> map = new HashMap<>(); map.put("PATH", "C:\\Windows"); final VariableResolver<String> resolver = new VariableResolver.ByMap<>(map); final String properties = "my.path=$PATH"; ArgumentListBuilder builder = new ArgumentListBuilder(); builder.addKeyValuePairsFromPropertyString("", properties, resolver); assertEquals("my.path=C:\\Windows", builder.toString()); builder = new ArgumentListBuilder(); builder.addKeyValuePairsFromPropertyString("", properties, resolver, null); assertEquals("my.path=C:\\Windows", builder.toString()); } @Test public void numberOfBackslashesInPropertiesShouldBePreservedAfterMacroExpansion() throws IOException { final Map<String, String> map = new HashMap<>(); map.put("ONE", "one\\backslash"); map.put("TWO", "two\\\\backslashes"); map.put("FOUR", "four\\\\\\\\backslashes"); final String properties = "one=$ONE\n" + "two=$TWO\n" + "four=$FOUR\n" ; final String args = new ArgumentListBuilder() .addKeyValuePairsFromPropertyString("", properties, new VariableResolver.ByMap<>(map)) .toString() ; assertThat(args, containsString("one=one\\backslash")); assertThat(args, containsString("two=two\\\\backslashes")); assertThat(args, containsString("four=four\\\\\\\\backslashes")); } }
patbos/jenkins
core/src/test/java/hudson/util/ArgumentListBuilderTest.java
Java
mit
11,899
[ 30522, 1013, 1008, 1008, 1996, 10210, 6105, 1008, 1008, 9385, 1006, 1039, 1007, 2432, 1011, 2230, 1010, 3103, 12702, 29390, 1010, 4297, 1012, 1010, 12849, 7898, 15851, 10556, 4213, 16918, 1010, 20643, 999, 4297, 1012, 1008, 1008, 6656, 2003...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright Statement: * * This software/firmware and related documentation ("MediaTek Software") are * protected under relevant copyright laws. The information contained herein is * confidential and proprietary to MediaTek Inc. and/or its licensors. Without * the prior written permission of MediaTek inc. and/or its licensors, any * reproduction, modification, use or disclosure of MediaTek Software, and * information contained herein, in whole or in part, shall be strictly * prohibited. * * MediaTek Inc. (C) 2010. All rights reserved. * * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * The following software/firmware and/or related documentation ("MediaTek * Software") have been modified by MediaTek Inc. All revisions are subject to * any receiver's applicable license agreements with MediaTek Inc. */ package com.mediatek.bluetooth.map.cache; import com.mediatek.bluetooth.map.util.UtcUtil; public class FolderListObject{ private String mTime = UtcUtil.getCurrentTime(); // "yyyymmddTHHMMSSZ", or "" if none private int mSize; private String mName; public void setName(String name){ mName = name; } public void setSize(int size){ mSize = size; } }
rex-xxx/mt6572_x201
mediatek/packages/apps/Bluetooth/profiles/map/src/com/mediatek/bluetooth/map/cache/FolderListObject.java
Java
gpl-2.0
2,588
[ 30522, 1013, 1008, 9385, 4861, 1024, 1008, 1008, 2023, 4007, 1013, 3813, 8059, 1998, 3141, 12653, 1006, 1000, 2865, 23125, 4007, 1000, 1007, 2024, 1008, 5123, 2104, 7882, 9385, 4277, 1012, 1996, 2592, 4838, 2182, 2378, 2003, 1008, 18777, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# AUTOGENERATED FILE FROM balenalib/artik530-debian:buster-run ENV NODE_VERSION 15.7.0 ENV YARN_VERSION 1.22.4 RUN buildDeps='curl libatomic1' \ && set -x \ && for key in \ 6A010C5166006599AA17F08146C2130DFD2497F5 \ ; do \ gpg --batch --keyserver pgp.mit.edu --recv-keys "$key" || \ gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \ gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ done \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ && rm -rf /var/lib/apt/lists/* \ && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-armv7l.tar.gz" \ && echo "aa65f287bfe060321ee5e0b4f7134bd17690abb911c6fc1173ddbedddbf2c060 node-v$NODE_VERSION-linux-armv7l.tar.gz" | sha256sum -c - \ && tar -xzf "node-v$NODE_VERSION-linux-armv7l.tar.gz" -C /usr/local --strip-components=1 \ && rm "node-v$NODE_VERSION-linux-armv7l.tar.gz" \ && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && mkdir -p /opt/yarn \ && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && npm config set unsafe-perm true -g --unsafe-perm \ && rm -rf /tmp/* CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@node.sh" \ && echo "Running test-stack@node" \ && chmod +x test-stack@node.sh \ && bash test-stack@node.sh \ && rm -rf test-stack@node.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Buster \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nNode.js v15.7.0, Yarn v1.22.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
nghiant2710/base-images
balena-base-images/node/artik530/debian/buster/15.7.0/run/Dockerfile
Dockerfile
apache-2.0
2,938
[ 30522, 1001, 8285, 6914, 16848, 5371, 2013, 28352, 8189, 29521, 1013, 2396, 5480, 22275, 2692, 1011, 2139, 15599, 1024, 18396, 1011, 2448, 4372, 2615, 13045, 1035, 2544, 2321, 1012, 1021, 1012, 1014, 4372, 2615, 27158, 1035, 2544, 1015, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ package com.sun.star.comp.beans; import java.awt.Container; import com.sun.star.lang.XComponent; import com.sun.star.uno.XComponentContext; /** * This abstract class represents a connection to the office * application. */ @Deprecated public interface OfficeConnection extends XComponent { /** * Sets a connection URL. * * @param url This is UNO URL which describes the type of a connection. */ void setUnoUrl(String url) throws java.net.MalformedURLException; /** * Sets an AWT container catory. * * @param containerFactory This is a application provided AWT container * factory. */ void setContainerFactory(ContainerFactory containerFactory); /** * Retrieves the UNO component context. * Establishes a connection if necessary and initialises the * UNO service manager if it has not already been initialised. * * @return The office UNO component context. */ XComponentContext getComponentContext(); /** * Creates an office window. * The window is either a sub-class of java.awt.Canvas (local) or * java.awt.Container (RVP). * * This method does not add the office window to its container. * * @param container This is an AWT container. * @return The office window instance. */ OfficeWindow createOfficeWindow(Container container); }
Limezero/libreoffice
bean/com/sun/star/comp/beans/OfficeConnection.java
Java
gpl-3.0
2,225
[ 30522, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 21091, 7245, 6610, 2622, 1012, 1008, 1008, 2023, 3120, 3642, 2433, 2003, 3395, 2000, 1996, 3408, 1997, 1996, 9587, 5831, 4571, 2270, 1008, 6105, 1010, 1058, 1012, 1016, 1012, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Node Native Module for Lib Sodium * * @Author Pedro Paixao * @email paixaop at gmail dot com * @License MIT */ #ifndef __CRYPTO_AEAD_H__ #define __CRYPTO_AEAD_H__ /* int crypto_aead_aes256gcm_encrypt(unsigned char *c, unsigned long long *clen_p, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k); int crypto_aead_aes256gcm_decrypt(unsigned char *m, unsigned long long *mlen_p, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k) */ #define CRYPTO_AEAD_DEF(ALGO) \ NAPI_METHOD(crypto_aead_ ## ALGO ## _encrypt ) { \ Napi::Env env = info.Env(); \ ARGS(4, "arguments message, additional data, nonce, and key must be buffers"); \ ARG_TO_UCHAR_BUFFER(m); \ ARG_TO_UCHAR_BUFFER_OR_NULL(ad); \ ARG_TO_UCHAR_BUFFER_LEN(npub, crypto_aead_ ## ALGO ## _NPUBBYTES); \ ARG_TO_UCHAR_BUFFER_LEN(k, crypto_aead_ ## ALGO ## _KEYBYTES); \ NEW_BUFFER_AND_PTR(c, crypto_aead_ ## ALGO ## _ABYTES + m_size); \ sodium_memzero(c_ptr, crypto_aead_ ## ALGO ## _ABYTES + m_size); \ unsigned long long clen;\ if( crypto_aead_ ## ALGO ## _encrypt (c_ptr, &clen, m, m_size, ad, ad_size, NULL, npub, k) == 0 ) { \ return c; \ } \ return NAPI_NULL; \ } \ NAPI_METHOD(crypto_aead_ ## ALGO ## _decrypt) { \ Napi::Env env = info.Env(); \ ARGS(4, "arguments chiper text, additional data, nonce, and key must be buffers"); \ ARG_TO_UCHAR_BUFFER(c); \ if( c_size < crypto_aead_ ## ALGO ## _ABYTES ) { \ THROW_ERROR("argument cipher text must be at least crypto_aead_ " #ALGO "_ABYTES bytes long"); \ } \ ARG_TO_UCHAR_BUFFER_OR_NULL(ad); \ ARG_TO_UCHAR_BUFFER_LEN(npub, crypto_aead_ ## ALGO ## _NPUBBYTES); \ ARG_TO_UCHAR_BUFFER_LEN(k, crypto_aead_ ## ALGO ## _KEYBYTES); \ NEW_BUFFER_AND_PTR(m, c_size - crypto_aead_ ## ALGO ## _ABYTES); \ unsigned long long mlen;\ if( crypto_aead_ ## ALGO ## _decrypt (m_ptr, &mlen, NULL, c, c_size, ad, ad_size, npub, k) == 0 ) { \ return m; \ } \ return NAPI_NULL; \ } \ NAPI_METHOD(crypto_aead_ ## ALGO ## _keygen ) { \ NEW_BUFFER_AND_PTR(buffer, crypto_aead_ ## ALGO ## _KEYBYTES); \ crypto_aead_ ## ALGO ## _keygen(buffer_ptr); \ return buffer; \ } /* SODIUM_EXPORT int crypto_aead_aes256gcm_encrypt_detached(unsigned char *c, unsigned char *mac, unsigned long long *maclen_p, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k); int crypto_aead_aes256gcm_decrypt_detached(unsigned char *m, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *mac, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k) */ #define CRYPTO_AEAD_DETACHED_DEF(ALGO) \ NAPI_METHOD(crypto_aead_ ## ALGO ## _encrypt_detached) { \ Napi::Env env = info.Env(); \ ARGS(4, "arguments message, additional data, nonce, and key must be buffers"); \ ARG_TO_UCHAR_BUFFER(m); \ ARG_TO_UCHAR_BUFFER_OR_NULL(ad); \ ARG_TO_UCHAR_BUFFER_LEN(npub, crypto_aead_ ## ALGO ## _NPUBBYTES); \ ARG_TO_UCHAR_BUFFER_LEN(k, crypto_aead_ ## ALGO ## _KEYBYTES); \ NEW_BUFFER_AND_PTR(c, m_size); \ NEW_BUFFER_AND_PTR(mac, crypto_aead_ ## ALGO ## _ABYTES); \ unsigned long long maclen;\ if( crypto_aead_ ## ALGO ## _encrypt_detached (c_ptr, mac_ptr, &maclen, m, m_size, ad, ad_size, NULL, npub, k) == 0 ) { \ Napi::Object result = Napi::Object::New(env); \ result.Set(Napi::String::New(env, "cipherText"), c); \ result.Set(Napi::String::New(env, "mac"), mac); \ return result; \ } \ return NAPI_NULL; \ }\ NAPI_METHOD(crypto_aead_ ## ALGO ## _decrypt_detached) { \ Napi::Env env = info.Env(); \ ARGS(4, "arguments cipher message, mac, additional data, nsec, nonce, and key must be buffers"); \ ARG_TO_UCHAR_BUFFER(c); \ ARG_TO_UCHAR_BUFFER(mac); \ ARG_TO_UCHAR_BUFFER_OR_NULL(ad); \ if( mac_size > crypto_aead_ ## ALGO ## _ABYTES ) { \ THROW_ERROR("argument mac cannot be longer than crypto_aead_" #ALGO "_ABYTES bytes"); \ }\ ARG_TO_UCHAR_BUFFER_LEN(npub, crypto_aead_ ## ALGO ## _NPUBBYTES); \ ARG_TO_UCHAR_BUFFER_LEN(k, crypto_aead_ ## ALGO ## _KEYBYTES); \ NEW_BUFFER_AND_PTR(m, c_size); \ if( crypto_aead_ ## ALGO ## _decrypt_detached (m_ptr, NULL, c, c_size, mac, ad, ad_size, npub, k) == 0 ) { \ return m; \ } \ return NAPI_NULL; \ } \ NAPI_METHOD_FROM_INT(crypto_aead_ ## ALGO ## _abytes); \ NAPI_METHOD_FROM_INT(crypto_aead_ ## ALGO ## _keybytes); \ NAPI_METHOD_FROM_INT(crypto_aead_ ## ALGO ## _npubbytes); \ NAPI_METHOD_FROM_INT(crypto_aead_ ## ALGO ## _nsecbytes); \ NAPI_METHOD_FROM_INT(crypto_aead_ ## ALGO ## _messagebytes_max) #define METHOD_AND_PROPS(ALGO) \ EXPORT(crypto_aead_ ## ALGO ## _decrypt); \ EXPORT(crypto_aead_ ## ALGO ## _decrypt_detached); \ EXPORT(crypto_aead_ ## ALGO ## _encrypt); \ EXPORT(crypto_aead_ ## ALGO ## _keygen); \ EXPORT(crypto_aead_ ## ALGO ## _encrypt_detached); \ EXPORT(crypto_aead_ ## ALGO ## _abytes); \ EXPORT(crypto_aead_ ## ALGO ## _keybytes); \ EXPORT(crypto_aead_ ## ALGO ## _npubbytes); \ EXPORT(crypto_aead_ ## ALGO ## _nsecbytes); \ EXPORT(crypto_aead_ ## ALGO ## _messagebytes_max); \ EXPORT_INT(crypto_aead_ ## ALGO ## _ABYTES); \ EXPORT_INT(crypto_aead_ ## ALGO ## _KEYBYTES); \ EXPORT_INT(crypto_aead_ ## ALGO ## _NPUBBYTES); \ EXPORT_INT(crypto_aead_ ## ALGO ## _NSECBYTES) #endif
paixaop/node-sodium
src/include/crypto_aead.h
C
mit
7,398
[ 30522, 1013, 1008, 1008, 1008, 13045, 3128, 11336, 2005, 5622, 2497, 13365, 1008, 1008, 1030, 3166, 7707, 6643, 7646, 7113, 1008, 1030, 10373, 6643, 7646, 7113, 2361, 2012, 20917, 4014, 11089, 4012, 1008, 1030, 6105, 10210, 1008, 1013, 1001...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# thingularity One perfect open source design for every type of thing
adius/thingularity
README.md
Markdown
mit
70
[ 30522, 1001, 2518, 7934, 3012, 2028, 3819, 2330, 3120, 2640, 2005, 2296, 2828, 1997, 2518, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 305...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
-- remove auras that are already applied in SAI UPDATE `creature_template_addon` SET `auras`='' WHERE `entry` IN ( 215, -- Defias Night Runner 579, -- Shadowhide Assassin 938, -- Kurzen Commando 1040, -- Fen Creeper 8550, -- Shadowmage 9299, -- Gaeriyan 10414, -- Patchwork Horror 10426, -- Crimson Inquisitor 10471, -- Scholomance Acolyte 11885, -- Blighthound 16017, -- Patchwork Golem 16375, -- Sewage Slime 21080, -- Dormant Infernal 22853, -- Illidari Defiler 24818, -- Anvilrage Taskmaster 25596, -- Infected Kodo Beast 25781, -- Oil Pool 26624, -- Wretched Belcher 26782, -- Crystalline Keeper 28161); -- Chicken Escapee
v21k93/new_core_me_and_cannibal
sql/updates/world/2013_01_18_01_world_creature_template_addon.sql
SQL
gpl-2.0
628
[ 30522, 1011, 1011, 6366, 15240, 2015, 2008, 2024, 2525, 4162, 1999, 18952, 10651, 1036, 6492, 1035, 23561, 1035, 5587, 2239, 1036, 2275, 1036, 15240, 2015, 1036, 1027, 1005, 1005, 2073, 1036, 4443, 1036, 1999, 1006, 30524, 2683, 2683, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /*------------------------------------------------------------------------ # TZ Portfolio Extension # ------------------------------------------------------------------------ # author DuongTVTemPlaza # copyright Copyright (C) 2012 templaza.com. All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Websites: http://www.templaza.com # Technical Support: Forum - http://templaza.com/Forum -------------------------------------------------------------------------*/ // no direct access defined('_JEXEC') or die(); jimport('joomla.application.component.model'); class TZ_PortfolioModelTag extends JModelLegacy { function populateState(){ $app = JFactory::getApplication(); $params = $app -> getParams(); $this -> setState('params',$params); $pk = JRequest::getInt('id'); $this -> setState('article.id',$pk); $this -> setState('list.ordering',null); $this -> setState('list.direction', null); } function getTag(){ // $query = 'SELECT t.* FROM #__tz_portfolio_tags AS t' // .' INNER JOIN #__tz_portfolio_tags_xref AS x ON t.id=x.tagsid' // .' WHERE t.published=1 AND x.contentid='.$this -> getState('article.id'); $db = JFactory::getDbo(); $query = $db -> getQuery(true); $query -> select('t.*,x.contentid'); $query -> from($db -> quoteName('#__tz_portfolio_tags').' AS t'); $query -> join('INNER',$db -> quoteName('#__tz_portfolio_tags_xref').' AS x ON t.id=x.tagsid'); $query -> where('t.published = 1'); if($pk = $this -> getState('article.id')){ if(is_array($pk)){ $query -> where('x.contentid IN('.implode(',',$pk).')'); }else{ $query -> where('x.contentid = '.$pk); } } if($order = $this -> getState('list.ordering')){ $query -> order($order,$this -> getState('list.direction','ASC')); } $db -> setQuery($query); if(!$db -> query()){ var_dump($db -> getErrorMsg()); return false; } $rows = $db -> loadObjectList(); if(count($rows)>0){ return $rows; } return false; } function getArticleTags(){ if($tags = $this -> getTag()){ $new_tags = array(); $_new_tags = array(); $tagIds = array(); foreach($tags as &$tag){ $itemId = $this -> FindItemId($tag -> id); $tag ->link = JRoute::_('index.php?option=com_tz_portfolio&view=tags&id='.$tag -> id.'&Itemid='.$itemId); if(!isset($new_tags[$tag -> contentid])){ $new_tags[$tag -> contentid][] = $tag; $_new_tags[$tag -> contentid][] = $tag -> id; }else{ if(!in_array($tag -> id,$_new_tags[$tag->contentid])) { $new_tags[$tag->contentid][] = $tag; } } } return $new_tags; } return false; } protected function FindItemId($_tagid=null) { $tagid = null; $app = JFactory::getApplication(); $menus = $app->getMenu('site'); $active = $menus->getActive(); $params = $this -> getState('params'); if($_tagid){ $tagid = intval($_tagid); } $component = JComponentHelper::getComponent('com_tz_portfolio'); $items = $menus->getItems('component_id', $component->id); if($params -> get('menu_active') && $params -> get('menu_active') != 'auto'){ return $params -> get('menu_active'); } foreach ($items as $item) { if (isset($item->query) && isset($item->query['view'])) { $view = $item->query['view']; if (isset($item->query['id'])) { if ($item->query['id'] == $tagid) { return $item -> id; } } else { $catids = $item->params->get('tz_catid'); if ($view == 'tags' && $catids) { if (is_array($catids)) { for ($i = 0; $i < count($catids); $i++) { if ($catids[$i] == 0 || $catids[$i] == $tagid) { return $item -> id; } } } else { if ($catids == $tagid) { return $item -> id; } } } } } } return $active -> id; } }
davidguillemet/fashionphotosub
components/com_tz_portfolio/models/tag.php
PHP
gpl-2.0
4,872
[ 30522, 1026, 1029, 25718, 1013, 30524, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
OxygenMailer::Client.setup do |config| # api-key for sms config.sms_api_key = "replace api key of sms" config.sms_api_secret = "replace api secret of sms" # api-key for mail config.mail_api_key = "reaplce api key of mail" config.mail_api_secret = "replace api secret of mail" config.ssh_host = "host" config.ssh_user = "user" # ssh private key for sftp config.ssh_private_key = <<-EOF REPLACE SSH PRIVATE-KEY EOF end
foobargem/oxygen_mailer_client
lib/generators/templates/oxygen_mailer_client.rb
Ruby
mit
444
[ 30522, 7722, 21397, 2121, 1024, 1024, 7396, 1012, 16437, 2079, 1064, 9530, 8873, 2290, 1064, 1001, 17928, 1011, 3145, 2005, 22434, 9530, 8873, 2290, 1012, 22434, 1035, 17928, 1035, 3145, 1027, 1000, 5672, 17928, 3145, 1997, 22434, 1000, 953...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2010-2011 * Written by: * Aly Hirani <alyhirani@gmail.com> * James Chou <uohcsemaj@gmail.com> * * All Rights Reserved * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * */ #ifndef LIBFACEBOOKCPP_ENUM_H_ #define LIBFACEBOOKCPP_ENUM_H_ #include "AuthorizedObject.hpp" namespace LibFacebookCpp { template<class T, T none, T count, const char *str_array[]> class Enum : public AuthorizedObject { public: // ctor Enum() : t_(none) { } public: // public interface operator T() const { return t_; } private: // callback methods void _Deserialize(const AuthorizedObject &parent_obj, const Json::Value &json) { if(!json.isConvertibleTo(Json::stringValue)) throw UnexpectedException("!json.isConvertibleTo(Json::stringValue)"); const std::string &str = json.asString(); bool found = false; // Hack: This is nasty, but required to do a complete iteration. Hopefully, we never have to go over the int limit! for(int s = (int)none; s < (int)count; ++s) { if(stricmp(str.c_str(), str_array[s]) == 0) { t_ = (T)s; break; } } if(!found) throw UnexpectedException("!found"); } private: // member variables T t_; }; } // namespace LibFacebookCpp #endif // LIBFACEBOOKCPP_ENUM_H_
kemcoi/libfacebookcpp
include/LibFacebookCpp/Enum.hpp
C++
lgpl-2.1
1,783
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2230, 1011, 2249, 1008, 2517, 2011, 1024, 1008, 2632, 2100, 7632, 21578, 1026, 2632, 2100, 11961, 7088, 1030, 20917, 4014, 1012, 4012, 1028, 1008, 2508, 16480, 2226, 1026, 1057, 11631, 6169, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
namespace Snippets3.Serialization { using NServiceBus; public class BinarySerializerUsage { public void Simple() { #region BinarySerialization Configure configure = Configure.With(); configure.BinarySerializer(); #endregion } } }
WojcikMike/docs.particular.net
Snippets/Snippets_3/Serialization/BinarySerializerUsage.cs
C#
apache-2.0
325
[ 30522, 3415, 15327, 1055, 3490, 29519, 2015, 2509, 1012, 7642, 3989, 1063, 2478, 24978, 2121, 7903, 15878, 2271, 1025, 2270, 2465, 12441, 8043, 4818, 17629, 10383, 3351, 1063, 2270, 11675, 3722, 1006, 1007, 1063, 1001, 2555, 12441, 8043, 48...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('@angular-devkit/build-angular/plugins/karma') ], client: { clearContext: false // leave Jasmine Spec Runner output visible in browser }, reporters: ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false, restartOnFileChange: true }); };
positive-js/mosaic
packages/docs/karma.conf.js
JavaScript
mit
866
[ 30522, 1013, 30524, 16129, 11336, 1012, 14338, 1027, 3853, 1006, 9530, 8873, 2290, 1007, 1063, 9530, 8873, 2290, 1012, 2275, 1006, 1063, 2918, 15069, 1024, 1005, 1005, 1010, 7705, 2015, 1024, 1031, 1005, 14032, 1005, 1010, 1005, 1030, 16108...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/perl # Copyright 2011-2013 Biblibre SARL # # This file is part of Koha. # # Koha is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # Koha is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Koha; if not, see <http://www.gnu.org/licenses>. use Modern::Perl; use CGI qw ( -utf8 ); use C4::Context; use C4::Serials::Numberpattern qw( AddSubscriptionNumberpattern ModSubscriptionNumberpattern ); use C4::Auth qw( check_cookie_auth ); my $input = CGI->new; my ($auth_status) = check_cookie_auth($input->cookie('CGISESSID'), { serials => '*' }); if ($auth_status ne "ok") { print $input->header(-type => 'text/plain', -status => '403 Forbidden'); exit 0; } my $numberpattern; foreach (qw/ numberingmethod label1 label2 label3 add1 add2 add3 every1 every2 every3 setto1 setto2 setto3 whenmorethan1 whenmorethan2 whenmorethan3 numbering1 numbering2 numbering3 locale /) { $numberpattern->{$_} = $input->param($_); } # patternname is label in database $numberpattern->{'label'} = $input->param('patternname'); # Check if pattern already exist in database my $dbh = C4::Context->dbh; my $query = qq{ SELECT id FROM subscription_numberpatterns WHERE STRCMP(label, ?) = 0 }; my $sth = $dbh->prepare($query); my $rv = $sth->execute($numberpattern->{'label'}); my $numberpatternid; if($rv == 0) { # Pattern does not exists $numberpatternid = AddSubscriptionNumberpattern($numberpattern); } else { ($numberpatternid) = $sth->fetchrow_array; $numberpattern->{'id'} = $numberpatternid; ModSubscriptionNumberpattern($numberpattern); } binmode STDOUT, ":encoding(UTF-8)"; print $input->header(-type => 'text/plain', -charset => 'UTF-8'); print "{\"numberpatternid\":\"$numberpatternid\"}";
PTFS-Europe/koha
serials/create-numberpattern.pl
Perl
gpl-3.0
2,187
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 2566, 2140, 1001, 9385, 2249, 1011, 2286, 12170, 16558, 12322, 2890, 18906, 2140, 1001, 1001, 2023, 5371, 2003, 2112, 1997, 12849, 3270, 1012, 1001, 1001, 12849, 3270, 2003, 2489, 4007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<style> #addingUserPopup { position: absolute; top:10%; right: 2%; width: 80%; padding-top: 10px; } #headerPopup { background-color: #C2C2C2; color: white; font-family: arial; height: 50px; text-align: center; } #title { position: fixed; } #footerPopup { height: 50px; margin-right: 25%; } #cancelButton, #saveButton { width: 25%; } </style> <script src="<?php echo base_url('/application/Content/Js/angular.min.js')?>"></script> <script src="<?php echo base_url('/application/Content/Js/app/AddProvider.model.js')?>"></script> <script src="<?php echo base_url('/application/Content/Js/jquery.form.js')?>"></script> <div id = "addingUserPage" ng-app="AddProviderApp"> <input type = "hidden" name = "baseUrl" id = "baseUrl" value = "<?php echo base_url();?>"/> <div id = "addingUserPopup" ng-controller="AddProviderController"> <div class="col-sm-12 col-md-12 col-lg-6 jarviswidget jarviswidget-sortable" id="wid-id-1" role="widget" style=""> <header role="heading"><div class="jarviswidget-ctrls" role="menu"> <a href="#" class="button-icon jarviswidget-toggle-btn" rel="tooltip" title="" data-placement="bottom" data-original-title="Collapse"><i class="fa fa-minus "></i></a> <a href="javascript:void(0);" class="button-icon jarviswidget-fullscreen-btn" rel="tooltip" title="" data-placement="bottom" data-original-title="Fullscreen"><i class="fa fa-resize-full "></i></a> <a href="javascript:void(0);" class="button-icon jarviswidget-delete-btn" rel="tooltip" title="" data-placement="bottom" data-original-title="Delete"><i class="fa fa-times"></i></a></div> <span class="widget-icon"> <i class="fa fa-edit"></i> </span> <h2>Thêm mới nhà cung cấp</h2> </header> <!-- widget div--> <div role="content"> <!-- widget content --> <div class="widget-body no-padding"> <form class="smart-form"> <fieldset> <section> <label class="label">Nhà cung cấp: </label> <label class="input"> <i class="icon-append fa fa-font"></i> <input type="text" id="name-field" ng-model="pro.Name" name="username" placeholder="Tên nhà cung cấp"> </label> </section> <section> <label class="label">Mã nhà cung cấp: </label> <label class="input"> <i class="icon-append fa fa-font"></i> <input type="text" id="name-field" ng-model="pro.Code" name="username" placeholder="Nhập mã nhà cung cấp"> </label> </section> <section> <label class="label">Logo: </label> <label> <img id = "logoImg" ng-src= "{{pro.fullPath}}" alt = "Logo" width="60px" height="60px" /> </label> </label> </section> <section> <label class="label">Đặc tả:</label> <label class="input"> <textarea ng-model = "pro.Description" rows="6" cols="60" placeholder = "Một vài thông tin về nhà cung cấp"></textarea> </label> </section> </fieldset> <footer> <button type="submit" class="btn btn-primary" ng-click = "completeAddingProviderProcess();"> Lưu lại </button> </footer> </form> </div> <!-- end widget content --> </div> <!-- end widget div --> </div> <article class="col-sm-12 col-md-12 col-lg-6 sortable-grid ui-sortable"> <div class="jarviswidget jarviswidget-color-blueLight" id="wid-id-0" data-widget-editbutton="false"> <header> <span class="widget-icon"> <i class="fa fa-cloud"></i> </span> <h2>Hình ảnh</h2> </header> <div> <div class="jarviswidget-editbox"> </div> <div class="widget-body"> <form action="<?php echo site_url(array('AdminProvider', 'FileUpload')); ?>" class="dropzone" id="myDropzone"> </form> </div> </div> </div> </article> <input type = "hidden" id="addTempImg" ng-click="addTempImg()" /> <input type = "hidden" id="removeTempImg" ng-click="removeTempImg()" /> <input type = "hidden" id="clickBinding" ng-click ="init()" /> </div> </div> <script type="text/javascript" src="<?php echo base_url('application/Content/Js/plugin/dropzone/dropzone.min.js')?>"></script> <script type="text/javascript"> $('document').ready(function(){ $('#clickBinding').click(); Dropzone.autoDiscover = false; Dropzone.options.myDropzone = { init: function() { this.on("success", function(file, responseText) { var jsonData = JSON.parse(responseText); $('#addTempImg').attr({ 'urlPath' : jsonData[0], 'fullPath' : jsonData[1]}); $('#addTempImg').click(); var removeButton = Dropzone.createElement("<button class='btn btn-sm btn-danger btn-block' item-prop='" + jsonData[0] + "'>Xóa</button>"); var _this = this; removeButton.addEventListener("click", function(e) { e.preventDefault(); e.stopPropagation(); var path = this.getAttribute("item-prop"); $('#removeTempImg').attr('urlPath',jsonData[0]); $('#removeTempImg').click(); _this.removeFile(file); }); file.previewElement.appendChild(removeButton); }); } }; $("#myDropzone").dropzone({ maxFilesize: 0.5, dictResponseError: 'Error uploading file!' }); }); </script>
hopdq/ecom
application/views/Admin/AdminProvider/AddProvider.php
PHP
mit
5,235
[ 30522, 1026, 2806, 1028, 1001, 5815, 20330, 16340, 6279, 1063, 2597, 1024, 7619, 1025, 2327, 1024, 2184, 1003, 1025, 2157, 1024, 1016, 1003, 1025, 9381, 1024, 3770, 1003, 1025, 11687, 4667, 1011, 2327, 1024, 2184, 2361, 2595, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2000-2011 Free Software Foundation, Inc. * * Author: Nikos Mavrogiannopoulos * * This file is part of GnuTLS. * * The GnuTLS is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 3 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> * */ /* Functions that relate to base64 encoding and decoding. */ #include "gnutls_int.h" #include "gnutls_errors.h" #include <gnutls_datum.h> #include <x509_b64.h> static const uint8_t b64table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static const uint8_t asciitable[128] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0x00, /* 0xf1 for '=' */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff }; inline static int encode (char *result, const uint8_t * data, int left) { int data_len; if (left > 3) data_len = 3; else data_len = left; switch (data_len) { case 3: result[0] = b64table[(data[0] >> 2)]; result[1] = b64table[(((((data[0] & 0x03) & 0xff) << 4) & 0xff) | (data[1] >> 4))]; result[2] = b64table[((((data[1] & 0x0f) << 2) & 0xff) | (data[2] >> 6))]; result[3] = b64table[(((data[2] << 2) & 0xff) >> 2)]; break; case 2: result[0] = b64table[(data[0] >> 2)]; result[1] = b64table[(((((data[0] & 0x03) & 0xff) << 4) & 0xff) | (data[1] >> 4))]; result[2] = b64table[(((data[1] << 4) & 0xff) >> 2)]; result[3] = '='; break; case 1: result[0] = b64table[(data[0] >> 2)]; result[1] = b64table[(((((data[0] & 0x03) & 0xff) << 4) & 0xff))]; result[2] = '='; result[3] = '='; break; default: return -1; } return 4; } /* data must be 4 bytes * result should be 3 bytes */ #define TOASCII(c) (c < 127 ? asciitable[c] : 0xff) inline static int decode (uint8_t * result, const opaque * data) { uint8_t a1, a2; int ret = 3; a1 = TOASCII (data[0]); a2 = TOASCII (data[1]); if (a1 == 0xff || a2 == 0xff) return -1; result[0] = ((a1 << 2) & 0xff) | ((a2 >> 4) & 0xff); a1 = a2; a2 = TOASCII (data[2]); if (a2 == 0xff) return -1; result[1] = ((a1 << 4) & 0xff) | ((a2 >> 2) & 0xff); a1 = a2; a2 = TOASCII (data[3]); if (a2 == 0xff) return -1; result[2] = ((a1 << 6) & 0xff) | (a2 & 0xff); if (data[2] == '=') ret--; if (data[3] == '=') ret--; return ret; } #define INCR(what, size) \ do { \ what+=size; \ if (what > ret) { \ gnutls_assert(); \ gnutls_free( (*result)); *result = NULL; \ return GNUTLS_E_INTERNAL_ERROR; \ } \ } while(0) /* encodes data and puts the result into result (locally allocated) * The result_size (including the null terminator) is the return value. */ int _gnutls_fbase64_encode (const char *msg, const uint8_t * data, int data_size, uint8_t ** result) { int i, ret, tmp, j; char tmpres[4]; uint8_t *ptr; uint8_t top[80]; uint8_t bottom[80]; int pos, bytes, top_len, bottom_len; if (msg == NULL || strlen(msg) > 50) { gnutls_assert (); return GNUTLS_E_BASE64_ENCODING_ERROR; } _gnutls_str_cpy (top, sizeof(top), "-----BEGIN "); _gnutls_str_cat (top, sizeof(top), msg); _gnutls_str_cat (top, sizeof(top), "-----"); _gnutls_str_cpy (bottom, sizeof(bottom), "\n-----END "); _gnutls_str_cat (bottom, sizeof(bottom), msg); _gnutls_str_cat (bottom, sizeof(bottom), "-----\n"); top_len = strlen (top); bottom_len = strlen (bottom); ret = B64FSIZE (top_len+bottom_len, data_size); (*result) = gnutls_calloc (1, ret + 1); if ((*result) == NULL) { gnutls_assert (); return GNUTLS_E_MEMORY_ERROR; } bytes = pos = 0; INCR (bytes, top_len); pos = top_len; memcpy (*result, top, top_len); for (i = j = 0; i < data_size; i += 3, j += 4) { tmp = encode (tmpres, &data[i], data_size - i); if (tmp == -1) { gnutls_assert (); gnutls_free ((*result)); *result = NULL; return GNUTLS_E_BASE64_ENCODING_ERROR; } INCR (bytes, 4); ptr = &(*result)[j + pos]; if ((j) % 64 == 0) { INCR (bytes, 1); pos++; *ptr++ = '\n'; } *ptr++ = tmpres[0]; if ((j + 1) % 64 == 0) { INCR (bytes, 1); pos++; *ptr++ = '\n'; } *ptr++ = tmpres[1]; if ((j + 2) % 64 == 0) { INCR (bytes, 1); pos++; *ptr++ = '\n'; } *ptr++ = tmpres[2]; if ((j + 3) % 64 == 0) { INCR (bytes, 1); pos++; *ptr++ = '\n'; } *ptr++ = tmpres[3]; } INCR (bytes, bottom_len); memcpy (&(*result)[bytes - bottom_len], bottom, bottom_len); (*result)[bytes] = 0; return ret + 1; } /** * gnutls_pem_base64_encode: * @msg: is a message to be put in the header * @data: contain the raw data * @result: the place where base64 data will be copied * @result_size: holds the size of the result * * This function will convert the given data to printable data, using * the base64 encoding. This is the encoding used in PEM messages. * * The output string will be null terminated, although the size will * not include the terminating null. * * Returns: On success %GNUTLS_E_SUCCESS (0) is returned, * %GNUTLS_E_SHORT_MEMORY_BUFFER is returned if the buffer given is * not long enough, or 0 on success. **/ int gnutls_pem_base64_encode (const char *msg, const gnutls_datum_t * data, char *result, size_t * result_size) { opaque *ret; int size; size = _gnutls_fbase64_encode (msg, data->data, data->size, &ret); if (size < 0) return size; if (result == NULL || *result_size < (unsigned) size) { gnutls_free (ret); *result_size = size; return GNUTLS_E_SHORT_MEMORY_BUFFER; } else { memcpy (result, ret, size); gnutls_free (ret); *result_size = size - 1; } return 0; } /** * gnutls_pem_base64_encode_alloc: * @msg: is a message to be put in the encoded header * @data: contains the raw data * @result: will hold the newly allocated encoded data * * This function will convert the given data to printable data, using * the base64 encoding. This is the encoding used in PEM messages. * This function will allocate the required memory to hold the encoded * data. * * You should use gnutls_free() to free the returned data. * * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise * an error code is returned. **/ int gnutls_pem_base64_encode_alloc (const char *msg, const gnutls_datum_t * data, gnutls_datum_t * result) { opaque *ret; int size; if (result == NULL) return GNUTLS_E_INVALID_REQUEST; size = _gnutls_fbase64_encode (msg, data->data, data->size, &ret); if (size < 0) return size; result->data = ret; result->size = size - 1; return 0; } /* decodes data and puts the result into result (locally allocated) * The result_size is the return value */ static int _gnutls_base64_decode (const uint8_t * data, size_t data_size, uint8_t ** result) { unsigned int i, j; int ret, tmp, est; uint8_t tmpres[3]; est = ((data_size * 3) / 4) + 1; (*result) = gnutls_malloc (est); if ((*result) == NULL) return GNUTLS_E_MEMORY_ERROR; ret = 0; for (i = j = 0; i < data_size; i += 4, j += 3) { tmp = decode (tmpres, &data[i]); if (tmp < 0) { gnutls_free (*result); *result = NULL; return tmp; } memcpy (&(*result)[j], tmpres, tmp); ret += tmp; } return ret; } /* copies data to result but removes newlines and <CR> * returns the size of the data copied. */ inline static int cpydata (const uint8_t * data, int data_size, uint8_t ** result) { int i, j; (*result) = gnutls_malloc (data_size); if (*result == NULL) return GNUTLS_E_MEMORY_ERROR; for (j = i = 0; i < data_size; i++) { if (data[i] == '\n' || data[i] == '\r' || data[i] == ' ' || data[i] == '\t') continue; (*result)[j] = data[i]; j++; } return j; } /* Searches the given string for ONE PEM encoded certificate, and * stores it in the result. * * The result_size is the return value */ #define ENDSTR "-----" int _gnutls_fbase64_decode (const char *header, const opaque * data, size_t data_size, uint8_t ** result) { int ret; static const char top[] = "-----BEGIN "; static const char bottom[] = "-----END "; uint8_t *rdata; int rdata_size; uint8_t *kdata; int kdata_size; char pem_header[128]; _gnutls_str_cpy (pem_header, sizeof (pem_header), top); if (header != NULL) _gnutls_str_cat (pem_header, sizeof (pem_header), header); rdata = memmem (data, data_size, pem_header, strlen (pem_header)); if (rdata == NULL) { gnutls_assert (); _gnutls_debug_log ("Could not find '%s'\n", pem_header); return GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR; } data_size -= (unsigned long int) rdata - (unsigned long int) data; if (data_size < 4 + strlen (bottom)) { gnutls_assert (); return GNUTLS_E_BASE64_DECODING_ERROR; } kdata = memmem (rdata + 1, data_size - 1, ENDSTR, sizeof (ENDSTR) - 1); /* allow CR as well. */ if (kdata == NULL) { gnutls_assert (); _gnutls_debug_log ("Could not find '%s'\n", ENDSTR); return GNUTLS_E_BASE64_DECODING_ERROR; } data_size -= strlen (ENDSTR); data_size -= (unsigned long int) kdata - (unsigned long int) rdata; rdata = kdata + strlen (ENDSTR); /* position is now after the ---BEGIN--- headers */ kdata = memmem (rdata, data_size, bottom, strlen (bottom)); if (kdata == NULL) { gnutls_assert (); return GNUTLS_E_BASE64_DECODING_ERROR; } /* position of kdata is before the ----END--- footer */ rdata_size = (unsigned long int) kdata - (unsigned long int) rdata; if (rdata_size < 4) { gnutls_assert (); return GNUTLS_E_BASE64_DECODING_ERROR; } kdata_size = cpydata (rdata, rdata_size, &kdata); if (kdata_size < 0) { gnutls_assert (); return kdata_size; } if (kdata_size < 4) { gnutls_assert (); gnutls_free (kdata); return GNUTLS_E_BASE64_DECODING_ERROR; } if ((ret = _gnutls_base64_decode (kdata, kdata_size, result)) < 0) { gnutls_free (kdata); gnutls_assert (); return GNUTLS_E_BASE64_DECODING_ERROR; } gnutls_free (kdata); return ret; } /** * gnutls_pem_base64_decode: * @header: A null terminated string with the PEM header (eg. CERTIFICATE) * @b64_data: contain the encoded data * @result: the place where decoded data will be copied * @result_size: holds the size of the result * * This function will decode the given encoded data. If the header * given is non null this function will search for "-----BEGIN header" * and decode only this part. Otherwise it will decode the first PEM * packet found. * * Returns: On success %GNUTLS_E_SUCCESS (0) is returned, * %GNUTLS_E_SHORT_MEMORY_BUFFER is returned if the buffer given is * not long enough, or 0 on success. **/ int gnutls_pem_base64_decode (const char *header, const gnutls_datum_t * b64_data, unsigned char *result, size_t * result_size) { opaque *ret; int size; size = _gnutls_fbase64_decode (header, b64_data->data, b64_data->size, &ret); if (size < 0) return size; if (result == NULL || *result_size < (unsigned) size) { gnutls_free (ret); *result_size = size; return GNUTLS_E_SHORT_MEMORY_BUFFER; } else { memcpy (result, ret, size); gnutls_free (ret); *result_size = size; } return 0; } /** * gnutls_pem_base64_decode_alloc: * @header: The PEM header (eg. CERTIFICATE) * @b64_data: contains the encoded data * @result: the place where decoded data lie * * This function will decode the given encoded data. The decoded data * will be allocated, and stored into result. If the header given is * non null this function will search for "-----BEGIN header" and * decode only this part. Otherwise it will decode the first PEM * packet found. * * You should use gnutls_free() to free the returned data. * * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise * an error code is returned. **/ int gnutls_pem_base64_decode_alloc (const char *header, const gnutls_datum_t * b64_data, gnutls_datum_t * result) { opaque *ret; int size; if (result == NULL) return GNUTLS_E_INVALID_REQUEST; size = _gnutls_fbase64_decode (header, b64_data->data, b64_data->size, &ret); if (size < 0) return size; result->data = ret; result->size = size; return 0; }
ppelleti/gnutls
lib/x509_b64.c
C
gpl-3.0
14,310
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 30524, 2618, 2009, 1998, 1013, 2030, 1008, 19933, 2009, 2104, 1996, 3408, 1997, 1996, 27004, 8276, 2236, 2270, 6105, 1008, 2004, 2405, 2011, 1996, 2489, 4007, 3192, 1025, 2593, 2544, 1017, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# rx-testforprescription Test for prescription, which provided via Greenify. Don't fork it or import it to Greenify, it is ONLY FOR TESTING! TAKE IT ON YOUR RISK! https://greenify.github.io/WitherZuo/rx-testforprescription
WitherZuo/rx-cleanmaster-services
README.md
Markdown
gpl-3.0
228
[ 30522, 1001, 1054, 2595, 1011, 3231, 29278, 28994, 23235, 3258, 3231, 2005, 20422, 1010, 2029, 3024, 3081, 2665, 8757, 1012, 2123, 1005, 1056, 9292, 2009, 2030, 12324, 2009, 2000, 2665, 8757, 1010, 2009, 2003, 2069, 2005, 5604, 999, 2202, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title>amCharts Data Loader Example</title> <script src="http://www.amcharts.com/lib/3/amcharts.js"></script> <script src="http://www.amcharts.com/lib/3/pie.js"></script> <script src="../dataloader.min.js"></script> <style> body, html { font-family: Verdana; font-size: 12px; } #chartdiv { width: 100%; height: 500px; } </style> <script> AmCharts.makeChart("chartdiv", { "type": "pie", "dataLoader": { "url": "data/pie.csv", "format": "csv", "delimiter": ",", "useColumnNames": true }, "titleField": "country", "valueField": "litres", "balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>", "innerRadius": "30%", "legend": { "align": "center", "markerType": "circle" }, "responsive": { "enabled": true, "addDefaultRules": true, "rules": [ { "minWidth": 500, "overrides": { "innerRadius": "50%", } } ] } }); </script> </head> <body> <div id="chartdiv"></div> </body> </html>
liushuishang/YayCrawler
yaycrawler.admin/src/main/resources/static/assets/global/plugins/amcharts/amstockcharts/plugins/dataloader/examples/pie_csv.html
HTML
lgpl-3.0
1,448
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 5890, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, 19817, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (c) 2016, JInterval Project. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package net.java.jinterval.expression.example; import net.java.jinterval.expression.CodeList; import net.java.jinterval.expression.Expression; import net.java.jinterval.expression.OptimizationProblem; /** * Формулы из Количественная оценка неопределённости пожарного риска. Сценарий * аварии "Пожар пролива ЛВЖ" Проблемы анализа риска, том 11, 2014Б ном. 4 */ public class FireRisk { /** * Enum to choose input variable */ public enum From { tpac_T_uw_d, L_d_theta, a_b_theta }; /** * Enum to choose objective function. */ public enum To { F, Fv, Fh, Fsqr } /** * Create optimization problem minimizing Fv on (l,d,theta) inputs. * * @return OptimizationProblem */ public static OptimizationProblem createOptimizationProblemLdMinFv() { return createOptimizationProblem(From.L_d_theta, To.Fv, false); } /** * Create optimization problem maximizing Fv on (tpac,T,uw,d) inputs. * * @return OptimizationProblem */ public static OptimizationProblem createOptimizationProblemTempMaxFv() { return createOptimizationProblem(From.tpac_T_uw_d, To.Fv, true); } /** * Create optimization problem * * @param from choose input variables * @param to choose objective function * @param neg true to negate objective function * @return OptimizationProblem */ public static OptimizationProblem createOptimizationProblem(From from, To to, boolean neg) { String[] box; switch (from) { case tpac_T_uw_d: box = new String[]{ "[50.0,170.0]", // tpac "[254.0,299.0]", // T "[2.3,9.0]", // uw "[15.2,34.8]" // d }; break; case L_d_theta: box = new String[]{ "[19.1,55.2]", // L "[15.2,34.8]", // d "[0,1.18]" // theta }; break; case a_b_theta: box = new String[]{ "[382/348,1104/152]", // a = 2*L/d "[2000/348,2000/152]", // b = 2*X/d "[0,1.18]" // theta }; break; default: throw new AssertionError(); } return new OptimizationProblem(createObjective(from, to, neg), box); } /** * Create objective function * * @param from choose input variables * @param to choose objective function * @param neg true to negate objective function * @return objective function */ public static Expression createObjective(From from, To to, boolean neg) { Subclass fr = new Subclass(from); Expression objective; switch (to) { case F: objective = fr.F; break; case Fv: objective = fr.Fv(); break; case Fh: objective = fr.Fh(); break; case Fsqr: objective = fr.Fsqr(); break; default: throw new AssertionError(); } return neg ? objective.neg().name("neg_" + objective.name()) : objective; } final CodeList cl; final From from; FireRisk(From from) { this.from = from; switch (from) { case tpac_T_uw_d: cl = CodeList.create("tpac", "T", "uw", "d"); break; case L_d_theta: cl = CodeList.create("L", "d", "theta"); break; case a_b_theta: cl = CodeList.create("a", "b", "theta"); break; default: throw new AssertionError(); } } boolean from(From from) { return this.from.ordinal() <= from.ordinal(); } Expression n(String literal) { return cl.lit(literal); } public static class Subclass extends FireRisk { Subclass(From from) { super(from); } // Constants public Expression m_prime = n("0.06").name("m_prime"); public Expression g = n("9.81").name("g"); public Expression Tnom = n("288.15").name("Tnom"); public Expression ro_v_nom = n("1.225").name("ro_v_nom"); public Expression X = n("100").name("X"); public Expression V_mu = n("22.413").name("V_mu"); public Expression k_factor = n("1.216").div(n("0.67668")).name("k_factor"); public Expression c1Pi = cl.pi().recip().name("c1Pi"); public Expression tpac = from(From.tpac_T_uw_d) ? cl.getInp(0) : null; public Expression T = from(From.tpac_T_uw_d) ? cl.getInp(1) : null; public Expression uw = from(From.tpac_T_uw_d) ? cl.getInp(2) : null; public Expression d = from(From.tpac_T_uw_d) ? cl.getInp(3) : from(From.L_d_theta) ? cl.getInp(1) : null; /*0*/ public Expression k = from(From.tpac_T_uw_d) ? k_factor.mul(tpac.rootn(3)).name("k") : null; public Expression mu0 = from(From.tpac_T_uw_d) ? n("7").mul(k).sub(n("21.5")).name("mu0") : null; public Expression mu1 = from(From.tpac_T_uw_d) ? n("0.76").sub(n("0.04").mul(k)).name("mu1") : null; public Expression mu2 = from(From.tpac_T_uw_d) ? n("0.0003").mul(k).sub(n("0.00245")).name("mu2") : null; /*1*/ public Expression mu = from(From.tpac_T_uw_d) ? mu0.add(mu1.mul(tpac)).add(mu2.mul(tpac.sqr())).name("mu") : null; /*2*/ public Expression ro_p = from(From.tpac_T_uw_d) ? mu.div(V_mu.mul(n("1").add(n("0.00367").mul(tpac)))).name("ro_p") : null; public Expression u_star_arg = from(From.tpac_T_uw_d) ? ro_p.div(m_prime.mul(g).mul(d)) : null; /*3*/ public Expression u_star = from(From.tpac_T_uw_d) ? uw.mul(u_star_arg.rootn(3)).max(n("1")).name("u_star") : null; /*4*/ public Expression ro_v = from(From.tpac_T_uw_d) ? Tnom.mul(ro_v_nom).div(T).name("ro_v") : null; /*5*/ public Expression L = from(From.tpac_T_uw_d) ? n("55") .mul(m_prime.pow(n("0.67"))) .div(g.pow(n("0.335"))) .mul(d.pow(n("0.665"))) .mul(u_star.pow(n("0.21"))) .div(ro_v.pow(n("0.67"))) .name("L") : from(From.L_d_theta) ? cl.getInp(0) : null; /*6*/ public Expression theta = from(From.tpac_T_uw_d) ? u_star.sqrt().recip().acos().name("theta") : from(From.L_d_theta) ? cl.getInp(2) : from(From.a_b_theta) ? cl.getInp(2) : null; /*7*/ public Expression a = from(From.L_d_theta) ? L.mul(n("2")).div(d).name("a") : from(From.a_b_theta) ? cl.getInp(0) : null; /*8*/ public Expression b = from(From.L_d_theta) ? n("2").mul(X).div(d).name("b") : from(From.a_b_theta) ? cl.getInp(1) : null; public Expression bp1 = b.add(n("1")).name("bp1"); public Expression bm1 = b.sub(n("1")).name("bm1"); public Expression sinth = theta.sin().name("sinth"); public Expression costh = theta.cos().name("costh"); public Expression A_arg = a.sqr() .add(bp1.sqr()) .sub(n("2").mul(a.mul(bp1).mul(sinth))) .name("A_arg"); /*9*/ public Expression A = A_arg.sqrt().name("A"); public Expression B_arg = a.sqr() .add(bm1.sqr()) .sub(n("2").mul(a.mul(bm1).mul(sinth))) .name("B_arg"); /*10*/ public Expression B = B_arg.sqrt().name("B"); public Expression C_arg = n("1").add((b.sqr().sub(n("1"))).mul(costh.sqr())).name("C_arg"); /*11*/ public Expression C = C_arg.sqrt().name("C"); public Expression D_arg = from(From.L_d_theta) ? n("2").mul(X).sub(d) .div(n("2").mul(X).add(d)) .name("D_arg") : from(From.a_b_theta) ? bm1.div(bp1).sqrt() : null; /*12*/ public Expression D = D_arg.sqrt().name("D"); /*13*/ public Expression E = from(From.L_d_theta) ? L.mul(costh) .div(X.sub(L.mul(sinth))) .name("E") : from(From.a_b_theta) ? a.mul(costh).div(b.sub(a.mul(sinth))) : null; /*14*/ public Expression F_arg = b.sqr().sub(n("1")).name("F_arg"); public Expression F = F_arg.sqrt().name("F"); public Expression ab = a.mul(b).name("ab"); public Expression AB = A.mul(B).name("AB"); public Expression S1arg = ab.sub(F.sqr().mul(sinth)) .div(F.mul(C)).name("S1arg"); public Expression S1 = S1arg.atan().name("S1"); public Expression S2arg = F.mul(sinth).div(C).name("S2arg"); public Expression S2 = S2arg.atan().name("S2"); public Expression S = S1.add(S2).name("S"); public Expression ADB = A.mul(D).div(B).name("ADB"); public Expression atanADB = ADB.atan().name("atanADB"); public Expression Fv() { Expression abFv = a.sqr() .add(b.add(n("1")).sqr()) .sub(n("2").mul(b).mul(n("1").add(a.mul(sinth)))) .name("abFv"); Expression Fv1 = E.neg().mul(D.atan()).name("Fv1"); Expression Fv2 = E.mul(abFv).div(AB).mul(atanADB).name("Fv2"); Expression Fv3 = costh.div(C).mul(S).name("Fv3"); Expression Fv = cl.pi().recip().mul(Fv1.add(Fv2.add(Fv3))).name("Fv"); return Fv; } public Expression Fh() { Expression abFh = a.sqr() .add(b.add(n("1")).sqr()) .sub(n("2").mul(b.add(n("1")).add(ab.mul(sinth)))) .name("abFh"); Expression Fh1 = D.recip().atan().name("Fh1"); Expression Fh2 = sinth.div(C).mul(S).name("Fh2"); Expression Fh3 = abFh.div(AB).mul(atanADB).name("Fh3"); Expression Fh = c1Pi.mul(Fh1.add(Fh2).sub(Fh3)).name("Fh"); return Fh; } public Expression Fsqr() { return Fv().sqr() .add(Fh().sqr()) .name("Fsqr"); } } }
jinterval/jinterval
jinterval-expression/src/main/java/net/java/jinterval/expression/example/FireRisk.java
Java
bsd-2-clause
12,563
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2355, 1010, 9743, 3334, 10175, 2622, 1012, 1008, 2035, 2916, 9235, 1012, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302, 1008, 14080, 1010, 2024, 7936, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.turlir.abakgists.allgists.view.listing; import androidx.recyclerview.widget.RecyclerView; import android.view.View; abstract class ModelViewHolder<T> extends RecyclerView.ViewHolder { ModelViewHolder(View itemView) { super(itemView); } abstract void bind(T model); }
iljaosintsev/Apress-Gists
app/src/main/java/com/turlir/abakgists/allgists/view/listing/ModelViewHolder.java
Java
apache-2.0
305
[ 30522, 7427, 4012, 1012, 10722, 12190, 4313, 1012, 19557, 2243, 24063, 2015, 1012, 2035, 24063, 2015, 1012, 3193, 1012, 10328, 1025, 12324, 11924, 2595, 1012, 28667, 2100, 14321, 2099, 8584, 1012, 15536, 24291, 1012, 28667, 2100, 14321, 2099,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
robinette ========= robinette is a simple IRC bot composed of two main components, client and server. The Client ---------- Client uses the twisted library. It's a thin client, which just receives and sends messages from and to the IRC server. Upon receiving an IRC message, it sends a request to the backend, and sends it's response back to IRC (if any). The Server (backend) -------------------- Server is an asynchronous XML-RPC service which does all the work. It processes the IRC message sent from the client and based on it's context creates a response, which is sent back to the client. It also logs all the events and messages to a MongoDB database. This client/server architecture allows us to add new features/commands to the bot without having to restart and disconnect the client from the IRC server, because all new features just need to be added to the server, and the client can then use them instantialy. Implemented functionality (available commands) ---------------------------------------------- * Seen - `!seen <nick>` (returns the last time `nick` was seen) * Backlog - `!backlog` Backlog returns a list of messages with timestamps less than the last user login time. This allows to user to see messages that were sent to the channel when he was logged out. Backlog returns the last 10 messages, if the user needs older messages, he can issue another `!backlog` command, fetching another 10 messages from the buffer. The buffer duration is set to 10 minutes, then it gets reset, and another !backlog command returns the last 10 messages again. * Stock quotes - `!quote <symbol>` (returns the realtime bid and ask stock prices for `symbol`) * Youtube - parses a youtube link, if it appears in the message, and sends a message with the title of the video * Chat - a simple markov chain chatbot responds to messages addressed to the bot
mgracik/robinette
README.md
Markdown
mit
1,875
[ 30522, 5863, 7585, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 5863, 7585, 2003, 1037, 3722, 20868, 2278, 28516, 3605, 1997, 2048, 2364, 6177, 1010, 7396, 1998, 8241, 1012, 1996, 7396, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Copyright (C) 2012 Typesafe, Inc. <http://www.typesafe.com> */ package org.pantsbuild.zinc import java.io.File import sbt.io.{ Hash, IO } import sbt.io.syntax._ object Util { // // Time // /** * Current timestamp and time passed since start time. */ def timing(start: Long): String = { val end = System.currentTimeMillis "at %s [%s]" format (dateTime(end), duration(end - start)) } /** * Format a minutes:seconds.millis time. */ def duration(millis: Long): String = { val secs = millis / 1000 val (m, s, ms) = (secs / 60, secs % 60, millis % 1000) if (m > 0) "%d:%02d.%03ds" format (m, s, ms) else "%d.%03ds" format (s, ms) } /** * Creating a readable timestamp. */ def dateTime(time: Long): String = { java.text.DateFormat.getDateTimeInstance().format(new java.util.Date(time)) } // // Files // /** * Normalise file in relation to actual current working directory. */ def normalise(cwd: Option[File])(file: File): File = { if (cwd.isDefined && !file.isAbsolute) new File(cwd.get, file.getPath) else file } /** * Normalise optional file in relation to actual current working directory. */ def normaliseOpt(cwd: Option[File])(optFile: Option[File]): Option[File] = { if (cwd.isDefined) optFile map normalise(cwd) else optFile } /** * Normalise file pair in relation to actual current working directory. */ def normalisePair(cwd: Option[File])(pair: (File, File)): (File, File) = { if (cwd.isDefined) (normalise(cwd)(pair._1), normalise(cwd)(pair._2)) else pair } /** * Normalise sequence of files in relation to actual current working directory. */ def normaliseSeq(cwd: Option[File])(files: Seq[File]): Seq[File] = { if (cwd.isDefined) files map normalise(cwd) else files } /** * Normalise file map in relation to actual current working directory. */ def normaliseMap(cwd: Option[File])(mapped: Map[File, File]): Map[File, File] = { if (cwd.isDefined) mapped map { case (l, r) => (normalise(cwd)(l), normalise(cwd)(r)) } else mapped } /** * Normalise file sequence map in relation to actual current working directory. */ def normaliseSeqMap(cwd: Option[File])(mapped: Map[Seq[File], File]): Map[Seq[File], File] = { if (cwd.isDefined) mapped map { case (l, r) => (normaliseSeq(cwd)(l), normalise(cwd)(r)) } else mapped } /** * Fully relativize a path, relative to any other base. */ def relativize(base: File, path: File): String = { import scala.tools.nsc.io.Path._ (base relativize path).toString } /** * Check a file is writable. */ def checkWritable(file: File) = { if (file.exists) file.canWrite else file.getParentFile.canWrite } /** * Clean all class files from a directory. */ def cleanAllClasses(dir: File): Unit = { import sbt.io.Path._ IO.delete((dir ** "*.class").get) } /** * Hash of a file's canonical path. */ def pathHash(file: File): String = { Hash.toHex(Hash(file.getCanonicalPath)) } // // Properties // /** * Create int from system property. */ def intProperty(name: String, default: Int): Int = { val value = System.getProperty(name) if (value ne null) try value.toInt catch { case _: Exception => default } else default } /** * Create set of strings, split by comma, from system property. */ def stringSetProperty(name: String, default: Set[String]): Set[String] = { val value = System.getProperty(name) if (value ne null) (value split ",").toSet else default } /** * Create a file, default empty, from system property. */ def fileProperty(name: String): File = new File(System.getProperty(name, "")) /** * Create an option file from system property. */ def optFileProperty(name: String): Option[File] = Option(System.getProperty(name, null)).map(new File(_)) /** * Get a property from a properties file resource in the classloader. */ def propertyFromResource(resource: String, property: String, classLoader: ClassLoader): Option[String] = { val props = propertiesFromResource(resource, classLoader) Option(props.getProperty(property)) } /** * Get all properties from a properties file resource in the classloader. */ def propertiesFromResource(resource: String, classLoader: ClassLoader): java.util.Properties = { val props = new java.util.Properties val stream = classLoader.getResourceAsStream(resource) try { props.load(stream) } catch { case e: Exception => } finally { if (stream ne null) stream.close } props } /** * Set system properties. */ def setProperties(props: Seq[String]): Unit = { for (prop <- props) { val kv = prop split "=" if (kv.length == 2) System.setProperty(kv(0), kv(1)) } } // // Timers // /** * Simple duration regular expression. */ val Duration = """(\d+)([hms])""".r /** * Milliseconds from string duration of the form Nh|Nm|Ns, otherwise default. */ def duration(arg: String, default: Long): Long = arg match { case Duration(length, unit) => val multiplier = unit match { case "h" => 60 * 60 * 1000 case "m" => 60 * 1000 case "s" => 1000 case _ => 0 } try { length.toLong * multiplier } catch { case _: Exception => default } case _ => default } /** * Schedule a resettable timer. */ def timer(delay: Long)(body: => Unit) = new Alarm(delay)(body) /** * Resettable timer. */ class Alarm(delay: Long)(body: => Unit) { import java.util.{ Timer, TimerTask } private[this] var timer: Timer = _ private[this] var task: TimerTask = _ schedule() private[this] def schedule(): Unit = { if ((task eq null) && delay > 0) { if (timer eq null) timer = new Timer(true) // daemon = true task = new TimerTask { def run = body } timer.schedule(task, delay) } } def reset(): Unit = synchronized { if (task ne null) { task.cancel(); task = null } schedule() } def cancel(): Unit = if (timer ne null) timer.cancel() } // // Debug output // /** * General utility for displaying objects for debug output. */ def show(thing: Any, output: String => Unit, prefix: String = "", level: Int = 0): Unit = { def out(s: String) = output((" " * level) + s) thing match { case (label: Any, value: Any) => show(value, output, label.toString + " = ", level) case Some(value: Any) => show(value, output, prefix, level) case None => out(prefix) case t: Traversable[_] if t.isEmpty => out(prefix + "{}") case t: Traversable[_] => out(prefix + "{") t foreach { a => show(a, output, "", level + 1) } out("}") case any => out(prefix + any.toString) } } def counted(count: Int, prefix: String, single: String, plural: String): String = { count.toString + " " + prefix + (if (count == 1) single else plural) } }
pombredanne/pants
src/scala/org/pantsbuild/zinc/Util.scala
Scala
apache-2.0
7,087
[ 30522, 1013, 1008, 1008, 1008, 9385, 1006, 1039, 1007, 2262, 4127, 10354, 2063, 1010, 4297, 1012, 1026, 8299, 1024, 1013, 1013, 7479, 1012, 4127, 10354, 2063, 1012, 4012, 1028, 1008, 1013, 7427, 8917, 1012, 6471, 8569, 4014, 2094, 1012, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Mantle.Hosting.WindowsServices")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Mantle.Hosting.WindowsServices")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("0b326e33-cab6-4469-bd97-56857458025b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
caseywatson/Mantle
v0/Mantle/Mantle.Hosting.WindowsServices/Properties/AssemblyInfo.cs
C#
mit
1,436
[ 30522, 2478, 2291, 1012, 9185, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 21624, 8043, 7903, 2229, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 6970, 11923, 2121, 7903, 2229, 1025, 1013, 1013, 2236, 2592, 2055, 2019, 3320, 2003, 4758, 2083, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Geopaparazzi - Digital field mapping on Android based devices * Copyright (C) 2016 HydroloGIS (www.hydrologis.com) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package eu.geopaparazzi.core.preferences; import android.content.Context; import android.content.res.TypedArray; import android.preference.DialogPreference; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.widget.ArrayAdapter; import android.widget.LinearLayout; import android.widget.Spinner; import eu.geopaparazzi.core.R; import eu.geopaparazzi.library.locale.LocaleUtils; /** * A custom preference to force a particular locale, even if the OS is on another. * * @author Andrea Antonello (www.hydrologis.com) */ public class ForceLocalePreference extends DialogPreference { public static final String PREFS_KEY_FORCELOCALE = "PREFS_KEY_FORCELOCALE";//NON-NLS private Context context; private Spinner localesSpinner; /** * @param ctxt the context to use. * @param attrs attributes. */ public ForceLocalePreference(Context ctxt, AttributeSet attrs) { super(ctxt, attrs); this.context = ctxt; setPositiveButtonText(ctxt.getString(android.R.string.ok)); setNegativeButtonText(ctxt.getString(android.R.string.cancel)); } @Override protected View onCreateDialogView() { LinearLayout mainLayout = new LinearLayout(context); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mainLayout.setLayoutParams(layoutParams); mainLayout.setOrientation(LinearLayout.VERTICAL); mainLayout.setPadding(25, 25, 25, 25); localesSpinner = new Spinner(context); localesSpinner.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); localesSpinner.setPadding(15, 5, 15, 5); final String[] localesArray = context.getResources().getStringArray(R.array.locales); ArrayAdapter<String> adapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item, localesArray); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); localesSpinner.setAdapter(adapter); final String currentLocale = LocaleUtils.getCurrentLocale(context); if (currentLocale != null) { for (int i = 0; i < localesArray.length; i++) { if (localesArray[i].equals(currentLocale.trim())) { localesSpinner.setSelection(i); break; } } } mainLayout.addView(localesSpinner); return mainLayout; } @Override protected void onBindDialogView(View v) { super.onBindDialogView(v); } @Override protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); if (positiveResult) { String selectedLocale = localesSpinner.getSelectedItem().toString(); LocaleUtils.changeLang(context, selectedLocale); } } @Override protected Object onGetDefaultValue(TypedArray a, int index) { return (a.getString(index)); } @Override protected void onSetInitialValue(boolean restoreValue, Object defaultValue) { } }
geopaparazzi/geopaparazzi
geopaparazzi_core/src/main/java/eu/geopaparazzi/core/preferences/ForceLocalePreference.java
Java
gpl-3.0
4,020
[ 30522, 1013, 1008, 1008, 20248, 4502, 28689, 13793, 1011, 30524, 2483, 1012, 4012, 1007, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 1008, 2009, 2104, 1996, 3408, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_91) on Mon Jun 06 14:51:11 EDT 2016 --> <title>Lists.Value (apache-cassandra API)</title> <meta name="date" content="2016-06-06"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Lists.Value (apache-cassandra API)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":9,"i2":10,"i3":10}; var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/Lists.Value.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/apache/cassandra/cql3/Lists.SetterByIndex.html" title="class in org.apache.cassandra.cql3"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../org/apache/cassandra/cql3/Maps.html" title="class in org.apache.cassandra.cql3"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/cassandra/cql3/Lists.Value.html" target="_top">Frames</a></li> <li><a href="Lists.Value.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.apache.cassandra.cql3</div> <h2 title="Class Lists.Value" class="title">Class Lists.Value</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li><a href="../../../../org/apache/cassandra/cql3/Term.Terminal.html" title="class in org.apache.cassandra.cql3">org.apache.cassandra.cql3.Term.Terminal</a></li> <li> <ul class="inheritance"> <li><a href="../../../../org/apache/cassandra/cql3/Term.MultiItemTerminal.html" title="class in org.apache.cassandra.cql3">org.apache.cassandra.cql3.Term.MultiItemTerminal</a></li> <li> <ul class="inheritance"> <li>org.apache.cassandra.cql3.Lists.Value</li> </ul> </li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd><a href="../../../../org/apache/cassandra/cql3/Term.html" title="interface in org.apache.cassandra.cql3">Term</a></dd> </dl> <dl> <dt>Enclosing class:</dt> <dd><a href="../../../../org/apache/cassandra/cql3/Lists.html" title="class in org.apache.cassandra.cql3">Lists</a></dd> </dl> <hr> <br> <pre>public static class <span class="typeNameLabel">Lists.Value</span> extends <a href="../../../../org/apache/cassandra/cql3/Term.MultiItemTerminal.html" title="class in org.apache.cassandra.cql3">Term.MultiItemTerminal</a></pre> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== NESTED CLASS SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="nested.class.summary"> <!-- --> </a> <h3>Nested Class Summary</h3> <ul class="blockList"> <li class="blockList"><a name="nested.classes.inherited.from.class.org.apache.cassandra.cql3.Term"> <!-- --> </a> <h3>Nested classes/interfaces inherited from interface&nbsp;org.apache.cassandra.cql3.<a href="../../../../org/apache/cassandra/cql3/Term.html" title="interface in org.apache.cassandra.cql3">Term</a></h3> <code><a href="../../../../org/apache/cassandra/cql3/Term.MultiColumnRaw.html" title="class in org.apache.cassandra.cql3">Term.MultiColumnRaw</a>, <a href="../../../../org/apache/cassandra/cql3/Term.MultiItemTerminal.html" title="class in org.apache.cassandra.cql3">Term.MultiItemTerminal</a>, <a href="../../../../org/apache/cassandra/cql3/Term.NonTerminal.html" title="class in org.apache.cassandra.cql3">Term.NonTerminal</a>, <a href="../../../../org/apache/cassandra/cql3/Term.Raw.html" title="class in org.apache.cassandra.cql3">Term.Raw</a>, <a href="../../../../org/apache/cassandra/cql3/Term.Terminal.html" title="class in org.apache.cassandra.cql3">Term.Terminal</a></code></li> </ul> </li> </ul> <!-- =========== FIELD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="field.summary"> <!-- --> </a> <h3>Field Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> <caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>java.util.List&lt;java.nio.ByteBuffer&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/cassandra/cql3/Lists.Value.html#elements">elements</a></span></code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/cassandra/cql3/Lists.Value.html#Value-java.util.List-">Value</a></span>(java.util.List&lt;java.nio.ByteBuffer&gt;&nbsp;elements)</code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/cassandra/cql3/Lists.Value.html#equals-org.apache.cassandra.db.marshal.ListType-org.apache.cassandra.cql3.Lists.Value-">equals</a></span>(<a href="../../../../org/apache/cassandra/db/marshal/ListType.html" title="class in org.apache.cassandra.db.marshal">ListType</a>&nbsp;lt, <a href="../../../../org/apache/cassandra/cql3/Lists.Value.html" title="class in org.apache.cassandra.cql3">Lists.Value</a>&nbsp;v)</code>&nbsp;</td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>static <a href="../../../../org/apache/cassandra/cql3/Lists.Value.html" title="class in org.apache.cassandra.cql3">Lists.Value</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/cassandra/cql3/Lists.Value.html#fromSerialized-java.nio.ByteBuffer-org.apache.cassandra.db.marshal.ListType-int-">fromSerialized</a></span>(java.nio.ByteBuffer&nbsp;value, <a href="../../../../org/apache/cassandra/db/marshal/ListType.html" title="class in org.apache.cassandra.db.marshal">ListType</a>&nbsp;type, int&nbsp;version)</code>&nbsp;</td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code>java.nio.ByteBuffer</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/cassandra/cql3/Lists.Value.html#get-int-">get</a></span>(int&nbsp;protocolVersion)</code>&nbsp;</td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code>java.util.List&lt;java.nio.ByteBuffer&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/cassandra/cql3/Lists.Value.html#getElements--">getElements</a></span>()</code>&nbsp;</td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.org.apache.cassandra.cql3.Term.Terminal"> <!-- --> </a> <h3>Methods inherited from class&nbsp;org.apache.cassandra.cql3.<a href="../../../../org/apache/cassandra/cql3/Term.Terminal.html" title="class in org.apache.cassandra.cql3">Term.Terminal</a></h3> <code><a href="../../../../org/apache/cassandra/cql3/Term.Terminal.html#addFunctionsTo-java.util.List-">addFunctionsTo</a>, <a href="../../../../org/apache/cassandra/cql3/Term.Terminal.html#bind-org.apache.cassandra.cql3.QueryOptions-">bind</a>, <a href="../../../../org/apache/cassandra/cql3/Term.Terminal.html#bindAndGet-org.apache.cassandra.cql3.QueryOptions-">bindAndGet</a>, <a href="../../../../org/apache/cassandra/cql3/Term.Terminal.html#collectMarkerSpecification-org.apache.cassandra.cql3.VariableSpecifications-">collectMarkerSpecification</a>, <a href="../../../../org/apache/cassandra/cql3/Term.Terminal.html#containsBindMarker--">containsBindMarker</a></code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ FIELD DETAIL =========== --> <ul class="blockList"> <li class="blockList"><a name="field.detail"> <!-- --> </a> <h3>Field Detail</h3> <a name="elements"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>elements</h4> <pre>public final&nbsp;java.util.List&lt;java.nio.ByteBuffer&gt; elements</pre> </li> </ul> </li> </ul> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="Value-java.util.List-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>Value</h4> <pre>public&nbsp;Value(java.util.List&lt;java.nio.ByteBuffer&gt;&nbsp;elements)</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="fromSerialized-java.nio.ByteBuffer-org.apache.cassandra.db.marshal.ListType-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>fromSerialized</h4> <pre>public static&nbsp;<a href="../../../../org/apache/cassandra/cql3/Lists.Value.html" title="class in org.apache.cassandra.cql3">Lists.Value</a>&nbsp;fromSerialized(java.nio.ByteBuffer&nbsp;value, <a href="../../../../org/apache/cassandra/db/marshal/ListType.html" title="class in org.apache.cassandra.db.marshal">ListType</a>&nbsp;type, int&nbsp;version) throws <a href="../../../../org/apache/cassandra/exceptions/InvalidRequestException.html" title="class in org.apache.cassandra.exceptions">InvalidRequestException</a></pre> <dl> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="../../../../org/apache/cassandra/exceptions/InvalidRequestException.html" title="class in org.apache.cassandra.exceptions">InvalidRequestException</a></code></dd> </dl> </li> </ul> <a name="get-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>get</h4> <pre>public&nbsp;java.nio.ByteBuffer&nbsp;get(int&nbsp;protocolVersion)</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../../../org/apache/cassandra/cql3/Term.Terminal.html#get-int-">get</a></code>&nbsp;in class&nbsp;<code><a href="../../../../org/apache/cassandra/cql3/Term.Terminal.html" title="class in org.apache.cassandra.cql3">Term.Terminal</a></code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the serialized value of this terminal.</dd> </dl> </li> </ul> <a name="equals-org.apache.cassandra.db.marshal.ListType-org.apache.cassandra.cql3.Lists.Value-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>equals</h4> <pre>public&nbsp;boolean&nbsp;equals(<a href="../../../../org/apache/cassandra/db/marshal/ListType.html" title="class in org.apache.cassandra.db.marshal">ListType</a>&nbsp;lt, <a href="../../../../org/apache/cassandra/cql3/Lists.Value.html" title="class in org.apache.cassandra.cql3">Lists.Value</a>&nbsp;v)</pre> </li> </ul> <a name="getElements--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>getElements</h4> <pre>public&nbsp;java.util.List&lt;java.nio.ByteBuffer&gt;&nbsp;getElements()</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../../../org/apache/cassandra/cql3/Term.MultiItemTerminal.html#getElements--">getElements</a></code>&nbsp;in class&nbsp;<code><a href="../../../../org/apache/cassandra/cql3/Term.MultiItemTerminal.html" title="class in org.apache.cassandra.cql3">Term.MultiItemTerminal</a></code></dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/Lists.Value.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/apache/cassandra/cql3/Lists.SetterByIndex.html" title="class in org.apache.cassandra.cql3"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../org/apache/cassandra/cql3/Maps.html" title="class in org.apache.cassandra.cql3"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/cassandra/cql3/Lists.Value.html" target="_top">Frames</a></li> <li><a href="Lists.Value.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &copy; 2016 The Apache Software Foundation</small></p> </body> </html>
jasonwee/videoOnCloud
lib/cassandra/apache-cassandra-3.7/javadoc/org/apache/cassandra/cql3/Lists.Value.html
HTML
apache-2.0
18,169
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 5890, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require 'spec_helper' describe "WeatherVane::HashComparer" do describe "when the target hash is missing a key from the source hash" do it "returns false" do target = {} source = {'a' => 1} WeatherVane::HashComparer.valid?(target, source).should be_false end end describe "when the target hash has the same top level keys as the source hash" do it "returns true" do target = {'a' => 1} source = {'a' => 1} WeatherVane::HashComparer.valid?(target, source).should be_true end end describe "when the target hash a key with a different value from the source hash" do it "returns true" do target = {'a' => 2} source = {'a' => 1} WeatherVane::HashComparer.valid?(target, source).should be_true end end describe "when the target hash has a key not in the source hash" do it "returns true" do target = {'a' => 2, 'b' => 3} source = {'a' => 1} WeatherVane::HashComparer.valid?(target, source).should be_true end end describe "when the target hash is missing a 2nd level key from the source hash" do it "returns false" do target = {'a' => {'c' => 4}} source = {'a' => {'b' => 2, 'c' => 3}} WeatherVane::HashComparer.valid?(target, source).should be_false end end describe "when the target hash has a 2nd level key not in the source hash" do it "returns true" do target = {'a' => {'b' => 2, 'c' => 3}} source = {'a' => {'c' => 4}} WeatherVane::HashComparer.valid?(target, source).should be_true end end describe "when the target hash is missing a 2nd level key from the source hash" do it "returns false" do target = {'a' => 1} source = {'a' => {'b' => 2, 'c' => 3}} WeatherVane::HashComparer.valid?(target, source).should be_false end end describe "when the target hash has another level when the source expects a value" do it "returns false" do target = {'a' => {'b' => 2, 'c' => 3}} source = {'a' => 1} WeatherVane::HashComparer.valid?(target, source).should be_false end end context "when the target and source use different keys types" do it "handles target is string and source is symbol" do target = {'a' => 1} source = {:a => 1} WeatherVane::HashComparer.valid?(target, source).should be_true end it "handles target is symbol and source is string" do target = {:a => 1} source = {'a' => 1} WeatherVane::HashComparer.valid?(target, source).should be_true end it "handles target is string and source is symbol for multi-levels" do target = {'a' => {'b' => 2, 'c' => 3}} source = {:a => {'c' => 4}} WeatherVane::HashComparer.valid?(target, source).should be_true end it "handles target is symbol and source is string for multi-levels" do target = {:a => {'b' => 2, 'c' => 3}} source = {'a' => {'c' => 4}} WeatherVane::HashComparer.valid?(target, source).should be_true end end end
attack/weather_vane
spec/utility/hash_comparer_spec.rb
Ruby
mit
3,117
[ 30522, 5478, 1005, 28699, 1035, 2393, 2121, 1005, 6235, 1000, 4633, 6212, 2063, 1024, 1024, 23325, 9006, 19362, 2121, 1000, 2079, 6235, 1000, 2043, 1996, 4539, 23325, 2003, 4394, 1037, 3145, 2013, 1996, 3120, 23325, 1000, 2079, 2009, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jsonp({"cep":"19110045","logradouro":"Rua Geraldo Ricardo do Nascimento","bairro":"Montalv\u00e3o","cidade":"Presidente Prudente","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/19110045.jsonp.js
JavaScript
cc0-1.0
169
[ 30522, 1046, 3385, 2361, 1006, 1063, 1000, 8292, 2361, 1000, 1024, 1000, 5184, 8889, 19961, 1000, 1010, 1000, 8833, 12173, 8162, 2080, 1000, 1024, 1000, 21766, 2050, 9659, 2080, 13559, 2079, 17235, 6895, 23065, 1000, 1010, 1000, 21790, 1893...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright 2014 Rohith All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package marathon import ( "fmt" "io/ioutil" "net/http" "net/url" "strings" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestApplicationDependsOn(t *testing.T) { app := NewDockerApplication() app.DependsOn("fake-app") app.DependsOn("fake-app1", "fake-app2") assert.Equal(t, 3, len(app.Dependencies)) } func TestApplicationMemory(t *testing.T) { app := NewDockerApplication() app.Memory(50.0) assert.Equal(t, 50.0, *app.Mem) } func TestApplicationString(t *testing.T) { app := NewDockerApplication(). Name("my-app"). CPU(0.1). Memory(64). Storage(0.0). Count(2). AddArgs("/usr/sbin/apache2ctl", "-D", "FOREGROUND"). AddEnv("NAME", "frontend_http"). AddEnv("SERVICE_80_NAME", "test_http"). AddEnvSecret("SECRET1", "secret1", "/path/to/secret") app. Container.Docker.Container("quay.io/gambol99/apache-php:latest"). Bridged(). Expose(80). Expose(443) app, err := app.CheckHTTP("/health", 80, 5) assert.Nil(t, err) expectedAppJSONBytes, err := ioutil.ReadFile("tests/app-definitions/TestApplicationString-output.json") if err != nil { panic(err) } expectedAppJSON := strings.TrimSpace(string(expectedAppJSONBytes)) assert.Equal(t, expectedAppJSON, app.String()) } func TestApplicationCount(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.Instances) app.Count(1) assert.Equal(t, 1, *app.Instances) } func TestApplicationStorage(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.Disk) app.Storage(0.10) assert.Equal(t, 0.10, *app.Disk) } func TestApplicationAllTaskRunning(t *testing.T) { app := NewDockerApplication() app.Instances = nil app.Tasks = nil assert.True(t, app.AllTaskRunning()) var cnt int app.Instances = &cnt cnt = 0 assert.True(t, app.AllTaskRunning()) cnt = 1 assert.False(t, app.AllTaskRunning()) app.Tasks = []*Task{} app.TasksRunning = 1 assert.True(t, app.AllTaskRunning()) cnt = 2 app.TasksRunning = 1 assert.False(t, app.AllTaskRunning()) } func TestApplicationName(t *testing.T) { app := NewDockerApplication() assert.Equal(t, "", app.ID) app.Name(fakeAppName) assert.Equal(t, fakeAppName, app.ID) } func TestApplicationCommand(t *testing.T) { app := NewDockerApplication() assert.Equal(t, "", app.ID) app.Command("format C:") assert.Equal(t, "format C:", *app.Cmd) } func TestApplicationCPU(t *testing.T) { app := NewDockerApplication() assert.Equal(t, 0.0, app.CPUs) app.CPU(0.1) assert.Equal(t, 0.1, app.CPUs) } func TestApplicationSetGPUs(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.GPUs) app.SetGPUs(0.1) assert.Equal(t, 0.1, *app.GPUs) } func TestApplicationEmptyGPUs(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.GPUs) app.EmptyGPUs() assert.Equal(t, 0.0, *app.GPUs) } func TestApplicationArgs(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.Args) app.AddArgs("-p").AddArgs("option", "-v") assert.Equal(t, 3, len(*app.Args)) assert.Equal(t, "-p", (*app.Args)[0]) assert.Equal(t, "option", (*app.Args)[1]) assert.Equal(t, "-v", (*app.Args)[2]) app.EmptyArgs() assert.NotNil(t, app.Args) assert.Equal(t, 0, len(*app.Args)) } func ExampleApplication_AddConstraint() { app := NewDockerApplication() // add two constraints app.AddConstraint("hostname", "UNIQUE"). AddConstraint("rack_id", "CLUSTER", "rack-1") } func TestApplicationConstraints(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.Constraints) app.AddConstraint("hostname", "UNIQUE"). AddConstraint("rack_id", "CLUSTER", "rack-1") assert.Equal(t, 2, len(*app.Constraints)) assert.Equal(t, []string{"hostname", "UNIQUE"}, (*app.Constraints)[0]) assert.Equal(t, []string{"rack_id", "CLUSTER", "rack-1"}, (*app.Constraints)[1]) app.EmptyConstraints() assert.NotNil(t, app.Constraints) assert.Equal(t, 0, len(*app.Constraints)) } func TestApplicationLabels(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.Labels) app.AddLabel("hello", "world").AddLabel("foo", "bar") assert.Equal(t, 2, len(*app.Labels)) assert.Equal(t, "world", (*app.Labels)["hello"]) assert.Equal(t, "bar", (*app.Labels)["foo"]) app.EmptyLabels() assert.NotNil(t, app.Labels) assert.Equal(t, 0, len(*app.Labels)) } func TestApplicationEnvs(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.Env) app.AddEnv("hello", "world").AddEnv("foo", "bar").AddEnvSecret("top", "secret1", "path/to/my/secret") assert.Equal(t, 3, len(*app.Env)) assert.Equal(t, "world", (*app.Env)["hello"]) assert.Equal(t, "bar", (*app.Env)["foo"]) assert.Equal(t, map[string]string{"secret": "secret1"}, (*app.Env)["top"]) app.EmptyEnvs() assert.NotNil(t, app.Env) assert.Equal(t, 0, len(*app.Env)) } func TestApplicationSecrets(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.Env) app.AddEnvSecret("top", "secret0", "path/to/my/secret") app.AddEnvSecret("top2", "secret1", "path/to/my/other/secret") assert.Equal(t, 2, len(*app.Secrets)) assert.Equal(t, Secret{Source: "path/to/my/secret"}, (*app.Secrets)["secret0"]) assert.Equal(t, Secret{Source: "path/to/my/other/secret"}, (*app.Secrets)["secret1"]) app.EmptySecrets() assert.NotNil(t, app.Secrets) assert.Equal(t, 0, len(*app.Secrets)) } func TestApplicationSetExecutor(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.Executor) app.SetExecutor("executor") assert.Equal(t, "executor", *app.Executor) app.SetExecutor("") assert.Equal(t, "", *app.Executor) } func TestApplicationHealthChecks(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.HealthChecks) app.AddHealthCheck(HealthCheck{}.SetPath("/check1")). AddHealthCheck(HealthCheck{}.SetPath("/check2")) assert.Equal(t, 2, len(*app.HealthChecks)) assert.Equal(t, HealthCheck{}.SetPath("/check1"), (*app.HealthChecks)[0]) assert.Equal(t, HealthCheck{}.SetPath("/check2"), (*app.HealthChecks)[1]) app.EmptyHealthChecks() assert.NotNil(t, app.HealthChecks) assert.Equal(t, 0, len(*app.HealthChecks)) } func TestApplicationReadinessChecks(t *testing.T) { app := NewDockerApplication() require.Nil(t, app.HealthChecks) rc := ReadinessCheck{} rc.SetName("/readiness") app.AddReadinessCheck(rc) require.Equal(t, 1, len(*app.ReadinessChecks)) assert.Equal(t, "/readiness", *((*app.ReadinessChecks)[0].Name)) app.EmptyReadinessChecks() require.NotNil(t, app.ReadinessChecks) assert.Equal(t, 0, len(*app.ReadinessChecks)) } func TestApplicationPortDefinitions(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.PortDefinitions) app.AddPortDefinition(PortDefinition{Protocol: "tcp", Name: "es"}.SetPort(9201).AddLabel("foo", "bar")). AddPortDefinition(PortDefinition{Protocol: "udp,tcp", Name: "syslog"}.SetPort(514)) assert.Equal(t, 2, len(*app.PortDefinitions)) assert.Equal(t, PortDefinition{Protocol: "tcp", Name: "es"}.SetPort(9201).AddLabel("foo", "bar"), (*app.PortDefinitions)[0]) assert.Equal(t, 1, len(*(*app.PortDefinitions)[0].Labels)) assert.Equal(t, PortDefinition{Protocol: "udp,tcp", Name: "syslog"}.SetPort(514), (*app.PortDefinitions)[1]) assert.Nil(t, (*app.PortDefinitions)[1].Labels) (*app.PortDefinitions)[0].EmptyLabels() assert.NotNil(t, (*app.PortDefinitions)[0].Labels) assert.Equal(t, 0, len(*(*app.PortDefinitions)[0].Labels)) app.EmptyPortDefinitions() assert.NotNil(t, app.PortDefinitions) assert.Equal(t, 0, len(*app.PortDefinitions)) } func TestHasHealthChecks(t *testing.T) { app := NewDockerApplication() assert.False(t, app.HasHealthChecks()) app.Container.Docker.Container("quay.io/gambol99/apache-php:latest").Expose(80) _, err := app.CheckTCP(80, 10) assert.NoError(t, err) assert.True(t, app.HasHealthChecks()) } func TestApplicationCheckTCP(t *testing.T) { app := NewDockerApplication() assert.False(t, app.HasHealthChecks()) _, err := app.CheckTCP(80, 10) assert.Error(t, err) assert.False(t, app.HasHealthChecks()) app.Container.Docker.Container("quay.io/gambol99/apache-php:latest").Expose(80) _, err = app.CheckTCP(80, 10) assert.NoError(t, err) assert.True(t, app.HasHealthChecks()) check := (*app.HealthChecks)[0] assert.Equal(t, "TCP", check.Protocol) assert.Equal(t, 10, check.IntervalSeconds) assert.Equal(t, 0, *check.PortIndex) } func TestApplicationCheckHTTP(t *testing.T) { app := NewDockerApplication() assert.False(t, app.HasHealthChecks()) _, err := app.CheckHTTP("/", 80, 10) assert.Error(t, err) assert.False(t, app.HasHealthChecks()) app.Container.Docker.Container("quay.io/gambol99/apache-php:latest").Expose(80) _, err = app.CheckHTTP("/health", 80, 10) assert.NoError(t, err) assert.True(t, app.HasHealthChecks()) check := (*app.HealthChecks)[0] assert.Equal(t, "HTTP", check.Protocol) assert.Equal(t, 10, check.IntervalSeconds) assert.Equal(t, "/health", *check.Path) assert.Equal(t, 0, *check.PortIndex) } func TestCreateApplication(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() application := NewDockerApplication() application.Name(fakeAppName) app, err := endpoint.Client.CreateApplication(application) assert.NoError(t, err) assert.NotNil(t, app) assert.Equal(t, application.ID, fakeAppName) assert.Equal(t, app.Deployments[0]["id"], "f44fd4fc-4330-4600-a68b-99c7bd33014a") } func TestUpdateApplication(t *testing.T) { for _, force := range []bool{false, true} { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() application := NewDockerApplication() application.Name(fakeAppName) id, err := endpoint.Client.UpdateApplication(application, force) assert.NoError(t, err) assert.Equal(t, id.DeploymentID, "83b215a6-4e26-4e44-9333-5c385eda6438") assert.Equal(t, id.Version, "2014-08-26T07:37:50.462Z") } } func TestApplications(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() applications, err := endpoint.Client.Applications(nil) assert.NoError(t, err) assert.NotNil(t, applications) assert.Equal(t, len(applications.Apps), 2) assert.Equal(t, (*applications.Apps[0].Env)["SECRET1"].(map[string]interface{})["secret"].(string), "secret0") assert.Equal(t, (*applications.Apps[0].Secrets)["secret0"].Source, "secret/definition/id") v := url.Values{} v.Set("cmd", "nginx") applications, err = endpoint.Client.Applications(v) assert.NoError(t, err) assert.NotNil(t, applications) assert.Equal(t, len(applications.Apps), 1) } func TestApplicationsEmbedTaskStats(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() v := url.Values{} v.Set("embed", "apps.taskStats") applications, err := endpoint.Client.Applications(v) assert.NoError(t, err) assert.NotNil(t, applications) assert.Equal(t, len(applications.Apps), 1) assert.NotNil(t, applications.Apps[0].TaskStats) assert.Equal(t, applications.Apps[0].TaskStats["startedAfterLastScaling"].Stats.Counts["healthy"], 1) assert.Equal(t, applications.Apps[0].TaskStats["startedAfterLastScaling"].Stats.LifeTime["averageSeconds"], 17024.575) } func TestApplicationsEmbedReadiness(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() v := url.Values{} v.Set("embed", "apps.readiness") applications, err := endpoint.Client.Applications(v) require.NoError(t, err) require.NotNil(t, applications) require.Equal(t, len(applications.Apps), 1) require.NotNil(t, applications.Apps[0].ReadinessCheckResults) require.True(t, len(*applications.Apps[0].ReadinessCheckResults) > 0) actualRes := (*applications.Apps[0].ReadinessCheckResults)[0] expectedRes := ReadinessCheckResult{ Name: "myReadyCheck", TaskID: "test_frontend_app1.c9de6033", Ready: false, LastResponse: ReadinessLastResponse{ Body: "{}", ContentType: "application/json", Status: 500, }, } assert.Equal(t, expectedRes, actualRes) } func TestListApplications(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() applications, err := endpoint.Client.ListApplications(nil) assert.NoError(t, err) assert.NotNil(t, applications) assert.Equal(t, len(applications), 2) assert.Equal(t, applications[0], fakeAppName) assert.Equal(t, applications[1], fakeAppNameBroken) } func TestApplicationVersions(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() versions, err := endpoint.Client.ApplicationVersions(fakeAppName) assert.NoError(t, err) assert.NotNil(t, versions) assert.NotNil(t, versions.Versions) assert.Equal(t, len(versions.Versions), 1) assert.Equal(t, versions.Versions[0], "2014-04-04T06:25:31.399Z") /* check we get an error on app not there */ versions, err = endpoint.Client.ApplicationVersions("/not/there") assert.Error(t, err) } func TestRestartApplication(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() id, err := endpoint.Client.RestartApplication(fakeAppName, false) assert.NoError(t, err) assert.NotNil(t, id) assert.Equal(t, "83b215a6-4e26-4e44-9333-5c385eda6438", id.DeploymentID) assert.Equal(t, "2014-08-26T07:37:50.462Z", id.Version) id, err = endpoint.Client.RestartApplication("/not/there", false) assert.Error(t, err) assert.Nil(t, id) } func TestApplicationUris(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.Uris) app.AddUris("file://uri1.tar.gz").AddUris("file://uri2.tar.gz", "file://uri3.tar.gz") assert.Equal(t, 3, len(*app.Uris)) assert.Equal(t, "file://uri1.tar.gz", (*app.Uris)[0]) assert.Equal(t, "file://uri2.tar.gz", (*app.Uris)[1]) assert.Equal(t, "file://uri3.tar.gz", (*app.Uris)[2]) app.EmptyUris() assert.NotNil(t, app.Uris) assert.Equal(t, 0, len(*app.Uris)) } func TestApplicationFetchURIs(t *testing.T) { app := NewDockerApplication() assert.Nil(t, app.Fetch) app.AddFetchURIs(Fetch{URI: "file://uri1.tar.gz"}). AddFetchURIs(Fetch{URI: "file://uri2.tar.gz"}, Fetch{URI: "file://uri3.tar.gz"}) assert.Equal(t, 3, len(*app.Fetch)) assert.Equal(t, Fetch{URI: "file://uri1.tar.gz"}, (*app.Fetch)[0]) assert.Equal(t, Fetch{URI: "file://uri2.tar.gz"}, (*app.Fetch)[1]) assert.Equal(t, Fetch{URI: "file://uri3.tar.gz"}, (*app.Fetch)[2]) app.EmptyUris() assert.NotNil(t, app.Uris) assert.Equal(t, 0, len(*app.Uris)) } func TestSetApplicationVersion(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() deployment, err := endpoint.Client.SetApplicationVersion(fakeAppName, &ApplicationVersion{Version: "2014-08-26T07:37:50.462Z"}) assert.NoError(t, err) assert.NotNil(t, deployment) assert.NotNil(t, deployment.Version) assert.NotNil(t, deployment.DeploymentID) assert.Equal(t, deployment.Version, "2014-08-26T07:37:50.462Z") assert.Equal(t, deployment.DeploymentID, "83b215a6-4e26-4e44-9333-5c385eda6438") _, err = endpoint.Client.SetApplicationVersion("/not/there", &ApplicationVersion{Version: "2014-04-04T06:25:31.399Z"}) assert.Error(t, err) } func TestHasApplicationVersion(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() found, err := endpoint.Client.HasApplicationVersion(fakeAppName, "2014-04-04T06:25:31.399Z") assert.NoError(t, err) assert.True(t, found) found, err = endpoint.Client.HasApplicationVersion(fakeAppName, "###2015-04-04T06:25:31.399Z") assert.NoError(t, err) assert.False(t, found) } func TestDeleteApplication(t *testing.T) { for _, force := range []bool{false, true} { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() id, err := endpoint.Client.DeleteApplication(fakeAppName, force) assert.NoError(t, err) assert.NotNil(t, id) assert.Equal(t, "83b215a6-4e26-4e44-9333-5c385eda6438", id.DeploymentID) assert.Equal(t, "2014-08-26T07:37:50.462Z", id.Version) id, err = endpoint.Client.DeleteApplication("no_such_app", force) assert.Error(t, err) } } func TestApplicationOK(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() ok, err := endpoint.Client.ApplicationOK(fakeAppName) assert.NoError(t, err) assert.True(t, ok) ok, err = endpoint.Client.ApplicationOK(fakeAppNameBroken) assert.NoError(t, err) assert.False(t, ok) ok, err = endpoint.Client.ApplicationOK(fakeAppNameUnhealthy) assert.NoError(t, err) assert.False(t, ok) } func verifyApplication(application *Application, t *testing.T) { assert.NotNil(t, application) assert.Equal(t, application.ID, fakeAppName) assert.NotNil(t, application.HealthChecks) assert.NotNil(t, application.Tasks) assert.Equal(t, len(*application.HealthChecks), 1) assert.Equal(t, len(application.Tasks), 2) } func TestApplication(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() application, err := endpoint.Client.Application(fakeAppName) assert.NoError(t, err) verifyApplication(application, t) _, err = endpoint.Client.Application("no_such_app") assert.Error(t, err) apiErr, ok := err.(*APIError) assert.True(t, ok) assert.Equal(t, ErrCodeNotFound, apiErr.ErrCode) config := NewDefaultConfig() config.URL = "http://non-existing-marathon-host.local:5555" // Reduce timeout to speed up test execution time. config.HTTPClient = &http.Client{ Timeout: 100 * time.Millisecond, } endpoint = newFakeMarathonEndpoint(t, &configContainer{ client: &config, }) defer endpoint.Close() _, err = endpoint.Client.Application(fakeAppName) assert.Error(t, err) _, ok = err.(*APIError) assert.False(t, ok) } func TestApplicationConfiguration(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() application, err := endpoint.Client.ApplicationByVersion(fakeAppName, "2014-09-12T23:28:21.737Z") assert.NoError(t, err) verifyApplication(application, t) _, err = endpoint.Client.ApplicationByVersion(fakeAppName, "no_such_version") assert.Error(t, err) apiErr, ok := err.(*APIError) assert.True(t, ok) assert.Equal(t, ErrCodeNotFound, apiErr.ErrCode) _, err = endpoint.Client.ApplicationByVersion("no_such_app", "latest") assert.Error(t, err) apiErr, ok = err.(*APIError) assert.True(t, ok) assert.Equal(t, ErrCodeNotFound, apiErr.ErrCode) } func TestWaitOnApplication(t *testing.T) { waitTime := 100 * time.Millisecond tests := []struct { desc string timeout time.Duration appName string testScope string shouldSucceed bool }{ { desc: "initially existing app", timeout: 0, appName: fakeAppName, shouldSucceed: true, }, { desc: "delayed existing app | timeout > ticker", timeout: 200 * time.Millisecond, appName: fakeAppName, testScope: "wait-on-app", shouldSucceed: true, }, { desc: "delayed existing app | timeout < ticker", timeout: 50 * time.Millisecond, appName: fakeAppName, testScope: "wait-on-app", shouldSucceed: false, }, { desc: "missing app | timeout > ticker", timeout: 200 * time.Millisecond, appName: "no_such_app", shouldSucceed: false, }, { desc: "missing app | timeout < ticker", timeout: 50 * time.Millisecond, appName: "no_such_app", shouldSucceed: false, }, } for _, test := range tests { defaultConfig := NewDefaultConfig() defaultConfig.PollingWaitTime = waitTime configs := &configContainer{ client: &defaultConfig, server: &serverConfig{ scope: test.testScope, }, } endpoint := newFakeMarathonEndpoint(t, configs) defer endpoint.Close() errCh := make(chan error) go func() { errCh <- endpoint.Client.WaitOnApplication(test.appName, test.timeout) }() select { case <-time.After(400 * time.Millisecond): assert.Fail(t, fmt.Sprintf("%s: WaitOnApplication did not complete in time", test.desc)) case err := <-errCh: if test.shouldSucceed { assert.NoError(t, err, test.desc) } else { assert.IsType(t, err, ErrTimeoutError, test.desc) } } } } func TestAppExistAndRunning(t *testing.T) { endpoint := newFakeMarathonEndpoint(t, nil) defer endpoint.Close() client := endpoint.Client.(*marathonClient) assert.True(t, client.appExistAndRunning(fakeAppName)) assert.False(t, client.appExistAndRunning("no_such_app")) } func TestSetIPPerTask(t *testing.T) { app := Application{} app.Ports = append(app.Ports, 10) app.AddPortDefinition(PortDefinition{}) assert.Nil(t, app.IPAddressPerTask) assert.Equal(t, 1, len(app.Ports)) assert.Equal(t, 1, len(*app.PortDefinitions)) app.SetIPAddressPerTask(IPAddressPerTask{}) assert.NotNil(t, app.IPAddressPerTask) assert.Equal(t, 0, len(app.Ports)) assert.Equal(t, 0, len(*app.PortDefinitions)) } func TestIPAddressPerTask(t *testing.T) { ipPerTask := IPAddressPerTask{} assert.Nil(t, ipPerTask.Groups) assert.Nil(t, ipPerTask.Labels) assert.Nil(t, ipPerTask.Discovery) ipPerTask. AddGroup("label"). AddLabel("key", "value"). SetDiscovery(Discovery{}) assert.Equal(t, 1, len(*ipPerTask.Groups)) assert.Equal(t, "label", (*ipPerTask.Groups)[0]) assert.Equal(t, "value", (*ipPerTask.Labels)["key"]) assert.NotEmpty(t, ipPerTask.Discovery) ipPerTask.EmptyGroups() assert.Equal(t, 0, len(*ipPerTask.Groups)) ipPerTask.EmptyLabels() assert.Equal(t, 0, len(*ipPerTask.Labels)) } func TestIPAddressPerTaskDiscovery(t *testing.T) { disc := Discovery{} assert.Nil(t, disc.Ports) disc.AddPort(Port{}) assert.NotNil(t, disc.Ports) assert.Equal(t, 1, len(*disc.Ports)) disc.EmptyPorts() assert.NotNil(t, disc.Ports) assert.Equal(t, 0, len(*disc.Ports)) } func TestUpgradeStrategy(t *testing.T) { app := Application{} assert.Nil(t, app.UpgradeStrategy) app.SetUpgradeStrategy(UpgradeStrategy{}.SetMinimumHealthCapacity(1.0).SetMaximumOverCapacity(0.0)) us := app.UpgradeStrategy assert.Equal(t, 1.0, *us.MinimumHealthCapacity) assert.Equal(t, 0.0, *us.MaximumOverCapacity) app.EmptyUpgradeStrategy() us = app.UpgradeStrategy assert.NotNil(t, us) assert.Nil(t, us.MinimumHealthCapacity) assert.Nil(t, us.MaximumOverCapacity) }
matt-deboer/go-marathon
application_test.go
GO
apache-2.0
22,611
[ 30522, 1013, 1008, 9385, 2297, 20996, 16584, 2232, 2035, 2916, 9235, 1012, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
----------------------------------- -- Area: Al'Taieu -- NPC: Quasilumin -- Type: Standard NPC -- !pos -27.443 -1 -636.850 33 ----------------------------------- package.loaded["scripts/zones/AlTaieu/TextIDs"] = nil; ----------------------------------- require("scripts/zones/AlTaieu/TextIDs"); ----------------------------------- function onTrade(player,npc,trade) end; function onTrigger(player,npc) player:showText(npc, QUASILUMIN_01); end; function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
HeavensSword/darkstar
scripts/zones/AlTaieu/npcs/Quasilumin.lua
Lua
gpl-3.0
686
[ 30522, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 2181, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /**#@+ * @version 0.1.0 * @since 0.1.0 */ /** * @package POT * @author Wrzasq <wrzasq@gmail.com> * @copyright 2007 (C) by Wrzasq * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License, Version 3 */ /** * Display interface. * * <p> * This way you can define low-level part of display logic to bind templates directly with POT objects. * </p> * * @package POT */ interface IOTS_Display { /** * Displays player. * * @param OTS_Player $player Player to be displayed. * @return string String representation. */ public function displayPlayer(OTS_Player $player); /** * Displays players list. * * @param OTS_Players_List $playersList List to be displayed. * @return string String representation. */ public function displayPlayersList(OTS_Players_List $playersList); /** * Displays account. * * @param OTS_Account $account Account to be displayed. * @return string String representation. */ public function displayAccount(OTS_Account $account); /** * Displays accounts list. * * @param OTS_Accounts_List $accountsList List to be displayed. * @return string String representation. */ public function displayAccountsList(OTS_Accounts_List $accountList); /** * Displays guild. * * @param OTS_Guild $guild Guild to be displayed. * @return string String representation. */ public function displayGuild(OTS_Guild $guild); /** * Displays guilds list. * * @param OTS_Guilds_List $guildsList List to be displayed. * @return string String representation. */ public function displayGuildsList(OTS_Guild_List $guildList); /** * Displays group. * * @param OTS_Group $group Group to be displayed. * @return string String representation. */ public function displayGroup(OTS_Group $group); /** * Displays groups list. * * @param OTS_Groups_List $groupsList List to be displayed. * @return string String representation. */ public function displayGroupsList(OTS_Groups_List $groupsList); /** * Displays rank. * * @param OTS_GuildRank $guildRank Rank to be displayed. * @return string String representation. */ public function displayGuildRank(OTS_GuildRank $guildRank); /** * Displays guild ranks list. * * @param OTS_GuildRanks_List $guildRanksList List to be displayed. * @return string String representation. */ public function displayGuildRanksList(OTS_GuildRanks_List $guildRanksList); } /**#@-*/ ?>
luquinhasbrito/pot-class
src/IOTS_Display.php
PHP
lgpl-3.0
2,539
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1001, 1030, 1009, 1008, 1030, 2544, 1014, 1012, 1015, 1012, 1014, 1008, 1030, 2144, 1014, 1012, 1015, 1012, 1014, 1008, 1013, 1013, 1008, 1008, 1008, 1030, 7427, 8962, 1008, 1030, 3166, 23277, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
var db=require('./dbDatabase'); var mysql=require('mysql'); var connect_pool=mysql.createPool(db.options); connect_pool.connectionLimit=100; //准备好20个链接 connect_pool.queueLimit=100; //最大链接数 function getConnection(callback){ connect_pool.getConnection(function(err,client){ if(err){ console.log(err.message); setTimeout(getConnection,2000); } callback(client); }) } exports.getConnection=getConnection;
zhuliyu/Learning-Platform
util/DBHelper.js
JavaScript
mit
466
[ 30522, 13075, 16962, 1027, 5478, 1006, 1005, 1012, 1013, 16962, 2850, 2696, 15058, 1005, 1007, 1025, 13075, 2026, 2015, 4160, 2140, 1027, 5478, 1006, 1005, 2026, 2015, 4160, 2140, 1005, 1007, 1025, 13075, 7532, 1035, 4770, 1027, 2026, 2015,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; use Joomla\CMS\Extension\ComponentInterface; use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory; use Joomla\CMS\Extension\Service\Provider\MVCFactory; use Joomla\CMS\HTML\Registry; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\Component\Languages\Administrator\Extension\LanguagesComponent; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; /** * The language service provider. * * @since 4.0.0 */ return new class implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.0.0 */ public function register(Container $container) { $container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Languages')); $container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Languages')); $container->set( ComponentInterface::class, function (Container $container) { $component = new LanguagesComponent($container->get(ComponentDispatcherFactoryInterface::class)); $component->setMVCFactory($container->get(MVCFactoryInterface::class)); $component->setRegistry($container->get(Registry::class)); return $component; } ); } };
Hackwar/joomla-cms
administrator/components/com_languages/services/provider.php
PHP
gpl-2.0
1,620
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1030, 7427, 28576, 19968, 2050, 1012, 8911, 1008, 1030, 4942, 23947, 4270, 4012, 1035, 4155, 1008, 1008, 1030, 9385, 1006, 1039, 1007, 2760, 2330, 3120, 5609, 1010, 4297, 1012, 1026, 16770, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>∆ Goods</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/main.css"> <!-- TYPOGRAPHY --> <script src="https://use.typekit.net/net6zjm.js"></script> <script>try{Typekit.load({ async: true });}catch(e){}</script> </head> <body> <svg style="position: absolute; width: 0; height: 0;" width="0" height="0" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <symbol id="icon-arrow" viewBox="0 0 1024 1024"> <title>arrow</title> <path class="path1" d="M957.156 512c0 0 0-1.422 0-1.422 0-5.689-2.844-11.378-7.111-15.644-1.422-1.422 0-2.844-1.422-4.267s-2.844 0-4.267-1.422c0 0-1.422-1.422-1.422-1.422l-345.6-317.156c-12.8-12.8-31.289-12.8-44.089 0s-12.8 31.289 0 44.089l291.556 264.533h-746.667c-17.067 0-31.289 14.222-31.289 31.289s14.222 31.289 31.289 31.289h746.667l-291.556 267.378c-12.8 12.8-12.8 31.289 0 44.089s31.289 12.8 44.089 0l348.444-317.156c0 0 1.422 0 1.422 0s1.422 0 1.422 0c0 0 0-1.422 0-1.422 4.267-5.689 7.111-11.378 8.533-19.911 0-1.422 0-1.422 0-2.844 0 0 0 0 0 0s0 0 0 0z"></path> </symbol> <symbol id="icon-triangle" viewBox="0 0 1024 1024"> <title>triangle</title> <path class="path1" d="M27.022 945.778l486.4-841.956 486.4 841.956z"></path> </symbol> </defs> </svg> <!-- <h1>∆ Goods</h1> --> <!-- <div class="clearfix header"> --> <!-- <div class="h1 left border">∆ Goods</div> --> <!-- <div class="left p2 border">.left</div> --> <!-- <div class="right p2 border">Menu</div> --> <!-- </div> --> <div class="logo"> <h1 class="triangle"> <a href="#"> <svg class="icon-triangle"> <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-triangle"> </use> </svg> </a> </h1> </div> <div class="wordmark"> <h1> Goods </h1> </div> <div class="toggle"> <span> ? </span> </div> <footer id="product-info-display"> <!-- <div class="product-details"> <h2 class="product-name-display"> <a href="#product-link-url" class="product-link-permalink"> Product Name </a> </h2> <p class="product-store-display"> <a href="product-store-link-display"> Store </a> </p> </div> <div class="buy-now"> <a href="#product-link-url" class="product-link-button"> Buy </a> </div> --> </footer> <aside id="about"> <h1> About </h1> <p> A list of goods made in The Triangle, North Carolina. </p> <h2> Submit a Good </h2> <p> <a href="mailto:submissions@trianglegoods.com"> submissions@trianglegoods.com </a> </p> <h2> Inquiries </h2> <p> <a href="mailto:info@trianglegoods.com"> info@trianglegoods.com </a> </p> <div class="credits"> <h6> Brought to you by: </h6> <h3> <strong class="morf"> MORF </strong> </h3> </div> </aside> <ul id="products"> <li class="product"> <div class="product-image" style="background-image:url('img/krupnikas.jpg');"> </div> <div class="product-info"> <div class="product-details"> <h2 class="product-name-display"> <a href="http://krupnikas.com/product-name" class="product-link-permalink"> Krupnikas KAS </a></h2> <p class="product-store-display"> <a href="http://krupnikas.com"> Krupnikas </a> </p> </div> <div class="buy-now"> <a href="http://krupnikas.com/product-name" class="product-link-button"> $10 </a> </div> </div> </li> <li class="product"> <div class="product-image" style="background-image:url('img/counterculture.jpg');"> </div> <div class="product-info"> <div class="product-details"> <h2 class="product-name-display"> <a href="http://counterculture.com/coffee" class="product-link-permalink"> Counter Culture Coffee </a></h2> <p class="product-store-display"> <a href="http://counterculture.com"> Counter Culture </a> </p> </div> <div class="buy-now"> <a href="http://counterculture.com/coffee" class="product-link-button"> $12 </a> </div> </div> </li> <li class="product"> <div class="product-image" style="background-image:url('img/krupnikas.jpg');"> </div> <div class="product-info"> <div class="product-details"> <h2 class="product-name-display"> <a href="http://krupnikas.com/product-name" class="product-link-permalink"> Krupnikas KAS </a></h2> <p class="product-store-display"> <a href="http://krupnikas.com"> Krupnikas </a> </p> </div> <div class="buy-now"> <a href="http://krupnikas.com/product-name" class="product-link-button"> $1.4k </a> </div> </div> </li> <li class="product"> <div class="product-image" style="background-image:url('img/counterculture.jpg');"> </div> <div class="product-info"> <div class="product-details"> <h2 class="product-name-display"> <a href="http://counterculture.com/coffee" class="product-link-permalink"> Counter Culture Coffee </a></h2> <p class="product-store-display"> <a href="http://counterculture.com"> Counter Culture </a> </p> </div> <div class="buy-now"> <a href="http://counterculture.com/coffee" class="product-link-button"> Buy </a> </div> </div> </li> <li class="product"> <div class="product-image" style="background-image:url('img/krupnikas.jpg');"> </div> <div class="product-info"> <div class="product-details"> <h2 class="product-name-display"> <a href="http://krupnikas.com/product-name" class="product-link-permalink"> Krupnikas KAS </a></h2> <p class="product-store-display"> <a href="http://krupnikas.com"> Krupnikas </a> </p> </div> <div class="buy-now"> <a href="http://krupnikas.com/product-name" class="product-link-button"> Buy </a> </div> </div> </li> </ul> <!-- End of Product --> <!-- <form> <label for="search">Search</label> <input id="search" type="text" class="field"> <button class="btn btn-primary">Go</button> </form> --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.1.min.js"><\/script>')</script> <script src="scripts/main.js"></script> <script> //Google Analytics var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']]; (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js'; s.parentNode.insertBefore(g,s)}(document,'script')); </script> </body> </html>
morf-studio/triangle-goods
index.html
HTML
gpl-3.0
6,882
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 2516, 1028, 1594, 5350, 1026, 1013, 2516, 1028...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Rhynchospora diamantina C.B.Clarke ex Kük. SPECIES #### Status SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Liliopsida/Poales/Cyperaceae/Rhynchospora/Rhynchospora leucostachys/ Syn. Rhynchospora diamantina/README.md
Markdown
apache-2.0
200
[ 30522, 1001, 1054, 10536, 12680, 2891, 17822, 2050, 22939, 2386, 13770, 1039, 1012, 1038, 1012, 8359, 4654, 13970, 2243, 1012, 2427, 1001, 1001, 1001, 1001, 3570, 10675, 1001, 1001, 1001, 1001, 2429, 2000, 1996, 10161, 1997, 2166, 1010, 382...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.235 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace NCrawler.HtmlProcessor.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NCrawler.HtmlProcessor.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Looks up a localized string similar to Cannot be the empty string.. /// </summary> public static string Option_Option_Cannot_be_the_empty_string_ { get { return ResourceManager.GetString("Option_Option_Cannot_be_the_empty_string_", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Cannot provide maxValueCount of 0 for OptionValueType.Required or OptionValueType.Optional.. /// </summary> public static string Option_Option_Cannot_provide_maxValueCount_of_0_for_OptionValueType_Required_or_OptionValueType_Optional_ { get { return ResourceManager.GetString("Option_Option_Cannot_provide_maxValueCount_of_0_for_OptionValueType_Required_or_O" + "ptionValueType_Optional_", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The default option handler &apos;&lt;&gt;&apos; cannot require values.. /// </summary> public static string Option_Option_The_default_option_handler______cannot_require_values_ { get { return ResourceManager.GetString("Option_Option_The_default_option_handler______cannot_require_values_", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Empty option names are not supported.. /// </summary> public static string Option_ParsePrototype_Empty_option_names_are_not_supported_ { get { return ResourceManager.GetString("Option_ParsePrototype_Empty_option_names_are_not_supported_", resourceCulture); } } /// <summary> /// Looks up a localized string similar to OriginalReferrerUrl. /// </summary> public static string PropertyBagKeyOriginalReferrerUrl { get { return ResourceManager.GetString("PropertyBagKeyOriginalReferrerUrl", resourceCulture); } } /// <summary> /// Looks up a localized string similar to OriginalUrl. /// </summary> public static string PropertyBagKeyOriginalUrl { get { return ResourceManager.GetString("PropertyBagKeyOriginalUrl", resourceCulture); } } } }
abutun/crexta-framework
Crexta .NET 4.0/Dependencies/NCrawler/Net 4.0/NCrawler.HtmlProcessor/Properties/Resources.Designer.cs
C#
apache-2.0
5,271
[ 30522, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
var class_redis_cache_test = [ [ "__construct", "class_redis_cache_test.html#ae22c12eb0d136f444b6c9c0735f70382", null ], [ "testArray", "class_redis_cache_test.html#a76100cea2dba0b01bfffb70a193dfb9f", null ], [ "testGet", "class_redis_cache_test.html#afb35249bbbb21b7eac20b12d6f5a8739", null ], [ "testHas", "class_redis_cache_test.html#a8ff5d29b2ceab16b9e10aead821f3707", null ], [ "testLeveledArray", "class_redis_cache_test.html#a56c8a7551fcbda565b8f81bd9a9e3b57", null ], [ "testReinitializedGet", "class_redis_cache_test.html#addb63e1b14cdbfcdc65837dff633f7f2", null ], [ "testReinitializedHas", "class_redis_cache_test.html#a39dc99ba8e9efe29f3939ecbe99210be", null ], [ "testRemove", "class_redis_cache_test.html#a10b3034f21731f5a6507dbb5207097cf", null ] ];
Palethorn/Yeah
docs/class_redis_cache_test.js
JavaScript
mit
796
[ 30522, 13075, 2465, 1035, 2417, 2483, 1035, 17053, 1035, 3231, 1027, 1031, 1031, 1000, 1035, 1035, 9570, 1000, 1010, 1000, 2465, 1035, 2417, 2483, 1035, 17053, 1035, 3231, 1012, 16129, 1001, 29347, 19317, 2278, 12521, 15878, 2692, 2094, 171...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
## Scanner type Scanner string::AbstractString tail::AbstractString pos::Integer end Scanner(string::AbstractString) = Scanner("", string, 0) ## Returns `true` if the tail is empty (end of string). function eos(s::Scanner) s.tail == "" end ## Tries to match the given regular expression at the current position. ## Returns the matched text if it can match, the empty string otherwise. function scan(s::Scanner, re::Regex) if !ismatch(re, s.tail) return "" end m = match(re, s.tail) if m.offset >= 1 ## move past match no_chars = endof(m.match) + m.offset - 1 s.pos += no_chars s.tail = s.tail[(no_chars + 1):end] end m.match end scan(s::Scanner, re::AbstractString) = scan(s, Regex(re)) scan(s::Scanner, re::Char) = scan(s, string(re)) ## Skips all text until the given regular expression can be matched. Returns ## the skipped string, which is the entire tail if no match can be made. function scanUntil!(s::Scanner, re::Regex) m = match(re, s.tail) if m == nothing ourmatch = s.tail s.pos += endof(s.tail) s.tail = "" else pos = m.offset ourmatch = s.tail[1:(pos-1)] s.tail = s.tail[pos:(endof(s.tail))] s.pos += pos end return(ourmatch) end scanUntil!(s::Scanner, re::AbstractString) = scanUntil!(s, Regex(re)) scanUntil!(s::Scanner, re::Char) = scanUntil!(s, string(re))
JuliaPackageMirrors/Mustache.jl
src/scanner.jl
Julia
mit
1,446
[ 30522, 1001, 1001, 26221, 2828, 26221, 5164, 1024, 1024, 29474, 18886, 3070, 5725, 1024, 1024, 29474, 18886, 3070, 13433, 2015, 1024, 1024, 16109, 2203, 26221, 1006, 5164, 1024, 1024, 29474, 18886, 3070, 1007, 1027, 26221, 1006, 1000, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.tutorial.TutorialTVScenes from panda3d.core import Camera from direct.task.Task import Task from otp.avatar import Emote from toontown.television.TVScenes import * from toontown.television.TVEffects import * from toontown.suit.Suit import Suit from toontown.suit.BossCog import BossCog from toontown.suit.SuitDNA import SuitDNA from toontown.toon import NPCToons, TTEmote import random class CEOScene(ThreeDScene): CameraPos = [(0, 203.5, 23.5, 0, 350, 0)] def __init__(self, effects = []): ThreeDScene.__init__(self, 'CEOScene', effects) self.geom = loader.loadModel('phase_12/models/bossbotHQ/BanquetInterior_1') self.geom.reparentTo(self) self.ceo = BossCog() dna = SuitDNA() dna.newBossCog('c') self.ceo.setDNA(dna) self.ceo.reparentTo(self) self.ceo.setPosHpr(0, 236.5, 0, 180, 0, 0) self.ceo.loop('Bb_neutral') def delete(self): if self.geom: self.geom.removeNode() self.geom = None if self.ceo: self.ceo.delete() self.ceo = None ThreeDScene.delete(self) return class HeadHunterScene(ThreeDScene): CameraPos = [(-22, -12.5, 7, 92, -6, 0)] def __init__(self, effects = []): ThreeDScene.__init__(self, 'HeadHunterScene', effects) self.geom = loader.loadModel('phase_12/models/bossbotHQ/BossbotEntranceRoom') self.geom.reparentTo(self) self.cog = Suit() dna = SuitDNA() dna.newSuit('hh') self.cog.setDNA(dna) self.cog.reparentTo(self) self.cog.setPosHpr(-32.5, -12.5, 0.02, 270, 0, 0) self.cog.nametag3d.removeNode() self.cog.nametag.destroy() self.cog.loop('neutral') def delete(self): if self.geom: self.geom.removeNode() self.geom = None if self.cog: self.cog.delete() self.cog = None ThreeDScene.delete(self) return class ScientistScene(ThreeDScene): CameraPos = [(-47.5, 0.5, 3.415, 90, 0, 0)] ToonPos = {2018: (-59, -1.5, 0.02, 270, 0, 0), 2019: (-59, 0.5, 0.02, 270, 0, 0), 2020: (-59, 2.5, 0.02, 270, 0, 0)} RandomEmotes = ['wave', 'angry', 'applause', 'cringe', 'confused', 'slip-forward', 'slip-backward', 'resistance-salute', 'surprise', 'cry', 'furious', 'laugh', 'idea', 'taunt', 'rage'] def __init__(self, effects = []): ThreeDScene.__init__(self, 'ScientistScene', effects) self.geom = loader.loadModel('phase_3.5/models/modules/tt_m_ara_int_toonhall') self.geom.reparentTo(self) self.taskStarted = False self.npcs = [] for id, posHpr in self.ToonPos.iteritems(): npc = NPCToons.createLocalNPC(id) npc.reparentTo(self.geom) npc.setPosHpr(*posHpr) npc.nametag3d.removeNode() npc.nametag.destroy() self.npcs.append(npc) def delete(self): if self.geom: self.geom.removeNode() self.geom = None for npc in self.npcs: taskMgr.remove(npc.uniqueName('randomEmote')) npc.delete() self.npcs = [] self.taskStarted = False ThreeDScene.delete(self) return def startTask(self): if self.taskStarted: return for i, npc in enumerate(self.npcs): taskMgr.doMethodLater(0.25 * i, lambda task, npc = npc: self.doRandomEmote(npc, task), npc.uniqueName('randomEmote')) self.taskStarted = True def stopTask(self): if not self.taskStarted: return for npc in self.npcs: taskMgr.remove(npc.uniqueName('randomEmote')) self.taskStarted = False def doRandomEmote(self, npc, task): Emote.globalEmote.doEmote(npc, TTEmote.Emotes.index(random.choice(self.RandomEmotes)), 0) task.delayTime = npc.emoteTrack.getDuration() + 1.0 return task.again
DedMemez/ODS-August-2017
tutorial/TutorialTVScenes.py
Python
apache-2.0
4,254
[ 30522, 1001, 6616, 2017, 4487, 6508, 2121, 1012, 11065, 2026, 8239, 3477, 12952, 1012, 2131, 21746, 1024, 2205, 13663, 7962, 1012, 14924, 4818, 1012, 14924, 4818, 9189, 11020, 28553, 2013, 25462, 29097, 1012, 4563, 12324, 4950, 2013, 3622, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * Webiny Framework (http://www.webiny.com/framework) * * @copyright Copyright Webiny LTD */ namespace Webiny\Component\ClassLoader\Tests; use Webiny\Component\Cache\Cache; use Webiny\Component\ClassLoader\ClassLoader; class ClassLoaderTest extends \PHPUnit_Framework_TestCase { public function testGetInstance() { $this->assertInstanceOf(ClassLoader::class, ClassLoader::getInstance()); } public function testRegisterSpl() { $autoloaders = spl_autoload_functions(); $this->assertSame(ClassLoader::class, get_class($autoloaders[0][0])); $this->assertSame('getClass', $autoloaders[0][1]); } public function testRegisterCacheDriver() { ClassLoader::getInstance()->registerCacheDriver(Cache::BlackHole()); $autoloaders = spl_autoload_functions(); $this->assertSame('getClassFromCache', $autoloaders[0][1]); } public function testFindClass() { ClassLoader::getInstance()->registerMap([ 'Webiny\Component\ClassLoader' => realpath(__DIR__ . '/../') ] ); $class = ClassLoader::getInstance()->findClass(ClassLoader::class); $this->assertSame(realpath(__DIR__ . '/../ClassLoader.php'), $class); } }
Webiny/Framework
src/Webiny/Component/ClassLoader/Tests/ClassLoaderTest.php
PHP
mit
1,346
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 4773, 24300, 7705, 1006, 8299, 1024, 1013, 1013, 7479, 1012, 4773, 24300, 1012, 4012, 1013, 7705, 1007, 1008, 1008, 1030, 9385, 9385, 4773, 24300, 5183, 1008, 1013, 3415, 15327, 4773, 24300,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/python3 ### rev: 5.0 ### author: <zhq> ### features: ### errors included ### up to 63 bases (2 to 64) ### caps recognition and same output format (deprecated) ### for the function parameters, `cur` represents the current (input) base, `res` represents the result (output) base, and `num` represents the current (input) number. def scale(cur, res, num): # int, int, str -> str # Default Settings num = str(num) iscaps = False positive = True # Input if cur == res: return num if num == "0": return "0" assert cur in range(2, 65) and res in range(2, 65), "Base not defined." if num[0] == "-": positive = False num = num[1:] result = 0 unit = 1 if cur != 10: for i in num[::-1]: value = ord(i) if value in range(48, 58): value -= 48 elif value in range(65, 92): value -= 55 elif value in range(97, 123): value -= 61 elif value == 64: value = 62 elif value == 95: value = 63 assert value <= cur, "Digit larger than original base. v:%d(%s) b:%d\nCall: scale(%d, %d, %s)" % (value, i, cur, cur, res, num) result += value * unit unit *= cur result = str(result) # Output if res != 10: num = int(result or num) result = "" while num > 0: num, value = divmod(num, res) if value < 10: digit = value + 48 elif value < 36: digit = value + 55 elif value < 62: digit = value + 61 elif value == 62: digit = 64 elif value == 63: digit = 95 result = chr(digit) + result if not positive: result = "-" + result return result
Irides-Chromium/cipher
scale_strict.py
Python
gpl-3.0
1,750
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 18750, 2509, 1001, 1001, 1001, 7065, 1024, 1019, 1012, 1014, 1001, 1001, 1001, 3166, 1024, 1026, 1062, 2232, 4160, 1028, 1001, 1001, 1001, 2838, 1024, 1001, 1001, 1001, 10697, 2443, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace Auth; class Module { public function getConfig() { return include __DIR__ . '/config/module.config.php'; } public function onBootstrap($e) { $e->getApplication()->getEventManager()->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch', function($e) { $controller = $e->getTarget(); $controllerClass = get_class($controller); $moduleNamespace = substr($controllerClass, 0, strpos($controllerClass, '\\')); if ('Auth' === $moduleNamespace ) { $controller->layout('layout/auth'); } }, 100); } public function getAutoloaderConfig() { return array( 'Zend\Loader\StandardAutoloader' => array( 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, ), ), ); } }
blue-ray/ocorrencia
module/Auth/Module.php
PHP
bsd-3-clause
997
[ 30522, 1026, 1029, 25718, 3415, 15327, 8740, 2705, 1025, 2465, 11336, 1063, 2270, 3853, 2131, 8663, 8873, 2290, 1006, 1007, 1063, 2709, 2421, 1035, 1035, 16101, 1035, 1035, 1012, 1005, 1013, 9530, 8873, 2290, 1013, 11336, 1012, 9530, 8873, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require 'not_magic' class Item def available? true end end describe 'NotMagic','adds not_ appended methods to all objects' do context 'on a class that has an available? method that returns true' do it 'adds a not_available? method' do item = Item.new item.not_available?.should eq false end end end
masonforest/not_magic
spec/not_magic_spec.rb
Ruby
mit
333
[ 30522, 5478, 1005, 2025, 1035, 3894, 1005, 2465, 8875, 13366, 2800, 1029, 2995, 2203, 2203, 6235, 1005, 2025, 2863, 12863, 1005, 1010, 1005, 9909, 2025, 1035, 10439, 21945, 4725, 2000, 2035, 5200, 1005, 2079, 6123, 1005, 2006, 1037, 2465, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>Uses of Class org.apache.commons.collections4.SetUtils (Apache Commons Collections 4.0 API)</title> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.commons.collections4.SetUtils (Apache Commons Collections 4.0 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/apache/commons/collections4/SetUtils.html" title="class in org.apache.commons.collections4">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/commons/collections4/class-use/SetUtils.html" target="_top">Frames</a></li> <li><a href="SetUtils.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.apache.commons.collections4.SetUtils" class="title">Uses of Class<br>org.apache.commons.collections4.SetUtils</h2> </div> <div class="classUseContainer">No usage of org.apache.commons.collections4.SetUtils</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/apache/commons/collections4/SetUtils.html" title="class in org.apache.commons.collections4">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/commons/collections4/class-use/SetUtils.html" target="_top">Frames</a></li> <li><a href="SetUtils.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2001&#x2013;2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> </body> </html>
icl7126/PlayConsoleSQL-parser
out/production/ConsoleParser/commons-collections4-4.0/apidocs/org/apache/commons/collections4/class-use/SetUtils.html
HTML
gpl-2.0
4,351
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 5890, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* File: AE/AEHelpers.h Contains: AEPrint, AEBuild and AEStream for Carbon Version: AppleEvents-527.6~1 Copyright: © 1999-2008 by Apple Computer, Inc., all rights reserved. Bugs?: For bug reports, consult the following page on the World Wide Web: http://developer.apple.com/bugreporter/ */ /* * Originally from AEGIzmos by Jens Alfke, circa 1992. */ #ifndef __AEHELPERS__ #define __AEHELPERS__ #include <stdarg.h> #ifndef __APPLEEVENTS__ #include <AE/AppleEvents.h> #endif #ifndef __AEDATAMODEL__ #include <AE/AEDataModel.h> #endif #ifndef __CFSTRING__ #include <CoreFoundation/CFString.h> #endif #include <AvailabilityMacros.h> #if PRAGMA_ONCE #pragma once #endif #ifdef __cplusplus extern "C" { #endif #pragma pack(push, 2) /* * AEBuild: * * AEBuild provides a very high level abstraction for building * complete AppleEvents and complex ObjectSpeciers. Using AEBuild it * is easy to produce a textual representation of an AEDesc. The * format is similar to the stdio printf call, where meta data is * extracted from a format string and used to build the final * representation. * * For more information on AEBuild and other APIs in AEHelpers, see: * <http://developer.apple.com/technotes/tn/tn2045.html> */ /* Syntax Error Codes: */ typedef UInt32 AEBuildErrorCode; enum { aeBuildSyntaxNoErr = 0, /* (No error) */ aeBuildSyntaxBadToken = 1, /* Illegal character */ aeBuildSyntaxBadEOF = 2, /* Unexpected end of format string */ aeBuildSyntaxNoEOF = 3, /* Unexpected extra stuff past end */ aeBuildSyntaxBadNegative = 4, /* "-" not followed by digits */ aeBuildSyntaxMissingQuote = 5, /* Missing close "'" */ aeBuildSyntaxBadHex = 6, /* Non-digit in hex string */ aeBuildSyntaxOddHex = 7, /* Odd # of hex digits */ aeBuildSyntaxNoCloseHex = 8, /* Missing hex quote close "È" */ aeBuildSyntaxUncoercedHex = 9, /* Hex string must be coerced to a type */ aeBuildSyntaxNoCloseString = 10, /* Missing close quote */ aeBuildSyntaxBadDesc = 11, /* Illegal descriptor */ aeBuildSyntaxBadData = 12, /* Bad data value inside (Ç È) */ aeBuildSyntaxNoCloseParen = 13, /* Missing ")" after data value */ aeBuildSyntaxNoCloseBracket = 14, /* Expected "," or "]" */ aeBuildSyntaxNoCloseBrace = 15, /* Expected "," or "}" */ aeBuildSyntaxNoKey = 16, /* Missing keyword in record */ aeBuildSyntaxNoColon = 17, /* Missing ":" after keyword in record */ aeBuildSyntaxCoercedList = 18, /* Cannot coerce a list */ aeBuildSyntaxUncoercedDoubleAt = 19 /* "@@" substitution must be coerced */ }; /* A structure containing error state.*/ struct AEBuildError { AEBuildErrorCode fError; UInt32 fErrorPos; }; typedef struct AEBuildError AEBuildError; /* Create an AEDesc from the format string. AEBuildError can be NULL, in which case no explicit error information will be returned. */ /* * AEBuildDesc() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEBuildDesc( AEDesc * dst, AEBuildError * error, /* can be NULL */ const char * src, ...) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* varargs version of AEBuildDesc*/ /* * vAEBuildDesc() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus vAEBuildDesc( AEDesc * dst, AEBuildError * error, /* can be NULL */ const char * src, va_list args) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Append parameters to an existing AppleEvent*/ /* * AEBuildParameters() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEBuildParameters( AppleEvent * event, AEBuildError * error, /* can be NULL */ const char * format, ...) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* varargs version of AEBuildParameters*/ /* * vAEBuildParameters() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus vAEBuildParameters( AppleEvent * event, AEBuildError * error, /* can be NULL */ const char * format, va_list args) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Building an entire Apple event:*/ /* * AEBuildAppleEvent() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEBuildAppleEvent( AEEventClass theClass, AEEventID theID, DescType addressType, const void * addressData, Size addressLength, SInt16 returnID, SInt32 transactionID, AppleEvent * result, AEBuildError * error, /* can be NULL */ const char * paramsFmt, ...) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* varargs version of AEBuildAppleEvent*/ /* * vAEBuildAppleEvent() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus vAEBuildAppleEvent( AEEventClass theClass, AEEventID theID, DescType addressType, const void * addressData, Size addressLength, SInt16 returnID, SInt32 transactionID, AppleEvent * resultEvt, AEBuildError * error, /* can be NULL */ const char * paramsFmt, va_list args) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* * AEPrintDescToHandle * * AEPrintDescToHandle provides a way to turn an AEDesc into a textual * representation. This is most useful for debugging calls to * AEBuildDesc and friends. The Handle returned should be disposed by * the caller. The size of the handle is the actual number of * characters in the string. */ /* * AEPrintDescToHandle() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEPrintDescToHandle( const AEDesc * desc, Handle * result) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* * AEStream: * * The AEStream interface allows you to build AppleEvents by appending * to an opaque structure (an AEStreamRef) and then turning this * structure into an AppleEvent. The basic idea is to open the * stream, write data, and then close it - closing it produces an * AEDesc, which may be partially complete, or may be a complete * AppleEvent. */ typedef struct OpaqueAEStreamRef* AEStreamRef; /* Create and return an AEStreamRef Returns NULL on memory allocation failure */ /* * AEStreamOpen() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern AEStreamRef AEStreamOpen(void) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Closes and disposes of an AEStreamRef, producing results in the desc. You must dispose of the desc yourself. If you just want to dispose of the AEStreamRef, you can pass NULL for desc. */ /* * AEStreamClose() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamClose( AEStreamRef ref, AEDesc * desc) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Prepares an AEStreamRef for appending data to a newly created desc. You append data with AEStreamWriteData */ /* * AEStreamOpenDesc() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamOpenDesc( AEStreamRef ref, DescType newType) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Append data to the previously opened desc.*/ /* * AEStreamWriteData() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamWriteData( AEStreamRef ref, const void * data, Size length) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Finish a desc. After this, you can close the stream, or adding new descs, if you're assembling a list. */ /* * AEStreamCloseDesc() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamCloseDesc(AEStreamRef ref) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Write data as a desc to the stream*/ /* * AEStreamWriteDesc() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamWriteDesc( AEStreamRef ref, DescType newType, const void * data, Size length) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Write an entire desc to the stream*/ /* * AEStreamWriteAEDesc() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamWriteAEDesc( AEStreamRef ref, const AEDesc * desc) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Begin a list. You can then append to the list by doing AEStreamOpenDesc, or AEStreamWriteDesc. */ /* * AEStreamOpenList() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamOpenList(AEStreamRef ref) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Finish a list.*/ /* * AEStreamCloseList() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamCloseList(AEStreamRef ref) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Begin a record. A record usually has type 'reco', however, this is rather generic, and frequently a different type is used. */ /* * AEStreamOpenRecord() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamOpenRecord( AEStreamRef ref, DescType newType) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Change the type of a record.*/ /* * AEStreamSetRecordType() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamSetRecordType( AEStreamRef ref, DescType newType) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Finish a record*/ /* * AEStreamCloseRecord() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamCloseRecord(AEStreamRef ref) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Add a keyed descriptor to a record. This is analogous to AEPutParamDesc. it can only be used when writing to a record. */ /* * AEStreamWriteKeyDesc() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamWriteKeyDesc( AEStreamRef ref, AEKeyword key, DescType newType, const void * data, Size length) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* OpenDesc for a keyed record entry. You can use AEStreamWriteData after opening a keyed desc. */ /* * AEStreamOpenKeyDesc() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamOpenKeyDesc( AEStreamRef ref, AEKeyword key, DescType newType) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Write a key to the stream - you can follow this with an AEWriteDesc.*/ /* * AEStreamWriteKey() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamWriteKey( AEStreamRef ref, AEKeyword key) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Create a complete AppleEvent. This creates and returns a new stream. Use this call to populate the meta fields in an AppleEvent record. After this, you can add your records, lists and other parameters. */ /* * AEStreamCreateEvent() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern AEStreamRef AEStreamCreateEvent( AEEventClass clazz, AEEventID id, DescType targetType, const void * targetData, Size targetLength, SInt16 returnID, SInt32 transactionID) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* This call lets you augment an existing AppleEvent using the stream APIs. This would be useful, for example, in constructing the reply record in an AppleEvent handler. Note that AEStreamOpenEvent will consume the AppleEvent passed in - you can't access it again until the stream is closed. When you're done building the event, AEStreamCloseStream will reconstitute it. */ /* * AEStreamOpenEvent() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern AEStreamRef AEStreamOpenEvent(AppleEvent * event) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /* Mark a keyword as being an optional parameter.*/ /* * AEStreamOptionalParam() * * Mac OS X threading: * Thread safe since version 10.2 * * Availability: * Mac OS X: in version 10.0 and later in ApplicationServices.framework * CarbonLib: in CarbonLib 1.1 and later * Non-Carbon CFM: not available */ extern OSStatus AEStreamOptionalParam( AEStreamRef ref, AEKeyword key) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; #pragma pack(pop) #ifdef __cplusplus } #endif #endif /* __AEHELPERS__ */
wesen/mididuino
thirdparty/includes-osx/Frameworks/AE.framework/Versions/Current/Headers/AEHelpers.h
C
lgpl-2.1
18,522
[ 30522, 1013, 1008, 5371, 1024, 29347, 1013, 29347, 16001, 7347, 1012, 1044, 3397, 1024, 29347, 16550, 1010, 29347, 8569, 4014, 2094, 1998, 29347, 21422, 30524, 6207, 3274, 1010, 4297, 1012, 1010, 2035, 2916, 9235, 1012, 12883, 1029, 1024, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
describe IncomeTax::Countries::Benin do subject(:result) { described_class.new(income: income, income_type: type, tax_year: tax_year) } let(:type) { :gross } describe "from gross income of 0" do let(:tax_year) { 2015 } let(:income) { 0 } its(:rate) { should be == Rational(0, 1) } its(:gross_income) { should be == 0 } its(:net_income) { should be == 0 } its(:taxes) { should be == 0 } end describe "from gross income of 1000" do let(:tax_year) { 2015 } let(:income) { 1000 } its(:rate) { should be == Rational(0, 1) } its(:gross_income) { should be == 1000 } its(:net_income) { should be == 1000 } its(:taxes) { should be == 0 } end describe "from gross income of 10000" do let(:tax_year) { 2015 } let(:income) { 10000 } its(:rate) { should be == Rational(0, 1) } its(:gross_income) { should be == 10000 } its(:net_income) { should be == 10000 } its(:taxes) { should be == 0 } end describe "from gross income of 100000" do let(:tax_year) { 2015 } let(:income) { 100000 } its(:rate) { should be == Rational(0, 1) } its(:gross_income) { should be == 100000 } its(:net_income) { should be == 100000 } its(:taxes) { should be == 0 } end describe "from gross income of 100000000" do let(:tax_year) { 2015 } let(:income) { 100000000 } its(:rate) { should be == Rational(83, 189) } its(:gross_income) { should be == 100000000 } its(:net_income) { should be == 56085000 } its(:taxes) { should be == 43915000 } end describe "from net income of 0" do let(:type) { :net } let(:tax_year) { 2015 } let(:income) { 0 } its(:rate) { should be == Rational(0, 1) } its(:gross_income) { should be == 0 } its(:net_income) { should be == 0 } its(:taxes) { should be == 0 } end describe "from net income of 1000" do let(:type) { :net } let(:tax_year) { 2015 } let(:income) { 1000 } its(:rate) { should be == Rational(0, 1) } its(:gross_income) { should be == 1000 } its(:net_income) { should be == 1000 } its(:taxes) { should be == 0 } end describe "from net income of 10000" do let(:type) { :net } let(:tax_year) { 2015 } let(:income) { 10000 } its(:rate) { should be == Rational(0, 1) } its(:gross_income) { should be == 10000 } its(:net_income) { should be == 10000 } its(:taxes) { should be == 0 } end describe "from net income of 100000" do let(:type) { :net } let(:tax_year) { 2015 } let(:income) { 100000 } its(:rate) { should be == Rational(0, 1) } its(:gross_income) { should be == 100000 } its(:net_income) { should be == 100000 } its(:taxes) { should be == 0 } end describe "from net income of 100000000" do let(:type) { :net } let(:tax_year) { 2015 } let(:income) { 100000000 } its(:rate) { should be == Rational(103, 232) } its(:gross_income) { should be == "179845454.545454545".to_d } its(:net_income) { should be == 100000000 } its(:taxes) { should be == "79845454.545454545".to_d } end end
rkh/income-tax
spec/income_tax/countries/benin_spec.rb
Ruby
mit
5,141
[ 30522, 6235, 3318, 2696, 2595, 1024, 1024, 3032, 1024, 1024, 21164, 2079, 3395, 1006, 1024, 2765, 1007, 1063, 2649, 1035, 2465, 1012, 2047, 1006, 3318, 1024, 3318, 1010, 3318, 1035, 2828, 1024, 2828, 1010, 4171, 1035, 2095, 1024, 4171, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* UOL Messenger * Copyright (c) 2005 Universo Online S/A * * Direitos Autorais Reservados * All rights reserved * * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo * sob os termos da Licença Pública Geral GNU conforme publicada pela Free * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) * qualquer versão posterior. * Este programa é distribuído na expectativa de que seja útil, porém, * SEM NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE * OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral * do GNU para mais detalhes. * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto * com este programa; se não, escreva para a Free Software Foundation, Inc., * no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Universo Online S/A - A/C: UOL Messenger 5o. Andar * Avenida Brigadeiro Faria Lima, 1.384 - Jardim Paulistano * São Paulo SP - CEP 01452-002 - BRASIL */ #include "StdAfx.h" #include <commands/ShowFileTransfersDialogcommand.h> #include "../UIMApplication.h" CShowFileTransfersDialogCommand::CShowFileTransfersDialogCommand() { } CShowFileTransfersDialogCommand::~CShowFileTransfersDialogCommand(void) { } void CShowFileTransfersDialogCommand::Execute() { CUIMApplication::GetApplication()->GetUIManager()->ShowFileTransferDialog(NULL); }
gabrieldelsaint/uol-messenger
src/public/uim/controller/commands/ShowFileTransfersDialogCommand.cpp
C++
gpl-2.0
2,122
[ 30522, 1013, 1008, 1057, 4747, 11981, 1008, 9385, 1006, 1039, 1007, 2384, 4895, 16402, 6499, 3784, 1055, 1013, 1037, 1008, 1008, 18704, 9956, 2015, 8285, 14995, 2015, 24501, 2121, 3567, 12269, 1008, 2035, 2916, 9235, 1008, 1008, 28517, 2565...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package wvlet.airframe.json import wvlet.log.LogSupport /** */ object JSON extends LogSupport { /** * Parse JSON object or array */ def parse(s: String): JSONValue = { parse(JSONSource.fromString(s)) } /** * Parse JSON object or array */ def parse(s: Array[Byte]): JSONValue = { parse(JSONSource.fromBytes(s)) } /** * Parse JSON object or array */ def parse(s: JSONSource): JSONValue = { val b = new JSONValueBuilder().singleContext(s, 0) JSONScanner.scan(s, b) val j = b.result j } /** * Parse any json values including null */ def parseAny(s: String): JSONValue = { parseAny(JSONSource.fromString(s)) } /** * Parse any json values including null */ def parseAny(s: Array[Byte]): JSONValue = { parseAny(JSONSource.fromBytes(s)) } /** * Parse any json values including null */ def parseAny(s: JSONSource): JSONValue = { val b = new JSONValueBuilder().singleContext(s, 0) JSONScanner.scanAny(s, b) } /** * Format JSON value */ def format(v: JSONValue): String = { def formatInternal(v: JSONValue, level: Int = 0): String = { val s = new StringBuilder() v match { case x: JSONObject => if (x.v.isEmpty) { s.append("{}") } else { s.append("{\n") s.append { x.v .map { case (k, v: JSONValue) => val ss = new StringBuilder ss.append(" " * (level + 1)) ss.append("\"") ss.append(quoteJSONString(k)) ss.append("\": ") ss.append(formatInternal(v, level + 1)) ss.result() }.mkString("", ",\n", "\n") } s.append(" " * level) s.append("}") } case x: JSONArray => if (x.v.isEmpty) { s.append("[]") } else { s.append("[\n") s.append( x.v .map { x => (" " * (level + 1)) + formatInternal(x, level + 1) }.mkString("", ",\n", "\n") ) s.append(" " * level) s.append("]") } case x => s.append(x.toJSON) } s.result() } formatInternal(v, 0) } sealed trait JSONValue { override def toString = toJSON def toJSON: String } case object JSONNull extends JSONValue { override def toJSON: String = "null" } final case class JSONBoolean(val v: Boolean) extends JSONValue { override def toJSON: String = if (v) "true" else "false" } val JSONTrue = JSONBoolean(true) val JSONFalse = JSONBoolean(false) sealed trait JSONNumber extends JSONValue final case class JSONDouble(v: Double) extends JSONNumber { override def toJSON: String = v.toString } final case class JSONLong(v: Long) extends JSONNumber { override def toJSON: String = v.toString } final case class JSONString(v: String) extends JSONValue { override def toString = v override def toJSON: String = { val s = new StringBuilder(v.length + 2) s.append("\"") s.append(quoteJSONString(v)) s.append("\"") s.result() } } object JSONObject { val empty: JSONObject = JSONObject(Seq.empty) } final case class JSONObject(v: Seq[(String, JSONValue)]) extends JSONValue { def isEmpty: Boolean = v.isEmpty def size: Int = v.size override def toJSON: String = { val s = new StringBuilder s.append("{") s.append { v.map { case (k, v: JSONValue) => val ss = new StringBuilder ss.append("\"") ss.append(quoteJSONString(k)) ss.append("\":") ss.append(v.toJSON) ss.result() }.mkString(",") } s.append("}") s.result() } def get(name: String): Option[JSONValue] = { v.collectFirst { case (key, value) if key == name => value } } } final case class JSONArray(v: IndexedSeq[JSONValue]) extends JSONValue { def size: Int = v.length override def toJSON: String = { val s = new StringBuilder s.append("[") s.append(v.map(x => x.toJSON).mkString(",")) s.append("]") s.result() } def apply(i: Int): JSONValue = { v.apply(i) } } /** * This function can be used to properly quote Strings for JSON output. */ def quoteJSONString(s: String): String = { s.map { case '"' => "\\\"" case '\\' => "\\\\" // case '/' => "\\/" We don't need to escape forward slashes case '\b' => "\\b" case '\f' => "\\f" case '\n' => "\\n" case '\r' => "\\r" case '\t' => "\\t" /* We'll unicode escape any control characters. These include: * 0x0 -> 0x1f : ASCII Control (C0 Control Codes) * 0x7f : ASCII DELETE * 0x80 -> 0x9f : C1 Control Codes * * Per RFC4627, section 2.5, we're not technically required to * encode the C1 codes, but we do to be safe. */ case c if ((c >= '\u0000' && c <= '\u001f') || (c >= '\u007f' && c <= '\u009f')) => "\\u%04x".format(c.toInt) case c => c }.mkString } }
wvlet/airframe
airframe-json/src/main/scala/wvlet/airframe/json/JSON.scala
Scala
apache-2.0
5,960
[ 30522, 1013, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2007, 1996, 6105, 1012, 1008, 2017, 2089, 6855, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.11"/> <title>V8 API Reference Guide for node.js v8.4.0: v8::Platform::TraceStateObserver Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">V8 API Reference Guide for node.js v8.4.0 </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1Platform.html">Platform</a></li><li class="navelem"><a class="el" href="classv8_1_1Platform_1_1TraceStateObserver.html">TraceStateObserver</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> &#124; <a href="classv8_1_1Platform_1_1TraceStateObserver-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">v8::Platform::TraceStateObserver Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:a048ed0e049feb4aa358111e20ae5e1ce"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a048ed0e049feb4aa358111e20ae5e1ce"></a> virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>OnTraceEnabled</b> ()=0</td></tr> <tr class="separator:a048ed0e049feb4aa358111e20ae5e1ce"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a04ccb65bd84ff4566e96dbe9e2a6691b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a04ccb65bd84ff4566e96dbe9e2a6691b"></a> virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>OnTraceDisabled</b> ()=0</td></tr> <tr class="separator:a04ccb65bd84ff4566e96dbe9e2a6691b"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <hr/>The documentation for this class was generated from the following file:<ul> <li>deps/v8/include/<a class="el" href="v8-platform_8h_source.html">v8-platform.h</a></li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>
v8-dox/v8-dox.github.io
2d806f4/html/classv8_1_1Platform_1_1TraceStateObserver.html
HTML
mit
5,715
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/****************************************************************************** * Wormux is a convivial mass murder game. * Copyright (C) 2001-2004 Lawrence Azzoug. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA ****************************************************************************** * Colors. ******************************************************************************/ #ifndef COLORS_H #define COLORS_H #include <SDL_video.h> #include "color.h" // Greyscale const Color white_color (255, 255, 255, SDL_ALPHA_OPAQUE); const Color lightgray_color (169, 169, 169, SDL_ALPHA_OPAQUE); const Color gray_color (128, 128, 128, SDL_ALPHA_OPAQUE); const Color dark_gray_color (64, 64, 64, SDL_ALPHA_OPAQUE); const Color black_color (0, 0, 0, SDL_ALPHA_OPAQUE); const Color c_white (0xFF, 0xFF, 0xFF, 0x70); const Color c_black (0x00, 0x00, 0x00, 0x70); const Color c_red (0xFF, 0x00, 0x00, 0x70); const Color c_yellow (0x00, 0xFF, 0xFF, 0x70); const Color c_grey (0xF0, 0xF0, 0xF0, 0x70); // Green const Color green_color (68, 120, 51, SDL_ALPHA_OPAQUE); const Color primary_red_color(255, 0, 0, SDL_ALPHA_OPAQUE); // Default colors: const Color defaultColorBox(80, 80, 159, 206); const Color defaultColorRect(49, 32, 122, 255); const Color defaultOptionColorBox(255,255,255,160); //const Color defaultOptionColorBox(34, 133, 175, 206); const Color highlightOptionColorBox(200, 100, 100, 206); //const Color defaultOptionColorBox(34, 133, 175, 206); const Color defaultDisabledColorBox(0,0,0,127); const Color defaultOptionColorRect(59,88,129,206); //const Color defaultListColor1(255, 255, 255, 255*3/10); const Color defaultListColor1(75, 163, 200, 255*3/10); const Color defaultListColor2(0, 0, 255*6/10, 255*8/10); const Color defaultListColor3(0, 0, 255*6/10, 255*4/10); #endif /* COLORS_H */
yeKcim/warmux
old/wormux-0.7.9/src/graphic/colors.h
C
gpl-2.0
2,512
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* eslint-disable no-console */ const buildData = require('./build_data'); const buildSrc = require('./build_src'); const buildCSS = require('./build_css'); let _currBuild = null; // if called directly, do the thing. buildAll(); function buildAll() { if (_currBuild) return _currBuild; return _currBuild = Promise.resolve() .then(() => buildCSS()) .then(() => buildData()) .then(() => buildSrc()) .then(() => _currBuild = null) .catch((err) => { console.error(err); _currBuild = null; process.exit(1); }); } module.exports = buildAll;
kartta-labs/iD
build.js
JavaScript
isc
591
[ 30522, 1013, 1008, 9686, 4115, 2102, 1011, 4487, 19150, 2053, 1011, 10122, 1008, 1013, 9530, 3367, 3857, 2850, 2696, 1027, 5478, 1006, 1005, 1012, 1013, 3857, 1035, 2951, 1005, 1007, 1025, 9530, 3367, 16473, 11890, 1027, 5478, 1006, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
(function(w){function D(c,b,f,k){if(b.points.errorbars){c=[{x:!0,number:!0,required:!0},{y:!0,number:!0,required:!0}];f=b.points.errorbars;if("x"==f||"xy"==f)b.points.xerr.asymmetric&&c.push({x:!0,number:!0,required:!0}),c.push({x:!0,number:!0,required:!0});if("y"==f||"xy"==f)b.points.yerr.asymmetric&&c.push({y:!0,number:!0,required:!0}),c.push({y:!0,number:!0,required:!0});k.format=c}}function A(c,b,f,k,e,u,h,B,a,C,n){k+=C;e+=C;u+=C;"x"==b.err?(e>f+a?v(c,[[e,k],[Math.max(f+a,n[0]),k]]):h=!1,u<f- a?v(c,[[Math.min(f-a,n[1]),k],[u,k]]):B=!1):(e<k-a?v(c,[[f,e],[f,Math.min(k-a,n[0])]]):h=!1,u>k+a?v(c,[[f,Math.max(k+a,n[1])],[f,u]]):B=!1);a=null!=b.radius?b.radius:a;h&&("-"==b.upperCap?"x"==b.err?v(c,[[e,k-a],[e,k+a]]):v(c,[[f-a,e],[f+a,e]]):w.isFunction(b.upperCap)&&("x"==b.err?b.upperCap(c,e,k,a):b.upperCap(c,f,e,a)));B&&("-"==b.lowerCap?"x"==b.err?v(c,[[u,k-a],[u,k+a]]):v(c,[[f-a,u],[f+a,u]]):w.isFunction(b.lowerCap)&&("x"==b.err?b.lowerCap(c,u,k,a):b.lowerCap(c,f,u,a)))}function v(c,b){c.beginPath(); c.moveTo(b[0][0],b[0][1]);for(var f=1;f<b.length;f++)c.lineTo(b[f][0],b[f][1]);c.stroke()}function E(c,b){var f=c.getPlotOffset();b.save();b.translate(f.left,f.top);w.each(c.getData(),function(c,e){if(e.points.errorbars&&(e.points.xerr.show||e.points.yerr.show)){c=e.datapoints.points;var f=e.datapoints.pointsize,h=[e.xaxis,e.yaxis],k=e.points.radius,a=[e.points.xerr,e.points.yerr],v=!1;if(h[0].p2c(h[0].max)<h[0].p2c(h[0].min)){v=!0;var n=a[0].lowerCap;a[0].lowerCap=a[0].upperCap;a[0].upperCap=n}var w= !1;h[1].p2c(h[1].min)<h[1].p2c(h[1].max)&&(w=!0,n=a[1].lowerCap,a[1].lowerCap=a[1].upperCap,a[1].upperCap=n);for(var p=0;p<e.datapoints.points.length;p+=f){var d=e.datapoints.points,q=null,r=null,l=null,m=null;var x=e.points.xerr;var g=e.points.yerr,t=e.points.errorbars;"x"==t||"xy"==t?x.asymmetric?(q=d[p+2],r=d[p+3],"xy"==t&&(g.asymmetric?(l=d[p+4],m=d[p+5]):l=d[p+4])):(q=d[p+2],"xy"==t&&(g.asymmetric?(l=d[p+3],m=d[p+4]):l=d[p+3])):"y"==t&&(g.asymmetric?(l=d[p+2],m=d[p+3]):l=d[p+2]);null==r&&(r= q);null==m&&(m=l);d=[q,r,l,m];x.show||(d[0]=null,d[1]=null);g.show||(d[2]=null,d[3]=null);x=d;for(g=0;g<a.length;g++)if(d=[h[g].min,h[g].max],x[g*a.length]&&(q=c[p],r=c[p+1],l=[q,r][g]+x[g*a.length+1],m=[q,r][g]-x[g*a.length],"x"!=a[g].err||!(r>h[1].max||r<h[1].min||l<h[0].min||m>h[0].max)))if("y"!=a[g].err||!(q>h[0].max||q<h[0].min||l<h[1].min||m>h[1].max)){var y=t=!0;l>d[1]&&(t=!1,l=d[1]);m<d[0]&&(y=!1,m=d[0]);if("x"==a[g].err&&v||"y"==a[g].err&&w)n=m,m=l,l=n,n=y,y=t,t=n,n=d[0],d[0]=d[1],d[1]=n; q=h[0].p2c(q);r=h[1].p2c(r);l=h[g].p2c(l);m=h[g].p2c(m);d[0]=h[g].p2c(d[0]);d[1]=h[g].p2c(d[1]);n=a[g].lineWidth?a[g].lineWidth:e.points.lineWidth;var z=null!=e.points.shadowSize?e.points.shadowSize:e.shadowSize;0<n&&0<z&&(z/=2,b.lineWidth=z,b.strokeStyle="rgba(0,0,0,0.1)",A(b,a[g],q,r,l,m,t,y,k,z+z/2,d),b.strokeStyle="rgba(0,0,0,0.2)",A(b,a[g],q,r,l,m,t,y,k,z/2,d));b.strokeStyle=a[g].color?a[g].color:e.color;b.lineWidth=n;A(b,a[g],q,r,l,m,t,y,k,0,d)}}}});b.restore()}w.plot.plugins.push({init:function(c){c.hooks.processRawData.push(D); c.hooks.draw.push(E)},options:{series:{points:{errorbars:null,xerr:{err:"x",show:null,asymmetric:null,upperCap:null,lowerCap:null,color:null,radius:null},yerr:{err:"y",show:null,asymmetric:null,upperCap:null,lowerCap:null,color:null,radius:null}}}},name:"errorbars",version:"1.0"})})(jQuery);
teuben/masc
www/js/lib/js9-3.5/js/jquery.flot.errorbars.min.js
JavaScript
mit
3,362
[ 30522, 1006, 3853, 1006, 1059, 1007, 1063, 3853, 1040, 1006, 1039, 1010, 1038, 1010, 1042, 1010, 1047, 1007, 1063, 2065, 1006, 1038, 1012, 2685, 1012, 7561, 8237, 2015, 1007, 1063, 1039, 1027, 1031, 1063, 1060, 1024, 999, 1014, 1010, 2193...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "util-internal.h" /* The old tests here need assertions to work. */ #undef NDEBUG #include "event2/event-config.h" #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef EVENT__HAVE_UNISTD_H #include <unistd.h> #endif #ifdef EVENT__HAVE_SYS_WAIT_H #include <sys/wait.h> #endif #ifdef EVENT__HAVE_PTHREADS #include <pthread.h> #elif defined(_WIN32) #include <process.h> #endif #include <assert.h> #ifdef EVENT__HAVE_UNISTD_H #include <unistd.h> #endif #include <time.h> #include "sys/queue.h" #include "event2/event.h" #include "event2/event_struct.h" #include "event2/thread.h" #include "event2/util.h" #include "evthread-internal.h" #include "event-internal.h" #include "defer-internal.h" #include "regress.h" #include "tinytest_macros.h" #include "time-internal.h" #include "regress_thread.h" struct cond_wait { void *lock; void *cond; }; static void wake_all_timeout(evutil_socket_t fd, short what, void *arg) { struct cond_wait *cw = arg; EVLOCK_LOCK(cw->lock, 0); EVTHREAD_COND_BROADCAST(cw->cond); EVLOCK_UNLOCK(cw->lock, 0); } static void wake_one_timeout(evutil_socket_t fd, short what, void *arg) { struct cond_wait *cw = arg; EVLOCK_LOCK(cw->lock, 0); EVTHREAD_COND_SIGNAL(cw->cond); EVLOCK_UNLOCK(cw->lock, 0); } #define NUM_THREADS 100 #define NUM_ITERATIONS 100 void *count_lock; static int count; static THREAD_FN basic_thread(void *arg) { struct cond_wait cw; struct event_base *base = arg; struct event ev; int i = 0; EVTHREAD_ALLOC_LOCK(cw.lock, 0); EVTHREAD_ALLOC_COND(cw.cond); assert(cw.lock); assert(cw.cond); evtimer_assign(&ev, base, wake_all_timeout, &cw); for (i = 0; i < NUM_ITERATIONS; i++) { struct timeval tv; evutil_timerclear(&tv); tv.tv_sec = 0; tv.tv_usec = 3000; EVLOCK_LOCK(cw.lock, 0); /* we need to make sure that event does not happen before * we get to wait on the conditional variable */ assert(evtimer_add(&ev, &tv) == 0); assert(EVTHREAD_COND_WAIT(cw.cond, cw.lock) == 0); EVLOCK_UNLOCK(cw.lock, 0); EVLOCK_LOCK(count_lock, 0); ++count; EVLOCK_UNLOCK(count_lock, 0); } /* exit the loop only if all threads fired all timeouts */ EVLOCK_LOCK(count_lock, 0); if (count >= NUM_THREADS * NUM_ITERATIONS) event_base_loopexit(base, NULL); EVLOCK_UNLOCK(count_lock, 0); EVTHREAD_FREE_LOCK(cw.lock, 0); EVTHREAD_FREE_COND(cw.cond); THREAD_RETURN(); } static int notification_fd_used = 0; #ifndef _WIN32 static int got_sigchld = 0; static void sigchld_cb(evutil_socket_t fd, short event, void *arg) { struct timeval tv; struct event_base *base = arg; got_sigchld++; tv.tv_usec = 100000; tv.tv_sec = 0; event_base_loopexit(base, &tv); } static void notify_fd_cb(evutil_socket_t fd, short event, void *arg) { ++notification_fd_used; } #endif static void thread_basic(void *arg) { THREAD_T threads[NUM_THREADS]; struct event ev; struct timeval tv; int i; struct basic_test_data *data = arg; struct event_base *base = data->base; struct event *notification_event = NULL; struct event *sigchld_event = NULL; EVTHREAD_ALLOC_LOCK(count_lock, 0); tt_assert(count_lock); tt_assert(base); if (evthread_make_base_notifiable(base)<0) { tt_abort_msg("Couldn't make base notifiable!"); } #ifndef _WIN32 if (data->setup_data && !strcmp(data->setup_data, "forking")) { pid_t pid; int status; sigchld_event = evsignal_new(base, SIGCHLD, sigchld_cb, base); /* This piggybacks on the th_notify_fd weirdly, and looks * inside libevent internals. Not a good idea in non-testing * code! */ notification_event = event_new(base, base->th_notify_fd[0], EV_READ|EV_PERSIST, notify_fd_cb, NULL); event_add(sigchld_event, NULL); event_add(notification_event, NULL); if ((pid = fork()) == 0) { event_del(notification_event); if (event_reinit(base) < 0) { TT_FAIL(("reinit")); exit(1); } event_assign(notification_event, base, base->th_notify_fd[0], EV_READ|EV_PERSIST, notify_fd_cb, NULL); event_add(notification_event, NULL); goto child; } event_base_dispatch(base); if (waitpid(pid, &status, 0) == -1) tt_abort_perror("waitpid"); TT_BLATHER(("Waitpid okay\n")); tt_assert(got_sigchld); tt_int_op(notification_fd_used, ==, 0); goto end; } child: #endif for (i = 0; i < NUM_THREADS; ++i) THREAD_START(threads[i], basic_thread, base); evtimer_assign(&ev, base, NULL, NULL); evutil_timerclear(&tv); tv.tv_sec = 1000; event_add(&ev, &tv); event_base_dispatch(base); for (i = 0; i < NUM_THREADS; ++i) THREAD_JOIN(threads[i]); event_del(&ev); tt_int_op(count, ==, NUM_THREADS * NUM_ITERATIONS); EVTHREAD_FREE_LOCK(count_lock, 0); TT_BLATHER(("notifiations==%d", notification_fd_used)); end: if (notification_event) event_free(notification_event); if (sigchld_event) event_free(sigchld_event); } #undef NUM_THREADS #define NUM_THREADS 10 struct alerted_record { struct cond_wait *cond; struct timeval delay; struct timeval alerted_at; int timed_out; }; static THREAD_FN wait_for_condition(void *arg) { struct alerted_record *rec = arg; int r; EVLOCK_LOCK(rec->cond->lock, 0); if (rec->delay.tv_sec || rec->delay.tv_usec) { r = EVTHREAD_COND_WAIT_TIMED(rec->cond->cond, rec->cond->lock, &rec->delay); } else { r = EVTHREAD_COND_WAIT(rec->cond->cond, rec->cond->lock); } EVLOCK_UNLOCK(rec->cond->lock, 0); evutil_gettimeofday(&rec->alerted_at, NULL); if (r == 1) rec->timed_out = 1; THREAD_RETURN(); } static void thread_conditions_simple(void *arg) { struct timeval tv_signal, tv_timeout, tv_broadcast; struct alerted_record alerted[NUM_THREADS]; THREAD_T threads[NUM_THREADS]; struct cond_wait cond; int i; struct timeval launched_at; struct event wake_one; struct event wake_all; struct basic_test_data *data = arg; struct event_base *base = data->base; int n_timed_out=0, n_signal=0, n_broadcast=0; tv_signal.tv_sec = tv_timeout.tv_sec = tv_broadcast.tv_sec = 0; tv_signal.tv_usec = 30*1000; tv_timeout.tv_usec = 150*1000; tv_broadcast.tv_usec = 500*1000; EVTHREAD_ALLOC_LOCK(cond.lock, EVTHREAD_LOCKTYPE_RECURSIVE); EVTHREAD_ALLOC_COND(cond.cond); tt_assert(cond.lock); tt_assert(cond.cond); for (i = 0; i < NUM_THREADS; ++i) { memset(&alerted[i], 0, sizeof(struct alerted_record)); alerted[i].cond = &cond; } /* Threads 5 and 6 will be allowed to time out */ memcpy(&alerted[5].delay, &tv_timeout, sizeof(tv_timeout)); memcpy(&alerted[6].delay, &tv_timeout, sizeof(tv_timeout)); evtimer_assign(&wake_one, base, wake_one_timeout, &cond); evtimer_assign(&wake_all, base, wake_all_timeout, &cond); evutil_gettimeofday(&launched_at, NULL); /* Launch the threads... */ for (i = 0; i < NUM_THREADS; ++i) { THREAD_START(threads[i], wait_for_condition, &alerted[i]); } /* Start the timers... */ tt_int_op(event_add(&wake_one, &tv_signal), ==, 0); tt_int_op(event_add(&wake_all, &tv_broadcast), ==, 0); /* And run for a bit... */ event_base_dispatch(base); /* And wait till the threads are done. */ for (i = 0; i < NUM_THREADS; ++i) THREAD_JOIN(threads[i]); /* Now, let's see what happened. At least one of 5 or 6 should * have timed out. */ n_timed_out = alerted[5].timed_out + alerted[6].timed_out; tt_int_op(n_timed_out, >=, 1); tt_int_op(n_timed_out, <=, 2); for (i = 0; i < NUM_THREADS; ++i) { const struct timeval *target_delay; struct timeval target_time, actual_delay; if (alerted[i].timed_out) { TT_BLATHER(("%d looks like a timeout\n", i)); target_delay = &tv_timeout; tt_assert(i == 5 || i == 6); } else if (evutil_timerisset(&alerted[i].alerted_at)) { long diff1,diff2; evutil_timersub(&alerted[i].alerted_at, &launched_at, &actual_delay); diff1 = timeval_msec_diff(&actual_delay, &tv_signal); diff2 = timeval_msec_diff(&actual_delay, &tv_broadcast); if (labs(diff1) < labs(diff2)) { TT_BLATHER(("%d looks like a signal\n", i)); target_delay = &tv_signal; ++n_signal; } else { TT_BLATHER(("%d looks like a broadcast\n", i)); target_delay = &tv_broadcast; ++n_broadcast; } } else { TT_FAIL(("Thread %d never got woken", i)); continue; } evutil_timeradd(target_delay, &launched_at, &target_time); test_timeval_diff_leq(&target_time, &alerted[i].alerted_at, 0, 200); } tt_int_op(n_broadcast + n_signal + n_timed_out, ==, NUM_THREADS); tt_int_op(n_signal, ==, 1); end: EVTHREAD_FREE_LOCK(cond.lock, EVTHREAD_LOCKTYPE_RECURSIVE); EVTHREAD_FREE_COND(cond.cond); } #define CB_COUNT 128 #define QUEUE_THREAD_COUNT 8 static void SLEEP_MS(int ms) { struct timeval tv; tv.tv_sec = ms/1000; tv.tv_usec = (ms%1000)*1000; evutil_usleep_(&tv); } struct deferred_test_data { struct event_callback cbs[CB_COUNT]; struct event_base *queue; }; static struct timeval timer_start = {0,0}; static struct timeval timer_end = {0,0}; static unsigned callback_count = 0; static THREAD_T load_threads[QUEUE_THREAD_COUNT]; static struct deferred_test_data deferred_data[QUEUE_THREAD_COUNT]; static void deferred_callback(struct event_callback *cb, void *arg) { SLEEP_MS(1); callback_count += 1; } static THREAD_FN load_deferred_queue(void *arg) { struct deferred_test_data *data = arg; size_t i; for (i = 0; i < CB_COUNT; ++i) { event_deferred_cb_init_(&data->cbs[i], 0, deferred_callback, NULL); event_deferred_cb_schedule_(data->queue, &data->cbs[i]); SLEEP_MS(1); } THREAD_RETURN(); } static void timer_callback(evutil_socket_t fd, short what, void *arg) { evutil_gettimeofday(&timer_end, NULL); } static void start_threads_callback(evutil_socket_t fd, short what, void *arg) { int i; for (i = 0; i < QUEUE_THREAD_COUNT; ++i) { THREAD_START(load_threads[i], load_deferred_queue, &deferred_data[i]); } } static void thread_deferred_cb_skew(void *arg) { struct timeval tv_timer = {1, 0}; struct event_base *base = NULL; struct event_config *cfg = NULL; struct timeval elapsed; int elapsed_usec; int i; cfg = event_config_new(); tt_assert(cfg); event_config_set_max_dispatch_interval(cfg, NULL, 16, 0); base = event_base_new_with_config(cfg); tt_assert(base); for (i = 0; i < QUEUE_THREAD_COUNT; ++i) deferred_data[i].queue = base; evutil_gettimeofday(&timer_start, NULL); event_base_once(base, -1, EV_TIMEOUT, timer_callback, NULL, &tv_timer); event_base_once(base, -1, EV_TIMEOUT, start_threads_callback, NULL, NULL); event_base_dispatch(base); evutil_timersub(&timer_end, &timer_start, &elapsed); TT_BLATHER(("callback count, %u", callback_count)); elapsed_usec = (unsigned)(elapsed.tv_sec*1000000 + elapsed.tv_usec); TT_BLATHER(("elapsed time, %u usec", elapsed_usec)); /* XXX be more intelligent here. just make sure skew is * within .4 seconds for now. */ tt_assert(elapsed_usec >= 600000 && elapsed_usec <= 1400000); end: for (i = 0; i < QUEUE_THREAD_COUNT; ++i) THREAD_JOIN(load_threads[i]); if (base) event_base_free(base); if (cfg) event_config_free(cfg); } static struct event time_events[5]; static struct timeval times[5]; static struct event_base *exit_base = NULL; static void note_time_cb(evutil_socket_t fd, short what, void *arg) { evutil_gettimeofday(arg, NULL); if (arg == &times[4]) { event_base_loopbreak(exit_base); } } static THREAD_FN register_events_subthread(void *arg) { struct timeval tv = {0,0}; SLEEP_MS(100); event_active(&time_events[0], EV_TIMEOUT, 1); SLEEP_MS(100); event_active(&time_events[1], EV_TIMEOUT, 1); SLEEP_MS(100); tv.tv_usec = 100*1000; event_add(&time_events[2], &tv); tv.tv_usec = 150*1000; event_add(&time_events[3], &tv); SLEEP_MS(200); event_active(&time_events[4], EV_TIMEOUT, 1); THREAD_RETURN(); } static void thread_no_events(void *arg) { THREAD_T thread; struct basic_test_data *data = arg; struct timeval starttime, endtime; int i; exit_base = data->base; memset(times,0,sizeof(times)); for (i=0;i<5;++i) { event_assign(&time_events[i], data->base, -1, 0, note_time_cb, &times[i]); } evutil_gettimeofday(&starttime, NULL); THREAD_START(thread, register_events_subthread, data->base); event_base_loop(data->base, EVLOOP_NO_EXIT_ON_EMPTY); evutil_gettimeofday(&endtime, NULL); tt_assert(event_base_got_break(data->base)); THREAD_JOIN(thread); for (i=0; i<5; ++i) { struct timeval diff; double sec; evutil_timersub(&times[i], &starttime, &diff); sec = diff.tv_sec + diff.tv_usec/1.0e6; TT_BLATHER(("event %d at %.4f seconds", i, sec)); } test_timeval_diff_eq(&starttime, &times[0], 100); test_timeval_diff_eq(&starttime, &times[1], 200); test_timeval_diff_eq(&starttime, &times[2], 400); test_timeval_diff_eq(&starttime, &times[3], 450); test_timeval_diff_eq(&starttime, &times[4], 500); test_timeval_diff_eq(&starttime, &endtime, 500); end: ; } #define TEST(name) \ { #name, thread_##name, TT_FORK|TT_NEED_THREADS|TT_NEED_BASE, \ &basic_setup, NULL } struct testcase_t thread_testcases[] = { { "basic", thread_basic, TT_FORK|TT_NEED_THREADS|TT_NEED_BASE, &basic_setup, NULL }, #ifndef _WIN32 { "forking", thread_basic, TT_FORK|TT_NEED_THREADS|TT_NEED_BASE, &basic_setup, (char*)"forking" }, #endif TEST(conditions_simple), { "deferred_cb_skew", thread_deferred_cb_skew, TT_FORK|TT_NEED_THREADS|TT_OFF_BY_DEFAULT, &basic_setup, NULL }, #ifndef _WIN32 /****** XXX TODO FIXME windows seems to be having some timing trouble, * looking into it now. / ellzey ******/ TEST(no_events), #endif END_OF_TESTCASES };
sigecoin/sigecoin
libevent/test/regress_thread.c
C
gpl-3.0
14,998
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2289, 1011, 2262, 9152, 9050, 4013, 19862, 1998, 4172, 23287, 2239, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302, 1008, 14080, 1010, 2024, 7936, 3024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/********************************************************************** Audacity: A Digital Audio Editor ExpandingToolBar.cpp Dominic Mazzoni *******************************************************************//** \class ExpandingToolBar \brief A smart ToolBar class that has a "MainPanel" which is always displayed, and an "ExtraPanel" that can be hidden to save space. Can be docked into a ToolBarArea or floated in an ToolBarFrame; If auto-expanding is off, behavior is very simple: clicking the toggle button expands, clicking it again collapses. If auto-expanding is on, behavior is a little more complicated. When the mouse movers over a toolbar and it is collapsed, it gets auto-expanded, and it gets auto-collapsed as soon as the mouse leaves. However, if they manually toggle it collapsed while it was auto-expanded, it will stay collapsed until you move the mouse completely away and then back again later. If you manually expand it, it will stay manually expanded until you manually collapse it. *//****************************************************************//** \class ExpandingToolBarEvtHandler \brief A custom event handler for ExpandingToolBar. *//****************************************************************//** \class ToolBarGrabber \brief Draws the grabber for an ExpandingToolBar. *//****************************************************************//** \class ToolBarDialog \brief A dialog based container for ExpandingToolBars providing modal based operations. *//****************************************************************//** \class ToolBarFrame \brief A miniframe based container for ExpandingToolBars providing modeless presentation. *//****************************************************************//** \class ToolBarArea \brief An alterantive to ToolBarFrame which can contain an ExpandingToolBar. ToolBarArea is used for a 'docked' ToolBar, ToolBarFrame for a floating one. *//****************************************************************//** \class ToolBarArrangement \brief Small class that holds some layout information for an ExpandingToolBar. *//*******************************************************************/ #include "../Theme.h" // For compilers that support precompilation, includes "wx/wx.h". #include <wx/wxprec.h> #ifndef WX_PRECOMP #include <wx/window.h> #endif #include <wx/wx.h> #include <wx/dcmemory.h> #include <wx/log.h> #include <wx/dragimag.h> #include <wx/arrimpl.cpp> #include <wx/dialog.h> #include "ExpandingToolBar.h" #include "AButton.h" #include "../AllThemeResources.h" #include "../Experimental.h" const int kToggleButtonHeight = 8; const int kTimerInterval = 50; // every 50 ms -> ~20 updates per second const wxRect kDummyRect = wxRect(-9999, -9999, 0, 0); enum { kToggleButtonID = 5000, kTimerID }; WX_DEFINE_OBJARRAY(wxArrayRect); class ToolBarArrangement { public: ExpandingToolBarArray childArray; wxArrayRect rectArray; wxArrayInt rowArray; }; // // ExpandingToolBar // BEGIN_EVENT_TABLE(ExpandingToolBar, wxPanel) EVT_SIZE(ExpandingToolBar::OnSize) EVT_TIMER(kTimerID, ExpandingToolBar::OnTimer) EVT_BUTTON(kToggleButtonID, ExpandingToolBar::OnToggle) END_EVENT_TABLE() IMPLEMENT_CLASS(ExpandingToolBar, wxPanel) //static int ExpandingToolBar::msNoAutoExpandStack = 0; ExpandingToolBar::ExpandingToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size): wxPanel(parent, id, pos, size), mIsAutoExpanded(false), mIsManualExpanded(false), mIsExpanded(false), mAutoExpand(true), mFirstTime(true), mFrameParent(NULL), mDialogParent(NULL), mAreaParent(NULL), mSavedArrangement(NULL), mDragImage(NULL), mTopLevelParent(NULL) { mMainPanel = new wxPanel(this, -1, wxDefaultPosition, wxSize(1, 1)); mExtraPanel = new wxPanel(this, -1, wxDefaultPosition, wxSize(1, 1)); mGrabber = NULL; ToolBarArea *toolBarParent = dynamic_cast<ToolBarArea *>(GetParent()); if (toolBarParent) mGrabber = new ToolBarGrabber(this, -1, this); /// \todo check whether this is a memory leak (and check similar code) wxImage hbar = theTheme.Image(bmpToolBarToggle); wxColour magicColor = wxColour(0, 255, 255); ImageArray fourStates = ImageRoll::SplitV(hbar, magicColor); mToggleButton = new AButton(this, kToggleButtonID, wxDefaultPosition, wxDefaultSize, ImageRoll(ImageRoll::HorizontalRoll, fourStates[0], magicColor), ImageRoll(ImageRoll::HorizontalRoll, fourStates[1], magicColor), ImageRoll(ImageRoll::HorizontalRoll, fourStates[2], magicColor), ImageRoll(ImageRoll::HorizontalRoll, fourStates[3], magicColor), true); mToggleButton->UseDisabledAsDownHiliteImage(true); SetAutoLayout(true); mTimer.SetOwner(this, kTimerID); } ExpandingToolBar::~ExpandingToolBar() { } void ExpandingToolBar::OnSize(wxSizeEvent & WXUNUSED(event)) { if (mFrameParent || mDialogParent || mAreaParent) return; // At the time of construction, it wasn't "safe" to tell // our parent that we've just joined the window, so we check // for it during our first OnSize event. if (!mFrameParent) { ToolBarFrame *toolBarParent = dynamic_cast<ToolBarFrame *>(GetParent()); if (toolBarParent) { // We were placed into a floating window mFrameParent = toolBarParent; toolBarParent->SetChild(this); } } if (!mDialogParent) { ToolBarDialog *toolBarParent = dynamic_cast<ToolBarDialog *>(GetParent()); if (toolBarParent) { // We were placed into a dialog mDialogParent = toolBarParent; toolBarParent->SetChild(this); } } if (!mAreaParent) { ToolBarArea *toolBarParent = dynamic_cast<ToolBarArea *>(GetParent()); if (toolBarParent) { // We were placed into an area full of other toolbars mAreaParent = toolBarParent; toolBarParent->AddChild(this); } } } void ExpandingToolBar::OnToggle(wxCommandEvent & WXUNUSED(event)) { if (mIsExpanded) Collapse(); else Expand(); } void ExpandingToolBar::Expand() { // We set both mIsManualExpanded and mIsAutoExpanded to true; // that way if the user manually collapses the toolbar we set // mIsManualExpanded to false but keep mIsAutoExpanded to true // to prevent it from being auto-expanded again until the user // actually moves the mouse completely away and back again later. mToggleButton->PushDown(); mIsManualExpanded = true; mIsAutoExpanded = true; Fit(); } void ExpandingToolBar::Collapse(bool now /* = false */) { // After being manually collapsed, we set mIsAutoExpanded back to // true, which prevents it from being immediately auto-expanded // again until after the mouse actually moves away and then // back again later. mToggleButton->PopUp(); mIsManualExpanded = false; mIsAutoExpanded = false; Fit(); mIsAutoExpanded = true; if (now) { mCurrentDrawerSize = mTargetDrawerSize; MoveDrawer(wxSize(0, 0)); } } void ExpandingToolBar::TryAutoExpand() { if (mAutoExpand && msNoAutoExpandStack==0 && mIsManualExpanded == false && mIsAutoExpanded == false) { mToggleButton->PushDown(); mIsAutoExpanded = true; Fit(); } } void ExpandingToolBar::TryAutoCollapse() { #ifdef EXPERIMENTAL_ROLL_UP_DIALOG if (mIsAutoExpanded == true && mIsManualExpanded == false) { mToggleButton->PopUp(); mIsAutoExpanded = false; Fit(); } #endif } class ExpandingToolBarEvtHandler : public wxEvtHandler { public: ExpandingToolBarEvtHandler(ExpandingToolBar *toolbar, wxEvtHandler *inheritedEvtHandler) { mToolBar = toolbar; mInheritedEvtHandler = inheritedEvtHandler; } virtual bool ProcessEvent(wxEvent& evt) { if (mToolBar->IsCursorInWindow()) mToolBar->TryAutoExpand(); else mToolBar->TryAutoExpand(); return mInheritedEvtHandler->ProcessEvent(evt); } protected: ExpandingToolBar *mToolBar; wxEvtHandler *mInheritedEvtHandler; DECLARE_NO_COPY_CLASS(ExpandingToolBarEvtHandler); }; void ExpandingToolBar::RecursivelyPushEventHandlers(wxWindow *win) { if (!mWindowHash[win]) { ExpandingToolBarEvtHandler *evtHandler = new ExpandingToolBarEvtHandler(this, win->GetEventHandler()); win->PushEventHandler(evtHandler); mWindowHash[win] = 1; } wxWindowList children = win->GetChildren(); typedef wxWindowList::compatibility_iterator Node; for(Node node = children.GetFirst(); node; node = node->GetNext()) { wxWindow *child = node->GetData(); RecursivelyPushEventHandlers(child); } } bool ExpandingToolBar::Layout() { mMainSize = mMainPanel->GetBestSize(); mExtraSize = mExtraPanel->GetBestSize(); mButtonSize = wxSize(wxMax(mMainSize.x, mExtraSize.x), kToggleButtonHeight); int left = 0; if (mGrabber) { mGrabberSize = mGrabber->GetMinSize(); left += mGrabberSize.x; } else mGrabberSize = wxSize(0, 0); mMainPanel->SetSize(left, 0, mMainSize.x, mMainSize.y); mToggleButton->SetSize(left, mMainSize.y, mButtonSize.x, mButtonSize.y); mExtraPanel->SetSize(left, mMainSize.y + mButtonSize.y, mExtraSize.x, mExtraSize.y); if (mGrabber) mGrabber->SetSize(0, 0, left, mMainSize.y + mButtonSize.y); // Add event handlers to all children //RecursivelyPushEventHandlers(this); return true; } void ExpandingToolBar::Fit() { #ifdef EXPERIMENTAL_ROLL_UP_DIALOG mIsExpanded = (mIsAutoExpanded || mIsManualExpanded); #else mIsExpanded = true;// JKC - Wedge it open at all times. #endif int width = mButtonSize.x + mGrabberSize.x; wxSize baseWindowSize = wxSize(width, mMainSize.y + mButtonSize.y); mTargetDrawerSize = wxSize(mButtonSize.x, 0); if (mIsExpanded) mTargetDrawerSize.y += mExtraSize.y; mCurrentDrawerSize.x = mTargetDrawerSize.x; // The first time, we always update the size. Otherwise, we set // a target size, and the actual size changes during a timer // event. if (mFirstTime) { mFirstTime = false; mCurrentDrawerSize = wxSize(mExtraSize.x, 0); mCurrentTotalSize = baseWindowSize; SetSizeHints(mCurrentTotalSize, mCurrentTotalSize); SetSize(mCurrentTotalSize); } // wxTimers seem to be a little unreliable - sometimes they stop for // no good reason, so this "primes" it every now and then... mTimer.Stop(); mTimer.Start(kTimerInterval); } bool ExpandingToolBar::IsCursorInWindow() { wxPoint globalMouse = ::wxGetMousePosition(); wxPoint localMouse = ScreenToClient(globalMouse); bool result = (localMouse.x >= 0 && localMouse.y >= 0 && localMouse.x < mCurrentTotalSize.x && localMouse.y < mCurrentTotalSize.y); // The grabber doesn't count! if (mGrabber && mGrabber->GetRect().Contains(localMouse)) result = false; return result; } void ExpandingToolBar::ReparentExtraPanel() { // This is how we make sure the extra panel, which slides out // like a drawer, appears on top of everything else in the window... wxPoint pos; pos.x = mGrabberSize.x; pos.y = mMainSize.y + mButtonSize.y; wxWindow *frame = this; while(!frame->IsTopLevel()) { pos += frame->GetPosition(); frame = frame->GetParent(); } mExtraPanel->Reparent(frame); mExtraPanel->SetPosition(pos); } void ExpandingToolBar::MoveDrawer(wxSize prevSize) { mCurrentTotalSize = wxSize(mButtonSize.x, mMainSize.y + mButtonSize.y + mCurrentDrawerSize.y); if (mFrameParent) { // If we're in a tool window SetSizeHints(mCurrentTotalSize, mCurrentTotalSize); SetSize(mCurrentTotalSize); GetParent()->Fit(); } if (mDialogParent) { // If we're in a dialog SetSizeHints(mCurrentTotalSize, mCurrentTotalSize); SetSize(mCurrentTotalSize); GetParent()->Fit(); } if (mAreaParent) { // If we're in a tool area if (mCurrentDrawerSize.y > 0 && prevSize.y == 0) { ReparentExtraPanel(); mExtraPanel->Show(); } mExtraPanel->SetSizeHints(mCurrentDrawerSize, mCurrentDrawerSize); mExtraPanel->SetSize(mCurrentDrawerSize); if (mCurrentDrawerSize.y == 0) mExtraPanel->Hide(); } } void ExpandingToolBar::OnTimer(wxTimerEvent & WXUNUSED(event)) { if (mAutoExpand && msNoAutoExpandStack==0 && IsCursorInWindow()) TryAutoExpand(); else if (!IsCursorInWindow()) TryAutoCollapse(); if (mCurrentDrawerSize == mTargetDrawerSize) return; // This accelerates the current size towards the target size; // it's a neat way for the window to roll open, but in such a // way that it wxSize prevSize = mCurrentDrawerSize; mCurrentDrawerSize = (mCurrentDrawerSize*2 + mTargetDrawerSize) / 3; if (abs((mCurrentDrawerSize-mTargetDrawerSize).x)<2 && abs((mCurrentDrawerSize-mTargetDrawerSize).y)<2) mCurrentDrawerSize = mTargetDrawerSize; MoveDrawer(prevSize); } wxBitmap ExpandingToolBar::GetToolbarBitmap() { wxSize size = GetClientSize(); wxBitmap bitmap(size.x, size.y); wxClientDC winDC(this); wxMemoryDC memDC; memDC.SelectObject(bitmap); memDC.Blit(0, 0, size.x, size.y, &winDC, 0, 0); return bitmap; } void ExpandingToolBar::StartMoving() { if (!mAreaParent) return; int j; mAreaParent->CollapseAll(true); mTimer.Stop(); // This gives time for wx to finish redrawing the window that way. // HACK: why do we need to do it so many times??? for(j=0; j<500; j++) ::wxSafeYield(); wxBitmap toolbarBitmap = GetToolbarBitmap(); msNoAutoExpandStack++; mSavedArrangement = mAreaParent->SaveArrangement(); mAreaParent->RemoveChild(this); mAreaParent->Refresh(true); mTopLevelParent = this; while(!mTopLevelParent->IsTopLevel()) mTopLevelParent = mTopLevelParent->GetParent(); wxPoint hotSpot = ScreenToClient(wxGetMousePosition()); hotSpot -= (ClientToScreen(wxPoint(0, 0)) - mAreaParent->ClientToScreen(wxPoint(0, 0))); mDropTargets = mAreaParent->GetDropTargets(); mDropTarget = kDummyRect; wxColour magicColor = wxColour(0, 255, 255); wxImage tgtImage = theTheme.Image(bmpToolBarTarget); ImageRoll tgtImageRoll = ImageRoll(ImageRoll::VerticalRoll, tgtImage, magicColor); mTargetPanel = new ImageRollPanel(mAreaParent, -1, tgtImageRoll, wxDefaultPosition, wxDefaultSize, wxTRANSPARENT_WINDOW); mTargetPanel->SetLogicalFunction(wxXOR); mTargetPanel->SetSize(mDropTarget); // This gives time for wx to finish redrawing the window that way. // HACK: why do we need to do it several times??? for(j=0; j<500; j++) ::wxSafeYield(); mAreaParent->SetCapturedChild(this); mDragImage = new wxDragImage(toolbarBitmap); mDragImage->BeginDrag(hotSpot, mAreaParent, mTopLevelParent); mDragImage->Show(); mDragImage->Move(ScreenToClient(wxGetMousePosition())); } void ExpandingToolBar::UpdateMoving() { if (!mAreaParent || !mSavedArrangement || !mDragImage) return; wxPoint cursorPos = mAreaParent->ScreenToClient(wxGetMousePosition()); wxRect prevTarget = mDropTarget; int best_dist_sq = 99999; int i; for(i=0; i<(int)mDropTargets.GetCount(); i++) { int x = (mDropTargets[i].x + (mDropTargets[i].width/2))-cursorPos.x; int y = (mDropTargets[i].y + (mDropTargets[i].height/2))-cursorPos.y; int dist_sq = (x*x) + (y*y); if (dist_sq < best_dist_sq) { best_dist_sq = dist_sq; mDropTarget = mDropTargets[i]; } } if (!mAreaParent->GetRect().Contains(cursorPos)) mDropTarget = kDummyRect; if (mDropTarget != prevTarget) { mDragImage->Hide(); wxRect r = mDropTarget; r.Inflate(4, 4); mTargetPanel->SetSize(r); #if 0 wxClientDC dc(mAreaParent); dc.DestroyClippingRegion(); dc.SetLogicalFunction(wxINVERT); wxRect r = prevTarget; r.Inflate(4, 4); dc.DrawRectangle(r); r = mDropTarget; r.Inflate(4, 4); dc.DrawRectangle(r); #endif // This gives time for wx to finish redrawing the window that way. // HACK: why do we need to do it so many times??? for(i=0; i<500; i++) ::wxSafeYield(); mDragImage->Show(); mDragImage->Move(ScreenToClient(wxGetMousePosition())); } else mDragImage->Move(ScreenToClient(wxGetMousePosition())); } void ExpandingToolBar::FinishMoving() { if (!mAreaParent || !mSavedArrangement) return; delete mTargetPanel; mAreaParent->SetCapturedChild(NULL); mDragImage->Hide(); mDragImage->EndDrag(); msNoAutoExpandStack--; if (mDropTarget == kDummyRect) { mAreaParent->RestoreArrangement(mSavedArrangement); mSavedArrangement = NULL; } else { delete mSavedArrangement; mSavedArrangement = NULL; mAreaParent->MoveChild(this, mDropTarget); } // Keep all drawers closed until the user moves specifically to a // different window mAreaParent->CollapseAll(); mTopLevelParent->Refresh(true); mTimer.Start(kTimerInterval); } // // ToolBarGrabber // BEGIN_EVENT_TABLE(ToolBarGrabber, wxPanel) EVT_PAINT(ToolBarGrabber::OnPaint) EVT_SIZE(ToolBarGrabber::OnSize) EVT_MOUSE_EVENTS(ToolBarGrabber::OnMouse) END_EVENT_TABLE() IMPLEMENT_CLASS(ToolBarGrabber, wxPanel) ToolBarGrabber::ToolBarGrabber(wxWindow *parent, wxWindowID id, ExpandingToolBar *ownerToolbar, const wxPoint& pos, const wxSize& size): wxPanel(parent, id, pos, size), mOwnerToolBar(ownerToolbar) { wxImage grabberImages = theTheme.Image(bmpToolBarGrabber); wxColour magicColor = wxColour(0, 255, 255); ImageArray images = ImageRoll::SplitH(grabberImages, magicColor); mImageRoll[0] = ImageRoll(ImageRoll::VerticalRoll, images[0], magicColor); mImageRoll[1] = ImageRoll(ImageRoll::VerticalRoll, images[1], magicColor); SetSizeHints(mImageRoll[0].GetMinSize(), mImageRoll[1].GetMaxSize()); mState = 0; } void ToolBarGrabber::OnMouse(wxMouseEvent &event) { int prevState = mState; // Handle hilighting the image if the mouse is over it if (event.Entering()) mState = 1; else if (event.Leaving()) mState = 0; else { wxSize clientSize = GetClientSize(); if (event.m_x >= 0 && event.m_y >= 0 && event.m_x < clientSize.x && event.m_y < clientSize.y) mState = 1; else mState = 0; } if (event.ButtonDown()) mOwnerToolBar->StartMoving(); if (mState != prevState) Refresh(false); } void ToolBarGrabber::OnPaint(wxPaintEvent & WXUNUSED(event)) { wxPaintDC dc(this); mImageRoll[mState].Draw(dc, GetClientRect()); } void ToolBarGrabber::OnSize(wxSizeEvent & WXUNUSED(event)) { Refresh(false); } // // ToolBarDialog // BEGIN_EVENT_TABLE(ToolBarDialog, wxDialog) END_EVENT_TABLE() IMPLEMENT_CLASS(ToolBarDialog, wxDialog) ToolBarDialog::ToolBarDialog(wxWindow* parent, wxWindowID id, const wxString& name, const wxPoint& pos): wxDialog(parent, id, name, pos, wxSize(1, 1), // Workaround for bug in __WXMSW__. No close box on a wxDialog unless wxSYSTEM_MENU is used. #ifdef __WXMSW__ wxSYSTEM_MENU | #endif wxCAPTION|wxCLOSE_BOX), mChild(NULL) { } ToolBarDialog::~ToolBarDialog() { } void ToolBarDialog::SetChild(ExpandingToolBar *child) { mChild = child; if (mChild && mChild->GetParent() != this) mChild->Reparent(this); Fit(); } void ToolBarDialog::Fit() { if (mChild) { wxSize childSize = mChild->GetBestSize(); // Take into account the difference between the content // size and the frame size wxSize curContentSize = GetClientSize(); wxSize curFrameSize = GetSize(); wxSize newFrameSize = childSize + (curFrameSize - curContentSize); SetSizeHints(newFrameSize, newFrameSize); SetSize(newFrameSize); } } // // ToolBarFrame // BEGIN_EVENT_TABLE(ToolBarFrame, wxMiniFrame) END_EVENT_TABLE() IMPLEMENT_CLASS(ToolBarFrame, wxMiniFrame) ToolBarFrame::ToolBarFrame(wxWindow* parent, wxWindowID id, const wxString& name, const wxPoint& pos): wxMiniFrame(parent, id, name, pos, wxSize(1, 1), // Workaround for bug in __WXMSW__. No close box on a miniframe unless wxSYSTEM_MENU is used. #ifdef __WXMSW__ wxSYSTEM_MENU | #endif wxCAPTION|wxCLOSE_BOX), mChild(NULL) { } ToolBarFrame::~ToolBarFrame() { } void ToolBarFrame::SetChild(ExpandingToolBar *child) { mChild = child; if (mChild && mChild->GetParent() != this) mChild->Reparent(this); Fit(); } void ToolBarFrame::Fit() { if (mChild) { wxSize childSize = mChild->GetBestSize(); // Take into account the difference between the content // size and the frame size wxSize curContentSize = GetClientSize(); wxSize curFrameSize = GetSize(); wxSize newFrameSize = childSize + (curFrameSize - curContentSize); SetSizeHints(newFrameSize, newFrameSize); SetSize(newFrameSize); } } // // ToolBarArea // BEGIN_EVENT_TABLE(ToolBarArea, wxPanel) EVT_SIZE(ToolBarArea::OnSize) EVT_MOUSE_EVENTS(ToolBarArea::OnMouse) END_EVENT_TABLE() IMPLEMENT_CLASS(ToolBarArea, wxPanel) ToolBarArea::ToolBarArea(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size): wxPanel(parent, id, pos, size), mInOnSize(false), mCapturedChild(NULL) { } ToolBarArea::~ToolBarArea() { } void ToolBarArea::ContractRow(int rowIndex) { // Contract all of the toolbars in a given row to their // minimum size. This is an intermediate step in layout. int i; int x = 0; for(i=0; i<(int)mChildArray.GetCount(); i++) if (mRowArray[i] == rowIndex) { wxPoint childPos = mChildArray[i]->GetPosition(); wxSize childMin = mChildArray[i]->GetMinSize(); mChildArray[i]->SetSize(x, childPos.y, childMin.x, childMin.y); x += childMin.x; } } bool ToolBarArea::ExpandRow(int rowIndex) { // Expand all of the toolbars in a given row so that the // whole width is filled, if possible. This is the last // step after laying out as many toolbars as possible in // that row. Returns false if it's not possible to fit // all of these toolbars in one row anymore. wxSize area = GetClientSize(); int i, j, x; int minWidth = 0; int leftoverSpace = 0; int expandableCount = 0; int toolbarCount = 0; for(i=0; i<(int)mChildArray.GetCount(); i++) if (mRowArray[i] == rowIndex) { ExpandingToolBar *child = mChildArray[i]; wxSize childMin = child->GetMinSize(); wxSize childMax = child->GetMaxSize(); minWidth += childMin.x; toolbarCount++; if (childMax.x > childMin.x) expandableCount++; } leftoverSpace = area.x - minWidth; if (leftoverSpace <= 0) { if (toolbarCount > 1) return false; // not possible to fit all in one row else return true; // there's only one, so it doesn't matter } j = 0; x = 0; for(i=0; i<(int)mChildArray.GetCount(); i++) if (mRowArray[i] == rowIndex) { ExpandingToolBar *child = mChildArray[i]; wxPoint childPos = child->GetPosition(); wxSize childMin = child->GetMinSize(); wxSize childMax = child->GetMaxSize(); int width = childMin.x; if (childMax.x > childMin.x) width += (leftoverSpace * (j+1) / expandableCount) - (leftoverSpace * (j) / expandableCount); mChildArray[i]->SetSize(x, childPos.y, width, childMin.y); x += width; j++; } return true; // success } void ToolBarArea::LayoutOne(int childIndex) { wxSize area = GetClientSize(); ExpandingToolBar *child = mChildArray[childIndex]; wxSize childMin = child->GetMinSize(); if (childIndex == 0) { mRowArray[childIndex] = 0; mChildArray[childIndex]->SetSize(0, 0, childMin.x, childMin.y); ExpandRow(0); #if 0 wxPoint p = mChildArray[childIndex]->GetPosition(); wxSize s = mChildArray[childIndex]->GetSize(); printf("ToolBar %d moved to row %d at (%d, %d), size (%d x %d)\n", childIndex, mRowArray[childIndex], p.x, p.y, s.x, s.y); #endif mLastLayoutSize = area; return; } int prevRow = mRowArray[childIndex-1]; ContractRow(prevRow); wxPoint prevPos = mChildArray[childIndex-1]->GetPosition(); wxSize prevSize = mChildArray[childIndex-1]->GetSize(); int prevX = prevPos.x + prevSize.x; int availableWidth = area.x - prevX; if (childMin.x <= availableWidth) { // It fits into the same row mRowArray[childIndex] = prevRow; mChildArray[childIndex]->SetSize(prevX, prevPos.y, childMin.x, childMin.y); ExpandRow(prevRow); } else { // Go to the next row ExpandRow(prevRow); mRowArray[childIndex] = prevRow + 1; int i; int maxRowHeight = 0; for(i=0; i<childIndex; i++) if (mRowArray[i] == prevRow && mChildArray[i]->GetSize().y > maxRowHeight) maxRowHeight = mChildArray[i]->GetSize().y; mChildArray[childIndex]->SetSize(0, prevPos.y + maxRowHeight, childMin.x, childMin.y); ExpandRow(prevRow+1); } // Save the size of the window the last time we moved one of the // toolbars around. If the user does a minor resize, we try to // preserve the layout. If the user does a major resize, we're // allowed to redo the layout. mLastLayoutSize = area; #if 0 wxPoint p = mChildArray[childIndex]->GetPosition(); wxSize s = mChildArray[childIndex]->GetSize(); printf("ToolBar %d moved to row %d at (%d, %d), size (%d x %d)\n", childIndex, mRowArray[childIndex], p.x, p.y, s.x, s.y); #endif } bool ToolBarArea::Layout() { // Redo the layout from scratch, preserving only the order of // the children int i; for(i=0; i<(int)mChildArray.GetCount(); i++) mRowArray[i] = -1; for(i=0; i<(int)mChildArray.GetCount(); i++) LayoutOne(i); Refresh(true); return true; } void ToolBarArea::AdjustLayout() { // Try to modify the layout as little as possible - but if that's // impossible, redo the layout as necessary. int row = -1; int i, j; for(i=0; i<(int)mChildArray.GetCount(); i++) { if (mRowArray[i] > row) { row = mRowArray[i]; bool success = ExpandRow(row); if (!success) { // Re-layout all toolbars from this row on for(j=i; j<(int)mChildArray.GetCount(); j++) LayoutOne(j); return; } } } } void ToolBarArea::Fit() { Fit(true, true); } void ToolBarArea::Fit(bool horizontal, bool vertical) { wxSize clientSize = GetClientSize(); wxSize minSize; wxSize maxSize; wxSize actualSize; int i; minSize.x = 0; minSize.y = 0; maxSize.x = 9999; maxSize.y = 0; for(i=0; i<(int)mChildArray.GetCount(); i++) { wxPoint childPos = mChildArray[i]->GetPosition(); wxSize childSize = mChildArray[i]->GetSize(); if (childPos.x + childSize.x > actualSize.x) { actualSize.x = childPos.x + childSize.x; } if (childSize.x > minSize.x) { minSize.x = childSize.x; } if (childPos.y + childSize.y > maxSize.y) { maxSize.y = childPos.y + childSize.y; minSize.y = maxSize.y; actualSize.y = maxSize.y; } } if (!horizontal && actualSize.x < clientSize.x) actualSize.x = clientSize.x; if (!vertical && actualSize.y < clientSize.y) actualSize.y = clientSize.y; if (minSize != mMinSize || maxSize != mMaxSize) { mMinSize = minSize; mMaxSize = maxSize; SetSizeHints(mMinSize, mMaxSize); } if (actualSize != mActualSize) { mActualSize = actualSize; SetSize(mActualSize); } } void ToolBarArea::OnSize(wxSizeEvent & WXUNUSED(event)) { if (mInOnSize) return; mInOnSize = true; wxSize currentSize = GetClientSize(); if (abs(currentSize.x - mLastLayoutSize.x >= 100)) { // If they resize by more than 100 pixels (horizontally), // we totally redo the layout, preserving the order of the // toolbars but not the exact position. Layout(); } else { // If it was a minor resize, we try to preserve the positions of // the toolbars. If this is impossible, we still redo the layout, // of course. AdjustLayout(); } Fit(false, true); mInOnSize = false; } void ToolBarArea::OnMouse(wxMouseEvent &evt) { if (mCapturedChild) { if (evt.ButtonUp()) mCapturedChild->FinishMoving(); else if (evt.Moving() || evt.Dragging()) mCapturedChild->UpdateMoving(); } else { evt.Skip(); } } void ToolBarArea::CollapseAll(bool now) { int i; for(i=0; i<(int)mChildArray.GetCount(); i++) mChildArray[i]->Collapse(now); } void ToolBarArea::AddChild(ExpandingToolBar *child) { mChildArray.Add(child); mRowArray.Add(-1); // unknown row LayoutOne(mChildArray.GetCount()-1); Fit(false, true); } void ToolBarArea::RemoveChild(ExpandingToolBar *child) { int i, j; for(i=0; i<(int)mChildArray.GetCount(); i++) { if (mChildArray[i] == child) { child->Hide(); mChildArray.RemoveAt(i); mRowArray.RemoveAt(i); for(j=i; j<(int)mChildArray.GetCount(); j++) mRowArray[j] = -1; for(j=i; j<(int)mChildArray.GetCount(); j++) LayoutOne(j); Fit(false, true); } } } ToolBarArrangement *ToolBarArea::SaveArrangement() { ToolBarArrangement *arrangement = new ToolBarArrangement(); int i; arrangement->childArray = mChildArray; arrangement->rowArray = mRowArray; for(i=0; i<(int)mChildArray.GetCount(); i++) arrangement->rectArray.Add(mChildArray[i]->GetRect()); return arrangement; } void ToolBarArea::RestoreArrangement(ToolBarArrangement *arrangement) { int i; mChildArray = arrangement->childArray; mRowArray = arrangement->rowArray; for(i=0; i<(int)mChildArray.GetCount(); i++) { mChildArray[i]->SetSize(arrangement->rectArray[i]); mChildArray[i]->Show(); } Fit(false, true); delete arrangement; } wxArrayRect ToolBarArea::GetDropTargets() { mDropTargets.Clear(); mDropTargetIndices.Clear(); mDropTargetRows.Clear(); int numChildren = (int)mChildArray.GetCount(); int i; int row = -1; if (numChildren == 0) return mDropTargets; for(i=0; i<numChildren; i++) { int childRow = mRowArray[i]; wxRect childRect = mChildArray[i]->GetRect(); if (childRow != row) { // Add a target before this child (at beginning of row only) row = childRow; mDropTargetIndices.Add(i); mDropTargetRows.Add(row); mDropTargets.Add(wxRect(childRect.x, childRect.y, 0, childRect.height)); } // Add a target after this child (always) mDropTargetIndices.Add(i+1); mDropTargetRows.Add(row); mDropTargets.Add(wxRect(childRect.x+childRect.width, childRect.y, 0, childRect.height)); } return mDropTargets; } void ToolBarArea::MoveChild(ExpandingToolBar *toolBar, wxRect dropTarget) { int i, j; for(i=0; i<(int)mDropTargets.GetCount(); i++) { if (dropTarget == mDropTargets[i]) { int newIndex = mDropTargetIndices[i]; int newRow = mDropTargetRows[i]; mChildArray.Insert(toolBar, newIndex); mRowArray.Insert(newRow, newIndex); for(j=newIndex+1; j<(int)mChildArray.GetCount(); j++) mRowArray[j] = -1; ContractRow(newRow); mChildArray[newIndex]->Show(); for(j=newIndex; j<(int)mChildArray.GetCount(); j++) LayoutOne(j); Fit(false, true); return; } } } void ToolBarArea::SetCapturedChild(ExpandingToolBar *child) { mCapturedChild = child; }
oneminot/audacity
src/widgets/ExpandingToolBar.cpp
C++
gpl-2.0
33,841
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...