code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
<?php /* Rafael Torres 11/19/2014 This php file will modify the raw stock data files and append the stock ticker inforation to allow easy entry into the database as a .csv file. Files should be located in the files folder after having executed stockpull.php. */ $dir = "../historical_upload/files/"; $files = scandir($dir); foreach($files as $name){ $handle = file_get_contents("./files/$name"); $handle = str_replace("Date,Open,High,Low,Close,Volume,Adj Close\n" , "" , $handle); $handle = str_replace("\n" , ",$name\n" , $handle); $handle = str_replace(".csv" , "," , $handle); file_put_contents("../historical_upload/historical/$name.csv", $handle); } ?>
ArunawayNERD/SimulatedStockTradingSystem
historical_upload/histpars.php
PHP
gpl-3.0
693
/* Pokémon neo ------------------------------ file : font.h author : Philip Wellnitz description : Consult corresponding source file. Copyright (C) 2012 - 2020 Philip Wellnitz This file is part of Pokémon neo. Pokémon neo 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. Pokémon neo 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 Pokémon neo. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <nds.h> namespace IO { typedef u16 color; namespace REGULAR_FONT { constexpr auto NUM_CHARS = 490; void shiftchar( u16 &val ); extern u8 fontWidths[ NUM_CHARS ]; extern u8 fontData[ NUM_CHARS * 256 ]; } // namespace REGULAR_FONT namespace BOLD_FONT { constexpr auto NUM_CHARS = 490; void shiftchar( u16 &val ); extern u8 fontWidths[ NUM_CHARS ]; extern u8 fontData[ NUM_CHARS * 256 ]; } // namespace BOLD_FONT namespace SMALL_FONT { constexpr auto NUM_CHARS = 150; void shiftchar( u16 &val ); extern u8 fontWidths[ NUM_CHARS ]; extern u8 fontData[ NUM_CHARS * 256 ]; } // namespace SMALL_FONT class font { private: u8 *_data; u8 *_widths; void ( *_shiftchar )( u16 &val ); color _color[ 5 ]; void _charDelay( ) const; public: enum alignment { LEFT, RIGHT, CENTER }; font( u8 *p_fontData, u8 *p_characterWidths, void ( *p_shiftchar )( u16 &val ) ); /* * @brief: Sets the p_num-th color. */ constexpr void setColor( color p_newColor, int p_num ) { _color[ p_num ] = p_newColor; } /* * @brief: Returns the p_num-th color */ constexpr color getColor( int p_num ) const { return _color[ p_num ]; } /* * @brief: Returns the width in px that the given string has when using the font */ u32 stringWidth( const char *p_string, u8 p_charShift = 0 ) const; /* * @brief: Returns the width in px that the given string has when using the * (compressed) font of the printStringC variants */ u32 stringWidthC( const char *p_string ) const; /* * @brief: Returns the width in px that the given string has when using the font * or the length of the longest prefix ending before a p_breakChar that is shorter * than p_maxwidth */ u32 stringMaxWidth( const char *p_string, u16 p_maxWidth, char p_breakChar, u8 p_charShift = 0 ) const; /* * @brief: Returns the width in px that the given string has when using the * (compressed) font of the printStringC variants * or the length of the longest prefix ending before a p_breakChar that is shorter * than p_maxwidth */ u32 stringMaxWidthC( const char *p_string, u16 p_maxWidth, char p_breakChar ) const; // Methods to print single characters /* * @brief: Prints the given character at the given position. * @returns: the width (in px) of the printed char. */ u16 printChar( u16 p_ch, s16 p_x, s16 p_y, bool p_bottom, u8 p_layer = 1, bool p_shift = true ) const; /* * @brief: Prints the given character (as bitmap) in the given buffer. * @returns: the width (in px) of the printed char. */ u16 printCharB( u16 p_ch, u16 *p_palette, u16 *p_buffer, u16 p_bufferWidth, s16 p_x = 0, s16 p_y = 0, bool p_shift = true ) const; /* * @brief: Draws the continue triangle for message boxes. */ void drawContinue( u8 p_x, u8 p_y, bool p_bottom = true, u8 p_layer = 1 ) const; /* * @brief: Un-draws the continue triangle. */ void hideContinue( u8 p_x, u8 p_y, u8 p_color = 250, bool p_bottom = true, u8 p_layer = 1 ) const; // Methods to print compound objects /* * @brief: Prints a counter with the specified value. */ void printCounter( u32 p_value, u8 p_digits, u16 p_x, u16 p_y, u8 p_highlightDigit, u8 p_highlightBG, u8 p_highlightFG, bool p_bottom, u8 p_layer = 1 ); // Methods to print strings /* * @brief: Prints the given string at the given position to the screen. * @returns: number of lines written (i.e. 1 + number of newlines or other breaks) */ u16 printString( const char *p_string, s16 p_x, s16 p_y, bool p_bottom, alignment p_alignment = LEFT, u8 p_yDistance = 15, s8 p_adjustX = 0, u8 p_charShift = 0, bool p_delay = false, u8 p_layer = 1 ) const; /* * @brief: Prints a string with less horizontal space between characters * @returns: number of lines written (i.e. 1 + number of newlines or other breaks) */ u16 printStringC( const char *p_string, s16 p_x, s16 p_y, bool p_bottom, alignment p_alignment = LEFT, u8 p_yDistance = 15, s8 p_adjustX = 0, bool p_delay = false, u8 p_layer = 1 ) const; /* * @brief: Prints the given string with some delay after every character. * @returns: number of lines written (i.e. 1 + number of newlines or other breaks) */ u16 printStringD( const char *p_string, s16 p_x, s16 p_y, bool p_bottom, alignment p_alignment = LEFT, u8 p_yDistance = 15, s8 p_adjustX = 0, u8 p_charShift = 0, u8 p_layer = 1 ) const; /* * @brief: Prints the given string to the given buffer. * @returns: number of lines written (i.e. 1 + number of newlines or other breaks) */ u16 printStringB( const char *p_string, u16 *p_palette, u16 *p_buffer, u16 p_bufferWidth, alignment p_alignment = LEFT, u8 p_yDistance = 15, u8 p_charShift = 0, u8 p_chunkSize = 64, u16 p_bufferHeight = 32 ) const; /* * @brief: Prints a string in the given buffer with less horizontal space between characters * @returns: number of lines written (i.e. 1 + number of newlines or other breaks) */ u16 printStringBC( const char *p_string, u16 *p_palette, u16 *p_buffer, u16 p_bufferWidth, alignment p_alignment = LEFT, u8 p_yDistance = 15, u8 p_chunkSize = 64, u16 p_bufferHeight = 32 ) const; /* * @brief: Prints the given string, where newlines are inserted whenever the * current line exceeds the given p_maxWidth. * @returns: number of lines written (i.e. 1 + number of newlines or other breaks) */ u16 printBreakingString( const char *p_string, s16 p_x, s16 p_y, s16 p_maxWidth, bool p_bottom, alignment p_alignment = LEFT, u8 p_yDistance = 16, char p_breakChar = ' ', s8 p_adjustX = 0, u8 p_charShift = 0, bool p_delay = false, u8 p_layer = 1 ) const; /* * @brief: Prints the given string, where newlines are inserted whenever the * current line exceeds the given p_maxWidth. Uses less horizontal space for each * character. * @returns: number of lines written (i.e. 1 + number of newlines or other breaks) */ u16 printBreakingStringC( const char *p_string, s16 p_x, s16 p_y, s16 p_maxWidth, bool p_bottom, alignment p_alignment = LEFT, u8 p_yDistance = 16, char p_breakChar = ' ', s8 p_adjustX = 0, bool p_delay = false, u8 p_layer = 1 ) const; /* * @brief: Prints a string until p_maxX is reached, writes p_breakChar if the * limit is hit */ void printMaxString( const char *p_string, s16 p_x, s16 p_y, bool p_bottom, s16 p_maxX = 256, u16 p_breakChar = L'.', u8 p_charShift = 0, bool p_delay = false, u8 p_layer = 1 ) const; /* * @brief: Prints a string with less horizontal space between characters; * prints p_breakChar once p_maxX is reached. */ void printMaxStringC( const char *p_string, s16 p_x, s16 p_y, bool p_bottom, s16 p_maxX = 256, u16 p_breakChar = L'.', bool p_delay = false, u8 p_layer = 1 ) const; }; } // namespace IO
PH111P/perm2
P-Emerald_2/arm9/include/font.h
C
gpl-3.0
9,264
/* * GIFs2PNG, a free tool for merge GIF images with his masks and save into PNG * This is a part of the Platformer Game Engine by Wohlstand, a free platform for game making * Copyright (c) 2017 Vitaly Novichkov <admin@wohlnet.ru> * * 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 * 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/>. */ #include <locale> #include <iostream> #include <stdio.h> #include <FileMapper/file_mapper.h> #include <DirManager/dirman.h> #include <Utils/files.h> #include <Utf8Main/utf8main.h> #include <tclap/CmdLine.h> #include "version.h" #ifdef _WIN32 #define FREEIMAGE_LIB 1 #endif #include <FreeImageLite.h> #include "common_features/config_manager.h" static FIBITMAP *loadImage(const std::string &file, bool convertTo32bit = true) { #if defined(__unix__) || defined(__APPLE__) || defined(_WIN32) FileMapper fileMap; if(!fileMap.open_file(file.c_str())) return NULL; FIMEMORY *imgMEM = FreeImage_OpenMemory(reinterpret_cast<unsigned char *>(fileMap.data()), (unsigned int)fileMap.size()); FREE_IMAGE_FORMAT formato = FreeImage_GetFileTypeFromMemory(imgMEM); if(formato == FIF_UNKNOWN) return NULL; FIBITMAP *img = FreeImage_LoadFromMemory(formato, imgMEM, 0); FreeImage_CloseMemory(imgMEM); fileMap.close_file(); if(!img) return NULL; #else FREE_IMAGE_FORMAT formato = FreeImage_GetFileType(file.c_str(), 0); if(formato == FIF_UNKNOWN) return NULL; FIBITMAP *img = FreeImage_Load(formato, file.c_str()); if(!img) return NULL; #endif if(convertTo32bit) { FIBITMAP *temp; temp = FreeImage_ConvertTo32Bits(img); if(!temp) return NULL; FreeImage_Unload(img); img = temp; } return img; } static void mergeBitBltToRGBA(FIBITMAP *image, const std::string &pathToMask) { if(!image) return; if(!Files::fileExists(pathToMask)) return; //Nothing to do FIBITMAP *mask = loadImage(pathToMask); if(!mask) return;//Nothing to do unsigned int img_w = FreeImage_GetWidth(image); unsigned int img_h = FreeImage_GetHeight(image); unsigned int mask_w = FreeImage_GetWidth(mask); unsigned int mask_h = FreeImage_GetHeight(mask); RGBQUAD Fpix; RGBQUAD Bpix; RGBQUAD Npix = {0x0, 0x0, 0x0, 0xFF}; for(unsigned int y = 0; (y < img_h) && (y < mask_h); y++) { for(unsigned int x = 0; (x < img_w) && (x < mask_w); x++) { FreeImage_GetPixelColor(image, x, y, &Fpix); FreeImage_GetPixelColor(mask, x, y, &Bpix); Npix.rgbRed = ((0x7F & Bpix.rgbRed) | Fpix.rgbRed); Npix.rgbGreen = ((0x7F & Bpix.rgbGreen) | Fpix.rgbGreen); Npix.rgbBlue = ((0x7F & Bpix.rgbBlue) | Fpix.rgbBlue); int newAlpha = 255 - ((int(Bpix.rgbRed) + int(Bpix.rgbGreen) + int(Bpix.rgbBlue)) / 3); if((Bpix.rgbRed > 240u) //is almost White && (Bpix.rgbGreen > 240u) && (Bpix.rgbBlue > 240u)) newAlpha = 0; newAlpha = newAlpha + ((int(Fpix.rgbRed) + int(Fpix.rgbGreen) + int(Fpix.rgbBlue)) / 3); if(newAlpha > 255) newAlpha = 255; Npix.rgbReserved = newAlpha; FreeImage_SetPixelColor(image, x, y, &Npix); } } FreeImage_Unload(mask); } struct GIFs2PNG_Setup { std::string pathIn; bool listOfFiles = false; std::string pathOut; bool pathOutSame = false; std::string configPath; bool removeSource = false; bool walkSubDirs = false; bool skipBackground2 = false; unsigned int count_success = 0; unsigned int count_failed = 0; unsigned int count_skipped = 0; }; static inline void delEndSlash(std::string &dirPath) { if(!dirPath.empty()) { char last = dirPath[dirPath.size() - 1]; if((last == '/') || (last == '\\')) dirPath.resize(dirPath.size() - 1); } } static inline void getGifMask(std::string &mask, const std::string &front) { mask = front; //Make mask filename size_t dotPos = mask.find_last_of('.'); if(dotPos == std::string::npos) mask.push_back('m'); else mask.insert(mask.begin() + dotPos, 'm'); } void doGifs2PNG(std::string pathIn, std::string imgFileIn, std::string pathOut, GIFs2PNG_Setup &setup, ConfigPackMiniManager &cnf) { if(Files::hasSuffix(imgFileIn, "m.gif")) return; //Skip mask files std::string imgPathIn = pathIn + "/" + imgFileIn; std::string maskPathIn; std::cout << imgPathIn; std::cout.flush(); if(setup.skipBackground2 && (imgFileIn.compare(0, 11, "background2", 11) == 0)) { setup.count_skipped++; std::cout << "...SKIP!\n"; std::cout.flush(); return; } std::string maskFileIn; getGifMask(maskFileIn, imgFileIn); maskPathIn = cnf.getFile(maskFileIn, pathIn); FIBITMAP *image = loadImage(imgPathIn); if(!image) { setup.count_failed++; std::cout << "...CAN'T OPEN!\n"; std::cout.flush(); return; } bool isFail = false; if(Files::fileExists(maskPathIn)) mergeBitBltToRGBA(image, maskPathIn); if(image) { std::string outPath = pathOut + "/" + Files::changeSuffix(imgFileIn, ".png"); int ret = FreeImage_Save(FIF_PNG, image, outPath.c_str()); if(!ret) { std::cout << "...F-WRT FAILED!\n"; isFail = true; } FreeImage_Unload(image); } if(isFail) { setup.count_failed++; std::cout << "...FAILED!\n"; } else { setup.count_success++; if(setup.removeSource)// Detele old files { if(Files::deleteFile(imgPathIn)) std::cout << ".F-DEL."; if(Files::deleteFile(maskPathIn)) std::cout << ".M-DEL."; } std::cout << "...done\n"; } std::cout.flush(); } int main(int argc, char *argv[]) { if(argc > 0) g_ApplicationPath = Files::dirname(argv[0]); g_ApplicationPath = DirMan(g_ApplicationPath).absolutePath(); DirMan imagesDir; std::vector<std::string> fileList; FreeImage_Initialise(); ConfigPackMiniManager config; GIFs2PNG_Setup setup; try { // Define the command line object. TCLAP::CmdLine cmd(_FILE_DESC "\n" "Copyright (c) 2017 Vitaly Novichkov <admin@wohlnet.ru>\n" "This program is distributed under the GNU GPLv3+ license\n", ' ', _FILE_VERSION _FILE_RELEASE); TCLAP::SwitchArg switchRemove("r", "remove", "Remove source images after a succesful conversion", false); TCLAP::SwitchArg switchSkipBG("b", "ingnore-bg", "Skip all \"background2-*.gif\" sprites (due a bug in the LunaLUA)", false); TCLAP::SwitchArg switchDigRecursive("d", "dig-recursive", "Look for images in subdirectories", false); TCLAP::SwitchArg switchDigRecursiveDEP("w", "dig-recursive-old", "Look for images in subdirectories [deprecated]", false); TCLAP::ValueArg<std::string> outputDirectory("O", "output", "path to a directory where the PNG images will be saved", false, "", "/path/to/output/directory/"); TCLAP::ValueArg<std::string> configDirectory("C", "config", "Allow usage of default masks from specific PGE config pack " "(Useful for cases where the GFX designer didn't make a mask image)", false, "", "/path/to/config/pack"); TCLAP::UnlabeledMultiArg<std::string> inputFileNames("filePath(s)", "Input GIF file(s)", true, "Input file path(s)"); cmd.add(&switchRemove); cmd.add(&switchSkipBG); cmd.add(&switchDigRecursive); cmd.add(&switchDigRecursiveDEP); cmd.add(&outputDirectory); cmd.add(&configDirectory); cmd.add(&inputFileNames); cmd.parse(argc, argv); setup.removeSource = switchRemove.getValue(); setup.skipBackground2 = switchSkipBG.getValue(); setup.walkSubDirs = switchDigRecursive.getValue() | switchDigRecursiveDEP.getValue(); //nopause = switchNoPause.getValue(); setup.pathOut = outputDirectory.getValue(); setup.configPath = configDirectory.getValue(); for(const std::string &fpath : inputFileNames.getValue()) { if(Files::hasSuffix(fpath, "m.gif")) continue; else if(DirMan::exists(fpath)) setup.pathIn = fpath; else { fileList.push_back(fpath); setup.listOfFiles = true; } } if((argc <= 1) || (setup.pathIn.empty() && !setup.listOfFiles)) { fprintf(stderr, "\n" "ERROR: Missing input files!\n" "Type \"%s --help\" to display usage.\n\n", argv[0]); return 2; } } catch(TCLAP::ArgException &e) // catch any exceptions { std::cerr << "Error: " << e.error() << " for arg " << e.argId() << std::endl; return 2; } fprintf(stderr, "============================================================================\n" "Pair of GIFs to PNG converter tool by Wohlstand. Version " _FILE_VERSION _FILE_RELEASE "\n" "============================================================================\n" "This program is distributed under the GNU GPLv3 license \n" "============================================================================\n"); fflush(stderr); if(!setup.listOfFiles) { if(setup.pathIn.empty()) goto WrongInputPath; if(!DirMan::exists(setup.pathIn)) goto WrongInputPath; imagesDir.setPath(setup.pathIn); setup.pathIn = imagesDir.absolutePath(); } if(!setup.pathOut.empty()) { if(!DirMan::exists(setup.pathOut) && !DirMan::mkAbsPath(setup.pathOut)) goto WrongOutputPath; setup.pathOut = DirMan(setup.pathOut).absolutePath(); setup.pathOutSame = false; } else { setup.pathOut = setup.pathIn; setup.pathOutSame = true; } delEndSlash(setup.pathIn); delEndSlash(setup.pathOut); printf("============================================================================\n" "Converting images...\n" "============================================================================\n"); fflush(stdout); if(!setup.listOfFiles) std::cout << ("Input path: " + setup.pathIn + "\n"); std::cout << ("Output path: " + setup.pathOut + "\n"); std::cout << "============================================================================\n"; std::cout.flush(); config.setConfigDir(setup.configPath); if(config.isUsing()) { std::cout << "============================================================================\n"; std::cout << ("Used config pack: " + setup.configPath + "\n"); if(!setup.listOfFiles) { config.appendDir(setup.pathIn); std::cout << ("With episode directory: " + setup.pathIn + "\n"); } std::cout << "============================================================================\n"; std::cout.flush(); } if(setup.listOfFiles)// Process a list of flies { for(std::string &file : fileList) { std::string fname = Files::basename(file); setup.pathIn = DirMan(Files::dirname(file)).absolutePath(); if(setup.pathOutSame) setup.pathOut = DirMan(Files::dirname(file)).absolutePath(); doGifs2PNG(setup.pathIn, fname , setup.pathOut, setup, config); } } else // Process directories with a source files { imagesDir.getListOfFiles(fileList, {".gif"}); if(!setup.walkSubDirs) //By directories { for(std::string &fname : fileList) doGifs2PNG(setup.pathIn, fname, setup.pathOut, setup, config); } else { imagesDir.beginWalking({".gif"}); std::string curPath; while(imagesDir.fetchListFromWalker(curPath, fileList)) { if(Files::hasSuffix(curPath, "/_backup")) continue; //Skip LazyFix's backup directories for(std::string &file : fileList) { if(setup.pathOutSame) setup.pathOut = curPath; doGifs2PNG(curPath, file, setup.pathOut, setup, config); } } } } printf("============================================================================\n" " Conversion has been completed!\n" "============================================================================\n" "Successfully merged: %d\n" "Conversion failed: %d\n" "Skipped files (bg2-*): %d\n" "\n", setup.count_success, setup.count_failed, setup.count_skipped); fflush(stdout); return (setup.count_failed == 0) ? 0 : 1; WrongInputPath: std::cout.flush(); std::cerr.flush(); printf("============================================================================\n" " Wrong input path!\n" "============================================================================\n"); fflush(stdout); return 2; WrongOutputPath: std::cout.flush(); std::cerr.flush(); printf("============================================================================\n" " Wrong output path!\n" "============================================================================\n"); fflush(stdout); return 2; }
jpmac26/PGE-Project
GIFs2PNG/gifs2png.cpp
C++
gpl-3.0
14,999
/* * GNU GENERAL LICENSE * Copyright (C) 2014 - 2021 Lobo Evolution * * 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 * verion 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 License for more details. * * You should have received a copy of the GNU General Public * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Contact info: ivan.difrancesco@yahoo.it */ package org.loboevolution.html.node.js; /** * <p>WindowBase64 interface.</p> * * * */ public interface WindowBase64 { /** * <p>atob.</p> * * @param encodedString a {@link java.lang.String} object. * @return a {@link java.lang.String} object. */ String atob(String encodedString); /** * <p>btoa.</p> * * @param rawString a {@link java.lang.String} object. * @return a {@link java.lang.String} object. */ String btoa(String rawString); }
oswetto/LoboEvolution
LoboW3C/src/main/java/org/loboevolution/html/node/js/WindowBase64.java
Java
gpl-3.0
1,264
package org.mivotocuenta.server.beans; import java.io.Serializable; import java.util.Date; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.NotPersistent; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; @PersistenceCapable(detachable="true") public class Conteo implements Serializable{ /** * */ private static final long serialVersionUID = -4099388828213167352L; @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long idConteo; @Persistent private Long idCandidato; @Persistent private Long idUsuario; @Persistent private Date fechaRegistro; @Persistent private String opinion; @NotPersistent private String operacion; @NotPersistent private Long version; public Long getIdConteo() { return idConteo; } public void setIdConteo(Long idConteo) { this.idConteo = idConteo; } public Long getIdCandidato() { return idCandidato; } public void setIdCandidato(Long idCandidato) { this.idCandidato = idCandidato; } public Long getIdUsuario() { return idUsuario; } public void setIdUsuario(Long idUsuario) { this.idUsuario = idUsuario; } public Date getFechaRegistro() { return fechaRegistro; } public void setFechaRegistro(Date fechaRegistro) { this.fechaRegistro = fechaRegistro; } public String getOpinion() { return opinion; } public void setOpinion(String opinion) { this.opinion = opinion; } public Long getVersion() { return version; } public void setVersion(Long version) { this.version = version; } public String getOperacion() { return operacion; } public void setOperacion(String operacion) { this.operacion = operacion; } }
jofrantoba/mivotocuenta
src/org/mivotocuenta/server/beans/Conteo.java
Java
gpl-3.0
1,758
package cn.exrick.sso.service; import cn.exrick.manager.dto.front.Order; import cn.exrick.manager.dto.front.OrderInfo; import cn.exrick.manager.dto.front.PageOrder; import cn.exrick.manager.pojo.TbThanks; import java.util.List; /** * @author Exrickx */ public interface OrderService { /** * 分页获得用户订单 * @param userId * @param page * @param size * @return */ PageOrder getOrderList(Long userId, int page, int size); /** * 获得单个订单 * @param orderId * @return */ Order getOrder(Long orderId); /** * 取消订单 * @param orderId * @return */ int cancelOrder(Long orderId); /** * 创建订单 * @param orderInfo * @return */ Long createOrder(OrderInfo orderInfo); /** * 删除订单 * @param orderId * @return */ int delOrder(Long orderId); /** * 订单支付 生成捐赠数据 * @param tbThanks * @return */ int payOrder(TbThanks tbThanks); }
Exrick/xmall
xmall-sso/xmall-sso-interface/src/main/java/cn/exrick/sso/service/OrderService.java
Java
gpl-3.0
1,055
var mysql = require('mysql') var state = { pool: null } exports.connect = function(done) { state.pool = mysql.createPool({ host: 'keeporselldbinstance.cuvbt4xyyhf3.us-west-2.rds.amazonaws.com', user: 'keeporsell', password: 'keeporsell', database: 'keeporsell' }) done() } exports.get = function() { return state.pool }
akshatsinha/keeporsell
lib/db.js
JavaScript
gpl-3.0
375
# import libraries import math import random import pygame from pygame.locals import * pygame.init() pygame.mixer.init() width, height = 800, 600 screen = pygame.display.set_mode((width, height)) keys = [False, False, False, False] player = [100, 520] invaders = [] bullets = [] bombs = [] rockets = [] rocketpieces = [] bgimg = pygame.image.load("g:/invaders/paragliding_2017_4_bsl-73.jpg") invaderimg = pygame.transform.scale(pygame.image.load("g:/invaders/Space-Invaders-PNG-Clipart.png"), (64, 64)) playerimg = pygame.transform.scale(pygame.image.load("g:/invaders/space-invaders-1again.png"), (64, 64)) bulletimg = pygame.transform.scale(pygame.image.load("g:/invaders/square-rounded-512.png"), (16, 16)) # 4 - keep looping through running = 1 exitcode = 0 invadersmv = 1 # create invaders for i in range (0, 734, 96): for j in range (0, 300, 64): invaders.append([i, j]) while running: # 5 - clear the screen before drawing it again movedown=False #screen.fill(0) # 6 - draw the screen elements screen.blit(bgimg, (0, 0)) screen.blit(playerimg, player) for invader in invaders: screen.blit(invaderimg, invader) for invader in invaders: if invader[0] >= 736: invadersmv = -1 movedown=True break if invader[0] <= 0: invadersmv = 1 movedown=True break for invader in invaders: invader[0] += invadersmv if movedown: invader[1] += 2 for bullet in bullets: screen.blit(bulletimg, bullet) bullet[1] -= 1 if len(bullets) > 0 and bullets[0][1] <= -16: bullets.pop(0) # collision check destroyedinvaders = [] destroyedbullets = [] for bullet in bullets: for invader in invaders: if bullet[0] < invader[0] + 16 and bullet[0] + 64 > invader[0] and bullet[1] < invader[1] + 16 and invader[1] + 16 > bullet[1]: destroyedbullets.append(bullet) destroyedinvaders.append(invader) #print('collision') bullets = [item for item in bullets if item not in destroyedbullets] invaders = [item for item in invaders if item not in destroyedinvaders] # 9 - Move player ## if keys[0]: ## player[1] -= 5 ## elif keys[2]: ## player[1] += 5 if keys[1] and player[0] >= 0: player[0] -= 5 elif keys[3] and player[0] <= 736: player[0] += 5 # 7 - update the screen pygame.display.flip() # 8 - check events for event in pygame.event.get(): if event.type == KEYDOWN: if event.key == K_w: keys[0] = True elif event.key == K_a: keys[1] = True elif event.key == K_s: keys[2] = True elif event.key == K_d: keys[3] = True if event.type == KEYUP: if event.key == K_w: keys[0] = False elif event.key == K_a: keys[1] = False elif event.key == K_s: keys[2] = False elif event.key == K_d: keys[3] = False if event.type == QUIT: pygame.quit() exit(0) if event.type == MOUSEBUTTONDOWN: #shoot.play() if len(bullets) < 3: # up to three bullets bullets.append([player[0]+32, player[1]-32])
vlna/another-py-invaders
another-py-invaders.py
Python
gpl-3.0
3,451
/******************************************************************************* * 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 org.worldgrower.gui.util; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.DocumentFilter; class DocumentIntFilter extends DocumentFilter { @Override public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException { Document doc = fb.getDocument(); StringBuilder sb = new StringBuilder(); sb.append(doc.getText(0, doc.getLength())); sb.insert(offset, string); if (test(sb.toString())) { super.insertString(fb, offset, string, attr); } else { // warn the user and don't allow the insert } } private boolean test(String text) { try { Integer.parseInt(text); return true; } catch (NumberFormatException e) { return false; } } @Override public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException { Document doc = fb.getDocument(); StringBuilder sb = new StringBuilder(); sb.append(doc.getText(0, doc.getLength())); sb.replace(offset, offset + length, text); if (test(sb.toString())) { super.replace(fb, offset, length, text, attrs); } else { // warn the user and don't allow the insert } } @Override public void remove(FilterBypass fb, int offset, int length) throws BadLocationException { Document doc = fb.getDocument(); StringBuilder sb = new StringBuilder(); sb.append(doc.getText(0, doc.getLength())); sb.delete(offset, offset + length); if (test(sb.toString())) { super.remove(fb, offset, length); } else { // warn the user and don't allow the insert } } }
WorldGrower/WorldGrower
src/org/worldgrower/gui/util/DocumentIntFilter.java
Java
gpl-3.0
2,812
#pragma once #include "../GUIFactory.h" class GfxAssetCombiner : public Texturizable { public: GfxAssetCombiner(GUIFactory* factory); virtual ~GfxAssetCombiner(); //unique_ptr<GraphicsAsset> combine(GraphicsAsset* asset1, GraphicsAsset* asset2); unique_ptr<GraphicsAsset> combine(Sprite* sprite1, Sprite* sprite2); /* Not used */ virtual unique_ptr<GraphicsAsset> texturize() override; virtual void textureDraw(SpriteBatch* batch, ComPtr<ID3D11Device> device = NULL) override; virtual void setPosition(const Vector2 & position) override; virtual const Vector2& getPosition() const override; virtual const int getWidth() const override; virtual const int getHeight() const override; private: GUIFactory* guiFactory; Sprite* sprite1; Sprite* sprite2; Vector2 origin; int width, height; };
TheDizzler/DXTKGui
Effects/GfxAssetCombiner.h
C
gpl-3.0
809
/* Copyright (c) 2001-2011, The HSQL Development Group * 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 the HSQL Development Group 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 HSQL DEVELOPMENT GROUP, HSQLDB.ORG, * 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 org.hsqldb.persist; import org.hsqldb.Row; import org.hsqldb.RowAVL; import org.hsqldb.RowAction; import org.hsqldb.Session; import org.hsqldb.Table; import org.hsqldb.TableBase; import org.hsqldb.index.Index; import org.hsqldb.index.NodeAVL; import org.hsqldb.index.NodeAVLDisk; import org.hsqldb.navigator.RowIterator; /* * Implementation of PersistentStore for information schema and temp tables. * * @author Fred Toussi (fredt@users dot sourceforge.net) * @version 2.3.0 * @since 2.0.1 */ public class RowStoreAVLHybridExtended extends RowStoreAVLHybrid { Session session; public RowStoreAVLHybridExtended(Session session, PersistentStoreCollection manager, TableBase table, boolean diskBased) { super(session, manager, table, diskBased); this.session = session; } public void set(CachedObject object) {} public CachedObject getNewCachedObject(Session session, Object object, boolean tx) { if (indexList != table.getIndexList()) { resetAccessorKeys(session, table.getIndexList()); } return super.getNewCachedObject(session, object, tx); } public void add(Session session, CachedObject object, boolean tx) { if (isCached) { int size = object.getRealSize(cache.rowOut); size += indexList.length * NodeAVLDisk.SIZE_IN_BYTE; size = cache.rowOut.getStorageSize(size); object.setStorageSize(size); long pos = tableSpace.getFilePosition(size, false); object.setPos(pos); if (tx) { RowAction.addInsertAction(session, (Table) table, (Row) object); } cache.add(object); } else { if (tx) { RowAction.addInsertAction(session, (Table) table, (Row) object); } } Object[] data = ((Row) object).getData(); for (int i = 0; i < nullsList.length; i++) { if (data[i] == null) { nullsList[i] = true; } } } public void indexRow(Session session, Row row) { NodeAVL node = ((RowAVL) row).getNode(0); int count = 0; while (node != null) { count++; node = node.nNext; } if (count != indexList.length) { resetAccessorKeys(session, table.getIndexList()); ((RowAVL) row).setNewNodes(this); } super.indexRow(session, row); } public void commitRow(Session session, Row row, int changeAction, int txModel) { switch (changeAction) { case RowAction.ACTION_DELETE : remove(row); break; case RowAction.ACTION_INSERT : break; case RowAction.ACTION_INSERT_DELETE : // INSERT + DELEETE remove(row); break; case RowAction.ACTION_DELETE_FINAL : delete(session, row); remove(row); break; } } public void rollbackRow(Session session, Row row, int changeAction, int txModel) { switch (changeAction) { case RowAction.ACTION_DELETE : row = (Row) get(row, true); ((RowAVL) row).setNewNodes(this); row.keepInMemory(false); indexRow(session, row); break; case RowAction.ACTION_INSERT : delete(session, row); remove(row); break; case RowAction.ACTION_INSERT_DELETE : // INSERT + DELEETE remove(row); break; } } /** * Row might have changed from memory to disk or indexes added */ public void delete(Session session, Row row) { NodeAVL node = ((RowAVL) row).getNode(0); int count = 0; while (node != null) { count++; node = node.nNext; } if ((isCached && row.isMemory()) || count != indexList.length) { row = ((Table) table).getDeleteRowFromLog(session, row.getData()); } if (row != null) { super.delete(session, row); } } public CachedObject getAccessor(Index key) { int position = key.getPosition(); if (position >= accessorList.length || indexList[position] != key) { resetAccessorKeys(session, table.getIndexList()); return getAccessor(key); } return accessorList[position]; } public synchronized void resetAccessorKeys(Session session, Index[] keys) { if (indexList.length == 0 || accessorList[0] == null) { indexList = keys; accessorList = new CachedObject[indexList.length]; return; } if (isCached) { resetAccessorKeysForCached(); return; } super.resetAccessorKeys(session, keys); } private void resetAccessorKeysForCached() { RowStoreAVLHybrid tempStore = new RowStoreAVLHybridExtended(session, manager, table, true); tempStore.changeToDiskTable(session); RowIterator iterator = table.rowIterator(this); while (iterator.hasNext()) { Row row = iterator.getNextRow(); Row newRow = (Row) tempStore.getNewCachedObject(session, row.getData(), false); tempStore.indexRow(session, newRow); } indexList = tempStore.indexList; accessorList = tempStore.accessorList; } }
ferquies/2dam
AD/Tema 2/hsqldb-2.3.1/hsqldb/src/org/hsqldb/persist/RowStoreAVLHybridExtended.java
Java
gpl-3.0
7,504
var selectdb = require('./selectDB'), accounts, DBPATIENTS = 0, DBDOCTORS = 1, DBPLANNERS = 2, DBADMINS = 3; var certAutoLogin = function(dni, db, callback){ 'use strict'; accounts = selectdb.selectDataBase(db); accounts.findOne({dni:dni}, function(e, o) { if (o){ callback(o); } else{ callback(null); } }); }; /*module*/ exports.certAutoLoginPatient = function(dni, callback){ 'use strict'; certAutoLogin(dni,DBPATIENTS,callback); }; exports.certAutoLoginDoctor = function(dni, callback){ 'use strict'; certAutoLogin(dni,DBDOCTORS,callback); }; exports.certAutoLoginPlanner = function(dni, callback){ 'use strict'; certAutoLogin(dni,DBPLANNERS,callback); }; exports.certAutoLoginAdmin = function(dni, callback){ 'use strict'; certAutoLogin(dni,DBADMINS,callback); };
BorjaPintos/mini-hospital
lib/loginCert.js
JavaScript
gpl-3.0
899
// Copyright (C) 2016 Andrea Esuli // http://www.esuli.it // // 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/>. namespace Esuli.Scheggia.Enumerators { using System; using Esuli.Scheggia.Core; using Esuli.Scheggia.Scoring; /// <summary> /// Stops an enumerator after a given number (cutoff) of results /// </summary> public class CutoffPostingEnumerator : IPostingEnumerator { private IPostingEnumerator postingEnumerator; private int cutoff; private ScoreFunction scoreFunction; public CutoffPostingEnumerator(IPostingEnumerator postingEnumerator, int cutoff) { this.postingEnumerator = postingEnumerator; this.cutoff = cutoff; scoreFunction = ScoreFunctions.CopyScore(postingEnumerator); } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { postingEnumerator.Dispose(); } } public ScoreFunction ScoreFunction { get { return scoreFunction; } set { scoreFunction = value; } } public int Count { get { return Math.Min(postingEnumerator.Count,cutoff); } } public int Progress { get { return postingEnumerator.Progress; } } public int CurrentPostingId { get { return postingEnumerator.CurrentPostingId; } } public int CurrentHitCount { get { return postingEnumerator.CurrentHitCount; } } public bool MoveNext() { if (postingEnumerator.Progress >= cutoff) { return false; } return postingEnumerator.MoveNext(); } public bool MoveNext(int minPostingId) { if (postingEnumerator.Progress >= cutoff) { return false; } return postingEnumerator.MoveNext(minPostingId); } public IHitEnumerator GetCurrentHitEnumerator() { return postingEnumerator.GetCurrentHitEnumerator(); } } }
aesuli/Scheggia
Scheggia/src/Esuli/Scheggia/Enumerators/CutoffPostingEnumerator.cs
C#
gpl-3.0
3,151
local ITEM = {} local WEAPON = {} ITEM.ID = "skullwep" ITEM.Name = "Human Skull" ITEM.ClassSpawn = "Engineer" ITEM.Scrap = 70 ITEM.Small_Parts = 5 ITEM.Chemicals = 0 ITEM.Chance = 100 ITEM.Info = "A Human Skull, Where did you get one of these you sick fuck ?" ITEM.Type = "melee" ITEM.Remove = true ITEM.Energy = 20 ITEM.Ent = "skullwep" ITEM.Model = "models/Gibs/HGIBS.mdl" ITEM.Icon ="models/Gibs/HGIBS.mdl" ITEM.Script = "" ITEM.Weight = 5 WEAPON.ID = ITEM.ID WEAPON.AmmoType = "" function ITEM.ToolCheck( p ) return true end function ITEM.Use( ply ) local WepName = "skullwep" local gotWep = false for k, v in pairs(ply:GetWeapons()) do if v:GetClass() == WepName then gotWep = true end end if gotWep == false then ply:Give(WepName) ply:GetWeapon(WepName):SetClip1(0) return true else ply:ChatPrint("Weapon already equipped.") return false end end function ITEM.Create( ply, class, pos ) local ent = ents.Create("ent_weapon") --ent:SetNetworkedInt("Ammo", self.Energy) ent:SetNWString("WepClass", ITEM.Ent) ent:SetModel(ITEM.Model) ent:SetAngles(Angle(0,0,0)) ent:SetPos(pos) ent:Spawn() return ent end PNRP.AddItem(ITEM) PNRP.AddWeapon(WEAPON)
AndyClausen/PNRP_HazG
postnukerp/Gamemode/items/melee_code/melee_blunt/skullwep.lua
Lua
gpl-3.0
1,248
package me.deftware.mixin.mixins; import javax.annotation.Nullable; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mutable; import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import me.deftware.client.framework.event.events.EventGuiScreenDisplay; import me.deftware.client.framework.event.events.EventKeyPress; import me.deftware.client.framework.event.events.EventLeftClick; import me.deftware.client.framework.event.events.EventMiddleClick; import me.deftware.client.framework.event.events.EventSetFPS; import me.deftware.client.framework.main.Bootstrap; import me.deftware.mixin.imp.IMixinMinecraft; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.settings.GameSettings; import net.minecraft.util.Session; import net.minecraft.util.Timer; @Mixin(Minecraft.class) public abstract class MixinMinecraft implements IMixinMinecraft { @Mutable @Shadow @Final private Session session; @Shadow @Final private Timer timer; @Shadow @Nullable private GuiScreen currentScreen; @Shadow private GameSettings gameSettings; @Shadow private WorldClient world; @Shadow private int rightClickDelayTimer; @Override @Shadow public abstract void displayGuiScreen(@Nullable GuiScreen guiScreenIn); @Shadow public abstract void rightClickMouse(); @Shadow public abstract void clickMouse(); @ModifyVariable(method = "displayGuiScreen", at = @At("HEAD")) private GuiScreen displayGuiScreenModifier(GuiScreen screen) { EventGuiScreenDisplay event = new EventGuiScreenDisplay(screen).send(); return event.isCanceled() ? null : event.getScreen(); } @Inject(method = "runTick", at = @At("HEAD")) private void runTick(CallbackInfo cb) { if (Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu) { EventGuiScreenDisplay event = new EventGuiScreenDisplay(Minecraft.getMinecraft().currentScreen).send(); if (!(event.getScreen() instanceof GuiMainMenu)) { displayGuiScreen(event.getScreen()); } } } @Override public void setRightClickDelayTimer(int delay) { this.rightClickDelayTimer = delay; } @Override public void doClickMouse() { clickMouse(); } @Override public void doRightClickMouse() { rightClickMouse(); } /** * @Author Deftware * @reason */ @Overwrite public int getLimitFramerate() { int fps = world == null && currentScreen != null ? 30 : gameSettings.limitFramerate; EventSetFPS event = new EventSetFPS(fps, Display.isActive()).send(); return event.getFps(); } @Inject(method = "runTickMouse", at = @At(value = "INVOKE_ASSIGN", target = "org/lwjgl/input/Mouse.getEventButton()I", remap = false)) private void onMouseEvent(CallbackInfo info) { if (currentScreen != null) { return; } int button = Mouse.getEventButton(); if (button == 0) { new EventLeftClick().send(); } else if (button == 1) { // Right click } else if (button == 2) { new EventMiddleClick().send(); } } @Inject(method = "runTickKeyboard", at = @At(value = "INVOKE_ASSIGN", target = "org/lwjgl/input/Keyboard.getEventKeyState()Z", remap = false)) private void onKeyEvent(CallbackInfo ci) { if (currentScreen != null) { return; } boolean down = Keyboard.getEventKeyState(); if (down) { new EventKeyPress(Keyboard.getEventKey()).send(); } } @Inject(method = "init", at = @At("RETURN")) private void init(CallbackInfo callbackInfo) { Bootstrap.init(); } @Override public Session getSession() { return session; } @Override public void setSession(Session session) { this.session = session; } @Override public Timer getTimer() { return timer; } }
Moudoux/EMC
src/main/java/me/deftware/mixin/mixins/MixinMinecraft.java
Java
gpl-3.0
4,168
package ch.jcsinfo.file; /** * Exception de fichier. * * @author jcstritt */ public class FileException extends Exception { private static final long serialVersionUID = 1L; /** * Constructor. * * @param className the class name * @param methodName the methodName * @param msg the error message */ public FileException(String className, String methodName, String msg) { super("File error detected in: " + methodName + ", class: " + className + "\n" + msg); } @Override public String toString() { return super.toString(); } @Override public String getMessage() { return super.getMessage(); } }
emfinfo/basiclib
src/main/java/ch/jcsinfo/file/FileException.java
Java
gpl-3.0
686
/* * Copyright (c) 2013 Mark Travis <mtravis15432+src@gmail.com> * All rights reserved. No warranty, explicit or implicit, provided. * * This file is part of InfiniSQL(tm). * InfiniSQL is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 * as published by the Free Software Foundation. * * InfiniSQL 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 InfiniSQL. If not, see <http://www.gnu.org/licenses/>. */ /** * @file larx.h * @author Mark Travis <mtravis15432+src@gmail.com> * @date Tue Dec 17 13:26:16 2013 * * @brief Function declarations so flex and bison can work together. */ #ifndef INFINISQLLARX_H #define INFINISQLLARX_H #include <stdint.h> #include "parser.h" #include <string.h> #include <stdio.h> class Larxer; /** * @brief data for flex and bison to cooperate * */ struct perlarxer { void *scaninfo; class Larxer *larxerPtr; }; /** * @brief parser function declaration * * * @return some bison result */ int yyparse(struct perlarxer *); /** * @brief probably initializes state object for reentrent tokenizer * */ void flexinit(struct perlarxer *); /** * @brief or this could intialize state object for reentrant tokenizer * * does anybody actually know what flex and bison do? * */ void flexbuffer(char *, size_t, void *); /** * @brief destroy state object for reentrant tokenizer * */ void flexdestroy(void *); #endif /* INFINISQLLARX_H */
infinisql/infinisql
infinisqld/larx.h
C
gpl-3.0
1,754
<!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"/> <title>SUMO - Simulation of Urban MObility: NIVissimSingleTypeParser_Zeitschrittfaktor.h Source File</title> <link href="../../tabs.css" rel="stylesheet" type="text/css"/> <link href="../../doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="../../main.html"><span>Main&nbsp;Page</span></a></li> <li><a href="../../pages.html"><span>Related&nbsp;Pages</span></a></li> <li><a href="../../modules.html"><span>Modules</span></a></li> <li><a href="../../annotated.html"><span>Data&nbsp;Structures</span></a></li> <li class="current"><a href="../../files.html"><span>Files</span></a></li> <li><a href="../../dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="../../files.html"><span>File&nbsp;List</span></a></li> <li><a href="../../globals.html"><span>Globals</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="../../dir_75b82e7e4a5feb05200b9ad7adf06257.html">home</a>&nbsp;&raquo;&nbsp;<a class="el" href="../../dir_46b8f36974b309f038ffc35aa047a32b.html">boni</a>&nbsp;&raquo;&nbsp;<a class="el" href="../../dir_52e5be8ca53cec2b5437a8ba83e8e4f0.html">Desktop</a>&nbsp;&raquo;&nbsp;<a class="el" href="../../dir_7de3ce0f65e0314f747915173f89e60e.html">DanielTouched</a>&nbsp;&raquo;&nbsp;<a class="el" href="../../dir_a0096e276045b3ff0719c75e0b3c59bf.html">sumo-0.14.0</a>&nbsp;&raquo;&nbsp;<a class="el" href="../../dir_e9b8d709919855cd07b0394009af2578.html">src</a>&nbsp;&raquo;&nbsp;<a class="el" href="../../dir_941ad1c9f6979a737b8a94dcef837464.html">netimport</a>&nbsp;&raquo;&nbsp;<a class="el" href="../../dir_f3d09ab64cb624c243f37870f6bbf2d9.html">vissim</a>&nbsp;&raquo;&nbsp;<a class="el" href="../../dir_96e4e0818b5facde9dffad21d54a3dd2.html">typeloader</a> </div> </div> <div class="contents"> <h1>NIVissimSingleTypeParser_Zeitschrittfaktor.h</h1><a href="../../d9/d91/_n_i_vissim_single_type_parser___zeitschrittfaktor_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/****************************************************************************/</span> <a name="l00007"></a>00007 <span class="comment">//</span> <a name="l00008"></a>00008 <span class="comment">/****************************************************************************/</span> <a name="l00009"></a>00009 <span class="comment">// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/</span> <a name="l00010"></a>00010 <span class="comment">// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors</span> <a name="l00011"></a>00011 <span class="comment">/****************************************************************************/</span> <a name="l00012"></a>00012 <span class="comment">//</span> <a name="l00013"></a>00013 <span class="comment">// This file is part of SUMO.</span> <a name="l00014"></a>00014 <span class="comment">// SUMO is free software: you can redistribute it and/or modify</span> <a name="l00015"></a>00015 <span class="comment">// it under the terms of the GNU General Public License as published by</span> <a name="l00016"></a>00016 <span class="comment">// the Free Software Foundation, either version 3 of the License, or</span> <a name="l00017"></a>00017 <span class="comment">// (at your option) any later version.</span> <a name="l00018"></a>00018 <span class="comment">//</span> <a name="l00019"></a>00019 <span class="comment">/****************************************************************************/</span> <a name="l00020"></a>00020 <span class="preprocessor">#ifndef NIVissimSingleTypeParser_Zeitschrittfaktor_h</span> <a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define NIVissimSingleTypeParser_Zeitschrittfaktor_h</span> <a name="l00022"></a>00022 <span class="preprocessor"></span> <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="comment">// ===========================================================================</span> <a name="l00025"></a>00025 <span class="comment">// included modules</span> <a name="l00026"></a>00026 <span class="comment">// ===========================================================================</span> <a name="l00027"></a>00027 <span class="preprocessor">#ifdef _MSC_VER</span> <a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="../../d3/d99/windows__config_8h.html">windows_config.h</a>&gt;</span> <a name="l00029"></a>00029 <span class="preprocessor">#else</span> <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="../../db/d16/config_8h.html">config.h</a>&gt;</span> <a name="l00031"></a>00031 <span class="preprocessor">#endif</span> <a name="l00032"></a>00032 <span class="preprocessor"></span> <a name="l00033"></a>00033 <span class="preprocessor">#include &lt;iostream&gt;</span> <a name="l00034"></a>00034 <span class="preprocessor">#include &quot;../NIImporter_Vissim.h&quot;</span> <a name="l00035"></a>00035 <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="comment">// ===========================================================================</span> <a name="l00038"></a>00038 <span class="comment">// class definitions</span> <a name="l00039"></a>00039 <span class="comment">// ===========================================================================</span> <a name="l00044"></a><a class="code" href="../../d8/d44/class_n_i_vissim_single_type_parser___zeitschrittfaktor.html">00044</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="../../d8/d44/class_n_i_vissim_single_type_parser___zeitschrittfaktor.html">NIVissimSingleTypeParser_Zeitschrittfaktor</a> : <a name="l00045"></a>00045 <span class="keyword">public</span> <a class="code" href="../../de/dfd/class_n_i_importer___vissim.html" title="Importer for networks stored in Vissim format.">NIImporter_Vissim</a>::<a class="code" href="../../d6/d62/class_n_i_importer___vissim_1_1_vissim_single_type_parser.html#a0c51dcab704c5eb8f37dbaf3019eb02c" title="Constructor.">VissimSingleTypeParser</a> { <a name="l00046"></a>00046 <span class="keyword">public</span>: <a name="l00048"></a>00048 <a class="code" href="../../d8/d44/class_n_i_vissim_single_type_parser___zeitschrittfaktor.html#abdeacc1068bc09d670d175276d1c2ab6" title="Constructor.">NIVissimSingleTypeParser_Zeitschrittfaktor</a>(<a class="code" href="../../de/dfd/class_n_i_importer___vissim.html" title="Importer for networks stored in Vissim format.">NIImporter_Vissim</a>&amp; parent); <a name="l00049"></a>00049 <a name="l00051"></a>00051 <a class="code" href="../../d8/d44/class_n_i_vissim_single_type_parser___zeitschrittfaktor.html#ad4e7aa7322e0d61e5f77afe23d875c35" title="Destructor.">~NIVissimSingleTypeParser_Zeitschrittfaktor</a>(); <a name="l00052"></a>00052 <a name="l00054"></a>00054 <span class="keywordtype">bool</span> <a class="code" href="../../d8/d44/class_n_i_vissim_single_type_parser___zeitschrittfaktor.html#a0785eeb2bc575cdbbfeb69e248229fe5" title="Parses the data type from the given stream.">parse</a>(std::istream&amp; from); <a name="l00055"></a>00055 <a name="l00056"></a>00056 }; <a name="l00057"></a>00057 <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="preprocessor">#endif</span> <a name="l00060"></a>00060 <span class="preprocessor"></span> <a name="l00061"></a>00061 <span class="comment">/****************************************************************************/</span> <a name="l00062"></a>00062 </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Tue Jul 17 12:16:08 2012 for SUMO - Simulation of Urban MObility by&nbsp; <a href="http://www.doxygen.org/index.html"> <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>
smendez-hi/SUMO-hib
docs/doxygen/d9/d91/_n_i_vissim_single_type_parser___zeitschrittfaktor_8h_source.html
HTML
gpl-3.0
8,381
package com.example.exerciciowidgetum; import android.os.Bundle; import android.app.Activity; import android.graphics.Color; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; import android.widget.ToggleButton; public class MainActivity extends Activity { private ImageButton ib1; //Instância variavel do Imagebutton 1 private ImageButton ib2; //Instância variavel do Imagebutton 2 private Button button; /**Instância variavel do button que interage com o radioGroup. */ private RadioGroup radioGroup ; /**Instância variavel do radioGroup.*/ private RadioButton radioButton; /**Instância da variável a ser selecionada no radioGroup. */ private String alerta = "Selecione uma opção de cor."; /**Menssage of alert, no color select*/ private TextView mColorRegion; /**Instância variavel do texto 'this is test!'*/ private int red = Color.RED; /**Instância variavel da cor vermelha*/ private int blue = Color.BLUE; /**Instância variavel da cor azul*/ private int yellow = Color.YELLOW;/**Instância variavel da cor amarela*/ private int black = Color.BLACK; /**Instância variavel da cor black*/ private int white= Color.WHITE; /**Instância variavel da cor white*/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Questão 1 //Modifica a cor do elemento com id 'color_region' this.mColorRegion = (TextView) findViewById(R.id.textView1); /** Questão 4 */ radioGroup = (RadioGroup)findViewById(R.id.radio_group_alterar); // Recebe o id do button this.button = (Button)findViewById(R.id.button_alterar); // Verifica o estado do button this.button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int selectedId = radioGroup.getCheckedRadioButtonId(); /** variável para armazenaer o id do radioButton selecionado.*/ if(selectedId >= 1){ /** trata um possível erro se não tiver algum radioButton selecionado.*/ // Procura o radioButton para retornar id radioButton = (RadioButton) findViewById(selectedId); } if (selectedId == -1){ Toast.makeText(MainActivity.this, alerta, Toast.LENGTH_SHORT).show(); }else if (radioButton.getId() == R.id.radioButton4){ setRegionColor(Color.BLACK);//modifica cor do texto mColorRegion.setBackgroundColor(Color.RED);//modifica cor do background }else if (radioButton.getId() == R.id.radioButton5){ setRegionColor(Color.BLACK);//modifica cor do texto mColorRegion.setBackgroundColor(Color.BLUE);//modifica cor do background }else if (radioButton.getId() == R.id.radioButton6){ setRegionColor(Color.BLACK);//modifica cor do texto mColorRegion.setBackgroundColor(Color.YELLOW);//modifica cor do background } } }); } //Metodo usado para modificar a cor do texto public void setRegionColor(int color){ mColorRegion.setTextColor(color); } // Questão 1 // ImageButton public void showImageButton1(View v) { //modifica cor do texto setRegionColor(this.red); } public void showImageButton2(View v) { //modifica cor do texto setRegionColor(this.blue); } // Questão 2 // 1ª linha de RadioButton public void showRadioButton1(View v) { //modifica cor do texto setRegionColor(this.red); } public void showRadioButton2(View v) { //modifica cor do texto setRegionColor(this.blue); } public void showRadioButton3(View v) { //modifica cor do texto setRegionColor(this.yellow); } // Questão 3 // Togglebutton RED public void showToggleButton1(View clickedToogleButton) { // android:id="@+id/toggleButton1" ToggleButton tb = (ToggleButton) clickedToogleButton; //modifica cor do texto if(tb.isChecked()){ setRegionColor(this.black); mColorRegion.setBackgroundColor(this.red); }else{ setRegionColor(this.black); mColorRegion.setBackgroundColor(this.white); } } // Togglebutton BLUE public void showToggleButton2(View clickedToogleButton) {// android:id="@+id/toggleButton2" ToggleButton tb = (ToggleButton) clickedToogleButton; //modifica cor do texto if(tb.isChecked()){ setRegionColor(this.black); mColorRegion.setBackgroundColor(this.blue); }else{ setRegionColor(this.black); mColorRegion.setBackgroundColor(this.white); } } // Togglebutton YELLOW public void showToggleButton3(View clickedToogleButton) { // android:id="@+id/toggleButton3" ToggleButton tb = (ToggleButton) clickedToogleButton; //modifica cor do texto if(tb.isChecked()){ setRegionColor(this.black); mColorRegion.setBackgroundColor(this.yellow); }else{ setRegionColor(this.black); mColorRegion.setBackgroundColor(this.white); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
luizantonio/ProjetoAvancadoSoftware2
ExercicioWidgetUm/src/com/example/exerciciowidgetum/MainActivity.java
Java
gpl-3.0
5,752
{% if threads.length %} {% include "./_list.html" %} {% else %} <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12"> <p class="text-center text-danger"> 尚无新帖发表! </p> </div> </div> {% endif %}
calidion/server.xiv.im
lib/v2/views/site/thread/list.html
HTML
gpl-3.0
233
# The set of languages for which implicit dependencies are needed: set(CMAKE_DEPENDS_LANGUAGES "CXX" ) # The set of files for implicit dependencies of each language: set(CMAKE_DEPENDS_CHECK_CXX "/home/matt/Dropbox/git/gol3d/src/Application.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/Application.cpp.o" "/home/matt/Dropbox/git/gol3d/src/Camera.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/Camera.cpp.o" "/home/matt/Dropbox/git/gol3d/src/CellularAutomaton.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/CellularAutomaton.cpp.o" "/home/matt/Dropbox/git/gol3d/src/Cube.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/Cube.cpp.o" "/home/matt/Dropbox/git/gol3d/src/GeneralizedCellularAutomaton.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/GeneralizedCellularAutomaton.cpp.o" "/home/matt/Dropbox/git/gol3d/src/IO.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/IO.cpp.o" "/home/matt/Dropbox/git/gol3d/src/Object.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/Object.cpp.o" "/home/matt/Dropbox/git/gol3d/src/Skybox.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/Skybox.cpp.o" "/home/matt/Dropbox/git/gol3d/src/User.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/User.cpp.o" "/home/matt/Dropbox/git/gol3d/src/World.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/World.cpp.o" "/home/matt/Dropbox/git/gol3d/src/load_obj.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/load_obj.cpp.o" "/home/matt/Dropbox/git/gol3d/src/load_shader.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/load_shader.cpp.o" "/home/matt/Dropbox/git/gol3d/src/main.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/main.cpp.o" "/home/matt/Dropbox/git/gol3d/src/utils.cpp" "/home/matt/Dropbox/git/gol3d/cmake-build-debug/CMakeFiles/gol3d.dir/src/utils.cpp.o" ) set(CMAKE_CXX_COMPILER_ID "GNU") # The include file search paths: set(CMAKE_CXX_TARGET_INCLUDE_PATH "../include" "/usr/include/SOIL" ) # Targets to which this target links. set(CMAKE_TARGET_LINKED_INFO_FILES ) # Fortran module output directory. set(CMAKE_Fortran_TARGET_MODULE_DIR "")
heyitsguay/gol3d
cmake-build-debug/CMakeFiles/gol3d.dir/DependInfo.cmake
CMake
gpl-3.0
2,454
/***********************************************************************/ /** * @class GR * Johnny Hausman <johnny@appdevdesigns.net> * * Dependencies: * - async * - ad-utils */ var GR = function (opts, testAD) { var defaults = { grBase: 'http://global.registry.com/', accessToken: 'noTokenProvided' }; this.opts = AD.sal.extend({}, defaults, opts); // if this is in a testing environment: if (testAD) { AD = testAD; if (testAD.klass) { testAD.klass.add('EntityType', EntityType); } } // make sure grBase ends in '/' var parts = this.opts.grBase.split('//'); var i = parts.length-1; parts[i] = parts[i] + '/'; parts[i] = parts[i].replace('//', '/'); this.opts.grBase = parts.join('//'); if (this.opts.accessToken == defaults.accessToken) { AD.log.error('<bold>Global Registry API:</bold> no access token provided. This isn\'t going to work.'); } // on node, we need to track our own cookie jar: if (typeof module != 'undefined' && module.exports) { this.jar = require('request').jar(); } // Now attach our Entity object and instantiate our GR this.Entity = Entity; this.Entity.GR = this; }; if (typeof module != 'undefined' && module.exports) { module.exports = GR; var async = require('async'); var AD = require('ad-utils'); } //**************************************************************************** /** * @function request * * This is our http() request function for communicating with * the Global Registry API. * * @return Deferred */ GR.prototype.request = function (opts) { // data: (typeof opts.data != 'undefined') ? // JSON.stringify(opts.data) : opts.data, var reqParams = { url: this.opts.grBase + opts.path, type: opts.method, data: opts.data, dataType: opts.dataType || 'json', contentType: 'application/json', cache: false, headers: { 'Authorization': 'Bearer '+this.opts.accessToken, 'Accept' : 'application/json', 'Content-type' : 'application/json' } }; if (this.opts.forwardedFor) { reqParams.headers['X-Forwarded-For'] = this.opts.forwardedFor; } // pass in our local cookie jar if it exists if (this.jar) { reqParams.jar = this.jar; } return AD.sal.http(reqParams); }; //**************************************************************************** /** * @function makeFilter * * Take an object defining a filter, and translate that into the GR API filter * format. * * example filter description: * { * first_name:'Neo', * status:{ * theOne:'true', * isCool:'true' * } * } * * returned GR API Filter: * filters[first_name]=Neo&filters[status][theOne]=true&filters[status][isCool]=true * * @param {object} opt * @return {string} */ GR.prototype.makeFilter = function(opt) { var filter = []; var parseEntry = function(key, obj) { // returns an array of [ '[key]=value' ] entries // for the current entry create the '[key]' var entry = '['+key+']'; // if the corresponding value is an object we recursively parse // all those values: if (typeof obj[key] == 'object') { var returnValues = []; for (var no in obj[key]) { nextEntries = parseEntry(no, obj[key]); nextEntries.forEach(function(nextEntry) { returnValues.push(entry+nextEntry); }); } return returnValues; } else { // else this is a simple key=value entry: return [ entry+'='+obj[key] ]; } } if ('undefined' != typeof opt) { // for each key in our given filter for (var o in opt) { // get the results for that key var results = parseEntry(o, opt); // store them in our filter array results.forEach(function(res){ filter.push( 'filters'+res); }); } } // convert our filters into the querystring params: return filter.join('&'); } //**************************************************************************** /** * @function EntityTypes * * Request the Defined EntityTypes in the Global Registry. * * @param {object} opts a filter object for filtering the results * @return Deferred */ GR.prototype.EntityTypes = function (opts) { var dfd = AD.sal.Deferred(); var self = this; var servicePath = 'entity_types'; //// NOTE: the request() library seems to modify the filter values in a way //// that doesn't work with GlobalRegistry, so we manually add it to the //// uri : var filter = this.makeFilter(opts); if (filter != '') { servicePath += '?'+filter; } var reqOptions = { path:servicePath, method:'get' } this.request(reqOptions) .fail(function(err){ AD.log.error('<bold>GlobalRegistryAPI</bold> error requesting EntityTypes', err, reqOptions ); dfd.reject(err); }) .then(function(data){ var listObjects = []; data.entity_types.forEach(function(entityDef){ entityDef.GR = self; entityDef.parent_id = 0; var entity = new EntityType(entityDef); listObjects.push(entity); }); dfd.resolve(listObjects); }); return dfd; }; //**************************************************************************** /** * @function newEntityType * * Return an instance of an EntityType object. * * @param {object} opts initial values for EntityType * @return {object} EntityType */ GR.prototype.newEntityType = function (opts) { var self = this; opts = opts || {}; opts.GR = this; return new EntityType(opts); }; /////// /////// LEFT OFF HERE: /////// Implement EntityTypes(); // var gr = new GR({ }); // var entityTypes = gr.getEntityTypes( 'key'); // entityTypes.foreach(function(entityType) { // entityType.id() // entityType.name() // entityType.fields().forEach(function( entityType) { // // }) // }) // var gr.entities('key',{filter}); // /************************************************************************/ /** * @class EntityType * * This class manages the individual EntityType node. * * field: id, name, field_type, parent_id * * methods: id(), id(val), name(), name(val), */ var EntityType = function(opts) { var self = this; this.GR = opts.GR; if (!this.GR) { AD.log.error('<bold>GlobalRegistryAPI:</bold> EntityType created with no GR set! '); } this._required = { save:{ name:'' } } this._defaults = { id: -1, name:'', description:'', field_type:'entity', enum_values:[], parent_id:-1 }; this._data = AD.sal.extend({}, this._defaults, opts); // parent_id can't be -1. If no parent_id provided, assume a root level node: if ('undefined' == typeof opts.parent_id) { this.parentId(0); } this._fields = []; //// //// now define our fields interface: //// // .fields() returns the array of fields for this entity_type this.fields = function() { return this._fields; }; // .fields.add( def ) creates a new field entity_type from the provided def this.fields.add = function( fieldDef ) { fieldDef.GR = self.GR; fieldDef.parent_id = self.id(); var newET = new EntityType(fieldDef); self._fields.push(newET); return newET; } // Now pull in all the provided field definitions if (opts.fields) { opts.fields.forEach(function(field) { self.fields.add(field); }) } // we just got through creating ourselves, so no need to update yet: this._inSync = true; }; //// //// Now implement get(), set() fns for each of these properties: //// var methods = ['name', 'description', 'field_type', 'enum_values', 'parent_id']; methods.forEach(function(key){ // these functions don't match the property name exactly: var xLate = { 'field_type':'fieldType', 'enum_values':'enumValues', 'parent_id':'parentId'}; var fnKey = key; if (xLate[key]) fnKey = xLate[key]; EntityType.prototype[fnKey] = function( val ) { return ObjGetSet(this, key, val); } }); /************************************************************************/ /** * @function destroy * * delete the current EntityType * * @return {Deferred} */ EntityType.prototype.destroy = function() { var self = this; var dfd = AD.sal.Deferred(); var reqOptions = { path:'entity_types/'+self.id(), method:'delete' } self.GR.request(reqOptions) .fail(function(err){ AD.log.error('<bold>GlobalRegistryAPI</bold> error saving EntityType', err, reqOptions, this ); dfd.reject(err); }) .then(function(dataBack){ //// QUESTION: <2014-05-09> Johnny : what do I do with a deleted Obj? reset id=-1? // A successful delete will actually delete all the embedded EntityTypes // so scan through all children and reset id(-1). var resetEntityType = function(current) { current.id(-1); current.fields().forEach(function(field){ resetEntityType(field); }); } resetEntityType(self); //// QUESTION: <2014-05-10> Johnny : Is there a need to remove this entry from a //// parent's _fields[] array? // don't need to update myself anymore... self._inSync = true; dfd.resolve(); }); return dfd; } /************************************************************************/ /** * @function id * * The id() get()/set() fn requires some additional setps when setting * it's value. * * @return {mixed} */ EntityType.prototype.id= function( val ) { if ('undefined' != typeof val) { this.fields().forEach(function(field){ field.parentId(val); }) } return ObjGetSet(this, 'id', val); } /************************************************************************/ /** * @function packageJSON * * Return the data values for this object packaged properly for submiting * to the GR API. * * @return {object} */ EntityType.prototype.packageJSON = function() { var data = {}; for (var d in this._defaults) { // if field has been set || field is required then add it to data if ((this._data[d] != this._defaults[d]) || ( typeof this._required.save[d] != 'undefined' )){ data[d] = this._data[d]; } } // when creating a Root Directory (parent_id:0) // we don't actually send that info to the API if ('undefined' != typeof data.parent_id) { if (data.parent_id == 0) { delete data.parent_id; } } // if this is not a 'enum_values' type // then make sure data.enum_values is not part of the // data package. if (this._data.field_type != 'enum_values') { delete data.enum_values; } // package in entity_types {} data = { entity_type: data } return data; } /************************************************************************/ /** * @function save * * Save the current state of this object back to the GR. If this object * is newly created, this will create it on the GR. If it has been updated * it will update the copy in GR. * * save() on a newly created object will also perform a save() on all it's * child fields. * * @return {Deferred} */ EntityType.prototype.save = function() { var dfd = AD.sal.Deferred(); var self = this; // if id == -1 then this value should be saved if (this.id() == -1) { var data = this.packageJSON(); var reqOptions = { path:'entity_types', method:'post', data:data } this.GR.request(reqOptions) .fail(function(err){ AD.log.error('<bold>GlobalRegistryAPI</bold> error creating EntityType', err, reqOptions, this ); dfd.reject(err); }) .then(function(dataBack){ loadFromData(self, 'entity_type', dataBack); // update each field's parent_id with current id // then have that item save itself var numSaved = 0; self._fields.forEach(function(field){ field.parentId( self.id() ); field.save() .fail(function(err){ dfd.reject(err); }) .then(function(){ // wait until all child fields are finished saving numSaved ++; if (numSaved >= self._fields.length) { dfd.resolve(); } }); }); // if we didn't have any child fields, resolve() now if (self._fields.length == 0) { dfd.resolve(); } }); } else { // if we are not inSync then we need to update if (!this._inSync) { var data = this.packageJSON(); var reqOptions = { path:'entity_types/'+self.id(), method:'put', data:data } self.GR.request(reqOptions) .fail(function(err){ AD.log.error('<bold>GlobalRegistryAPI</bold> error updating EntityType', err, reqOptions, this ); dfd.reject(err); }) .then(function(response){ loadFromData(self, 'entity_type', response); dfd.resolve(); }); } else { dfd.resolve(); } } return dfd; } //**************************************************************************** // Helper Functions //**************************************************************************** /************************************************************************/ /** * @function filterToQSObj * * convert a filter string into an object for use in the request qs field. * * given: 'filters[name]=Neo&filters[isTheOne]=true' * * return: { * 'filters[name]' : 'Neo', * 'filters[isTheOne]' : 'true' * } * * @param {string} strFilter the generated filter string for GR. * @return {object} */ var filterToQSObj = function( strFilter ) { var returnObj = {}; strFilter.split('&').forEach(function(filter){ var parts = filter.split('='); if (parts.length > 1) { returnObj[parts[0]] = parts[1]; } }); return returnObj; } /************************************************************************/ /** * @function loadFromData * * Reload our object from the given data response from GR. * * @param {object} self a reference to the Object instance * @param {string} key a reference to which Object this is * @return {undefined} */ var loadFromData = function(self, key, dataBack) { // dataBack = { // entity_type: { // id:x, // name:'xxx', // description:'yyy', // ... // } // } // the data is embedded in an object's key property: // adjust dataBack to data value dataBack = dataBack[key]; if (dataBack) { // update our values for (var db in dataBack) { self._data[db] = dataBack[db]; } // consider ourselves in sync with server self._inSync = true; } } /************************************************************************/ /** * @function ObjGetSet * * implements a generic get() & set() fn for an object. * * This fn expects the object to store it's data in a self._data object. * * This fn also manages an object's self._inSync setting. * * if called with no value parameter, then this performs a get() operation. * * if called with a val parameter, then this performs a set() operation. * * @param {object} self a reference to the Object instance * @param {string} key a reference to which Object property we are accessing * @param {} val [optional] value for the property. * @return {Deferred} */ var ObjGetSet = function(self, key, val) { if ('undefined' != typeof val) { self._inSync = false; // setter: return self._data[key] = val; } else { // getter return self._data[key]; } } var Entity = { GR:null, _entityTypes:null, instance:function(type, data) { var instance = new Entity(type, data); instance.GR = this.GR; return instance; }, /* * @function create * * @param {string} type the entity_type of the data to create * (optional) if not given, then entity_type must be * a field in the data. * @param {json/array} data the data of the entity to create. * @return {deferred} */ create:function(type, data) { var dfd = AD.sal.Deferred(); if (typeof data == 'undefined') { data = type; type = null; } if (!type) { type = data.entity_type; delete data.entity_type; } if (!type) { AD.log.error('<bold>GlobalRegistryAPI</bold> error creating Entity: no entity_type provided!', type, data); } var reqData = { entity: {} } reqData.entity[type] = data; // if( Object.prototype.toString.call( data ) !== '[object Array]' ) { // data = [data]; // } var reqOptions = { path:'entities', method:'post', data:reqData } this.GR.request(reqOptions) .fail(function(err){ AD.log.error('<bold>GlobalRegistryAPI</bold> error creating Entity['+type+']', err, reqOptions, this ); dfd.reject(err); }) .then(function(dataBack){ // returned structure: // { // entity:{ // [type]:{ // data:here // } // } // } var liveData = AD.sal.extend({}, data, dataBack.entity[type]); console.log('... liveData:', liveData); var entityInstance = _this.GR.Entity.instance(type, liveData); dfd.resolve(entityInstance); }); return dfd; } } /* // Searching: // GR.Entity._entityTypes = []; GR.Entity.instance({json}); GR.Entity.find({id:abcd}) .then(function(person){ person.set('first_name', 'Neo'); person.save(); }) GR.Entity.findOne(id) .then(function(person){ person.set('first_name', 'Neo'); person.save(); }) GR.Entity.create({json def}) GR.Entity.update(id, {json.values}) GR.Entity.destroy(id) // an instance: entityInstance.save() // -> .create() or .update() entityInstance.destroy() // .destroy() eI.get('first_name'); eI.set('first_name', value); eI.set({ first_name:'value' }) */ var EntityMerge = function(data, newData) { for(var v in newData) { var value = newData[v]; // if value is an array // if 1st entry is an object // forEach object: // find my this.data[v] entry with same client_integration_id // send both of those to EntityMerge( myCurrentValue, newObject) // else // an array of non entities: // update this.data[v] = value; // end if // else if value is an object // else // current this.data[v] = value; // end if } } var Entity = function(type, data) { var _this = this; this.GR = null; this.type = type; // the specific entity key ('person') this.data = data; // the data for that entity } Entity.prototype.get = function(key) { var value = this.data[key]; // if value is an object // return a this.GR.Entity.instance(key, value) // else if value is an array // need to return an array of Entities: // var returnArray = []; // this.data[key].forEach(obj) { // returnArray.push( new Entity.instance(key, obj)) // } // return returnArray; // else // return value; // end if } Entity.prototype.set = function(key, value) { // if value is of type Entity // value = value.data; // end if // this.data[key] = value; } Entity.prototype.save = function() { var dfd = AD.sal.Deferred(); var _this = this; // a .create() will actually perform an .update() if // the entry is already found. So we can just perform // a .create() on both create/update operations. this.GR.Entity.create(this.type, this.data) .fail(function(err){ dfd.reject(err); }) .then(function(returnData) { // returnData is an instance of Entity with the data returned: // make sure returned data is reflected in our data copy EntityMerge(_this.data, returnData.data); // pass the updated data on dfd.resolve(returnData.data); }) return dfd; } //// LEFT OFF //// + test the returnData from the Entity.create() //// + implement EntityMerge //// + update LHRISRen.toGR() to create a new Entity and Entity.save() it //// + implement Entity.prototype.destroy()
appdevdesigns/globalRegistry-api
globalRegistry-api.js
JavaScript
gpl-3.0
21,811
package gostuff import ( "fmt" "log" "os" "os/exec" "runtime" ) //exports database(without Grandmaster games) to an .sql file as a hot backup //@param isTemplate If true then export template database func ExportDatabase(isTemplate bool) { problems, _ := os.OpenFile("logs/errors.txt", os.O_APPEND|os.O_WRONLY, 0666) defer problems.Close() log.SetOutput(problems) command := "mysqldump --databases gochess --ignore-table=gochess.grandmaster > ./../backup/gochessNoGrandmaster.sql" if isTemplate { command = "cd config && mysqldump --databases gochess --no-data > ./../backup/gochessTemplate.sql" } if runtime.GOOS == "windows" { _, err := exec.Command("cmd.exe", "/C", command).Output() if err != nil { log.Println(err) fmt.Println("Error in exporting database, please check logs") } } else { _, err := exec.Command("/bin/bash", "-c", command).Output() if err != nil { log.Println(err) fmt.Println("Error in exporting database, please check logs") } } } // zips up exported database func CompressDatabase() { result := compress("./backup/gochess.zip", []string{"./backup/gochess.sql"}) if result { fmt.Println("Exported database file succesfully compressed!") } } //imports the main gochess database, returns true if successful func importDatabase() bool { problems, _ := os.OpenFile("logs/errors.txt", os.O_APPEND|os.O_WRONLY, 0666) defer problems.Close() log.SetOutput(problems) result := unzip("./backup/gochess.zip", "./backup") if result == false { return false } if runtime.GOOS == "windows" { _, err := exec.Command("cmd.exe", "/C", "mysql < ./backup/gochess.sql").Output() if err != nil { log.Println(err) fmt.Println("Error in importing gochess database, please check logs") return false } } else { _, err := exec.Command("/bin/bash", "-c", "mysql < ./backup/gochess.sql").Output() if err != nil { log.Println(err) fmt.Println("Error in importing gochess database, please check logs") return false } } return true } //imports template database, returns true if sucessful func importTemplateDatabase() bool { problems, _ := os.OpenFile("logs/errors.txt", os.O_APPEND|os.O_WRONLY, 0666) defer problems.Close() log.SetOutput(problems) //determine which operating system to execute appropriate shell command if runtime.GOOS == "windows" { _, err := exec.Command("cmd.exe", "/C", "mysql < ./backup/gochessTemplate.sql").Output() if err != nil { log.Println(err) fmt.Println("Error in importing template database, please check logs") return false } } else { _, err := exec.Command("/bin/bash", "-c", "mysql < ./backup/gochessTemplate.sql").Output() if err != nil { log.Println(err) fmt.Println("Error in importing template database, please check logs") return false } } return true }
jonpchin/GoChess
gostuff/backup.go
GO
gpl-3.0
2,823
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.17929 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace rgbled.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()] internal 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)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("rgbled.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)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
zkemble/AVR-USB-RGB-LED-Controller
examples/win/rgbled/src/rgbled/Properties/Resources.Designer.cs
C#
gpl-3.0
2,777
/******************************************************************************* * * Copyright (C) 2014-2018 Greg McGarragh <mcgarragh@atm.ox.ac.uk> * * This source code is licensed under the GNU General Public License (GPL), * Version 3. See the file COPYING for more details. * ******************************************************************************/ #ifndef READ_WRITE_NAT_H #define READ_WRITE_NAT_H #include "external.h" #include "read_write.h" #ifdef __cplusplus extern "C" { #endif int seviri_get_dimens_nat(const char *filename, uint *i_line, uint *i_column, uint *n_lines, uint *n_columns, enum seviri_bounds bounds, uint line0, uint line1, uint column0, uint column1, double lat0, double lat1, double lon0, double lon1); int seviri_read_nat(const char *filename, struct seviri_data *d, uint n_bands, const uint *band_ids, enum seviri_bounds bounds, uint line0, uint line1, uint column0, uint column1, double lat0, double lat1, double lon0, double lon1); int seviri_write_nat(const char *filename, const struct seviri_data *d); #ifdef __cplusplus } #endif #endif /* READ_WRITE_NAT_H */
gmcgarragh/seviri_native_util
read_write_nat.h
C
gpl-3.0
1,264
<!DOCTYPE html> <!-- This has to come before any comments (or anything else). Otherwise it kills IE --> <!-- Copyright 2013 Tauran Wood --> <!-- 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/>. --> <!-- For info about changing the website (fixing bugs, etc.) see https://github.com/thirstyice/abe-site --> <html> <head> <meta charset="UTF-8"/> <title>Field hockey</title> <link rel="stylesheet" type="text/css" href="/b829/aberhart/universal/main.css"/> <script src="/b829/aberhart/universal/jquery-1.11.0.min.js"></script> <script src="/b829/aberhart/universal/js-cookie.js"></script> <script src="/b829/aberhart/universal/menu-importer.js"></script> <link rel="stylesheet" type="text/css" href="/b829/aberhart/universal/simpletabs.css"/> <script src="/b829/aberhart/universal/simpletabs.js"></script> <link rel="stylesheet" type="text/css" href="/b829/aberhart/departments/departments.css"/> </head> <body> <div id="cbe-header"></div> <div id="topmenu-import"></div> <div id="content"> <h2 class="centerAlign"> Field Hockey </h2> <div class="simpleTabs"> <ul class="simpleTabsNavigation"> <li><a>Junior Girls</a></li> <li><a>Senior Girls</a></li> </ul> <div class="simpleTabsContent"> <img class="teamImage" src="/b829/aberhart/departments/athletics/teams/fieldhockey-jr-girls.jpg"/> </div> <div class="simpleTabsContent"> <img class="teamImage" src="/b829/aberhart/departments/athletics/teams/fieldhockey-sr-girls.jpg"/> </div> <p class="teamInfoLink"><a href="http://calgaryhighschoolsports.ca/index.php">Schedules, Results and Standings (External link)</a></p> </div> </div> <div id="leftside"> <div id="areamenu"></div> </div> <div id="rightside"></div> <div id="footers"></div> </body> </html>
meebee70/abe-site
b829/aberhart/departments/athletics/teams/field-hockey.html
HTML
gpl-3.0
2,390
""" Configuration and utilities for all the X509 unit tests """ import os import sys from datetime import datetime from pytest import fixture # We use certificates stored in the same folder as this test file CERTDIR = os.path.join(os.path.dirname(__file__), "certs") HOSTCERT = os.path.join(CERTDIR, "host/hostcert.pem") HOSTKEY = os.path.join(CERTDIR, "host/hostkey.pem") USERCERT = os.path.join(CERTDIR, "user/usercert.pem") USERKEY = os.path.join(CERTDIR, "user/userkey.pem") VOMSPROXY = os.path.join(CERTDIR, "voms/proxy.pem") ENCRYPTEDKEY = os.path.join(CERTDIR, "key/encrypted_key_pass_0000.pem") ENCRYPTEDKEYPASS = "0000" CERTS = (HOSTCERT, USERCERT) CERTKEYS = (HOSTKEY, USERKEY) CERTCONTENTS = { "HOSTCERTCONTENT": """-----BEGIN CERTIFICATE----- MIIGQTCCBCmgAwIBAgICEAIwDQYJKoZIhvcNAQELBQAwVDEYMBYGA1UECgwPRElS QUMgQ29tcHV0aW5nMTgwNgYDVQQDDC9ESVJBQyBDb21wdXRpbmcgU2lnbmluZyBD ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xODA4MjIwOTE4MTdaFw0zNzEwMjEw OTE4MTdaMDkxGDAWBgNVBAoMD0RpcmFjIENvbXB1dGluZzENMAsGA1UECgwEQ0VS TjEOMAwGA1UEAwwFVk9Cb3gwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC AQDjV5Y6AQI61nZHy6hjr1MziFFeh/z1DdAgkPfiUnHQLxWtvXGcc4sX/tBcD6tv NKTzJCwyFVAML0WNTD/w480TUmGILlRtg+17qfSWfeCvDygSbGNINX+la0auEqY7 u5oXtwhFAEnqBe+6pzvgfTpzh8eOtBSrqgJUwMtaI81P6LQn5urIQbJ7hg9HKh9d AX+mR/mwxDTPpzTP6YT5oiqXE5hRaPAO6ibeGGduyphFiAwVzAV2B5UfB4tL8C/S eyPX7+70W+paHD7ffJaHLKFQjdA9q7EHRGbm068+aPRmNCKtl1ptgbYquVmp0DiO 5qOSq+LU2v8W5/y8W75DajyqGbJuMdo4zMjCvOafOvHHabOfYrOHcI6MNJx2Z6v/ G0C7mMVwcBPcuLkqtia2uPnzwDcwxVL3wK/uJiHHw3T6odmOE/6KxYM+SJf9weBf RFW/fCfkWYfEA1FJhncfDZPzwiJnQJTrRls367rwnNLH0VkvxDLOHY7Lhl+j1vwd dnjONYrKVMttf1IfFN5QdMX2rRrkLX2jZXXaJ4IBeVBWWPVmWj8e892dh2FpzZV8 8XE72y17YRx+uX7x/76p3J9H3vEI0Lj/53q3lxH/W3VRGnbac7tT7kvVoqeUaXc4 AQiIF2tlR2dtjHbOAA3Sl7KCxJBvad8yq7YSm2I58sQN1wIDAQABo4IBNjCCATIw CQYDVR0TBAIwADAzBglghkgBhvhCAQ0EJhYkT3BlblNTTCBHZW5lcmF0ZWQgU2Vy dmVyIENlcnRpZmljYXRlMB0GA1UdDgQWBBTLQlHIlgopkniwA7yxCpuQ68gYgTCB hAYDVR0jBH0we4AUBMIXrzhk4Ia/H8kAbpdvG7tOhx+hWKRWMFQxGDAWBgNVBAoM D0RJUkFDIENvbXB1dGluZzE4MDYGA1UEAwwvRElSQUMgQ29tcHV0aW5nIFNpZ25p bmcgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHmCCQCsvNC5K0fF2DAOBgNVHQ8BAf8E BAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMBsGA1UdEQQUMBKC BVZPQm94gglsb2NhbGhvc3QwDQYJKoZIhvcNAQELBQADggIBAB38IzhseSjULM80 ZdiG6GlYaOiBGIRglBJJqDeslhhei9upgn35yz64RqMoM4bFWSae0gFCMGNAdV5D IXUZiTfZIRKqN35zOEZvbAU/t5Hi70ted3DPOAXM4XaghnFGg26ZTB86Z6Dph33Q JLqNkqU8oaOfl1ET4TDoimpolQI0M82datPlhDe2EkvPjJaclNXKGZ0kX5gquZKK pTYe+cj/4E7AG9mAQTB9M6XXpx5i/E+NLkGLjCm05QZdblhLmJ4Mjj2iCGMOL/z2 /bhncJYVyceAAFG/fTb2Yk6uXo/yDakq3SfyrOpSy5/bcy5YVcaGOlah74ppB26l bO/cJWAOcTm6zroLzQteorJDif96EsSJj5fxGKDnSRcg+K+2sA3c+G/395FHn1qK RRlcNm/yIWySrkUjtbSkZHChSU5vfjwlIq5acV/XtkXJpY7L4scQ0AeFDKdIhbXx 8ajVwBrU/GzyMmw7+p0PVvzNFZSn006D6zI6DRwUcPp/NRNi1oxrnzv1XVZ/MtiW FNZgz+mnqpakOUAsCGt9YiElVFanmS7iMkqhobt54UlFXhfd+FQyRI2kSrW8kL8e Is33dZgJZTT/KSsG8e883ISBb5zDeN47pxjU5pF/uhk2/eBY1EwEevpYdQPokY0R Hia1xkpBKOPRY0BrSGCdEUT5+ict -----END CERTIFICATE----- """, "USERCERTCONTENT": """-----BEGIN CERTIFICATE----- MIIFszCCA5ugAwIBAgICEAEwDQYJKoZIhvcNAQELBQAwVDEYMBYGA1UECgwPRElS QUMgQ29tcHV0aW5nMTgwNgYDVQQDDC9ESVJBQyBDb21wdXRpbmcgU2lnbmluZyBD ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xODA4MjIwOTE1MTRaFw0zNzEwMjEw OTE1MTRaMDoxGDAWBgNVBAoMD0RpcmFjIENvbXB1dGluZzENMAsGA1UECgwEQ0VS TjEPMA0GA1UEAwwGTXJVc2VyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKC AgEAqfZnf9wK+a+qx8kfRlIaehzD2ix+6TKZJ+w9aBlh11b5cPfmIMOmTEXe8rD5 G6WKofOKNBiQ4vX2tEv7psYpetMwQ9R5ks67RN/YGFkzEEO7jzYFtWsS2jbsdHVf /2wejICPhABYP1sGaQbRWtcp690fZ97cM1c7AuN/fFZ9m3mAoop5Bc6p1hqWSXyZ ce/0J+/SjtrLeWY8yvMx4ztR+8wQG+hXEAifnT77zwxeH7pPkwj3IFpRozimTmaP g0wpwUJXUd8LpPnF6pBeZPMybJ4b4TfoddCXSF/wT7q9UfTKptcoLayFCLp+mNJI KkKUzm/1CBMFkhenzSP7uhjhu3Swr6SXlz1pEW7B9FFyyghLd7FMEuDIAu8ULqLA ATFR95p5ec3GbObV4OX4G1Up9f6vDle+qhwkQ81uWxebsaVWveUo38Hsl37dqxB9 IxNOC/nTQu58l3KnLodMOweCmDnzHFrC5V96pYrKOaFj2Ijg6TO5maQHo0hfwiAC FNIvYDb8AxNmDzOVAAZkd/Y0nbYeaO6/eNJzRiwJGKZMnXC3UpzRmIBenDTVMCjE O1ZjsXe0hwjS0/sRytZHN1jWztnMuYftu3BLUQJQL0cmkWvPGjXKBd9kHhuYjtZu +SEyLni+6VXJJCyR7/2kmlkq9UimB+RLA+EemW7Ik0oDI48CAwEAAaOBqDCBpTAJ BgNVHRMEAjAAMB0GA1UdDgQWBBRKwv3rLMXxY6XyF2JDa52CbJoTJDAfBgNVHSME GDAWgBQEwhevOGTghr8fyQBul28bu06HHzAOBgNVHQ8BAf8EBAMCBeAwEwYDVR0l BAwwCgYIKwYBBQUHAwIwMwYJYIZIAYb4QgENBCYWJE9wZW5TU0wgR2VuZXJhdGVk IENsaWVudCBDZXJ0aWZpY2F0ZTANBgkqhkiG9w0BAQsFAAOCAgEAOe2uEU17UWOU iDsZWLDVYC820sXcC19ijco9zNDVfCkKzPMKKPlEA56dY/Kt0cWAtiklPOiWEtKy bsM7ayZ2FEiPdBSd9P8qHYFMlbsXcyib5QXpdHebcipu9ORzp+hlFvTA1fFErDn+ nPW+xTCp19tdlrNywxDWXbB4KJZ/VxSVuT4lMZYn6wUOMFN/xj41evGqqQfJm+yT feW3n2ClDCDbk3br/3KY8eCPLUllZfdJgnN24SWrS4S0tBuOZt+hTt7LISPSPIix xXNsxLCXq7KsElIlzPPbMsdqDJ/lhDUoHPZZu9chi4t8F5JGkzcn1MOSmn5d74kx SYD1QTgvX77t0A1E7G55NYiZJTSjoaIQiQwBNEak7Oz9QCh+5qHwR/Np4vo4+d4p yuWxpzHHBuQrV6dDZ0mONBWx6gxpkFN42mt8EUd26faG7kebbeVoUt1VBTcp9HHH DKQq9loodgGokarycFeJ8l+ZMM93YoPPVlsijG6Jmn+UrZNzwbi5JcE731qEurGY U4kjpzpirauwCnOgSm7DwawNoilLFOSSh3/iZgDjMyhspGJ2FwXBlJm7wBWyS+0q TnsekqTamuTDTAPJRhb2LPVFl0L8+frk1gkpw4KTCzGw4rKW++EUjS1i09sq2Dv6 /fW/ybqxpROqmyLHbqEExj0/hPxPKPw= -----END CERTIFICATE----- """, } # This is not just a copy paste of the key file content. # The key file is an RSA key (PKCS1) # What PyGSI and M2Crypto will print are PKCS8 format. # To go from RSA to generic key: # openssl pkcs8 -topk8 -nocrypt -in privkey.pem # Look for 'BEGIN RSA PRIVATE KEY' in the link bellow # https://tls.mbed.org/kb/cryptography/asn1-key-structures-in-der-and-pem KEYCONTENTS_PKCS8 = { HOSTKEY: """-----BEGIN PRIVATE KEY----- MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDjV5Y6AQI61nZH y6hjr1MziFFeh/z1DdAgkPfiUnHQLxWtvXGcc4sX/tBcD6tvNKTzJCwyFVAML0WN TD/w480TUmGILlRtg+17qfSWfeCvDygSbGNINX+la0auEqY7u5oXtwhFAEnqBe+6 pzvgfTpzh8eOtBSrqgJUwMtaI81P6LQn5urIQbJ7hg9HKh9dAX+mR/mwxDTPpzTP 6YT5oiqXE5hRaPAO6ibeGGduyphFiAwVzAV2B5UfB4tL8C/SeyPX7+70W+paHD7f fJaHLKFQjdA9q7EHRGbm068+aPRmNCKtl1ptgbYquVmp0DiO5qOSq+LU2v8W5/y8 W75DajyqGbJuMdo4zMjCvOafOvHHabOfYrOHcI6MNJx2Z6v/G0C7mMVwcBPcuLkq tia2uPnzwDcwxVL3wK/uJiHHw3T6odmOE/6KxYM+SJf9weBfRFW/fCfkWYfEA1FJ hncfDZPzwiJnQJTrRls367rwnNLH0VkvxDLOHY7Lhl+j1vwddnjONYrKVMttf1If FN5QdMX2rRrkLX2jZXXaJ4IBeVBWWPVmWj8e892dh2FpzZV88XE72y17YRx+uX7x /76p3J9H3vEI0Lj/53q3lxH/W3VRGnbac7tT7kvVoqeUaXc4AQiIF2tlR2dtjHbO AA3Sl7KCxJBvad8yq7YSm2I58sQN1wIDAQABAoICAAtXAhpQlJDkw6+fG/4k76yB XzWs6NQ8ZSZKtOKoJB8zSgyJh5I7PTPsNO5ypaV9ZcDvC/lPkNeawAhlRkc4xbDy CgVl8jYoP39MofOjwcJZqjEJEQa4DG7u4+6o5XvTRsNqENKISiePNj8EOntfI7xB iJW4q9NIPqeFml8brBERVXMsFIf6pvF8ZWSyWDAmc/ySWIUVtGCrQXohds2Q5jj0 9EMTTe4gheHMK9Sd7GyDdb7cl2Ukya5rjOozx97i343U3QF5WD44bHZvW37QnhdL i5iX6NOo+M0IwBQH3jD+5r/r7cnKj5CgADX1Oez+2iflxQHDDrhQyA2JMftg4Dev xus6PsNUcsafhIsXlLP1Zx6dq1u3sBUw1s1TMaSP8g611tyiwrNqiaCR+WAd705Q EGWfp4ddRcuB2BvV6NDQb8Z+A9vTqmEW+yqQdtji9VlH0XcPEu8qwjeSw6IrE7UV dW/6HWKfRLoV+kajZwPkHHfS97/3T4jWPt3dZrEyT3T3Zno9hLbNFUXfDvvAqjOP PkOgSMjUl/92J7SOu/fiPHjl4klxmSrG0OE79CKUU3C7a8Id81AYFKgr+3XNUvwJ ZgjvKsHXDkoka8/y1YYeMEmH7dD4y02hd055mYfTIvYWdDIfaQcxvnCPvV7HUhpb JMzvx7hveyxsHpRMRgk5AoIBAQD/oed5cl5mwvt3QcenBhvwgzz2uOocs42MPzvp 77RCn5cur80pBTgez1GZFnWBZEu1ygwKsu7l9ES+szlAMs37yD0LbNALTVHNQdbH KZ7TyzY1vFQXyw730BvyKGVLnRm+/wuWnJuSDPGomATOon+ILDK5ps1NiYLpvbBR ogAdk+llpIk/sRuoTCVlY9BYfd/XSiHyUEtVzq6CtG75Gqq7/MGEKl1xVDyXip92 6+KNr2CN6+/0lwdVUVWKCJpjrD7Yk4BwOzeGKIIsdNIaG+fl5O9UNe/njb0+joM4 177Lf1oaaBjjHwpqi9q8B78ud0/Jl+xFGB1HOBrHV7n52w8zAoIBAQDjq0TtCByO HBdwn7Q/6JLMCU475dTs0DKBhbPfyK9GD26BTFccMcp8OuRX4S62Gkvq47s9UKAW 3R4x0ZFAkIHo+kxt9H4Sw8PPWDlVSbb6qf+rOhSPlEeW8nf6BJHreqMaWxTnzr+j cQRY4O9GvKv3Y/fWqOe/iToQKkhjtnmtGyRVdsRVKkUrW+Ly/oxaxxe9eXOkUTOd 4UXxxSMbic6GJ57HRAfDpNYrnhbIk6JXYeuuArJeFBFmJ8vd0Nwd99y/uQ19kaxb /F0km2zLI+2S+1j6I6p1dA7G2oA+K54er4jgGAF6guq1F/SVPO545x41YPkxGXNF qwEz5OCyy5bNAoIBADJoP5ewGLNUwXdbrj3eM4YyqsPP5MIyGbhNA8h2buowRAR9 wAvVrqJMqT9xsUwJdfBr3gICFJ+dkiy0dJaXLgz3CCqHk2KXJYk+8VYme94xlQf1 kfN7JAFztP8EPi0x1lDWQ/e3++lJyiE/kLsaSeGVLY90N8mRUxI6SFlgg3tRnlVf o3y+tMBz+2/JxdydPZVbVeRNNv29mqXFZJiUTJRzG8mu/OwK+0O6nwU5MFxV98kk fBWT7mtBdYeZeLAs19unAk2fL6yxsjGH+6IQXKL1iMfnNt5HEckTGwcLa+D+xMqu OjIW/dvSphgrwuQrvLz4yys4vRU9F/K09sQxEQcCggEBAMxFtXg/mO9hAR8KDD5z PJNZnhpcIum//DD+d9/IPotL+UiF6Hrhqd5BMPQwlSrK+Wbtoehn2Nvq1da5Q+x8 PDN/sOfPQPcxMxVtATQnCchqk31chWo2Du2+7Cslwo9X39Qb+OvsM0JAezgLymTb kChOR+cQca8HP1OVvJHK/e11tun/wDTx0lIPBdgk0GX60LAusrWyLe/wWkONL+zb frQcBHih75143rkQBT0+SaDBuSbOQJ/svZe9CUwiw/0XkbdsIFCUTePS0PexhLHX sKf6YWE+cwkjcsa08e/WTu8VbGg04c68fD60Gb11iDpulEoskimdvjG6N0AKkhma VdkCggEBAJC5Byfjk5SMFbH4uIP2yScQAJ3lwrNsxOgnnm6C5vANWqMEsXyH+Qcs lawDdGUmb0E/7eaYoxgsEq8OUPluZNVFgA3O9iZfyF49G36PvKGRBHtHkiE9n13n c85Ksre6haNHO4BboojNovPMF0bqvseAoWTPaCYjktBcqB1I8Y/EzApN+zuZQWCQ vhBLq/cZi5jOwECbR2LMebth521/4C/j2E3Ssy+5uTMlDFQh0yYZnaS8OaecQ0Hc qRk0GL7AI33fPBBPD7b/Ptc8HHeeB0F61vzIE2ZOJEwLDtHqQr5fZs7Qn9aiN7Nc CrerHYr0zdgIXTt+xus9RGGmZi1mfjI= -----END PRIVATE KEY----- """, USERKEY: """-----BEGIN PRIVATE KEY----- MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCp9md/3Ar5r6rH yR9GUhp6HMPaLH7pMpkn7D1oGWHXVvlw9+Ygw6ZMRd7ysPkbpYqh84o0GJDi9fa0 S/umxil60zBD1HmSzrtE39gYWTMQQ7uPNgW1axLaNux0dV//bB6MgI+EAFg/WwZp BtFa1ynr3R9n3twzVzsC4398Vn2beYCiinkFzqnWGpZJfJlx7/Qn79KO2st5ZjzK 8zHjO1H7zBAb6FcQCJ+dPvvPDF4fuk+TCPcgWlGjOKZOZo+DTCnBQldR3wuk+cXq kF5k8zJsnhvhN+h10JdIX/BPur1R9Mqm1ygtrIUIun6Y0kgqQpTOb/UIEwWSF6fN I/u6GOG7dLCvpJeXPWkRbsH0UXLKCEt3sUwS4MgC7xQuosABMVH3mnl5zcZs5tXg 5fgbVSn1/q8OV76qHCRDzW5bF5uxpVa95SjfweyXft2rEH0jE04L+dNC7nyXcqcu h0w7B4KYOfMcWsLlX3qliso5oWPYiODpM7mZpAejSF/CIAIU0i9gNvwDE2YPM5UA BmR39jSdth5o7r940nNGLAkYpkydcLdSnNGYgF6cNNUwKMQ7VmOxd7SHCNLT+xHK 1kc3WNbO2cy5h+27cEtRAlAvRyaRa88aNcoF32QeG5iO1m75ITIueL7pVckkLJHv /aSaWSr1SKYH5EsD4R6ZbsiTSgMjjwIDAQABAoICAC4S8/+/QOJq8pryNJ41h6Pu xFESmtzQsKAX9JWRu+pKU5iCO0pKf3xRvJyBySXrfGdmw+JXfn9oOhaqOm/9bCU1 tvHMWaColi+XltcS5zrTgbbS6D1D53psRTFU2E8/mhBwkXcxOLsEC/rQtFQx29Vq vibETWFFlmO0FE06jRZmm650Z1ZhrbyyvGbzdg1jBQcGhkffnCUux/AkeTOmUxU1 PnCyTVe1Xr+b4VtBeQqU0RmE5qlIkrTymHLMbr8jGHaha1ZwZpG0fCiYNl6bZuH3 AovNQiEeCMS/7T9P2h6rg3wy+1tWV0IEfGklKBb8saY8x2oG7g2qh/yecpECSb68 Cauh18mXJ5JsT6P8dwDoxTxR1/lImvOU2Nys7T7nEhXrls1Dc0tv6Emi37hNwihn vAnzXYx0MwIh0N85LrdbRtVM+dis2LLpDScVt9CHS+Vl0+qO9fsgDnUKYYGONYq+ MHjtDdTMB0DhxTNjaWOU0J1RgmlAFV63lx7iWs0twH44Fbylo6DYYkAiNGOUvpKD 7GNz/aooEtrTf/3GnHoB2UBdvsmI8RZ7TSXCsoCkldQRsJJnzjo5fxTyH8ufCeEh Umw+lmK2OFldkPSrVL8eBPV8QTECbJOyFQC8IpVy/QnJhZlDmgrOJAVtl6xjkaEf qPV2sLruhNBqxh2zgsMhAoIBAQDfXwQBa+sf1J6oOo872ev68aQ5Zx5bZWV6Vke/ sxjab/GiZ44A33TRTUpIermdR3zJ5D0B9vh6IW6tbuU3wBgJACjs9VjWFfb5T46M Z5FNtN3zNvxJ9YhbQ2RJc4GRzCNcGAquDecD9xUk91k9kI07UZKUIDywGA2OGKra USRdS8LqAfpAxANu3JvinlqTQFfOxT3AZY03UWmXJI9xXtgxX1KLB+46Luy5GIWs /BNFi1Nk12OHql19woMKpx4iw89cA3S26FjViuGX0g9domT+biatPNan96Refp4s /jTHOFZ4HuhmWGugb1J9yhcHEZp9XreUtbrm8Xm++16f9bdJAoIBAQDCyir3lw94 X0EfNE4dMO0KlQiYXobTxQ7y0aZdL9a58t5C0Pq5nTyvX7NcIyk2KcxhMjJDJC1M mVmQz2dvb3aJt+VKhVl2q0H/qSRI2Rp5QB5o7BlpszVkMt5CP36HZE7xz1LXZ+74 WMEsePkbn1GrRts/QsAy3iqmoBsy/fq8rqU3tXaajAzORb3KFNKkbdBX7nXnS8v+ xizWccKMTf0QuaLiC/Wcdi9vPB4UQogpa8vpAl8gM5YqaDs94eVpSv23UMhNrvAg V3tn7FNSQNh+ugnLBwNqwam95fBMteGUh4HapnoEDlOezE7qUwGAaTswk5TnxiON VIjpQlk2VkwXAoIBAQC1l4orGbABpZoCS/EsCCMXVKFc5V9BkDIqfcBAsXowAzfe /u7r+L4AdiRAvjzuBzME8t9CHKSurUVMC86fPzSLBK1AzskU6rBoyGur63quQK77 ziTWf50GDMiYCiY5AEty0DzGeZjomVOARPIw4bZflhZjA74yrqs+bQFhEPxOOIxS L59iTbg4xXKZjoE2GuYHvERSiHyAj1gXPuq6kQ+TO9pgGudqN8HNTIlIM3n7XKRE Y/KPVUpCNgLQg0I1oxiNxmV5WXT2zbxO77/8MEyIp8Ybqk0cKnBfPfKbw2Hm3/80 EnR+171PpZDboJKN9Zqx93GpnQBARenjAHpR8rG5AoIBAH1JnbNchUXONsvET830 zzJ0Q3AFtMD3SbMi59eeUoWN0im10t6aZRMEAhBsSTCeV+fYan3HAh/3rqU20ffa AKt6DdANz0pFwxCXEVCN27pLZIPmAD59VwUYtt5zioW5HhHoYQdNwWYZaD6bnNaI dfYtgA3DeG3/ef1sk7ILrD+6MWiQnjWviPkP4I/fLtE2FMDKDynzFcXMX8CasSCf dPtR+5NbT+IQHlh0mYA8funtfN1lehvzMk4adqhJ6M39vw0ut3dH4wlaW3Svi7Qn I1j3fh8JZsg+wlfzUsl0XyCyu/IQDAEZ2e0UyllrhFa82KZY9njRd8KKsfkehNUv UocCggEAGFGpLq8flL4lU4AnetR5Gs2BFaHBeqyGL1pWY1oPgF8jE/aNafIDs6Nq wMBIOQmekhEOxBf9Ti9qJDaTkTNyIiPFYS3/sm+thfqJFVMZX8LKnjSntSCp/pGD YELJ+GOYwOnqcni7psF4+cvxQmRkI1LHpIwiUOMniwcfPVCtoEHdJ5Pn0jFFkcAV VPWLyXcPH0WpgklFGvCNvvVthRkZTuT4Zy2QXgP6dfIK/2UAUDE6Uk1odkNyAtw9 d2tkfZjxzb8djGdcmTCbVzyRdkkhRsp/grQbg+qXfmiTlAyPE3uB5VFPJYcx5gJL oYjpqlB4Kj08eIAI5vcWnt/RcE1tLw== -----END PRIVATE KEY----- """, } # This contains the attributes of the certificates in order to be compared in the tests # If they are the same, they are directly at the root, otherwise, # they are in subdirectory CERT_ATTRS = { # Just take the date, it is the same for both "endDate": datetime.strptime("2037-10-21", "%Y-%m-%d").date(), "startDate": datetime.strptime("2018-08-22", "%Y-%m-%d").date(), "issuerDN": "/O=DIRAC Computing/CN=DIRAC Computing Signing Certification Authority", HOSTCERT: { "subjectDN": "/O=Dirac Computing/O=CERN/CN=VOBox", "serial": 4098, "availableExtensions": [ "authorityKeyIdentifier", "basicConstraints", "extendedKeyUsage", "keyUsage", "nsComment", "subjectAltName", "subjectKeyIdentifier", ], "basicConstraints": "CA:FALSE", "subjectAltName": "DNS:VOBox, DNS:localhost", "extendedKeyUsage": "TLS Web Server Authentication, TLS Web Client Authentication", "content": CERTCONTENTS["HOSTCERTCONTENT"], "keyFile": HOSTKEY, }, USERCERT: { "subjectDN": "/O=Dirac Computing/O=CERN/CN=MrUser", "serial": 4097, "availableExtensions": [ "authorityKeyIdentifier", "basicConstraints", "extendedKeyUsage", "keyUsage", "nsComment", "subjectKeyIdentifier", ], "basicConstraints": "CA:FALSE", "subjectAltName": "DNS:VOBox, DNS:localhost", "extendedKeyUsage": "TLS Web Client Authentication", "content": CERTCONTENTS["USERCERTCONTENT"], "keyFile": USERKEY, }, } VOMS_PROXY_ATTR = { "notBefore": datetime(2018, 10, 23, 9, 11, 44), "notAfter": datetime(2024, 7, 6, 17, 11, 44), "fqan": ["/fakevo/Role=user/Capability=NULL"], "vo": "fakevo", "subject": "/O=Dirac Computing/O=CERN/CN=MrUser", "issuer": "/O=Dirac Computing/O=CERN/CN=VOBox", } def getCertOption(cert, optionName): """Return a given option of a given certificate, taken from CERT_ATTRS :param cert: effectively, path to the certificate in question :param optionName: name of the options :returns: the option """ if optionName in CERT_ATTRS: return CERT_ATTRS[optionName] return CERT_ATTRS[cert][optionName] def deimportDIRAC(): """clean all what has already been imported from DIRAC. This method is extremely fragile, but hopefully, we can get ride of all these messy tests soon, when PyGSI has gone. """ if len(X509CHAINTYPES) != 1 or len(X509REQUESTTYPES) != 1: raise NotImplementedError( "This no longer de-imports DIRAC, if we want to test another SSL wrapper " "we will have to find another way of doing this or run a separate pytest " "process again" ) # for mod in list(sys.modules): # # You should be careful with what you remove.... # if (mod == 'DIRAC' or mod.startswith('DIRAC.')) and not mod.startswith('DIRAC.Core.Security.test'): # sys.modules.pop(mod) X509CHAINTYPES = ("M2_X509Chain",) # This fixture will return a pyGSI or M2Crypto X509Chain class # https://docs.pytest.org/en/latest/fixture.html#automatic-grouping-of-tests-by-fixture-instances @fixture(scope="function", params=X509CHAINTYPES) def get_X509Chain_class(request): """Fixture to return either the X509Certificate class. It also 'de-import' DIRAC before and after """ # Clean before deimportDIRAC() x509Class = request.param if x509Class == "M2_X509Chain": from DIRAC.Core.Security.m2crypto.X509Chain import X509Chain else: raise NotImplementedError() yield X509Chain # Clean after deimportDIRAC() X509REQUESTTYPES = ("M2_X509Request",) # This fixture will return a X509Request class # https://docs.pytest.org/en/latest/fixture.html#automatic-grouping-of-tests-by-fixture-instances @fixture(scope="function", params=X509REQUESTTYPES) def get_X509Request(request): """Fixture to return either the X509Request instance. It also 'de-import' DIRAC before and after """ # Clean before deimportDIRAC() x509Class = request.param if x509Class == "M2_X509Request": from DIRAC.Core.Security.m2crypto.X509Request import X509Request else: raise NotImplementedError() def _generateX509Request(): """Instanciate the object :returns: an X509Request instance """ return X509Request() yield _generateX509Request # Clean after deimportDIRAC() def get_X509Chain_from_X509Request(x509ReqObj): """This returns an X509Chain class from the same "type" as the X509Request object given as param :param x509ReqObj: instance of a X509Request object :returns: X509Chain class """ # In principle, we should deimport Dirac everywhere, but I am not even sure it makes any difference if "m2crypto" in x509ReqObj.__class__.__module__: from DIRAC.Core.Security.m2crypto.X509Chain import X509Chain else: raise NotImplementedError() return X509Chain
DIRACGrid/DIRAC
src/DIRAC/Core/Security/test/x509TestUtilities.py
Python
gpl-3.0
17,182
<?php namespace ApacheSolrForTypo3\Solr\Controller\Backend\Search; /* * This file is part of the TYPO3 CMS project. * * It is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, either version 2 * of the License, or any later version. * * For the full copyright and license information, please read the * LICENSE.txt file that was distributed with this source code. * * The TYPO3 project - inspiring people to share! */ use ApacheSolrForTypo3\Solr\System\Mvc\Backend\Component\Exception\InvalidViewObjectNameException; use ApacheSolrForTypo3\Solr\Utility\ManagedResourcesUtility; use Doctrine\DBAL\Driver\Exception as DBALDriverException; use Psr\Http\Message\ResponseInterface; use Throwable; use TYPO3\CMS\Core\Http\RedirectResponse; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3Fluid\Fluid\View\ViewInterface; /** * Manage Synonyms and Stop words in Backend Module * @property ResponseInterface $response */ class CoreOptimizationModuleController extends AbstractModuleController { /** * Set up the doc header properly here * * @param ViewInterface $view * @return void * @throws DBALDriverException * @throws InvalidViewObjectNameException * @throws Throwable * @noinspection PhpUnused */ protected function initializeView($view) { parent::initializeView($view); $this->generateCoreSelectorMenuUsingPageTree(); $coreOptimizationTabs = $this->moduleTemplate->getDynamicTabMenu([], 'coreOptimization'); $this->view->assign('tabs', $coreOptimizationTabs); } /** * Gets synonyms and stopwords for the currently selected core * * @return ResponseInterface * * @noinspection PhpUnused */ public function indexAction(): ResponseInterface { if ($this->selectedSolrCoreConnection === null) { $this->view->assign('can_not_proceed', true); return $this->getModuleTemplateResponse(); } $synonyms = []; $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); $rawSynonyms = $coreAdmin->getSynonyms(); foreach ($rawSynonyms as $baseWord => $synonymList) { $synonyms[$baseWord] = implode(', ', $synonymList); } $stopWords = $coreAdmin->getStopWords(); $this->view->assignMultiple([ 'synonyms' => $synonyms, 'stopWords' => implode(PHP_EOL, $stopWords), 'stopWordsCount' => count($stopWords) ]); return $this->getModuleTemplateResponse(); } /** * Add synonyms to selected core * * @param string $baseWord * @param string $synonyms * @param bool $overrideExisting * @return ResponseInterface * * @noinspection PhpUnused */ public function addSynonymsAction(string $baseWord, string $synonyms, bool $overrideExisting): ResponseInterface { if (empty($baseWord) || empty($synonyms)) { $this->addFlashMessage( 'Please provide a base word and synonyms.', 'Missing parameter', FlashMessage::ERROR ); } else { $baseWord = mb_strtolower($baseWord); $synonyms = mb_strtolower($synonyms); $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); if ($overrideExisting && $coreAdmin->getSynonyms($baseWord)) { $coreAdmin->deleteSynonym($baseWord); } $coreAdmin->addSynonym($baseWord, GeneralUtility::trimExplode(',', $synonyms, true)); $coreAdmin->reloadCore(); $this->addFlashMessage( '"' . $synonyms . '" added as synonyms for base word "' . $baseWord . '"' ); } return new RedirectResponse($this->uriBuilder->uriFor('index'), 303); } /** * @param string $fileFormat * @return ResponseInterface * * @noinspection PhpUnused */ public function exportStopWordsAction(string $fileFormat = 'txt'): ResponseInterface { $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); return $this->exportFile( implode(PHP_EOL, $coreAdmin->getStopWords()), 'stopwords', $fileFormat ); } /** * Exports synonyms to a download file. * * @param string $fileFormat * @return ResponseInterface * * @noinspection PhpUnused */ public function exportSynonymsAction(string $fileFormat = 'txt'): ResponseInterface { $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); $synonyms = $coreAdmin->getSynonyms(); return $this->exportFile(ManagedResourcesUtility::exportSynonymsToTxt($synonyms), 'synonyms', $fileFormat); } /** * @param array $synonymFileUpload * @param bool $overrideExisting * @param bool $deleteSynonymsBefore * @return ResponseInterface * * @noinspection PhpUnused */ public function importSynonymListAction( array $synonymFileUpload, bool $overrideExisting = false, bool $deleteSynonymsBefore = false ): ResponseInterface { if ($deleteSynonymsBefore) { $this->deleteAllSynonyms(); } $fileLines = ManagedResourcesUtility::importSynonymsFromPlainTextContents($synonymFileUpload); $synonymCount = 0; $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); foreach ($fileLines as $baseWord => $synonyms) { if (!isset($baseWord) || empty($synonyms)) { continue; } $this->deleteExistingSynonym($overrideExisting, $deleteSynonymsBefore, $baseWord); $coreAdmin->addSynonym($baseWord, $synonyms); $synonymCount++; } $coreAdmin->reloadCore(); $this->addFlashMessage( $synonymCount . ' synonyms imported.' ); return new RedirectResponse($this->uriBuilder->uriFor('index'), 303); } /** * @param array $stopwordsFileUpload * @param bool $replaceStopwords * * @return ResponseInterface * * @noinspection PhpUnused */ public function importStopWordListAction(array $stopwordsFileUpload, bool $replaceStopwords): ResponseInterface { $this->saveStopWordsAction( ManagedResourcesUtility::importStopwordsFromPlainTextContents($stopwordsFileUpload), $replaceStopwords ); return new RedirectResponse($this->uriBuilder->uriFor('index'), 303); } /** * Delete complete synonym list * * @return ResponseInterface * * @noinspection PhpUnused */ public function deleteAllSynonymsAction(): ResponseInterface { $allSynonymsCouldBeDeleted = $this->deleteAllSynonyms(); $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); $reloadResponse = $coreAdmin->reloadCore(); if ($allSynonymsCouldBeDeleted && $reloadResponse->getHttpStatus() == 200 ) { $this->addFlashMessage( 'All synonym removed.' ); } else { $this->addFlashMessage( 'Failed to remove all synonyms.', 'An error occurred', FlashMessage::ERROR ); } return new RedirectResponse($this->uriBuilder->uriFor('index'), 303); } /** * Deletes a synonym mapping by its base word. * * @param string $baseWord Synonym mapping base word * * @return ResponseInterface * * @noinspection PhpUnused */ public function deleteSynonymsAction(string $baseWord): ResponseInterface { $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); $deleteResponse = $coreAdmin->deleteSynonym($baseWord); $reloadResponse = $coreAdmin->reloadCore(); if ($deleteResponse->getHttpStatus() == 200 && $reloadResponse->getHttpStatus() == 200 ) { $this->addFlashMessage( 'Synonym removed.' ); } else { $this->addFlashMessage( 'Failed to remove synonym.', 'An error occurred', FlashMessage::ERROR ); } return new RedirectResponse($this->uriBuilder->uriFor('index'), 303); } /** * Saves the edited stop word list to Solr * * @param string $stopWords * @param bool $replaceStopwords * * @return ResponseInterface * * @noinspection PhpUnused */ public function saveStopWordsAction(string $stopWords, bool $replaceStopwords = true): ResponseInterface { // lowercase stopword before saving because terms get lowercased before stopword filtering $newStopWords = mb_strtolower($stopWords); $newStopWords = GeneralUtility::trimExplode("\n", $newStopWords, true); $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); $oldStopWords = $coreAdmin->getStopWords(); if ($replaceStopwords) { $removedStopWords = array_diff($oldStopWords, $newStopWords); $wordsRemoved = $this->removeStopsWordsFromIndex($removedStopWords); } else { $wordsRemoved = true; } $wordsAdded = true; $addedStopWords = array_diff($newStopWords, $oldStopWords); if (!empty($addedStopWords)) { $wordsAddedResponse = $coreAdmin->addStopWords($addedStopWords); $wordsAdded = ($wordsAddedResponse->getHttpStatus() == 200); } $reloadResponse = $coreAdmin->reloadCore(); if ($wordsRemoved && $wordsAdded && $reloadResponse->getHttpStatus() == 200) { $this->addFlashMessage( 'Stop Words Updated.' ); } return new RedirectResponse($this->uriBuilder->uriFor('index'), 303); } /** * @param string $content * @param string $type * @param string $fileExtension * * @return ResponseInterface */ protected function exportFile(string $content, string $type = 'synonyms', string $fileExtension = 'txt'): ResponseInterface { $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); return $this->responseFactory->createResponse() ->withHeader('Content-Type', 'text/plain; charset=utf-8') ->withHeader('Cache-control', 'public') ->withHeader('Content-Description', 'File transfer') ->withHeader('Content-Description', 'File transfer') ->withHeader( 'Content-disposition', 'attachment; filename =' . $type . '_' . $coreAdmin->getPrimaryEndpoint()->getCore() . '.' . $fileExtension ) ->withBody($this->streamFactory->createStream($content)); } /** * Delete complete synonym list form solr * * @return bool */ protected function deleteAllSynonyms(): bool { $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); $synonyms = $coreAdmin->getSynonyms(); $allSynonymsCouldBeDeleted = true; foreach ($synonyms as $baseWord => $synonym) { $deleteResponse = $coreAdmin->deleteSynonym($baseWord); $allSynonymsCouldBeDeleted = $allSynonymsCouldBeDeleted && $deleteResponse->getHttpStatus() == 200; } return $allSynonymsCouldBeDeleted; } /** * @param $stopwordsToRemove * @return bool */ protected function removeStopsWordsFromIndex($stopwordsToRemove): bool { $wordsRemoved = true; $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); foreach ($stopwordsToRemove as $word) { $response = $coreAdmin->deleteStopWord($word); if ($response->getHttpStatus() != 200) { $wordsRemoved = false; $this->addFlashMessage( 'Failed to remove stop word "' . $word . '".', 'An error occurred', FlashMessage::ERROR ); break; } } return $wordsRemoved; } /** * Delete synonym entry if selected before * @param bool $overrideExisting * @param bool $deleteSynonymsBefore * @param string $baseWord */ protected function deleteExistingSynonym(bool $overrideExisting, bool $deleteSynonymsBefore, string $baseWord) { $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); if (!$deleteSynonymsBefore && $overrideExisting && $coreAdmin->getSynonyms($baseWord) ) { $coreAdmin->deleteSynonym($baseWord); } } }
dkd-kaehm/ext-solr
Classes/Controller/Backend/Search/CoreOptimizationModuleController.php
PHP
gpl-3.0
13,006
<?php /** * Event related classes */ namespace pocketmine\event; abstract class Event { /** * Any callable event must declare the static variable * * public static $handlerList = null; * public static $eventPool = []; * public static $nextEvent = 0; * * Not doing so will deny the proper event initialization */ protected $eventName = null; private $isCancelled = false; /** * @return string */ final public function getEventName() { return $this->eventName === null ? get_class($this) : $this->eventName; } /** * @return bool * * @throws \BadMethodCallException */ public function isCancelled() { if (!($this instanceof Cancellable)) { throw new \BadMethodCallException("Event is not Cancellable"); } /** @var Event $this */ return $this->isCancelled === true; } /** * @param bool $value * * @return bool * * @throws \BadMethodCallException */ public function setCancelled($value = true) { if (!($this instanceof Cancellable)) { throw new \BadMethodCallException("Event is not Cancellable"); } /** @var Event $this */ $this->isCancelled = (bool) $value; } /** * @return HandlerList */ public function getHandlers() { if (static::$handlerList === null) { static::$handlerList = new HandlerList(); } return static::$handlerList; } }
ISRAPIL/FastCorePE
src/pocketmine/event/Event.php
PHP
gpl-3.0
1,548
using System; using System.ComponentModel; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using PropertyChanged; #pragma warning disable CS0067 namespace pEngine.Framework { /// <summary> /// pEngine framework base object. /// </summary> public partial class pObject : INotifyPropertyChanged, IDisposable { /// <summary> /// True if this object is disposed. /// </summary> public bool Disposed { get; private set; } /// <summary> /// Makes a new instance of <see cref="pObject"/> class. /// </summary> public pObject() { initializeBinding(); initializeValidations(); initializeCacheModule(); } /// <summary> /// Dispose all resources used from this class. /// </summary> ~pObject() { Dispose(false); } /// <summary> /// Dispose all resources used from this class. /// </summary> public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } /// <summary> /// Dispose all resources used from this class. /// </summary> /// <param name="disposing">Dispose managed resources.</param> protected virtual void Dispose(bool disposing) { if (Disposed) return; if (disposing) { disposeBinding(); disposeCacheModule(); } // Free any unmanaged objects here. // Disposed = true; } /// <summary> /// Triggered on a property change. /// </summary> public event PropertyChangedEventHandler PropertyChanged; } }
PizzaKun/pEngine
pEngine/Framework/pObject.cs
C#
gpl-3.0
1,563
#include "../../shogi.h" #ifdef YANEURAOU_CLASSIC_TCE_ENGINE // ----------------------- // やねうら王classic-tce探索部 // ----------------------- // 開発方針 // やねうら王classicからの改造 // 持ち時間制御(秒読み、フィッシャールールに対応)、ponderの機能を追加したものです。 // tce = time control enabledの意味 // mate1ply()を呼び出すのか #define USE_MATE_1PLY // futilityのmarginを動的に決定するのか // #define DYNAMIC_FUTILITY_MARGIN #include <sstream> #include <iostream> #include <fstream> #include <algorithm> #include <iomanip> #include "../../position.h" #include "../../search.h" #include "../../thread.h" #include "../../misc.h" #include "../../tt.h" #include "../../extra/book/book.h" #include "../../move_picker.h" using namespace std; using namespace Search; using namespace Eval; // USIに追加オプションを設定したいときは、この関数を定義すること。 // USI::init()のなかからコールバックされる。 void USI::extra_option(USI::OptionsMap & o) { // // 定跡設定 // // 実現確率の低い狭い定跡を選択しない o["NarrowBook"] << Option(false); // 定跡の指し手を何手目まで用いるか o["BookMoves"] << Option(16, 0, 10000); // // パラメーターの外部からの自動調整 // o["Param1"] << Option(0, 0, 100000); o["Param2"] << Option(0, 0, 100000); } namespace YaneuraOuClassicTce { // 外部から調整される探索パラメーター int param1 = 0; int param2 = 0; // 定跡等で用いる乱数 PRNG prng; // Ponder用の指し手 Move ponder_candidate; // ----------------------- // 探索用の定数 // ----------------------- // 探索しているnodeの種類 // Rootはここでは用意しない。Rootに特化した関数を用意するのが少し無駄なので。 enum NodeType { PV, NonPV }; // Razoringのdepthに応じたマージン値 // ※ この値、あとで調整すべき。 const Value razor_margin(Depth d) { static_assert(ONE_PLY == 2,"static_assert ONE_PLY == 2"); ASSERT_LV3(DEPTH_ZERO <= d && d < 4 * ONE_PLY); return (Value)(512 + 16 * static_cast<int>(d)); } #ifdef DYNAMIC_FUTILITY_MARGIN // 64個分のfutility marginを足したもの Value futility_margin_sum; // game ply(≒進行度)とdepth(残り探索深さ)に応じたfutility margin。 Value futility_margin(Depth d, int game_ply) { // 64は64個のサンプリングをしているから。 // 平均値をmaringとすると小さすぎるので(40%ぐらいが危険な枝刈りになる) // そこから分散をσとして3σぐらいの範囲にしたいが、分散は平均に比例すると仮定して、 // 結局、3σ≒ 平均(= futility_margin_sum/64 )×適当な係数。 return (20 + (param1 - 1) * 2) * futility_margin_sum * (int)d / ONE_PLY / (64 * 8); } #else // game ply(≒進行度)とdepth(残り探索深さ)に応じたfutility margin。 Value futility_margin(Depth d, int game_ply) { return Value(d * 90); } #endif // 残り探索depthが少なくて、王手がかかっていなくて、王手にもならないような指し手を // 枝刈りしてしまうためのmoveCountベースのfutilityで用いるテーブル // [improving][残りdepth] int FutilityMoveCounts[2][16 * (int)ONE_PLY]; // 探索深さを減らすためのReductionテーブル // [PvNodeであるか][improvingであるか][このnodeで何手目の指し手であるか][残りdepth] Depth reduction_table[2][2][64][64]; // 残り探索深さをこの深さだけ減らす。depthとmove_countに関して63以上は63とみなす。 // improvingとは、評価値が2手前から上がっているかのフラグ。上がっていないなら // 悪化していく局面なので深く読んでも仕方ないからreduction量を心もち増やす。 template <bool PvNode> Depth reduction(bool improving, Depth depth, int move_count) { return reduction_table[PvNode][improving][std::min((int)depth / ONE_PLY, 63)][std::min(move_count, 63)]; } // ----------------------- // EasyMoveの判定用 // ----------------------- // EasyMoveManagerは、"easy move"を検出するのに用いられる。 // PVが、複数の探索iterationにおいて安定しているとき、即座にbest moveを返すことが出来る。 struct EasyMoveManager { void clear() { stableCnt = 0; expectedPosKey = 0; pv[0] = pv[1] = pv[2] = MOVE_NONE; } // 前回の探索からPVで2手進んだ局面であるかを判定するのに用いる。 Move get(Key key) const { return expectedPosKey == key ? pv[2] : MOVE_NONE; } void update(Position& pos, const std::vector<Move>& newPv) { ASSERT_LV3(newPv.size() >= 3); // pvの3手目以降が変化がない回数をカウントしておく。 stableCnt = (newPv[2] == pv[2]) ? stableCnt + 1 : 0; if (!std::equal(newPv.begin(), newPv.begin() + 3, pv)) { std::copy(newPv.begin(), newPv.begin() + 3, pv); StateInfo st[2]; pos.do_move(newPv[0], st[0]); pos.do_move(newPv[1], st[1]); expectedPosKey = pos.state()->key(); pos.undo_move(newPv[1]); pos.undo_move(newPv[0]); } } int stableCnt; Key expectedPosKey; Move pv[3]; }; EasyMoveManager EasyMove; // ----------------------- // lazy SMPで用いるテーブル // ----------------------- // 各行のうち、半分のbitを1にして、残り半分を1にする。 // これは探索スレッドごとの反復深化のときのiteration深さを割り当てるのに用いる。 // 16個のスレッドがあるとして、このスレッドをそれぞれ、 // depth : 8個 // depth+1 : 4個 // depth+2 : 2個 // depth+3 : 1個 // のように先細るように割り当てたい。 // ゆえに、反復深化のループで // if (table[thread_id][ rootDepth ]) このdepthをskip; // のように書けるテーブルがあると都合が良い。 typedef std::vector<int> Row; const Row HalfDensity[] = { // 0番目のスレッドはmain threadだとして。 { 0, 1 }, // 1番目のスレッド用 { 1, 0 }, // 2番目のスレッド用 { 0, 0, 1, 1 }, // 3番目のスレッド用 { 0, 1, 1, 0 }, // (以下略) { 1, 1, 0, 0 }, { 1, 0, 0, 1 }, { 0, 0, 0, 1, 1, 1 }, { 0, 0, 1, 1, 1, 0 }, { 0, 1, 1, 1, 0, 0 }, { 1, 1, 1, 0, 0, 0 }, { 1, 1, 0, 0, 0, 1 }, { 1, 0, 0, 0, 1, 1 }, { 0, 0, 0, 0, 1, 1, 1, 1 }, { 0, 0, 0, 1, 1, 1, 1, 0 }, { 0, 0, 1, 1, 1, 1, 0 ,0 }, { 0, 1, 1, 1, 1, 0, 0 ,0 }, { 1, 1, 1, 1, 0, 0, 0 ,0 }, { 1, 1, 1, 0, 0, 0, 0 ,1 }, { 1, 1, 0, 0, 0, 0, 1 ,1 }, { 1, 0, 0, 0, 0, 1, 1 ,1 }, }; const size_t HalfDensitySize = std::extent<decltype(HalfDensity)>::value; // ----------------------- // Statsのupdate // ----------------------- // MovePickerで用いる直前の指し手に対するそれぞれの指し手のスコア CounterMoveHistoryStat CounterMoveHistory; // 直前のnodeの指し手で動かした駒(移動後の駒)とその移動先の升を返す。 // この実装においてmoved_piece()は使えない。これは現在のPosition::side_to_move()の駒が返るからである。 // 駒打ちのときは、駒打ちの駒(+32した駒)が返る。 #define sq_pc_from_move(sq,pc,move) \ { \ sq = move_to(move); \ pc = Piece(pos.piece_on(sq) + (is_drop(move) ? 32 : 0)); \ } // いい探索結果だったときにkiller等を更新する // move = これが良かった指し手 // quiets = 悪かった指し手(このnodeで生成した指し手) // quietsCnt = ↑の数 inline void update_stats(const Position& pos, Stack* ss, Move move, Depth depth, Move* quiets, int quietsCnt) { // IID、null move、singular extensionの判定のときは浅い探索なのでこのときに // killer等を更新するのは有害である。 if (ss->skipEarlyPruning) { // しかしkillerがないときはkillerぐらいは登録したほうが少しだけ得かも。 if (ss->killers[0] == MOVE_NONE) ss->killers[0] = move; else if (ss->killers[1] == MOVE_NONE) ss->killers[1] = move; return; } // killerのupdate // killer 2本しかないので[0]と違うならいまの[0]を[1]に降格させて[0]と差し替え if (ss->killers[0] != move) { ss->killers[1] = ss->killers[0]; ss->killers[0] = move; } // historyのupdate // depthの二乗に比例したbonusをhistory tableに加算する。 Value bonus = Value((int)depth*(int)depth / ((int)ONE_PLY*(int)ONE_PLY) + (int)depth / (int)ONE_PLY + 1); // 直前に移動させた升(その升に移動させた駒がある。今回の指し手はcaptureではないはずなので) // 駒打ちの場合は+32した駒 Square prevSq, prevPrevSq; Piece prevPc, prevPrevPc; sq_pc_from_move(prevSq , prevPc , (ss - 1)->currentMove); sq_pc_from_move(prevPrevSq, prevPrevPc, (ss - 2)->currentMove); ASSERT_LV3(move != MOVE_NULL); auto& cmh = CounterMoveHistory[prevSq][prevPc]; auto& fmh = CounterMoveHistory[prevPrevSq][prevPrevPc]; auto thisThread = pos.this_thread(); Piece mpc = pos.moved_piece_after(move); thisThread->history.update(mpc, move_to(move), bonus); if (is_ok((ss - 1)->currentMove)) { // counter moveだが、移動させた駒を上位16バイトのほうに保持しておく。 thisThread->counterMoves.update(prevPc, prevSq, move ); cmh.update(mpc, move_to(move), bonus); } if (is_ok((ss - 2)->currentMove)) fmh.update(mpc, move_to(move), bonus); // このnodeのベストの指し手以外の指し手はボーナス分を減らす for (int i = 0; i < quietsCnt; ++i) { Piece qpc = pos.moved_piece_after(quiets[i]); thisThread->history.update(qpc, move_to(quiets[i]), -bonus); // 前の局面の指し手がMOVE_NULLでないならcounter moveもupdateしておく。 if (is_ok((ss - 1)->currentMove)) cmh.update(qpc, move_to(quiets[i]), -bonus); if (is_ok((ss - 2)->currentMove)) fmh.update(qpc, move_to(quiets[i]), -bonus); } // さらに、1手前で置換表の指し手が反駁されたときは、追加でペナルティを与える。 // 1手前は置換表の指し手であるのでNULL MOVEではありえない。 if ((ss - 1)->moveCount == 1 && !pos.captured_piece() && is_ok((ss - 2)->currentMove)) { // 直前がcaptureではないから、2手前に動かした駒は捕獲されずに盤上にあるはずであり、 // その升の駒を盤から取り出すことが出来る。 auto& prevCmh = CounterMoveHistory[prevPrevSq][prevPrevPc]; prevCmh.update(prevPc, prevSq, -bonus - 2 * (depth + 1) / ONE_PLY); } } // 残り時間をチェックして、時間になっていればSignals.stopをtrueにする。 void check_time() { // 1秒ごとにdbg_print()を呼び出す処理。 // dbg_print()は、dbg_hit_on()呼び出しによる統計情報を表示する。 static TimePoint lastInfoTime = now(); TimePoint tick = now(); // 1秒ごとに if (tick - lastInfoTime >= 1000) { lastInfoTime = tick; dbg_print(); } // ponder中においては、GUIがstopとかponderhitとか言ってくるまでは止まるべきではない。 if (Limits.ponder) return; // "ponderhit"時は、そこからの経過時間で考えないと、elapsed > Time.maximum()になってしまう。 // elapsed_from_ponderhit()は、"ponderhit"していないときは"go"コマンドからの経過時間を返すのでちょうど良い。 int elapsed = Time.elapsed_from_ponderhit(); // 今回のための思考時間を完璧超えているかの判定。 // 反復深化のループ内で、そろそろ終了して良い頃合いになると、Time.search_endに停止させて欲しい時間が代入される。 if ((Limits.use_time_management() && ( elapsed > Time.maximum() - 10 || (Time.search_end > 0 && elapsed > Time.search_end - 10))) || (Limits.movetime && elapsed >= Limits.movetime) || (Limits.nodes && Threads.nodes_searched() >= (uint64_t)Limits.nodes)) Signals.stop = true; } // ----------------------- // 静止探索 // ----------------------- // search()で残り探索深さが0以下になったときに呼び出される。 // (より正確に言うなら、残り探索深さがONE_PLY未満になったときに呼び出される) // InCheck : 王手がかかっているか template <NodeType NT, bool InCheck> Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) { // ----------------------- // 変数宣言 // ----------------------- // PV nodeであるか。 const bool PvNode = NT == PV; ASSERT_LV3(InCheck == !!pos.checkers()); ASSERT_LV3(-VALUE_INFINITE<=alpha && alpha < beta && beta <= VALUE_INFINITE); ASSERT_LV3(PvNode || alpha == beta - 1); ASSERT_LV3(depth <= DEPTH_ZERO); // PV求める用のbuffer // (これnonPVでは不要なので、nonPVでは参照していないの削除される。) Move pv[MAX_PLY + 1]; // 評価値の最大を求めるために必要なもの Value bestValue; // この局面での指し手のベストなスコア(alphaとは違う) Move bestMove; // そのときの指し手 Value oldAlpha; // 関数が呼び出されたときのalpha値 Value futilityBase; // futility pruningの基準となる値 // hash key関係 TTEntry* tte; // 置換表にhitしたときの置換表のエントリーへのポインタ Key posKey; // この局面のhash key bool ttHit; // 置換表にhitしたかのフラグ Move ttMove; // 置換表に登録されていた指し手 Value ttValue; // 置換表に登録されていたスコア Depth ttDepth; // このnodeに関して置換表に登録するときの残り探索深さ // 王手関係 bool givesCheck; // MovePickerから取り出した指し手で王手になるか // ----------------------- // nodeの初期化 // ----------------------- if (PvNode) { // PV nodeではalpha値を上回る指し手が存在した場合は(そこそこ指し手を調べたので)置換表にはBOUND_EXACTで保存したいから、 // そのことを示すフラグとして元の値が必要(non PVではこの変数は参照しない) // PV nodeでalpha値を上回る指し手が存在しなかった場合は、調べ足りないのかも知れないからBOUND_UPPERとしてbestValueを保存しておく。 oldAlpha = alpha; // PvNodeのときしかoldAlphaを初期化していないが、PvNodeのときしか使わないのでこれは問題ない。 (ss + 1)->pv = pv; ss->pv[0] = MOVE_NONE; } ss->currentMove = bestMove = MOVE_NONE; // rootからの手数 ss->ply = (ss - 1)->ply + 1; // ----------------------- // 最大手数へ到達したか? // ----------------------- if (pos.game_ply() > Limits.max_game_ply) return draw_value(REPETITION_DRAW, pos.side_to_move()); // ----------------------- // 置換表のprobe // ----------------------- // 置換表に登録するdepthは、あまりマイナスの値が登録されてもおかしいので、 // 王手がかかっているときは、DEPTH_QS_CHECKS(=0)、王手がかかっていないときはDEPTH_QS_NO_CHECKSの深さとみなす。 ttDepth = InCheck || depth >= DEPTH_QS_CHECKS ? DEPTH_QS_CHECKS : DEPTH_QS_NO_CHECKS; posKey = pos.state()->key(); tte = TT.probe(posKey, ttHit); ttMove = ttHit ? pos.move16_to_move(tte->move()) : MOVE_NONE; ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE; // nonPVでは置換表の指し手で枝刈りする // PVでは置換表の指し手では枝刈りしない(前回evaluateした値は使える) if (!PvNode && ttHit && tte->depth() >= ttDepth && ttValue != VALUE_NONE // 置換表から取り出したときに他スレッドが値を潰している可能性があるのでこのチェックが必要 && (ttValue >= beta ? (tte->bound() & BOUND_LOWER) : (tte->bound() & BOUND_UPPER))) // ttValueが下界(真の評価値はこれより大きい)もしくはジャストな値で、かつttValue >= beta超えならbeta cutされる // ttValueが上界(真の評価値はこれより小さい)だが、tte->depth()のほうがdepthより深いということは、 // 今回の探索よりたくさん探索した結果のはずなので、今回よりは枝刈りが甘いはずだから、その値を信頼して // このままこの値でreturnして良い。 { ss->currentMove = ttMove; // MOVE_NONEでありうるが return ttValue; } // ----------------------- // 宣言勝ち // ----------------------- { // 王手がかかってようがかかってまいが、宣言勝ちの判定は正しい。 // (トライルールのとき王手を回避しながら入玉することはありうるので) Move m = pos.DeclarationWin(); if (m != MOVE_NONE) { bestValue = mate_in(ss->ply + 1); // 1手詰めなのでこの次のnodeで(指し手がなくなって)詰むという解釈 tte->save(posKey, value_to_tt(bestValue, ss->ply), BOUND_EXACT, DEPTH_MAX, m, ss->staticEval, TT.generation()); return bestValue; } } // ----------------------- // eval呼び出し // ----------------------- if (InCheck) { // 王手がかかっているならすべての指し手を調べるべきなのでevaluate()は呼び出さない。 ss->staticEval = VALUE_NONE; // bestValueはalphaとは違う。 // 王手がかかっているときは-VALUE_INFINITEを初期値として、すべての指し手を生成してこれを上回るものを探すので // alphaとは区別しなければならない。 bestValue = futilityBase = -VALUE_INFINITE; } else { // 王手がかかっていないなら置換表の指し手を持ってくる if (ttHit) { // 置換表に評価値が格納されているとは限らないのでその場合は評価関数の呼び出しが必要 // bestValueの初期値としてこの局面のevaluate()の値を使う。これを上回る指し手があるはずなのだが.. if ((bestValue = tte->eval()) == VALUE_NONE) bestValue = evaluate(pos); ss->staticEval = bestValue; // 置換表に格納されていたスコアは、この局面で今回探索するものと同等か少しだけ劣るぐらいの // 精度で探索されたものであるなら、それをbestValueの初期値として使う。 if (ttValue != VALUE_NONE) if (tte->bound() & (ttValue > bestValue ? BOUND_LOWER : BOUND_UPPER)) bestValue = ttValue; } else { // 置換表がhitしなかった場合、bestValueの初期値としてevaluate()を呼び出すしかないが、 // NULL_MOVEの場合は前の局面での値を反転させると良い。(手番を考慮しない評価関数であるなら) // NULL_MOVEしているということは王手がかかっていないということであり、staticEvalの値は取り出せるはず。 ss->staticEval = bestValue = (ss - 1)->currentMove != MOVE_NULL ? evaluate(pos) : -(ss - 1)->staticEval; } // Stand pat. // 現在のbestValueは、この局面で何も指さないときのスコア。recaptureすると損をする変化もあるのでこのスコアを基準に考える。 // 王手がかかっていないケースにおいては、この時点での静的なevalの値がbetaを上回りそうならこの時点で帰る。 if (bestValue >= beta) { if (!ttHit) tte->save(posKey, value_to_tt(bestValue, ss->ply), BOUND_LOWER, DEPTH_NONE, MOVE_NONE, ss->staticEval, TT.generation()); return bestValue; } // ----------------------- // 一手詰め判定 // ----------------------- #ifdef USE_MATE_1PLY Move m = pos.mate1ply(); if (m != MOVE_NONE) { bestValue = mate_in(ss->ply+1); // 1手詰めなのでこの次のnodeで(指し手がなくなって)詰むという解釈 tte->save(posKey, value_to_tt(bestValue, ss->ply), BOUND_EXACT, DEPTH_MAX, m, ss->staticEval, TT.generation()); return bestValue; } #endif // 王手がかかっていなくてPvNodeでかつ、bestValueがalphaより大きいならそれをalphaの初期値に使う。 // 王手がかかっているなら全部の指し手を調べたほうがいい。 if (PvNode && bestValue > alpha) alpha = bestValue; // futilityの基準となる値をbestValueにmargin値を加算したものとして、 // これを下回るようであれば枝刈りする。 futilityBase = bestValue + 128; } // ----------------------- // 1手ずつ調べる // ----------------------- // 取り合いの指し手だけ生成する // searchから呼び出された場合、直前の指し手がMOVE_NULLであることがありうるが、 // 静止探索の1つ目の深さではrecaptureを生成しないならこれは問題とならない。 // ToDo: あとでNULL MOVEを実装したときにrecapture以外も生成するように修正する。 MovePicker mp(pos, ttMove, depth, pos.this_thread()->history, move_to((ss - 1)->currentMove)); Move move; Value value; StateInfo st; // このあとnodeを展開していくので、evaluate()の差分計算ができないと速度面で損をするから、 // evaluate()を呼び出していないなら呼び出しておく。 evaluate_with_no_return(pos); while ((move = mp.next_move()) != MOVE_NONE) { // ----------------------- // 局面を進める前の枝刈り // ----------------------- givesCheck = pos.gives_check(move); // // Futility pruning // // 王手がかかっていなくて王手ではない指し手なら、今回捕獲されるであろう駒による評価値の上昇分を // 加算してもalpha値を超えそうにないならこの指し手は枝刈りしてしまう。 if (!InCheck && !givesCheck && futilityBase > -VALUE_KNOWN_WIN) { // moveが成りの指し手なら、その成ることによる価値上昇分もここに乗せたほうが正しい見積りになる。 Value futilityValue = futilityBase + (Value)CapturePieceValue[pos.piece_on(move_to(move))] + (is_promote(move) ? (Value)ProDiffPieceValue[pos.piece_on(move_from(move))] : VALUE_ZERO) ; // futilityValueは今回捕獲するであろう駒の価値の分を上乗せしているのに // それでもalpha値を超えないというとってもひどい指し手なので枝刈りする。 if (futilityValue <= alpha) { bestValue = std::max(bestValue, futilityValue); continue; } // futilityBaseはこの局面のevalにmargin値を加算しているのだが、それがalphaを超えないし、 // かつseeがプラスではない指し手なので悪い手だろうから枝刈りしてしまう。 if (futilityBase <= alpha && !pos.see_ge(move, VALUE_ZERO + 1)) { bestValue = std::max(bestValue, futilityBase); continue; } } // // Detect non-capture evasions // // 駒を取らない王手回避の指し手はよろしくない可能性が高いのでこれは枝刈りしてしまう。 // 成りでない && seeが負の指し手はNG。王手回避でなくとも、同様。 bool evasionPrunable = InCheck && bestValue > VALUE_MATED_IN_MAX_PLY && !pos.capture(move); if ( (!InCheck || evasionPrunable) && !is_promote(move) && !pos.see_ge(move, VALUE_ZERO)) continue; // ----------------------- // 局面を1手進める // ----------------------- // 指し手の合法性の判定は直前まで遅延させたほうが得。 // (これが非合法手である可能性はかなり低いので他の判定によりskipされたほうが得) if (!pos.legal(move)) continue; // 現在このスレッドで探索している指し手を保存しておく。 ss->currentMove = move; pos.do_move(move, st, givesCheck); value = givesCheck ? -qsearch<NT, true>(pos, ss + 1, -beta, -alpha, depth - ONE_PLY) : -qsearch<NT,false>(pos, ss + 1, -beta, -alpha, depth - ONE_PLY); pos.undo_move(move); ASSERT_LV3(-VALUE_INFINITE < value && value < VALUE_INFINITE); // bestValue(≒alpha値)を更新するのか if (value > bestValue) { bestValue = value; if (value > alpha) { // fail-highの場合もPVは更新する。 if (PvNode) update_pv(ss->pv, move, (ss + 1)->pv); if (PvNode && value < beta) { // alpha値の更新はこのタイミングで良い。 // なぜなら、このタイミング以外だと枝刈りされるから。(else以下を読むこと) alpha = value; bestMove = move; } else // fails high { // 1. nonPVでのalpha値の更新 → もうこの時点でreturnしてしまっていい。(ざっくりした枝刈り) // 2. PVでのvalue >= beta、すなわちfail high tte->save(posKey, value_to_tt(value, ss->ply), BOUND_LOWER, ttDepth, move, ss->staticEval, TT.generation()); return value; } } } } // ----------------------- // 指し手を調べ終わった // ----------------------- // 王手がかかっている状況ではすべての指し手を調べたということだから、これは詰みである。 // どうせ指し手がないということだから、次にこのnodeに訪問しても、指し手生成後に詰みであることは // わかるわけだし、そもそもこのnodeが詰みだとわかるとこのnodeに再訪問する確率は極めて低く、 // 置換表に保存しても得しない。 if (InCheck && bestValue == -VALUE_INFINITE) { bestValue = mated_in(ss->ply); // rootからの手数による詰みである。 } else { // 詰みではなかったのでこれを書き出す。 tte->save(posKey, value_to_tt(bestValue, ss->ply), PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER, ttDepth, bestMove, ss->staticEval, TT.generation()); } // 置換表には abs(value) < VALUE_INFINITEの値しか書き込まないし、この関数もこの範囲の値しか返さない。 ASSERT_LV3(-VALUE_INFINITE < bestValue && bestValue < VALUE_INFINITE); return bestValue; } // ----------------------- // 通常探索 // ----------------------- // cutNode = LMRで悪そうな指し手に対してreduction量を増やすnode template <NodeType NT> Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth,bool cutNode) { // ----------------------- // nodeの種類 // ----------------------- // PV nodeであるか(root nodeはPV nodeに含まれる) const bool PvNode = NT == PV; // root nodeであるか const bool RootNode = PvNode && (ss - 1)->ply == 0; // ----------------------- // 変数の宣言 // ----------------------- // このnodeからのPV line(読み筋) Move pv[MAX_PLY + 1]; // do_move()するときに必要 StateInfo st; // MovePickerから1手ずつもらうときの一時変数 Move move; // LMRのときにfail highが起きるなどしたので元の残り探索深さで探索することを示すフラグ bool doFullDepthSearch; // この局面でのベストのスコア Value bestValue; // search()の戻り値を受ける一時変数 Value value; // この局面に対する評価値の見積り。 Value eval; // ----------------------- // nodeの初期化 // ----------------------- ASSERT_LV3(-VALUE_INFINITE <= alpha && alpha < beta && beta <= VALUE_INFINITE); ASSERT_LV3(PvNode || (alpha == beta - 1)); ASSERT_LV3(DEPTH_ZERO < depth && depth < DEPTH_MAX); Thread* thisThread = pos.this_thread(); // ss->moveCountはこのあとMovePickerがこのnodeの指し手を生成するより前に // 枝刈り等でsearch()を再帰的に呼び出すことがあり、そのときに親局面のmoveCountベースで // 枝刈り等を行ないたいのでこのタイミングで初期化しなければならない。 // ss->moveCountではなく、moveCountのほうはMovePickerで指し手を生成するとき以降で良い。 ss->moveCount = 0; bestValue = -VALUE_INFINITE; // rootからの手数 ss->ply = (ss - 1)->ply + 1; // seldepthをGUIに出力するために、PVnodeであるならmaxPlyを更新してやる。 if (PvNode && thisThread->maxPly < ss->ply) thisThread->maxPly = ss->ply; // ----------------------- // Timerの監視 // ----------------------- // タイマースレッドを使うとCPU負荷的にちょっと損なので // 自分で呼び出し回数をカウントして一定回数ごとにタイマーのチェックを行なう。 if (thisThread->resetCalls.load(std::memory_order_relaxed)) { thisThread->resetCalls = false; thisThread->callsCnt = 0; } // nps 1コア時でも800kぐらい出るから、20knodeごとに調べれば0.02秒程度の精度は出るはず。 if (++thisThread->callsCnt > 20000) { for (Thread* th : Threads) th->resetCalls = true; check_time(); } // ----------------------- // RootNode以外での処理 // ----------------------- if (!RootNode) { // ----------------------- // 千日手等の検出 // ----------------------- // 連続王手による千日手、および通常の千日手、優等局面・劣等局面。 // 連続王手による千日手に対してdraw_value()は、詰みのスコアを返すので、rootからの手数を考慮したスコアに変換する必要がある。 // そこで、value_from_tt()で変換してから返すのが正解。 auto draw_type = pos.is_repetition(); if (draw_type != REPETITION_NONE) return value_from_tt(draw_value(draw_type, pos.side_to_move()),ss->ply); // 最大手数を超えている、もしくは停止命令が来ている。 if (Signals.stop.load(std::memory_order_relaxed) || pos.game_ply() > Limits.max_game_ply) return draw_value(REPETITION_DRAW, pos.side_to_move()); // ----------------------- // Mate Distance Pruning // ----------------------- // rootから5手目の局面だとして、このnodeのスコアが // 5手以内で詰ますときのスコアを上回ることもないし、 // 5手以内で詰まさせるときのスコアを下回ることもないので // これを枝刈りする。 alpha = std::max(mated_in(ss->ply), alpha); beta = std::min(mate_in(ss->ply + 1), beta); if (alpha >= beta) return alpha; } // ----------------------- // 探索Stackの初期化 // ----------------------- // この初期化、もう少し早めにしたほうがいい可能性が.. // このnodeで指し手を進めずにリターンしたときにこの局面でのcurrnetMoveにゴミが入っていると困るような? ss->currentMove = MOVE_NONE; // 1手先のexcludedMoveの初期化 (ss + 1)->excludedMove = MOVE_NONE; // 1手先のskipEarlyPruningフラグの初期化。 (ss + 1)->skipEarlyPruning = false; // 2手先のkillerの初期化。 (ss + 2)->killers[0] = (ss + 2)->killers[1] = MOVE_NONE; // ----------------------- // 置換表のprobe // ----------------------- // このnodeで探索から除外する指し手。ss->excludedMoveのコピー。 Move excludedMove = ss->excludedMove; // 除外した指し手をxorしてそのままhash keyに使う。 // 除外した指し手がないときは、0だから、xorしても0。 // ただし、hash keyのbit0は手番を入れることになっているのでここは0にしておく。 auto posKey = pos.key() ^ Key(excludedMove << 1); bool ttHit; // 置換表がhitしたか TTEntry* tte = TT.probe(posKey, ttHit); // 置換表上のスコア // 置換表にhitしなければVALUE_NONE Value ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE; // 置換表の指し手 // 置換表にhitしなければMOVE_NONE // RootNodeであるなら、(MultiPVなどでも)現在注目している1手だけがベストの指し手と仮定できるから、 // それが置換表にあったものとして指し手を進める。 Move ttMove = RootNode ? thisThread->rootMoves[thisThread->PVIdx].pv[0] : ttHit ? pos.move16_to_move(tte->move()) : MOVE_NONE; // 置換表の値による枝刈り if (!PvNode // PV nodeでは置換表の指し手では枝刈りしない(PV nodeはごくわずかしかないので..) && ttHit // 置換表の指し手がhitして && tte->depth() >= depth // 置換表に登録されている探索深さのほうが深くて && ttValue != VALUE_NONE // (VALUE_NONEだとすると他スレッドからTTEntryが読みだす直前に破壊された可能性がある) && (ttValue >= beta ? (tte->bound() & BOUND_LOWER) : (tte->bound() & BOUND_UPPER)) // ttValueが下界(真の評価値はこれより大きい)もしくはジャストな値で、かつttValue >= beta超えならbeta cutされる // ttValueが上界(真の評価値はこれより小さい)だが、tte->depth()のほうがdepthより深いということは、 // 今回の探索よりたくさん探索した結果のはずなので、今回よりは枝刈りが甘いはずだから、その値を信頼して // このままこの値でreturnして良い。 ) { ss->currentMove = ttMove; // この指し手で枝刈りをした。ただしMOVE_NONEでありうる。 // 置換表の指し手でbeta cutが起きたのであれば、この指し手をkiller等に登録する。 // ただし、捕獲する指し手か成る指し手であればこれはkillerを更新する価値はない。 if (ttValue >= beta && ttMove && !pos.capture_or_promotion(ttMove)) update_stats(pos, ss, ttMove, depth, nullptr, 0); return ttValue; } // ----------------------- // 宣言勝ち // ----------------------- { // 王手がかかってようがかかってまいが、宣言勝ちの判定は正しい。 // (トライルールのとき王手を回避しながら入玉することはありうるので) Move m = pos.DeclarationWin(); if (m != MOVE_NONE) { bestValue = mate_in(ss->ply + 1); // 1手詰めなのでこの次のnodeで(指し手がなくなって)詰むという解釈 tte->save(posKey, value_to_tt(bestValue, ss->ply), BOUND_EXACT, DEPTH_MAX, m, ss->staticEval, TT.generation()); return bestValue; } } // ----------------------- // 1手詰みか? // ----------------------- Move bestMove = MOVE_NONE; const bool InCheck = pos.checkers(); #ifdef USE_MATE_1PLY // RootNodeでは1手詰め判定、ややこしくなるのでやらない。(RootMovesの入れ替え等が発生するので) // 置換表にhitしたときも1手詰め判定はすでに行われていると思われるのでこの場合もはしょる。 // depthの残りがある程度ないと、1手詰めはどうせこのあとすぐに見つけてしまうわけで1手詰めを // 見つけたときのリターン(見返り)が少ない。 if (!RootNode && !ttHit && depth > ONE_PLY && !InCheck) { bestMove = pos.mate1ply(); if (bestMove != MOVE_NONE) { // 1手詰めスコアなので確実にvalue > alphaなはず。 bestValue = mate_in(ss->ply + 1); // 1手詰めは次のnodeで詰むという解釈 tte->save(posKey, value_to_tt(bestValue, ss->ply), BOUND_EXACT, DEPTH_MAX, bestMove, ss->staticEval, TT.generation()); return bestValue; } } #endif // ----------------------- // 局面を評価値によって静的に評価 // ----------------------- if (InCheck) { // 評価値を置換表から取り出したほうが得だと思うが、反復深化でこのnodeに再訪問したときも // このnodeでは評価値を用いないであろうから、置換表にこのnodeの評価値があることに意味がない。 ss->staticEval = eval = VALUE_NONE; goto MOVES_LOOP; } else if (ttHit) { // 置換表にhitしたなら、評価値が記録されているはずだから、それを取り出しておく。 // あとで置換表に書き込むときにこの値を使えるし、各種枝刈りはこの評価値をベースに行なうから。 // tte->eval()へのアクセスは1回にしないと他のスレッドが壊してしまう可能性があるので気をつける。 if ((eval = tte->eval()) == VALUE_NONE) eval = evaluate(pos); ss->staticEval = eval; // ttValueのほうがこの局面の評価値の見積もりとして適切であるならそれを採用する。 // 1. ttValue > evaluate()でかつ、ttValueがBOUND_LOWERなら、真の値はこれより大きいはずだから、 // evalとしてttValueを採用して良い。 // 2. ttValue < evaluate()でかつ、ttValueがBOUND_UPPERなら、真の値はこれより小さいはずだから、 // evalとしてttValueを採用したほうがこの局面に対する評価値の見積りとして適切である。 if (ttValue != VALUE_NONE && (tte->bound() & (ttValue > eval ? BOUND_LOWER : BOUND_UPPER))) eval = ttValue; } else { ss->staticEval = eval = (ss - 1)->currentMove != MOVE_NULL ? evaluate(pos) : -(ss - 1)->staticEval; // 評価関数を呼び出したので置換表のエントリーはなかったことだし、何はともあれそれを保存しておく。 tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, ss->staticEval, TT.generation()); } // このnodeで指し手生成前の枝刈りを省略するなら指し手生成ループへ。 if (ss->skipEarlyPruning) goto MOVES_LOOP; // ----------------------- // evalベースの枝刈り // ----------------------- // 局面の静的評価値(eval)が得られたので、以下ではこの評価値を用いて各種枝刈りを行なう。 // 王手のときはここにはこない。(上のInCheckのなかでMOVES_LOOPに突入。) // // Razoring // // 残り探索深さが少ないときに、その手数でalphaを上回りそうにないとき用の枝刈り。 if (!PvNode && depth < 4 * ONE_PLY && eval + razor_margin(depth) <= alpha && ttMove == MOVE_NONE) { // 残り探索深さがONE_PLY以下で、alphaを確実に下回りそうなら、ここで静止探索を呼び出してしまう。 if (depth <= ONE_PLY && eval + razor_margin(3 * ONE_PLY) <= alpha) return qsearch<NonPV, false>(pos, ss, alpha, beta , DEPTH_ZERO); // 残り探索深さが1~3手ぐらいあるときに、alpha - razor_marginを上回るかだけ調べて // 上回りそうにないならもうリターンする。 Value ralpha = alpha - razor_margin(depth); Value v = qsearch<NonPV, false>(pos, ss, ralpha, ralpha + 1, DEPTH_ZERO); if (v <= ralpha) return v; } // // Futility pruning // // このあとの残り探索深さによって、評価値が変動する幅はfutility_margin(depth)だと見積れるので // evalからこれを引いてbetaより大きいなら、beta cutが出来る。 // ただし、将棋の終盤では評価値の変動の幅は大きくなっていくので、進行度に応じたfutility_marginが必要となる。 // ここでは進行度としてgamePly()を用いる。このへんはあとで調整すべき。 if (!RootNode && depth < 7 * ONE_PLY && eval - futility_margin(depth, pos.game_ply()) >= beta && eval < VALUE_KNOWN_WIN) // 詰み絡み等だとmate distance pruningで枝刈りされるはずで、ここでは枝刈りしない。 return eval - futility_margin(depth, pos.game_ply()); // // Null move search with verification search // // null move探索。PV nodeではやらない。 // evalの見積りがbetaを超えているので1手パスしてもbetaは超えそう。 if (!PvNode && depth >= 2 * ONE_PLY && eval >= beta) { ss->currentMove = MOVE_NULL; // 残り探索深さと評価値によるnull moveの深さを動的に減らす Depth R = ((823 + 67 * depth) / 256 + std::min((int)((eval - beta) / PawnValue), 3)) * ONE_PLY; pos.do_null_move(st); (ss + 1)->skipEarlyPruning = true; // 王手がかかっているときはここに来ていないのでqsearchはInCheck == falseのほうを呼ぶ。 Value nullValue = depth - R < ONE_PLY ? -qsearch<NonPV, false>(pos, ss + 1, -beta, -beta + 1, DEPTH_ZERO ) : - search<NonPV >(pos, ss + 1, -beta, -beta + 1, depth - R , !cutNode); (ss + 1)->skipEarlyPruning = false; pos.undo_null_move(); if (nullValue >= beta) { // 1手パスしてもbetaを上回りそうであることがわかったので // これをもう少しちゃんと検証しなおす。 // 証明されていないmate scoreの場合はリターンしない。 if (nullValue >= VALUE_MATE_IN_MAX_PLY) nullValue = beta; if (depth < 12 * ONE_PLY && abs(beta) < VALUE_KNOWN_WIN) return nullValue; // nullMoveせずに(現在のnodeと同じ手番で)同じ深さで探索しなおして本当にbetaを超えるか検証する。cutNodeにしない。 ss->skipEarlyPruning = true; Value v = depth - R < ONE_PLY ? qsearch<NonPV, false>(pos, ss, beta - 1, beta, DEPTH_ZERO ) : search<NonPV >(pos, ss, beta - 1, beta, depth - R , false); ss->skipEarlyPruning = false; if (v >= beta) return nullValue; } } // // ProbCut // // もし、このnodeで非常に良いcaptureの指し手があり(例えば、SEEの値が動かす駒の価値を上回るようなもの) // 探索深さを減らしてざっくり見てもbetaを非常に上回る値を返すようなら、このnodeをほぼ安全に枝刈りすることが出来る。 if (!PvNode && depth >= 5 * ONE_PLY && abs(beta) < VALUE_MATE_IN_MAX_PLY) { Value rbeta = std::min(beta + 200 , VALUE_INFINITE); // 大胆に探索depthを減らす Depth rdepth = depth - 4 * ONE_PLY; ASSERT_LV3(rdepth >= ONE_PLY); ASSERT_LV3((ss - 1)->currentMove != MOVE_NONE); ASSERT_LV3((ss - 1)->currentMove != MOVE_NULL); // このnodeの指し手としては置換表の指し手を返したあとは、直前の指し手で捕獲された駒による評価値の上昇を // 上回るようなcaptureの指し手のみを生成する。 MovePicker mp(pos, ttMove, thisThread->history, (Value)Eval::CapturePieceValue[pos.captured_piece()]); while ((move = mp.next_move()) != MOVE_NONE) if (pos.legal(move)) { ss->currentMove = move; pos.do_move(move, st, pos.gives_check(move)); value = -search<NonPV>(pos, ss + 1, -rbeta, -rbeta + 1, rdepth, !cutNode); pos.undo_move(move); if (value >= rbeta) return value; } } // // Internal iterative deepening // // いわゆる多重反復深化。残り探索深さがある程度あるのに置換表に指し手が登録されていないとき // (たぶん置換表のエントリーを上書きされた)、浅い探索をして、その指し手を置換表の指し手として用いる。 // 置換表用のメモリが潤沢にあるときはこれによる効果はほとんどないはずではあるのだが…。 if (depth >= (PvNode ? 5 * ONE_PLY : 8 * ONE_PLY) && !ttMove && (PvNode || ss->staticEval + 256 >= beta)) { Depth d = depth - 2 * ONE_PLY - (PvNode ? DEPTH_ZERO : depth / 4); ss->skipEarlyPruning = true; search<NT>(pos, ss, alpha, beta, d, true); ss->skipEarlyPruning = false; tte = TT.probe(posKey, ttHit); ttMove = ttHit ? pos.move16_to_move(tte->move()) : MOVE_NONE; } // ----------------------- // 1手ずつ指し手を試す // ----------------------- MOVES_LOOP: // 評価値が2手前の局面から上がって行っているのかのフラグ // 上がって行っているなら枝刈りを甘くする。 // ※ VALUE_NONEの場合は、王手がかかっていてevaluate()していないわけだから、 // 枝刈りを甘くして調べないといけないのでimproving扱いとする。 bool improving = (ss)->staticEval >= (ss - 2)->staticEval || (ss )->staticEval == VALUE_NONE || (ss - 2)->staticEval == VALUE_NONE; // singular延長をするnodeであるか。 bool singularExtensionNode = !RootNode && depth >= 10 * ONE_PLY // Stockfish , Apreyは、8 * ONE_PLY && ttMove != MOVE_NONE /* && ttValue != VALUE_NONE これは次行の条件に暗に含まれている */ && abs(ttValue) < VALUE_KNOWN_WIN && !excludedMove // 再帰的なsingular延長はすべきではない && (tte->bound() & BOUND_LOWER) && tte->depth() >= depth - 3 * ONE_PLY; // 調べた指し手を残しておいて、statusのupdateを行なうときに使う。 Move quietsSearched[64]; int quietCount = 0; // このnodeでdo_move()された合法手の数 int moveCount = 0; // MovePickerでのオーダリングのためにhistory tableなどを渡す // 親nodeとその親nodeでの指し手でのtoの升 Square prevSq,prevPrevSq; // その升へ移動させた駒 Piece prevPc,prevPrevPc; sq_pc_from_move(prevSq , prevPc , (ss - 1)->currentMove); sq_pc_from_move(prevPrevSq, prevPrevPc, (ss - 2)->currentMove); // toの升に駒pcを動かしたことに対する応手 auto cm = is_ok((ss - 1)->currentMove) ? thisThread->counterMoves[prevSq][prevPc] : MOVE_NONE ; // counter history const auto& cmh = CounterMoveHistory[prevSq][prevPc]; const auto& fmh = CounterMoveHistory[prevPrevSq][prevPrevPc]; // 2手前のtoの駒、1手前の指し手によって捕獲されている場合があるが、それはcaptureであるから // ここでは対象とならない…はず…。 // このあとnodeを展開していくので、evaluate()の差分計算ができないと速度面で損をするから、 // evaluate()を呼び出していないなら呼び出しておく。 // ss->staticEvalに代入するとimprovingの判定間違うのでそれはしないほうがよさげ。 evaluate_with_no_return(pos); MovePicker mp(pos, ttMove, depth, thisThread->history, cmh, fmh, cm, ss); // 一手ずつ調べていく while ((move = mp.next_move()) !=MOVE_NONE) { if (move == excludedMove) continue; // root nodeでは、rootMoves()の集合に含まれていない指し手は探索をスキップする。 if (RootNode && !std::count(thisThread->rootMoves.begin() + thisThread->PVIdx, thisThread->rootMoves.end(), move)) continue; // do_move()した指し手の数のインクリメント // このあとdo_move()の前で枝刈りのためにsearchを呼び出す可能性があるので // このタイミングでやっておき、legalでなければ、この値を減らす ss->moveCount = ++moveCount; // この読み筋の出力、細かすぎるので時間をロスする。しないほうがいいと思う。 #if 0 // 3秒以上経過しているなら現在探索している指し手をGUIに出力する。 if (RootNode && !Limits.silent && thisThread == Threads.main() && Time.elapsed() > 3000) sync_cout << "info depth " << depth / ONE_PLY << " currmove " << move << " currmovenumber " << moveCount + thisThread->PVIdx << sync_endl; #endif // 次のnodeのpvをクリアしておく。 if (PvNode) (ss + 1)->pv = nullptr; // ----------------------- // extension // ----------------------- // // Extend checks // // 今回の指し手で王手になるかどうか bool givesCheck = pos.gives_check(move); Depth extension = DEPTH_ZERO; // 王手となる指し手でSEE >= 0であれば残り探索深さに1手分だけ足す。 if (givesCheck && pos.see_ge(move, VALUE_ZERO)) extension = ONE_PLY; // // Singular extension search. // #if 1 // (alpha-s,beta-s)の探索(sはマージン値)において1手以外がすべてfail lowして、 // 1手のみが(alpha,beta)においてfail highしたなら、指し手はsingularであり、延長されるべきである。 // これを調べるために、ttMove以外の探索深さを減らして探索して、 // その結果がttValue-s 以下ならttMoveの指し手を延長する。 // Stockfishの実装だとmargin = 2 * depthだが、(ONE_PLY==1として)、 // 将棋だと1手以外はすべてそれぐらい悪いことは多々あり、 // ほとんどの指し手がsingularと判定されてしまう。 // これでは効果がないので、1割ぐらいの指し手がsingularとなるぐらいの係数に調整する。 // note : // singular延長で強くなるのは、あるnodeで1手だけが特別に良い場合、相手のプレイヤーもそのnodeでは // その指し手を選択する可能性が高く、それゆえ、相手のPVもそこである可能性が高いから、そこを相手よりわずかにでも // 読んでいて詰みを回避などできるなら、その相手に対する勝率は上がるという理屈。 // いわば、0.5手延長が自己対戦で(のみ)強くなるのの拡張。 // そう考えるとベストな指し手のスコアと2番目にベストな指し手のスコアとの差に応じて1手延長するのが正しいのだが、 // 2番目にベストな指し手のスコアを小さなコストで求めることは出来ないので…。 else if (singularExtensionNode && move == ttMove // && !extension // 延長が確定しているところはこれ以上調べても仕方がない。しかしこの条件はelse ifなので暗に含む。 && pos.legal(move)) { // このmargin値は評価関数の性質に合わせて調整されるべき。 // Value rBeta = ttValue - 2 * depth / ONE_PLY; Value rBeta = ttValue - 8 * depth / ONE_PLY; // ttMoveの指し手を以下のsearch()での探索から除外 ss->excludedMove = move; ss->skipEarlyPruning = true; // 局面はdo_move()で進めずにこのnodeから浅い探索深さで探索しなおす。 // 浅いdepthでnull windowなので、すぐに探索は終わるはず。 value = search<NonPV>(pos, ss, rBeta - 1, rBeta, depth / 2, cutNode); ss->skipEarlyPruning = false; ss->excludedMove = MOVE_NONE; ss->moveCount = moveCount; // 破壊したと思うので修復しておく。 // 置換表の指し手以外がすべてfail lowしているならsingular延長確定。 if (value < rBeta) extension = ONE_PLY; // singular extentionが生じた回数の統計を取ってみる。 // dbg_hit_on(extension == ONE_PLY); } #endif // ----------------------- // 1手進める前の枝刈り // ----------------------- // 再帰的にsearchを呼び出すとき、search関数に渡す残り探索深さ。 // これはsingluar extensionの探索が終わってから決めなければならない。(singularなら延長したいので) Depth newDepth = depth - ONE_PLY + extension; // 指し手で捕獲する指し手、もしくは成りである。 bool captureOrPromotion = pos.capture_or_promotion(move); // // Pruning at shallow depth // // 浅い深さでの枝刈り Piece mpc = pos.moved_piece_after(move); if (!RootNode && !captureOrPromotion && !InCheck && !givesCheck && bestValue > VALUE_MATED_IN_MAX_PLY) { // Move countに基づいた枝刈り(futilityの亜種) if (depth < 16 * ONE_PLY && moveCount >= FutilityMoveCounts[improving][depth]) continue; // Historyに基づいた枝刈り(history && counter moveの値が悪いものに関してはskip) if (depth <= 4 * ONE_PLY && move != (Move)(ss->killers[0]) && thisThread->history[move_to(move)][mpc] < VALUE_ZERO && cmh[move_to(move)][mpc] < VALUE_ZERO) continue; // Futility pruning: at parent node // 親nodeの時点で子nodeを展開する前にfutilityの対象となりそうなら枝刈りしてしまう。 // 次の子node(do_move()で進めたあとのnode)でのLMR後の予想depth Depth predictedDepth = std::max(newDepth - reduction<PvNode>(improving, depth, moveCount), DEPTH_ZERO); if (predictedDepth < 7 * ONE_PLY) { // このmargin値はあとでもっと厳密に調整すべき。 Value futilityValue = ss->staticEval + futility_margin(predictedDepth,pos.game_ply()) + 170; if (futilityValue <= alpha) { bestValue = std::max(bestValue, futilityValue); continue; } } // 次の子nodeにおいて浅い深さになる場合、負のSSE値を持つ指し手の枝刈り if (predictedDepth < 4 * ONE_PLY && !pos.see_ge(move, VALUE_ZERO)) continue; } // ----------------------- // 1手進める // ----------------------- // legal()のチェック。root nodeだとlegal()だとわかっているのでこのチェックは不要。 // 非合法手はほとんど含まれていないからこの判定はdo_move()の直前まで遅延させたほうが得。 if (!RootNode && !pos.legal(move)) { // 足してしまったmoveCountを元に戻す。 ss->moveCount = --moveCount; continue; } // 現在このスレッドで探索している指し手を保存しておく。 ss->currentMove = move; // 指し手で1手進める pos.do_move(move, st, givesCheck); // ----------------------- // LMR(Late Move Reduction) // ----------------------- // moveCountが大きいものなどは探索深さを減らしてざっくり調べる。 // alpha値を更新しそうなら(fail highが起きたら)、full depthで探索しなおす。 if (depth >= 3 * ONE_PLY && moveCount > 1 && !captureOrPromotion) { // Reduction量 Depth r = reduction<PvNode>(improving, depth, moveCount); Value hValue = thisThread->history[move_to(move)][mpc]; Value cmhValue = cmh[move_to(move)][mpc]; // cut nodeや、historyの値が悪い指し手に対してはreduction量を増やす。 if ((!PvNode && cutNode) || (hValue < VALUE_ZERO && cmhValue <= VALUE_ZERO)) r += ONE_PLY; // historyの値に応じて指し手のreduction量を増減する。 int rHist = (hValue + cmhValue) / 14980; r = std::max(DEPTH_ZERO, r - rHist * ONE_PLY); #if 0 // 捕獲から逃れるための指し手に関してはreduction量を減らしてやる。 // 捕獲から逃れるとそれによって局面の優劣が反転することが多いためである。 if (r && !(move & MOVE_PROMOTE) && pos.effected_to(~us,move_from(move))) // 敵の利きがこの移動元の駒にあるか r = std::max(DEPTH_ZERO, r - ONE_PLY); #endif // // ここにその他の枝刈り、何か入れるべき // // depth >= 3なのでqsearchは呼ばれないし、かつ、 // moveCount > 1 すなわち、このnodeの2手目以降なのでsearch<NonPv>が呼び出されるべき。 Depth d = std::max(newDepth - r, ONE_PLY); value = -search<NonPV>(pos, ss + 1, -(alpha + 1), -alpha, d, true); // 上の探索によりalphaを更新しそうだが、いい加減な探索なので信頼できない。まともな探索で検証しなおす doFullDepthSearch = (value > alpha) && (r != DEPTH_ZERO); } else { // non PVか、PVでも2手目以降であればfull depth searchを行なう。 doFullDepthSearch = !PvNode || moveCount > 1; } // Full depth search // LMRがskipされたか、LMRにおいてfail highを起こしたなら元の探索深さで探索する。 // ※ 静止探索は残り探索深さはDEPTH_ZEROとして開始されるべきである。(端数があるとややこしいため) if (doFullDepthSearch) value = newDepth < ONE_PLY ? givesCheck ? -qsearch<NonPV, true> (pos, ss + 1, -(alpha + 1), -alpha, DEPTH_ZERO) : -qsearch<NonPV, false>(pos, ss + 1, -(alpha + 1), -alpha, DEPTH_ZERO) : - search<NonPV> (pos, ss + 1, -(alpha + 1), -alpha, newDepth ,!cutNode); // PV nodeにおいては、full depth searchがfail highしたならPV nodeとしてsearchしなおす。 // ただし、value >= betaなら、正確な値を求めることにはあまり意味がないので、これはせずにbeta cutしてしまう。 if (PvNode && (moveCount == 1 || (value > alpha && (RootNode || value < beta)))) { // 次のnodeのPVポインターはこのnodeのpvバッファを指すようにしておく。 pv[0] = MOVE_NONE; (ss+1)->pv = pv; // full depthで探索するときはcutNodeにしてはいけない。 value = newDepth < ONE_PLY ? givesCheck ? -qsearch<PV, true> (pos, ss + 1, -beta, -alpha, DEPTH_ZERO) : -qsearch<PV, false>(pos, ss + 1, -beta, -alpha, DEPTH_ZERO) : - search<PV> (pos, ss + 1, -beta, -alpha, newDepth ,false); #ifdef DYNAMIC_FUTILITY_MARGIN // 普通にfull depth searchしたのでこのときのeval-valueをサンプリングして // futilty marginを動的に変更してやる。 // sampling対象はONE_PLYのときのもののみ。 // あまり深いものを使うと、途中で枝刈りされて、小さな値が返ってきたりして困る。 // あくまで1手でどれくらいの変動があるかを知りたくて、 // その変動値 × depth みたいなものを計算したい。 if (newDepth == ONE_PLY && eval != VALUE_NONE // evalutate()を呼び出していて && !captureOrPromotion // futilityはcaptureとpromotionのときは行わないのでこの値は参考にならない && !InCheck // 王手がかかっていなくて && abs(value) <= VALUE_MAX_EVAL // 評価関数の返してきた値 && alpha < value && value < beta // fail low/highしていると参考にならない ) { // 移動平均みたいなものを求める futility_margin_sum = futility_margin_sum * 63 / 64; futility_margin_sum += abs(value - eval); //static int count = 0; //if ((++count & 0x100) == 0) // sync_cout << "futility_margin = " << futility_margin(ONE_PLY,0) << sync_endl; } #endif } // ----------------------- // 1手戻す // ----------------------- pos.undo_move(move); // 停止シグナルが来たら置換表を汚さずに終了。 if (Signals.stop.load(std::memory_order_relaxed)) return VALUE_ZERO; // ----------------------- // root node用の特別な処理 // ----------------------- if (RootNode) { auto& rm = *std::find(thisThread->rootMoves.begin(), thisThread->rootMoves.end(), move); if (moveCount == 1 || value > alpha) { // root nodeにおいてPVの指し手または、α値を更新した場合、スコアをセットしておく。 // (iterationの終わりでsortするのでそのときに指し手が入れ替わる。) rm.score = value; rm.pv.resize(1); // PVは変化するはずなのでいったんリセット // 1手進めたのだから、何らかPVを持っているはずなのだが。 ASSERT_LV3((ss + 1)->pv); // RootでPVが変わるのは稀なのでここがちょっとぐらい重くても問題ない。 // 新しく変わった指し手の後続のpvをRootMoves::pvにコピーしてくる。 for (Move* m = (ss+1)->pv; *m != MOVE_NONE; ++m) rm.pv.push_back(*m); if (moveCount > 1 && thisThread == Threads.main()) ++static_cast<MainThread*>(thisThread)->bestMoveChanges; } else { // root nodeにおいてα値を更新しなかったのであれば、この指し手のスコアを-VALUE_INFINITEにしておく。 // こうしておかなければ、stable_sort()しているにもかかわらず、前回の反復深化のときの値との // 大小比較してしまい指し手の順番が入れ替わってしまうことによるオーダリング性能の低下がありうる。 rm.score = -VALUE_INFINITE; } } // ----------------------- // alpha値の更新処理 // ----------------------- if (value > bestValue) { bestValue = value; if (value > alpha) { // 不安定なnodeにおいてeasy moveをクリアする。 // ※  posKeyは、excludedMoveが指定されていると本来のkeyとは異なることになるが、それは // singular extensionのときにしか関係なくて、singular extensionは深いdepthでしかやらないので、 // EasyMove.get()で返す2手目のkeyには影響を及ぼさない。 if (PvNode && thisThread == Threads.main() && EasyMove.get(posKey) && (move != EasyMove.get(posKey) || moveCount > 1)) EasyMove.clear(); bestMove = move; // fail highのときにもPVをupdateする。 if (PvNode && !RootNode) update_pv(ss->pv, move, (ss + 1)->pv); // alpha値を更新したので更新しておく if (PvNode && value < beta) alpha = value; else { // value >= beta なら fail high(beta cut) // また、non PVであるなら探索窓の幅が0なのでalphaを更新した時点で、value >= betaが言えて、 // beta cutである。 break; } } } // 探索した指し手を64手目までquietsSearchedに登録しておく。 // あとでhistoryなどのテーブルに加点/減点するときに使う。 if (!captureOrPromotion && move != bestMove && quietCount < 64) quietsSearched[quietCount++] = move; } // end of while // ----------------------- // 生成された指し手がない? // ----------------------- // 合法手がない == 詰まされている ので、rootの局面からの手数で詰まされたという評価値を返す。 // ただし、singular extension中のときは、ttMoveの指し手が除外されているので単にalphaを返すべき。 if (!moveCount) bestValue = excludedMove ? alpha : mated_in(ss->ply); // 詰まされていない場合、bestMoveがあるならこの指し手をkiller等に登録する。 else if (bestMove && !pos.capture_or_promotion(bestMove)) update_stats(pos, ss, bestMove, depth, quietsSearched, quietCount); // fail lowを引き起こした前nodeでのcounter moveに対してボーナスを加点する。 else if (depth >= 3 * ONE_PLY && !bestMove // bestMoveが無い == fail low && !InCheck && !pos.captured_piece() && is_ok((ss - 1)->currentMove) && is_ok((ss - 2)->currentMove)) { // 残り探索depthの2乗ぐらいのボーナスを与える。 Value bonus = Value(int(depth / ONE_PLY) * (depth / ONE_PLY) + depth / ONE_PLY - 1); auto& prevCmh = CounterMoveHistory[prevPrevSq][prevPrevPc]; prevCmh.update(prevPc,prevSq, bonus); } // ----------------------- // 置換表に保存する // ----------------------- // betaを超えているということはbeta cutされるわけで残りの指し手を調べていないから真の値はまだ大きいと考えられる。 // すなわち、このとき値は下界と考えられるから、BOUND_LOWER。 // さもなくば、(PvNodeなら)枝刈りはしていないので、これが正確な値であるはずだから、BOUND_EXACTを返す。 // また、PvNodeでないなら、枝刈りをしているので、これは正確な値ではないから、BOUND_UPPERという扱いにする。 // ただし、指し手がない場合は、詰まされているスコアなので、これより短い/長い手順の詰みがあるかも知れないから、 // すなわち、スコアは変動するかも知れないので、BOUND_UPPERという扱いをする。 tte->save(posKey, value_to_tt(bestValue, ss->ply), bestValue >= beta ? BOUND_LOWER : PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER, depth, bestMove, ss->staticEval, TT.generation()); // 置換表には abs(value) < VALUE_INFINITEの値しか書き込まないし、この関数もこの範囲の値しか返さない。 ASSERT_LV3(-VALUE_INFINITE < bestValue && bestValue < VALUE_INFINITE); return bestValue; } } using namespace YaneuraOuClassicTce; // --- 以下に好きなように探索のプログラムを書くべし。 // 定跡ファイル Book::MemoryBook book; // 起動時に呼び出される。時間のかからない探索関係の初期化処理はここに書くこと。 void Search::init() { // ----------------------- // LMRで使うreduction tableの初期化 // ----------------------- // pvとnon pvのときのreduction定数 // 0.05とか変更するだけで勝率えらく変わる // K[][2] = { nonPV時 }、{ PV時 } double K[][2] = { { 0.799 - 0.1 , 2.281 + 0.1 },{ 0.484 + 0.1 , 3.023 + 0.05 } }; for (int pv = 0; pv <= 1; ++pv) for (int imp = 0; imp <= 1; ++imp) for (int d = 1; d < 64; ++d) for (int mc = 1; mc < 64; ++mc) { // 基本的なアイデアとしては、log(depth) × log(moveCount)に比例した分だけreductionさせるというもの。 double r = K[pv][0] + log(d) * log(mc) / K[pv][1]; if (r >= 1.5) reduction_table[pv][imp][d][mc] = int(r) * ONE_PLY; // nonPVでimproving(評価値が2手前から上がっている)でないときはreductionの量を増やす。 // → これ、ほとんど効果がないようだ…。あとで調整すべき。 if (!pv && !imp && reduction_table[pv][imp][d][mc] >= 2 * ONE_PLY) reduction_table[pv][imp][d][mc] += ONE_PLY; } // 残り探索depthが少なくて、王手がかかっていなくて、王手にもならないような指し手を // 枝刈りしてしまうためのmoveCountベースのfutilityで用いるテーブル。 // FutilityMoveCounts[improving][残りdepth] // ONE_PLY = 2にしたいので、それに合わせてテーブルを持つことにする。 for (int d = 0; d < 16 * (int)ONE_PLY; ++d) { FutilityMoveCounts[0][d] = int(2.4 + 0.773 * pow((float)d/ONE_PLY + 0.00, 1.8)); FutilityMoveCounts[1][d] = int(2.9 + 1.045 * pow((float)d/ONE_PLY + 0.49, 1.8)); } #ifdef DYNAMIC_FUTILITY_MARGIN // 64個分のmarginの合計 futility_margin_sum = Value(int(int(90 * ONE_PLY) / (14.0/8.0) * 64)); #endif } // isreadyコマンドの応答中に呼び出される。時間のかかる処理はここに書くこと。 void Search::clear() { // ----------------------- // 定跡の読み込み // ----------------------- Book::read_book("book/standard_book.db", book); // ----------------------- // 置換表のクリアなど // ----------------------- TT.clear(); CounterMoveHistory.clear(); // Threadsが変更になってからisreadyが送られてこないとisreadyでthread数だけ初期化しているものはこれではまずいの for (Thread* th : Threads) { th->history.clear(); th->counterMoves.clear(); } Threads.main()->previousScore = VALUE_INFINITE; } // 探索本体。並列化している場合、ここがslaveのエントリーポイント。 // lazy SMPなので、それぞれのスレッドが勝手に探索しているだけ。 void Thread::search() { // --------------------- // variables // --------------------- // (ss-2)と(ss+2)にアクセスしたいので4つ余分に確保しておく。 Stack stack[MAX_PLY + 4], *ss = stack + 2; // aspiration searchの窓の範囲(alpha,beta) // apritation searchで窓を動かす大きさdelta Value bestValue, alpha, beta, delta; // 安定したnodeのときに返す指し手 Move easyMove = MOVE_NONE; // 反復深化のiterationが浅いうちはaspiration searchを使わない。 // 探索窓を (-VALUE_INFINITE , +VALUE_INFINITE)とする。 bestValue = delta = alpha = -VALUE_INFINITE; beta = VALUE_INFINITE; // もし自分がメインスレッドであるならmainThreadにそのポインタを入れる。 // 自分がスレーブのときはnullptrになる。 MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr); // 先頭5つを初期化しておけば十分。そのあとはsearchの先頭でss+2を初期化する。 memset(stack, 0, 5 * sizeof(Stack)); // メインスレッド用の初期化処理 if (mainThread) { // 前回の局面からPVの指し手で2手進んだ局面であるかを判定する。 easyMove = EasyMove.get(rootPos.state()->key()); EasyMove.clear(); mainThread->easyMovePlayed = mainThread->failedLow = false; mainThread->bestMoveChanges = 0; // ponder用の指し手の初期化 ponder_candidate = MOVE_NONE; // --- 置換表のTTEntryの世代を進める。 TT.new_search(); } // --- MultiPV // bestmoveとしてしこの局面の上位N個を探索する機能 size_t multiPV = Options["MultiPV"]; // この局面での指し手の数を上回ってはいけない multiPV = std::min(multiPV, rootMoves.size()); // --------------------- // 反復深化のループ // --------------------- while (++rootDepth < MAX_PLY && !Signals.stop && (!Limits.depth || Threads.main()->rootDepth <= Limits.depth)) { // ------------------------ // lazy SMPのための初期化 // ------------------------ // slaveであれば、これはヘルパースレッドという扱いなので条件を満たしたとき // 探索深さを次の深さにする。 if (!mainThread) { // これにはhalf density matrixを用いる。 // 詳しくは、このmatrixの定義部の説明を読むこと。 // game_ply()は加算すべきではない気がする。あとで実験する。 const Row& row = HalfDensity[(idx - 1) % HalfDensitySize]; if (row[(rootDepth + rootPos.game_ply()) % row.size()]) continue; } // bestMoveが変化した回数を記録しているが、反復深化の世代が一つ進むので、 // 古い世代の情報として重みを低くしていく。 if (mainThread) mainThread->bestMoveChanges *= 0.505, mainThread->failedLow = false; // aspiration window searchのために反復深化の前回のiterationのスコアをコピーしておく for (RootMove& rm : rootMoves) rm.previousScore = rm.score; // MultiPVのためにこの局面の候補手をN個選出する。 for (PVIdx = 0; PVIdx < multiPV && !Signals.stop; ++PVIdx) { // ------------------------ // Aspiration window search // ------------------------ // 探索窓を狭めてこの範囲で探索して、この窓の範囲のscoreが返ってきたらラッキー、みたいな探索。 // 探索が浅いときは (-VALUE_INFINITE,+VALUE_INFINITE)の範囲で探索する。 // 探索深さが一定以上あるなら前回の反復深化のiteration時の最小値と最大値 // より少し幅を広げたぐらいの探索窓をデフォルトとする。 // この値は 6~10ぐらいがベスト。Stockfish7では、5 * ONE_PLY。 if (rootDepth >= 7) { // aspiration windowの幅 // 精度の良い評価関数ならばこの幅を小さくすると探索効率が上がるのだが、 // 精度の悪い評価関数だとこの幅を小さくしすぎると再探索が増えて探索効率が低下する。 // やねうら王のKPP評価関数では35~40ぐらいがベスト。もっと精度の高い評価関数を用意すべき。 delta = Value(40); alpha = std::max(rootMoves[PVIdx].previousScore - delta, -VALUE_INFINITE); beta = std::min(rootMoves[PVIdx].previousScore + delta, VALUE_INFINITE); } while (true) { bestValue = YaneuraOuClassicTce::search<PV>(rootPos, ss, alpha, beta, rootDepth * ONE_PLY, false); // それぞれの指し手に対するスコアリングが終わったので並べ替えおく。 // 一つ目の指し手以外は-VALUE_INFINITEが返る仕様なので並べ替えのために安定ソートを // 用いないと前回の反復深化の結果によって得た並び順を変えてしまうことになるのでまずい。 std::stable_sort(rootMoves.begin() + PVIdx, rootMoves.end()); if (Signals.stop) break; // main threadでfail high/lowが起きたなら読み筋をGUIに出力する。 // ただし出力を散らかさないように思考開始から3秒経ってないときは抑制する。 if (mainThread && !Limits.silent && multiPV == 1 && (bestValue <= alpha || bestValue >= beta) && Time.elapsed() > 3000) sync_cout << USI::pv(rootPos, rootDepth, alpha, beta) << sync_endl; // aspiration窓の範囲外 if (bestValue <= alpha) { // fails low // betaをalphaにまで寄せてしまうと今度はfail highする可能性があるので // betaをalphaのほうに少しだけ寄せる程度に留める。 beta = (alpha + beta) / 2; alpha = std::max(bestValue - delta, -VALUE_INFINITE); // fail lowを起こしていて、いま探索を中断するのは危険。 if (mainThread) mainThread->failedLow = true; } else if (bestValue >= beta) { // fails high // fails lowのときと同じ意味の処理。 alpha = (alpha + beta) / 2; beta = std::min(bestValue + delta, VALUE_INFINITE); } else { // 正常な探索結果なのでこれにてaspiration window searchは終了 break; } // delta を等比級数的に大きくしていく delta += delta / 4 + 5; ASSERT_LV3( -VALUE_INFINITE <= alpha && beta <= VALUE_INFINITE); } // MultiPVの候補手をスコア順に再度並び替えておく。 // (二番目だと思っていたほうの指し手のほうが評価値が良い可能性があるので…) std::stable_sort(rootMoves.begin(), rootMoves.begin() + PVIdx + 1); if (!mainThread) continue; // メインスレッド以外はPVを出力しない。 // また、silentモードの場合もPVは出力しない。 if (!Limits.silent) { // 停止するときに探索node数と経過時間を出力すべき。 // (そうしないと正確な探索node数がわからなくなってしまう) if (Signals.stop) sync_cout << "info nodes " << Threads.nodes_searched() << " time " << Time.elapsed() << sync_endl; // MultiPVのときは最後の候補手を求めた直後とする。 // ただし、時間が3秒以上経過してからは、MultiPVのそれぞれの指し手ごと。 else if (PVIdx + 1 == multiPV || Time.elapsed() > 3000) sync_cout << USI::pv(rootPos, rootDepth, alpha, beta) << sync_endl; } } // multi PV // ここでこの反復深化の1回分は終了したのでcompletedDepthに反映させておく。 if (!Signals.stop) completedDepth = rootDepth; if (!mainThread) continue; // ponder用の指し手として、2手目の指し手を保存しておく。 // これがmain threadのものだけでいいかどうかはよくわからないが。 // とりあえず、無いよりマシだろう。 if (mainThread->rootMoves[0].pv.size() > 1) ponder_candidate = mainThread->rootMoves[0].pv[1]; // // main threadのときは探索の停止判定が必要 // // go mateで詰み探索として呼び出されていた場合、その手数以内の詰みが見つかっていれば終了。 if (Limits.mate && bestValue >= VALUE_MATE_IN_MAX_PLY && VALUE_MATE - bestValue <= Limits.mate) Signals.stop = true; // 勝ちを読みきっているのに将棋所の表示が追いつかずに、将棋所がフリーズしていて、その間の時間ロスで // 時間切れで負けることがある。 // mateを読みきったとき、そのmateの倍以上、iterationを回しても仕方ない気がするので探索を打ち切るようにする。 if (!Limits.mate && bestValue >= VALUE_MATE_IN_MAX_PLY && (VALUE_MATE - bestValue) * 2 < rootDepth) break; // 詰まされる形についても同様。こちらはmateの2倍以上、iterationを回したなら探索を打ち切る。 if (!Limits.mate && bestValue <= VALUE_MATED_IN_MAX_PLY && (bestValue - (-VALUE_MATE)) * 2 < rootDepth) break; // 残り時間的に、次のiterationに行って良いのか、あるいは、探索をいますぐここでやめるべきか? if (Limits.use_time_management()) { // まだ停止が確定していない if (!Signals.stop && !Time.search_end) { // 1つしか合法手がない(one reply)であるだとか、利用できる時間を使いきっているだとか、 // easyMoveに合致しただとか…。 const bool F[] = { !mainThread->failedLow, bestValue >= mainThread->previousScore }; int improvingFactor = 640 - 160 * F[0] - 126 * F[1] - 124 * F[0] * F[1]; double unstablePvFactor = 1 + mainThread->bestMoveChanges; auto elapsed = Time.elapsed(); bool doEasyMove = rootMoves[0].pv[0] == easyMove && mainThread->bestMoveChanges < 0.03 && elapsed > Time.optimum() * 25 / 204; // bestMoveが何度も変更になっているならunstablePvFactorが大きくなる。 // failLowが起きてなかったり、1つ前の反復深化から値がよくなってたりするとimprovingFactorが小さくなる。 if (rootMoves.size() == 1 || elapsed > Time.optimum() * unstablePvFactor * improvingFactor / 634 || (mainThread->easyMovePlayed = doEasyMove)) { // 停止条件を満たした // 将棋の場合、フィッシャールールではないのでこの時点でも最小思考時間分だけは // 思考を継続したほうが得なので、思考自体は継続して、キリの良い時間になったらcheck_time()にて停止する。 // ponder中なら、終了時刻はponderhit後から計算して、Time.minimum()。 if (Limits.ponder) Time.search_end = Time.minimum(); else { // "ponderhit"しているときは、そこからの経過時間を丸める。 // "ponderhit"していないときは開始からの経過時間を丸める。 // そのいずれもTime.elapsed_from_ponderhit()で良い。 Time.search_end = std::max(Time.round_up(Time.elapsed_from_ponderhit()), Time.minimum()); } } } // pvが3手以上あるならEasyMoveに記録しておく。 if (rootMoves[0].pv.size() >= 3) EasyMove.update(rootPos, rootMoves[0].pv); else EasyMove.clear(); } } // iterative deeping if (!mainThread) return; // 最後の反復深化のiterationにおいて、easy moveの候補が安定していないならクリアしてしまう。 // ifの2つ目の条件は連続したeasy moveを行わないようにするためのもの。 // (どんどんeasy moveで局面が進むといずれわずかにしか読んでいない指し手を指してしまうため。) if (EasyMove.stableCnt < 6 || mainThread->easyMovePlayed) EasyMove.clear(); } // 探索開始時に呼び出される。 // この関数内で初期化を終わらせ、slaveスレッドを起動してThread::search()を呼び出す。 // そのあとslaveスレッドを終了させ、ベストな指し手を返すこと。 void MainThread::think() { // --------------------- // 探索パラメーターの自動調整用 // --------------------- param1 = Options["Param1"]; param2 = Options["Param2"]; // --------------------- // 合法手がないならここで投了 // --------------------- // lazy SMPではcompletedDepthを最後に比較するのでこれをゼロ初期化しておかないと // 探索しないときにThreads.main()の指し手が選ばれない。 for (Thread* th : Threads) th->completedDepth = 0; if (rootMoves.size() == 0) { // 詰みなのでbestmoveを返す前に読み筋として詰みのスコアを出力すべき。 if (!Limits.silent) sync_cout << "info depth 0 score " << USI::score_to_usi(-VALUE_MATE) << sync_endl; // rootMoves.at(0)がbestmoveとしてGUIに対して出力される。 rootMoves.push_back(RootMove(MOVE_RESIGN)); goto ID_END; } // --------------------- // 定跡の選択部 // --------------------- { // 定跡を用いる手数 int book_ply = Options["BookMoves"]; if (rootPos.game_ply() <= book_ply) { auto it = book.find(rootPos); if (it != book.end() && it->second.size() != 0) { // 定跡にhitした。逆順で出力しないと将棋所だと逆順にならないという問題があるので逆順で出力する。 // また、it->second->size()!=0をチェックしておかないと指し手のない定跡が登録されていたときに困る。 const auto& move_list = it->second; if (!Limits.silent) for (auto it = move_list.rbegin(); it != move_list.rend(); it++) sync_cout << "info pv " << it->bestMove << " " << it->nextMove << " (" << fixed << setprecision(2) << (100 * it->prob) << "%)" // 採択確率 << " score cp " << it->value << " depth " << it->depth << sync_endl; // このなかの一つをランダムに選択 // 無難な指し手が選びたければ、採択回数が一番多い、最初の指し手(move_list[0])を選ぶべし。 // 狭い定跡を用いるのか? bool narrowBook = Options["NarrowBook"]; size_t book_move_max = move_list.size(); if (narrowBook) { // 出現確率10%未満のものを取り除く。 for (int i = 0; i < move_list.size(); ++i) { if (move_list[i].prob < 0.1) { book_move_max = (size_t)max(i, 1); // 定跡から取り除いたことをGUIに出力 if (!Limits.silent) sync_cout << "info string narrow book moves to " << book_move_max << " moves " << sync_endl; break; } } } // 不成の指し手がRootMovesに含まれていると正しく指せない。 const auto& move = move_list[prng.rand(book_move_max)]; auto bestMove = move.bestMove; auto it_move = std::find(rootMoves.begin(), rootMoves.end(), bestMove); if (it_move != rootMoves.end()) { std::swap(rootMoves[0], *it_move); // 2手目の指し手も与えないとponder出来ない。 if (move.nextMove != MOVE_NONE) { if (rootMoves[0].pv.size() <= 1) rootMoves[0].pv.push_back(MOVE_NONE); rootMoves[0].pv[1] = move.nextMove; // これが合法手でなかったら将棋所が弾くと思う。 } goto ID_END; } // 合法手のなかに含まれていなかったので定跡の指し手は指さない。 } } } // --------------------- // 宣言勝ち判定 // --------------------- { // 宣言勝ちもあるのでこのは局面で1手勝ちならその指し手を選択 // 王手がかかっていても、回避しながらトライすることもあるので王手がかかっていようが // Position::DeclarationWin()で判定して良い。 auto bestMove = rootPos.DeclarationWin(); if (bestMove != MOVE_NONE) { // 宣言勝ちなのでroot movesの集合にはないかも知れない。強制的に書き換える。 rootMoves[0] = RootMove(bestMove); goto ID_END; } } // --------------------- // 通常の思考処理 // --------------------- // root nodeにおける自分の手番 auto us = rootPos.side_to_move(); { StateInfo si; auto& pos = rootPos; // -- MAX_PLYに到達したかの判定が面倒なのでLimits.max_game_plyに一本化する。 // あとで戻す用 auto max_game_ply = Limits.max_game_ply; Limits.max_game_ply = std::min(Limits.max_game_ply, rootPos.game_ply() + MAX_PLY -1); // --- contempt factor(引き分けのスコア) // Contempt: 引き分けを受け入れるスコア。歩を100とする。例えば、この値を100にすると引き分けの局面は // 評価値が - 100とみなされる。(互角と思っている局面であるなら引き分けを選ばずに他の指し手を選ぶ) int contempt = Options["Contempt"] * PawnValue / 100; drawValueTable[REPETITION_DRAW][ us] = VALUE_ZERO - Value(contempt); drawValueTable[REPETITION_DRAW][~us] = VALUE_ZERO + Value(contempt); // --- 今回の思考時間の設定。 Time.init(Limits, us, rootPos.game_ply()); // --------------------- // 各スレッドがsearch()を実行する // --------------------- for (Thread* th : Threads) { th->maxPly = 0; th->rootDepth = 0; if (th != this) th->start_searching(); } Thread::search(); // 復元する。 Limits.max_game_ply = max_game_ply; } // 反復深化の終了。 ID_END:; // 最大depth深さに到達したときに、ここまで実行が到達するが、 // まだSignals.stopが生じていない。しかし、ponder中や、go infiniteによる探索の場合、 // USI(UCI)プロトコルでは、"stop"や"ponderhit"コマンドをGUIから送られてくるまで // best moveを出力すべきではない。 // それゆえ、単にここでGUIからそれらのいずれかのコマンドが送られてくるまで待つ。 if (!Signals.stop && (Limits.ponder || Limits.infinite)) { // "stop"が送られてきたらSignals.stop == trueになる。 // "ponderhit"が送られてきたらLimits.ponder == 0になるのでそれを待つ。 // "go infinite"に対してはstopが送られてくるまで待つ。 while (!Signals.stop && (Limits.ponder || Limits.infinite)) sleep(10); } Signals.stop = true; // 各スレッドが終了するのを待機する(開始していなければいないで構わない) for (Thread* th : Threads.slaves) th->wait_for_search_finished(); // --------------------- // lazy SMPの結果を取り出す // --------------------- Thread* bestThread = this; // 並列して探索させていたスレッドのうち、ベストのスレッドの結果を選出する。 if (Options["MultiPV"] == 1) { // 深くまで探索できていて、かつそっちの評価値のほうが優れているならそのスレッドの指し手を採用する // 単にcompleteDepthが深いほうのスレッドを採用しても良さそうだが、スコアが良いほうの探索深さのほうが // いい指し手を発見している可能性があって楽観合議のような効果があるようだ。 for (Thread* th : Threads) if (th->completedDepth > bestThread->completedDepth && th->rootMoves[0].score > bestThread->rootMoves[0].score) bestThread = th; // 次回の探索のときに何らか使えるのでベストな指し手の評価値を保存しておく。 previousScore = bestThread->rootMoves[0].score; // ベストな指し手として返すスレッドがmain threadではないのなら、その読み筋は出力していなかったはずなので // ここで読み筋を出力しておく。 if (bestThread != this && !Limits.silent) sync_cout << USI::pv(bestThread->rootPos, bestThread->completedDepth, -VALUE_INFINITE, VALUE_INFINITE) << sync_endl; } // --------------------- // 指し手をGUIに返す // --------------------- // サイレントモードでないならbestな指し手を出力 if (!Limits.silent) { // sync_cout~sync_endlで全体を挟んでいるのでここを実行中に他スレッドの出力が割り込んでくる余地はない。 // ベストなスレッドの指し手を返す。 sync_cout << "bestmove " << bestThread->rootMoves[0].pv[0]; // ponderの指し手の出力。 // pvにはbestmoveのときの読み筋(PV)が格納されているので、ponderとしてpv[1]があればそれを出力してやる。 // また、pv[1]がない場合(rootでfail highを起こしたなど)、置換表からひねり出してみる。 if (bestThread->rootMoves[0].pv.size() > 1 || bestThread->rootMoves[0].extract_ponder_from_tt(rootPos, ponder_candidate)) std::cout << " ponder " << bestThread->rootMoves[0].pv[1]; std::cout << sync_endl; } } #endif // YANEURAOU_CLASSIC_TCE_ENGINE
nodchip/tanuki-
source/old_engines/engines/classic-tce-engine/classic-tce-search.cpp
C++
gpl-3.0
94,476
#pragma once #include <memory/AllocatorBundle.h> #include <memory/Config.h> #include <content/Texture.h> #include <components/Entities.h> #include <memory/StaticReferencedAllocator.h> #include <content/VertexTypes.h> #include "WorldMesh.h" #include <content/StaticMeshAllocator.h> #include "Waynet.h" #include <logic/ScriptEngine.h> #include <content/SkeletalMeshAllocator.h> #include <components/Entities.h> #include <physics/PhysicsSystem.h> #include <content/AnimationAllocator.h> #include <content/Sky.h> #include <logic/DialogManager.h> #include "audio/AudioWorld.h" #include <json.hpp> #include <logic/PfxManager.h> #include "BspTree.h" using json = nlohmann::json; namespace ZenLoad { class ZenParser; } namespace Engine { class BaseEngine; } namespace World { struct WorldAllocators { template<typename V, typename I> using MeshAllocator = Memory::StaticReferencedAllocator< Meshes::WorldStaticMesh, Config::MAX_NUM_LEVEL_MESHES >; typedef MeshAllocator<Meshes::UVNormColorVertex, uint32_t> WorldMeshAllocator; typedef Memory::StaticReferencedAllocator< Materials::TexturedMaterial, Config::MAX_NUM_LEVEL_MATERIALS> MaterialAllocator; Components::ComponentAllocator m_ComponentAllocator; Textures::TextureAllocator m_LevelTextureAllocator; Meshes::StaticMeshAllocator m_LevelStaticMeshAllocator; Meshes::SkeletalMeshAllocator m_LevelSkeletalMeshAllocator; Animations::AnimationAllocator m_AnimationAllocator; // TODO: Refractor this one into StaticMeshAllocator WorldMeshAllocator m_WorldMeshAllocator; MaterialAllocator m_MaterialAllocator; }; /** * All information inside this struct are only valid at a certain time of the frame, where no entities can be * (de)allocated or moved around in any way. The indices stored inside the vectors are a direct mapping to the * Elements inside the allocator, which are to be seen as invalid in the next frame! */ struct TransientEntityFeatures { std::vector<size_t> m_VisibleEntities; }; /** * Basic gametype this is. Needed for sky configuration, for example */ enum EGameType { GT_Gothic1, GT_Gothic2 }; class WorldInstance : public Handle::HandleTypeDescriptor<Handle::WorldHandle> { public: /** * Information about the state of the world */ struct WorldInfo { WorldInfo() { m_LastFrameDeltaTime = 0.0; } // Last deltatime-value we have gotten here double m_LastFrameDeltaTime; }; WorldInstance(); ~WorldInstance(); /** * @param zen file */ bool init(Engine::BaseEngine& engine, const std::string& zen, const json& j = json()); /** * Creates an entity with the given components and returns its handle */ Components::ComponentAllocator::Handle addEntity(Components::ComponentMask components = 0); /** * Removes the entitiy with the given handle */ void removeEntity(Handle::EntityHandle h); /** * Updates this world instances entities */ void onFrameUpdate(double deltaTime, float updateRangeSquared, const Math::Matrix& cameraWorld); /** * @return The component associated with the given handle */ template<typename C> C& getEntity(Handle::EntityHandle h) { return m_Allocators.m_ComponentAllocator.getElement<C>(h); } /** * @return The vob-entity of a vob using the given name */ Handle::EntityHandle getVobEntityByName(const std::string& name) { auto it = m_VobsByNames.find(name); if(it == m_VobsByNames.end()) return Handle::EntityHandle::makeInvalidHandle(); return (*it).second; } /** * Goes through the list of all vobs and returns a list of the startwaypoint-indices * @return List indices of the waypoints which are used as starting-position */ std::vector<size_t> findStartPoints(); /** * @return Basic gametype this is. Needed for sky configuration, for example */ EGameType getBasicGameType(); /** * Data access */ Components::ComponentAllocator::DataBundle getComponentDataBundle() { return m_Allocators.m_ComponentAllocator.getDataBundle(); } WorldAllocators& getAllocators() { return m_Allocators; } WorldAllocators::WorldMeshAllocator& getWorldMeshAllocator() { return m_Allocators.m_WorldMeshAllocator; } Textures::TextureAllocator& getTextureAllocator() { return m_Allocators.m_LevelTextureAllocator; } Components::ComponentAllocator& getComponentAllocator() { return m_Allocators.m_ComponentAllocator; } Meshes::StaticMeshAllocator& getStaticMeshAllocator() { return m_Allocators.m_LevelStaticMeshAllocator; } Meshes::SkeletalMeshAllocator& getSkeletalMeshAllocator() { return m_Allocators.m_LevelSkeletalMeshAllocator; } Animations::AnimationAllocator& getAnimationAllocator() { return m_Allocators.m_AnimationAllocator; } // TODO: Depricated, remove WorldAllocators::MaterialAllocator& getMaterialAllocator() { return m_Allocators.m_MaterialAllocator; } const Waynet::WaynetInstance& getWaynet() { return m_Waynet; } Logic::ScriptEngine& getScriptEngine() { return m_ScriptEngine; } Handle::WorldHandle getMyHandle() { return Handle::WorldHandle(this); } Engine::BaseEngine* getEngine() { return m_pEngine; } Physics::PhysicsSystem& getPhysicsSystem() { return m_PhysicsSystem; } Handle::CollisionShapeHandle getStaticObjectCollisionShape() { return m_StaticWorldObjectCollsionShape; } WorldMesh& getWorldMesh() { return m_WorldMesh; } Content::Sky& getSky() { return m_Sky; } Logic::DialogManager& getDialogManager() { return m_DialogManager; } World::AudioWorld& getAudioWorld() { return *m_AudioWorld; } Logic::PfxManager& getPfxManager() { return m_PfxManager; } /** * This worlds print-screen manager */ UI::PrintScreenMessages& getPrintScreenManager() const { return *m_PrintScreenMessageView; } /** * @return Information about the state of the world */ WorldInfo& getWorldInfo(){ return m_WorldInfo; } /** * @return Map of freepoints */ std::vector<Handle::EntityHandle> getFreepoints(const std::string& tag); /** * Returns a map of freepoints in the given range of the center * @param center Center of distance search * @param distance Max distance to check for * @param name Name-filter * @param closestOnly Put only the closest one into the result * @param inst Entity that want's a new freepoint, aka, should not be on any of the returned ones * @return Vector of closest freepoints */ std::vector<Handle::EntityHandle> getFreepointsInRange(const Math::float3& center, float distance, const std::string& name = "", bool closestOnly = false, Handle::EntityHandle inst = Handle::EntityHandle::makeInvalidHandle()); /** * Exports this world into a json-object * @param j json-object to write into */ void exportWorld(json& j); /** * Imports vobs from a json-object * @param j */ void importVobs(const json& j); /** * @return world-file this is built after */ const std::string& getZenFile(){ return m_ZenFile; } /** * Imports a single vob from a json-object */ void importSingleVob(const json& j); protected: /** * Initializes the Script-Engine for a ZEN-World. * Will load the .DAT-Files and setup the VM. * @param firstStart Whether this is the initial load. If true, all NPCs will be put in here. */ bool initializeScriptEngineForZenWorld(const std::string& worldName, bool firstStart = true); WorldAllocators m_Allocators; TransientEntityFeatures m_TransientEntityFeatures; /** * Loaded zen-file */ std::string m_ZenFile; /** * Worldmesh-data */ WorldMesh m_WorldMesh; /** * BSP-Tree representing this world */ BspTree m_BspTree; /** * Waynet-data */ Waynet::WaynetInstance m_Waynet; /** * Engine-instance */ Engine::BaseEngine* m_pEngine; /** * Scripting-Engine of this world */ Logic::ScriptEngine m_ScriptEngine; /** * This worlds physics system */ Physics::PhysicsSystem m_PhysicsSystem; World::AudioWorld *m_AudioWorld; /** * Sky of this world */ Content::Sky m_Sky; /** * Static collision-shape for the world */ Handle::CollisionShapeHandle m_StaticWorldObjectCollsionShape; Handle::CollisionShapeHandle m_StaticWorldMeshCollsionShape; Handle::PhysicsObjectHandle m_StaticWorldMeshPhysicsObject; Handle::PhysicsObjectHandle m_StaticWorldObjectPhysicsObject; /** * Handle of this world-instance */ Handle::WorldHandle m_MyHandle; /** * Map of vobs by their names (If they have one) */ std::unordered_map<std::string, Handle::EntityHandle> m_VobsByNames; /** * List of freepoints */ std::map<std::string, Handle::EntityHandle> m_FreePoints; /** * NPCs in this world */ std::set<Handle::EntityHandle> m_NPCEntities; /** * This worlds dialog-manager */ Logic::DialogManager m_DialogManager; /** * This worlds print-screen manager */ UI::PrintScreenMessages* m_PrintScreenMessageView; /** * Information about the state of the world */ WorldInfo m_WorldInfo; /** * Pfx-cache */ Logic::PfxManager m_PfxManager; }; }
CppAndre/REGoth
src/engine/World.h
C
gpl-3.0
9,852
// Copyright 2014-2021, University of Colorado Boulder /** * A node that presents a graphical representation of an atom's configuration. It looks somewhat like a bar graph that * grows to the right except that the "bars" are actually lines of particles. * * @author John Blanco * @author Aadish Gupta */ import merge from '../../../phet-core/js/merge.js'; import PhetFont from '../../../scenery-phet/js/PhetFont.js'; import { Node } from '../../../scenery/js/imports.js'; import { Rectangle } from '../../../scenery/js/imports.js'; import { Text } from '../../../scenery/js/imports.js'; import Panel from '../../../sun/js/Panel.js'; import Tandem from '../../../tandem/js/Tandem.js'; import shred from '../shred.js'; import ShredConstants from '../ShredConstants.js'; import shredStrings from '../shredStrings.js'; import ParticleNode from './ParticleNode.js'; const electronsColonString = shredStrings.electronsColon; const neutronsColonString = shredStrings.neutronsColon; const protonsColonString = shredStrings.protonsColon; // constants const TITLE_MAX_WIDTH_PROPORTION = 1 / 3; const MIN_VERTICAL_SPACING = 16; // Empirically Determined const LABEL_FONT = new PhetFont( 12 ); class ParticleCountDisplay extends Panel { /** * @param {NumberAtom} numberAtom Model representation of the atom * @param {number} maxParticles The maximum number of particles to display * @param {number} maxWidth The maximum width that this display should reach * @param {Object} [options] */ constructor( numberAtom, maxParticles, maxWidth, options ) { options = merge( { fill: ShredConstants.DISPLAY_PANEL_BACKGROUND_COLOR, cornerRadius: 5, pickable: false, tandem: Tandem.REQUIRED }, options ); const panelContents = new Node(); const protonTitle = new Text( protonsColonString, { font: LABEL_FONT, tandem: options.tandem.createTandem( 'protonTitle' ) } ); panelContents.addChild( protonTitle ); const neutronTitle = new Text( neutronsColonString, { font: LABEL_FONT, tandem: options.tandem.createTandem( 'neutronTitle' ) } ); panelContents.addChild( neutronTitle ); const electronTitle = new Text( electronsColonString, { font: LABEL_FONT, tandem: options.tandem.createTandem( 'electronTitle' ) } ); panelContents.addChild( electronTitle ); // Scale the title if more than allowed proportion width const maxAllowableLabelWidth = maxWidth * TITLE_MAX_WIDTH_PROPORTION; protonTitle.maxWidth = maxAllowableLabelWidth; electronTitle.maxWidth = maxAllowableLabelWidth; neutronTitle.maxWidth = maxAllowableLabelWidth; // Lay out the labels. const maxLabelWidth = Math.max( Math.max( protonTitle.width, neutronTitle.width ), electronTitle.width ); protonTitle.right = maxLabelWidth; protonTitle.top = 0; neutronTitle.right = maxLabelWidth; neutronTitle.bottom = protonTitle.bottom + Math.max( neutronTitle.height, MIN_VERTICAL_SPACING ); electronTitle.right = maxLabelWidth; electronTitle.bottom = neutronTitle.bottom + Math.max( electronTitle.height, MIN_VERTICAL_SPACING ); // Figure out the sizes of the particles and the inter-particle spacing based on the max width. const totalParticleSpace = maxWidth - protonTitle.right - 10; const nucleonRadius = totalParticleSpace / ( ( maxParticles * 2 ) + ( maxParticles - 1 ) + 2 ); const electronRadius = nucleonRadius * 0.6; // Arbitrarily chosen. const interParticleSpacing = nucleonRadius * 3; // Add an invisible spacer that will keep the control panel at a min width. const spacer = new Rectangle( maxLabelWidth, 0, interParticleSpacing * 3, 1 ); // Add the layer where the particles will live. const particleLayer = new Node( { children: [ spacer ] } ); panelContents.addChild( particleLayer ); // stored ParticleNode instances that are positioned correctly, so we just have to add/remove the // changed ones (faster than full rebuild) const protons = []; const neutrons = []; const electrons = []; // counts of the displayed number of particles let protonDisplayCount = 0; let neutronDisplayCount = 0; let electronDisplayCount = 0; // increase the particle count by 1, and return the currently displayed quantity array function incrementParticleCount( array, currentQuantity, particleType, radius, startX, startY ) { const newIndex = currentQuantity; if ( newIndex === array.length ) { // we need to create a new particle array.push( new ParticleNode( particleType, radius, { x: startX + newIndex * interParticleSpacing, y: startY } ) ); } particleLayer.addChild( array[ newIndex ] ); currentQuantity += 1; return currentQuantity; } // decrease the particle count by 1, and return the currently displayed quantity array function decrementParticleCount( array, currentQuantity ) { currentQuantity -= 1; particleLayer.removeChild( array[ currentQuantity ] ); array.splice( currentQuantity, 1 ); return currentQuantity; } // Function that updates that displayed particles. const updateParticles = function( atom ) { // feel free to refactor this, although we'd need to get a passable reference to the counts // (that's why there is duplication now) while ( atom.protonCountProperty.get() > protonDisplayCount ) { protonDisplayCount = incrementParticleCount( protons, protonDisplayCount, 'proton', nucleonRadius, protonTitle.right + interParticleSpacing, protonTitle.center.y ); } while ( atom.protonCountProperty.get() < protonDisplayCount ) { protonDisplayCount = decrementParticleCount( protons, protonDisplayCount ); } while ( atom.neutronCountProperty.get() > neutronDisplayCount ) { neutronDisplayCount = incrementParticleCount( neutrons, neutronDisplayCount, 'neutron', nucleonRadius, neutronTitle.right + interParticleSpacing, neutronTitle.center.y ); } while ( atom.neutronCountProperty.get() < neutronDisplayCount ) { neutronDisplayCount = decrementParticleCount( neutrons, neutronDisplayCount ); } while ( atom.electronCountProperty.get() > electronDisplayCount ) { electronDisplayCount = incrementParticleCount( electrons, electronDisplayCount, 'electron', electronRadius, electronTitle.right + interParticleSpacing, electronTitle.center.y ); } while ( atom.electronCountProperty.get() < electronDisplayCount ) { electronDisplayCount = decrementParticleCount( electrons, electronDisplayCount ); } }; // Hook up the update function. numberAtom.particleCountProperty.link( () => { updateParticles( numberAtom ); } ); // Initial update. updateParticles( numberAtom ); super( panelContents, options ); } } shred.register( 'ParticleCountDisplay', ParticleCountDisplay ); export default ParticleCountDisplay;
phetsims/shred
js/view/ParticleCountDisplay.js
JavaScript
gpl-3.0
7,220
/* Copyright 2014-2019 Ian Tester This file is part of Photo Finish. Photo Finish 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. Photo Finish 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 Photo Finish. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <string> #include <exception> #include <string.h> namespace PhotoFinish { inline const char* new_c_str(const std::string& s) { auto len = s.length() + 1; char *ret = new char[len]; strncpy(ret, s.c_str(), len); return ret; } //! Uninitialised attribute exception class Uninitialised : public std::exception { protected: const std::string _class, _attribute; public: //! Constructor /*! \param c Class name \param a Attribute name */ Uninitialised(const std::string& c, const std::string& a) : _class(c), _attribute(a) {} //! Constructor /*! \param c Class name */ Uninitialised(const std::string& c) : _class(c) {} virtual const char* what() const noexcept { std::string w = _class; if (_attribute.length() > 0) w += "::" + _attribute; w += " is uninitialised."; return new_c_str(w); } }; //! Unimplemented method exception class Unimplemented : public std::exception { protected: const std::string _class, _method; public: //! Constructor /*! \param c Class name \param m Method name */ Unimplemented(const std::string& c, const std::string& m) : _class(c), _method(m) {} virtual const char* what() const noexcept { return new_c_str(_class + "::" + _method + " is unimplemented."); } }; //! No results exception class NoResults : public std::exception { protected: const std::string _class, _method; public: //! Constructor /*! \param c Class name \param m Method name */ NoResults(const std::string& c, const std::string& m) : _class(c), _method(m) {} virtual const char* what() const noexcept { return new_c_str(_class + "::" + _method + " has no results."); } }; //! No targets exception class NoTargets : public std::exception { protected: const std::string _destination; public: //! Constructor /*! \param d Name of destination that has no targets */ NoTargets(const std::string& d) : _destination(d) {} virtual const char* what() const noexcept { return new_c_str("Destination \"" + _destination + "\" has no targets."); } }; //! Generic error message exception class ErrorMsg : public std::exception { protected: const std::string _msg; public: //! Constructor /*! \param m Error message */ ErrorMsg(const std::string& m) : _msg(m) {} virtual const char* what() const noexcept = 0; }; //! Memory allocation exception class MemAllocError : public ErrorMsg { public: //! Constructor /*! \param m Error message */ MemAllocError(const std::string& m) : ErrorMsg(m) {} const char* what() const noexcept { return new_c_str(_msg); } }; //! File error abstract base exception class FileError : public ErrorMsg { protected: const std::string _filepath; public: //! Constructor /*! \param fp File path \param m Error message */ FileError(const std::string& fp, const std::string& m) : ErrorMsg(m), _filepath(fp) {} //! Constructor /*! \param fp File path */ FileError(const std::string& fp) : ErrorMsg(""), _filepath(fp) {} virtual const char* what() const noexcept = 0; }; //! Unknown file type exception class UnknownFileType : public FileError { public: //! Constructor /*! \param fp File path \param m Error message */ UnknownFileType(const std::string& fp, const std::string& m) : FileError(fp, m) {} //! Constructor /*! \param fp File path */ UnknownFileType(const std::string& fp) : FileError(fp) {} virtual const char* what() const noexcept { std::string w = "Could not determine type for \"" + _filepath + "\""; if (_msg.length() > 0) w += ": " + _msg; w += "."; return new_c_str(w); } }; //! File open exception class FileOpenError : public FileError { public: //! Constructor /*! \param fp File path \param m Error message */ FileOpenError(const std::string& fp, const std::string& m) : FileError(fp, m) {} //! Constructor /*! \param fp File path */ FileOpenError(const std::string& fp) : FileError(fp) {} virtual const char* what() const noexcept { std::string w = "Could not open filepath \"" + _filepath + "\""; if (_msg.length() > 0) w += ": " + _msg; w += "."; return new_c_str(w); } }; //! File content exception class FileContentError : public FileError { public: //! Constructor /*! \param fp File path \param m Error message */ FileContentError(const std::string& fp, const std::string& m) : FileError(fp, m) {} //! Constructor /*! \param fp File path */ FileContentError(const std::string& fp) : FileError(fp) {} virtual const char* what() const noexcept { std::string w = "Something is wrong with the contents of filepath \"" + _filepath + "\""; if (_msg.length() > 0) w += ": " + _msg; w += "."; return new_c_str(w); } }; //! Destination exception class DestinationError : public ErrorMsg { private: const std::string _path, _value; public: //! Constructor /*! \param p Destination field "path" \param v Value that is wrong */ DestinationError(const std::string& p, const std::string& v) : ErrorMsg(""), _path(p), _value(v) {} virtual const char* what() const noexcept { return new_c_str("Error with value of destination field \"" + _path + "\" (\"" + _value + "\")."); } }; //! Library exception class LibraryError : public ErrorMsg { private: const std::string _lib; public: //! Constructor /*! \param l Library name \param m Error message */ LibraryError(const std::string& l, const std::string& m) : ErrorMsg(m), _lib(l) {} virtual const char* what() const noexcept { return new_c_str("Error in " + _lib + ": " + _msg + "."); } }; class cmsTypeError : public ErrorMsg { private: const unsigned int _type; public: //! Constructor /*! \param m Message string. \param t LCMS2 type. */ cmsTypeError(const std::string& m, const unsigned int& t) : ErrorMsg(m), _type(t) {} virtual const char* what() const noexcept { return new_c_str("Error with value of cmsType: " + _msg + "."); } }; //! WebP exception class WebPError : public std::exception { private: int _code; public: //! Constructor /*! \param c Error code */ WebPError(int c) : _code(c) {} virtual const char* what() const noexcept { switch (_code) { case 0: return "No error"; case 1: return "Out of memory"; case 2: return "Bitstream out of memory"; case 3: return "NULL parameter"; case 4: return "Invalid configuration"; case 5: return "Bad dimension"; case 6: return "Partition is larger than 512 KiB"; case 7: return "Partition is larger than 16 MiB"; case 8: return "Bad write"; case 9: return "File is larger than 4 GiB"; case 10: return "User abort"; } return "Dunno"; } }; }
Imroy/photofinish
include/Exception.hh
C++
gpl-3.0
8,241
//////////////////////////////////////////////////////////////////////////// // Created : 30.12.2009 // Author : Dmitriy Iassenev // Copyright (C) GSC Game World - 2009 //////////////////////////////////////////////////////////////////////////// #include "pch.h" #include "memory_leak_detector.h" #if XRAY_USE_MEMORY_LEAK_DETECTOR #include <xray/hash_multiset.h> #include <xray/intrusive_double_linked_list.h> #include <xray/logging_log_file.h> #include "fs_helper.h" #include <xray/fs_utils.h> #include "debug_call_stack.h" #include "logging.h" static xray::command_line::key s_no_leaks_detection_key("no_leaks_detection", "", "memory", "disables runtime memory leaks detection"); namespace xray { namespace memory { namespace leak_detector { struct allocation_info : public hash_multiset_intrusive_base<allocation_info> { void* stacktrace[64]; pcstr description; allocation_info* next_hash_node; u32 full_hash; u32 alive_allocations; }; struct housekeeping { allocation_info* info; housekeeping* intrusive_prev; housekeeping* intrusive_next; }; static bool enabled ( ) { static bool result = !s_no_leaks_detection_key.is_set(); return result; } class leak_detector { public: ~leak_detector (); void on_allocate (pvoid& pointer, pcstr description); void on_free (pvoid& pointer); void dump_leaks (); private: typedef hash_multiset< allocation_info, xray::detail::fixed_size_policy<16384> > allocation_info_container; typedef intrusive_double_linked_list< housekeeping, housekeeping, &housekeeping::intrusive_prev, &housekeeping::intrusive_next, threading::multi_threading_mutex_policy > pointers_container; threading::mutex m_mutex; allocation_info_container m_allocation_info; pointers_container m_pointers; }; static char s_no_monitoring_desc[] = "+"; static uninitialized_reference<leak_detector> s_leak_detector; leak_detector::~leak_detector () { for ( allocation_info_container::iterator it = m_allocation_info.begin(); it != m_allocation_info.end(); ) { allocation_info_container::iterator next_it = it; ++next_it; m_allocation_info.erase (it); allocation_info* info = *it; MT_FREE (info); it = next_it; } } void leak_detector::on_allocate (pvoid& pointer, pcstr const description) { housekeeping* const housekeeping = (memory::leak_detector::housekeeping*)pointer; if ( description && *description == s_no_monitoring_desc[0] ) // no monitoring of this pointer { housekeeping->info = 0; return; } allocation_info info; u32 stacktrace_hash; core::debug::call_stack::get_stack_trace (info.stacktrace, array_size(info.stacktrace), 62, &stacktrace_hash); u32 const desc_hash = description ? fs::crc32(description, strings::length(description)) : 0; info.full_hash = stacktrace_hash ^ desc_hash; info.description = description; info.alive_allocations = 0; m_mutex.lock (); allocation_info_container::iterator iterator = m_allocation_info.find(info.full_hash); if ( iterator == m_allocation_info.end() ) { allocation_info* const new_info = (allocation_info*)MT_MALLOC(sizeof(allocation_info), s_no_monitoring_desc); new (new_info) allocation_info; *new_info = info; m_allocation_info.insert (new_info->full_hash, new_info); housekeeping->info = new_info; } else { housekeeping->info = *iterator; } ++housekeeping->info->alive_allocations; m_mutex.unlock (); m_pointers.push_back (housekeeping); } void leak_detector::on_free (pvoid& pointer) { housekeeping* const housekeeping = (memory::leak_detector::housekeeping*)pointer; if ( !housekeeping->info ) // no monitoring of this pointer { return; } --housekeeping->info->alive_allocations; m_pointers.erase (housekeeping); } static pcstr s_full_call_stack_line_format = "%-60s(%-3d) : %-70s : %-36s : 0x%08x\n"; static pcstr s_call_stack_line_format = "%-60s : %-70s : 0x%08x\n"; struct leak_logger { FILE * m_file; leak_logger() : m_file(NULL) { if ( xray::logging::g_log_file_name.length() ) { if ( !xray::fs::open_file(& m_file, xray::fs::open_file_write | xray::fs::open_file_append, xray::logging::g_log_file_name.c_str()) ) { ; } } } ~leak_logger() { if ( m_file ) fclose (m_file); } bool predicate ( u32 call_stack_id, u32 num_call_stack_lines, pcstr module_name, pcstr file_name, int line_number, pcstr function, u32 address ) { XRAY_UNREFERENCED_PARAMETER ( num_call_stack_lines ); if ( call_stack_id < 3 ) return true; fixed_string4096 string; if ( line_number > 0 ) string.assignf (s_full_call_stack_line_format, file_name, line_number, function, module_name, address ); else string.assignf (s_call_stack_line_format, module_name, function, address); output (string); return true; } void output (buffer_string string) { xray::debug::output (string.c_str()); if ( logging::use_console_for_logging() ) logging::write_to_stdout("%s", string.c_str()); if ( m_file ) fwrite (string.c_str(), 1, string.length(), m_file); } }; // struct helper void leak_detector::dump_leaks () { if ( !xray::logging::g_log_file_name.length() && !xray::debug::is_debugger_present() ) return; m_mutex.lock (); u32 leak_index = 1; leak_logger helper; bool header_printed = false; fixed_string4096 header; header.assignf ("------------------------------------------------------------------------------------------------\n" "- MEMORY LEAKS DETECTED !!!!!!!!!!!!!!\n" "------------------------------------------------------------------------------------------------\n"); for ( allocation_info_container::iterator it = m_allocation_info.begin(); it != m_allocation_info.end(); ++it ) { allocation_info* const info = *it; if ( !info->alive_allocations ) continue; if ( !header_printed ) { helper.output (header); header_printed = true; } fixed_string4096 header; header.assignf ("------------------------------------------------------------------------------------------------\n" "LEAK #%d description: %s, alive_allocations: %d\n" "------------------------------------------------------------------------------------------------\n", leak_index, info->description, info->alive_allocations); helper.output (header); core::debug::call_stack::iterate (NULL, info->stacktrace, core::debug::call_stack::Callback(&helper, &leak_logger::predicate)); ++leak_index; } pcstr leak_message; if ( header_printed ) { leak_message = "- OMG! %d LEAKS DETECTED!!!\n"; } else { leak_message = "CONGRATULATIONS! NO LEAKS DETECTED!\n"; } header.assignf ("------------------------------------------------------------------------------------------------\n"); header.appendf (leak_message, leak_index-1); header.appendf ("------------------------------------------------------------------------------------------------\n"); helper.output (header); m_mutex.unlock (); } void initialize ( ) { XRAY_CONSTRUCT_REFERENCE (s_leak_detector, leak_detector); } void finalize ( ) { if ( enabled() ) s_leak_detector->dump_leaks ( ); XRAY_DESTROY_REFERENCE ( s_leak_detector ); } static inline size_t get_house_keeping_size_impl ( ) { return sizeof(housekeeping); } void on_alloc ( pvoid& allocation_address, size_t & allocation_size, size_t const previous_size, pcstr const allocation_description ) { XRAY_UNREFERENCED_PARAMETER ( allocation_size ); XRAY_UNREFERENCED_PARAMETER ( previous_size ); if ( !enabled() ) return; s_leak_detector->on_allocate ( allocation_address, allocation_description ); static size_t const house_keeping_size = get_house_keeping_size_impl( ); (pbyte&)allocation_address += house_keeping_size; allocation_size -= house_keeping_size; } void on_free ( pvoid& deallocation_address, bool const can_clear ) { XRAY_UNREFERENCED_PARAMETER ( can_clear ); if ( !enabled() ) return; static size_t const house_keeping_size = get_house_keeping_size_impl( ); (pbyte&)deallocation_address -= house_keeping_size; s_leak_detector->on_free ( deallocation_address ); } size_t get_house_keeping_size ( ) { if ( !enabled() ) return 0; return get_house_keeping_size_impl(); } } // namespace leak_detector } // namespace memory } // namespace xray #endif // #if XRAY_USE_MEMORY_LEAK_DETECTOR
hpl1nk/nonamegame
xray/core/sources/memory_leak_detector.cpp
C++
gpl-3.0
8,745
var searchData= [ ['phy_2ed',['phy.d',['../phy_8d.html',1,'']]], ['phy_5fksz8051mll_2ed',['phy_ksz8051mll.d',['../phy__ksz8051mll_8d.html',1,'']]], ['pwr_2ec',['pwr.c',['../pwr_8c.html',1,'']]], ['pwr_2eh',['pwr.h',['../pwr_8h.html',1,'']]], ['pwr_5fcommon_5fall_2ec',['pwr_common_all.c',['../pwr__common__all_8c.html',1,'']]], ['pwr_5fcommon_5fall_2ed',['pwr_common_all.d',['../pwr__common__all_8d.html',1,'']]], ['pwr_5fcommon_5fall_2eh',['pwr_common_all.h',['../pwr__common__all_8h.html',1,'']]] ];
Aghosh993/TARS_codebase
libopencm3/doc/stm32f1/html/search/files_b.js
JavaScript
gpl-3.0
516
#pragma once /*************************************************************** * This source files comes from the xLights project * https://www.xlights.org * https://github.com/smeighan/xLights * See the github commit history for a record of contributing * developers. * Copyright claimed based on commit dates recorded in Github * License: https://github.com/smeighan/xLights/blob/master/License.txt **************************************************************/ #include "DmxModel.h" #include "DmxColorAbility.h" #include "DmxPanTiltAbility.h" #include "DmxShutterAbility.h" class DmxMovingHead : public DmxModel, public DmxColorAbility, public DmxPanTiltAbility, public DmxShutterAbility { public: DmxMovingHead(wxXmlNode *node, const ModelManager &manager, bool zeroBased = false); virtual ~DmxMovingHead(); virtual bool HasColorAbility() override { return true; } virtual void AddTypeProperties(wxPropertyGridInterface *grid) override; virtual int OnPropertyGridChange(wxPropertyGridInterface *grid, wxPropertyGridEvent& event) override; protected: virtual void InitModel() override; virtual void ExportXlightsModel() override; virtual void ImportXlightsModel(std::string filename, xLightsFrame* xlights, float& min_x, float& max_x, float& min_y, float& max_y) override; void DrawModel(ModelPreview* preview, DrawGLUtils::xlAccumulator& va2, DrawGLUtils::xl3Accumulator& va3, const xlColor* c, float& sx, float& sy, float& sz, bool active, bool is_3d); virtual void DrawModelOnWindow(ModelPreview* preview, DrawGLUtils::xlAccumulator &va, const xlColor *c, float &sx, float &sy, bool active) override; virtual void DrawModelOnWindow(ModelPreview* preview, DrawGLUtils::xl3Accumulator &va, const xlColor *c, float &sx, float &sy, float &sz, bool active) override; virtual float GetDefaultBeamWidth() const { return 30; } void Draw3DDMXBaseLeft(DrawGLUtils::xlAccumulator& va, const xlColor& c, float& sx, float& sy, float& scale, float& pan_angle, float& rot_angle); void Draw3DDMXBaseRight(DrawGLUtils::xlAccumulator& va, const xlColor& c, float& sx, float& sy, float& scale, float& pan_angle, float& rot_angle); void Draw3DDMXHead(DrawGLUtils::xlAccumulator& va, const xlColor& c, float& sx, float& sy, float& scale, float& pan_angle, float& tilt_angle); bool hide_body = false; bool style_changed; std::string dmx_style; int dmx_style_val; float beam_length; float beam_width; private: };
cjd/xLights
xLights/models/DMX/DmxMovingHead.h
C
gpl-3.0
2,595
using System; using System.Collections.Generic; using Server; using Server.Engines.PartySystem; using Server.Network; using Server.Items; using Server.Targeting; using Server.Spells.Necromancy; using Server.Spells.Fourth; using Server.Buff.Icons; namespace Server.Spells.Mysticism { public class CleansingWindsSpell : MysticismSpell { private static SpellInfo m_Info = new SpellInfo( "Cleansing Winds", "In Vas Mani Hur", -1, 9002, Reagent.DragonBlood, Reagent.Garlic, Reagent.Ginseng, Reagent.MandrakeRoot ); public override TimeSpan CastDelayBase { get { return TimeSpan.FromSeconds(2.0); } } public override double RequiredSkill { get { return 58.0; } } public override int RequiredMana { get { return 20; } } public CleansingWindsSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info) { } public override void OnCast() { Caster.Target = new InternalTarget(this); } public void Target(Mobile targeted) { if (!Caster.CanSee(targeted)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckBSequence(targeted)) { SpellHelper.Turn(Caster, targeted); /* Soothing winds attempt to neutralize poisons, lift curses, and heal a valid * Target. The Caster's Mysticism and either Focus or Imbuing (whichever is * greater) skills determine the effectiveness of the Cleansing Winds. */ targeted.PlaySound(0x64C); List<Mobile> targets = new List<Mobile>(); targets.Add(targeted); Map map = targeted.Map; if (map != null) { var eable = map.GetMobilesInRange(targeted.Location, 2); foreach (Mobile m in eable) { if (targets.Count >= 3) break; if (targeted != m && IsValidTarget(m)) targets.Add(m); } } int baseToHeal = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 4.0) + Utility.RandomMinMax(-3, 3); baseToHeal /= targets.Count; for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; Caster.DoBeneficial(m); m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head); IEntity from = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z - 10), Caster.Map); IEntity to = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 50), Caster.Map); Effects.SendMovingParticles(from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100); Poison poison = m.Poison; int toHeal = baseToHeal; bool canHeal = true; if (MortalStrike.IsWounded(m)) { // Cleansing Winds will not heal the target after removing mortal wound. canHeal = false; } // Each Curse reduces healing by 3 points + 1% per curse level. int cursePower = EnchantedApple.GetCursePower(m); toHeal -= cursePower * 3; toHeal -= (int)(toHeal * cursePower * 0.01); // Curse removal no longer based on chance. RemoveCurses(m); if (poison != null) { int chanceBonus = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) * 37.5); int cureChance = 10000 + chanceBonus - ((poison.Level + 1) * 3500); if (cureChance > Utility.Random(10000)) { m.CurePoison(Caster); // Poison reduces healing factor by 15% per level of poison. toHeal -= (int)(toHeal * (poison.Level + 1) * 0.15); } else { // If the cure fails, the target will not be healed. canHeal = false; } } if (canHeal) m.Heal(toHeal, Caster); } } FinishSequence(); } private bool IsValidTarget(Mobile target) { Party party = Party.Get(Caster); return party != null && party.Contains(target); } private static string[] StatModNames = new string[] { "[Magic] Str Malus", "[Magic] Dex Malus", "[Magic] Int Malus" }; private void RemoveCurses(Mobile m) { StatMod mod; foreach (string statModName in StatModNames) { mod = m.GetStatMod(statModName); if (mod != null && mod.Offset < 0) m.RemoveStatMod(statModName); } m.Paralyzed = false; EvilOmenSpell.CheckEffect(m); StrangleSpell.RemoveCurse(m); CorpseSkinSpell.RemoveCurse(m); CurseSpell.RemoveEffect(m); MortalStrike.EndWound(m); BloodOathSpell.EndEffect(m); SpellPlagueSpell.RemoveEffect(m); SleepSpell.RemoveEffect(m); MindRotSpell.ClearMindRotScalar(m); BuffInfo.RemoveBuff(m, BuffIcon.Clumsy); BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind); BuffInfo.RemoveBuff(m, BuffIcon.Weaken); BuffInfo.RemoveBuff(m, BuffIcon.MassCurse); BuffInfo.RemoveBuff(m, BuffIcon.Curse); BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen); BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike); BuffInfo.RemoveBuff(m, BuffIcon.Sleep); BuffInfo.RemoveBuff(m, BuffIcon.MassSleep); BuffInfo.RemoveBuff(m, BuffIcon.Mindrot); } private class InternalTarget : Target { private CleansingWindsSpell m_Owner; public InternalTarget(CleansingWindsSpell owner) : base(12, false, TargetFlags.Beneficial) { m_Owner = owner; } protected override void OnTarget(Mobile from, object o) { if (o is Mobile) m_Owner.Target((Mobile)o); } protected override void OnTargetFinish(Mobile from) { m_Owner.FinishSequence(); } } } }
GenerationOfWorlds/GOW
Scripts/Core/Stygian Abyss/Magic/Mysticism/CleansingWindsSpell.cs
C#
gpl-3.0
7,048
# CHANGELOG ULTIMATEIMMO FOR <a href="https://www.dolibarr.org">DOLIBARR ERP CRM</a> ## 1.0 Initial version
Darkjeff/immobilier
ChangeLog.md
Markdown
gpl-3.0
110
# Battery_script Small python script to check battery level and notify user if it is under a certain threshold with an alert. ## Usage Script can run only on OS X devices, since there are some calls to the osascript library. Script can be launched directly with the command <strong>python file.py [-b N,] [-c M,] [-s K]</strong> where -b is the level of battery under which user wants to get notified, -c is the frequency (in seconds) at which script checks for a change in battery status (charging, discharging, charged, ...), -s is the frequency (in seconds) at which script checks for the battery level and eventually notifies user. By default, -b = 20% -c = 60s and -s = 20s. ## Automatic execution To automatically execute the script at boot time, move the com.user.battery_list.plist file into ~/Library/LaunchAgents and after that, from within the same folder in which now the file is, type the commands <strong>launchctl start com.user.battery_script.plist</strong> and <strong>launchctl load com.user.battery_script.plist</strong>. If arguments other then default wants need to be set, just modify the plist file adding the needed parameter and value (as you would in the command line) in the <key>ProgramArguments<key> section, inside the <array></array> section. For example, adding the tag <string>-b 30</string> will execute the script with a battery threshold level of 30% instead of 20%. In order to stop script from executing automatically, just either remove the plist file from the directory or type <strong>launchctl stop com.user.battery_script.plist</strong> and <strong>launchctl unload com.user.battery_script.plist</strong>.
Diiaablo95/Battery_script
README.md
Markdown
gpl-3.0
1,658
//############################################################################ /*! @brief std::list<>のシリアライズ @ingroup SerializationStl @file list.h @author Yoshinori Tahara(Theoride Technology) @date 2016/09/07 Created */ /* © 2016 Theoride Technology (http://theolizer.com/) All Rights Reserved. "Theolizer" is a registered trademark of Theoride Technology. "Theolizer" License In the case where you are in possession of a valid “Theolizer” License, you may use this file in accordance with the terms and conditions of the use license determined by Theoride Technology. General Public License Version 3 ("GPLv3") You may use this file in accordance with the terms and conditions of GPLv3 published by Free Software Foundation. Please confirm the contents of GPLv3 at https://www.gnu.org/licenses/gpl.txt . A copy of GPLv3 is also saved in a LICENSE.TXT file. 商用ライセンス あなたが有効なTheolizer商用ライセンスを保持している場合、 セオライド テクノロジーの定める使用許諾書の条件に従って、 このファイルを取り扱うことができます。 General Public License Version 3(以下GPLv3) Free Software Foundationが公表するGPLv3の使用条件に従って、 あなたはこのファイルを取り扱うことができます。 GPLv3の内容を https://www.gnu.org/licenses/gpl.txt にて確認して下さい。 またGPLv3のコピーをLICENSE.TXTファイルにおいてます。 */ //############################################################################ #if !defined(THEOLIZER_INTERNAL_LIST_H) #define THEOLIZER_INTERNAL_LIST_H #ifndef THEOLIZER_INTERNAL_DOXYGEN //############################################################################ // Begin //############################################################################ #include <list> #include "serializer.h" #include "internal/containers.h" THEOLIZER_PROVIDED_BY("Theoride Technology"); //############################################################################ // std::list<>対応 //############################################################################ // *************************************************************************** // 手動コード展開 // *************************************************************************** #define THEOLZIER_INTERNAL_CONTAINER_PARAMETER template<class T, class Alloc> #define THEOLZIER_INTERNAL_CONTAINER_NAME std::list #define THEOLZIER_INTERNAL_CONTAINER_ARGUMENT T, Alloc #define THEOLZIER_INTERNAL_CONTAINER_UNIQUE listTheolizer #include "internal/container_no_key.inc" // *************************************************************************** // 自動生成コード // *************************************************************************** #ifdef THEOLIZER_WRITE_CODE #define THEOLIZER_GENERATED_LAST_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kLastVersionNo,1) #define THEOLIZER_GENERATED_CLASS_TYPE THEOLIZER_INTERNAL_UNPAREN(std::list<T, Alloc>) #define THEOLIZER_GENERATED_PARAMETER_LIST template<class T, class Alloc> #define THEOLIZER_GENERATED_UNIQUE_NAME listTheolizer // ---<<< Version.1 >>>--- #define THEOLIZER_GENERATED_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kVersionNo,1) #define THEOLIZER_GENERATED_CLASS_NAME()\ THEOLIZER_INTERNAL_TEMPLATE_NAME((u8"std::list",T,Alloc)) #include <theolizer/internal/version_manual.inc> #undef THEOLIZER_GENERATED_VERSION_NO #endif//THEOLIZER_WRITE_CODE // *************************************************************************** // 定義したマクロの解放 // *************************************************************************** #undef THEOLZIER_INTERNAL_CONTAINER_PARAMETER #undef THEOLZIER_INTERNAL_CONTAINER_NAME #undef THEOLZIER_INTERNAL_CONTAINER_ARGUMENT #undef THEOLZIER_INTERNAL_CONTAINER_UNIQUE #undef THEOLIZER_INTERNAL_FULL_NAME //############################################################################ // 被ポインタ用(theolizer::ListPointee<>) //############################################################################ // *************************************************************************** // theolizer::ListPointee<> // std::list<>の単純な派生クラス // 要素をPointeeとして処理する // *************************************************************************** namespace theolizer { template<class T, class Alloc=std::allocator<T> > class THEOLIZER_ANNOTATE(CS) ListPointee : public std::list<T, Alloc> { public: using std::list<T, Alloc>::list; }; } // namespace theolizer // *************************************************************************** // 手動コード展開 // *************************************************************************** #define THEOLZIER_INTERNAL_CONTAINER_PARAMETER template<class T, class Alloc> #define THEOLZIER_INTERNAL_CONTAINER_NAME theolizer::ListPointee #define THEOLZIER_INTERNAL_CONTAINER_ARGUMENT T, Alloc #define THEOLZIER_INTERNAL_CONTAINER_UNIQUE ListPointeeTheolizer #define THEOLIZER_INTERNAL_POINTEE #include "internal/container_no_key.inc" #undef THEOLIZER_INTERNAL_POINTEE // *************************************************************************** // 自動生成コード // *************************************************************************** #ifdef THEOLIZER_WRITE_CODE #define THEOLIZER_GENERATED_LAST_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kLastVersionNo,1) #define THEOLIZER_GENERATED_CLASS_TYPE THEOLIZER_INTERNAL_UNPAREN(theolizer::ListPointee<T, Alloc>) #define THEOLIZER_GENERATED_PARAMETER_LIST template<class T, class Alloc> #define THEOLIZER_GENERATED_UNIQUE_NAME ListPointeeTheolizer // ---<<< Version.1 >>>--- #define THEOLIZER_GENERATED_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kVersionNo,1) #define THEOLIZER_GENERATED_CLASS_NAME()\ THEOLIZER_INTERNAL_TEMPLATE_NAME((u8"theolizer::ListPointee",T,Alloc)) #include <theolizer/internal/version_manual.inc> #undef THEOLIZER_GENERATED_VERSION_NO #endif//THEOLIZER_WRITE_CODE // *************************************************************************** // 定義したマクロの解放 // *************************************************************************** #undef THEOLZIER_INTERNAL_CONTAINER_PARAMETER #undef THEOLZIER_INTERNAL_CONTAINER_NAME #undef THEOLZIER_INTERNAL_CONTAINER_ARGUMENT #undef THEOLZIER_INTERNAL_CONTAINER_UNIQUE #undef THEOLIZER_INTERNAL_FULL_NAME //############################################################################ // End //############################################################################ #endif // THEOLIZER_INTERNAL_DOXYGEN #endif // THEOLIZER_INTERNAL_LIST_H
yossi-tahara/Theolizer
source/library/theolizer/list.h
C
gpl-3.0
7,020
# -*- coding: utf-8 -*- # * Copyright (C) 2012-2014 Croissance Commune # * Authors: # * Arezki Feth <f.a@majerti.fr>; # * Miotte Julien <j.m@majerti.fr>; # * TJEBBES Gaston <g.t@majerti.fr> # # This file is part of Autonomie : Progiciel de gestion de CAE. # # Autonomie 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. # # Autonomie 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 Autonomie. If not, see <http://www.gnu.org/licenses/>. """ Base tools for administrable options """ from sqlalchemy import ( Column, Integer, String, Boolean, ForeignKey, ) from sqlalchemy.util import classproperty from sqlalchemy.sql.expression import func from autonomie_base.utils.ascii import camel_case_to_name from autonomie_base.models.base import ( DBBASE, default_table_args, DBSESSION, ) from autonomie.forms import ( get_hidden_field_conf, EXCLUDED, ) class ConfigurableOption(DBBASE): """ Base class for options """ __table_args__ = default_table_args id = Column( Integer, primary_key=True, info={'colanderalchemy': get_hidden_field_conf()} ) label = Column( String(100), info={'colanderalchemy': {'title': u'Libellé'}}, nullable=False, ) active = Column( Boolean(), default=True, info={'colanderalchemy': EXCLUDED} ) order = Column( Integer, default=0, info={'colanderalchemy': get_hidden_field_conf()} ) type_ = Column( 'type_', String(30), nullable=False, info={'colanderalchemy': EXCLUDED} ) @classproperty def __mapper_args__(cls): name = cls.__name__ if name == 'ConfigurableOption': return { 'polymorphic_on': 'type_', 'polymorphic_identity': 'configurable_option' } else: return {'polymorphic_identity': camel_case_to_name(name)} @classmethod def query(cls, *args): query = super(ConfigurableOption, cls).query(*args) query = query.filter(ConfigurableOption.active == True) query = query.order_by(ConfigurableOption.order) return query def __json__(self, request): return dict( id=self.id, label=self.label, active=self.active, ) def move_up(self): """ Move the current instance up in the category's order """ order = self.order if order > 0: new_order = order - 1 self.__class__.insert(self, new_order) def move_down(self): """ Move the current instance down in the category's order """ order = self.order new_order = order + 1 self.__class__.insert(self, new_order) @classmethod def get_next_order(cls): """ :returns: The next available order :rtype: int """ query = DBSESSION().query(func.max(cls.order)).filter_by(active=True) query = query.filter_by( type_=cls.__mapper_args__['polymorphic_identity'] ) query = query.first() if query is not None and query[0] is not None: result = query[0] + 1 else: result = 0 return result @classmethod def _query_active_items(cls): """ Build a query to collect active items of the current class :rtype: :class:`sqlalchemy.Query` """ return DBSESSION().query(cls).filter_by( type_=cls.__mapper_args__['polymorphic_identity'] ).filter_by(active=True) @classmethod def insert(cls, item, new_order): """ Place the item at the given index :param obj item: The item to move :param int new_order: The new index of the item """ query = cls._query_active_items() items = query.filter(cls.id != item.id).order_by(cls.order).all() items.insert(new_order, item) for index, item in enumerate(items): item.order = index DBSESSION().merge(item) @classmethod def reorder(cls): """ Regenerate order attributes """ items = cls._query_active_items().order_by(cls.order).all() for index, item in enumerate(items): item.order = index DBSESSION().merge(item) def get_id_foreignkey_col(foreignkey_str): """ Return an id column as a foreignkey with correct colander configuration foreignkey_str The foreignkey our id is pointing to """ column = Column( "id", Integer, ForeignKey(foreignkey_str), primary_key=True, info={'colanderalchemy': get_hidden_field_conf()}, ) return column
CroissanceCommune/autonomie
autonomie/models/options.py
Python
gpl-3.0
5,322
// // deskhare // Copyright (C) 2017 Richard Liebscher // // 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/>. // #include "xbelreader.h" namespace Deskhare { using Ascii = QLatin1String; XbelReader::XbelReader() = default; bool XbelReader::read(QIODevice* device) { xml_.setDevice(device); if (xml_.readNextStartElement()) { if (xml_.name() == Ascii("xbel") && xml_.attributes().value(Ascii("version")) == Ascii("1.0")) { readXbel(); } else { xml_.raiseError(tr("The file is not an XBEL version 1.0 file.")); } } return !xml_.error(); } QVector<XbelBookmark> XbelReader::bookmarks() const { return bookmarks_; } void XbelReader::readXbel() { while (xml_.readNextStartElement()) { if (xml_.name() == Ascii("folder")) readFolder(); else if (xml_.name() == Ascii("bookmark")) readBookmark(); else xml_.skipCurrentElement(); } } void XbelReader::readBookmark() { bookmarks_.push_back(XbelBookmark()); auto& back = bookmarks_.back(); auto attrs = xml_.attributes(); back.added = readDateTime(attrs.value(Ascii("added"))); back.modified = readDateTime(attrs.value(Ascii("modified"))); back.visited = readDateTime(attrs.value(Ascii("visited"))); back.href = QUrl::fromUserInput(attrs.value(Ascii("href")).toString()); while (xml_.readNextStartElement()) { if (xml_.name() == Ascii("title")) back.title = xml_.readElementText(); else xml_.skipCurrentElement(); } } void XbelReader::readFolder() { while (xml_.readNextStartElement()) { if (xml_.name() == Ascii("folder")) readFolder(); else if (xml_.name() == Ascii("bookmark")) readBookmark(); else xml_.skipCurrentElement(); } } QDateTime XbelReader::readDateTime(const QStringRef& dateTime) { if (dateTime.isEmpty()) return QDateTime(); return QDateTime::fromString(dateTime.toString(), Qt::ISODate); } } // namespace Deskhare
R1tschY/deskhare
plugins/xdg/parser/xbelreader.cpp
C++
gpl-3.0
2,544
import json from mflow_nodes.processors.base import BaseProcessor from mflow_nodes.stream_node import get_processor_function, get_receiver_function from mflow_nodes.node_manager import NodeManager def setup_file_writing_receiver(connect_address, output_filename): """ Setup a node that writis the message headers into an output file for later inspection. :param connect_address: Address the node connects to. :param output_filename: Output file. :return: Instance of ExternalProcessWrapper. """ # Format the output file. with open(output_filename, 'w') as output_file: output_file.write("[]") def process_message(message): with open(output_filename, 'r') as input_file: test_data = json.load(input_file) test_data.append(message.get_header()) with open(output_filename, 'w') as output: output.write(json.dumps(test_data, indent=4)) processor = BaseProcessor() processor.process_message = process_message receiver = NodeManager(processor_function=get_processor_function(processor=processor, connection_address=connect_address), receiver_function=get_receiver_function(connection_address=connect_address), processor_instance=processor) return receiver
datastreaming/mflow_nodes
tests/helpers.py
Python
gpl-3.0
1,389
package hu.gyulbro.webservice.controller; import hu.gyulbro.webservice.duplicate.UserBO; import hu.gyulbro.webservice.service.CheckExistingUsers; import hu.gyulbro.webservice.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; @RestController public class LoginController { private UserService usersService; @Autowired public void setUsersService(UserService userService) { this.usersService = userService; } @RequestMapping(value = "/login/{loginCredentials}", method = RequestMethod.GET) @ResponseBody List<String> loginAttempt(@PathVariable ArrayList<String> loginCredentials) { String validLogin = usersService.isPasswordCorrect(loginCredentials.get(0), loginCredentials.get(1)); List<String> result = new ArrayList<>(); if ("succeed".equals(validLogin)) { String userID = usersService.getUserID(loginCredentials.get(0)); return usersService.getUserDataToList(userID); } else { result.add(validLogin); } return result; } @RequestMapping(value = "/register/{registrationCredentials}", method = RequestMethod.POST) @ResponseBody String createUser(@PathVariable ArrayList<String> registrationCredentials) { //nickname, email CheckExistingUsers checker = new CheckExistingUsers(registrationCredentials.get(0), registrationCredentials.get(1)); String result = checker.checkNickAndMail(); if (result.equals("fine")) { UserBO userToCreate = new UserBO( registrationCredentials.get(0), //nickname registrationCredentials.get(1), //email registrationCredentials.get(2), //firstName registrationCredentials.get(3), //lastName registrationCredentials.get(4)); //password String userId = usersService.generateUserID(); userToCreate.setUserID(userId); usersService.addNewUser(userToCreate); return "succeed"; } else { return result; } } @RequestMapping(value = "/google/{googleCredentials}", method = RequestMethod.POST) @ResponseBody List<String> googleAuth(@PathVariable ArrayList<String> registrationCredentials) { String nickname = registrationCredentials.get(0); String firstName = registrationCredentials.get(1); String lastName = registrationCredentials.get(2); String email = registrationCredentials.get(3); String googleID = registrationCredentials.get(4); String result = usersService.googleAuth(email, googleID); CheckExistingUsers checkExistingUsers = new CheckExistingUsers(); boolean isNickValidated = false; Integer i = 0; List<String> userDataToPass = new ArrayList<>(); while (!isNickValidated) { isNickValidated = checkExistingUsers.isNickNameExisting(nickname); if (isNickValidated) { nickname = usersService.generateNewNick(firstName, lastName + i.toString()); isNickValidated = false; i++; } else { isNickValidated = true; } } if ("logged_in".equals(result)) { String userID = usersService.getIDbyGoogleID(googleID); userDataToPass = usersService.getUserDataToList(userID); } else if ("not_existing".equals(result)) { UserBO googleUserToCreate = new UserBO( nickname, //nickname email, //email firstName, //firstName lastName, //lastName null);//password googleUserToCreate.setUserID(usersService.generateUserID()); googleUserToCreate.setGoogleID(googleID); usersService.addNewUser(googleUserToCreate); } else { String userID = usersService.getIDbyGoogleID(googleID); usersService.changeEmail(userID, email); userDataToPass = usersService.getUserDataToList(userID); } return userDataToPass; } }
Transfet/SamuEntropy
cs/NorbironSync/main/hu/gyulbro/webservice/controller/LoginController.java
Java
gpl-3.0
4,319
//------------------------------------------------------------------------------ // <auto-generated> // Dieser Code wurde von einem Tool generiert. // Laufzeitversion:4.0.30319.18408 // // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn // der Code erneut generiert wird. // </auto-generated> //------------------------------------------------------------------------------ namespace GraficDisplay.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } }
EnricoBeltramo/ArduDebug
PC interface/Project/ArduDebug/GraphDisplay/GraficalDisplay/Properties/Settings.Designer.cs
C#
gpl-3.0
1,108
/** * 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 org.jivesoftware.smackx.bytestreams.socks5; import java.io.IOException; import java.net.Socket; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeoutException; import org.jivesoftware.smack.AbstractConnectionListener; import org.jivesoftware.smack.Connection; import org.jivesoftware.smack.ConnectionCreationListener; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.XMPPError; import org.jivesoftware.smackx.ServiceDiscoveryManager; import org.jivesoftware.smackx.bytestreams.BytestreamListener; import org.jivesoftware.smackx.bytestreams.BytestreamManager; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHostUsed; import org.jivesoftware.smackx.filetransfer.FileTransferManager; import org.jivesoftware.smackx.packet.DiscoverInfo; import org.jivesoftware.smackx.packet.DiscoverItems; import org.jivesoftware.smackx.packet.SyncPacketSend; import org.jivesoftware.smackx.packet.DiscoverInfo.Identity; import org.jivesoftware.smackx.packet.DiscoverItems.Item; /** * The Socks5BytestreamManager class handles establishing SOCKS5 Bytestreams as specified in the <a * href="http://xmpp.org/extensions/xep-0065.html">XEP-0065</a>. * <p> * A SOCKS5 Bytestream is negotiated partly over the XMPP XML stream and partly over a separate * socket. The actual transfer though takes place over a separately created socket. * <p> * A SOCKS5 Bytestream generally has three parties, the initiator, the target, and the stream host. * The stream host is a specialized SOCKS5 proxy setup on a server, or, the initiator can act as the * stream host. * <p> * To establish a SOCKS5 Bytestream invoke the {@link #establishSession(String)} method. This will * negotiate a SOCKS5 Bytestream with the given target JID and return a socket. * <p> * If a session ID for the SOCKS5 Bytestream was already negotiated (e.g. while negotiating a file * transfer) invoke {@link #establishSession(String, String)}. * <p> * To handle incoming SOCKS5 Bytestream requests add an {@link Socks5BytestreamListener} to the * manager. There are two ways to add this listener. If you want to be informed about incoming * SOCKS5 Bytestreams from a specific user add the listener by invoking * {@link #addIncomingBytestreamListener(BytestreamListener, String)}. If the listener should * respond to all SOCKS5 Bytestream requests invoke * {@link #addIncomingBytestreamListener(BytestreamListener)}. * <p> * Note that the registered {@link Socks5BytestreamListener} will NOT be notified on incoming Socks5 * bytestream requests sent in the context of <a * href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See * {@link FileTransferManager}) * <p> * If no {@link Socks5BytestreamListener}s are registered, all incoming SOCKS5 Bytestream requests * will be rejected by returning a &lt;not-acceptable/&gt; error to the initiator. * * @author Henning Staib */ public final class Socks5BytestreamManager implements BytestreamManager { /* * create a new Socks5BytestreamManager and register a shutdown listener on every established * connection */ static { Connection.addConnectionCreationListener(new ConnectionCreationListener() { public void connectionCreated(Connection connection) { final Socks5BytestreamManager manager; manager = Socks5BytestreamManager.getBytestreamManager(connection); // register shutdown listener connection.addConnectionListener(new AbstractConnectionListener() { public void connectionClosed() { manager.disableService(); } }); } }); } /** * The XMPP namespace of the SOCKS5 Bytestream */ public static final String NAMESPACE = "http://jabber.org/protocol/bytestreams"; /* prefix used to generate session IDs */ private static final String SESSION_ID_PREFIX = "js5_"; /* random generator to create session IDs */ private final static Random randomGenerator = new Random(); /* stores one Socks5BytestreamManager for each XMPP connection */ private final static Map<Connection, Socks5BytestreamManager> managers = new HashMap<Connection, Socks5BytestreamManager>(); /* XMPP connection */ private final Connection connection; /* * assigns a user to a listener that is informed if a bytestream request for this user is * received */ private final Map<String, BytestreamListener> userListeners = new ConcurrentHashMap<String, BytestreamListener>(); /* * list of listeners that respond to all bytestream requests if there are not user specific * listeners for that request */ private final List<BytestreamListener> allRequestListeners = Collections.synchronizedList(new LinkedList<BytestreamListener>()); /* listener that handles all incoming bytestream requests */ private final InitiationListener initiationListener; /* timeout to wait for the response to the SOCKS5 Bytestream initialization request */ private int targetResponseTimeout = 10000; /* timeout for connecting to the SOCKS5 proxy selected by the target */ private int proxyConnectionTimeout = 10000; /* blacklist of errornous SOCKS5 proxies */ private final List<String> proxyBlacklist = Collections.synchronizedList(new LinkedList<String>()); /* remember the last proxy that worked to prioritize it */ private String lastWorkingProxy = null; /* flag to enable/disable prioritization of last working proxy */ private boolean proxyPrioritizationEnabled = true; /* * list containing session IDs of SOCKS5 Bytestream initialization packets that should be * ignored by the InitiationListener */ private List<String> ignoredBytestreamRequests = Collections.synchronizedList(new LinkedList<String>()); /** * Returns the Socks5BytestreamManager to handle SOCKS5 Bytestreams for a given * {@link Connection}. * <p> * If no manager exists a new is created and initialized. * * @param connection the XMPP connection or <code>null</code> if given connection is * <code>null</code> * @return the Socks5BytestreamManager for the given XMPP connection */ public static synchronized Socks5BytestreamManager getBytestreamManager(Connection connection) { if (connection == null) { return null; } Socks5BytestreamManager manager = managers.get(connection); if (manager == null) { manager = new Socks5BytestreamManager(connection); managers.put(connection, manager); manager.activate(); } return manager; } /** * Private constructor. * * @param connection the XMPP connection */ private Socks5BytestreamManager(Connection connection) { this.connection = connection; this.initiationListener = new InitiationListener(this); } /** * Adds BytestreamListener that is called for every incoming SOCKS5 Bytestream request unless * there is a user specific BytestreamListener registered. * <p> * If no listeners are registered all SOCKS5 Bytestream request are rejected with a * &lt;not-acceptable/&gt; error. * <p> * Note that the registered {@link BytestreamListener} will NOT be notified on incoming Socks5 * bytestream requests sent in the context of <a * href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See * {@link FileTransferManager}) * * @param listener the listener to register */ public void addIncomingBytestreamListener(BytestreamListener listener) { this.allRequestListeners.add(listener); } /** * Removes the given listener from the list of listeners for all incoming SOCKS5 Bytestream * requests. * * @param listener the listener to remove */ public void removeIncomingBytestreamListener(BytestreamListener listener) { this.allRequestListeners.remove(listener); } /** * Adds BytestreamListener that is called for every incoming SOCKS5 Bytestream request from the * given user. * <p> * Use this method if you are awaiting an incoming SOCKS5 Bytestream request from a specific * user. * <p> * If no listeners are registered all SOCKS5 Bytestream request are rejected with a * &lt;not-acceptable/&gt; error. * <p> * Note that the registered {@link BytestreamListener} will NOT be notified on incoming Socks5 * bytestream requests sent in the context of <a * href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See * {@link FileTransferManager}) * * @param listener the listener to register * @param initiatorJID the JID of the user that wants to establish a SOCKS5 Bytestream */ public void addIncomingBytestreamListener(BytestreamListener listener, String initiatorJID) { this.userListeners.put(initiatorJID, listener); } /** * Removes the listener for the given user. * * @param initiatorJID the JID of the user the listener should be removed */ public void removeIncomingBytestreamListener(String initiatorJID) { this.userListeners.remove(initiatorJID); } /** * Use this method to ignore the next incoming SOCKS5 Bytestream request containing the given * session ID. No listeners will be notified for this request and and no error will be returned * to the initiator. * <p> * This method should be used if you are awaiting a SOCKS5 Bytestream request as a reply to * another packet (e.g. file transfer). * * @param sessionID to be ignored */ public void ignoreBytestreamRequestOnce(String sessionID) { this.ignoredBytestreamRequests.add(sessionID); } /** * Disables the SOCKS5 Bytestream manager by removing the SOCKS5 Bytestream feature from the * service discovery, disabling the listener for SOCKS5 Bytestream initiation requests and * resetting its internal state. * <p> * To re-enable the SOCKS5 Bytestream feature invoke {@link #getBytestreamManager(Connection)}. * Using the file transfer API will automatically re-enable the SOCKS5 Bytestream feature. */ public synchronized void disableService() { // remove initiation packet listener this.connection.removePacketListener(this.initiationListener); // shutdown threads this.initiationListener.shutdown(); // clear listeners this.allRequestListeners.clear(); this.userListeners.clear(); // reset internal state this.lastWorkingProxy = null; this.proxyBlacklist.clear(); this.ignoredBytestreamRequests.clear(); // remove manager from static managers map managers.remove(this.connection); // shutdown local SOCKS5 proxy if there are no more managers for other connections if (managers.size() == 0) { Socks5Proxy.getSocks5Proxy().stop(); } // remove feature from service discovery ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connection); // check if service discovery is not already disposed by connection shutdown if (serviceDiscoveryManager != null) { serviceDiscoveryManager.removeFeature(NAMESPACE); } } /** * Returns the timeout to wait for the response to the SOCKS5 Bytestream initialization request. * Default is 10000ms. * * @return the timeout to wait for the response to the SOCKS5 Bytestream initialization request */ public int getTargetResponseTimeout() { if (this.targetResponseTimeout <= 0) { this.targetResponseTimeout = 10000; } return targetResponseTimeout; } /** * Sets the timeout to wait for the response to the SOCKS5 Bytestream initialization request. * Default is 10000ms. * * @param targetResponseTimeout the timeout to set */ public void setTargetResponseTimeout(int targetResponseTimeout) { this.targetResponseTimeout = targetResponseTimeout; } /** * Returns the timeout for connecting to the SOCKS5 proxy selected by the target. Default is * 10000ms. * * @return the timeout for connecting to the SOCKS5 proxy selected by the target */ public int getProxyConnectionTimeout() { if (this.proxyConnectionTimeout <= 0) { this.proxyConnectionTimeout = 10000; } return proxyConnectionTimeout; } /** * Sets the timeout for connecting to the SOCKS5 proxy selected by the target. Default is * 10000ms. * * @param proxyConnectionTimeout the timeout to set */ public void setProxyConnectionTimeout(int proxyConnectionTimeout) { this.proxyConnectionTimeout = proxyConnectionTimeout; } /** * Returns if the prioritization of the last working SOCKS5 proxy on successive SOCKS5 * Bytestream connections is enabled. Default is <code>true</code>. * * @return <code>true</code> if prioritization is enabled, <code>false</code> otherwise */ public boolean isProxyPrioritizationEnabled() { return proxyPrioritizationEnabled; } /** * Enable/disable the prioritization of the last working SOCKS5 proxy on successive SOCKS5 * Bytestream connections. * * @param proxyPrioritizationEnabled enable/disable the prioritization of the last working * SOCKS5 proxy */ public void setProxyPrioritizationEnabled(boolean proxyPrioritizationEnabled) { this.proxyPrioritizationEnabled = proxyPrioritizationEnabled; } /** * Establishes a SOCKS5 Bytestream with the given user and returns the Socket to send/receive * data to/from the user. * <p> * Use this method to establish SOCKS5 Bytestreams to users accepting all incoming Socks5 * bytestream requests since this method doesn't provide a way to tell the user something about * the data to be sent. * <p> * To establish a SOCKS5 Bytestream after negotiation the kind of data to be sent (e.g. file * transfer) use {@link #establishSession(String, String)}. * * @param targetJID the JID of the user a SOCKS5 Bytestream should be established * @return the Socket to send/receive data to/from the user * @throws XMPPException if the user doesn't support or accept SOCKS5 Bytestreams, if no Socks5 * Proxy could be found, if the user couldn't connect to any of the SOCKS5 Proxies * @throws IOException if the bytestream could not be established * @throws InterruptedException if the current thread was interrupted while waiting */ public Socks5BytestreamSession establishSession(String targetJID) throws XMPPException, IOException, InterruptedException { String sessionID = getNextSessionID(); return establishSession(targetJID, sessionID); } /** * Establishes a SOCKS5 Bytestream with the given user using the given session ID and returns * the Socket to send/receive data to/from the user. * * @param targetJID the JID of the user a SOCKS5 Bytestream should be established * @param sessionID the session ID for the SOCKS5 Bytestream request * @return the Socket to send/receive data to/from the user * @throws XMPPException if the user doesn't support or accept SOCKS5 Bytestreams, if no Socks5 * Proxy could be found, if the user couldn't connect to any of the SOCKS5 Proxies * @throws IOException if the bytestream could not be established * @throws InterruptedException if the current thread was interrupted while waiting */ public Socks5BytestreamSession establishSession(String targetJID, String sessionID) throws XMPPException, IOException, InterruptedException { // check if target supports SOCKS5 Bytestream if (!supportsSocks5(targetJID)) { throw new XMPPException(targetJID + " doesn't support SOCKS5 Bytestream"); } // determine SOCKS5 proxies from XMPP-server List<String> proxies = determineProxies(); // determine address and port of each proxy List<StreamHost> streamHosts = determineStreamHostInfos(proxies); // compute digest String digest = Socks5Utils.createDigest(sessionID, this.connection.getUser(), targetJID); if (streamHosts.isEmpty()) { throw new XMPPException("no SOCKS5 proxies available"); } // prioritize last working SOCKS5 proxy if exists if (this.proxyPrioritizationEnabled && this.lastWorkingProxy != null) { StreamHost selectedStreamHost = null; for (StreamHost streamHost : streamHosts) { if (streamHost.getJID().equals(this.lastWorkingProxy)) { selectedStreamHost = streamHost; break; } } if (selectedStreamHost != null) { streamHosts.remove(selectedStreamHost); streamHosts.add(0, selectedStreamHost); } } Socks5Proxy socks5Proxy = Socks5Proxy.getSocks5Proxy(); try { // add transfer digest to local proxy to make transfer valid socks5Proxy.addTransfer(digest); // create initiation packet Bytestream initiation = createBytestreamInitiation(sessionID, targetJID, streamHosts); // send initiation packet Packet response = SyncPacketSend.getReply(this.connection, initiation, getTargetResponseTimeout()); // extract used stream host from response StreamHostUsed streamHostUsed = ((Bytestream) response).getUsedHost(); StreamHost usedStreamHost = initiation.getStreamHost(streamHostUsed.getJID()); if (usedStreamHost == null) { throw new XMPPException("Remote user responded with unknown host"); } // build SOCKS5 client Socks5Client socks5Client = new Socks5ClientForInitiator(usedStreamHost, digest, this.connection, sessionID, targetJID); // establish connection to proxy Socket socket = socks5Client.getSocket(getProxyConnectionTimeout()); // remember last working SOCKS5 proxy to prioritize it for next request this.lastWorkingProxy = usedStreamHost.getJID(); // negotiation successful, return the output stream return new Socks5BytestreamSession(socket, usedStreamHost.getJID().equals( this.connection.getUser())); } catch (TimeoutException e) { throw new IOException("Timeout while connecting to SOCKS5 proxy"); } finally { // remove transfer digest if output stream is returned or an exception // occurred socks5Proxy.removeTransfer(digest); } } /** * Returns <code>true</code> if the given target JID supports feature SOCKS5 Bytestream. * * @param targetJID the target JID * @return <code>true</code> if the given target JID supports feature SOCKS5 Bytestream * otherwise <code>false</code> * @throws XMPPException if there was an error querying target for supported features */ private boolean supportsSocks5(String targetJID) throws XMPPException { ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connection); DiscoverInfo discoverInfo = serviceDiscoveryManager.discoverInfo(targetJID); return discoverInfo.containsFeature(NAMESPACE); } /** * Returns a list of JIDs of SOCKS5 proxies by querying the XMPP server. The SOCKS5 proxies are * in the same order as returned by the XMPP server. * * @return list of JIDs of SOCKS5 proxies * @throws XMPPException if there was an error querying the XMPP server for SOCKS5 proxies */ private List<String> determineProxies() throws XMPPException { ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connection); List<String> proxies = new ArrayList<String>(); // get all items form XMPP server DiscoverItems discoverItems = serviceDiscoveryManager.discoverItems(this.connection.getServiceName()); Iterator<Item> itemIterator = discoverItems.getItems(); // query all items if they are SOCKS5 proxies while (itemIterator.hasNext()) { Item item = itemIterator.next(); // skip blacklisted servers if (this.proxyBlacklist.contains(item.getEntityID())) { continue; } try { DiscoverInfo proxyInfo; proxyInfo = serviceDiscoveryManager.discoverInfo(item.getEntityID()); Iterator<Identity> identities = proxyInfo.getIdentities(); // item must have category "proxy" and type "bytestream" while (identities.hasNext()) { Identity identity = identities.next(); if ("proxy".equalsIgnoreCase(identity.getCategory()) && "bytestreams".equalsIgnoreCase(identity.getType())) { proxies.add(item.getEntityID()); break; } /* * server is not a SOCKS5 proxy, blacklist server to skip next time a Socks5 * bytestream should be established */ this.proxyBlacklist.add(item.getEntityID()); } } catch (XMPPException e) { // blacklist errornous server this.proxyBlacklist.add(item.getEntityID()); } } return proxies; } /** * Returns a list of stream hosts containing the IP address an the port for the given list of * SOCKS5 proxy JIDs. The order of the returned list is the same as the given list of JIDs * excluding all SOCKS5 proxies who's network settings could not be determined. If a local * SOCKS5 proxy is running it will be the first item in the list returned. * * @param proxies a list of SOCKS5 proxy JIDs * @return a list of stream hosts containing the IP address an the port */ private List<StreamHost> determineStreamHostInfos(List<String> proxies) { List<StreamHost> streamHosts = new ArrayList<StreamHost>(); // add local proxy on first position if exists List<StreamHost> localProxies = getLocalStreamHost(); if (localProxies != null) { streamHosts.addAll(localProxies); } // query SOCKS5 proxies for network settings for (String proxy : proxies) { Bytestream streamHostRequest = createStreamHostRequest(proxy); try { Bytestream response = (Bytestream) SyncPacketSend.getReply(this.connection, streamHostRequest); streamHosts.addAll(response.getStreamHosts()); } catch (XMPPException e) { // blacklist errornous proxies this.proxyBlacklist.add(proxy); } } return streamHosts; } /** * Returns a IQ packet to query a SOCKS5 proxy its network settings. * * @param proxy the proxy to query * @return IQ packet to query a SOCKS5 proxy its network settings */ private Bytestream createStreamHostRequest(String proxy) { Bytestream request = new Bytestream(); request.setType(IQ.Type.GET); request.setTo(proxy); return request; } /** * Returns the stream host information of the local SOCKS5 proxy containing the IP address and * the port or null if local SOCKS5 proxy is not running. * * @return the stream host information of the local SOCKS5 proxy or null if local SOCKS5 proxy * is not running */ private List<StreamHost> getLocalStreamHost() { // get local proxy singleton Socks5Proxy socks5Server = Socks5Proxy.getSocks5Proxy(); if (socks5Server.isRunning()) { List<String> addresses = socks5Server.getLocalAddresses(); int port = socks5Server.getPort(); if (addresses.size() >= 1) { List<StreamHost> streamHosts = new ArrayList<StreamHost>(); for (String address : addresses) { StreamHost streamHost = new StreamHost(this.connection.getUser(), address); streamHost.setPort(port); streamHosts.add(streamHost); } return streamHosts; } } // server is not running or local address could not be determined return null; } /** * Returns a SOCKS5 Bytestream initialization request packet with the given session ID * containing the given stream hosts for the given target JID. * * @param sessionID the session ID for the SOCKS5 Bytestream * @param targetJID the target JID of SOCKS5 Bytestream request * @param streamHosts a list of SOCKS5 proxies the target should connect to * @return a SOCKS5 Bytestream initialization request packet */ private Bytestream createBytestreamInitiation(String sessionID, String targetJID, List<StreamHost> streamHosts) { Bytestream initiation = new Bytestream(sessionID); // add all stream hosts for (StreamHost streamHost : streamHosts) { initiation.addStreamHost(streamHost); } initiation.setType(IQ.Type.SET); initiation.setTo(targetJID); return initiation; } /** * Responses to the given packet's sender with a XMPP error that a SOCKS5 Bytestream is not * accepted. * * @param packet Packet that should be answered with a not-acceptable error */ protected void replyRejectPacket(IQ packet) { XMPPError xmppError = new XMPPError(XMPPError.Condition.no_acceptable); IQ errorIQ = IQ.createErrorResponse(packet, xmppError); this.connection.sendPacket(errorIQ); } /** * Activates the Socks5BytestreamManager by registering the SOCKS5 Bytestream initialization * listener and enabling the SOCKS5 Bytestream feature. */ private void activate() { // register bytestream initiation packet listener this.connection.addPacketListener(this.initiationListener, this.initiationListener.getFilter()); // enable SOCKS5 feature enableService(); } /** * Adds the SOCKS5 Bytestream feature to the service discovery. */ private void enableService() { ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(this.connection); if (!manager.includesFeature(NAMESPACE)) { manager.addFeature(NAMESPACE); } } /** * Returns a new unique session ID. * * @return a new unique session ID */ private String getNextSessionID() { StringBuilder buffer = new StringBuilder(); buffer.append(SESSION_ID_PREFIX); buffer.append(Math.abs(randomGenerator.nextLong())); return buffer.toString(); } /** * Returns the XMPP connection. * * @return the XMPP connection */ protected Connection getConnection() { return this.connection; } /** * Returns the {@link BytestreamListener} that should be informed if a SOCKS5 Bytestream request * from the given initiator JID is received. * * @param initiator the initiator's JID * @return the listener */ protected BytestreamListener getUserListener(String initiator) { return this.userListeners.get(initiator); } /** * Returns a list of {@link BytestreamListener} that are informed if there are no listeners for * a specific initiator. * * @return list of listeners */ protected List<BytestreamListener> getAllRequestListeners() { return this.allRequestListeners; } /** * Returns the list of session IDs that should be ignored by the InitialtionListener * * @return list of session IDs */ protected List<String> getIgnoredBytestreamRequests() { return ignoredBytestreamRequests; } }
ErkiDerLoony/xpeter
lib/smack-3.2.1-source/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java
Java
gpl-3.0
30,850
/* Copyright 2016 SINTEF ICT, Applied Mathematics. This file is part of The Open Porous Media project (OPM). OPM 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. OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #define BOOST_TEST_MODULE UpscaleHelperGravityPressure // Enable intrusive unit-testing of private property // // ::Opm::RelPermUpscaleHelper::dP // #define UNITTEST_TRESPASS_PRIVATE_PROPERTY_DP 1 #include <dune/common/version.hh> #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) #include <dune/common/parallel/mpihelper.hh> #else #include <dune/common/mpihelper.hh> #endif #include <opm/upscaling/RelPermUtils.hpp> #undef UNITTEST_TRESPASS_PRIVATE_PROPERTY_DP #include <opm/parser/eclipse/Parser/Parser.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Units/Units.hpp> #include <cmath> #include <cstddef> #include <functional> #include <initializer_list> #include <map> #include <memory> #include <string> #include <utility> #include <boost/test/unit_test.hpp> #include <boost/test/floating_point_comparison.hpp> namespace { // Case utilities namespace GridInput { namespace detail { std::string RUNSPEC() { return R"~~( RUNSPEC DIMENS 1 1 10 / OIL WATER METRIC )~~"; } // Note: Must be COORD + ZCORN because of details of // implementation of Opm::UpscalerBase--notably the // representation of the rock properties. std::string GRID() { return R"~~( GRID COORD 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 0 1 1 0 1 1 0 / ZCORN 4*0.0 4*0.1 4*0.1 4*0.2 4*0.2 4*0.3 4*0.3 4*0.4 4*0.4 4*0.5 4*0.5 4*0.6 4*0.6 4*0.7 4*0.7 4*0.8 4*0.8 4*0.9 4*0.9 4*1.0 / PERMX 10*100 / PERMY 10*100 / PERMZ 10*10 / PORO 10*0.3 / )~~"; } } // detail std::string basic() { return detail::RUNSPEC() + detail::GRID(); } } // GridInput namespace Options { using Opt = std::map<std::string, std::string>; namespace detail { Opt tesselateBasic() { return { {"linsolver_tolerance", "1e-12"}, {"linsolver_verbosity", "0"}, {"linsolver_type", "3"}, {"linsolver_max_iterations", "0"}, {"linsolver_smooth_steps", "1"}, {"linsolver_prolongate_factor", "1.0"}, {"minPerm", "1e-12"}, // mD }; } Opt fluidSystem() { return { { "fluids", "ow" }, }; } Opt boundaryCondition() { return { { "bc", "fixed" }, }; } Opt gravityOn() { return { { "gravity", "10.0" }, }; } Opt gravityOff() { return { { "gravity", "Zero" }, }; } Opt gravityEquator() { return { { "gravity", "9.80665" }, }; } Opt densityNormal() { return { { "waterDensity", "1.0" }, // g/cm3 { "oilDensity" , "0.8" }, // g/cm3 }; } Opt densityWrong() { // String->double conversion internally effected by // std::strtod() which returns zero (0.0) when unable to // convert an input string. No error checking at time of // writing. // // These options therefore behave as if set to "0.0". return { { "waterDensity", "One" }, // g/cm3 { "oilDensity" , "Zero Point Eight" }, // g/cm3 }; } Opt mergeOptions(Opt&& into, std::initializer_list<Opt> others) { for (const auto& other : others) { into.insert(other.begin(), other.end()); } return into; } } // detail Opt baseCase() { return detail::mergeOptions(detail::tesselateBasic(), { detail::boundaryCondition(), detail::fluidSystem(), detail::gravityOn(), detail::densityNormal() }); } Opt noGravity() { return detail::mergeOptions(detail::tesselateBasic(), { detail::boundaryCondition(), detail::fluidSystem(), detail::gravityOff(), detail::densityNormal() }); } Opt noGravityWrong() { return detail::mergeOptions(detail::tesselateBasic(), { detail::boundaryCondition(), detail::fluidSystem(), detail::gravityOn(), detail::densityWrong() }); } Opt equator() { return detail::mergeOptions(detail::tesselateBasic(), { detail::boundaryCondition(), detail::fluidSystem(), detail::gravityEquator(), detail::densityNormal() }); } } // Options namespace TestCase { namespace Results { struct Computed { explicit Computed(std::vector<double>&& x); std::vector<double> data; }; struct Expected { explicit Expected(std::vector<double>&& x); std::vector<double> data; }; Computed::Computed(std::vector<double>&& x) : data(std::move(x)) {} Expected::Expected(std::vector<double>&& x) : data(std::move(x)) {} void compare(const Computed& computed, const Expected& expected) { const auto& c = computed.data; const auto& e = expected.data; BOOST_REQUIRE_EQUAL(c.size(), e.size()); for (decltype(c.size()) i = 0, n = c.size(); i < n; ++i) { BOOST_CHECK_CLOSE(c[i], e[i], 100.0e-6); } } } // Results namespace Expect { namespace detail { std::vector<double>::size_type numCells() { return 10; } double offset() { return 5.0; } double g10() { return 10.0; } double gEquator() { return 9.80665; } double dRho() { using namespace Opm; return unit::convert:: from(1.0 - 0.8, prefix::milli*unit::kilogram / unit::cubic(prefix::centi*unit::meter)); } std::vector<double> gravityPressure(const double grav) { auto dp = std::vector<double>(numCells(), 0.0); if (std::abs(grav) > 0.0) { const auto off = offset(); const auto drho = dRho(); decltype(dp.size()) i = 0; for (auto& x : dp) { x = grav * drho * ((i + 0.5 - off) / numCells()); ++i; } } return dp; } } // detail std::vector<double> noGravity() { return detail::gravityPressure(0.0); } std::vector<double> gravity10() { return detail::gravityPressure(detail::g10()); } std::vector<double> gravityEquator() { return detail::gravityPressure(detail::gEquator()); } } // Expect namespace Compute { std::vector<double> modelDP(const std::string& input, Options::Opt& options) { // We're NOT master (rank == 0) in this context. // // This is to suppress informational/diagnostic output from // RelPermUpscaleHelper during grid construction (i.e., when // calling tesselateGrid()). const auto mpi_rank = 1; int m_argc = boost::unit_test::framework::master_test_suite().argc; char** m_argv = boost::unit_test::framework::master_test_suite().argv; Dune::MPIHelper::instance(m_argc, m_argv); Opm::RelPermUpscaleHelper helper{mpi_rank, options}; { auto parse = Opm::Parser{}; auto deck = parse.parseString(input); const auto minPerm = 0; // mD const auto maxPerm = 10.0e3; // mD const auto minPoro = 0.1; // Note: sanityCheckInput() extracts and stores private // copies of ZCORN and PERMX from the 'deck'. // // This function *must* be called before tesselateGrid(). helper.sanityCheckInput(deck, minPerm, maxPerm, minPoro); // Function tesselateGrid() cannot be called unless the // upscaler's boundary conditions are well defined. helper.setupBoundaryConditions(); helper.tesselateGrid(deck); } helper.calculateCellPressureGradients(); // Note: 'private' member of RelPermUpscaleHelper. return helper.dP; } } // Compute void run(std::function<std::string()> input, std::function<Options::Opt()> options, std::function<std::vector<double>()> expect) { auto computed = std::vector<double>{}; { auto opt = options(); // Live for duration of modelDP(). computed = Compute::modelDP(input(), opt); } Results::compare(Results::Computed{std::move(computed)}, Results::Expected{expect()}); } } // TestCase } // Anonymous // ===================================================================== // Actual test suite below // ===================================================================== BOOST_AUTO_TEST_SUITE() BOOST_AUTO_TEST_CASE (BaseCase) { TestCase::run(GridInput::basic, Options::baseCase, TestCase::Expect::gravity10); } BOOST_AUTO_TEST_CASE (NoGravity) { TestCase::run(GridInput::basic, Options::noGravity, TestCase::Expect::noGravity); } BOOST_AUTO_TEST_CASE (NoGravityWrong) { TestCase::run(GridInput::basic, Options::noGravityWrong, TestCase::Expect::noGravity); } BOOST_AUTO_TEST_CASE (GravityEquator) { TestCase::run(GridInput::basic, Options::equator, TestCase::Expect::gravityEquator); } BOOST_AUTO_TEST_SUITE_END()
joakim-hove/opm-upscaling
tests/common/test_gravitypressure.cpp
C++
gpl-3.0
13,120
body{ background-color: #055375; } ol{ padding: 50px 100px 50px 100px; margin:50px 100px 50px 100px; } ol li{ background-color: firebrick; }
techlearning8/learning
HTML/My Learning/Assignments/Timeline/timeline1.css
CSS
gpl-3.0
173
package com.michaelhoffmantech.recipemanager.recipedataservice.domain; // Generated Feb 13, 2017 4:02:01 PM by Hibernate Tools 5.2.0.CR1 import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * Recipeattribute generated by hbm2java */ @Entity @Table(name = "recipe_attribute") public class RecipeAttribute implements java.io.Serializable { private static final long serialVersionUID = 7940283521556252203L; private Integer recipeAttributeId; private Recipe recipe; private String attributeName; private String attributeValue; private String createdBy; private Date createdTimestamp; public RecipeAttribute() { } public RecipeAttribute(Integer recipeAttributeId, Recipe recipe, String attributeName, String attributeValue, String createdBy, Date createdTimestamp) { this.recipeAttributeId = recipeAttributeId; this.recipe = recipe; this.attributeName = attributeName; this.attributeValue = attributeValue; this.createdBy = createdBy; this.createdTimestamp = createdTimestamp; } @Id @SequenceGenerator(name = "recipe_attribute_recipe_attribute_id_seq", sequenceName = "recipe_attribute_recipe_attribute_id_seq", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "recipe_attribute_recipe_attribute_id_seq") @Column(name = "recipe_attribute_id", unique = true, nullable = false) public Integer getRecipeAttributeId() { return this.recipeAttributeId; } public void setRecipeAttributeId(Integer recipeAttributeId) { this.recipeAttributeId = recipeAttributeId; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "recipe_id", nullable = false) public Recipe getRecipe() { return this.recipe; } public void setRecipe(Recipe recipe) { this.recipe = recipe; } @Column(name = "attribute_name", nullable = false, length = 250) public String getAttributeName() { return this.attributeName; } public void setAttributeName(String attributeName) { this.attributeName = attributeName; } @Column(name = "attribute_value", nullable = false, length = 1000) public String getAttributeValue() { return this.attributeValue; } public void setAttributeValue(String attributeValue) { this.attributeValue = attributeValue; } @Column(name = "created_by", nullable = false, length = 100) public String getCreatedBy() { return this.createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } @Temporal(TemporalType.TIMESTAMP) @Column(name = "created_timestamp", nullable = false, length = 29) public Date getCreatedTimestamp() { return this.createdTimestamp; } public void setCreatedTimestamp(Date createdTimestamp) { this.createdTimestamp = createdTimestamp; } }
mikevoxcap/recipe-data-service
src/main/java/com/michaelhoffmantech/recipemanager/recipedataservice/domain/RecipeAttribute.java
Java
gpl-3.0
3,412
var React = require('react'); var Bootstrap = require('react-bootstrap'); var Network = require('../network'); var connect = require('react-redux').connect; var ReactDOM = require('react-dom'); var Triggers = React.createClass({ getInitialState: function () { return {triggers: [], operators: {'lt': '<', 'gt': '>', 'ge': '>=', 'le': '<='}, conditions: [], actions: [], icinga_status: ""}; }, getCurrentTriggers: function () { var me = this; Network.get('/api/triggers', this.props.auth.token).done(function (data) { var d = data["va-clc"]; me.setState({triggers: d.triggers, conditions: d.functions.conditions, actions: d.functions.actions}); }).fail(function (msg) { me.props.dispatch({type: 'SHOW_ALERT', msg: msg}); }); }, componentDidMount: function () { this.getCurrentTriggers(); }, executeAction: function (rowId, evtKey) { switch (evtKey) { case "edit": var trigger = {}; for(var i=0; i < this.state.triggers.length; i++){ if(this.state.triggers[i].id === rowId){ trigger = Object.assign({}, this.state.triggers[i]); break; } } this.props.dispatch({type: 'OPEN_MODAL', args: trigger, modalType: "EDIT"}); break; case "delete": var data = {"hostname": "va-clc", "trigger_id": rowId}, me = this; Network.delete("/api/triggers/delete_trigger", this.props.auth.token, data).done(function(d) { me.getCurrentTriggers(); }).fail(function (msg) { me.props.dispatch({type: 'SHOW_ALERT', msg: msg}); }); break; default: break; } }, openModal: function() { this.props.dispatch({type: 'OPEN_MODAL', modalType: "CREATE"}); }, addTrigger: function (t_data) { t_data.extra_kwargs = ["domain"]; var me = this, data = {hostname: "va-clc", new_trigger: t_data}; Network.post('/api/triggers/add_trigger', this.props.auth.token, data).done(function (data) { me.getCurrentTriggers(); me.props.dispatch({type: 'CLOSE_MODAL'}); }).fail(function (msg) { me.props.dispatch({type: 'SHOW_ALERT', msg: msg}); }); }, editTrigger: function (id, t_data) { t_data.extra_kwargs = ["domain"]; var me = this, data = {hostname: "va-clc", trigger_id: id, trigger: t_data}; Network.post('/api/triggers/edit_trigger', this.props.auth.token, data).done(function (data) { var triggers = Object.assign([], me.state.triggers); for(var i=0; i < triggers.length; i++){ if(triggers[i].id === id){ triggers[i] = {service: service, status: status, conditions: conditions, actions: actions, extra_kwargs: ["domain"], id: id}; break; } } me.setState({triggers: triggers}); me.props.dispatch({type: 'CLOSE_MODAL'}); }).fail(function (msg) { me.props.dispatch({type: 'SHOW_ALERT', msg: msg}); }); }, updateTriggerVals: function (data) { var me = this; Network.post('/api/evo/change_icinga_services', this.props.auth.token, data).done(function (data) { me.setState({icinga_status: "Thresholds are updated."}); }).fail(function (msg) { me.props.dispatch({type: 'SHOW_ALERT', msg: msg}); }); }, render: function () { var me = this; var trigger_rows = this.state.triggers.map(function(trigger) { var conditions = trigger.conditions.map(function(c, j) { return ( <div key={j}>{c}</div> ); }); var actions = trigger.actions.map(function(a, j) { return ( <div key={j}>{a}</div> ); }); var actionBtn = ( <Bootstrap.DropdownButton bsStyle='primary' title="Choose" onSelect = {me.executeAction.bind(me, trigger.id)}> <Bootstrap.MenuItem key="edit" eventKey="edit">Edit</Bootstrap.MenuItem> <Bootstrap.MenuItem key="delete" eventKey="delete">Delete</Bootstrap.MenuItem> </Bootstrap.DropdownButton> ); return ( <tr key={trigger.id}> <td>{trigger.service}</td> <td>{trigger.status}</td> <td>{conditions}</td> <td>Terminal</td> <td>{actions}</td> <td>{actionBtn}</td> </tr> ); }); var ModalRedux = connect(function(state){ return {auth: state.auth, modal: state.modal, alert: state.alert}; })(Modal); var TriggerFormRedux = connect(function(state){ return {auth: state.auth, alert: state.alert}; })(TriggerForm); return ( <div> <TriggerFormRedux updateTriggerVals={this.updateTriggerVals} /> <span id="action-status">{this.state.icinga_status}</span> <Bootstrap.PageHeader>List triggers</Bootstrap.PageHeader> <Bootstrap.Button type="button" bsStyle='default' className="pull-right margina" onClick={this.openModal}> <Bootstrap.Glyphicon glyph='plus' /> Add trigger </Bootstrap.Button> <ModalRedux addTrigger = {this.addTrigger} editTrigger = {this.editTrigger} conditions = {this.state.conditions} actions = {this.state.actions} getCurrentTriggers = {this.getCurrentTriggers} /> <Bootstrap.Table striped bordered hover> <thead> <tr> <td>Service</td> <td>Status</td> <td>Conditions</td> <td>Target</td> <td>Actions</td> <td></td> </tr> </thead> <tbody> {trigger_rows} </tbody> </Bootstrap.Table> </div> ); } }); var Modal = React.createClass({ getInitialState: function () { var values = {"service": "", "status": "", "conditions": "", "target": "", "actions": "", checkboxes: {}}; var args = this.props.modal.args; if('service' in args){ for(var key in args){ values[key] = args[key]; } var conditions = {}, actions = {}; for(var i=0; i < args.conditions.length; i++){ conditions[args.conditions[i]] = true; } for(var i=0; i < args.actions.length; i++){ conditions[args.actions[i]] = true; } values.checkboxes = Object.assign({}, conditions, actions); } return values; }, open: function() { this.props.dispatch({type: 'OPEN_MODAL'}); }, close: function() { this.props.dispatch({type: 'CLOSE_MODAL'}); }, toggleCheckbox: function(e) { var checkboxes = Object.assign({}, this.state.checkboxes); checkboxes[e.target.id] = !checkboxes[e.target.id] this.setState({checkboxes: checkboxes}); }, action: function(e) { console.log(e.target); console.log(this.refs.forma); console.log(ReactDOM.findDOMNode(this.refs.forma).elements); var elements = ReactDOM.findDOMNode(this.refs.forma).elements; var data = {conditions: [], actions: []}; for(i=0; i<elements.length; i++){ if(elements[i].name == "conditions" || elements[i].name == "actions") { if(this.state.checkboxes[elements[i].id]) data[elements[i].name].push(elements[i].id); }else{ data[elements[i].name] = elements[i].value; } } console.log(data); if(this.props.modal.modalType === "CREATE"){ this.props.addTrigger(data); }else{ this.props.editTrigger(this.state.id, data); } }, render: function () { var me = this; return ( <Bootstrap.Modal show={this.props.modal.isOpen} onHide={this.close}> <Bootstrap.Modal.Header closeButton> <Bootstrap.Modal.Title>{this.props.modal.modalType === "CREATE" ? "Create Trigger" : "Edit Trigger"}</Bootstrap.Modal.Title> </Bootstrap.Modal.Header> <Bootstrap.Modal.Body> <div className="left"> <Bootstrap.Form ref="forma"> <Bootstrap.FormControl id="service" key="service" name="service" componentClass="select" defaultValue={this.state["service"]}> <option value="CPU">CPU</option> <option value="Memory">Memory</option> <option value="CPUSize">CPUSize</option> <option value="MemorySize">MemorySize</option> <option value="Memory">Memory</option> </Bootstrap.FormControl> <Bootstrap.FormControl id="status" key="status" name="status" componentClass="select" defaultValue={this.state["status"]}> <option value="CRITICAL">CRITICAL</option> <option value="OK">OK</option> <option value="WARNING">WARNING</option> </Bootstrap.FormControl> {this.props.conditions.map(function(option, i) { return <Bootstrap.Checkbox id={option} key={option} name="conditions" onChange={me.toggleCheckbox} defaultChecked={me.state["conditions"].indexOf(option) > -1 ? true:false}>{option}</Bootstrap.Checkbox> })} <Bootstrap.FormControl type='text' name="target" value="Terminal" disabled /> {this.props.actions.map(function(option, i) { return <Bootstrap.Checkbox id={option} key={option} name="actions" onChange={me.toggleCheckbox} defaultChecked={me.state["actions"].indexOf(option) > -1 ? true:false}>{option}</Bootstrap.Checkbox> })} </Bootstrap.Form> </div> <div className="right"> <h3>{this.props.modal.modalType === "CREATE" ? "Fill the form to add new trigger" : "Fill the form to edit existing trigger"}</h3> <div></div> </div> </Bootstrap.Modal.Body> <Bootstrap.Modal.Footer> <Bootstrap.Button onClick={this.close}>Cancel</Bootstrap.Button> <Bootstrap.Button onClick={this.action} bsStyle = "primary">{this.props.modal.modalType === "CREATE" ? "Add trigger" : "Apply change"}</Bootstrap.Button> </Bootstrap.Modal.Footer> </Bootstrap.Modal> ); } }); var TriggerForm = React.createClass({ getInitialState: function () { return {services: {CPU: {name: 'CPU', min: 50, max: 100, min_size: 2, max_size: 8, w_val: 0, c_val: 0, size: 0}, Memory: {name: 'Memory', min: 50, max: 100, min_size: 3000, max_size: 16000, w_val: 0, c_val: 0, size: 0}, TotalUsers: {name: 'Users', min: 0, max: 200, min_size: 50, max_size: 200, w_val: 0, c_val: 0, size: 0}}, severity: ['w_val', 'c_val', 'size']}; }, getTriggerVals: function () { var me = this; Network.get('/api/evo/get_all_icinga_services', this.props.auth.token).done(function (data) { var services = me.state.services; var cpu = Object.assign({}, services.CPU, data.CPU); var mem = Object.assign({}, services.Memory, data.Memory); var usr = Object.assign({}, services.TotalUsers, data.TotalUsers); me.setState({services: {CPU: cpu, Memory: mem, TotalUsers: usr}}); }).fail(function (msg) { me.props.dispatch({type: 'SHOW_ALERT', msg: msg}); }); }, componentDidMount: function () { this.getTriggerVals(); }, onChange: function(e) { var arr = e.target.id.split("_"); var services = Object.assign({}, this.state.services); services[arr[0]][this.state.severity[arr[1]]] = e.target.value; this.setState({services: services}); }, updateTriggerVals: function (e) { e.preventDefault(); var me = this; var data = []; for(var key in this.state.services){ var service = this.state.services[key]; data.push({service: key, severity : "WARNING", value: service.w_val}); data.push({service: key, severity : "CRITICAL", value: service.c_val}); data.push({service: key, severity : "MAXIMUM", value: service.size}); } console.log(data); this.props.updateTriggerVals({services: data}); }, render: function () { var s = this.state.services; return ( <div> <Bootstrap.PageHeader>Change thresholds</Bootstrap.PageHeader> <form onSubmit={this.updateTriggerVals}> <table className="threshold-tbl"> <tr> <th></th> <th>Warning</th> <th>Critical</th> <th>Maximum</th> </tr> <tr> <td>CPU</td> <td><input type='number' min={s.CPU.min} max={s.CPU.max} id="CPU_0" key="CPU_0" value={s.CPU.w_val} onChange={this.onChange} /></td> <td><input type='number' min={s.CPU.min < s.CPU.w_val ? s.CPU.w_val : s.CPU.min} max={s.CPU.max} id="CPU_1" key="CPU_1" value={s.CPU.c_val} onChange={this.onChange} /></td> <td><input type='number' min={s.CPU.min_size} max={s.CPU.max_size} id="CPU_2" key="CPU_2" value={s.CPU.size} onChange={this.onChange} /></td> </tr> <tr> <td>Memory</td> <td><input type='number' min={s.Memory.min} max={s.Memory.max} id="Memory_0" key="Memory_0" value={s.Memory.w_val} onChange={this.onChange} /></td> <td><input type='number' min={s.Memory.min < s.Memory.w_val ? s.Memory.w_val : s.Memory.min} max={s.Memory.max} id="Memory_1" key="Memory_1" value={s.Memory.c_val} onChange={this.onChange} /></td> <td><input type='number' min={s.Memory.min_size} max={s.Memory.max_size} id="Memory_2" key="Memory_2" value={s.Memory.size} onChange={this.onChange} /></td> </tr> <tr> <td>Users</td> <td><input type='number' min={s.TotalUsers.min} max={s.TotalUsers.max} id="TotalUsers_0" key="TotalUsers_0" value={s.TotalUsers.w_val} onChange={this.onChange} /></td> <td><input type='number' min={s.TotalUsers.min < s.TotalUsers.w_val ? s.TotalUsers.w_val : s.TotalUsers.min} max={s.TotalUsers.max} id="TotalUsers_1" key="TotalUsers_1" value={s.TotalUsers.c_val} onChange={this.onChange} /></td> <td><input type='number' min={s.TotalUsers.min_size} max={s.TotalUsers.max_size} id="TotalUsers_2" key="TotalUsers_2" value={s.TotalUsers.size} onChange={this.onChange} /></td> </tr> </table> <input type="submit" className="btn btn-primary" value="Apply changes" /> </form> </div> ); } }); Triggers = connect(function(state){ return {auth: state.auth, alert: state.alert}; })(Triggers); module.exports = Triggers;
VapourApps/va_master
va_dashboard/src/tabs/triggers.js
JavaScript
gpl-3.0
16,269
/* Copyright (c) 1997-1999 Miller Puckette. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ /* my_numbox.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ #include <stdlib.h> #include <string.h> #include <stdio.h> #include <ctype.h> #include "m_pd.h" #include "g_canvas.h" #include "g_all_guis.h" #include <math.h> #ifdef _WIN32 #include <io.h> #else #include <unistd.h> #endif /*------------------ global varaibles -------------------------*/ /*------------------ global functions -------------------------*/ static void my_numbox_key(void *z, t_floatarg fkey); static void my_numbox_draw_update(t_gobj *client, t_glist *glist); /* ------------ nmx gui-my number box ----------------------- */ t_widgetbehavior my_numbox_widgetbehavior; static t_class *my_numbox_class; /* widget helper functions */ static void my_numbox_tick_reset(t_my_numbox *x) { if(x->x_gui.x_fsf.x_change && x->x_gui.x_glist) { x->x_gui.x_fsf.x_change = 0; sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } } static void my_numbox_tick_wait(t_my_numbox *x) { sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } void my_numbox_clip(t_my_numbox *x) { if(x->x_val < x->x_min) x->x_val = x->x_min; if(x->x_val > x->x_max) x->x_val = x->x_max; } void my_numbox_calc_fontwidth(t_my_numbox *x) { int w, f=31; if(x->x_gui.x_fsf.x_font_style == 1) f = 27; else if(x->x_gui.x_fsf.x_font_style == 2) f = 25; w = x->x_gui.x_fontsize * f * x->x_gui.x_w; w /= 36; x->x_numwidth = w + (x->x_gui.x_h / 2) + 4; } void my_numbox_ftoa(t_my_numbox *x) { double f=x->x_val; int bufsize, is_exp=0, i, idecimal; sprintf(x->x_buf, "%g", f); bufsize = strlen(x->x_buf); if(bufsize >= 5)/* if it is in exponential mode */ { i = bufsize - 4; if((x->x_buf[i] == 'e') || (x->x_buf[i] == 'E')) is_exp = 1; } if(bufsize > x->x_gui.x_w)/* if to reduce */ { if(is_exp) { if(x->x_gui.x_w <= 5) { x->x_buf[0] = (f < 0.0 ? '-' : '+'); x->x_buf[1] = 0; } i = bufsize - 4; for(idecimal=0; idecimal < i; idecimal++) if(x->x_buf[idecimal] == '.') break; if(idecimal > (x->x_gui.x_w - 4)) { x->x_buf[0] = (f < 0.0 ? '-' : '+'); x->x_buf[1] = 0; } else { int new_exp_index=x->x_gui.x_w-4, old_exp_index=bufsize-4; for(i=0; i < 4; i++, new_exp_index++, old_exp_index++) x->x_buf[new_exp_index] = x->x_buf[old_exp_index]; x->x_buf[x->x_gui.x_w] = 0; } } else { for(idecimal=0; idecimal < bufsize; idecimal++) if(x->x_buf[idecimal] == '.') break; if(idecimal > x->x_gui.x_w) { x->x_buf[0] = (f < 0.0 ? '-' : '+'); x->x_buf[1] = 0; } else x->x_buf[x->x_gui.x_w] = 0; } } } static void my_numbox_draw_update(t_gobj *client, t_glist *glist) { t_my_numbox *x = (t_my_numbox *)client; if (glist_isvisible(glist)) { if(x->x_gui.x_fsf.x_change) { if(x->x_buf[0]) { char *cp=x->x_buf; int sl = strlen(x->x_buf); x->x_buf[sl] = '>'; x->x_buf[sl+1] = 0; if(sl >= x->x_gui.x_w) cp += sl - x->x_gui.x_w + 1; sys_vgui( ".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x -text {%s} \n", glist_getcanvas(glist), x, IEM_GUI_COLOR_EDITED, cp); x->x_buf[sl] = 0; } else { my_numbox_ftoa(x); sys_vgui( ".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x -text {%s} \n", glist_getcanvas(glist), x, IEM_GUI_COLOR_EDITED, x->x_buf); x->x_buf[0] = 0; } } else { my_numbox_ftoa(x); sys_vgui( ".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x -text {%s} \n", glist_getcanvas(glist), x, x->x_gui.x_fsf.x_selected? IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol, x->x_buf); x->x_buf[0] = 0; } } } static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) { int half=x->x_gui.x_h/2, d=1+x->x_gui.x_h/34; int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); sys_vgui( ".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d -outline #%6.6x \ -fill #%6.6x -tags %lxBASE1\n", canvas, xpos, ypos, xpos + x->x_numwidth-4, ypos, xpos + x->x_numwidth, ypos+4, xpos + x->x_numwidth, ypos + x->x_gui.x_h, xpos, ypos + x->x_gui.x_h, IEM_GUI_COLOR_NORMAL, x->x_gui.x_bcol, x); sys_vgui( ".x%lx.c create line %d %d %d %d %d %d -fill #%6.6x -tags %lxBASE2\n", canvas, xpos, ypos, xpos + half, ypos + half, xpos, ypos + x->x_gui.x_h, x->x_gui.x_fcol, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ -font {{%s} -%d %s} -fill #%6.6x -tags [list %lxLABEL label text]\n", canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x); my_numbox_ftoa(x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ -font {{%s} -%d %s} -fill #%6.6x -tags %lxNUMBER\n", canvas, xpos+half+2, ypos+half+d, x->x_buf, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fcol, x); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags [list %lxOUT%d outlet]\n", canvas, xpos, ypos + x->x_gui.x_h-1, xpos+IOWIDTH, ypos + x->x_gui.x_h, x, 0); if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags [list %lxIN%d inlet]\n", canvas, xpos, ypos, xpos+IOWIDTH, ypos+1, x, 0); } static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist) { int half = x->x_gui.x_h/2, d=1+x->x_gui.x_h/34; int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%lx.c coords %lxBASE1 %d %d %d %d %d %d %d %d %d %d\n", canvas, x, xpos, ypos, xpos + x->x_numwidth-4, ypos, xpos + x->x_numwidth, ypos+4, xpos + x->x_numwidth, ypos + x->x_gui.x_h, xpos, ypos + x->x_gui.x_h); sys_vgui(".x%lx.c coords %lxBASE2 %d %d %d %d %d %d\n", canvas, x, xpos, ypos, xpos + half, ypos + half, xpos, ypos + x->x_gui.x_h); sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); sys_vgui(".x%lx.c coords %lxNUMBER %d %d\n", canvas, x, xpos+half+2, ypos+half+d); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c coords %lxOUT%d %d %d %d %d\n", canvas, x, 0, xpos, ypos + x->x_gui.x_h-1, xpos+IOWIDTH, ypos + x->x_gui.x_h); if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%lx.c coords %lxIN%d %d %d %d %d\n", canvas, x, 0, xpos, ypos, xpos+IOWIDTH, ypos+1); } static void my_numbox_draw_erase(t_my_numbox* x,t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%lx.c delete %lxBASE1\n", canvas, x); sys_vgui(".x%lx.c delete %lxBASE2\n", canvas, x); sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x); sys_vgui(".x%lx.c delete %lxNUMBER\n", canvas, x); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); } static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); sys_vgui(".x%lx.c itemconfigure %lxNUMBER -font {{%s} -%d %s} -fill #%6.6x \n", canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol); sys_vgui(".x%lx.c itemconfigure %lxBASE1 -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); sys_vgui(".x%lx.c itemconfigure %lxBASE2 -fill #%6.6x\n", canvas, x, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol); } static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_flags) { int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", canvas, xpos, ypos + x->x_gui.x_h-1, xpos+IOWIDTH, ypos + x->x_gui.x_h, x, 0); if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", canvas, xpos, ypos, xpos+IOWIDTH, ypos+1, x, 0); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); } static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); if(x->x_gui.x_fsf.x_selected) { if(x->x_gui.x_fsf.x_change) { x->x_gui.x_fsf.x_change = 0; clock_unset(x->x_clock_reset); x->x_buf[0] = 0; sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } sys_vgui(".x%lx.c itemconfigure %lxBASE1 -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); sys_vgui(".x%lx.c itemconfigure %lxBASE2 -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); sys_vgui(".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); } else { sys_vgui(".x%lx.c itemconfigure %lxBASE1 -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%lx.c itemconfigure %lxBASE2 -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); sys_vgui(".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); } } void my_numbox_draw(t_my_numbox *x, t_glist *glist, int mode) { if(mode == IEM_GUI_DRAW_MODE_UPDATE) sys_queuegui(x, glist, my_numbox_draw_update); else if(mode == IEM_GUI_DRAW_MODE_MOVE) my_numbox_draw_move(x, glist); else if(mode == IEM_GUI_DRAW_MODE_NEW) my_numbox_draw_new(x, glist); else if(mode == IEM_GUI_DRAW_MODE_SELECT) my_numbox_draw_select(x, glist); else if(mode == IEM_GUI_DRAW_MODE_ERASE) my_numbox_draw_erase(x, glist); else if(mode == IEM_GUI_DRAW_MODE_CONFIG) my_numbox_draw_config(x, glist); else if(mode >= IEM_GUI_DRAW_MODE_IO) my_numbox_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); } /* ------------------------ nbx widgetbehaviour----------------------------- */ static void my_numbox_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) { t_my_numbox* x = (t_my_numbox*)z; *xp1 = text_xpix(&x->x_gui.x_obj, glist); *yp1 = text_ypix(&x->x_gui.x_obj, glist); *xp2 = *xp1 + x->x_numwidth; *yp2 = *yp1 + x->x_gui.x_h; } static void my_numbox_save(t_gobj *z, t_binbuf *b) { t_my_numbox *x = (t_my_numbox *)z; int bflcol[3]; t_symbol *srl[3]; iemgui_save(&x->x_gui, srl, bflcol); if(x->x_gui.x_fsf.x_change) { x->x_gui.x_fsf.x_change = 0; clock_unset(x->x_clock_reset); sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } binbuf_addv(b, "ssiisiiffiisssiiiiiiifi", gensym("#X"),gensym("obj"), (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, gensym("nbx"), x->x_gui.x_w, x->x_gui.x_h, (t_float)x->x_min, (t_float)x->x_max, x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, bflcol[0], bflcol[1], bflcol[2], x->x_val, x->x_log_height); binbuf_addv(b, ";"); } int my_numbox_check_minmax(t_my_numbox *x, double min, double max) { int ret=0; if(x->x_lin0_log1) { if((min == 0.0)&&(max == 0.0)) max = 1.0; if(max > 0.0) { if(min <= 0.0) min = 0.01*max; } else { if(min > 0.0) max = 0.01*min; } } x->x_min = min; x->x_max = max; if(x->x_val < x->x_min) { x->x_val = x->x_min; ret = 1; } if(x->x_val > x->x_max) { x->x_val = x->x_max; ret = 1; } if(x->x_lin0_log1) x->x_k = exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)); else x->x_k = 1.0; return(ret); } static void my_numbox_properties(t_gobj *z, t_glist *owner) { t_my_numbox *x = (t_my_numbox *)z; char buf[800]; t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); if(x->x_gui.x_fsf.x_change) { x->x_gui.x_fsf.x_change = 0; clock_unset(x->x_clock_reset); sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } sprintf(buf, "pdtk_iemgui_dialog %%s |nbx| \ -------dimensions(digits)(pix):------- %d %d width: %d %d height: \ -----------output-range:----------- %g min: %g max: %d \ %d lin log %d %d log-height: %d \ {%s} {%s} \ {%s} %d %d \ %d %d \ %d %d %d\n", x->x_gui.x_w, 1, x->x_gui.x_h, 8, x->x_min, x->x_max, 0,/*no_schedule*/ x->x_lin0_log1, x->x_gui.x_isa.x_loadinit, -1, x->x_log_height, /*no multi, but iem-characteristic*/ srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); } static void my_numbox_bang(t_my_numbox *x) { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_val); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, x->x_val); } static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc, t_atom *argv) { t_symbol *srl[3]; int w = (int)atom_getintarg(0, argc, argv); int h = (int)atom_getintarg(1, argc, argv); double min = (double)atom_getfloatarg(2, argc, argv); double max = (double)atom_getfloatarg(3, argc, argv); int lilo = (int)atom_getintarg(4, argc, argv); int log_height = (int)atom_getintarg(6, argc, argv); int sr_flags; if(lilo != 0) lilo = 1; x->x_lin0_log1 = lilo; sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); if(w < 1) w = 1; x->x_gui.x_w = w; if(h < 8) h = 8; x->x_gui.x_h = h; if(log_height < 10) log_height = 10; x->x_log_height = log_height; my_numbox_calc_fontwidth(x); /*if(my_numbox_check_minmax(x, min, max)) my_numbox_bang(x);*/ my_numbox_check_minmax(x, min, max); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); canvas_fixlinesfor(x->x_gui.x_glist, (t_text*)x); } static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy) { double k2=1.0; if(x->x_gui.x_fsf.x_finemoved) k2 = 0.01; if(x->x_lin0_log1) x->x_val *= pow(x->x_k, -k2*dy); else x->x_val -= k2*dy; my_numbox_clip(x); sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); my_numbox_bang(x); clock_unset(x->x_clock_reset); } static void my_numbox_click(t_my_numbox *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, (t_glistmotionfn)my_numbox_motion, my_numbox_key, xpos, ypos); } static int my_numbox_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_my_numbox* x = (t_my_numbox *)z; if(doit) { my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); if(shift) x->x_gui.x_fsf.x_finemoved = 1; else x->x_gui.x_fsf.x_finemoved = 0; if(!x->x_gui.x_fsf.x_change) { clock_delay(x->x_clock_wait, 50); x->x_gui.x_fsf.x_change = 1; clock_delay(x->x_clock_reset, 3000); x->x_buf[0] = 0; } else { x->x_gui.x_fsf.x_change = 0; clock_unset(x->x_clock_reset); x->x_buf[0] = 0; sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } } return (1); } static void my_numbox_set(t_my_numbox *x, t_floatarg f) { x->x_val = f; my_numbox_clip(x); sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } static void my_numbox_log_height(t_my_numbox *x, t_floatarg lh) { if(lh < 10.0) lh = 10.0; x->x_log_height = (int)lh; if(x->x_lin0_log1) x->x_k = exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)); else x->x_k = 1.0; } static void my_numbox_float(t_my_numbox *x, t_floatarg f) { my_numbox_set(x, f); if(x->x_gui.x_fsf.x_put_in2out) my_numbox_bang(x); } static void my_numbox_size(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { int h, w; w = (int)atom_getintarg(0, ac, av); if(w < 1) w = 1; x->x_gui.x_w = w; if(ac > 1) { h = (int)atom_getintarg(1, ac, av); if(h < 8) h = 8; x->x_gui.x_h = h; } my_numbox_calc_fontwidth(x); iemgui_size((void *)x, &x->x_gui); } static void my_numbox_delta(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) {iemgui_delta((void *)x, &x->x_gui, s, ac, av);} static void my_numbox_pos(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) {iemgui_pos((void *)x, &x->x_gui, s, ac, av);} static void my_numbox_range(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { if(my_numbox_check_minmax(x, (double)atom_getfloatarg(0, ac, av), (double)atom_getfloatarg(1, ac, av))) { sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); /*my_numbox_bang(x);*/ } } static void my_numbox_color(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) {iemgui_color((void *)x, &x->x_gui, s, ac, av);} static void my_numbox_send(t_my_numbox *x, t_symbol *s) {iemgui_send(x, &x->x_gui, s);} static void my_numbox_receive(t_my_numbox *x, t_symbol *s) {iemgui_receive(x, &x->x_gui, s);} static void my_numbox_label(t_my_numbox *x, t_symbol *s) {iemgui_label((void *)x, &x->x_gui, s);} static void my_numbox_label_pos(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) {iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} static void my_numbox_label_font(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { int f = (int)atom_getintarg(1, ac, av); if(f < 4) f = 4; x->x_gui.x_fontsize = f; f = (int)atom_getintarg(0, ac, av); if((f < 0) || (f > 2)) f = 0; x->x_gui.x_fsf.x_font_style = f; my_numbox_calc_fontwidth(x); iemgui_label_font((void *)x, &x->x_gui, s, ac, av); } static void my_numbox_log(t_my_numbox *x) { x->x_lin0_log1 = 1; if(my_numbox_check_minmax(x, x->x_min, x->x_max)) { sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); /*my_numbox_bang(x);*/ } } static void my_numbox_lin(t_my_numbox *x) { x->x_lin0_log1 = 0; } static void my_numbox_init(t_my_numbox *x, t_floatarg f) { x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1; } static void my_numbox_loadbang(t_my_numbox *x) { if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) { sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); my_numbox_bang(x); } } static void my_numbox_key(void *z, t_floatarg fkey) { t_my_numbox *x = z; char c=fkey; char buf[3]; buf[1] = 0; if (c == 0) { x->x_gui.x_fsf.x_change = 0; clock_unset(x->x_clock_reset); sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); return; } if(((c>='0')&&(c<='9'))||(c=='.')||(c=='-')|| (c=='e')||(c=='+')||(c=='E')) { if(strlen(x->x_buf) < (IEMGUI_MAX_NUM_LEN-2)) { buf[0] = c; strcat(x->x_buf, buf); sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } } else if((c=='\b')||(c==127)) { int sl=strlen(x->x_buf)-1; if(sl < 0) sl = 0; x->x_buf[sl] = 0; sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } else if((c=='\n')||(c==13)) { x->x_val = atof(x->x_buf); x->x_buf[0] = 0; x->x_gui.x_fsf.x_change = 0; clock_unset(x->x_clock_reset); my_numbox_clip(x); my_numbox_bang(x); sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } clock_delay(x->x_clock_reset, 3000); } static void my_numbox_list(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { if (IS_A_FLOAT(av,0)) { my_numbox_set(x, atom_getfloatarg(0, ac, av)); my_numbox_bang(x); } } static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv) { t_my_numbox *x = (t_my_numbox *)pd_new(my_numbox_class); int bflcol[]={-262144, -1, -1}; int w=5, h=14; int lilo=0, f=0, ldx=0, ldy=-8; int fs=10; int log_height=256; double min=-1.0e+37, max=1.0e+37,v=0.0; char str[144]; if((argc >= 17)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1) &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3) &&IS_A_FLOAT(argv,4)&&IS_A_FLOAT(argv,5) &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6)) &&(IS_A_SYMBOL(argv,7)||IS_A_FLOAT(argv,7)) &&(IS_A_SYMBOL(argv,8)||IS_A_FLOAT(argv,8)) &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10) &&IS_A_FLOAT(argv,11)&&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13) &&IS_A_FLOAT(argv,14)&&IS_A_FLOAT(argv,15)&&IS_A_FLOAT(argv,16)) { w = (int)atom_getintarg(0, argc, argv); h = (int)atom_getintarg(1, argc, argv); min = (double)atom_getfloatarg(2, argc, argv); max = (double)atom_getfloatarg(3, argc, argv); lilo = (int)atom_getintarg(4, argc, argv); iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv)); iemgui_new_getnames(&x->x_gui, 6, argv); ldx = (int)atom_getintarg(9, argc, argv); ldy = (int)atom_getintarg(10, argc, argv); iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv)); fs = (int)atom_getintarg(12, argc, argv); bflcol[0] = (int)atom_getintarg(13, argc, argv); bflcol[1] = (int)atom_getintarg(14, argc, argv); bflcol[2] = (int)atom_getintarg(15, argc, argv); v = atom_getfloatarg(16, argc, argv); } else iemgui_new_getnames(&x->x_gui, 6, 0); if((argc == 18)&&IS_A_FLOAT(argv,17)) { log_height = (int)atom_getintarg(17, argc, argv); } x->x_gui.x_draw = (t_iemfunptr)my_numbox_draw; x->x_gui.x_fsf.x_snd_able = 1; x->x_gui.x_fsf.x_rcv_able = 1; x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); if(x->x_gui.x_isa.x_loadinit) x->x_val = v; else x->x_val = 0.0; if(lilo != 0) lilo = 1; x->x_lin0_log1 = lilo; if(log_height < 10) log_height = 10; x->x_log_height = log_height; if (!strcmp(x->x_gui.x_snd->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0; if (!strcmp(x->x_gui.x_rcv->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0; if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); else { x->x_gui.x_fsf.x_font_style = 0; strcpy(x->x_gui.x_font, sys_font); } if (x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); x->x_gui.x_ldx = ldx; x->x_gui.x_ldy = ldy; if(fs < 4) fs = 4; x->x_gui.x_fontsize = fs; if(w < 1) w = 1; x->x_gui.x_w = w; if(h < 8) h = 8; x->x_gui.x_h = h; x->x_buf[0] = 0; my_numbox_calc_fontwidth(x); my_numbox_check_minmax(x, min, max); iemgui_all_colfromload(&x->x_gui, bflcol); iemgui_verify_snd_ne_rcv(&x->x_gui); x->x_clock_reset = clock_new(x, (t_method)my_numbox_tick_reset); x->x_clock_wait = clock_new(x, (t_method)my_numbox_tick_wait); x->x_gui.x_fsf.x_change = 0; outlet_new(&x->x_gui.x_obj, &s_float); return (x); } static void my_numbox_free(t_my_numbox *x) { if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); clock_free(x->x_clock_reset); clock_free(x->x_clock_wait); gfxstub_deleteforkey(x); } void g_numbox_setup(void) { my_numbox_class = class_new(gensym("nbx"), (t_newmethod)my_numbox_new, (t_method)my_numbox_free, sizeof(t_my_numbox), 0, A_GIMME, 0); class_addcreator((t_newmethod)my_numbox_new, gensym("my_numbox"), A_GIMME, 0); class_addbang(my_numbox_class,my_numbox_bang); class_addfloat(my_numbox_class,my_numbox_float); class_addlist(my_numbox_class, my_numbox_list); class_addmethod(my_numbox_class, (t_method)my_numbox_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_motion, gensym("motion"), A_FLOAT, A_FLOAT, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_dialog, gensym("dialog"), A_GIMME, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_loadbang, gensym("loadbang"), 0); class_addmethod(my_numbox_class, (t_method)my_numbox_set, gensym("set"), A_FLOAT, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_size, gensym("size"), A_GIMME, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_delta, gensym("delta"), A_GIMME, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_pos, gensym("pos"), A_GIMME, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_range, gensym("range"), A_GIMME, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_color, gensym("color"), A_GIMME, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_send, gensym("send"), A_DEFSYM, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_receive, gensym("receive"), A_DEFSYM, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_label, gensym("label"), A_DEFSYM, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_label_pos, gensym("label_pos"), A_GIMME, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_label_font, gensym("label_font"), A_GIMME, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_log, gensym("log"), 0); class_addmethod(my_numbox_class, (t_method)my_numbox_lin, gensym("lin"), 0); class_addmethod(my_numbox_class, (t_method)my_numbox_init, gensym("init"), A_FLOAT, 0); class_addmethod(my_numbox_class, (t_method)my_numbox_log_height, gensym("log_height"), A_FLOAT, 0); my_numbox_widgetbehavior.w_getrectfn = my_numbox_getrect; my_numbox_widgetbehavior.w_displacefn = iemgui_displace; my_numbox_widgetbehavior.w_selectfn = iemgui_select; my_numbox_widgetbehavior.w_activatefn = NULL; my_numbox_widgetbehavior.w_deletefn = iemgui_delete; my_numbox_widgetbehavior.w_visfn = iemgui_vis; my_numbox_widgetbehavior.w_clickfn = my_numbox_newclick; class_setwidget(my_numbox_class, &my_numbox_widgetbehavior); class_sethelpsymbol(my_numbox_class, gensym("numbox2")); class_setsavefn(my_numbox_class, my_numbox_save); class_setpropertiesfn(my_numbox_class, my_numbox_properties); }
rvega/morphasynth
vendors/pd-extended-0.43.4/pd/src/g_numbox.c
C
gpl-3.0
30,156
{% extends 'base.html' %} {% load widget_tweaks %} {%block styles %}<link rel="stylesheet" href="{{STATIC_URL}}css/login.css">{%endblock%} {% block body_class %}login{%endblock%} {% block h1 %}Acceso{%endblock%} {% block contenido %} <div class="login-box"> <div class="login-icono"> <figure> <img src="{{STATIC_URL}}img/logo_greco.png" alt="Bienvenido a Greco Socios"/> </figure> <h4>Bienvenido a <span>Greco Socios</span></h4> </div> <div class="login-form"> <p><strong>Reinicio de contraseña completado</strong></p> <p>Su contraseña ha sido cambiada. Ahora puede continuar e ingresar.</p> <br /> <br /> <a href="/" class="btn btn-login">Acceder</a> </div> </div> {%endblock%}
PanuWeb/greco_socios
greco_socios/templates/reset-confirm-done.html
HTML
gpl-3.0
717
-- Add buildactions to path premake.path = premake.path..";utils/buildactions" require "compose_files" require "install_data" require "install_resources" require "install_cef" require "install_discord" require "install_unifont" -- Set CI Build global local ci = os.getenv("CI") if ci and ci:lower() == "true" then CI_BUILD = true else CI_BUILD = false end GLIBC_COMPAT = os.getenv("GLIBC_COMPAT") == "true" workspace "MTASA" configurations {"Debug", "Release", "Nightly"} platforms { "x86", "x64"} if os.host() == "macosx" then removeplatforms { "x86" } end targetprefix "" location "Build" startproject "Client Launcher" cppdialect "C++17" characterset "MBCS" pic "On" symbols "On" dxdir = os.getenv("DXSDK_DIR") or "" includedirs { "vendor", } defines { "_CRT_SECURE_NO_WARNINGS", "_SCL_SECURE_NO_WARNINGS", "_CRT_NONSTDC_NO_DEPRECATE", "NOMINMAX", "_TIMESPEC_DEFINED" } -- Helper function for output path buildpath = function(p) return "%{wks.location}/../Bin/"..p.."/" end copy = function(p) return "{COPY} %{cfg.buildtarget.abspath} \"%{wks.location}../Bin/"..p.."/\"" end if GLIBC_COMPAT then filter { "system:linux" } includedirs "/compat" linkoptions "-static-libstdc++ -static-libgcc" forceincludes { "glibc_version.h" } filter { "system:linux", "platforms:x86" } libdirs { "/compat/x86" } filter { "system:linux", "platforms:x64" } libdirs { "/compat/x64" } end filter "platforms:x86" architecture "x86" filter "platforms:x64" architecture "x86_64" filter "configurations:Debug" defines { "MTA_DEBUG" } targetsuffix "_d" filter "configurations:Release or configurations:Nightly" optimize "Speed" -- "On"=MS:/Ox GCC:/O2 "Speed"=MS:/O2 GCC:/O3 "Full"=MS:/Ox GCC:/O3 if CI_BUILD then filter {} defines { "CI_BUILD=1" } filter { "system:linux" } linkoptions { "-s" } end filter {"system:windows", "configurations:Nightly", "kind:not StaticLib"} os.mkdir("Build/Symbols") linkoptions "/PDB:\"Symbols\\$(ProjectName).pdb\"" filter "system:windows" toolset "v142" staticruntime "On" defines { "WIN32", "_WIN32", "_WIN32_WINNT=0x601", "_MSC_PLATFORM_TOOLSET=$(PlatformToolsetVersion)" } buildoptions { "/Zc:__cplusplus" } includedirs { path.join(dxdir, "Include") } libdirs { path.join(dxdir, "Lib/x86") } filter {"system:windows", "configurations:Debug"} runtime "Release" -- Always use Release runtime defines { "DEBUG" } -- Using DEBUG as _DEBUG is not available with /MT filter "system:linux" vectorextensions "SSE2" buildoptions { "-fvisibility=hidden" } -- Only build the client on Windows if os.target() == "windows" then group "Client" include "Client/ceflauncher" include "Client/ceflauncher_DLL" include "Client/cefweb" include "Client/core" include "Client/game_sa" include "Client/sdk" include "Client/gui" include "Client/launch" include "Client/loader" include "Client/multiplayer_sa" include "Client/mods/deathmatch" group "Client/CEGUI" include "vendor/cegui-0.4.0-custom/src/renderers/directx9GUIRenderer" include "vendor/cegui-0.4.0-custom/WidgetSets/Falagard" include "vendor/cegui-0.4.0-custom" group "Vendor" include "vendor/portaudio" include "vendor/cef3" include "vendor/freetype" include "vendor/jpeg-9d" include "vendor/ksignals" include "vendor/libpng" include "vendor/tinygettext" include "vendor/pthreads" include "vendor/libspeex" include "vendor/detours" end filter {} group "Server" include "Server/core" include "Server/dbconmy" include "Server/launcher" include "Server/mods/deathmatch" include "Server/sdk" group "Shared" include "Shared" include "Shared/XML" group "Vendor" include "vendor/bcrypt" include "vendor/cryptopp" include "vendor/curl" include "vendor/ehs" include "vendor/google-breakpad" include "vendor/json-c" include "vendor/luajit" include "vendor/mbedtls" include "vendor/pcre" include "vendor/pme" include "vendor/sqlite" include "vendor/tinyxml" include "vendor/unrar" include "vendor/zip" include "vendor/zlib"
huncrys/mtasa-blue
premake5.lua
Lua
gpl-3.0
4,127
<?php /******************************************************************************* Version: 1.0 ($Rev: 152 $) Website: http://sourceforge.net/projects/simplehtmldom/ Author: S.C. Chen (me578022@gmail.com) Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/) Contributions by: Yousuke Kumakura (Attribute filters) Licensed under The MIT License Redistributions of files must retain the above copyright notice. *******************************************************************************/ define('HDOM_TYPE_ELEMENT', 1); define('HDOM_TYPE_COMMENT', 2); define('HDOM_TYPE_TEXT', 3); define('HDOM_TYPE_ENDTAG', 4); define('HDOM_TYPE_ROOT', 5); define('HDOM_TYPE_UNKNOWN', 6); define('HDOM_QUOTE_DOUBLE', 0); define('HDOM_QUOTE_SINGLE', 1); define('HDOM_QUOTE_NO', 3); define('HDOM_INFO_BEGIN', 0); define('HDOM_INFO_END', 1); define('HDOM_INFO_QUOTE', 2); define('HDOM_INFO_SPACE', 3); define('HDOM_INFO_TEXT', 4); define('HDOM_INFO_INNER', 5); define('HDOM_INFO_OUTER', 6); define('HDOM_INFO_ENDSPACE',7); // helper functions // ----------------------------------------------------------------------------- // get html dom form file function file_get_html() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } // get html dom form string function str_get_html($str, $lowercase=true) { $dom = new simple_html_dom; $dom->load($str, $lowercase); return $dom; } // get dom form file (deprecation) function file_get_dom() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } // get dom form string (deprecation) function str_get_dom($str, $lowercase=true) { $dom = new simple_html_dom; $dom->load($str, $lowercase); return $dom; } // simple html dom node // ----------------------------------------------------------------------------- class simple_html_dom_node { public $nodetype = HDOM_TYPE_TEXT; public $tag = 'text'; public $attr = array(); public $children = array(); public $nodes = array(); public $parent = null; public $_ = array(); private $dom = null; function __construct($dom) { $this->dom = $dom; $dom->nodes[] = &$this; } function __destruct() { $this->clear(); } function __toString() { return $this->outertext(); } // clean up memory due to php5 circular references memory leak... function clear() { $this->dom = null; $this->nodes = null; $this->parent = null; $this->children = null; } // returns the parent of node function parent() { return $this->parent; } // returns children of node function children($idx=-1) { if ($idx===-1) return $this->children; if (isset($this->children[$idx])) return $this->children[$idx]; return null; } // returns the first child of node function first_child() { if (count($this->children)>0) return $this->children[0]; return null; } // returns the last child of node function last_child() { if (($count=count($this->children))>0) return $this->children[$count-1]; return null; } // returns the next sibling of node function next_sibling() { if ($this->parent===null) return null; $idx = 0; $count = count($this->parent->children); while ($idx<$count && $this!==$this->parent->children[$idx]) ++$idx; if (++$idx>=$count) return null; return $this->parent->children[$idx]; } // returns the previous sibling of node function prev_sibling() { if ($this->parent===null) return null; $idx = 0; $count = count($this->parent->children); while ($idx<$count && $this!==$this->parent->children[$idx]) ++$idx; if (--$idx<0) return null; return $this->parent->children[$idx]; } // get dom node's inner html function innertext() { if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER]; if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); $ret = ''; foreach($this->nodes as $n) $ret .= $n->outertext(); return $ret; } // get dom node's outer text (with tag) function outertext() { if ($this->tag==='root') return $this->innertext(); // trigger callback if ($this->dom->callback!==null) call_user_func_array($this->dom->callback, array($this)); if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER]; if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); // render begin tag $ret = $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]->makeup(); // render inner text if (isset($this->_[HDOM_INFO_INNER])) $ret .= $this->_[HDOM_INFO_INNER]; else { foreach($this->nodes as $n) $ret .= $n->outertext(); } // render end tag if(isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) $ret .= '</'.$this->tag.'>'; return $ret; } // get dom node's plain text function plaintext() { if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER]; switch ($this->nodetype) { case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); case HDOM_TYPE_COMMENT: return ''; case HDOM_TYPE_UNKNOWN: return ''; } if (strcasecmp($this->tag, 'script')===0) return ''; if (strcasecmp($this->tag, 'style')===0) return ''; $ret = ''; foreach($this->nodes as $n) $ret .= $n->plaintext(); return $ret; } // build node's text with tag function makeup() { // text, comment, unknown if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); $ret = '<'.$this->tag; $i = -1; foreach($this->attr as $key=>$val) { ++$i; // skip removed attribute if ($val===null || $val===false) continue; $ret .= $this->_[HDOM_INFO_SPACE][$i][0]; //no value attr: nowrap, checked selected... if ($val===true) $ret .= $key; else { switch($this->_[HDOM_INFO_QUOTE][$i]) { case HDOM_QUOTE_DOUBLE: $quote = '"'; break; case HDOM_QUOTE_SINGLE: $quote = '\''; break; default: $quote = ''; } $ret .= $key.$this->_[HDOM_INFO_SPACE][$i][1].'='.$this->_[HDOM_INFO_SPACE][$i][2].$quote.$val.$quote; } } $ret = $this->dom->restore_noise($ret); return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>'; } // find elements by css selector function find($selector, $idx=-1) { $selectors = $this->parse_selector($selector); if (($count=count($selectors))===0) return array(); $found_keys = array(); // find each selector for ($c=0; $c<$count; ++$c) { if (($levle=count($selectors[0]))===0) return array(); if (!isset($this->_[HDOM_INFO_BEGIN])) return array(); $head = array($this->_[HDOM_INFO_BEGIN]=>1); // handle descendant selectors, no recursive! for ($l=0; $l<$levle; ++$l) { $ret = array(); foreach($head as $k=>$v) { $n = ($k===-1) ? $this->dom->root : $this->dom->nodes[$k]; $n->seek($selectors[$c][$l], $ret); } $head = $ret; } foreach($head as $k=>$v) { if (!isset($found_keys[$k])) $found_keys[$k] = 1; } } // sort keys ksort($found_keys); $found = array(); foreach($found_keys as $k=>$v) $found[] = $this->dom->nodes[$k]; // return nth-element or array if ($idx<0) return $found; return (isset($found[$idx])) ? $found[$idx] : null; } // seek for given conditions protected function seek($selector, &$ret) { list($tag, $key, $val, $exp) = $selector; $end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0; if ($end==0) { $parent = $this->parent; while (!isset($parent->_[HDOM_INFO_END]) && $parent!==null) { $end -= 1; $parent = $parent->parent; } $end += $parent->_[HDOM_INFO_END]; } for($i=$this->_[HDOM_INFO_BEGIN]+1; $i<$end; ++$i) { $node = $this->dom->nodes[$i]; $pass = true; if ($tag==='*') { if (in_array($node, $this->children, true)) $ret[$i] = 1; continue; } // compare tag if ($tag && $tag!=$node->tag) {$pass=false;} // compare key if ($pass && $key && !(isset($node->attr[$key]))) {$pass=false;} // compare value if ($pass && $key && $val) { $check = $this->match($exp, $val, $node->attr[$key]); // handle multiple class if (!$check && strcasecmp($key, 'class')===0) { foreach(explode(' ',$node->attr[$key]) as $k) { $check = $this->match($exp, $val, $k); if ($check) break; } } if (!$check) $pass = false; } if ($pass) $ret[$i] = 1; unset($node); } } protected function match($exp, $pattern, $value) { $check = true; switch ($exp) { case '=': $check = ($value===$pattern) ? true : false; break; case '!=': $check = ($value!==$pattern) ? true : false; break; case '^=': $check = (preg_match("/^".preg_quote($pattern,'/')."/", $value)) ? true : false; break; case '$=': $check = (preg_match("/".preg_quote($pattern,'/')."$/", $value)) ? true : false; break; case '*=': $check = (preg_match("/".preg_quote($pattern,'/')."/i", $value)) ? true : false; break; } return $check; } protected function parse_selector($selector_string) { // pattern of CSS selectors, modified from mootools $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([, ]+)/is"; preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER); $selectors = array(); $result = array(); foreach ($matches as $m) { if (trim($m[0])==='') continue; list($tag, $key, $val, $exp) = array($m[1], null, null, '='); if(!empty($m[2])) {$key='id'; $val=$m[2];} if(!empty($m[3])) {$key='class'; $val=$m[3];} if(!empty($m[4])) {$key=$m[4];} if(!empty($m[5])) {$exp=$m[5];} if(!empty($m[6])) {$val=$m[6];} // convert to lowercase if ($this->dom->lowercase) {$tag=strtolower($tag); $key=strtolower($key);} $result[] = array($tag, $key, $val, $exp); if (trim($m[7])===',') { $selectors[] = $result; $result = array(); } } if (count($result)>0) $selectors[] = $result; return $selectors; } function __get($name) { if (isset($this->attr[$name])) return $this->attr[$name]; switch($name) { case 'outertext': return $this->outertext(); case 'innertext': return $this->innertext(); case 'plaintext': return $this->plaintext(); default: return array_key_exists($name, $this->attr); } } function __set($name, $value) { switch($name) { case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value; case 'innertext': if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value; return $this->_[HDOM_INFO_INNER] = $value; } if (!isset($this->attr[$name])) { $this->_[HDOM_INFO_SPACE][] = array(' ', '', ''); $this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE; } $this->attr[$name] = $value; } function __isset($name) { switch($name) { case 'outertext': return true; case 'innertext': return true; case 'plaintext': return true; } //no value attr: nowrap, checked selected... return (array_key_exists($name, $this->attr)) ? true : isset($this->attr[$name]); } function __unset($name) { if (isset($this->attr[$name])) unset($this->attr[$name]); } // camel naming conventions function getAllAttributes() {return $this->attr;} function getAttribute($name) {return $this->__get($name);} function setAttribute($name, $value) {$this->__set($name, $value);} function hasAttribute($name) {return $this->__isset($name);} function removeAttribute($name) {$this->__set($name, null);} function getElementById($id) {return $this->find("#$id", 0);} function getElementsById($id, $idx=-1) {return $this->find("#$id", $idx);} function getElementByTagName($name) {return $this->find($name, 0);} function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);} function parentNode() {return $this->parent();} function childNodes($idx=-1) {return $this->children($idx);} function firstChild() {return $this->first_child();} function lastChild() {return $this->last_child();} function nextSibling() {return $this->next_sibling();} function previousSibling() {return $this->prev_sibling();} } // simple html dom parser // ----------------------------------------------------------------------------- class simple_html_dom { public $root = null; public $nodes = array(); public $callback = null; public $lowercase = false; protected $pos; protected $doc; protected $char; protected $size; protected $cursor; protected $parent; protected $noise = array(); protected $token_blank = " \t\r\n"; protected $token_equal = ' =/><'; protected $token_slash = " />\r\n\t"; protected $token_attr = ' >'; // use isset instead of in_array, performance boost about 30%... protected $self_closing_tags = array('img'=>1, 'br'=>1, 'input'=>1, 'meta'=>1, 'link'=>1, 'hr'=>1, 'base'=>1, 'embed'=>1, 'spacer'=>1, 'nobr'=>1); protected $block_tags = array('root'=>1, 'body'=>1, 'form'=>1, 'div'=>1, 'span'=>1, 'table'=>1); protected $optional_closing_tags = array( 'tr'=>array('tr'=>1, 'td'=>1, 'th'=>1), 'th'=>array('th'=>1), 'td'=>array('td'=>1), 'ul'=>array('li'=>1), 'li'=>array('li'=>1), 'dt'=>array('dt'=>1, 'dd'=>1), 'dd'=>array('dd'=>1, 'dt'=>1), 'dl'=>array('dd'=>1, 'dt'=>1), 'p'=>array('p'=>1), ); function __destruct() { $this->clear(); } // load html from string function load($str, $lowercase=true) { // prepare $this->prepare($str, $lowercase); // strip out comments $this->remove_noise("'<!--(.*?)-->'is"); // strip out <style> tags $this->remove_noise("'<\s*style[^>]*[^/]>(.*?)<\s*/\s*style\s*>'is"); $this->remove_noise("'<\s*style\s*>(.*?)<\s*/\s*style\s*>'is"); // strip out <script> tags $this->remove_noise("'<\s*script[^>]*[^/]>(.*?)<\s*/\s*script\s*>'is"); $this->remove_noise("'<\s*script\s*>(.*?)<\s*/\s*script\s*>'is"); // strip out preformatted tags $this->remove_noise("'<\s*(?:pre|code)[^>]*>(.*?)<\s*/\s*(?:pre|code)\s*>'is"); // strip out server side scripts $this->remove_noise("'(<\?)(.*?)(\?>)'is", true); //echo $this->doc; //die; // parsing while ($this->parse()); // end $this->root->_[HDOM_INFO_END] = $this->cursor; } // load html from file function load_file() { $args = func_get_args(); $this->load(call_user_func_array('file_get_contents', $args), true); } // set callback function function set_callback($function_name) { $this->callback = $function_name; } // remove callback function function remove_callback() { $this->callback = null; } // save dom as string function save($filepath='') { $ret = $this->root->innertext(); if ($filepath!=='') file_put_contents($filepath, $ret); return $ret; } // find dom node by css selector function find($selector, $idx=-1) { return $this->root->find($selector, $idx); } // clean up memory due to php5 circular references memory leak... function clear() { foreach($this->nodes as $n) {$n->clear(); $n = null;} if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);} if (isset($this->root)) {$this->root->clear(); unset($this->root);} unset($this->doc); unset($this->noise); } // prepare HTML data and init everything protected function prepare($str, $lowercase=true) { $this->clear(); $this->doc = $str; $this->pos = 0; $this->cursor = 1; $this->noise = array(); $this->nodes = array(); $this->lowercase = $lowercase; $this->root = new simple_html_dom_node($this); $this->root->tag = 'root'; $this->root->_[HDOM_INFO_BEGIN] = -1; $this->root->nodetype = HDOM_TYPE_ROOT; $this->parent = $this->root; // set the length of content $this->size = strlen($str); if ($this->size>0) $this->char = $this->doc[0]; } // parse html content protected function parse() { if (($s = $this->copy_until_char('<'))==='') return $this->read_tag(); // text $node = new simple_html_dom_node($this); ++$this->cursor; $node->_[HDOM_INFO_TEXT] = $s; $this->link_nodes($node, false); return true; } // read tag info protected function read_tag() { if ($this->char!=='<') { $this->root->_[HDOM_INFO_END] = $this->cursor; return false; } $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next // end tag if ($this->char==='/') { $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next $this->skip($this->token_blank_t); $tag = $this->copy_until_char('>'); // skip attributes in end tag if (($pos = strpos($tag, ' '))!==false) $tag = substr($tag, 0, $pos); $parent_lower = strtolower($this->parent->tag); $tag_lower = strtolower($tag); if ($parent_lower!==$tag_lower) { if (isset($this->optional_closing_tags[$parent_lower]) && isset($this->block_tags[$tag_lower])) { $this->parent->_[HDOM_INFO_END] = 0; while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) $this->parent = $this->parent->parent; if (strtolower($this->parent->tag)!==$tag_lower) { $this->as_text_node($tag); $this->char = (--$this->pos>-1) ? $this->doc[$this->pos] : null; // back } } else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower) { $this->parent->_[HDOM_INFO_END] = 0; $this->parent = $this->parent->parent; } else return $this->as_text_node($tag); } $this->parent->_[HDOM_INFO_END] = $this->cursor; if ($this->parent->parent) $this->parent = $this->parent->parent; $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next return true; } $node = new simple_html_dom_node($this); $node->_[HDOM_INFO_BEGIN] = $this->cursor; ++$this->cursor; $tag = $this->copy_until($this->token_slash); // doctype, cdata & comments... if (isset($tag[0]) && $tag[0]==='!') { $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>'); if (isset($tag[2]) && $tag[1]==='-' && $tag[2]==='-') { $node->nodetype = HDOM_TYPE_COMMENT; $node->tag = 'comment'; } else { $node->nodetype = HDOM_TYPE_UNKNOWN; $node->tag = 'unknown'; } if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>'; $this->link_nodes($node, false); $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next return true; } // text if (!preg_match("/^[\w-:]+$/", $tag)) { $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>'); if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>'; $this->link_nodes($node, false); $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next return true; } // begin tag $node->nodetype = HDOM_TYPE_ELEMENT; $tag_lower = strtolower($tag); $node->tag = ($this->lowercase) ? $tag_lower : $tag; // handle optional closing tags if (isset($this->optional_closing_tags[$tag_lower]) ) { while (isset($this->optional_closing_tags[$tag_lower][strtolower($this->parent->tag)])) { $this->parent->_[HDOM_INFO_END] = 0; $this->parent = $this->parent->parent; } $node->parent = $this->parent; } $this->link_nodes($node, true); $guard = 0; // prevent infinity loop $space = array($this->copy_skip($this->token_blank), '', ''); // attributes do { if ($this->char!==null && $space[0]==='') break; $name = $this->copy_until($this->token_equal); if($guard===$this->pos) { $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next continue; } $guard = $this->pos; // handle endless '<' if($this->pos>=$this->size-1 && $this->char!=='>') { $node->nodetype = HDOM_TYPE_TEXT; $node->_[HDOM_INFO_END] = 0; $node->_[HDOM_INFO_TEXT] = '<'.$tag . $space[0] . $name; $node->tag = 'text'; return true; } if ($name!=='/' && $name!=='') { $space[1] = $this->copy_skip($this->token_blank); if ($this->lowercase) $name = strtolower($name); if ($this->char==='=') { $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next $this->parse_attr($node, $name, $space); } else { //no value attr: nowrap, checked selected... $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO; $node->attr[$name] = true; if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev } $node->_[HDOM_INFO_SPACE][] = $space; $space = array($this->copy_skip($this->token_blank), '', ''); } else break; } while($this->char!=='>' && $this->char!=='/'); $node->_[HDOM_INFO_ENDSPACE] = $space[0]; // check self closing if ($this->copy_until_char_escape('>')==='/') { $node->_[HDOM_INFO_ENDSPACE] .= '/'; $node->_[HDOM_INFO_END] = 0; } else { // reset parent if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node; } $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next return true; } // parse attributes protected function parse_attr($node, $name, &$space) { $space[2] = $this->copy_skip($this->token_blank); switch($this->char) { case '"': $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE; $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next $node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('"')); $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next break; case '\'': $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_SINGLE; $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next $node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('\'')); $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next break; default: $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO; $node->attr[$name] = $this->restore_noise($this->copy_until($this->token_attr)); } } // link node's parent protected function link_nodes(&$node, $is_child) { $node->parent = $this->parent; $this->parent->nodes[] = &$node; if ($is_child) $this->parent->children[] = &$node; } // as a text node protected function as_text_node($tag) { $node = new simple_html_dom_node($this); ++$this->cursor; $node->_[HDOM_INFO_TEXT] = '</' . $tag . '>'; $this->link_nodes($node, false); $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next return true; } protected function skip($chars) { $this->pos += strspn($this->doc, $chars, $this->pos); $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next } protected function copy_skip($chars) { $pos = $this->pos; $len = strspn($this->doc, $chars, $pos); $this->pos += $len; $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next if ($len===0) return ''; return substr($this->doc, $pos, $len); } protected function copy_until($chars) { $pos = $this->pos; $len = strcspn($this->doc, $chars, $pos); $this->pos += $len; $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next return substr($this->doc, $pos, $len); } protected function copy_until_char($char) { if ($this->char===null) return ''; if (($pos = strpos($this->doc, $char, $this->pos))===false) { $ret = substr($this->doc, $this->pos, $this->size-$this->pos); $this->char = null; $this->pos = $this->size; return $ret; } if ($pos===$this->pos) return ''; $pos_old = $this->pos; $this->char = $this->doc[$pos]; $this->pos = $pos; return substr($this->doc, $pos_old, $pos-$pos_old); } protected function copy_until_char_escape($char) { if ($this->char===null) return ''; $start = $this->pos; while(1) { if (($pos = strpos($this->doc, $char, $start))===false) { $ret = substr($this->doc, $this->pos, $this->size-$this->pos); $this->char = null; $this->pos = $this->size; return $ret; } if ($pos===$this->pos) return ''; if ($this->doc[$pos-1]==='\\') { $start = $pos+1; continue; } $pos_old = $this->pos; $this->char = $this->doc[$pos]; $this->pos = $pos; return substr($this->doc, $pos_old, $pos-$pos_old); } } // remove noise from html content protected function remove_noise($pattern, $remove_tag=false) { $count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE); for ($i=$count-1; $i>-1; --$i) { $key = '___noise___'.sprintf('% 3d', count($this->noise)+100); $idx = ($remove_tag) ? 0 : 1; $this->noise[$key] = $matches[$i][$idx][0]; $this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0])); } // reset the length of content $this->size = strlen($this->doc); if ($this->size>0) $this->char = $this->doc[0]; } // restore noise to html content function restore_noise($text) { while(($pos=strpos($text, '___noise___'))!==false) { $key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13]; if (isset($this->noise[$key])) $text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+14); } return $text; } function __toString() { return $this->root->innertext(); } function __get($name) { switch($name) { case 'outertext': return $this->root->innertext(); case 'innertext': return $this->root->innertext(); case 'plaintext': return $this->root->plaintext(); } } // camel naming conventions function childNodes($idx=-1) {return $this->root->childNodes($idx);} function firstChild() {return $this->root->first_child();} function lastChild() {return $this->root->last_child();} function getElementById($id) {return $this->find("#$id", 0);} function getElementsById($id, $idx=-1) {return $this->find("#$id", $idx);} function getElementByTagName($name) {return $this->find($name, 0);} function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);} function loadFile() {$args = func_get_args();$this->load(call_user_func_array('file_get_contents', $args), true);} } ?>
shannah/swete
swete-admin/lib/simple_html_dom.php
PHP
gpl-3.0
30,855
/* * Copyright (C) 2013 SLUB Dresden * * 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 de.qucosa.fedora; import com.yourmediashelf.fedora.client.FedoraClient; import com.yourmediashelf.fedora.client.FedoraClientException; import com.yourmediashelf.fedora.client.request.*; import com.yourmediashelf.fedora.client.response.*; import com.yourmediashelf.fedora.generated.management.DatastreamProfile; import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import java.io.ByteArrayInputStream; import java.io.InputStream; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Mockito.*; public class FedoraRepositoryTest { private FedoraRepository fedoraRepository; private FedoraClient fedoraClient; @Before public void setUp() { fedoraClient = mock(FedoraClient.class); fedoraRepository = new FedoraRepository(fedoraClient); } @Test public void getsDatastreamContent() throws Exception { GetDatastreamResponse dsResponse = mock(GetDatastreamResponse.class); when(dsResponse.getEntityInputStream()).thenReturn(new ByteArrayInputStream("Test Content".getBytes())); when(fedoraClient.execute(any(GetDatastreamDissemination.class))).thenReturn(dsResponse); InputStream contentStream = fedoraRepository.getDatastreamContent("test:1", "TEST-DS"); assertEquals("Test Content", IOUtils.toString(contentStream)); } @Test public void modifiesDatastreamContent() throws Exception { ModifyDatastreamResponse mockResponse = mock(ModifyDatastreamResponse.class); when(mockResponse.getStatus()).thenReturn(200); when(fedoraClient.execute(any(ModifyDatastream.class))).thenReturn(mockResponse); InputStream testInputStream = IOUtils.toInputStream("testInputData"); fedoraRepository.modifyDatastreamContent("test:1", "TEST-DS", "text", testInputStream); verify(fedoraClient).execute(any(ModifyDatastream.class)); } @SuppressWarnings("unchecked") @Test(expected = FedoraClientException.class) public void throwsFedoraClientException() throws Exception { when(fedoraClient.execute(any(GetDatastreamDissemination.class))).thenThrow(FedoraClientException.class); fedoraRepository.getDatastreamContent("test:1", "TEST-DS"); } @Test public void mintNewPid() throws Exception { GetNextPIDResponse mockGetNextPidResponse = mock(GetNextPIDResponse.class); when(mockGetNextPidResponse.getPid()).thenReturn("qucosa:4711"); when(fedoraClient.execute(any(GetNextPID.class))).thenReturn(mockGetNextPidResponse); String newPid = fedoraRepository.mintPid(null); assertEquals("qucosa:4711", newPid); } @Test public void modifiesObjectMetadata() throws Exception { FedoraResponse mockResponse = mock(FedoraResponse.class); when(mockResponse.getStatus()).thenReturn(200); when(fedoraClient.execute(any(ModifyObject.class))).thenReturn(mockResponse); fedoraRepository.modifyObjectMetadata("qucosa:4711", "A", "new-label", "qucosa"); verify(fedoraClient).execute(any(ModifyObject.class)); } @Test public void returnTrueIfDatastreamExists() throws Exception { GetDatastreamResponse dsResponse = mock(GetDatastreamResponse.class); when(dsResponse.getStatus()).thenReturn(200); when(fedoraClient.execute(any(GetDatastream.class))).thenReturn(dsResponse); assertTrue(fedoraRepository.hasDatastream("test:1", "TEST-DS")); } @Test public void triggersUpdatesDatastreamProfile() throws Exception { DatastreamProfile mockDSProfile = mock(DatastreamProfile.class); when(mockDSProfile.getDsLabel()).thenReturn("old-label"); DatastreamProfileResponse mockDSProfileResponse = mock(DatastreamProfileResponse.class); when(mockDSProfileResponse.getDatastreamProfile()).thenReturn(mockDSProfile); when(fedoraClient.execute(any(GetDatastream.class))).thenReturn(mockDSProfileResponse); fedoraRepository.updateExternalReferenceDatastream("qucosa:4711", "TEST-DS", "new-label", null, null); verify(fedoraClient, atLeastOnce()).execute(any(ModifyDatastream.class)); } @Test @Ignore("Currently not possible to ensure that method is not invoked with particular object argument.") public void doesNotTriggerUpdatesDatastreamProfileWhenNothingChanges() throws Exception { DatastreamProfile mockDSProfile = mock(DatastreamProfile.class); when(mockDSProfile.getDsLabel()).thenReturn("same-old-label"); DatastreamProfileResponse mockDSProfileResponse = mock(DatastreamProfileResponse.class); when(mockDSProfileResponse.getDatastreamProfile()).thenReturn(mockDSProfile); when(fedoraClient.execute(any(GetDatastream.class))).thenReturn(mockDSProfileResponse); fedoraRepository.updateExternalReferenceDatastream("qucosa:4711", "TEST-DS", "same-old-label", null, null); // Express intend, but not supported by Mockito this way verify(fedoraClient, never()).execute(any(ModifyDatastream.class)); } }
qucosa/qucosa-webapi
src/test/java/de/qucosa/fedora/FedoraRepositoryTest.java
Java
gpl-3.0
5,903
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <style> table.head, table.foot { width: 100%; } td.head-rtitle, td.foot-os { text-align: right; } td.head-vol { text-align: center; } table.foot td { width: 50%; } table.head td { width: 33%; } div.spacer { margin: 1em 0; } </style> <title> Mono(Mono 1.1.x)</title> </head> <body> <div class="mandoc"> <table class="head"> <tbody> <tr> <td class="head-ltitle"> Mono(Mono 1.1.x)</td> <td class="head-vol"> </td> <td class="head-rtitle"> Mono(Mono 1.1.x)</td> </tr> </tbody> </table> <div class="section"> <h1>NAME</h1> monodis - CIL image content dumper and disassembler.</div> <div class="section"> <h1>SYNOPSIS</h1> <b>monodis</b> [-h] [--help] [--output=FILENAME] [--mscorlib] [--assembly] [--assemblyref] [--classlayout] [--constant] [--customattr] [--declsec] [--event] [--exported] [--fields] [--file] [--forward-decls] [--genericpar] [--implmap] [--interface] [--manifest] [--marshal] [--memberref] [--method] [--methodimpl] [--methodsem] [--methodspec] [--module] [--moduleref] [--mresources] [--presources] [--nested] [--param] [--parconst] [--property] [--propertymap] [--standalonesig] [--typedef] [--typeref] [--typespec] [--blob] [--strings] [--userstrings] [FILES...]</div> <div class="section"> <h1>DESCRIPTION</h1> The <i>monodis</i> program is used to dump the contents an ECMA/ISO CIL image (contained in .EXE files that contain extended PE/COFF CIL code).<div class="spacer"> </div> To roundtrip assemblies using ilasm, it is best to use the --output argument, as that will make monodis save the embedded resources in files that can later be properly embedded back by ilasm.<div class="spacer"> </div> Additionally, the tool can be used to dump the contents of the various ECMA CIL metadata tables.</div> <div class="section"> <h1>OPTIONS</h1> The following Generic options are supported:<dl> <dt> <i>--help , -h</i></dt> <dd> Displays usage instructions.</dd> </dl> <dl> <dt> <i>--output=FILENAME</i></dt> <dd> Write output into <i>FILENAME</i> and dump any embedded managed resources.</dd> </dl> <dl> <dt> <i>--mscorlib</i></dt> <dd> For non-corlib assemblies, use &quot;mscorlib&quot; as the assembly name. This is useful for round-tripping the IL with ilasm.</dd> </dl> <dl> <dt> <i>--show-method-tokens</i></dt> <dd> Display tokens for disassembled methods.</dd> </dl> </div> <div class="section"> <h1>OPTIONS TO DISPLAY METADATA TABLES</h1> The following options are used to display metadata tables instead of disassembling the CIL image.<dl> <dt> <i>--assembly</i></dt> <dd> Dumps the contents of the Assembly table.</dd> </dl> <dl> <dt> <i>--assemblyref</i></dt> <dd> Dumps the contents of the AssemblyRef table.</dd> </dl> <dl> <dt> <i>--classlayout</i></dt> <dd> Dumps the contents of the ClassLayout table.</dd> </dl> <dl> <dt> <i>--constant</i></dt> <dd> Dumps the contents of the Constant table.</dd> </dl> <dl> <dt> <i>--customattr</i></dt> <dd> Dumps the contents of the CustomAttribute table.</dd> </dl> <dl> <dt> <i>--declsec</i></dt> <dd> Dumps the contents of the DeclSec table.</dd> </dl> <dl> <dt> <i>--event</i></dt> <dd> Dumps the contents of the Event table.</dd> </dl> <dl> <dt> <i>--exported</i></dt> <dd> Dumps the contents of the ExportedType table.</dd> </dl> <dl> <dt> <i>--fields</i></dt> <dd> Dumps the contents of the Field table.</dd> </dl> <dl> <dt> <i>--file</i></dt> <dd> Dumps the contents of the File table.</dd> </dl> <dl> <dt> <i>--forward-decls</i></dt> <dd> Dumps forward declarations for classes.</dd> </dl> <dl> <dt> <i>--genericpar</i></dt> <dd> Dumps the contents of the GenericParam table.</dd> </dl> <dl> <dt> <i>--implmap</i></dt> <dd> Dumps the contents of the ImplMap table.</dd> </dl> <dl> <dt> <i>--interface</i></dt> <dd> Dumps the contents of the InterfaceImpl table.</dd> </dl> <dl> <dt> <i>--manifest</i></dt> <dd> Dumps the contents of the ManifestResource table.</dd> </dl> <dl> <dt> <i>--marshal</i></dt> <dd> Dumps the contents of the FieldMarshal table.</dd> </dl> <dl> <dt> <i>--memberref</i></dt> <dd> Dumps the contents of the MemberRef table.</dd> </dl> <dl> <dt> <i>--method</i></dt> <dd> Dumps the contents of the MethodDef table.</dd> </dl> <dl> <dt> <i>--methodimpl</i></dt> <dd> Dumps the contents of the MethodImpl table.</dd> </dl> <dl> <dt> <i>--methodspec</i></dt> <dd> Dumps the contents of the MethodSpec table.</dd> </dl> <dl> <dt> <i>--methodsem</i></dt> <dd> Dumps the contents of the MethodSemantics table.</dd> </dl> <dl> <dt> <i>--module</i></dt> <dd> Dumps the contents of the Module table.</dd> </dl> <dl> <dt> <i>--moduleref</i></dt> <dd> Dumps the contents of the ModuleRef table.</dd> </dl> <dl> <dt> <i>--mresources</i></dt> <dd> Saves all the managed resources embedded in the assembly into the current directory. To get a list of the embedded resources use the --manifest option.</dd> </dl> <dl> <dt> <i>--presources</i></dt> <dd> Prints offsets and names of manifest resources embedded in the assembly.</dd> </dl> <dl> <dt> <i>--nested</i></dt> <dd> Dumps the contents of the NestedClass table.</dd> </dl> <dl> <dt> <i>--param</i></dt> <dd> Dumps the contents of the Param table.</dd> </dl> <dl> <dt> <i>--parconst</i></dt> <dd> Dumps the contents of the GenericParameterConstraint table.</dd> </dl> <dl> <dt> <i>--property</i></dt> <dd> Dumps the contents of the Property table.</dd> </dl> <dl> <dt> <i>--propertymap</i></dt> <dd> Dumps the contents of the PropertyMap table.</dd> </dl> <dl> <dt> <i>--standalonesig</i></dt> <dd> Dumps the contents of the StandAloneSig table.</dd> </dl> <dl> <dt> <i>--typedef</i></dt> <dd> Dumps the contents of the TypeDef table.</dd> </dl> <dl> <dt> <i>--typespec</i></dt> <dd> Dumps the contents of the TypeSpec table.</dd> </dl> <dl> <dt> <i>--typeref</i></dt> <dd> Dumps the contents of the TypeRef table.</dd> </dl> <dl> <dt> <i>--blob</i></dt> <dd> Dumps the entire contents of the blob stream as hex.</dd> </dl> <dl> <dt> <i>--strings</i></dt> <dd> Dumps the contents of the Strings heap.</dd> </dl> <dl> <dt> <i>--userstrings</i></dt> <dd> Dumps the contents of the User-Strings heap</dd> </dl> <div class="spacer"> </div> If no flags are specified the program dumps the content of the image in a format that can be used to rountrip the code.</div> <div class="section"> <h1>ENVIRONMENT VARIABLES</h1><dl> <dt> <i>MONO_PATH</i></dt> <dd> Provides a search path to mono and mint where to look for library files. Directories are separated by the platform path separator (colons on unix). Example: <b>/home/username/lib:/usr/local/mono/lib</b></dd> </dl> </div> <div class="section"> <h1>AUTHOR</h1> monodis was written by Miguel de Icaza, Paolo Molaro and Dietmar Maurer.</div> <div class="section"> <h1>SEE ALSO</h1> <b>pedump(1)</b></div> <table class="foot"> <tr> <td class="foot-date"> </td> <td class="foot-os"> </td> </tr> </table> </div> </body> </html>
fusion809/fusion809.github.io-old
man/monodis.1.html
HTML
gpl-3.0
6,873
/* Copyright (C) 2010 Aurelien Da Campo 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package vues.commun; import java.awt.AlphaComposite; import java.awt.Component; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.table.TableCellRenderer; import models.terrains.Terrain; public class TableCellRenderer_Image implements TableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object terrain, boolean isSelected, boolean hasFocus, int row, int column) { Terrain t = (Terrain) terrain; BufferedImage image = new BufferedImage(t.getLargeur(), t.getHauteur(), BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); // image ou couleur de fond if(t.getImageDeFond() != null) { Image image1 = t.getImageDeFond(); for(int l=0;l<t.getLargeur();l+=image1.getWidth(null)) for(int h=0;h<t.getHauteur();h+=image1.getHeight(null)) g2.drawImage(image1, l, h, null); } else { // couleur de fond g2.setColor(t.getCouleurDeFond()); g2.fillRect(0, 0, t.getLargeur(), t.getHauteur()); } // murs setTransparence(t.getOpaciteMurs(),g2); g2.setColor(t.getCouleurMurs()); ArrayList<Rectangle> murs = t.getMurs(); g2.setColor(t.getCouleurMurs()); for(Rectangle mur : murs) dessinerZone(mur,g2); setTransparence(1.f,g2); return new JLabel(new ImageIcon(image.getScaledInstance(50, 50, Image.SCALE_SMOOTH))); } /** * Permet de dessiner une zone rectangulaire sur le terrain. * * @param zone la zone rectangulaire * @param g2 le Graphics2D pour dessiner */ private void dessinerZone(final Rectangle zone, final Graphics2D g2) { g2.fillRect((int) zone.getX(), (int) zone.getY(), (int) zone.getWidth(), (int) zone.getHeight()); } /** * Permet de modifier la transparence du Graphics2D * * @param tauxTransparence le taux (1.f = 100% opaque et 0.f = 100% transparent) * @param g2 le Graphics2D a configurer */ protected void setTransparence(float tauxTransparence, Graphics2D g2) { g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, tauxTransparence)); } }
sergeyk93/tdai-finalproject
src/vues/commun/TableCellRenderer_Image.java
Java
gpl-3.0
3,372
#!/usr/bin/env python3 # Copyright 2016, 2017 Andrew Conrad # # 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/>. """Tool to initialize Thrustmaster racing wheels.""" import argparse import time import tmdrv_devices import usb1 from importlib import import_module from os import path from subprocess import check_call, CalledProcessError device_list = ['thrustmaster_t500rs', 'thrustmaster_tmx', 'thrustmaster_tx', 'thrustmaster_tsxw'] _context = usb1.USBContext() def initialize(device_name='thrustmaster_tx'): try: device = import_module('tmdrv_devices.' + device_name) except ModuleNotFoundError: print('Device name "' + device_name + '" is invalid.') raise try: device except UnboundLocalError: print('Device name "' + device_name + '" is invalid.') raise # Send all control packets for initialization for m in device.control: try: _control_init( device.idVendor, device.idProduct[m['step'] - 1], m['request_type'], m['request'], m['value'], m['index'], m['data'], ) except usb1.USBErrorNotFound: print('Error getting handle for device {:0=4x}:{:0=4x} ({} Step {}).'.format(device.idVendor, device.idProduct[m['step']-1], device.name, m['step'])) raise except usb1.USBErrorNoDevice: # Caught when device switches modes pass except usb1.USBErrorPipe: # Possibly caught when device switches modes on older libusb pass except usb1.USBErrorIO: # Possibly caught when device switches modes on newer # libusb. This still has to be investigated, there might # be another issue going on here. pass # Wait for device to switch connected = False while not connected: handle = _context.openByVendorIDAndProductID( device.idVendor, device.idProduct[m['step']], ) if handle is not None: connected = True # Load configuration to remove deadzones if device.jscal is not None: dev_path = '/dev/input/by-id/' + device.dev_by_id # Sometimes the device symlink is not ready in time, so we wait n = 9 while not path.islink(dev_path): if n > 0: time.sleep(.5) n -= 1 else: print('Device "{}" not found, skipping device calibration'.format(dev_path)) raise FileNotFoundError _jscal(device.jscal, dev_path) def _jscal(configuration, device_file): try: check_call(['jscal', '-s', configuration, device_file]) except FileNotFoundError: print('jscal not found, skipping device calibration.') except CalledProcessError as err: print('jscal non-zero exit code {}, device may not be calibrated'.format(str(err)[-1])) def _control_init(idVendor, idProduct, request_type, request, value, index, data): handle = _context.openByVendorIDAndProductID( idVendor, idProduct, ) if handle is None: raise usb1.USBErrorNotFound('Device not found or wrong permissions') handle.setAutoDetachKernelDriver(True) handle.claimInterface(0) # Send control packet that will switch modes handle.controlWrite( request_type, request, value, index, data, ) if __name__ == '__main__': parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-d', '--device', default='thrustmaster_tx', help='Specify device to use') parser.add_argument('-D', '--supported-devices', action='store_true', help='List all supported devices') args = parser.parse_args() if args.supported_devices: for d in device_list: print(d) else: initialize(args.device)
her001/tmdrv
tmdrv.py
Python
gpl-3.0
3,992
/* Developed by Sandeep Sharma and Garnet K.-L. Chan, 2012 Copyright (c) 2012, Garnet K.-L. Chan This program is integrated in Molpro with the permission of Sandeep Sharma and Garnet K.-L. Chan */ #include "IntegralMatrix.h" #include <fstream> #include "input.h" #include "pario.h" #include "global.h" #include "orbstring.h" #include <include/communicate.h> #ifdef _OPENMP #include "omp.h" #endif //the following can be removed later #include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> #include "sweep.h" #include <boost/filesystem.hpp> #ifndef SERIAL #include <boost/mpi/environment.hpp> #include <boost/mpi/communicator.hpp> #include <boost/mpi.hpp> #endif using namespace SpinAdapted; void CheckFileExistence(string filename, string filetype) { boost::filesystem::path p(filename); if (boost::filesystem::exists(p)) { if (!boost::filesystem::is_regular_file(p)) { pout << filetype<<" "<<filename<<" is not a regular file."<<endl; abort(); } } else { pout << filetype<<" "<<filename<<" is not present."<<endl; abort(); } } void CheckFileInexistence(string filename, string filetype){ boost::filesystem::path p(filename); if (boost::filesystem::exists(p)) { p2out << filetype<<" "<<filename<<" is present."<<endl; if (filetype=="genetic algorithm reorder") pout << "You already ran the genetic algorithm reordering and the ordering is present in the location above." << endl; abort(); } } void ReadInput(char* conf) { #ifndef SERIAL mpi::communicator world; int rank = world.rank(); int size = world.size(); p3out << " communication topology " << endl; vector<int> sendlist; for (int i = 0; i < sendlist.size(); ++i) p3out << "processor " << rank << " to " << sendlist[i] << endl; p3out << "\t\t\t proc " << rank << " of " << size << endl; #endif globaltimer.start(); int randomseed = 243; srand(randomseed); std::string configFile(conf); CheckFileExistence(conf, "Input file "); //read the config file dmrginp = Input(configFile); RESTART = dmrginp.get_restart(); FULLRESTART = dmrginp.get_fullrestart(); BACKWARD = dmrginp.get_backward(); restartwarm = dmrginp.get_restart_warm(); reset_iter = dmrginp.get_reset_iterations(); #ifndef SERIAL MAX_THRD=dmrginp.thrds_per_node()[rank]; #else MAX_THRD=dmrginp.thrds_per_node()[0]; #endif #ifdef _OPENMP omp_set_num_threads(MAX_THRD); #endif //initialise the size of all Slater determinants equal to orbsize Orbstring::init(dmrginp.slater_size()); }
sanshar/StackBlock
readinput.C
C++
gpl-3.0
2,882
/* * Copyright (C) 2017 Josua Frank * * 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. */ package dfmaster.xml.validation.types.characters; import dfmaster.xml.XMLUtils; import dfmaster.xml.validation.types.Datatype; /** * * @author Josua Frank */ public class IDREFS extends NCName implements Datatype<String> { public IDREFS(String... name) { super(XMLUtils.toNCNamesString(name)); } public static IDREFS of(String... value) { return new IDREFS(value); } }
Sharknoon/dfMASTER
dfMASTER/src/main/java/dfmaster/xml/validation/types/characters/IDREFS.java
Java
gpl-3.0
1,168
using System.Windows.Input; using Rubberduck.Parsing.VBA; using Rubberduck.UI.Command.MenuItems.ParentMenus; namespace Rubberduck.UI.Command.MenuItems { public class FindAllImplementationsCommandMenuItem : CommandMenuItemBase { public FindAllImplementationsCommandMenuItem(CommandBase command) : base(command) { } public override string Key { get { return "ContextMenu_GoToImplementation"; } } public override int DisplayOrder { get { return (int)CodePaneContextMenuItemDisplayOrder.FindAllImplementations; } } public override bool EvaluateCanExecute(RubberduckParserState state) { return Command.CanExecute(null); } } }
kerzhaw/Rubberduck
RetailCoder.VBE/UI/Command/MenuItems/FindAllImplementationsCommandMenuItem.cs
C#
gpl-3.0
712
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main() { long long i,j; while(scanf("%d %d\n",&i,&j) != EOF) { long long ic=1,jc=1; cin>>i>>j; long long temp =i; while(temp!=1) { if(temp%2 != 0) { temp = 3*temp +1; temp = temp/2; ic+=2; } else{ temp=temp/2; ic++; } } temp = j; while(temp!=1) { if(temp%2 != 0) { temp = 3*temp +1; temp = temp/2; jc+=2; } else { temp=temp/2; jc++; } } cout<<i<<" "<<j<<" "<<max(jc,ic)<<endl; } return 0; }
divyanshgaba/Competitive-Coding
The 3n + 1 problem/main.cpp
C++
gpl-3.0
890
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Bitcoin Blocks</title> <link rel="stylesheet" type="text/css" href="../shared-html5/css/bitmaps.css"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="../shared-html5/js/reconnecting-websocket.js"></script> <script src="../shared-html5/js/representations.js"></script> <script src="../shared-html5/js/bitmaps.js"></script> <script src="js/init.js"></script> </head> <body> <div id="transactions"> <div id="transactions-inner"> </div> </div> <script> initBlocks(); </script> </body> </html>
robmyers/blockchain-aesthetics
bitcoin-html5/blocks-bitmaps.html
HTML
gpl-3.0
676
package com.jackwilsdon.PvPoints; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; /* * PvPointsCommandExecutor * Command Executor for PvPoints */ public class PvPointsCommandExecutor implements CommandExecutor { /* * Variable for plugin */ private static PvPointsPlugin plugin; /* * Message return prefix */ String prefix = "["+ChatColor.GREEN+"PvPoints"+ChatColor.WHITE+"] "; /* * PvPointsPlayerManager * Constructor */ PvPointsCommandExecutor(PvPointsPlugin pl) { /* * Set plugin variable */ plugin = pl; } /* * issue() * Displays a problem to the reciever */ public void issue(String issue, CommandSender reciever) { switch (issue) { case "syntax": reciever.sendMessage(prefix+ChatColor.YELLOW+"Invalid syntax!"); reciever.sendMessage(prefix+ChatColor.YELLOW+"Valid commands are "+ ChatColor.GREEN+"reset"+ChatColor.YELLOW+", "+ ChatColor.GREEN+"add"+ChatColor.YELLOW+", "+ ChatColor.GREEN+"help"+ChatColor.YELLOW+", "+ ChatColor.GREEN+"scores"); reciever.sendMessage(prefix+ChatColor.YELLOW+"Optional arguments are denoted as "+ChatColor.GREEN+"[option]"); break; case "reset-syntax": reciever.sendMessage(prefix+ChatColor.YELLOW+"Invalid syntax for "+ChatColor.GREEN+"reset"+ChatColor.YELLOW+"!"); reciever.sendMessage(prefix+ChatColor.YELLOW+"Valid syntax: /pvpoints reset [username]"); reciever.sendMessage(prefix+ChatColor.YELLOW+"Optional arguments are denoted as "+ChatColor.GREEN+"[option]"); break; case "reset-sender": reciever.sendMessage(prefix+ChatColor.GREEN+"reset"+ChatColor.RED+" without parameters can only be run by a player!"); break; case "add-syntax": reciever.sendMessage(prefix+ChatColor.YELLOW+"Invalid syntax for "+ChatColor.GREEN+"add"+ChatColor.YELLOW+"!"); reciever.sendMessage(prefix+ChatColor.YELLOW+"Valid syntax: /pvpoints add <username>"); break; case "scores-syntax": reciever.sendMessage(prefix+ChatColor.YELLOW+"Invalid syntax for "+ChatColor.GREEN+"scores"+ChatColor.YELLOW+"!"); reciever.sendMessage(prefix+ChatColor.YELLOW+"Valid syntax: /pvpoints scores"); break; case "existing-player": reciever.sendMessage(prefix+ChatColor.RED+"That player already exists!"); break; case "missing-player": reciever.sendMessage(prefix+ChatColor.RED+"That is not a valid player!"); break; case "permissions": reciever.sendMessage(prefix+ChatColor.RED+"You don't have permission to do that!"); break; default: reciever.sendMessage(prefix+ChatColor.RED+"Something went wrong!"); break; } } /* * onCommand() * Called when a command is run */ @Override public boolean onCommand(CommandSender cmdSender, Command cmd, String label, String[] arguments) { /* * Check argument length is correct */ if (arguments.length == 0) { /* * If the sender isn't a player, display command help */ if (!(cmdSender instanceof Player)) { issue("syntax", cmdSender); return true; } /* * Retrieve information */ int points = PvPointsPlayerManager.getPoints(cmdSender.getName()); int kills = PvPointsPlayerManager.getKills(cmdSender.getName()); int deaths = PvPointsPlayerManager.getDeaths(cmdSender.getName()); /* * Output statistics */ cmdSender.sendMessage(prefix+ChatColor.YELLOW+"Points: "+ChatColor.WHITE+points); cmdSender.sendMessage(prefix+ChatColor.GREEN+"Kills: "+ChatColor.WHITE+kills); cmdSender.sendMessage(prefix+ChatColor.RED+"Deaths: "+ChatColor.WHITE+deaths); float ratio = (float)kills/(float)deaths; cmdSender.sendMessage(prefix+ChatColor.YELLOW+"Kill/Death ratio: "+ChatColor.WHITE+ratio); return true; } /* * Reload the configuration */ plugin.reloadConfig(); /* * Retrieve command and remove it from the arguments */ String command = arguments[0]; arguments = Arrays.copyOfRange(arguments, 1, arguments.length); /* * Manage the command */ switch(command) { /* * Reset score command */ case "reset": if (arguments.length == 0) { if (!(cmdSender instanceof Player)) { issue("reset-sender", cmdSender); break; } if (!cmdSender.hasPermission("pvpoints.reset.self") && !cmdSender.isOp()) { issue("permissions", cmdSender); break; } PvPointsPlayerManager.reset(cmdSender.getName()); cmdSender.sendMessage(prefix+ChatColor.YELLOW+"Your kills/deaths/points have been reset!"); } else if (arguments.length == 1) { if (!cmdSender.hasPermission("pvpoints.reset.other") && !cmdSender.isOp()) { issue("permissions", cmdSender); break; } if (!PvPointsPlayerManager.playerExists(arguments[0])) { issue("missing-player", cmdSender); break; } PvPointsPlayerManager.reset(arguments[0]); cmdSender.sendMessage(prefix+ChatColor.YELLOW+"The player "+ChatColor.GREEN+arguments[0]+ChatColor.YELLOW+" has been reset!"); plugin.getServer().getPlayer(arguments[0]).sendMessage(prefix+ChatColor.YELLOW+"Your kills/deaths/points have been reset!"); } else { issue("reset-syntax", cmdSender); break; } break; /* * Add player command */ case "add": if (!cmdSender.hasPermission("pvpoints.add") && !cmdSender.isOp()) { issue("permissions", cmdSender); break; } if (arguments.length == 0) { issue("add-syntax", cmdSender); break; } if (PvPointsPlayerManager.playerExists(arguments[0])) { issue("existing-player", cmdSender); break; } PvPointsPlayerManager.reset(arguments[0]); cmdSender.sendMessage(prefix+ChatColor.YELLOW+"The player '"+arguments[0]+"' was added."); break; /* * Help command */ case "help": if (!cmdSender.hasPermission("pvpoints.help") && !cmdSender.isOp()) { issue("permissions", cmdSender); break; } if (arguments.length != 1) { cmdSender.sendMessage(ChatColor.GREEN+"reset [username]"+ChatColor.YELLOW+" - "+ChatColor.WHITE+"Resets a player's kills, deaths and points"); cmdSender.sendMessage(ChatColor.GREEN+"add <username>"+ChatColor.YELLOW+" - "+ChatColor.WHITE+"Add a player to PvPoints"); cmdSender.sendMessage(ChatColor.GREEN+"help [command]"+ChatColor.YELLOW+" - "+ChatColor.WHITE+"Displays help for a certain command, or for all commands"); cmdSender.sendMessage(ChatColor.GREEN+"scores"+ChatColor.YELLOW+" - "+ChatColor.WHITE+"Displays server-wide leaderboards"); break; } else { switch (arguments[0]) { case "reset": cmdSender.sendMessage(ChatColor.GREEN+"reset [username]"+ChatColor.YELLOW+" - "+ChatColor.WHITE+"Using "+ChatColor.GREEN+"reset"+ChatColor.WHITE+" without any parameters will reset your own statistics."); cmdSender.sendMessage(ChatColor.WHITE+"Using "+ChatColor.GREEN+"reset"+ChatColor.WHITE+" with a username will reset the supplied user to default, as long as they are in the PvPoints system"); cmdSender.sendMessage(ChatColor.RED+"Using reset will clear statistics and scores WITHOUT WARNING!"); break; case "add": cmdSender.sendMessage(ChatColor.GREEN+"add <username>"+ChatColor.YELLOW+" - "+ChatColor.WHITE+"Add a user to the PvPoints configuration."); cmdSender.sendMessage(ChatColor.WHITE+"This should not normally need to be used, as players are added to the configuration on join."); break; case "help": cmdSender.sendMessage(ChatColor.GREEN+"help [command]"+ChatColor.YELLOW+" - "+ChatColor.WHITE+"If [command] is not passed, generalised help will be shown for all commands"); cmdSender.sendMessage(ChatColor.WHITE+"If [command] is passed, help for the specified command will be shown"); break; case "scores": cmdSender.sendMessage(ChatColor.GREEN+"scores"+ChatColor.YELLOW+" - "+ChatColor.WHITE+"Displays server-wide leaderboards"); break; default: cmdSender.sendMessage(prefix+ChatColor.WHITE+"Not a valid command! To view all commands, use "+ChatColor.GREEN+"pvpoints help"); break; } } cmdSender.sendMessage(ChatColor.YELLOW+"Optional arguments are denoted as "+ChatColor.GREEN+"[option]"); break; /* * Scoreboard */ case "scores": if (arguments.length != 0) { issue("scores-syntax", cmdSender); break; } Map<String, PvPointsPlayer> players = PvPointsPlayerManager.getAllPlayers(); List<PvPointsPlayer> list = new ArrayList<PvPointsPlayer>(players.values()); Collections.sort(list, new PvPointsLeaderboard()); if (list.size() >= 10) { list = list.subList(0, 10); } cmdSender.sendMessage(prefix+ChatColor.YELLOW+"Leaderboard"); for (int cP = 0; cP < list.size(); cP++) { PvPointsPlayer player = list.get(cP); String username = player.username; cmdSender.sendMessage(ChatColor.GREEN+Integer.toString(cP+1)+". "+ChatColor.WHITE+player.points+" "+ChatColor.YELLOW+username); } break; /* * Default, unknown command */ default: if (!cmdSender.hasPermission("pvpoints.help") && !cmdSender.isOp()) { issue("permissions", cmdSender); break; } issue("syntax", cmdSender); break; } /* * Save any configuration changes */ plugin.saveConfig(); /* * Return true to prevent default help from appearing */ return true; } }
jackwilsdon/PvPoints
src/com/jackwilsdon/PvPoints/PvPointsCommandExecutor.java
Java
gpl-3.0
9,585
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>FACILITY_Academy</title> <style> body{ font-family: 'Electrolize'; background-image: url(https://raw.githubusercontent.com/namhyein/CURLY-FORTNIGHT/master/main/image/02.jpeg); background-size: 100%; background-repeat: no-repeat; background-attachment: fixed; background-position: 50% 50%; } #topMenu{ height: 30px; width: 900px; } #topMenu ul li{ list-style: none; color: white; text-shadow: 2px 2px 5px black; float: left; position: relative; left: 62%; line-height: 40px; vertical-align: middle; text-align: center; } #topMenu .menuLink{ text-decoration: none; color: white; display: block; width: 120px; font-size: 17px; font-weight: bold; font-family: "Trebuchet MS", Dotum, Arial; } #topMenu .menuLink:hover{ color: red; background-color: #4d4d4d; background : rgba(0, 0, 0, 0.2); } #subMenu{ height: 800px; width: 190px; position: absolute; top: 20%; } #subMenu ul li{ list-style: none; color: white; text-shadow: 2px 2px 5px black; background-color: #2d2d2d; background : rgba(0, 0, 0, 0.3); position: relative; line-height: 50px; vertical-align: middle; text-align: center; } #subMenu .menuLink{ text-decoration: none; color: white; display: block; width: 150px; font-size: 20px; font-weight: bold; font-family: "Trebuchet MS", Dotum, Arial; } #subMenu .menuLink:hover{ color: skyblue; background-color: #4d4d4d; background : rgba(0, 0, 0, 0.2); } #logo{ position: absolute; left: 5.6%; top: 4%; } #box{ background-color: #2d2d2d; background : rgba(0, 0, 0, 0.3); position: absolute; top: 13%; left: 20%; width: 1080px; height: 2050px; } #information{ color: white; position: absolute; left: 23%; top: 13%; font-size: 20px; font-family: "Tahoma"; } </style> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="euc-kr"> <script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> <script> function initialize() { var Y_point = 37.297090; var X_point = 126.836085; var zoomLevel = 17; var markerTitle1 = "0&1 Algorithm Academy"; var markerMaxWidth = 300; var contentString1 = '<div>' + '<h3>0&1 Algorithm Academy</h3>'+ '<p>Location of 0&1 Academy : in SMASH Room</p>' + '</div>'; var myLatlng = new google.maps.LatLng(Y_point, X_point); var mapOptions = { zoom: zoomLevel, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById('map1'), mapOptions); var marker1 = new google.maps.Marker({ position: myLatlng, map: map, title: markerTitle1 }); var infowindow1 = new google.maps.InfoWindow( { content: contentString1, maxWidth: markerMaxWidth } ); google.maps.event.addListener(marker1, 'click', function() { infowindow1.open(map, marker1); }); var Y_point = 37.297363; var X_point = 126.836033; var zoomLevel = 17; var markerTitle2 = "Jaram Academy"; var markerMaxWidth = 300; var contentString2 = '<div>' + '<h3>Jaram Academy</h3>'+ '<p>Location of Jaram Academy : in the 3rd Engineering Building, 1st basement</p>' + '</div>'; var myLatlng = new google.maps.LatLng(Y_point, X_point); var mapOptions = { zoom: zoomLevel, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById('map2'), mapOptions); var marker2 = new google.maps.Marker({ position: myLatlng, map: map, title: markerTitle2 }); var infowindow2 = new google.maps.InfoWindow( { content: contentString2, maxWidth: markerMaxWidth } ); google.maps.event.addListener(marker2, 'click', function() { infowindow2.open(map, marker2); }); var Y_point = 37.297090; var X_point = 126.836085; var zoomLevel = 17; var markerTitle3 = "HYcube Academy"; var markerMaxWidth = 300; var contentString3 = '<div>' + '<h3>HYcube Academy</h3>'+ '<p>Location of HYcube Academy : in SMASH Room</p>' + '</div>'; var myLatlng = new google.maps.LatLng(Y_point, X_point); var mapOptions = { zoom: zoomLevel, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById('map3'), mapOptions); var marker3 = new google.maps.Marker({ position: myLatlng, map: map, title: markerTitle3 }); var infowindow3 = new google.maps.InfoWindow( { content: contentString3, maxWidth: markerMaxWidth } ); google.maps.event.addListener(marker3, 'click', function() { infowindow3.open(map, marker3); }); } </script> </head> <body onload="initialize()"> <div id="logo"><img src="http://printmania.co.kr/data/file/logo/988383267_Y8czCHrG_C7D1BEE7B4EBB7CEB0ED-BCBCB7CEC7FC28B1B9B9AE29.png" height="80"></div> <nav id="topMenu"> <ul> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/main/main.html">HOME</a></li> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/introduction/src/1_Introduction/intro.html">ABOUT</a></li> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/introduction/src/2_LAB/LAB.html">LAB</a></li> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/introduction/src/4_Curriculum/curriculum.html">CURRICULUM</a></li> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/introduction/src/3_academy/academy.html">ACADEMY</a></li> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/introduction/src/5_Facility/facility_main.html">FACILITY</a></li> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/calendar/schedule.html">CALENDAR</a></li> </ul> </nav> <nav id="subMenu"> <ul> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/introduction/src/5_Facility/01.html">Office</a></li> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/introduction/src/5_Facility/02.html">DepRoom</a></li> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/introduction/src/5_Facility/03.html">Smash</a></li> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/introduction/src/5_Facility/04.html">Academy</a></li> <li><a class="menuLink" href="file:///Users/ju/CURLY-FORTNIGHT/introduction/src/5_Facility/05.html">Lecture</a></li> </ul> </nav> <div id="box"></div> <div id="information"> <h2>Academy Room</h2> <i>There are several rooms for academies in C.S.E.</i> <h3>0&1 Algorithm Academy</h3> <div id="map1" style="width:500px; height:300px;"></div> <br> <img src="https://scontent-icn1-1.xx.fbcdn.net/v/t1.0-9/10403626_917419861666206_8552933554060635076_n.jpg?oh=d8d3e45ee92a73bb857c35897c356f6f&oe=588759AA" alt="0&1 room" height="300"> <img src="http://cfile5.uf.tistory.com/image/21508A4557F0958023B64E" alt="0&1 logo" height="200"> <h3>Jaram Academy</h3> <div id="map2" style="width:500px; height:300px;"></div> <br> <img src="http://postfiles10.naver.net/MjAxNjExMTdfMjE5/MDAxNDc5MzU5NzEyNDE1.IAAc1enuB8KTs8IxvreXir8t90RdkTuhaf-5XcIE47wg.jqt6Aw6ktYinJsI9yR6CBQkzZfnUMEIjNb_hC_VKLr4g.JPEG.geulims/KakaoTalk_Photo_2016-11-17-14-09-14.jpeg?type=w3" alt="Jaram Room" height="250"> <img src="https://scontent-icn1-1.xx.fbcdn.net/v/t1.0-9/420094_318625458188023_1823237204_n.jpg?oh=eb722fe96f9070dc19f124a13e0e91c4&oe=58C5B696" alt="Jaram logo" height="200"> <h3>HYcube Academy</h3> <div id="map3" style="width:500px; height:300px;"></div> <br> <img src="https://scontent-icn1-1.xx.fbcdn.net/v/t1.0-9/541097_152576178218848_558480619_n.png?oh=4e4843cb62618d4330bbedcdfd591ea4&oe=58C95E1B" alt="HYcube logo"> <br><br><br><br> </div> </body> </html>
namhyein/CURLY-FORTNIGHT
introduction/src/5_Facility/04.html
HTML
gpl-3.0
7,963
/* * R Cloud - R-based Cloud Platform for Computational Research * at EMBL-EBI (European Bioinformatics Institute) * * Copyright (C) 2007-2015 European Bioinformatics Institute * Copyright (C) 2009-2015 Andrew Tikhonov - andrew.tikhonov@gmail.com * Copyright (C) 2007-2009 Karim Chine - karim.chine@m4x.org * * 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 uk.ac.ebi.rcloud.server.cluster; import uk.ac.ebi.rcloud.server.RServices; import java.util.Vector; /** * Created by IntelliJ IDEA. * User: andrew * Date: Mar 16, 2010 * Time: 1:37:54 PM * To change this template use File | Settings | File Templates. */ public class Cluster { private String _name; private Vector<RServices> _workers; private String _nodeName; public Cluster(String name, Vector<RServices> workers, String nodeName) { _name = name; _workers = workers; _nodeName = nodeName; } public String getName() { return _name; } public Vector<RServices> getWorkers() { return _workers; } public String getNodeName() { return _nodeName; } }
andrewtikhonov/RCloud
rcloud-server/src/main/java/uk/ac/ebi/rcloud/server/cluster/Cluster.java
Java
gpl-3.0
1,727
RENAME TABLE cdus TO categorias; ALTER TABLE livros_categorias CHANGE COLUMN cdu categoria INT;
DriwFS/Livraria
doc/SQL Updates/rev36.sql
SQL
gpl-3.0
100
package config import "golang.org/x/xerrors" // JSONLoader loads configuration type JSONLoader struct { } // Load load the configuration JSON file specified by path arg. func (c JSONLoader) Load(_, _, _ string) (err error) { return xerrors.New("Not implement yet") }
future-architect/vuls
config/jsonloader.go
GO
gpl-3.0
271
package com.github.angerona.fw.gui.report; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import com.github.angerona.fw.gui.base.Presenter; import com.github.angerona.fw.report.Report; import com.github.angerona.fw.report.ReportListener; /** * The ReportPresenter links a Report (data-model) to an * implementation of the {@link ReportView}. For this * it links different events like the {@link ReportListener} * * @author Tim Janus */ public class ReportPresenter extends Presenter<Report, ReportView> implements ActionListener { public ReportPresenter(Report model, ReportView view) { setModel(model); setView(view); } @Override protected void forceUpdate() { } @Override protected void wireViewEvents() { model.addReportListener(view); } @Override protected void unwireViewEvents() { model.removeReportListener(view); } @Override public void actionPerformed(ActionEvent e) { // does nothing } }
Angerona/angerona-framework
gui/src/main/java/com/github/angerona/fw/gui/report/ReportPresenter.java
Java
gpl-3.0
970
namespace Maticsoft.IDAL.Shop.Sales { using Maticsoft.Model.Shop.Sales; using System; using System.Data; public interface ISalesRule { int Add(SalesRule model); SalesRule DataRowToModel(DataRow row); bool Delete(int RuleId); bool DeleteEx(int RuleId); bool DeleteList(string RuleIdlist); bool DeleteListEx(string RuleIdlist); bool Exists(int RuleId); DataSet GetList(string strWhere); DataSet GetList(int Top, string strWhere, string filedOrder); DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex); int GetMaxId(); SalesRule GetModel(int RuleId); int GetRecordCount(string strWhere); bool Update(SalesRule model); } }
51zhaoshi/myyyyshop
Maticsoft.IDAL_Source/Maticsoft.IDAL.Shop.Sales/ISalesRule.cs
C#
gpl-3.0
790
<?php $sLangName = "English"; $aLang = array( 'charset' => 'utf-8', 'ZPFFD_FREEDELIVERY_PRICEDEPARTURE' => 'Dear customer, you still need %s euro to send your article for free!', 'ZPFFD_FREEDELIVERY' => 'Thank you! Your article can be sent for free !', ); ?>
zpfeuropa/oxid-eshop-modul
zpffd/freedelivery/translations/en/zpffreedelivery_en_lang.php
PHP
gpl-3.0
266
#include <iostream> #include <string.h> using namespace std; int p[10001]; int cut_rod(int n) { int q; if (n == 0) return 0; q = 0; for (int i=1; i<=n; i++) { q = max(q, p[i] + cut_rod(n-i)); } return q; } int main() { int n; memset(p, 0, sizeof(p)); p[0] = 0; p[1] = 1; p[2] = 5; p[3] = 8; p[4] = 9; p[5] = 10; p[6] = 17; p[7] = 17; p[8] = 20; p[9] = 24; p[10] = 30; cin >> n; cout << cut_rod(n); }
munif/paa-2
161702/sample/03/C/rod-cut-recursive.cpp
C++
gpl-3.0
510
/* * emu_tran_file.h * * 11/09/14 DJG Added new function prototypes for emulator file * buffering and structure changes for buffering and other new * command line options * Created on: Jan 25, 2014 * Author: djg */ #ifndef EMU_TRAN_FILE_H_ #define EMU_TRAN_FILE_H_ // Information on disk image file for emulator typedef struct emu_file_info { // File version information uint32_t version; // The size of this data in the file header int file_header_size_bytes; // Header and data size of track. All tracks are the same size int track_header_size_bytes; int track_data_size_bytes; // File contains num_cyl*num_head tracks int num_cyl; int num_head; // Rate in Hz int sample_rate_hz; // Delay from index to first data in nanoseconds uint32_t start_time_ns; // The command line used to generate the file char *decode_cmdline; // And description of file char *note; } EMU_FILE_INFO; // Information on transition data file typedef struct tran_file_info { // File version information uint32_t version; int file_header_size_bytes; int track_header_size_bytes; // File contains num_cyl*num_head tracks int num_cyl; int num_head; // Rate in Hz int sample_rate_hz; // Delay from index to first data in nanoseconds uint32_t start_time_ns; // The command line used to generate the file char *decode_cmdline; // And description of file char *note; } TRAN_FILE_INFO; int emu_file_write_header(char *fn, int num_cyl, int num_head, char *cmdline, char *note, uint32_t sample_rate, uint32_t start_time_ns, uint32_t track_bytes); int emu_file_read_header(char *fn, EMU_FILE_INFO *emu_file_info_out, int rewrite); void emu_file_write_track_bits(int fd, uint32_t *words, int num_words, int cyl, int head, uint32_t track_bytes); int emu_file_read_track_bits(int fd, EMU_FILE_INFO *emu_file_info, uint32_t *words, int num_bytes, int *cyl, int *head); void emu_file_close(int fd, int write_eof); int emu_file_seek_track(int fd, int seek_cyl, int seek_head, EMU_FILE_INFO *emu_file_info); int emu_file_read_track_deltas(int fd, EMU_FILE_INFO *emu_file_info, uint16_t deltas[], int max_deltas, int *cyl, int *head); void emu_file_read_cyl(int fd, EMU_FILE_INFO *emu_file_info, int cyl, void *buf, int buf_size); void emu_file_write_cyl(int fd, EMU_FILE_INFO *emu_file_info, int cyl, void *buf, int buf_size); void emu_file_rewrite_track(int fd, EMU_FILE_INFO *emu_file_info, int cyl, int head, void *buf, int buf_size); int tran_file_write_header(char *fn, int num_cyl, int num_head, char *cmdline, char *note, uint32_t start_time_ns); int tran_file_read_header(char *fn, TRAN_FILE_INFO *tran_file_info); int tran_file_seek_track(int fd, int seek_cyl, int seek_head, TRAN_FILE_INFO *tran_file_info); int tran_file_read_track_deltas(int fd,uint16_t deltas[], int max_deltas, int *cyl, int *head); void tran_file_write_track_deltas(int fd,uint16_t *deltas, int num_words, int cyl, int head); void tran_file_close(int fd, int write_eof); float emu_rps(int sample_rate_hz); #endif /* EMU_TRAN_FILE_H_ */
dgesswein/mfm
mfm/inc/emu_tran_file.h
C
gpl-3.0
3,210
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="id"> <context> <name>AddGroup</name> <message> <source>add group</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AddPatternPiece</name> <message> <source>add pattern piece %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AddPiece</name> <message> <source>add detail</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AddToCalc</name> <message> <source>add object</source> <translation type="unfinished"></translation> </message> </context> <context> <name>CommunityPage</name> <message> <source>Server</source> <translation type="vanished">Server</translation> </message> <message> <source>Server name/IP</source> <translation type="vanished">Nama Server/IP</translation> </message> <message> <source>Secure connection</source> <translation type="vanished">Sambungan Aman</translation> </message> <message> <source>Proxy settings</source> <translation type="vanished">Setingan Proxy</translation> </message> <message> <source>Use Proxy</source> <translation type="vanished">Gunakan Proxy</translation> </message> <message> <source>Proxy address</source> <translation type="vanished">Alamat Proxy</translation> </message> <message> <source>Proxy port</source> <translation type="vanished">Saluran Proxy</translation> </message> <message> <source>Proxy user</source> <translation type="vanished">Pengguna Proxy</translation> </message> <message> <source>User settings</source> <translation type="vanished">Pengaturan Pengguna</translation> </message> <message> <source>User Name</source> <translation type="vanished">Nama Pengguna</translation> </message> <message> <source>Save password</source> <translation type="vanished">Simpan sandi</translation> </message> <message> <source>Password</source> <translation type="vanished">Sandi</translation> </message> </context> <context> <name>ConfigDialog</name> <message> <source>Apply</source> <translation type="vanished">Terapkan</translation> </message> <message> <source>&amp;Cancel</source> <translation type="vanished">&amp;Batalkan</translation> </message> <message> <source>&amp;Ok</source> <translation type="vanished">&amp;Ok</translation> </message> <message> <source>Config Dialog</source> <translation type="vanished">Dialog konfigurasi</translation> </message> <message> <source>Configuration</source> <translation type="vanished">Konfigurasi</translation> </message> <message> <source>Pattern</source> <translation type="vanished">Pola</translation> </message> <message> <source>Community</source> <translation type="vanished">Komunitas</translation> </message> </context> <context> <name>ConfigurationPage</name> <message> <source>Setup user interface language updated and will be used the next time start</source> <translation type="vanished">Pengaturan bahasa antarmuka pengguna diperbarui dan akan digunakan waktu mulai berikutnya</translation> </message> <message> <source>Default unit updated and will be used the next pattern creation</source> <translation type="vanished">Unit standar diperbarui dan akan digunakan pada pembuatan pola berikutnya</translation> </message> <message> <source>Save</source> <translation type="vanished">Simpan</translation> </message> <message> <source>Auto-save modified pattern</source> <translation type="vanished">Simpan otomatis Pola yang telah dimodifikasi</translation> </message> <message> <source>min</source> <translation type="vanished">minimal</translation> </message> <message> <source>Interval:</source> <translation type="vanished">Selang waktu:</translation> </message> <message> <source>Language</source> <translation type="vanished">Bahasa</translation> </message> <message> <source>GUI language</source> <translation type="vanished">Bahasa GUI</translation> </message> <message> <source>Decimal separator parts</source> <translation type="vanished">komponen pemisah desimal</translation> </message> <message> <source>With OS options (%1)</source> <translation type="vanished">dengan pilihan OS (%1)</translation> </message> <message> <source>Default unit</source> <translation type="vanished">Unit Standar</translation> </message> <message> <source>Centimeters</source> <translation type="vanished">Centimeter</translation> </message> <message> <source>Millimiters</source> <translation type="vanished">Milimeter</translation> </message> <message> <source>Inches</source> <translation type="vanished">Inchi</translation> </message> <message> <source>Label language</source> <translation type="vanished">label bahasa</translation> </message> <message> <source>Send crash reports</source> <translation type="vanished">Kirim laporan kerusakan</translation> </message> <message> <source>Send crash reports (recommended)</source> <translation type="vanished">Kirim laporan kerusakan (disarankan)</translation> </message> <message> <source>After each crash Seamly2D collect information that may help us fix a problem. We do not collect any personal information. Find more about what &lt;a href=&quot;https://wiki.seamly2d.com/wiki/Developer:Crash_Reports&quot;&gt;kind of information&lt;/a&gt; we collect.</source> <translation type="vanished">Setelah setiap kerusakan Seamly2D mengumpulkan informasi yang dapat membantu kami memperbaiki suatu masalah. Kami tidak mengumpulkan informasi pribadi apapun. Temukan lebih lanjut tentang apa &lt;a href=&quot;https://wiki.seamly2d.com/wiki/Developer:Crash_Reports&quot;&gt; jenis informasi &lt;/a&gt; kami kumpulkan.</translation> </message> </context> <context> <name>DelGroup</name> <message> <source>delete group</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DelTool</name> <message> <source>delete tool</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DeletePatternPiece</name> <message> <source>delete pattern piece %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DeletePiece</name> <message> <source>delete tool</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogAboutApp</name> <message> <source>About Seamly2D</source> <translation>Mengenai Seamly2D</translation> </message> <message> <source>Seamly2D version</source> <translation>Versi Seamly2D</translation> </message> <message> <source>Contributors</source> <translation>para kontributor</translation> </message> <message> <source>Built on %3 at %4</source> <translation type="vanished">Dibuat pada %3 at %4</translation> </message> <message> <source>Web site : %1</source> <translation>Situs web : %1</translation> </message> <message> <source>Cannot open your default browser</source> <translation>Tidak dapat membuka peramban bawaan Anda</translation> </message> <message> <source>Build revision:</source> <translation type="unfinished"></translation> </message> <message> <source>Built on %1 at %2</source> <translation type="unfinished">Dibuat pada %3 at %2 {1 ?}</translation> </message> <message> <source>Check For Updates</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogAboutTape</name> <message> <source>About SeamlyMe</source> <translation type="unfinished"></translation> </message> <message> <source>SeamlyMe version</source> <translation type="unfinished"></translation> </message> <message> <source>Build revision:</source> <translation type="unfinished"></translation> </message> <message> <source>This program is part of Seamly2D project.</source> <translation type="unfinished"></translation> </message> <message> <source>Build revision: %1</source> <translation type="unfinished"></translation> </message> <message> <source>Built on %3 at %4</source> <translation type="vanished">Dibuat pada %3 at %4</translation> </message> <message> <source>Web site : %1</source> <translation>Situs web : %1</translation> </message> <message> <source>Cannot open your default browser</source> <translation>Tidak dapat membuka peramban bawaan Anda</translation> </message> <message> <source>Built on %1 at %2</source> <translation type="unfinished">Dibuat pada %3 at %2 {1 ?}</translation> </message> <message> <source>Check For Updates</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogAlongLine</name> <message> <source>Length</source> <translation type="vanished">panjang</translation> </message> <message> <source>Value of length</source> <translation type="vanished">Nilai panjang</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan penuh perhitungan dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>First point</source> <translation type="vanished">Titik pertama</translation> </message> <message> <source>First point of line</source> <translation type="vanished">Titik pertama dari baris</translation> </message> <message> <source>Second point</source> <translation type="vanished">titik kedua</translation> </message> <message> <source>Second point of line</source> <translation type="vanished">titik kedua dari baris</translation> </message> <message> <source>Type of line</source> <translation type="vanished">Jenis baris</translation> </message> <message> <source>Show line from first point to this point</source> <translation type="vanished">Tampilkan garis dari titik pertama ke titik ini</translation> </message> <message> <source>Select second point of line</source> <translation>Pilih titik kedua dari garis</translation> </message> <message> <source>Point at distance along line</source> <translation type="unfinished"></translation> </message> <message> <source>Edit length</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>First point:</source> <translation type="unfinished"></translation> </message> <message> <source>First point of the line</source> <translation type="unfinished"></translation> </message> <message> <source>Second point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point of the line</source> <translation type="unfinished"></translation> </message> <message> <source>Type of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Line color:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogArc</name> <message> <source>Arc</source> <translation>busur</translation> </message> <message> <source>Radius</source> <translation type="vanished">Radius</translation> </message> <message> <source>Value of radius</source> <translation type="vanished">Nilai radius</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesa&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>First angle</source> <translation type="vanished">sudut pertama</translation> </message> <message> <source>Value of first angle</source> <translation type="vanished">nilai dari sudut pertama</translation> </message> <message> <source>Second angle</source> <translation type="vanished">sudut kedua</translation> </message> <message> <source>Value of second angle</source> <translation type="vanished">nilai dari sudut kedua</translation> </message> <message> <source>Center point</source> <translation type="vanished">titik tengah</translation> </message> <message> <source>Select point of center of arc</source> <translation type="vanished">pilih titik tengah dari busur</translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Radius can&apos;t be negative</source> <translation type="unfinished"></translation> </message> <message> <source>Angles equal</source> <translation type="unfinished"></translation> </message> <message> <source>Edit radius</source> <translation type="unfinished"></translation> </message> <message> <source>Edit first angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit second angle</source> <translation type="unfinished"></translation> </message> <message> <source>Radius:</source> <translation>Radius:</translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>First angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Second angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Center point:</source> <translation type="unfinished"></translation> </message> <message> <source>Select center point of the arc</source> <translation type="unfinished"></translation> </message> <message> <source>Color:</source> <translation type="unfinished"></translation> </message> <message> <source>Pen style:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogArcWithLength</name> <message> <source>Dialog</source> <translation type="unfinished"></translation> </message> <message> <source>Radius</source> <translation type="vanished">Radius</translation> </message> <message> <source>Value of radius</source> <translation type="vanished">Nilai radius</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>First angle</source> <translation type="vanished">sudut pertama</translation> </message> <message> <source>Value of first angle</source> <translation type="vanished">nilai dari sudut pertama</translation> </message> <message> <source>Length</source> <translation type="vanished">panjang</translation> </message> <message> <source>Center point</source> <translation type="vanished">titik tengah</translation> </message> <message> <source>Select point of center of arc</source> <translation type="vanished">pilih titik tengah dari busur</translation> </message> <message> <source>Edit radius</source> <translation type="unfinished"></translation> </message> <message> <source>Edit the first angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit the arc length</source> <translation type="unfinished"></translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Radius can&apos;t be negative</source> <translation type="unfinished"></translation> </message> <message> <source>Length can&apos;t be equal 0</source> <translation type="unfinished"></translation> </message> <message> <source>Radius:</source> <translation>Radius:</translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>First angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Center point:</source> <translation type="unfinished"></translation> </message> <message> <source>Color:</source> <translation type="unfinished"></translation> </message> <message> <source>Pen style:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogBisector</name> <message> <source>Length</source> <translation type="vanished">panjang</translation> </message> <message> <source>Value of length</source> <translation type="vanished">nilai panjang</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan penuh perhitungan dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>First point</source> <translation type="vanished">Titik pertama</translation> </message> <message> <source>First point of angle</source> <translation type="vanished">Titik pertama dari sudut</translation> </message> <message> <source>Second point</source> <translation type="vanished">titik kedua</translation> </message> <message> <source>Second point of angle</source> <translation type="vanished">titik kedua dari sudut</translation> </message> <message> <source>Third point</source> <translation type="vanished">titik ketiga</translation> </message> <message> <source>Third point of angle</source> <translation type="vanished">titik ketiga dari sudut</translation> </message> <message> <source>Type of line</source> <translation type="vanished">Jenis baris</translation> </message> <message> <source>Show line from second point to this point</source> <translation type="vanished">Tampilkan garis dari titik kedua ke titik ini</translation> </message> <message> <source>Select second point of angle</source> <translation>Pilih titik kedua dari sudut</translation> </message> <message> <source>Select third point of angle</source> <translation>Pilih titik ketiga dari garis</translation> </message> <message> <source>Point along bisector</source> <translation type="unfinished"></translation> </message> <message> <source>Edit length</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>First point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point:</source> <translation type="unfinished"></translation> </message> <message> <source>Third point:</source> <translation type="unfinished"></translation> </message> <message> <source>Type of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Line color:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogCubicBezier</name> <message> <source>Color:</source> <translation type="unfinished"></translation> </message> <message> <source>Name:</source> <translation type="unfinished"></translation> </message> <message> <source>First point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point:</source> <translation type="unfinished"></translation> </message> <message> <source>Third point:</source> <translation type="unfinished"></translation> </message> <message> <source>Fourth point:</source> <translation type="unfinished"></translation> </message> <message> <source>Select the second point of curve</source> <translation type="unfinished"></translation> </message> <message> <source>Select the third point of curve</source> <translation type="unfinished"></translation> </message> <message> <source>Select the fourth point of curve</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid spline</source> <translation type="unfinished"></translation> </message> <message> <source>Tool cubic bezier</source> <translation type="unfinished"></translation> </message> <message> <source>Pen Style:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogCubicBezierPath</name> <message> <source>Point:</source> <translation type="unfinished"></translation> </message> <message> <source>List of points</source> <translation type="unfinished"></translation> </message> <message> <source>Color:</source> <translation type="unfinished"></translation> </message> <message> <source>Name:</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid spline path</source> <translation type="unfinished"></translation> </message> <message> <source>Tool cubic bezier path</source> <translation type="unfinished"></translation> </message> <message> <source>Pen style:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogCurveIntersectAxis</name> <message> <source>Angle</source> <translation type="vanished">sudut</translation> </message> <message> <source>Value of angle</source> <translation type="vanished">nilai dari sudut</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan penuh perhitungan dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Axis point</source> <translation type="vanished">titik sumbu</translation> </message> <message> <source>Curve</source> <translation type="vanished">kurva</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Type of line</source> <translation type="vanished">Jenis baris</translation> </message> <message> <source>Show line from first point to this point</source> <translation type="vanished">Tampilkan garis dari titik pertama ke titik ini</translation> </message> <message> <source>Select axis point</source> <translation>pilih titik sumbu</translation> </message> <message> <source>Point intersect curve and axis</source> <translation type="unfinished"></translation> </message> <message> <source>Edit angle</source> <translation type="unfinished"></translation> </message> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Axis point:</source> <translation type="unfinished"></translation> </message> <message> <source>Curve:</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>Type of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Line color:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogCutArc</name> <message> <source>Length</source> <translation type="vanished">panjang</translation> </message> <message> <source>Value of length</source> <translation type="vanished">Nilai panjang</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Arc</source> <translation type="vanished">busur</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Segment an arc</source> <translation type="unfinished"></translation> </message> <message> <source>Edit length</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Arc:</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogCutSpline</name> <message> <source>Length</source> <translation type="vanished">panjang</translation> </message> <message> <source>Value of length</source> <translation type="vanished">Nilai panjang</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Curve</source> <translation type="vanished">kurva</translation> </message> <message> <source>Selected curve</source> <translation type="vanished">kurva yang telah dipilih</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Segmenting a simple curve</source> <translation type="unfinished"></translation> </message> <message> <source>Edit length</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Curve:</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogCutSplinePath</name> <message> <source>Length</source> <translation type="vanished">panjang</translation> </message> <message> <source>Value of length</source> <translation type="vanished">Nilai panjang</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Curve</source> <translation type="vanished">kurva</translation> </message> <message> <source>Selected curve path</source> <translation type="vanished">jalur kurva yang telah dipilih</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Segment a curved path</source> <translation type="unfinished"></translation> </message> <message> <source>Edit length</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Curve:</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogDateTimeFormats</name> <message> <source>Label date time editor</source> <translation type="unfinished"></translation> </message> <message> <source>Format:</source> <translation type="unfinished"></translation> </message> <message> <source>Insert a format</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;empty&gt;</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogDetail</name> <message> <source>Detail</source> <translation type="vanished">rincial</translation> </message> <message> <source>cm</source> <translation type="vanished">cm</translation> </message> <message> <source>Options</source> <translation type="vanished">pilihan</translation> </message> <message> <source>Name of detail</source> <translation type="vanished">nama rincian</translation> </message> <message> <source>Seam allowance</source> <translation type="vanished">kampuh</translation> </message> <message> <source>Width</source> <translation type="vanished">lebar</translation> </message> <message> <source>Closed</source> <translation type="vanished">tertutup</translation> </message> <message> <source>Delete</source> <translation type="vanished">hapus</translation> </message> </context> <context> <name>DialogEditLabel</name> <message> <source>Edit label template</source> <translation type="unfinished"></translation> </message> <message> <source>Clear current and begin new label</source> <translation type="unfinished"></translation> </message> <message> <source>Import from label template</source> <translation type="unfinished"></translation> </message> <message> <source>Export label as template</source> <translation type="unfinished"></translation> </message> <message> <source>Edit</source> <translation type="unfinished"></translation> </message> <message> <source>Bold</source> <comment>Font formatting</comment> <translation type="unfinished"></translation> </message> <message> <source>Italic</source> <comment>Font formatting</comment> <translation type="unfinished"></translation> </message> <message> <source>Aligns with the left edge</source> <translation type="unfinished"></translation> </message> <message> <source>Centers horizontally in the available space</source> <translation type="unfinished"></translation> </message> <message> <source>Aligns with the right edge</source> <translation type="unfinished"></translation> </message> <message> <source>Additional font size. Use to make a line bigger.</source> <translation type="unfinished"></translation> </message> <message> <source>Text:</source> <translation type="unfinished"></translation> </message> <message> <source>Line of text</source> <translation type="unfinished"></translation> </message> <message> <source>Insert placeholders</source> <translation type="unfinished"></translation> </message> <message> <source>Insert...</source> <translation type="unfinished"></translation> </message> <message> <source>Preview</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;empty&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Create new template</source> <translation type="unfinished"></translation> </message> <message> <source>Creating new template will overwrite the current, do you want to continue?</source> <translation type="unfinished"></translation> </message> <message> <source>Label template</source> <translation type="unfinished"></translation> </message> <message> <source>Export label template</source> <translation type="unfinished"></translation> </message> <message> <source>template</source> <translation type="unfinished"></translation> </message> <message> <source>Could not save file</source> <translation type="unfinished"></translation> </message> <message> <source>Import template</source> <translation type="unfinished"></translation> </message> <message> <source>Import template will overwrite the current, do you want to continue?</source> <translation type="unfinished"></translation> </message> <message> <source>File error.</source> <translation type="unfinished"></translation> </message> <message> <source>Date</source> <translation type="unfinished"></translation> </message> <message> <source>Time</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern name</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern number</source> <translation type="unfinished"></translation> </message> <message> <source>Company name or designer name</source> <translation type="unfinished"></translation> </message> <message> <source>Customer name</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern extension</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern file name</source> <translation type="unfinished"></translation> </message> <message> <source>Measurments file name</source> <translation type="unfinished"></translation> </message> <message> <source>Size</source> <translation type="unfinished"></translation> </message> <message> <source>Height</source> <translation type="unfinished"></translation> </message> <message> <source>Measurments extension</source> <translation type="unfinished"></translation> </message> <message> <source>Piece letter</source> <translation type="unfinished"></translation> </message> <message> <source>Piece annotation</source> <translation type="unfinished"></translation> </message> <message> <source>Piece orientation</source> <translation type="unfinished"></translation> </message> <message> <source>Piece rotation</source> <translation type="unfinished"></translation> </message> <message> <source>Piece tilt</source> <translation type="unfinished"></translation> </message> <message> <source>Piece fold position</source> <translation type="unfinished"></translation> </message> <message> <source>Piece name</source> <translation type="unfinished"></translation> </message> <message> <source>Quantity</source> <translation type="unfinished"></translation> </message> <message> <source>Material: Fabric</source> <translation type="unfinished"></translation> </message> <message> <source>Fabric</source> <translation type="unfinished"></translation> </message> <message> <source>Material: Lining</source> <translation type="unfinished"></translation> </message> <message> <source>Lining</source> <translation type="unfinished"></translation> </message> <message> <source>Material: Interfacing</source> <translation type="unfinished"></translation> </message> <message> <source>Interfacing</source> <translation type="unfinished"></translation> </message> <message> <source>Material: Interlining</source> <translation type="unfinished"></translation> </message> <message> <source>Interlining</source> <translation type="unfinished"></translation> </message> <message> <source>Word: Cut</source> <translation type="unfinished"></translation> </message> <message> <source>Cut</source> <translation type="unfinished"></translation> </message> <message> <source>Word: on fold</source> <translation type="unfinished"></translation> </message> <message> <source>on fold</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogEditWrongFormula</name> <message> <source>Edit formula</source> <translation>edit rumus</translation> </message> <message> <source>Formula</source> <translation type="vanished">rumus</translation> </message> <message> <source>Insert variable into formula</source> <translation>sisipkan variabel ke dalam rumus</translation> </message> <message> <source>Value of first angle</source> <translation type="vanished">nilai dari sudut pertama</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Input data</source> <translation>masukan data</translation> </message> <message> <source>Size and height</source> <translation type="vanished">ukuran dan panjang</translation> </message> <message> <source>Measurements</source> <translation>pengukuran</translation> </message> <message> <source>Increments</source> <translation>tambahan</translation> </message> <message> <source>Length of lines</source> <translation>panjang garis</translation> </message> <message> <source>Length of arcs</source> <translation type="vanished">panjang busur</translation> </message> <message> <source>Length of curves</source> <translation>Panjang kurva</translation> </message> <message> <source>Angle of lines</source> <translation>Sudut garis</translation> </message> <message> <source>Hide empty measurements</source> <translation>Sembunyikan pengukuran kosong</translation> </message> <message> <source>Line length</source> <translation type="unfinished"></translation> </message> <message> <source>Curve length</source> <translation type="unfinished"></translation> </message> <message> <source>Line Angle</source> <translation type="unfinished"></translation> </message> <message> <source>Radius of arcs</source> <translation type="unfinished"></translation> </message> <message> <source>Angles of curves</source> <translation type="unfinished"></translation> </message> <message> <source>Arc radius</source> <translation type="unfinished"></translation> </message> <message> <source>Curve angle</source> <translation type="unfinished"></translation> </message> <message> <source>Formula:</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Name</source> <translation type="unfinished">Nama</translation> </message> <message> <source>Full name</source> <translation type="unfinished"></translation> </message> <message> <source>Functions</source> <translation type="unfinished"></translation> </message> <message> <source>Lengths to control points</source> <translation type="unfinished"></translation> </message> <message> <source>Filter list by keyword</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogEllipticalArc</name> <message> <source>Radius1:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calulation</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Radius2:</source> <translation type="unfinished"></translation> </message> <message> <source>First angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Second angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Rotation angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Center point:</source> <translation type="unfinished"></translation> </message> <message> <source>Select center point of the arc</source> <translation type="unfinished"></translation> </message> <message> <source>Color:</source> <translation type="unfinished"></translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Radius can&apos;t be negative</source> <translation type="unfinished"></translation> </message> <message> <source>Angles equal</source> <translation type="unfinished"></translation> </message> <message> <source>Edit radius1</source> <translation type="unfinished"></translation> </message> <message> <source>Edit radius2</source> <translation type="unfinished"></translation> </message> <message> <source>Edit first angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit second angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit rotation angle</source> <translation type="unfinished"></translation> </message> <message> <source>Elliptical arc</source> <translation type="unfinished"></translation> </message> <message> <source>Pen style:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogEndLine</name> <message> <source>Length</source> <translation type="vanished">panjang</translation> </message> <message> <source>Value of length</source> <translation type="vanished">Nilai panjang</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Angle</source> <translation type="vanished">sudut</translation> </message> <message> <source>Value of angle</source> <translation type="vanished">nilai dari sudut</translation> </message> <message> <source>First point of line</source> <translation type="vanished">Titik pertama dari baris</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Type of line</source> <translation type="vanished">Jenis baris</translation> </message> <message> <source>Show line from first point to this point</source> <translation type="vanished">Tampilkan garis dari titik pertama ke titik ini</translation> </message> <message> <source>Point at distance and angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit length</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Base point:</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>Type of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Line color:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogExportToCSV</name> <message> <source>Export options</source> <translation type="unfinished"></translation> </message> <message> <source>Export</source> <translation type="unfinished"></translation> </message> <message> <source>With header</source> <translation type="unfinished"></translation> </message> <message> <source>Codec:</source> <translation type="unfinished"></translation> </message> <message> <source>Separator</source> <translation type="unfinished"></translation> </message> <message> <source>Tab</source> <translation type="unfinished"></translation> </message> <message> <source>Comma</source> <translation type="unfinished"></translation> </message> <message> <source>Semicolon</source> <translation type="unfinished"></translation> </message> <message> <source>Space</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogFlippingByAxis</name> <message> <source>Origin point:</source> <translation type="unfinished"></translation> </message> <message> <source>Suffix:</source> <translation type="unfinished"></translation> </message> <message> <source>Axis type:</source> <translation type="unfinished"></translation> </message> <message> <source>Select origin point</source> <translation type="unfinished"></translation> </message> <message> <source>Select origin point that is not part of the list of objects</source> <translation type="unfinished"></translation> </message> <message> <source>Vertical axis</source> <translation type="unfinished"></translation> </message> <message> <source>Horizontal axis</source> <translation type="unfinished"></translation> </message> <message> <source>Flipping by axis</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogFlippingByLine</name> <message> <source>First line point:</source> <translation type="unfinished"></translation> </message> <message> <source>Suffix:</source> <translation type="unfinished"></translation> </message> <message> <source>Second line point:</source> <translation type="unfinished"></translation> </message> <message> <source>Select first line point</source> <translation type="unfinished"></translation> </message> <message> <source>Select first line point that is not part of the list of objects</source> <translation type="unfinished"></translation> </message> <message> <source>Select second line point</source> <translation type="unfinished"></translation> </message> <message> <source>Select second line point that is not part of the list of objects</source> <translation type="unfinished"></translation> </message> <message> <source>Flipping by line</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogGroup</name> <message> <source>Group</source> <translation type="unfinished"></translation> </message> <message> <source>Group name:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique pattern piece name</source> <translation type="unfinished"></translation> </message> <message> <source>Choose group name</source> <translation type="unfinished"></translation> </message> <message> <source>New group</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogHeight</name> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>First point of line</source> <translation type="vanished">Titik pertama dari baris</translation> </message> <message> <source>Second point of line</source> <translation type="vanished">titik kedua dari baris</translation> </message> <message> <source>Type of line</source> <translation type="vanished">Jenis baris</translation> </message> <message> <source>Select first point of line</source> <translation type="unfinished"></translation> </message> <message> <source>Select second point of line</source> <translation>Pilih titik kedua dari garis</translation> </message> <message> <source>Perpendicular point along line</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>Base point:</source> <translation type="unfinished"></translation> </message> <message> <source>First point of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Type of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Line color:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogHistory</name> <message> <source>History</source> <translation type="unfinished"></translation> </message> <message> <source>Tool</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t create record.</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - Base point</source> <translation type="unfinished"></translation> </message> <message> <source>%1_%2 - Line from point %1 to point %2</source> <translation type="unfinished"></translation> </message> <message> <source>%3 - Point along line %1_%2</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - Point of shoulder</source> <translation type="unfinished"></translation> </message> <message> <source>%3 - normal to line %1_%2</source> <translation type="unfinished"></translation> </message> <message> <source>%4 - bisector of angle %1_%2_%3</source> <translation type="unfinished"></translation> </message> <message> <source>%5 - intersection of lines %1_%2 and %3_%4</source> <translation type="unfinished"></translation> </message> <message> <source>%4 - point of contact of arc with the center in point %1 and line %2_%3</source> <translation type="unfinished"></translation> </message> <message> <source>Point of perpendicular from point %1 to line %2_%3</source> <translation type="unfinished"></translation> </message> <message> <source>Triangle: axis %1_%2, points %3 and %4</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - point of intersection %2 and %3</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - point of intersection line %2_%3 and axis through point %4</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - point of intersection curve and axis through point %2</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - point of arcs intersection</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - point of circles intersection</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - point from circle and tangent</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - point from arc and tangent</source> <translation type="unfinished"></translation> </message> <message> <source>Correction the dart %1_%2_%3</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - point of curves intersection</source> <translation type="unfinished"></translation> </message> <message> <source>Curve</source> <translation type="unfinished">kurva</translation> </message> <message> <source>Cubic bezier curve</source> <translation type="unfinished"></translation> </message> <message> <source>Arc</source> <translation type="unfinished">busur</translation> </message> <message> <source>%1 with length %2</source> <translation type="unfinished"></translation> </message> <message> <source>Spline path</source> <translation type="unfinished"></translation> </message> <message> <source>Cubic bezier curve path</source> <translation type="unfinished"></translation> </message> <message> <source>%1 - cut %2</source> <translation type="unfinished"></translation> </message> <message> <source>arc</source> <translation type="unfinished"></translation> </message> <message> <source>curve</source> <translation type="unfinished"></translation> </message> <message> <source>curve path</source> <translation type="unfinished"></translation> </message> <message> <source>Elliptical arc</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogIncrements</name> <message> <source>Increments</source> <translation>tambahan</translation> </message> <message> <source>Name</source> <translation>Nama</translation> </message> <message> <source>The calculated value</source> <translation type="unfinished"></translation> </message> <message> <source>Lines</source> <translation type="unfinished"></translation> </message> <message> <source>Line</source> <translation type="unfinished"></translation> </message> <message> <source>Length</source> <translation>panjang</translation> </message> <message> <source>Curve</source> <translation>kurva</translation> </message> <message> <source>Arc</source> <translation>busur</translation> </message> <message> <source>Tables of Variables</source> <translation type="unfinished"></translation> </message> <message> <source>Lines angles</source> <translation type="unfinished"></translation> </message> <message> <source>Angle</source> <translation>sudut</translation> </message> <message> <source>Lengths curves</source> <translation type="unfinished"></translation> </message> <message> <source>Angles curves</source> <translation type="unfinished"></translation> </message> <message> <source>Radiuses arcs</source> <translation type="unfinished"></translation> </message> <message> <source>Radius</source> <translation>Radius</translation> </message> <message> <source>Formula</source> <translation>rumus</translation> </message> <message> <source>Details</source> <translation type="unfinished"></translation> </message> <message> <source>Move measurement up</source> <translation type="unfinished"></translation> </message> <message> <source>Move measurement down</source> <translation type="unfinished"></translation> </message> <message> <source>Name:</source> <translation type="unfinished"></translation> </message> <message> <source>Calculated value:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula:</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Description:</source> <translation type="unfinished"></translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Empty field.</source> <translation type="unfinished"></translation> </message> <message> <source>Empty field</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Parser error: %1</source> <translation type="unfinished"></translation> </message> <message> <source>Edit increment</source> <translation type="unfinished"></translation> </message> <message> <source>Unique increment name</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Find:</source> <translation type="unfinished"></translation> </message> <message> <source>Search</source> <translation type="unfinished"></translation> </message> <message> <source>Curves control point lengths</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid result. Value is infinite or NaN. Please, check your calculations.</source> <translation type="unfinished"></translation> </message> <message> <source>Refresh a pattern with all changes you made</source> <translation type="unfinished"></translation> </message> <message> <source>Refresh</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogInsertNode</name> <message> <source>Insert node</source> <translation type="unfinished"></translation> </message> <message> <source>Item:</source> <translation type="unfinished"></translation> </message> <message> <source>Piece:</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogLayoutProgress</name> <message> <source>Couldn&apos;t prepare data for creation layout</source> <translation type="unfinished"></translation> </message> <message> <source>Several workpieces left not arranged, but none of them match for paper</source> <translation type="unfinished"></translation> </message> <message> <source>Create a Layout</source> <translation type="unfinished"></translation> </message> <message> <source>Arranged workpieces: %1 from %2</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Finding best position for workpieces. Please, wait.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogLayoutSettings</name> <message> <source>Templates:</source> <translation type="unfinished"></translation> </message> <message> <source>Width:</source> <translation type="unfinished"></translation> </message> <message> <source>Height:</source> <translation type="unfinished"></translation> </message> <message> <source>Rotate workpiece</source> <translation type="unfinished"></translation> </message> <message> <source>Rotate by</source> <translation type="unfinished"></translation> </message> <message> <source>degree</source> <translation type="unfinished"></translation> </message> <message> <source>Three groups: big, middle, small</source> <translation type="unfinished"></translation> </message> <message> <source>Two groups: big, small</source> <translation type="unfinished"></translation> </message> <message> <source>Descending area</source> <translation type="unfinished"></translation> </message> <message> <source>Millimiters</source> <translation>Milimeter</translation> </message> <message> <source>Centimeters</source> <translation>Centimeter</translation> </message> <message> <source>Inches</source> <translation>Inchi</translation> </message> <message> <source>Pixels</source> <translation type="unfinished"></translation> </message> <message> <source>Create a layout</source> <translation type="unfinished"></translation> </message> <message> <source>Auto crop unused length</source> <translation type="unfinished"></translation> </message> <message> <source>Unite pages (if possible)</source> <translation type="unfinished"></translation> </message> <message> <source>Gap width:</source> <translation type="unfinished"></translation> </message> <message> <source>Save length of the sheet</source> <translation type="unfinished"></translation> </message> <message> <source>Letter</source> <translation type="unfinished"></translation> </message> <message> <source>Legal</source> <translation type="unfinished"></translation> </message> <message> <source>Roll 24in</source> <translation type="unfinished"></translation> </message> <message> <source>Roll 30in</source> <translation type="unfinished"></translation> </message> <message> <source>Roll 36in</source> <translation type="unfinished"></translation> </message> <message> <source>Roll 42in</source> <translation type="unfinished"></translation> </message> <message> <source>Roll 44in</source> <translation type="unfinished"></translation> </message> <message> <source>Paper format</source> <translation type="unfinished"></translation> </message> <message> <source>Left:</source> <translation type="unfinished"></translation> </message> <message> <source>Right:</source> <translation type="unfinished"></translation> </message> <message> <source>Top:</source> <translation type="unfinished"></translation> </message> <message> <source>Bottom:</source> <translation type="unfinished"></translation> </message> <message> <source>Custom</source> <translation type="unfinished"></translation> </message> <message> <source>Wrong fields.</source> <translation type="unfinished"></translation> </message> <message> <source>Fields go beyond printing. Apply settings anyway?</source> <translation type="unfinished"></translation> </message> <message> <source> Three groups: big, middle, small = 0; Two groups: big, small = 1; Descending area = 2</source> <translation type="unfinished"></translation> </message> <message> <source>Layout options</source> <translation type="unfinished"></translation> </message> <message> <source>Shift/Offset length:</source> <translation type="unfinished"></translation> </message> <message> <source>Rule for choosing the next workpiece</source> <translation type="unfinished"></translation> </message> <message> <source>Divide into strips</source> <translation type="unfinished"></translation> </message> <message> <source>Multiplier</source> <translation type="unfinished"></translation> </message> <message> <source>Set multiplier for length of the biggest workpiece in layout.</source> <translation type="unfinished"></translation> </message> <message> <source>Enabling for sheets that have big height will speed up creating.</source> <translation type="unfinished"></translation> </message> <message> <source>Printer:</source> <translation type="unfinished"></translation> </message> <message> <source>None</source> <comment>Printer</comment> <translation type="unfinished"></translation> </message> <message> <source>Text</source> <translation type="unfinished"></translation> </message> <message> <source>Text will be converted to paths</source> <translation type="unfinished"></translation> </message> <message> <source>Export text as paths</source> <translation type="unfinished"></translation> </message> <message> <source>Margins</source> <translation type="unfinished"></translation> </message> <message> <source>Ignore margins</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogLine</name> <message> <source>First point</source> <translation type="vanished">Titik pertama</translation> </message> <message> <source>Second point</source> <translation type="vanished">titik kedua</translation> </message> <message> <source>Type of line</source> <translation type="vanished">Jenis baris</translation> </message> <message> <source>Show line from first point to this point</source> <translation type="vanished">Tampilkan garis dari titik pertama ke titik ini</translation> </message> <message> <source>Select second point</source> <translation type="unfinished"></translation> </message> <message> <source>Line between points</source> <translation type="unfinished"></translation> </message> <message> <source>First point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point:</source> <translation type="unfinished"></translation> </message> <message> <source>Type of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Line color:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogLineIntersect</name> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>First line</source> <translation type="unfinished"></translation> </message> <message> <source>First point</source> <translation type="vanished">Titik pertama</translation> </message> <message> <source>Second point</source> <translation type="vanished">titik kedua</translation> </message> <message> <source>Second line</source> <translation type="unfinished"></translation> </message> <message> <source>Select second point of first line</source> <translation type="unfinished"></translation> </message> <message> <source>Select first point of second line</source> <translation type="unfinished"></translation> </message> <message> <source>Select second point of second line</source> <translation type="unfinished"></translation> </message> <message> <source>Point at line intersection</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>First point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogLineIntersectAxis</name> <message> <source>Angle</source> <translation type="vanished">sudut</translation> </message> <message> <source>Value of angle</source> <translation type="vanished">nilai dari sudut</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Axis point</source> <translation type="vanished">titik sumbu</translation> </message> <message> <source>First point of line</source> <translation>Titik pertama dari baris</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Type of line</source> <translation type="vanished">Jenis baris</translation> </message> <message> <source>Show line from first point to this point</source> <translation>Tampilkan garis dari titik pertama ke titik ini</translation> </message> <message> <source>Select second point of line</source> <translation>Pilih titik kedua dari garis</translation> </message> <message> <source>Select axis point</source> <translation>pilih titik sumbu</translation> </message> <message> <source>Point intersect line and axis</source> <translation type="unfinished"></translation> </message> <message> <source>Axis Point</source> <translation type="unfinished"></translation> </message> <message> <source>Second point of line</source> <translation>titik kedua dari baris</translation> </message> <message> <source>Edit angle</source> <translation type="unfinished"></translation> </message> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Axis point:</source> <translation type="unfinished"></translation> </message> <message> <source>First line point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second line point:</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>Type of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Line color:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogMDataBase</name> <message> <source>Measurement data base</source> <translation type="unfinished"></translation> </message> <message> <source>Measurements</source> <translation>pengukuran</translation> </message> <message> <source>Direct Height</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Direct Width</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Indentation</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Circumference and Arc</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Vertical</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Horizontal</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Bust</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Balance</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Arm</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Leg</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Crotch and Rise</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Hand</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Foot</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Head</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Men &amp; Tailoring</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Historical &amp; Specialty</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Patternmaking measurements</source> <comment>Measurement section</comment> <translation type="unfinished"></translation> </message> <message> <source>Collapse All</source> <translation type="unfinished"></translation> </message> <message> <source>Expand All</source> <translation type="unfinished"></translation> </message> <message> <source>Check all</source> <translation type="unfinished"></translation> </message> <message> <source>Uncheck all</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogMove</name> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Suffix:</source> <translation type="unfinished"></translation> </message> <message> <source>Edit angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit length</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Move</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogNewMeasurements</name> <message> <source>New measurement file</source> <translation type="unfinished"></translation> </message> <message> <source>Measurement type:</source> <translation type="unfinished"></translation> </message> <message> <source>Unit:</source> <translation type="unfinished"></translation> </message> <message> <source>Base size:</source> <translation type="unfinished"></translation> </message> <message> <source>Base height:</source> <translation type="unfinished"></translation> </message> <message> <source>Individual</source> <translation type="unfinished"></translation> </message> <message> <source>Centimeters</source> <translation>Centimeter</translation> </message> <message> <source>Millimiters</source> <translation>Milimeter</translation> </message> <message> <source>Inches</source> <translation>Inchi</translation> </message> <message> <source>Multisize</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogNewPattern</name> <message> <source>Pattern piece name</source> <translation type="vanished">Nama potongan pola</translation> </message> <message> <source>Units:</source> <translation type="unfinished"></translation> </message> <message> <source>Centimeters</source> <translation>Centimeter</translation> </message> <message> <source>Millimiters</source> <translation>Milimeter</translation> </message> <message> <source>Inches</source> <translation>Inchi</translation> </message> <message> <source>Pattern piece name:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique pattern piece name</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique pattern piece name.</source> <translation type="unfinished"></translation> </message> <message> <source>New pattern</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogNormal</name> <message> <source>Length</source> <translation type="vanished">panjang</translation> </message> <message> <source>Value of length</source> <translation type="vanished">Nilai panjang</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>First point</source> <translation type="vanished">Titik pertama</translation> </message> <message> <source>Second point</source> <translation type="vanished">titik kedua</translation> </message> <message> <source>Type of line</source> <translation type="vanished">Jenis baris</translation> </message> <message> <source>Show line from first point to this point</source> <translation type="vanished">Tampilkan garis dari titik pertama ke titik ini</translation> </message> <message> <source>Select second point of line</source> <translation>Pilih titik kedua dari garis</translation> </message> <message> <source>Point along perpendicular</source> <translation type="unfinished"></translation> </message> <message> <source>First point of line</source> <translation type="vanished">Titik pertama dari baris</translation> </message> <message> <source>Second point of line</source> <translation type="vanished">titik kedua dari baris</translation> </message> <message> <source>Edit length</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>First point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point:</source> <translation type="unfinished"></translation> </message> <message> <source>Additional angle degrees:</source> <translation type="unfinished"></translation> </message> <message> <source>Type of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Line color:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPatternProperties</name> <message> <source>Pattern properties</source> <translation type="unfinished"></translation> </message> <message> <source>Author name</source> <translation type="vanished">Nama Pembuat</translation> </message> <message> <source>Pattern description</source> <translation>Keterangan Pola</translation> </message> <message> <source>For technical notes.</source> <translation type="vanished">Untuk catatan teknis.</translation> </message> <message> <source>Heights and Sizes</source> <translation type="unfinished"></translation> </message> <message> <source>All heights (cm)</source> <translation type="unfinished"></translation> </message> <message> <source>All sizes (cm)</source> <translation type="unfinished"></translation> </message> <message> <source>Default height and size</source> <translation type="unfinished"></translation> </message> <message> <source>Custom</source> <translation type="unfinished"></translation> </message> <message> <source>Height:</source> <translation type="unfinished"></translation> </message> <message> <source>Size:</source> <translation type="unfinished"></translation> </message> <message> <source>Security</source> <translation type="unfinished"></translation> </message> <message> <source>Open only for read</source> <translation type="unfinished"></translation> </message> <message> <source>Call context menu for edit</source> <translation type="unfinished"></translation> </message> <message> <source>No image</source> <translation type="unfinished"></translation> </message> <message> <source>Delete image</source> <translation type="unfinished"></translation> </message> <message> <source>Change image</source> <translation type="unfinished"></translation> </message> <message> <source>Save image to file</source> <translation type="unfinished"></translation> </message> <message> <source>Show image</source> <translation type="unfinished"></translation> </message> <message> <source>Image for pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Images</source> <translation type="unfinished"></translation> </message> <message> <source>Save File</source> <translation type="unfinished"></translation> </message> <message> <source>untitled</source> <translation type="unfinished"></translation> </message> <message> <source>Path:</source> <translation type="unfinished"></translation> </message> <message> <source>Show in Explorer</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;Empty&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>File was not saved yet.</source> <translation type="unfinished"></translation> </message> <message> <source>Show in Finder</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern name:</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern number:</source> <translation type="unfinished"></translation> </message> <message> <source>Company/Designer name:</source> <translation type="unfinished"></translation> </message> <message> <source>Customer name:</source> <translation type="unfinished"></translation> </message> <message> <source>From multisize measurements</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern</source> <translation type="unfinished">Pola</translation> </message> <message> <source>For technical notes</source> <translation type="unfinished"></translation> </message> <message> <source>Label data</source> <translation type="unfinished"></translation> </message> <message> <source>Label template:</source> <translation type="unfinished"></translation> </message> <message> <source>Edit pattern label</source> <translation type="unfinished"></translation> </message> <message> <source>Edit template</source> <translation type="unfinished"></translation> </message> <message> <source>Date format:</source> <translation type="unfinished"></translation> </message> <message> <source>Time format:</source> <translation type="unfinished"></translation> </message> <message> <source>Save label data.</source> <translation type="unfinished"></translation> </message> <message> <source>Label data were changed. Do you want to save them before editing label template?</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPiecePath</name> <message> <source>Piece path tool</source> <translation type="unfinished"></translation> </message> <message> <source>Path</source> <translation type="unfinished"></translation> </message> <message> <source>Name:</source> <translation type="unfinished"></translation> </message> <message> <source>Unnamed path</source> <translation type="unfinished"></translation> </message> <message> <source>Create name for your path</source> <translation type="unfinished"></translation> </message> <message> <source>Type:</source> <translation type="unfinished"></translation> </message> <message> <source>Piece:</source> <translation type="unfinished"></translation> </message> <message> <source>Type of pen:</source> <translation type="unfinished"></translation> </message> <message> <source>Ready!</source> <translation type="unfinished"></translation> </message> <message> <source>Seam allowance</source> <translation type="unfinished">kampuh</translation> </message> <message> <source>Width:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Nodes</source> <translation type="unfinished"></translation> </message> <message> <source>Node:</source> <translation type="unfinished"></translation> </message> <message> <source>Before:</source> <translation type="unfinished"></translation> </message> <message> <source>Return to default width</source> <translation type="unfinished"></translation> </message> <message> <source>Default</source> <translation type="unfinished"></translation> </message> <message> <source>After:</source> <translation type="unfinished"></translation> </message> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Select main path objects, &lt;b&gt;Shift&lt;/b&gt; - reverse direction curve, &lt;b&gt;Enter&lt;/b&gt; - finish creation</source> <translation type="unfinished"></translation> </message> <message> <source>Reverse</source> <translation type="unfinished"></translation> </message> <message> <source>Delete</source> <translation type="unfinished">hapus</translation> </message> <message> <source>Current seam aloowance</source> <translation type="unfinished"></translation> </message> <message> <source>Edit seam allowance width</source> <translation type="unfinished"></translation> </message> <message> <source>Edit seam allowance width before</source> <translation type="unfinished"></translation> </message> <message> <source>Edit seam allowance width after</source> <translation type="unfinished"></translation> </message> <message> <source>Internal path</source> <translation type="unfinished"></translation> </message> <message> <source>Custom seam allowance</source> <translation type="unfinished"></translation> </message> <message> <source>You need more points!</source> <translation type="unfinished"></translation> </message> <message> <source>First point of &lt;b&gt;custom seam allowance&lt;/b&gt; cannot be equal to the last point!</source> <translation type="unfinished"></translation> </message> <message> <source>You have double points!</source> <translation type="unfinished"></translation> </message> <message> <source>Notches</source> <translation type="unfinished"></translation> </message> <message> <source>Notch:</source> <translation type="unfinished"></translation> </message> <message> <source>One line</source> <translation type="unfinished"></translation> </message> <message> <source>Two lines</source> <translation type="unfinished"></translation> </message> <message> <source>Three lines</source> <translation type="unfinished"></translation> </message> <message> <source>Angle</source> <translation type="unfinished">sudut</translation> </message> <message> <source>Straightforward</source> <translation type="unfinished"></translation> </message> <message> <source>Bisector</source> <translation type="unfinished"></translation> </message> <message> <source>Notch</source> <translation type="unfinished"></translation> </message> <message> <source>Marks</source> <translation type="unfinished"></translation> </message> <message> <source>T mark</source> <translation type="unfinished"></translation> </message> <message> <source>V mark</source> <translation type="unfinished"></translation> </message> <message> <source>Please, select a detail to insert into!</source> <translation type="unfinished"></translation> </message> <message> <source>List of details is empty!</source> <translation type="unfinished"></translation> </message> <message> <source>Select if need designate the corner point as a passmark</source> <translation type="unfinished"></translation> </message> <message> <source>Intersection</source> <translation type="unfinished"></translation> </message> <message> <source>Each point in the &lt;b&gt;custom seam allowance&lt;/b&gt; path must be unique!</source> <translation type="unfinished"></translation> </message> <message> <source>The path is a cut contour</source> <translation type="unfinished"></translation> </message> <message> <source>Cut on fabric</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPin</name> <message> <source>Pin tool</source> <translation type="unfinished"></translation> </message> <message> <source>Point:</source> <translation type="unfinished"></translation> </message> <message> <source>Piece:</source> <translation type="unfinished"></translation> </message> <message> <source>Pin</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPointFromArcAndTangent</name> <message> <source>Point from arc and tangent</source> <translation type="unfinished"></translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Arc</source> <translation type="vanished">busur</translation> </message> <message> <source>Select point of center of arc</source> <translation type="vanished">pilih titik tengah dari busur</translation> </message> <message> <source>Select an arc</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>Tangent point:</source> <translation type="unfinished"></translation> </message> <message> <source>Arc:</source> <translation type="unfinished"></translation> </message> <message> <source>Take:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPointFromCircleAndTangent</name> <message> <source>Point from circle and tangent</source> <translation type="unfinished"></translation> </message> <message> <source>Radius</source> <translation type="vanished">Radius</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Select point of center of arc</source> <translation type="vanished">pilih titik tengah dari busur</translation> </message> <message> <source>Select a circle center</source> <translation type="unfinished"></translation> </message> <message> <source>Edit radius</source> <translation type="unfinished"></translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Radius can&apos;t be negative</source> <translation type="unfinished"></translation> </message> <message> <source>Radius:</source> <translation>Radius:</translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>Center of the circle:</source> <translation type="unfinished"></translation> </message> <message> <source>Tangent point:</source> <translation type="unfinished"></translation> </message> <message> <source>Take:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPointOfContact</name> <message> <source>Radius</source> <translation type="vanished">Radius</translation> </message> <message> <source>Value of radius</source> <translation type="vanished">Nilai radius</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Select point of center of arc</source> <translation>pilih titik tengah dari busur</translation> </message> <message> <source>Select second point of line</source> <translation>Pilih titik kedua dari garis</translation> </message> <message> <source>Point at intersection of arc and line</source> <translation type="unfinished"></translation> </message> <message> <source>Edit radius</source> <translation type="unfinished"></translation> </message> <message> <source>Radius:</source> <translation>Radius:</translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>Center of arc:</source> <translation type="unfinished"></translation> </message> <message> <source>Top of the line:</source> <translation type="unfinished"></translation> </message> <message> <source>End of the line:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPointOfIntersection</name> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>First point of angle</source> <translation type="vanished">Titik pertama dari sudut</translation> </message> <message> <source>Second point of angle</source> <translation type="vanished">titik kedua dari sudut</translation> </message> <message> <source>Point from X and Y of two other points</source> <translation type="unfinished"></translation> </message> <message> <source>Select point for Y value (horizontal)</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>X: vertical point:</source> <translation type="unfinished"></translation> </message> <message> <source>Y: horizontal point:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPointOfIntersectionArcs</name> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Select second an arc</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>First arc:</source> <translation type="unfinished"></translation> </message> <message> <source>Second arc:</source> <translation type="unfinished"></translation> </message> <message> <source>Take:</source> <translation type="unfinished"></translation> </message> <message> <source>Tool point of intersetion arcs</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPointOfIntersectionCircles</name> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Select point of center of arc</source> <translation type="vanished">pilih titik tengah dari busur</translation> </message> <message> <source>Select second circle center</source> <translation type="unfinished"></translation> </message> <message> <source>Edit first circle radius</source> <translation type="unfinished"></translation> </message> <message> <source>Edit second circle radius</source> <translation type="unfinished"></translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Radius can&apos;t be negative</source> <translation type="unfinished"></translation> </message> <message> <source>Radius of the first circle:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Radius of the second circle:</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>Center of the first circle:</source> <translation type="unfinished"></translation> </message> <message> <source>Center of the second circle:</source> <translation type="unfinished"></translation> </message> <message> <source>Take:</source> <translation type="unfinished"></translation> </message> <message> <source>Tool point of intersection circles</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPointOfIntersectionCurves</name> <message> <source>Tool point of intersection curves</source> <translation type="unfinished"></translation> </message> <message> <source>First curve:</source> <translation type="unfinished"></translation> </message> <message> <source>Second curve:</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>Vertical correction:</source> <translation type="unfinished"></translation> </message> <message> <source>Horizontal correction:</source> <translation type="unfinished"></translation> </message> <message> <source>Select second curve</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogPreferences</name> <message> <source>Preferences</source> <translation type="unfinished"></translation> </message> <message> <source>Configuration</source> <translation type="unfinished">Konfigurasi</translation> </message> <message> <source>Pattern</source> <translation type="unfinished">Pola</translation> </message> <message> <source>Paths</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogRotation</name> <message> <source>Rotation</source> <translation type="unfinished"></translation> </message> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Origin Point:</source> <translation type="unfinished"></translation> </message> <message> <source>Suffix:</source> <translation type="unfinished"></translation> </message> <message> <source>Edit angle</source> <translation type="unfinished"></translation> </message> <message> <source>Select origin point</source> <translation type="unfinished"></translation> </message> <message> <source>Select origin point that is not part of the list of objects</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogSaveLAyout</name> <message> <source>Save Layout</source> <translation type="unfinished"></translation> </message> <message> <source>File name:</source> <translation type="unfinished"></translation> </message> <message> <source>Path:</source> <translation type="unfinished"></translation> </message> <message> <source>File format:</source> <translation type="unfinished"></translation> </message> <message> <source>Browse...</source> <translation type="unfinished"></translation> </message> <message> <source>Destination folder</source> <translation type="unfinished"></translation> </message> <message> <source>Select path to destination folder</source> <translation type="unfinished"></translation> </message> <message> <source>File base name</source> <translation type="unfinished"></translation> </message> <message> <source>Path to destination folder</source> <translation type="unfinished"></translation> </message> <message> <source>Binary form</source> <translation type="unfinished"></translation> </message> <message> <source>Text as paths</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogSaveLayout</name> <message> <source>Name conflict</source> <translation type="unfinished"></translation> </message> <message> <source>Folder already contain file with name %1. Rewrite all conflict file names?</source> <translation type="unfinished"></translation> </message> <message> <source>Example:</source> <translation type="unfinished"></translation> </message> <message> <source>Select folder</source> <translation type="unfinished"></translation> </message> <message> <source>Tried to use out of range format number.</source> <translation type="unfinished"></translation> </message> <message> <source>Selected not present format.</source> <translation type="unfinished"></translation> </message> <message> <source>The destination directory doesn&apos;t exists or is not readable.</source> <translation type="unfinished"></translation> </message> <message> <source>The base filename does not match a regular expression.</source> <translation type="unfinished"></translation> </message> <message> <source>files</source> <translation type="unfinished"></translation> </message> <message> <source>(flat) files</source> <translation type="unfinished"></translation> </message> <message> <source>Image files</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogSeamAllowance</name> <message> <source>Ready!</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Grainline</source> <translation type="unfinished"></translation> </message> <message> <source>Select main path objects clockwise, &lt;b&gt;Shift&lt;/b&gt; - reverse direction curve, &lt;b&gt;Enter&lt;/b&gt; - finish creation</source> <translation type="unfinished"></translation> </message> <message> <source>Reverse</source> <translation type="unfinished"></translation> </message> <message> <source>Delete</source> <translation type="unfinished">hapus</translation> </message> <message> <source>Options</source> <translation type="unfinished">pilihan</translation> </message> <message> <source>Error. Can&apos;t save piece path.</source> <translation type="unfinished"></translation> </message> <message> <source>Infinite/undefined result</source> <translation type="unfinished"></translation> </message> <message> <source>Length should be positive</source> <translation type="unfinished"></translation> </message> <message> <source>Parser error: %1</source> <translation type="unfinished"></translation> </message> <message> <source>Current seam allowance</source> <translation type="unfinished"></translation> </message> <message> <source>Edit seam allowance width</source> <translation type="unfinished"></translation> </message> <message> <source>Edit seam allowance width before</source> <translation type="unfinished"></translation> </message> <message> <source>Edit seam allowance width after</source> <translation type="unfinished"></translation> </message> <message> <source>You need more points!</source> <translation type="unfinished"></translation> </message> <message> <source>You have to choose points in a clockwise direction!</source> <translation type="unfinished"></translation> </message> <message> <source>First point cannot be equal to the last point!</source> <translation type="unfinished"></translation> </message> <message> <source>You have double points!</source> <translation type="unfinished"></translation> </message> <message> <source>Empty</source> <translation type="unfinished"></translation> </message> <message> <source>main path</source> <translation type="unfinished"></translation> </message> <message> <source>custom seam allowance</source> <translation type="unfinished"></translation> </message> <message> <source>Both</source> <translation type="unfinished"></translation> </message> <message> <source>Just front</source> <translation type="unfinished"></translation> </message> <message> <source>Just rear</source> <translation type="unfinished"></translation> </message> <message> <source>Pins</source> <translation type="unfinished"></translation> </message> <message> <source>no pin</source> <translation type="unfinished"></translation> </message> <message> <source>Labels</source> <translation type="unfinished"></translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Edit length</source> <translation type="unfinished"></translation> </message> <message> <source>Edit angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit height</source> <translation type="unfinished"></translation> </message> <message> <source>Edit width</source> <translation type="unfinished"></translation> </message> <message> <source>Paths</source> <translation type="unfinished"></translation> </message> <message> <source>Excluded</source> <translation type="unfinished"></translation> </message> <message> <source>Notch</source> <translation type="unfinished"></translation> </message> <message> <source>Each point in the path must be unique!</source> <translation type="unfinished"></translation> </message> <message> <source>Notches</source> <translation type="unfinished"></translation> </message> <message> <source>To open all detail&apos;s features complete creating the main path.</source> <translation type="unfinished"></translation> </message> <message> <source>Workpiece tool</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogShoulderPoint</name> <message> <source>Length</source> <translation type="vanished">panjang</translation> </message> <message> <source>Value of length</source> <translation type="vanished">Nilai panjang</translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>First point</source> <translation type="vanished">Titik pertama</translation> </message> <message> <source>Second point</source> <translation type="vanished">titik kedua</translation> </message> <message> <source>Third point</source> <translation type="vanished">titik ketiga</translation> </message> <message> <source>Type of line</source> <translation type="vanished">Jenis baris</translation> </message> <message> <source>Select first point of line</source> <translation type="unfinished"></translation> </message> <message> <source>Select second point of line</source> <translation>Pilih titik kedua dari garis</translation> </message> <message> <source>Special point on shoulder</source> <translation type="unfinished"></translation> </message> <message> <source>Edit length</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>First point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point:</source> <translation type="unfinished"></translation> </message> <message> <source>Third point:</source> <translation type="unfinished"></translation> </message> <message> <source>Type of line:</source> <translation type="unfinished"></translation> </message> <message> <source>Line color:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogSinglePoint</name> <message> <source>Single point</source> <translation type="unfinished"></translation> </message> <message> <source>Coordinates on the sheet</source> <translation type="unfinished"></translation> </message> <message> <source>Coordinates</source> <translation type="unfinished"></translation> </message> <message> <source>Y coordinate</source> <translation type="unfinished"></translation> </message> <message> <source>X coordinate</source> <translation type="unfinished"></translation> </message> <message> <source>Point label</source> <translation>label titik</translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogSpline</name> <message> <source>First point</source> <translation type="vanished">Titik pertama</translation> </message> <message> <source>Second point</source> <translation type="vanished">titik kedua</translation> </message> <message> <source>Select last point of curve</source> <translation type="unfinished"></translation> </message> <message> <source>Simple curve</source> <translation type="unfinished"></translation> </message> <message> <source>Color:</source> <translation type="unfinished"></translation> </message> <message> <source>First point:</source> <translation type="unfinished"></translation> </message> <message> <source>Control point</source> <translation type="unfinished"></translation> </message> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point:</source> <translation type="unfinished"></translation> </message> <message> <source>Name:</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid spline</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Edit first control point angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit second control point angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit first control point length</source> <translation type="unfinished"></translation> </message> <message> <source>Edit second control point length</source> <translation type="unfinished"></translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Length can&apos;t be negative</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Pen style:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogSplinePath</name> <message> <source>Curved path</source> <translation type="unfinished"></translation> </message> <message> <source>List of points</source> <translation type="unfinished"></translation> </message> <message> <source>Select point of curve path</source> <translation type="unfinished"></translation> </message> <message> <source>Color:</source> <translation type="unfinished"></translation> </message> <message> <source>Point:</source> <translation type="unfinished"></translation> </message> <message> <source>First control point</source> <translation type="unfinished"></translation> </message> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Second control point</source> <translation type="unfinished"></translation> </message> <message> <source>Name:</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid spline path</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Edit first control point angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit second control point angle</source> <translation type="unfinished"></translation> </message> <message> <source>Edit first control point length</source> <translation type="unfinished"></translation> </message> <message> <source>Edit second control point length</source> <translation type="unfinished"></translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Length can&apos;t be negative</source> <translation type="unfinished"></translation> </message> <message> <source>Not used</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>Pen style:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogTapePreferences</name> <message> <source>Preferences</source> <translation type="unfinished"></translation> </message> <message> <source>Configuration</source> <translation type="unfinished">Konfigurasi</translation> </message> <message> <source>Paths</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogTool</name> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Empty field</source> <translation type="unfinished"></translation> </message> <message> <source>Value can&apos;t be 0</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Parser error: %1</source> <translation type="unfinished"></translation> </message> <message> <source>First point</source> <translation>Titik pertama</translation> </message> <message> <source>Second point</source> <translation>titik kedua</translation> </message> <message> <source>Highest point</source> <translation type="unfinished"></translation> </message> <message> <source>Lowest point</source> <translation type="unfinished"></translation> </message> <message> <source>Leftmost point</source> <translation type="unfinished"></translation> </message> <message> <source>Rightmost point</source> <translation type="unfinished"></translation> </message> <message> <source>by length</source> <translation type="unfinished"></translation> </message> <message> <source>by points intersetions</source> <translation type="unfinished"></translation> </message> <message> <source>by first edge symmetry</source> <translation type="unfinished"></translation> </message> <message> <source>by second edge symmetry</source> <translation type="unfinished"></translation> </message> <message> <source>by first edge right angle</source> <translation type="unfinished"></translation> </message> <message> <source>by second edge right angle</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid result. Value is infinite or NaN. Please, check your calculations.</source> <translation type="unfinished"></translation> </message> <message> <source>Value can&apos;t be less than 0</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogTriangle</name> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>First point of line</source> <translation type="vanished">Titik pertama dari baris</translation> </message> <message> <source>First point</source> <translation type="vanished">Titik pertama</translation> </message> <message> <source>Second point</source> <translation type="vanished">titik kedua</translation> </message> <message> <source>Select second point of axis</source> <translation type="unfinished"></translation> </message> <message> <source>Select first point</source> <translation type="unfinished"></translation> </message> <message> <source>Select second point</source> <translation type="unfinished"></translation> </message> <message> <source>Triangle tool</source> <translation type="unfinished"></translation> </message> <message> <source>Second point of line</source> <translation type="vanished">titik kedua dari baris</translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>First point of axis:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point of axis:</source> <translation type="unfinished"></translation> </message> <message> <source>First point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogTrueDarts</name> <message> <source>True darts</source> <translation type="unfinished"></translation> </message> <message> <source>First point of angle</source> <translation type="vanished">Titik pertama dari sudut</translation> </message> <message> <source>Second point of angle</source> <translation type="vanished">titik kedua dari sudut</translation> </message> <message> <source>Third point of angle</source> <translation type="vanished">titik ketiga dari sudut</translation> </message> <message> <source>Show line from second point to this point</source> <translation type="vanished">Tampilkan garis dari titik kedua ke titik ini</translation> </message> <message> <source>Select the second base point</source> <translation type="unfinished"></translation> </message> <message> <source>Select the first dart point</source> <translation type="unfinished"></translation> </message> <message> <source>Select the second dart point</source> <translation type="unfinished"></translation> </message> <message> <source>Select the third dart point</source> <translation type="unfinished"></translation> </message> <message> <source>First base point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second base point:</source> <translation type="unfinished"></translation> </message> <message> <source>First dart point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second dart point:</source> <translation type="unfinished"></translation> </message> <message> <source>Third dart point:</source> <translation type="unfinished"></translation> </message> <message> <source>First new dart point:</source> <translation type="unfinished"></translation> </message> <message> <source>Unique label</source> <translation type="unfinished"></translation> </message> <message> <source>Choose unique label.</source> <translation type="unfinished"></translation> </message> <message> <source>Second new dart point:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogUndo</name> <message> <source>Broken formula</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Undo</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Fix formula</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Cancel</source> <translation>&amp;Batalkan</translation> </message> <message> <source>Error while calculation formula. You can try to undo last operation or fix broken formula.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DialogUnionDetails</name> <message> <source>Union tool</source> <translation type="unfinished"></translation> </message> <message> <source>Select a first point</source> <translation type="unfinished"></translation> </message> <message> <source>Workpiece should have at least two points and three objects</source> <translation type="unfinished"></translation> </message> <message> <source>Select a second point</source> <translation type="unfinished"></translation> </message> <message> <source>Select a unique point</source> <translation type="unfinished"></translation> </message> <message> <source>Select a detail</source> <translation type="unfinished"></translation> </message> <message> <source>Select a point on edge</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Do you really want to unite details?&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Retain original pieces</source> <translation type="unfinished"></translation> </message> </context> <context> <name>FvUpdateWindow</name> <message> <source>Software Update</source> <translation type="unfinished"></translation> </message> <message> <source>A new version of %1 is available!</source> <translation type="unfinished"></translation> </message> <message> <source>%1 %2 is now available - you have %3. Would you like to download it now?</source> <translation type="unfinished"></translation> </message> <message> <source>Skip This Version</source> <translation type="unfinished"></translation> </message> <message> <source>Remind Me Later</source> <translation type="unfinished"></translation> </message> <message> <source>Get Update</source> <translation type="unfinished"></translation> </message> </context> <context> <name>FvUpdater</name> <message> <source>Cannot open your default browser.</source> <translation type="unfinished"></translation> </message> <message> <source>Feed download failed: %1.</source> <translation type="unfinished"></translation> </message> <message> <source>Feed parsing failed: %1 %2.</source> <translation type="unfinished"></translation> </message> <message> <source>No updates were found.</source> <translation type="unfinished"></translation> </message> <message> <source>Feed error: invalid &quot;enclosure&quot; with the download link</source> <translation type="unfinished"></translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Information</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InternalStrings</name> <message> <source>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MApplication</name> <message> <source>Error parsing file. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Error bad id. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Error can&apos;t convert value. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Error empty parameter. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Error wrong id. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Something&apos;s wrong!!</source> <translation type="unfinished"></translation> </message> <message> <source>Parser error: %1. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Exception thrown: %1. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Seamly2D&apos;s measurements editor.</source> <translation type="unfinished"></translation> </message> <message> <source>The measurement file.</source> <translation type="unfinished"></translation> </message> <message> <source>The base height</source> <translation type="unfinished"></translation> </message> <message> <source>The base size</source> <translation type="unfinished"></translation> </message> <message> <source>Set pattern file unit: cm, mm, inch.</source> <translation type="unfinished"></translation> </message> <message> <source>The pattern unit</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid base size argument. Must be cm, mm or inch.</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t begin to listen for incoming connections on name &apos;%1&apos;</source> <translation type="unfinished"></translation> </message> <message> <source>Test mode doesn&apos;t support Opening several files.</source> <translation type="unfinished"></translation> </message> <message> <source>Please, provide one input file.</source> <translation type="unfinished"></translation> </message> <message> <source>Open with the base size. Valid values: %1cm.</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid base height argument. Must be %1cm.</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid base size argument. Must be %1cm.</source> <translation type="unfinished"></translation> </message> <message> <source>Open with the base height. Valid values: %1cm.</source> <translation type="unfinished"></translation> </message> <message> <source>Use for unit testing. Run the program and open a file without showing the main window.</source> <translation type="unfinished"></translation> </message> <message> <source>Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). Alternatively you can use the %1 environment variable.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MainWindow</name> <message> <source>Seamly2D</source> <translation type="unfinished"></translation> </message> <message> <source>Tools for creating points.</source> <translation type="unfinished"></translation> </message> <message> <source>Point</source> <translation type="unfinished"></translation> </message> <message> <source>Point along perpendicular</source> <translation type="unfinished"></translation> </message> <message> <source>Perpendicular point along line</source> <translation type="unfinished"></translation> </message> <message> <source>Point along bisector</source> <translation type="unfinished"></translation> </message> <message> <source>Point at distance and angle</source> <translation type="unfinished"></translation> </message> <message> <source>Point at distance along line</source> <translation type="unfinished"></translation> </message> <message> <source>Tools for creating lines.</source> <translation type="unfinished"></translation> </message> <message> <source>Line</source> <translation type="unfinished"></translation> </message> <message> <source>Line between points</source> <translation type="unfinished"></translation> </message> <message> <source>Point at line intersection</source> <translation type="unfinished"></translation> </message> <message> <source>Tools for creating curves.</source> <translation type="unfinished"></translation> </message> <message> <source>Curve</source> <translation>kurva</translation> </message> <message> <source>Tools for creating arcs.</source> <translation type="unfinished"></translation> </message> <message> <source>Arc</source> <translation>busur</translation> </message> <message> <source>Tools for creating details.</source> <translation type="unfinished"></translation> </message> <message> <source>Detail</source> <translation>rincial</translation> </message> <message> <source>&amp;File</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Help</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Pattern piece</source> <translation type="unfinished"></translation> </message> <message> <source>Measurements</source> <translation>pengukuran</translation> </message> <message> <source>Window</source> <translation type="unfinished"></translation> </message> <message> <source>Toolbar files</source> <translation type="unfinished"></translation> </message> <message> <source>ToolBar modes</source> <translation type="unfinished"></translation> </message> <message> <source>Toolbar pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Toolbar options</source> <translation type="unfinished"></translation> </message> <message> <source>Toolbar tools</source> <translation type="unfinished"></translation> </message> <message> <source>Tool options</source> <translation type="unfinished"></translation> </message> <message> <source>New</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;New</source> <translation type="unfinished"></translation> </message> <message> <source>Create a new pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Open</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Open</source> <translation type="unfinished"></translation> </message> <message> <source>Open file with pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Save</source> <translation>Simpan</translation> </message> <message> <source>&amp;Save</source> <translation type="unfinished"></translation> </message> <message> <source>Save pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Save &amp;As...</source> <translation type="unfinished"></translation> </message> <message> <source>Save not yet saved pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Draw</source> <translation type="unfinished"></translation> </message> <message> <source>Details</source> <translation type="unfinished"></translation> </message> <message> <source>Pointer tools</source> <translation type="unfinished"></translation> </message> <message> <source>New pattern piece</source> <translation type="unfinished"></translation> </message> <message> <source>Add new pattern piece</source> <translation type="unfinished"></translation> </message> <message> <source>Change the label of pattern piece</source> <translation type="unfinished"></translation> </message> <message> <source>History</source> <translation type="unfinished"></translation> </message> <message> <source>About &amp;Qt</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;About Seamly2D</source> <translation type="unfinished"></translation> </message> <message> <source>E&amp;xit</source> <translation type="unfinished"></translation> </message> <message> <source>Exit the application</source> <translation type="unfinished"></translation> </message> <message> <source>Preferences</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern properties</source> <translation type="unfinished"></translation> </message> <message> <source>Zoom in</source> <translation type="unfinished"></translation> </message> <message> <source>zoom in</source> <translation type="unfinished"></translation> </message> <message> <source>Zoom out</source> <translation type="unfinished"></translation> </message> <message> <source>Zoom fit best</source> <translation type="unfinished"></translation> </message> <message> <source>Report bug</source> <translation type="unfinished"></translation> </message> <message> <source>Show online help</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern piece %1</source> <translation type="unfinished"></translation> </message> <message> <source>Select point</source> <translation type="unfinished"></translation> </message> <message> <source>Select first point</source> <translation type="unfinished"></translation> </message> <message> <source>Select first point of line</source> <translation type="unfinished"></translation> </message> <message> <source>Select first point of angle</source> <translation type="unfinished"></translation> </message> <message> <source>Select first point of first line</source> <translation type="unfinished"></translation> </message> <message> <source>Select first point curve</source> <translation type="unfinished"></translation> </message> <message> <source>Select simple curve</source> <translation type="unfinished"></translation> </message> <message> <source>Select point of center of arc</source> <translation>pilih titik tengah dari busur</translation> </message> <message> <source>Select point of curve path</source> <translation type="unfinished"></translation> </message> <message> <source>Select curve path</source> <translation type="unfinished"></translation> </message> <message> <source>Select base point</source> <translation type="unfinished"></translation> </message> <message> <source>Select first point of axis</source> <translation type="unfinished"></translation> </message> <message> <source>Select detail</source> <translation type="unfinished"></translation> </message> <message> <source>Select arc</source> <translation type="unfinished"></translation> </message> <message> <source>Select curve</source> <translation type="unfinished"></translation> </message> <message> <source>About Qt</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern files (*.val)</source> <translation type="unfinished"></translation> </message> <message> <source>pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Save as</source> <translation type="unfinished"></translation> </message> <message> <source>Could not save file</source> <translation type="unfinished"></translation> </message> <message> <source>Open file</source> <translation>Buka File</translation> </message> <message> <source>Error parsing file.</source> <translation type="unfinished"></translation> </message> <message> <source>Error can&apos;t convert value.</source> <translation type="unfinished"></translation> </message> <message> <source>Error empty parameter.</source> <translation type="unfinished"></translation> </message> <message> <source>Error wrong id.</source> <translation type="unfinished"></translation> </message> <message> <source>Error parsing file (std::bad_alloc).</source> <translation type="unfinished"></translation> </message> <message> <source>Bad id.</source> <translation type="unfinished"></translation> </message> <message> <source>File saved</source> <translation>File telah disimpan</translation> </message> <message> <source>untitled.val</source> <translation>tanpajudul.val</translation> </message> <message> <source>The pattern has been modified. Do you want to save your changes?</source> <translation>Pola telah dimodiikasi Apakah anda ingin menyimpan perubahan anda?</translation> </message> <message> <source>&amp;Undo</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Redo</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern piece:</source> <translation type="unfinished"></translation> </message> <message> <source>Enter a new label for the pattern piece.</source> <translation type="unfinished"></translation> </message> <message> <source>This file already opened in another window.</source> <translation type="unfinished"></translation> </message> <message> <source>Wrong units.</source> <translation type="unfinished"></translation> </message> <message> <source>File error.</source> <translation type="unfinished"></translation> </message> <message> <source>File loaded</source> <translation type="unfinished"></translation> </message> <message> <source>Seamly2D didn&apos;t shut down correctly. Do you want reopen files (%1) you had open?</source> <translation type="unfinished"></translation> </message> <message> <source>Reopen files.</source> <translation type="unfinished"></translation> </message> <message> <source>Special point on shoulder</source> <translation type="unfinished"></translation> </message> <message> <source>Triangle tool</source> <translation type="unfinished"></translation> </message> <message> <source>Point at intersection of arc and line</source> <translation type="unfinished"></translation> </message> <message> <source>Point from X and Y of two other points</source> <translation type="unfinished"></translation> </message> <message> <source>Point intersect line and axis</source> <translation type="unfinished"></translation> </message> <message> <source>Simple curve</source> <translation type="unfinished"></translation> </message> <message> <source>Curved path</source> <translation type="unfinished"></translation> </message> <message> <source>Segmenting a simple curve</source> <translation type="unfinished"></translation> </message> <message> <source>Segment a curved path</source> <translation type="unfinished"></translation> </message> <message> <source>Point intersect curve and axis</source> <translation type="unfinished"></translation> </message> <message> <source>Segment an arc</source> <translation type="unfinished"></translation> </message> <message> <source>Point intersect arc and axis</source> <translation type="unfinished"></translation> </message> <message> <source>Union tool</source> <translation type="unfinished"></translation> </message> <message> <source>Last Tool</source> <translation type="unfinished"></translation> </message> <message> <source>Activate last used tool again</source> <translation type="unfinished"></translation> </message> <message> <source>Select point for X value (vertical)</source> <translation type="unfinished"></translation> </message> <message> <source>Mode</source> <translation type="unfinished"></translation> </message> <message> <source>Pointer</source> <translation type="unfinished"></translation> </message> <message> <source>Config pattern piece</source> <translation type="unfinished"></translation> </message> <message> <source>Layout</source> <translation type="unfinished"></translation> </message> <message> <source>Show Curve Details</source> <translation type="unfinished"></translation> </message> <message> <source>Show/hide control points and curve direction</source> <translation type="unfinished"></translation> </message> <message> <source>Point of intersection arcs</source> <translation type="unfinished"></translation> </message> <message> <source>Point of intersection circles</source> <translation type="unfinished"></translation> </message> <message> <source>Point from circle and tangent</source> <translation type="unfinished"></translation> </message> <message> <source>Point from arc and tangent</source> <translation type="unfinished"></translation> </message> <message> <source>Arc with given length</source> <translation type="unfinished"></translation> </message> <message> <source>Settings</source> <translation type="unfinished"></translation> </message> <message> <source>Layout pages</source> <translation type="unfinished"></translation> </message> <message> <source>Print</source> <translation type="unfinished"></translation> </message> <message> <source>Print tiled PDF</source> <translation type="unfinished"></translation> </message> <message> <source>Split and print a layout into smaller pages (for regular printers)</source> <translation type="unfinished"></translation> </message> <message> <source>Print preview</source> <translation type="unfinished"></translation> </message> <message> <source>Print preview original layout</source> <translation type="unfinished"></translation> </message> <message> <source>Export As...</source> <translation type="unfinished"></translation> </message> <message> <source>Export original layout</source> <translation type="unfinished"></translation> </message> <message> <source>Select first an arc</source> <translation type="unfinished"></translation> </message> <message> <source>Select point of the center of the arc</source> <translation type="unfinished"></translation> </message> <message> <source>Select the first base line point</source> <translation type="unfinished"></translation> </message> <message> <source>Detail mode</source> <translation type="unfinished"></translation> </message> <message> <source>Layout mode</source> <translation type="unfinished"></translation> </message> <message> <source>Unsaved changes</source> <translation type="unfinished"></translation> </message> <message> <source>Measurements loaded</source> <translation type="unfinished"></translation> </message> <message> <source>You can&apos;t export empty scene.</source> <translation type="unfinished"></translation> </message> <message> <source>Create new Layout</source> <translation type="unfinished"></translation> </message> <message> <source>Failed to lock. This file already opened in another window.</source> <translation type="unfinished"></translation> </message> <message> <source>Failed to lock. This file already opened in another window. Expect collissions when run 2 copies of the program.</source> <translation type="unfinished"></translation> </message> <message> <source>Measurement file contains invalid known measurement(s).</source> <translation type="unfinished"></translation> </message> <message> <source>Measurement file has unknown format.</source> <translation type="unfinished"></translation> </message> <message> <source>Measurement file doesn&apos;t include all required measurements.</source> <translation type="unfinished"></translation> </message> <message> <source>Measurement files types have not match.</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t sync measurements.</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t update measurements.</source> <translation type="unfinished"></translation> </message> <message> <source>The measurements file &apos;%1&apos; could not be found.</source> <translation type="unfinished"></translation> </message> <message> <source>Loading measurements file</source> <translation type="unfinished"></translation> </message> <message> <source>Not supported size value &apos;%1&apos; for this pattern file.</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t set size. File wasn&apos;t opened.</source> <translation type="unfinished"></translation> </message> <message> <source>The method %1 does nothing in GUI mode</source> <translation type="unfinished"></translation> </message> <message> <source>Not supported height value &apos;%1&apos; for this pattern file.</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t set height. File wasn&apos;t opened.</source> <translation type="unfinished"></translation> </message> <message> <source>Export error.</source> <translation type="unfinished"></translation> </message> <message> <source>Please, provide one input file.</source> <translation type="unfinished"></translation> </message> <message> <source>Print an original layout</source> <translation type="unfinished"></translation> </message> <message> <source>Preview tiled PDF</source> <translation type="unfinished"></translation> </message> <message> <source>Print preview tiled layout</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Mode for working with pattern pieces. These pattern pieces are base for going to the next stage &amp;quot;Details mode&amp;quot;. Before you will be able to enable the &amp;quot;Details mode&amp;quot; need create at least one detail.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Mode for working with details. Before you will be able to enable the &amp;quot;Details mode&amp;quot; need create at least one detail on the stage &amp;quot;Draw mode&amp;quot;. Details created on this stage will be used for creating a layout. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Mode for creating a layout of details. This mode avaliable if was created at least one detail on the stage &amp;quot;Details mode&amp;quot;. The layout can be exported to your preferred file format and saved to your harddirve.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Measurements unloaded</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t unload measurements. Some of them are used in the pattern.</source> <translation type="unfinished"></translation> </message> <message> <source>True darts</source> <translation type="unfinished"></translation> </message> <message> <source>New pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Open pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Create/Edit measurements</source> <translation type="unfinished"></translation> </message> <message> <source>Save...</source> <translation type="unfinished"></translation> </message> <message> <source>Don&apos;t Save</source> <translation type="unfinished"></translation> </message> <message> <source>Locking file</source> <translation type="unfinished"></translation> </message> <message> <source>This file already opened in another window. Ignore if you want to continue (not recommended, can cause a data corruption).</source> <translation type="unfinished"></translation> </message> <message> <source>The lock file could not be created, for lack of permissions. Ignore if you want to continue (not recommended, can cause a data corruption).</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown error happened, for instance a full partition prevented writing out the lock file. Ignore if you want to continue (not recommended, can cause a data corruption).</source> <translation type="unfinished"></translation> </message> <message> <source>The lock file could not be created, for lack of permissions.</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown error happened, for instance a full partition prevented writing out the lock file.</source> <translation type="unfinished"></translation> </message> <message> <source>Report Bug...</source> <translation type="unfinished"></translation> </message> <message> <source>Point intersection curves</source> <translation type="unfinished"></translation> </message> <message> <source>Select first curve</source> <translation type="unfinished"></translation> </message> <message> <source>Curve tool which uses point as control handle</source> <translation type="unfinished"></translation> </message> <message> <source>Select first curve point</source> <translation type="unfinished"></translation> </message> <message> <source>Select point of cubic bezier path</source> <translation type="unfinished"></translation> </message> <message> <source>Operations</source> <translation type="unfinished"></translation> </message> <message> <source>Create new group</source> <translation type="unfinished"></translation> </message> <message> <source>Rotate objects</source> <translation type="unfinished"></translation> </message> <message> <source>Close pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Tool pointer</source> <translation type="unfinished"></translation> </message> <message> <source>Midpoint between two points</source> <translation type="unfinished"></translation> </message> <message> <source>Group</source> <translation type="unfinished"></translation> </message> <message> <source>Contains all visibility groups</source> <translation type="unfinished"></translation> </message> <message> <source>Show which details will go in layout</source> <translation type="unfinished"></translation> </message> <message> <source>Original zoom</source> <translation type="unfinished"></translation> </message> <message> <source>Select first circle center</source> <translation type="unfinished"></translation> </message> <message> <source>Select point on tangent</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern Piece:</source> <translation type="unfinished"></translation> </message> <message> <source>Height:</source> <translation type="unfinished"></translation> </message> <message> <source>Size:</source> <translation type="unfinished"></translation> </message> <message> <source>The measurements file &lt;br/&gt;&lt;br/&gt; &lt;b&gt;%1&lt;/b&gt; &lt;br/&gt;&lt;br/&gt; could not be found. Do you want to update the file location?</source> <translation type="unfinished"></translation> </message> <message> <source>Flipping objects by line</source> <translation type="unfinished"></translation> </message> <message> <source>Flipping objects by axis</source> <translation type="unfinished"></translation> </message> <message> <source>Move objects</source> <translation type="unfinished"></translation> </message> <message> <source>Measurements were changed. Do you want to sync measurements now?</source> <translation type="unfinished"></translation> </message> <message> <source>Gradation doesn&apos;t support inches</source> <translation type="unfinished"></translation> </message> <message> <source>Measurements have been synced</source> <translation type="unfinished"></translation> </message> <message> <source>Tools for creating elliptical arcs.</source> <translation type="unfinished"></translation> </message> <message> <source>Elliptical Arc</source> <translation type="unfinished"></translation> </message> <message> <source>Select point of center of elliptical arc</source> <translation type="unfinished"></translation> </message> <message> <source>Select main path objects clockwise.</source> <translation type="unfinished"></translation> </message> <message> <source>Select path objects, &lt;b&gt;Shift&lt;/b&gt; - reverse direction curve</source> <translation type="unfinished"></translation> </message> <message> <source>The document has no write permissions.</source> <translation type="unfinished"></translation> </message> <message> <source>Cannot set permissions for %1 to writable.</source> <translation type="unfinished"></translation> </message> <message> <source>Could not save the file.</source> <translation type="unfinished"></translation> </message> <message> <source>Could not save the file</source> <translation type="unfinished"></translation> </message> <message> <source>read only</source> <translation type="unfinished"></translation> </message> <message> <source>Variables Table</source> <translation type="unfinished"></translation> </message> <message> <source>Contains information about increments and internal variables</source> <translation type="unfinished"></translation> </message> <message> <source>Load Individual</source> <translation type="unfinished"></translation> </message> <message> <source>Load Individual measurements file</source> <translation type="unfinished"></translation> </message> <message> <source>Load Multisize</source> <translation type="unfinished"></translation> </message> <message> <source>Load multisize measurements file</source> <translation type="unfinished"></translation> </message> <message> <source>Open SeamlyMe</source> <translation type="unfinished"></translation> </message> <message> <source>Edit Current</source> <translation type="unfinished"></translation> </message> <message> <source>Edit linked to the pattern measurements</source> <translation type="unfinished"></translation> </message> <message> <source>Sync</source> <translation type="unfinished"></translation> </message> <message> <source>Synchronize linked to the pattern measurements after change</source> <translation type="unfinished"></translation> </message> <message> <source>Unload Current</source> <translation type="unfinished"></translation> </message> <message> <source>Unload measurements if they were not used in a pattern file</source> <translation type="unfinished"></translation> </message> <message> <source>Individual measurements</source> <translation type="unfinished"></translation> </message> <message> <source>Multisize measurements</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern files</source> <translation type="unfinished"></translation> </message> <message> <source>Pin tool</source> <translation type="unfinished"></translation> </message> <message> <source>Select pin point</source> <translation type="unfinished"></translation> </message> <message> <source>Insert node tool</source> <translation type="unfinished"></translation> </message> <message> <source>Select an item to insert</source> <translation type="unfinished"></translation> </message> <message> <source>Wiki</source> <translation type="unfinished"></translation> </message> <message> <source>Forum</source> <translation type="unfinished"></translation> </message> <message> <source>Select one or more objects, hold &lt;b&gt;%1&lt;/b&gt; - for multiple selection, &lt;b&gt;Enter&lt;/b&gt; - finish creation</source> <translation type="unfinished"></translation> </message> <message> <source>Select one or more objects, hold &lt;b&gt;%1&lt;/b&gt; - for multiple selection, &lt;b&gt;Enter&lt;/b&gt; - confirm selection</source> <translation type="unfinished"></translation> </message> <message> <source>Open SeamlyMe app for creating or editing measurements file</source> <translation type="unfinished"></translation> </message> <message> <source>Export increments to CSV</source> <translation type="unfinished"></translation> </message> <message> <source>Name</source> <translation type="unfinished">Nama</translation> </message> <message> <source>The calculated value</source> <translation type="unfinished"></translation> </message> <message> <source>Formula</source> <translation type="unfinished">rumus</translation> </message> <message> <source>You can&apos;t use Detail mode yet. Please, create at least one workpiece.</source> <translation type="unfinished"></translation> </message> <message> <source>You can&apos;t use Layout mode yet. Please, create at least one workpiece.</source> <translation type="unfinished"></translation> </message> <message> <source>You can&apos;t use Layout mode yet. Please, include at least one detail in layout.</source> <translation type="unfinished"></translation> </message> <message> <source>You can&apos;t use Layout mode yet.</source> <translation type="unfinished"></translation> </message> <message> <source>Zoom fit best current</source> <translation type="unfinished"></translation> </message> <message> <source>zoom fit best current pattern piece</source> <translation type="unfinished"></translation> </message> <message> <source>Export details skiping the Layout stage</source> <translation type="unfinished"></translation> </message> <message> <source>Application doesn&apos;t support multisize table with inches.</source> <translation type="unfinished"></translation> </message> <message> <source>You don&apos;t have enough details to export. Please, include at least one detail in layout.</source> <translation type="unfinished"></translation> </message> <message> <source>Export details</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t export details.</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t set size. Need a file with multisize measurements.</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t set height. Need a file with multisize measurements.</source> <translation type="unfinished"></translation> </message> <message> <source>Please, additionally provide: %1</source> <translation type="unfinished"></translation> </message> <message> <source>Label template editor</source> <translation type="unfinished"></translation> </message> <message> <source>Workpiece tool</source> <translation type="unfinished"></translation> </message> <message> <source>Internal path tool</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MainWindowsNoGUI</name> <message> <source>Creating file &apos;%1&apos; failed! %2</source> <translation type="unfinished"></translation> </message> <message> <source>Critical error!</source> <translation type="unfinished"></translation> </message> <message> <source>Print error</source> <translation type="unfinished"></translation> </message> <message> <source>Cannot proceed because there are no available printers in your system.</source> <translation type="unfinished"></translation> </message> <message> <source>unnamed</source> <translation type="unfinished"></translation> </message> <message> <source>The layout is stale.</source> <translation type="unfinished"></translation> </message> <message> <source>The layout was not updated since last pattern modification. Do you want to continue?</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t prepare data for creation layout</source> <translation type="unfinished"></translation> </message> <message> <source>Several workpieces left not arranged, but none of them match for paper</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t open printer %1</source> <translation type="unfinished"></translation> </message> <message> <source>For previewing multipage document all sheet should have the same size.</source> <translation type="unfinished"></translation> </message> <message> <source>For printing multipages document all sheet should have the same size.</source> <translation type="unfinished"></translation> </message> <message> <source>Pages will be cropped because they do not fit printer paper size.</source> <translation type="unfinished"></translation> </message> <message> <source>Cannot set printer margins</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t create a path</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern</source> <translation type="unfinished">Pola</translation> </message> </context> <context> <name>MoveDoubleLabel</name> <message> <source>move the first dart label</source> <translation type="unfinished"></translation> </message> <message> <source>move the second dart label</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MoveLabel</name> <message> <source>move point label</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MoveSPoint</name> <message> <source>move single point</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MoveSpline</name> <message> <source>move spline</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MoveSplinePath</name> <message> <source>move spline path</source> <translation type="unfinished"></translation> </message> </context> <context> <name>OperationMoveLabel</name> <message> <source>move point label</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PreferencesConfigurationPage</name> <message> <source>Save</source> <translation type="unfinished">Simpan</translation> </message> <message> <source>Auto-save modified pattern</source> <translation type="unfinished">Simpan otomatis Pola yang telah dimodifikasi</translation> </message> <message> <source>Interval:</source> <translation type="unfinished">Selang waktu:</translation> </message> <message> <source>min</source> <translation type="unfinished">minimal</translation> </message> <message> <source>Language</source> <translation type="unfinished">Bahasa</translation> </message> <message> <source>GUI language:</source> <translation type="unfinished"></translation> </message> <message> <source>Decimal separator parts:</source> <translation type="unfinished"></translation> </message> <message> <source>Default unit:</source> <translation type="unfinished"></translation> </message> <message> <source>Label language:</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern making system</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern making system:</source> <translation type="unfinished"></translation> </message> <message> <source>Author:</source> <translation type="unfinished"></translation> </message> <message> <source>Book:</source> <translation type="unfinished"></translation> </message> <message> <source>Send crash reports</source> <translation type="unfinished">Kirim laporan kerusakan</translation> </message> <message> <source>Send crash reports (recommended)</source> <translation type="unfinished">Kirim laporan kerusakan (disarankan)</translation> </message> <message> <source>Pattern editing</source> <translation type="unfinished"></translation> </message> <message> <source>Reset warnings</source> <translation type="unfinished"></translation> </message> <message> <source>Toolbar</source> <translation type="unfinished"></translation> </message> <message> <source>The text appears under the icon (recommended for beginners).</source> <translation type="unfinished"></translation> </message> <message> <source>With OS options</source> <translation type="unfinished"></translation> </message> <message> <source>After each crash Seamly2D collects information that may help us fix the problem. We do not collect any personal information. Find more about what %1kind of information%2 we collect.</source> <translation type="unfinished"></translation> </message> <message> <source>The Default unit has been updated and will be used as the default for the next pattern you create.</source> <translation type="unfinished"></translation> </message> <message> <source>Centimeters</source> <translation type="unfinished">Centimeter</translation> </message> <message> <source>Millimiters</source> <translation type="unfinished">Milimeter</translation> </message> <message> <source>Inches</source> <translation type="unfinished">Inchi</translation> </message> </context> <context> <name>PreferencesPathPage</name> <message> <source>Paths that Seamly2D uses</source> <translation type="unfinished"></translation> </message> <message> <source>Type</source> <translation type="unfinished"></translation> </message> <message> <source>Path</source> <translation type="unfinished"></translation> </message> <message> <source>Default</source> <translation type="unfinished"></translation> </message> <message> <source>Edit</source> <translation type="unfinished"></translation> </message> <message> <source>Open Directory</source> <translation type="unfinished"></translation> </message> <message> <source>My Individual Measurements</source> <translation type="unfinished"></translation> </message> <message> <source>My Multisize Measurements</source> <translation type="unfinished"></translation> </message> <message> <source>My Patterns</source> <translation type="unfinished"></translation> </message> <message> <source>My Layouts</source> <translation type="unfinished"></translation> </message> <message> <source>My Templates</source> <translation type="unfinished"></translation> </message> <message> <source>My label templates</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PreferencesPatternPage</name> <message> <source>Graphical output</source> <translation type="unfinished"></translation> </message> <message> <source>Use antialiasing</source> <translation type="unfinished"></translation> </message> <message> <source>Undo</source> <translation type="unfinished"></translation> </message> <message> <source>Count steps (0 - no limit):</source> <translation type="unfinished"></translation> </message> <message> <source>Workpiece</source> <translation type="unfinished"></translation> </message> <message> <source>Forbid flipping</source> <translation type="unfinished"></translation> </message> <message> <source>Show a passmark both in the seam allowance and on the seam line.</source> <translation type="unfinished"></translation> </message> <message> <source>Show second passmark on seam line</source> <translation type="unfinished"></translation> </message> <message> <source>By default forbid flipping for all new created workpieces</source> <translation type="unfinished"></translation> </message> <message> <source>By default hide the main path if the seam allowance was enabled</source> <translation type="unfinished"></translation> </message> <message> <source>Hide main path</source> <translation type="unfinished"></translation> </message> <message> <source>Label font:</source> <translation type="unfinished"></translation> </message> <message> <source>Seam allowance</source> <translation type="unfinished">kampuh</translation> </message> <message> <source>Default value:</source> <translation type="unfinished"></translation> </message> <message> <source>Label data/time format</source> <translation type="unfinished"></translation> </message> <message> <source>Date:</source> <translation type="unfinished"></translation> </message> <message> <source>Edit formats</source> <translation type="unfinished"></translation> </message> <message> <source>Time:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>QCoreApplication</name> <message> <source>Based on Qt %1 (%2, %3 bit)</source> <translation type="unfinished"></translation> </message> </context> <context> <name>QObject</name> <message> <source>Create new pattern piece to start working.</source> <translation type="unfinished"></translation> </message> <message> <source>mm</source> <translation type="unfinished"></translation> </message> <message> <source>cm</source> <translation>cm</translation> </message> <message> <source>inch</source> <translation type="unfinished"></translation> </message> <message> <source>Property</source> <extracomment>The text that appears in the first column header</extracomment> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <extracomment>The text that appears in the second column header</extracomment> <translation type="unfinished"></translation> </message> <message> <source>px</source> <translation type="unfinished"></translation> </message> <message> <source>add node</source> <translation type="unfinished"></translation> </message> <message> <source>move detail</source> <translation type="unfinished"></translation> </message> <message> <source>Changes applied.</source> <translation type="unfinished"></translation> </message> <message> <source>Wrong tag name &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t convert toUInt parameter</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t convert toBool parameter</source> <translation type="unfinished"></translation> </message> <message> <source>Got empty parameter</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t convert toDouble parameter</source> <translation type="unfinished"></translation> </message> <message> <source>Got wrong parameter id. Need only id &gt; 0.</source> <translation type="unfinished"></translation> </message> <message> <source>United detail</source> <translation type="unfinished"></translation> </message> <message> <source>Fabric</source> <translation type="unfinished"></translation> </message> <message> <source>Lining</source> <translation type="unfinished"></translation> </message> <message> <source>Interfacing</source> <translation type="unfinished"></translation> </message> <message> <source>Interlining</source> <translation type="unfinished"></translation> </message> <message> <source>Cut</source> <translation type="unfinished"></translation> </message> <message> <source>on fold</source> <translation type="unfinished"></translation> </message> </context> <context> <name>QmuParser</name> <message> <source>too few arguments for function sum.</source> <comment>parser error message</comment> <translation type="unfinished"></translation> </message> <message> <source>too few arguments for function min.</source> <comment>parser error message</comment> <translation type="unfinished"></translation> </message> </context> <context> <name>QmuParserErrorMsg</name> <message> <source>Unexpected token &quot;$TOK$&quot; found at position $POS$.</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot; and $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Internal error</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>Invalid function-, variable- or constant name: &quot;$TOK$&quot;.</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot;</comment> <translation type="unfinished"></translation> </message> <message> <source>Invalid binary operator identifier: &quot;$TOK$&quot;.</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot;</comment> <translation type="unfinished"></translation> </message> <message> <source>Invalid infix operator identifier: &quot;$TOK$&quot;.</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot;</comment> <translation type="unfinished"></translation> </message> <message> <source>Invalid postfix operator identifier: &quot;$TOK$&quot;.</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot;</comment> <translation type="unfinished"></translation> </message> <message> <source>Invalid pointer to callback function.</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>Expression is empty.</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>Invalid pointer to variable.</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>Unexpected operator &quot;$TOK$&quot; found at position $POS$</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot; and $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Unexpected end of expression at position $POS$</source> <comment>Math parser error messages. Left untouched $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Unexpected argument separator at position $POS$</source> <comment>Math parser error messages. Left untouched $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Unexpected parenthesis &quot;$TOK$&quot; at position $POS$</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot; and $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Unexpected function &quot;$TOK$&quot; at position $POS$</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot; and $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Unexpected value &quot;$TOK$&quot; found at position $POS$</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot; and $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Unexpected variable &quot;$TOK$&quot; found at position $POS$</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot; and $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Function arguments used without a function (position: $POS$)</source> <comment>Math parser error messages. Left untouched $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Missing parenthesis</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>Too many parameters for function &quot;$TOK$&quot; at expression position $POS$</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot; and $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Too few parameters for function &quot;$TOK$&quot; at expression position $POS$</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot; and $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Divide by zero</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>Domain error</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>Name conflict</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>Invalid value for operator priority (must be greater or equal to zero).</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>user defined binary operator &quot;$TOK$&quot; conflicts with a built in operator.</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot;</comment> <translation type="unfinished"></translation> </message> <message> <source>Unexpected string token found at position $POS$.</source> <comment>Math parser error messages. Left untouched $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Unterminated string starting at position $POS$.</source> <comment>Math parser error messages. Left untouched $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>String function called with a non string type of argument.</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>String value used where a numerical argument is expected.</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>No suitable overload for operator &quot;$TOK$&quot; at position $POS$.</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot; and $POS$</comment> <translation type="unfinished"></translation> </message> <message> <source>Function result is a string.</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>Parser error.</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>Decimal separator is identic to function argument separator.</source> <comment>Math parser error messages.</comment> <translation type="unfinished"></translation> </message> <message> <source>The &quot;$TOK$&quot; operator must be preceded by a closing bracket.</source> <comment>Math parser error messages. Left untouched &quot;$TOK$&quot;</comment> <translation type="unfinished"></translation> </message> <message> <source>If-then-else operator is missing an else clause</source> <comment>Math parser error messages. Do not translate operator name.</comment> <translation type="unfinished"></translation> </message> <message> <source>Misplaced colon at position $POS$</source> <comment>Math parser error messages. Left untouched $POS$</comment> <translation type="unfinished"></translation> </message> </context> <context> <name>RenamePP</name> <message> <source>rename pattern piece</source> <translation type="unfinished"></translation> </message> </context> <context> <name>SavePieceOptions</name> <message> <source>save detail option</source> <translation type="unfinished"></translation> </message> </context> <context> <name>SavePiecePathOptions</name> <message> <source>save path options</source> <translation type="unfinished"></translation> </message> </context> <context> <name>SaveToolOptions</name> <message> <source>save tool option</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TMainWindow</name> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:18pt;&quot;&gt;Select New for creation measurement file.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Name</source> <translation>Nama</translation> </message> <message> <source>Calculated value</source> <translation type="unfinished"></translation> </message> <message> <source>Formula</source> <translation>rumus</translation> </message> <message> <source>Base value</source> <translation type="unfinished"></translation> </message> <message> <source>In sizes</source> <translation type="unfinished"></translation> </message> <message> <source>In heights</source> <translation type="unfinished"></translation> </message> <message> <source>Details</source> <translation type="unfinished"></translation> </message> <message> <source>Name:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula:</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tampilkan perhitungan penuh dalam kotak pesan&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <source>Base value:</source> <translation type="unfinished"></translation> </message> <message> <source>In sizes:</source> <translation type="unfinished"></translation> </message> <message> <source>In heights:</source> <translation type="unfinished"></translation> </message> <message> <source>Description:</source> <translation type="unfinished"></translation> </message> <message> <source>Move measurement up</source> <translation type="unfinished"></translation> </message> <message> <source>Move measurement down</source> <translation type="unfinished"></translation> </message> <message> <source>Calculated value:</source> <translation type="unfinished"></translation> </message> <message> <source>Full name:</source> <translation type="unfinished"></translation> </message> <message> <source>Information</source> <translation type="unfinished"></translation> </message> <message> <source>Type:</source> <translation type="unfinished"></translation> </message> <message> <source>Measurement type</source> <translation type="unfinished"></translation> </message> <message> <source>Path:</source> <translation type="unfinished"></translation> </message> <message> <source>Show in Explorer</source> <translation type="unfinished"></translation> </message> <message> <source>Base size:</source> <translation type="unfinished"></translation> </message> <message> <source>Base size value</source> <translation type="unfinished"></translation> </message> <message> <source>Base height:</source> <translation type="unfinished"></translation> </message> <message> <source>Base height value</source> <translation type="unfinished"></translation> </message> <message> <source>Given name:</source> <translation type="unfinished"></translation> </message> <message> <source>Family name:</source> <translation type="unfinished"></translation> </message> <message> <source>Birth date:</source> <translation type="unfinished"></translation> </message> <message> <source>Email:</source> <translation type="unfinished"></translation> </message> <message> <source>Notes:</source> <translation type="unfinished"></translation> </message> <message> <source>File</source> <translation type="unfinished"></translation> </message> <message> <source>Window</source> <translation type="unfinished"></translation> </message> <message> <source>Help</source> <translation type="unfinished"></translation> </message> <message> <source>Measurements</source> <translation>pengukuran</translation> </message> <message> <source>Menu</source> <translation type="unfinished"></translation> </message> <message> <source>Gradation</source> <translation type="unfinished"></translation> </message> <message> <source>Open individual ...</source> <translation type="unfinished"></translation> </message> <message> <source>Save</source> <translation>Simpan</translation> </message> <message> <source>Save As ...</source> <translation type="unfinished"></translation> </message> <message> <source>Quit</source> <translation type="unfinished"></translation> </message> <message> <source>About &amp;Qt</source> <translation type="unfinished"></translation> </message> <message> <source>About SeamlyMe</source> <translation type="unfinished"></translation> </message> <message> <source>New</source> <translation type="unfinished"></translation> </message> <message> <source>Add known</source> <translation type="unfinished"></translation> </message> <message> <source>Add custom</source> <translation type="unfinished"></translation> </message> <message> <source>Read only</source> <translation type="unfinished"></translation> </message> <message> <source>Open template</source> <translation type="unfinished"></translation> </message> <message> <source>Database</source> <translation type="unfinished"></translation> </message> <message> <source>Show information about all known measurement</source> <translation type="unfinished"></translation> </message> <message> <source>Preferences</source> <translation type="unfinished"></translation> </message> <message> <source>untitled %1</source> <translation type="unfinished"></translation> </message> <message> <source>This file already opened in another window.</source> <translation type="unfinished"></translation> </message> <message> <source>File error.</source> <translation type="unfinished"></translation> </message> <message> <source>Could not save file</source> <translation type="unfinished"></translation> </message> <message> <source>measurements</source> <translation type="unfinished"></translation> </message> <message> <source>Save as</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;New Window</source> <translation type="unfinished"></translation> </message> <message> <source>Edit measurement</source> <translation type="unfinished"></translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Empty field.</source> <translation type="unfinished"></translation> </message> <message> <source>Parser error: %1</source> <translation type="unfinished"></translation> </message> <message> <source>Individual measurements</source> <translation type="unfinished"></translation> </message> <message> <source>Unsaved changes</source> <translation type="unfinished"></translation> </message> <message> <source>Measurements have been modified. Do you want to save your changes?</source> <translation type="unfinished"></translation> </message> <message> <source>Empty field</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Open file</source> <translation>Buka File</translation> </message> <message> <source>Import from a pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern files (*.val)</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern unit:</source> <translation type="unfinished"></translation> </message> <message> <source>Find:</source> <translation type="unfinished"></translation> </message> <message> <source>Find Previous</source> <translation type="unfinished"></translation> </message> <message> <source>Ctrl+Shift+G</source> <translation type="unfinished"></translation> </message> <message> <source>Find Next</source> <translation type="unfinished"></translation> </message> <message> <source>Ctrl+G</source> <translation type="unfinished"></translation> </message> <message> <source>Failed to lock. This file already opened in another window.</source> <translation type="unfinished"></translation> </message> <message> <source>Failed to lock. This file already opened in another window. Expect collissions when run 2 copies of the program.</source> <translation type="unfinished"></translation> </message> <message> <source>File contains invalid known measurement(s).</source> <translation type="unfinished"></translation> </message> <message> <source>File has unknown format.</source> <translation type="unfinished"></translation> </message> <message> <source>Full name</source> <translation type="unfinished"></translation> </message> <message> <source>File &apos;%1&apos; doesn&apos;t exist!</source> <translation type="unfinished"></translation> </message> <message> <source>The name of known measurement forbidden to change.</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t find measurement &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>The full name of known measurement forbidden to change.</source> <translation type="unfinished"></translation> </message> <message> <source>Function Wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Move measurement top</source> <translation type="unfinished"></translation> </message> <message> <source>Move measurement bottom</source> <translation type="unfinished"></translation> </message> <message> <source>Delete measurement</source> <translation type="unfinished"></translation> </message> <message> <source>unknown</source> <comment>gender</comment> <translation type="unfinished"></translation> </message> <message> <source>male</source> <comment>gender</comment> <translation type="unfinished"></translation> </message> <message> <source>female</source> <comment>gender</comment> <translation type="unfinished"></translation> </message> <message> <source>Gender:</source> <translation type="unfinished"></translation> </message> <message> <source>PM system:</source> <translation type="unfinished"></translation> </message> <message> <source>Create from existing ...</source> <translation type="unfinished"></translation> </message> <message> <source>Create from existing file</source> <translation type="unfinished"></translation> </message> <message> <source>Select file</source> <translation type="unfinished"></translation> </message> <message> <source>Measurement diagram</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:340pt;&quot;&gt;?&lt;/span&gt;&lt;/p&gt;&lt;p align=\&quot;center\&quot;&gt;Unknown measurement&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:340pt;&quot;&gt;?&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Unknown measurement&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>About Qt</source> <translation type="unfinished"></translation> </message> <message> <source>File was not saved yet.</source> <translation type="unfinished"></translation> </message> <message> <source>Search</source> <translation type="unfinished"></translation> </message> <message> <source>Measurement&apos;s name in a formula</source> <translation type="unfinished"></translation> </message> <message> <source>Measurement&apos;s name in a formula.</source> <translation type="unfinished"></translation> </message> <message> <source>Measurement&apos;s human-readable name.</source> <translation type="unfinished"></translation> </message> <message> <source>Save...</source> <translation type="unfinished"></translation> </message> <message> <source>Don&apos;t Save</source> <translation type="unfinished"></translation> </message> <message> <source>Locking file</source> <translation type="unfinished"></translation> </message> <message> <source>This file already opened in another window. Ignore if you want to continue (not recommended, can cause a data corruption).</source> <translation type="unfinished"></translation> </message> <message> <source>The lock file could not be created, for lack of permissions. Ignore if you want to continue (not recommended, can cause a data corruption).</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown error happened, for instance a full partition prevented writing out the lock file. Ignore if you want to continue (not recommended, can cause a data corruption).</source> <translation type="unfinished"></translation> </message> <message> <source>The lock file could not be created, for lack of permissions.</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown error happened, for instance a full partition prevented writing out the lock file.</source> <translation type="unfinished"></translation> </message> <message> <source>Export to CSV</source> <translation type="unfinished"></translation> </message> <message> <source>Show in Finder</source> <translation type="unfinished"></translation> </message> <message> <source>Customer&apos;s name</source> <translation type="unfinished"></translation> </message> <message> <source>Customer&apos;s family name</source> <translation type="unfinished"></translation> </message> <message> <source>Customer&apos;s email address</source> <translation type="unfinished"></translation> </message> <message> <source>Height:</source> <translation type="unfinished"></translation> </message> <message> <source>Size:</source> <translation type="unfinished"></translation> </message> <message> <source>All files</source> <translation type="unfinished"></translation> </message> <message> <source>The measurements document has no write permissions.</source> <translation type="unfinished"></translation> </message> <message> <source>Cannot set permissions for %1 to writable.</source> <translation type="unfinished"></translation> </message> <message> <source>Could not save the file.</source> <translation type="unfinished"></translation> </message> <message> <source>Could not save the file</source> <translation type="unfinished"></translation> </message> <message> <source>read only</source> <translation type="unfinished"></translation> </message> <message> <source>Multisize measurements</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid result. Value is infinite or NaN. Please, check your calculations.</source> <translation type="unfinished"></translation> </message> <message> <source>Empty</source> <translation type="unfinished"></translation> </message> <message> <source>Open multisize ...</source> <translation type="unfinished"></translation> </message> <message> <source>Export from multisize measurements is not supported.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TabGrainline</name> <message> <source>Grainline visible</source> <translation type="unfinished"></translation> </message> <message> <source>Rotation:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Center pin:</source> <translation type="unfinished"></translation> </message> <message> <source>Top pin:</source> <translation type="unfinished"></translation> </message> <message> <source>Bottom pin:</source> <translation type="unfinished"></translation> </message> <message> <source>Arrows:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TabLabels</name> <message> <source>Piece label data</source> <translation type="unfinished"></translation> </message> <message> <source>Letter:</source> <translation type="unfinished"></translation> </message> <message> <source>Letter of pattern piece</source> <translation type="unfinished"></translation> </message> <message> <source>Name of detail:</source> <translation type="unfinished"></translation> </message> <message> <source>Detail</source> <translation type="unfinished">rincial</translation> </message> <message> <source>Name can&apos;t be empty</source> <translation type="unfinished"></translation> </message> <message> <source>Placement:</source> <translation type="unfinished"></translation> </message> <message> <source>Labels</source> <translation type="unfinished"></translation> </message> <message> <source>Detail label visible</source> <translation type="unfinished"></translation> </message> <message> <source>Width:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Height:</source> <translation type="unfinished"></translation> </message> <message> <source>Center pin:</source> <translation type="unfinished"></translation> </message> <message> <source>Top left pin:</source> <translation type="unfinished"></translation> </message> <message> <source>Bottom right pin:</source> <translation type="unfinished"></translation> </message> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern label visible</source> <translation type="unfinished"></translation> </message> <message> <source>Label template:</source> <translation type="unfinished"></translation> </message> <message> <source>Edit pattern label</source> <translation type="unfinished"></translation> </message> <message> <source>Edit template</source> <translation type="unfinished"></translation> </message> <message> <source>Label data</source> <translation type="unfinished"></translation> </message> <message> <source>Quantity:</source> <translation type="unfinished"></translation> </message> <message> <source>on fold</source> <translation type="unfinished"></translation> </message> <message> <source>Annotation:</source> <translation type="unfinished"></translation> </message> <message> <source>A text field to add comments in</source> <translation type="unfinished"></translation> </message> <message> <source>Orientation:</source> <translation type="unfinished"></translation> </message> <message> <source>Rotation:</source> <translation type="unfinished"></translation> </message> <message> <source>Tilt:</source> <translation type="unfinished"></translation> </message> <message> <source>Fold position:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TabPassmarks</name> <message> <source>Notch:</source> <translation type="unfinished"></translation> </message> <message> <source>One line</source> <translation type="unfinished"></translation> </message> <message> <source>Two lines</source> <translation type="unfinished"></translation> </message> <message> <source>Three lines</source> <translation type="unfinished"></translation> </message> <message> <source>T mark</source> <translation type="unfinished"></translation> </message> <message> <source>V mark</source> <translation type="unfinished"></translation> </message> <message> <source>Angle</source> <translation type="unfinished">sudut</translation> </message> <message> <source>Straightforward</source> <translation type="unfinished"></translation> </message> <message> <source>Bisector</source> <translation type="unfinished"></translation> </message> <message> <source>Marks</source> <translation type="unfinished"></translation> </message> <message> <source>Select if need designate the corner point as a passmark</source> <translation type="unfinished"></translation> </message> <message> <source>Intersection</source> <translation type="unfinished"></translation> </message> <message> <source>Show the second passmark on seam line</source> <translation type="unfinished"></translation> </message> <message> <source>This option has effect only if the second passmark on seam line enabled in global preferences. The option helps disable the second passmark for this passmark only.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TabPaths</name> <message> <source>Main path</source> <translation type="unfinished"></translation> </message> <message> <source>All objects in path should follow in clockwise direction.</source> <translation type="unfinished"></translation> </message> <message> <source>Forbid piece be mirrored in a layout.</source> <translation type="unfinished"></translation> </message> <message> <source>Forbid flipping</source> <translation type="unfinished"></translation> </message> <message> <source>Ready!</source> <translation type="unfinished"></translation> </message> <message> <source>Seam allowance</source> <translation type="unfinished">kampuh</translation> </message> <message> <source>Automatic</source> <translation type="unfinished"></translation> </message> <message> <source>Width:</source> <translation type="unfinished"></translation> </message> <message> <source>Formula wizard</source> <translation type="unfinished"></translation> </message> <message> <source>Value</source> <translation type="unfinished"></translation> </message> <message> <source>Calculation</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Nodes</source> <translation type="unfinished"></translation> </message> <message> <source>Node:</source> <translation type="unfinished"></translation> </message> <message> <source>Before:</source> <translation type="unfinished"></translation> </message> <message> <source>Return to default width</source> <translation type="unfinished"></translation> </message> <message> <source>Default</source> <translation type="unfinished"></translation> </message> <message> <source>After:</source> <translation type="unfinished"></translation> </message> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Custom</source> <translation type="unfinished"></translation> </message> <message> <source>Start point:</source> <translation type="unfinished"></translation> </message> <message> <source>End point:</source> <translation type="unfinished"></translation> </message> <message> <source>Include as:</source> <translation type="unfinished"></translation> </message> <message> <source>Internal paths</source> <translation type="unfinished"></translation> </message> <message> <source>The seam allowance is part of main path</source> <translation type="unfinished"></translation> </message> <message> <source>Built in</source> <translation type="unfinished"></translation> </message> <message> <source>Hide the main path if the seam allowance is enabled</source> <translation type="unfinished"></translation> </message> <message> <source>Hide main path</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TapeConfigDialog</name> <message> <source>Apply</source> <translation type="vanished">Terapkan</translation> </message> <message> <source>&amp;Cancel</source> <translation type="vanished">&amp;Batalkan</translation> </message> <message> <source>&amp;Ok</source> <translation type="vanished">&amp;Ok</translation> </message> <message> <source>Config Dialog</source> <translation type="vanished">Dialog konfigurasi</translation> </message> <message> <source>Configuration</source> <translation type="vanished">Konfigurasi</translation> </message> </context> <context> <name>TapeConfigurationPage</name> <message> <source>Language</source> <translation type="vanished">Bahasa</translation> </message> <message> <source>GUI language</source> <translation type="vanished">Bahasa GUI</translation> </message> <message> <source>Decimal separator parts</source> <translation type="vanished">komponen pemisah desimal</translation> </message> <message> <source>With OS options (%1)</source> <translation type="vanished">dengan pilihan OS (%1)</translation> </message> </context> <context> <name>TapePreferencesConfigurationPage</name> <message> <source>Language</source> <translation type="unfinished">Bahasa</translation> </message> <message> <source>GUI language:</source> <translation type="unfinished"></translation> </message> <message> <source>Decimal separator parts:</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern making system</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern making system:</source> <translation type="unfinished"></translation> </message> <message> <source>Author:</source> <translation type="unfinished"></translation> </message> <message> <source>Book:</source> <translation type="unfinished"></translation> </message> <message> <source>Measurements editing</source> <translation type="unfinished"></translation> </message> <message> <source>Reset warnings</source> <translation type="unfinished"></translation> </message> <message> <source>Toolbar</source> <translation type="unfinished"></translation> </message> <message> <source>The text appears under the icon (recommended for beginners).</source> <translation type="unfinished"></translation> </message> <message> <source>Default height and size</source> <translation type="unfinished"></translation> </message> <message> <source>Default height:</source> <translation type="unfinished"></translation> </message> <message> <source>Default size:</source> <translation type="unfinished"></translation> </message> <message> <source>With OS options</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TapePreferencesPathPage</name> <message> <source>Paths that Seamly2D uses</source> <translation type="unfinished"></translation> </message> <message> <source>Type</source> <translation type="unfinished"></translation> </message> <message> <source>Path</source> <translation type="unfinished"></translation> </message> <message> <source>Default</source> <translation type="unfinished"></translation> </message> <message> <source>Edit</source> <translation type="unfinished"></translation> </message> <message> <source>Open Directory</source> <translation type="unfinished"></translation> </message> <message> <source>My Individual Measurements</source> <translation type="unfinished"></translation> </message> <message> <source>My Multisize Measurements</source> <translation type="unfinished"></translation> </message> <message> <source>My Templates</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TogglePieceInLayout</name> <message> <source>detail in layout list</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Utils::CheckableMessageBox</name> <message> <source>Do not ask again</source> <translation type="unfinished"></translation> </message> <message> <source>Do not &amp;ask again</source> <translation type="unfinished"></translation> </message> <message> <source>Do not &amp;show again</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VAbstractConverter</name> <message> <source>Couldn&apos;t get version information.</source> <translation type="unfinished"></translation> </message> <message> <source>Too many tags &lt;%1&gt; in file.</source> <translation type="unfinished"></translation> </message> <message> <source>Version &quot;%1&quot; invalid.</source> <translation type="unfinished"></translation> </message> <message> <source>Version &quot;0.0.0&quot; invalid.</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid version. Minimum supported version is %1</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid version. Maximum supported version is %1</source> <translation type="unfinished"></translation> </message> <message> <source>Error no unique id.</source> <translation type="unfinished"></translation> </message> <message> <source>Could not change version.</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating a reserv copy: %1.</source> <translation type="unfinished"></translation> </message> <message> <source>Unexpected version &quot;%1&quot;.</source> <translation type="unfinished"></translation> </message> <message> <source>Error Opening a temp file: %1.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VAbstractCubicBezierPath</name> <message> <source>Can&apos;t cut this spline</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VAbstractPattern</name> <message> <source>Can&apos;t find tool in table.</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating group</source> <translation type="unfinished"></translation> </message> <message> <source>New group</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VAbstractPieceData</name> <message> <source>Detail</source> <translation type="unfinished">rincial</translation> </message> </context> <context> <name>VAbstractSpline</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> </context> <context> <name>VAbstractTool</name> <message> <source>black</source> <translation type="unfinished"></translation> </message> <message> <source>green</source> <translation type="unfinished"></translation> </message> <message> <source>blue</source> <translation type="unfinished"></translation> </message> <message> <source>dark red</source> <translation type="unfinished"></translation> </message> <message> <source>dark green</source> <translation type="unfinished"></translation> </message> <message> <source>dark blue</source> <translation type="unfinished"></translation> </message> <message> <source>yellow</source> <translation type="unfinished"></translation> </message> <message> <source>Confirm deletion</source> <translation type="unfinished"></translation> </message> <message> <source>Do you really want to delete?</source> <translation type="unfinished"></translation> </message> <message> <source>light salmon</source> <translation type="unfinished"></translation> </message> <message> <source>orange</source> <translation type="unfinished"></translation> </message> <message> <source>deep pink</source> <translation type="unfinished"></translation> </message> <message> <source>violet</source> <translation type="unfinished"></translation> </message> <message> <source>dark violet</source> <translation type="unfinished"></translation> </message> <message> <source>medium sea green</source> <translation type="unfinished"></translation> </message> <message> <source>lime</source> <translation type="unfinished"></translation> </message> <message> <source>deep sky blue</source> <translation type="unfinished"></translation> </message> <message> <source>corn flower blue</source> <translation type="unfinished"></translation> </message> <message> <source>Edit wrong formula</source> <translation type="unfinished"></translation> </message> <message> <source>goldenrod</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VApplication</name> <message> <source>Error parsing file. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Error bad id. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Error can&apos;t convert value. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Error empty parameter. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Error wrong id. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Something&apos;s wrong!!</source> <translation type="unfinished"></translation> </message> <message> <source>Parser error: %1. Program will be terminated.</source> <translation type="unfinished"></translation> </message> <message> <source>Exception thrown: %1. Program will be terminated.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VCommandLine</name> <message> <source>Path to custom measure file (export mode).</source> <translation type="unfinished"></translation> </message> <message> <source>The measure file</source> <translation type="unfinished"></translation> </message> <message> <source>Format number</source> <translation type="unfinished"></translation> </message> <message> <source>Template number</source> <translation type="unfinished"></translation> </message> <message> <source>The page width</source> <translation type="unfinished"></translation> </message> <message> <source>The measure unit</source> <translation type="unfinished"></translation> </message> <message> <source>Angle</source> <translation>sudut</translation> </message> <message> <source>Auto crop unused length (export mode).</source> <translation type="unfinished"></translation> </message> <message> <source>Layout units (as paper&apos;s one except px, export mode).</source> <translation type="unfinished"></translation> </message> <message> <source>The unit</source> <translation type="unfinished"></translation> </message> <message> <source>The gap width</source> <translation type="unfinished"></translation> </message> <message> <source>Grouping type</source> <translation type="unfinished"></translation> </message> <message> <source>Cannot use pageformat and page explicit size/units together.</source> <translation type="unfinished"></translation> </message> <message> <source>Page height, width, units must be used all 3 at once.</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid rotation value. That must be one of predefined values.</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown page templated selected.</source> <translation type="unfinished"></translation> </message> <message> <source>Unsupported paper units.</source> <translation type="unfinished"></translation> </message> <message> <source>Unsupported layout units.</source> <translation type="unfinished"></translation> </message> <message> <source>Export options can be used with single input file only.</source> <translation type="unfinished"></translation> </message> <message> <source>Test option can be used with single input file only.</source> <translation type="unfinished"></translation> </message> <message> <source>The base filename of exported layout files. Use it to enable console export mode.</source> <translation type="unfinished"></translation> </message> <message> <source>The base filename of layout files</source> <translation type="unfinished"></translation> </message> <message> <source>The destination folder</source> <translation type="unfinished"></translation> </message> <message> <source>The size value</source> <translation type="unfinished"></translation> </message> <message> <source>The height value</source> <translation type="unfinished"></translation> </message> <message> <source>Page width in current units like 12.0 (cannot be used with &quot;%1&quot;, export mode).</source> <translation type="unfinished"></translation> </message> <message> <source>Page height in current units like 12.0 (cannot be used with &quot;%1&quot;, export mode).</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid gradation size value.</source> <translation type="unfinished"></translation> </message> <message> <source>Invalid gradation height value.</source> <translation type="unfinished"></translation> </message> <message> <source>Pattern making program.</source> <translation>Program pembuat pola.</translation> </message> <message> <source>Pattern file.</source> <translation>Berkas pola.</translation> </message> <message> <source>Gap width must be used together with shift units.</source> <translation type="unfinished"></translation> </message> <message> <source>Left margin must be used together with page units.</source> <translation type="unfinished"></translation> </message> <message> <source>Right margin must be used together with page units.</source> <translation type="unfinished"></translation> </message> <message> <source>Top margin must be used together with page units.</source> <translation type="unfinished"></translation> </message> <message> <source>Bottom margin must be used together with page units.</source> <translation type="unfinished"></translation> </message> <message> <source>The path to output destination folder. By default the directory at which the application was started.</source> <translation type="unfinished"></translation> </message> <message> <source>Page height/width measure units (cannot be used with &quot;%1&quot;, export mode). Valid values: %2.</source> <translation type="unfinished"></translation> </message> <message> <source>Ignore margins printing (export mode). Disable value keys: &quot;%1&quot;, &quot;%2&quot;, &quot;%3&quot;, &quot;%4&quot;. Set all margins to 0.</source> <translation type="unfinished"></translation> </message> <message> <source>Page left margin in current units like 3.0 (export mode). If not set will be used value from default printer. Or 0 if none printers was found. Value will be ignored if key &quot;%1&quot; is used.</source> <translation type="unfinished"></translation> </message> <message> <source>Page right margin in current units like 3.0 (export mode). If not set will be used value from default printer. Or 0 if none printers was found. Value will be ignored if key &quot;%1&quot; is used.</source> <translation type="unfinished"></translation> </message> <message> <source>Page top margin in current units like 3.0 (export mode). If not set will be used value from default printer. Or 0 if none printers was found. Value will be ignored if key &quot;%1&quot; is used.</source> <translation type="unfinished"></translation> </message> <message> <source>Page bottom margin in current units like 3.0 (export mode). If not set will be used value from default printer. Or 0 if none printers was found. Value will be ignored if key &quot;%1&quot; is used.</source> <translation type="unfinished"></translation> </message> <message> <source>Rotation in degrees (one of predefined, export mode). Default value is 180. 0 is no-rotate. Valid values: %1. Each value show how many times details will be rotated. For example 180 mean two times (360/180=2) by 180 degree.</source> <translation type="unfinished"></translation> </message> <message> <source>Unite pages if possible (export mode). Maximum value limited by QImage that supports only a maximum of 32768x32768 px images.</source> <translation type="unfinished"></translation> </message> <message> <source>Save length of the sheet if set (export mode). The option tells the program to use as much as possible width of sheet. Quality of a layout can be worse when this option was used.</source> <translation type="unfinished"></translation> </message> <message> <source>The layout gap width x2, measured in layout units (export mode). Set distance between details and a detail and a sheet.</source> <translation type="unfinished"></translation> </message> <message> <source>Sets layout groupping cases (export mode): %1.</source> <translation type="unfinished"></translation> </message> <message> <source>Run the program in a test mode. The program in this mode loads a single pattern file and silently quit without showing the main window. The key have priority before key &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Shift/Offset layout length measured in layout units (export mode). The option show how many points along edge will be used in creating a layout.</source> <translation type="unfinished"></translation> </message> <message> <source>Shift/Offset length</source> <translation type="unfinished"></translation> </message> <message> <source>Shift/Offset length must be used together with shift units.</source> <translation type="unfinished"></translation> </message> <message> <source>Number corresponding to output format (default = 0, export mode):</source> <translation type="unfinished"></translation> </message> <message> <source>Number corresponding to page template (default = 0, export mode):</source> <translation type="unfinished"></translation> </message> <message> <source>Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). Alternatively you can use the %1 environment variable.</source> <translation type="unfinished"></translation> </message> <message> <source>Export dxf in binary form.</source> <translation type="unfinished"></translation> </message> <message> <source>Export text as paths.</source> <translation type="unfinished"></translation> </message> <message> <source>Export only details. Export details as they positioned in the details mode. Any layout related options will be ignored.</source> <translation type="unfinished"></translation> </message> <message> <source>Set size value a pattern file, that was opened with multisize measurements (export mode). Valid values: %1cm.</source> <translation type="unfinished"></translation> </message> <message> <source>Set height value a pattern file, that was opened with multisize measurements (export mode). Valid values: %1cm.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VCommonSettings</name> <message> <source>measurements</source> <translation type="unfinished"></translation> </message> <message> <source>individual</source> <translation type="unfinished"></translation> </message> <message> <source>multisize</source> <translation type="unfinished"></translation> </message> <message> <source>templates</source> <translation type="unfinished"></translation> </message> <message> <source>label templates</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VContainer</name> <message> <source>Can&apos;t find object</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t cast object</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t find object. Type mismatch.</source> <translation type="unfinished"></translation> </message> <message> <source>Number of free id exhausted.</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t create a curve with type &apos;%1&apos;</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VCubicBezierPath</name> <message> <source>Not enough points to create the spline.</source> <translation type="unfinished"></translation> </message> <message> <source>This spline does not exist.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VDomDocument</name> <message> <source>Can&apos;t open file %1: %2.</source> <translation type="unfinished"></translation> </message> <message> <source>Can&apos;t open schema file %1: %2.</source> <translation type="unfinished"></translation> </message> <message> <source>Validation error file %3 in line %1 column %2</source> <translation type="unfinished"></translation> </message> <message> <source>Parsing error file %3 in line %1 column %2</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t get node</source> <translation type="unfinished"></translation> </message> <message> <source>This id is not unique.</source> <translation type="unfinished"></translation> </message> <message> <source>Could not load schema file &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Fail to write Canonical XML.</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;empty&gt;</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VDrawTool</name> <message> <source>Options</source> <translation>pilihan</translation> </message> <message> <source>Delete</source> <translation>hapus</translation> </message> </context> <context> <name>VException</name> <message> <source>Exception: %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VFormula</name> <message> <source>Error</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VFormulaProperty</name> <message> <source>Formula</source> <translation>rumus</translation> </message> </context> <context> <name>VLayoutPiece</name> <message> <source>Piece %1 doesn&apos;t have shape.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VMeasurements</name> <message> <source>Can&apos;t find measurement &apos;%1&apos;</source> <translation type="unfinished"></translation> </message> <message> <source>The measurement name is empty!</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VPE::VBoolProperty</name> <message> <source>True</source> <translation type="unfinished"></translation> </message> <message> <source>False</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VPE::VFileEditWidget</name> <message> <source>Directory</source> <translation type="unfinished"></translation> </message> <message> <source>Open File</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VPattern</name> <message> <source>Error parsing file.</source> <translation type="unfinished"></translation> </message> <message> <source>Error can&apos;t convert value.</source> <translation type="unfinished"></translation> </message> <message> <source>Error empty parameter.</source> <translation type="unfinished"></translation> </message> <message> <source>Error wrong id.</source> <translation type="unfinished"></translation> </message> <message> <source>Error parsing file (std::bad_alloc).</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating detail</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating single point</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of end line</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point along line</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of shoulder</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of normal</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of bisector</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of contact</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating modeling point</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating height</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating triangle</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of intersection</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating cut spline point</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating cut spline path point</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating cut arc point</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of intersection line and axis</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of intersection curve and axis</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating line</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating simple curve</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating curve path</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating modeling simple curve</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating modeling curve path</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating simple arc</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating modeling arc</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating union details</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of intersection arcs</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of intersection circles</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point from circle and tangent</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point from arc and tangent</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating true darts</source> <translation type="unfinished"></translation> </message> <message> <source>Wrong tag name &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown point type &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown spline type &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown arc type &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown tools type &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Error not unique id.</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of intersection curves</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating simple interactive spline</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating interactive spline path</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating cubic bezier curve</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating cubic bezier path curve</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating operation of rotation</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown operation type &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating operation of flipping by line</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating operation of flipping by axis</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating operation of moving</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating point of line intersection</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating simple elliptical arc</source> <translation type="unfinished"></translation> </message> <message> <source>Unknown elliptical arc type &apos;%1&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating modeling elliptical arc</source> <translation type="unfinished"></translation> </message> <message> <source>Detail</source> <translation type="unfinished">rincial</translation> </message> <message> <source>Unnamed path</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating a piece path</source> <translation type="unfinished"></translation> </message> <message> <source>Error creating or updating pin point</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VPoster</name> <message> <source>Grid ( %1 , %2 )</source> <translation type="unfinished"></translation> </message> <message> <source>Page %1 of %2</source> <translation type="unfinished"></translation> </message> <message> <source>Sheet %1 of %2</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VSettings</name> <message> <source>patterns</source> <translation type="unfinished"></translation> </message> <message> <source>layouts</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VSplinePath</name> <message> <source>Not enough points to create the spline.</source> <translation type="unfinished"></translation> </message> <message> <source>This spline does not exist.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VToolAlongLine</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> <message> <source>Angle</source> <translation type="unfinished">sudut</translation> </message> </context> <context> <name>VToolArc</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> <message> <source>Radius</source> <translation type="unfinished">Radius</translation> </message> <message> <source>Start angle</source> <translation type="unfinished"></translation> </message> <message> <source>End angle</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VToolArcWithLength</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> <message> <source>Radius</source> <translation type="unfinished">Radius</translation> </message> <message> <source>Start angle</source> <translation type="unfinished"></translation> </message> <message> <source>End angle</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VToolCut</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> </context> <context> <name>VToolCutArc</name> <message> <source>Arc</source> <translation type="unfinished">busur</translation> </message> <message> <source>length</source> <translation type="unfinished"></translation> </message> <message> <source>start angle</source> <translation type="unfinished"></translation> </message> <message> <source>end angle</source> <translation type="unfinished"></translation> </message> <message> <source>radius</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VToolCutSpline</name> <message> <source>Curve</source> <translation type="unfinished">kurva</translation> </message> <message> <source>length</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VToolCutSplinePath</name> <message> <source>Curve</source> <translation type="unfinished">kurva</translation> </message> <message> <source>length</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VToolDetail</name> <message> <source>Options</source> <translation type="vanished">pilihan</translation> </message> <message> <source>Delete</source> <translation type="vanished">hapus</translation> </message> </context> <context> <name>VToolEllipticalArc</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> <message> <source>Radius</source> <translation type="unfinished">Radius</translation> </message> <message> <source>Start angle</source> <translation type="unfinished"></translation> </message> <message> <source>End angle</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VToolHeight</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> <message> <source>Angle</source> <translation type="unfinished">sudut</translation> </message> </context> <context> <name>VToolLine</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> <message> <source>Angle</source> <translation type="unfinished">sudut</translation> </message> </context> <context> <name>VToolLineIntersectAxis</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> <message> <source>Angle</source> <translation type="unfinished">sudut</translation> </message> </context> <context> <name>VToolLinePoint</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> <message> <source>Angle</source> <translation type="unfinished">sudut</translation> </message> </context> <context> <name>VToolOptionsPropertyBrowser</name> <message> <source>Base point</source> <translation type="unfinished"></translation> </message> <message> <source>Point label</source> <translation type="vanished">label titik</translation> </message> <message> <source>Point at distance and angle</source> <translation type="unfinished"></translation> </message> <message> <source>Length</source> <translation type="vanished">panjang</translation> </message> <message> <source>Angle</source> <translation type="vanished">sudut</translation> </message> <message> <source>Point at distance along line</source> <translation type="unfinished"></translation> </message> <message> <source>Arc</source> <translation>busur</translation> </message> <message> <source>Radius</source> <translation type="vanished">Radius</translation> </message> <message> <source>First angle</source> <translation type="vanished">sudut pertama</translation> </message> <message> <source>Second angle</source> <translation type="vanished">sudut kedua</translation> </message> <message> <source>Point along bisector</source> <translation type="unfinished"></translation> </message> <message> <source>Cut arc tool</source> <translation type="unfinished"></translation> </message> <message> <source>Tool for segmenting a curve</source> <translation type="unfinished"></translation> </message> <message> <source>Tool segment a pathed curve</source> <translation type="unfinished"></translation> </message> <message> <source>Perpendicular point along line</source> <translation type="unfinished"></translation> </message> <message> <source>Line between points</source> <translation type="unfinished"></translation> </message> <message> <source>Point at line intersection</source> <translation type="unfinished"></translation> </message> <message> <source>Point along perpendicular</source> <translation type="unfinished"></translation> </message> <message> <source>Point at intersection of arc and line</source> <translation type="unfinished"></translation> </message> <message> <source>Tool to make point from x &amp; y of two other points</source> <translation type="unfinished"></translation> </message> <message> <source>Special point on shoulder</source> <translation type="unfinished"></translation> </message> <message> <source>Curve tool</source> <translation type="unfinished"></translation> </message> <message> <source>Tool for path curve</source> <translation type="unfinished"></translation> </message> <message> <source>Tool triangle</source> <translation type="unfinished"></translation> </message> <message> <source>Point intersection line and axis</source> <translation type="unfinished"></translation> </message> <message> <source>Point intersection curve and axis</source> <translation type="unfinished"></translation> </message> <message> <source>First point</source> <translation>Titik pertama</translation> </message> <message> <source>Second point</source> <translation>titik kedua</translation> </message> <message> <source>Arc with given length</source> <translation type="unfinished"></translation> </message> <message> <source>True darts</source> <translation type="unfinished"></translation> </message> <message> <source>Tool to make point from intersection two arcs</source> <translation type="unfinished"></translation> </message> <message> <source>Tool to make point from intersection two circles</source> <translation type="unfinished"></translation> </message> <message> <source>Tool to make point from circle and tangent</source> <translation type="unfinished"></translation> </message> <message> <source>Tool to make point from arc and tangent</source> <translation type="unfinished"></translation> </message> <message> <source>Highest point</source> <translation type="unfinished"></translation> </message> <message> <source>Lowest point</source> <translation type="unfinished"></translation> </message> <message> <source>Leftmost point</source> <translation type="unfinished"></translation> </message> <message> <source>Rightmost point</source> <translation type="unfinished"></translation> </message> <message> <source>Tool to make point from intersection two curves</source> <translation type="unfinished"></translation> </message> <message> <source>Cubic bezier curve</source> <translation type="unfinished"></translation> </message> <message> <source>Tool cubic bezier curve</source> <translation type="unfinished"></translation> </message> <message> <source>Tool rotation</source> <translation type="unfinished"></translation> </message> <message> <source>Vertical axis</source> <translation type="unfinished"></translation> </message> <message> <source>Horizontal axis</source> <translation type="unfinished"></translation> </message> <message> <source>Tool move</source> <translation type="unfinished"></translation> </message> <message> <source>Tool flipping by line</source> <translation type="unfinished"></translation> </message> <message> <source>Tool flipping by axis</source> <translation type="unfinished"></translation> </message> <message> <source>Elliptical arc</source> <translation type="unfinished"></translation> </message> <message> <source>Point label:</source> <translation type="unfinished"></translation> </message> <message> <source>Position:</source> <translation type="unfinished"></translation> </message> <message> <source>Base point:</source> <translation type="unfinished"></translation> </message> <message> <source>Line type:</source> <translation type="unfinished"></translation> </message> <message> <source>Line color:</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Angle:</source> <translation type="unfinished"></translation> </message> <message> <source>First point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point:</source> <translation type="unfinished"></translation> </message> <message> <source>Center point:</source> <translation type="unfinished"></translation> </message> <message> <source>Radius:</source> <translation type="unfinished">Radius:</translation> </message> <message> <source>First angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Second angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Color:</source> <translation type="unfinished"></translation> </message> <message> <source>Third point:</source> <translation type="unfinished"></translation> </message> <message> <source>Point 1 label:</source> <translation type="unfinished"></translation> </message> <message> <source>Point 2 label:</source> <translation type="unfinished"></translation> </message> <message> <source>First base point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second base point:</source> <translation type="unfinished"></translation> </message> <message> <source>First dart point:</source> <translation type="unfinished"></translation> </message> <message> <source>Arc:</source> <translation type="unfinished"></translation> </message> <message> <source>Curve:</source> <translation type="unfinished"></translation> </message> <message> <source>First line point:</source> <translation type="unfinished"></translation> </message> <message> <source>Second line point:</source> <translation type="unfinished"></translation> </message> <message> <source>First line (first point):</source> <translation type="unfinished"></translation> </message> <message> <source>First line (second point):</source> <translation type="unfinished"></translation> </message> <message> <source>Second line (first point):</source> <translation type="unfinished"></translation> </message> <message> <source>Second line (second point):</source> <translation type="unfinished"></translation> </message> <message> <source>Additional angle degrees:</source> <translation type="unfinished"></translation> </message> <message> <source>Center of arc:</source> <translation type="unfinished"></translation> </message> <message> <source>Top of the line:</source> <translation type="unfinished"></translation> </message> <message> <source>End of the line:</source> <translation type="unfinished"></translation> </message> <message> <source>X: vertical point:</source> <translation type="unfinished"></translation> </message> <message> <source>Y: horizontal point:</source> <translation type="unfinished"></translation> </message> <message> <source>First arc:</source> <translation type="unfinished"></translation> </message> <message> <source>Second arc:</source> <translation type="unfinished"></translation> </message> <message> <source>Take:</source> <translation type="unfinished"></translation> </message> <message> <source>Center of the first circle:</source> <translation type="unfinished"></translation> </message> <message> <source>Center of the second circle:</source> <translation type="unfinished"></translation> </message> <message> <source>First circle radius:</source> <translation type="unfinished"></translation> </message> <message> <source>Second circle radius:</source> <translation type="unfinished"></translation> </message> <message> <source>First curve:</source> <translation type="unfinished"></translation> </message> <message> <source>Second curve:</source> <translation type="unfinished"></translation> </message> <message> <source>Vertical correction:</source> <translation type="unfinished"></translation> </message> <message> <source>Horizontal correction:</source> <translation type="unfinished"></translation> </message> <message> <source>Center of the circle:</source> <translation type="unfinished"></translation> </message> <message> <source>Tangent point:</source> <translation type="unfinished"></translation> </message> <message> <source>Circle radius:</source> <translation type="unfinished"></translation> </message> <message> <source>Name:</source> <translation type="unfinished"></translation> </message> <message> <source>C1: angle:</source> <translation type="unfinished"></translation> </message> <message> <source>C1: length:</source> <translation type="unfinished"></translation> </message> <message> <source>C2: angle:</source> <translation type="unfinished"></translation> </message> <message> <source>C2: length:</source> <translation type="unfinished"></translation> </message> <message> <source>First point of axis:</source> <translation type="unfinished"></translation> </message> <message> <source>Second point of axis:</source> <translation type="unfinished"></translation> </message> <message> <source>Axis point:</source> <translation type="unfinished"></translation> </message> <message> <source>Suffix:</source> <translation type="unfinished"></translation> </message> <message> <source>Origin point:</source> <translation type="unfinished"></translation> </message> <message> <source>Axis type:</source> <translation type="unfinished"></translation> </message> <message> <source>Rotation angle:</source> <translation type="unfinished"></translation> </message> <message> <source>Fourth point:</source> <translation type="unfinished"></translation> </message> <message> <source>Pen style:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VToolPointOfContact</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> <message> <source>Angle</source> <translation type="unfinished">sudut</translation> </message> </context> <context> <name>VToolSeamAllowance</name> <message> <source>Current seam allowance</source> <translation type="unfinished"></translation> </message> <message> <source>move pattern piece label</source> <translation type="unfinished"></translation> </message> <message> <source>resize pattern piece label</source> <translation type="unfinished"></translation> </message> <message> <source>rotate pattern piece label</source> <translation type="unfinished"></translation> </message> <message> <source>move pattern info label</source> <translation type="unfinished"></translation> </message> <message> <source>resize pattern info label</source> <translation type="unfinished"></translation> </message> <message> <source>rotate pattern info label</source> <translation type="unfinished"></translation> </message> <message> <source>move grainline</source> <translation type="unfinished"></translation> </message> <message> <source>resize grainline</source> <translation type="unfinished"></translation> </message> <message> <source>rotate grainline</source> <translation type="unfinished"></translation> </message> <message> <source>Options</source> <translation type="unfinished">pilihan</translation> </message> <message> <source>In layout</source> <translation type="unfinished"></translation> </message> <message> <source>Delete</source> <translation type="unfinished">hapus</translation> </message> </context> <context> <name>VToolShoulderPoint</name> <message> <source>Length</source> <translation type="unfinished">panjang</translation> </message> <message> <source>Angle</source> <translation type="unfinished">sudut</translation> </message> </context> <context> <name>VToolUnionDetails</name> <message> <source>union details</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VTranslateVars</name> <message> <source>Bunka</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Bunka Fashion College</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Fundamentals of Garment Design</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Barnfield and Richard</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Jo Barnfield and Andrew Richards</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Pattern Making Primer</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Friendship/Women</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Elizabeth Friendship</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Creating Historical Clothes - Pattern Cutting from the 16th to the 19th Centuries</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Morris, K.</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Karen Morris</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Sewing Lingerie that Fits</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Castro</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Lucia Mors de Castro</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Patternmaking in Practic</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Kim &amp; Uh</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Injoo Kim and Mykyung Uh</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Apparel Making in Fashion Design</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Waugh</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Norah Waugh</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Corsets and Crinolines</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Grimble</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Frances Grimble</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Fashions of the Gilded Age</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Thornton&apos;s International System</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>ed. R. L. Shep</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>The Great War: Styles and Patterns of the 1910s</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Hillhouse &amp; Mansfield</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Marion S. Hillhouse and Evelyn A. Mansfield</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Dress Design: Draping and Flat Pattern Making</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Pivnick</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Esther Kaplan Pivnick</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>How to Design Beautiful Clothes: Designing and Pattern Making</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Minister &amp; Son</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Edward Minister &amp; Son, ed. R. L. Shep</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>The Complete Guide to Practical Cutting (1853)</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Strickland</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Gertrude Strickland</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>A Tailoring Manual</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Loh &amp; Lewis</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>May Loh and Diehl Lewis</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Patternless Fashion Design</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Morris, F. R.</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>F. R. Morris</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Ladies Garment Cutting and Making</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Mason</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Gertrude Mason</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Gertrude Mason&apos;s Patternmaking Book</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Kimata</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>K. Kimata</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>K.Kimata&apos;s Simplified Drafting Book for Dressmaking</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Master Designer</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>The Master Designer (Chicago, IL)</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Master Designer&apos;s System of Designing, Cutting and Grading</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Kopp</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Ernestine Kopp, Vittorina Rolfo, Beatrice Zelin, Lee Gross</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>How to Draft Basic Patterns</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Ekern</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Doris Ekern</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Slacks Cut-to-Fit for Your Figure</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Doyle</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Sarah J. Doyle</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Sarah&apos;s Key to Pattern Drafting</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Shelton</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Karla J. Shelton</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Design and Sew Jeans</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Lady Boutique</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Lady Boutique</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Lady Boutique magazine (Japan)</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Rohr</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>M. Rohr</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Pattern Drafting and Grading: Women&apos;s nd Misses&apos; Garment Design</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Moore</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Dorothy Moore</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Dorothy Moore&apos;s Pattern Drafting and Dressmaking</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Abling</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Bina Abling</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Integrating Draping, Drafting and Drawing</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Fukomoto</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Sue S. Fukomoto</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Scientific Pattern Drafting as taught at Style Center School of Costume Design, Dressmaking and Millinery</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Dressmaking International</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Dressmaking International</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Dressmaking International magazine (Japan)</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Erwin</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Mabel D. Erwin</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Practical Dress Design</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Gough</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>E. L. G. Gough</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Principles of Garment Cutting</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Allemong</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Elizabeth M. Allemong</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>European Cut</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>McCunn</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Donald H. McCunn</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>How to Make Your Own Sewing Patterns</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Zarapkar</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Shri K. R. Zarapkar and Shri Arvind K. Zarapkar</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Zarapkar System of Cutting</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Kunick</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Philip Kunick</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Sizing, Pattern Construction and Grading for Women&apos;s and Children&apos;s Garments</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Handford</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Jack Handford</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Professional Patternmaking for Designers: Women&apos;s Wear, Men&apos;s Casual Wear</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Davis</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>R. I. Davis</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Men&apos;s 17th &amp; 18th Century Costume, Cut &amp; Fashion</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>MacLochlainn</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Jason MacLochlainn</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>The Victorian Tailor: An Introduction to Period Tailoring</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Joseph-Armstrong</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Helen Joseph-Armstrong</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Patternmaking for Fashion Design</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Supreme System</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Frederick T. Croonberg</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>The Blue Book of Men&apos;s Tailoring, Grand Edition of Supreme System for Producing Mens Garments (1907)</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Sugino</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Dressmaking</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Pattern Drafting Vols. I, II, III (Japan)</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Centre Point System</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Louis Devere</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>The Handbook of Practical Cutting on the Centre Point System</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Aldrich/Men</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Winifred Aldrich</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Metric Pattern Cutting for Menswear</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Aldrich/Women</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Metric Pattern Cutting for Women&apos;s Wear</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Kershaw</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Gareth Kershaw</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Patternmaking for Menswear</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Gilewska</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Teresa Gilewska</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Pattern-Drafting for Fashion: The Basics</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Lo</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Dennic Chunman Lo</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Pattern Cutting</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Bray</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Natalie Bray</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Dress Pattern Designing: The Basic Principles of Cut and Fit</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Knowles/Men</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Lori A. Knowles</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>The Practical Guide to Patternmaking for Fashion Designers: Menswear</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Friendship/Men</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Pattern Cutting for Men&apos;s Costume</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Brown</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>P. Clement Brown</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Art in Dress</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Mitchell</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Jno. J. Mitchell</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>&quot;Standard&quot; Work on Cutting (Men&apos;s Garments) 1886: The Art and Science of Garment Cutting</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>GOST 17917-86</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Ministry of consumer industry of the USSR</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Standard figure boys</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Eddy</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Josephine F. Eddy and Elizabeth C. B. Wiley</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Pattern and Dress Design</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>Knowles/Women</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Practical Guide to Patternmaking for Fashion Designers: Juniors, Misses, and Women</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>American Garment Cutter</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>None</source> <comment>System name</comment> <translation type="unfinished"></translation> </message> <message> <source>Seamly2D team</source> <comment>Author name</comment> <translation type="unfinished"></translation> </message> <message> <source>Seamly2D&apos;s internal standard</source> <comment>Book name</comment> <translation type="unfinished"></translation> </message> <message> <source>sinh</source> <comment>hyperbolic sine function</comment> <translation type="unfinished"></translation> </message> <message> <source>cosh</source> <comment>hyperbolic cosine</comment> <translation type="unfinished"></translation> </message> <message> <source>tanh</source> <comment>hyperbolic tangens function</comment> <translation type="unfinished"></translation> </message> <message> <source>asinh</source> <comment>hyperbolic arcus sine function</comment> <translation type="unfinished"></translation> </message> <message> <source>atanh</source> <comment>hyperbolic arcur tangens function</comment> <translation type="unfinished"></translation> </message> <message> <source>log2</source> <comment>logarithm to the base 2</comment> <translation type="unfinished"></translation> </message> <message> <source>log10</source> <comment>logarithm to the base 10</comment> <translation type="unfinished"></translation> </message> <message> <source>log</source> <comment>logarithm to the base 10</comment> <translation type="unfinished"></translation> </message> <message> <source>ln</source> <comment>logarithm to base e (2.71828...)</comment> <translation type="unfinished"></translation> </message> <message> <source>exp</source> <comment>e raised to the power of x</comment> <translation type="unfinished"></translation> </message> <message> <source>sqrt</source> <comment>square root of a value</comment> <translation type="unfinished"></translation> </message> <message> <source>sign</source> <comment>sign function -1 if x&lt;0; 1 if x&gt;0</comment> <translation type="unfinished"></translation> </message> <message> <source>rint</source> <comment>round to nearest integer</comment> <translation type="unfinished"></translation> </message> <message> <source>abs</source> <comment>absolute value</comment> <translation type="unfinished"></translation> </message> <message> <source>min</source> <comment>min of all arguments</comment> <translation>minimal</translation> </message> <message> <source>max</source> <comment>max of all arguments</comment> <translation type="unfinished"></translation> </message> <message> <source>sum</source> <comment>sum of all arguments</comment> <translation type="unfinished"></translation> </message> <message> <source>avg</source> <comment>mean value of all arguments</comment> <translation type="unfinished"></translation> </message> <message> <source>fmod</source> <comment>Returns the floating-point remainder of numer/denom (rounded towards zero)</comment> <translation type="unfinished"></translation> </message> <message> <source>cm</source> <comment>centimeter</comment> <translation>cm</translation> </message> <message> <source>mm</source> <comment>millimeter</comment> <translation type="unfinished"></translation> </message> <message> <source>in</source> <comment>inch</comment> <translation type="unfinished"></translation> </message> <message> <source>Line_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>AngleLine_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Arc_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Spl_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>SplPath</source> <comment>Do not add symbol _ to the end of the name</comment> <translation type="unfinished"></translation> </message> <message> <source>RadiusArc_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Angle1Arc_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Angle2Arc_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Angle1Spl_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Angle2Spl_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Angle1SplPath</source> <comment>Do not add symbol _ to the end of the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Angle2SplPath</source> <comment>Do not add symbol _ to the end of the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Seg_</source> <comment>Segment. Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>CurrentLength</source> <comment>Do not add space between words</comment> <translation type="unfinished"></translation> </message> <message> <source>acosh</source> <comment>hyperbolic arcus cosine function</comment> <translation type="unfinished"></translation> </message> <message> <source>size</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>height</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>C1LengthSpl_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>C2LengthSpl_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>C1LengthSplPath</source> <comment>Do not add symbol _ to the end of the name</comment> <translation type="unfinished"></translation> </message> <message> <source>C2LengthSplPath</source> <comment>Do not add symbol _ to the end of the name</comment> <translation type="unfinished"></translation> </message> <message> <source>CurrentSeamAllowance</source> <comment>Do not add space between words</comment> <translation type="unfinished"></translation> </message> <message> <source>degTorad</source> <comment>converts degrees to radian</comment> <translation type="unfinished"></translation> </message> <message> <source>radTodeg</source> <comment>converts radian to degrees</comment> <translation type="unfinished"></translation> </message> <message> <source>sin</source> <comment>sine function working with radians</comment> <translation type="unfinished"></translation> </message> <message> <source>cos</source> <comment>cosine function working with radians</comment> <translation type="unfinished"></translation> </message> <message> <source>tan</source> <comment>tangens function working with radians</comment> <translation type="unfinished"></translation> </message> <message> <source>asin</source> <comment>arcus sine function working with radians</comment> <translation type="unfinished"></translation> </message> <message> <source>acos</source> <comment>arcus cosine function working with radians</comment> <translation type="unfinished"></translation> </message> <message> <source>atan</source> <comment>arcus tangens function working with radians</comment> <translation type="unfinished"></translation> </message> <message> <source>sinD</source> <comment>sine function working with degrees</comment> <translation type="unfinished"></translation> </message> <message> <source>cosD</source> <comment>cosine function working with degrees</comment> <translation type="unfinished"></translation> </message> <message> <source>tanD</source> <comment>tangens function working with degrees</comment> <translation type="unfinished"></translation> </message> <message> <source>asinD</source> <comment>arcus sine function working with degrees</comment> <translation type="unfinished"></translation> </message> <message> <source>acosD</source> <comment>arcus cosine function working with degrees</comment> <translation type="unfinished"></translation> </message> <message> <source>atanD</source> <comment>arcus tangens function working with degrees</comment> <translation type="unfinished"></translation> </message> <message> <source>M_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Increment_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>ElArc_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Radius1ElArc_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Radius2ElArc_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Angle1ElArc_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>Angle2ElArc_</source> <comment>Left symbol _ in the name</comment> <translation type="unfinished"></translation> </message> <message> <source>date</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>time</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>patternName</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>patternNumber</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>author</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>customer</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>pExt</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>pFileName</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>mFileName</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>mExt</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>pLetter</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>pAnnotation</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>pOrientation</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>pRotation</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>pTilt</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>pFoldPosition</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>pName</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>pQuantity</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>mFabric</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>mLining</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>mInterfacing</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>mInterlining</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>wCut</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> <message> <source>wOnFold</source> <comment>placeholder</comment> <translation type="unfinished"></translation> </message> </context> <context> <name>VWidgetDetails</name> <message> <source>Form</source> <translation type="unfinished"></translation> </message> <message> <source>Unnamed</source> <translation type="unfinished"></translation> </message> <message> <source>Select all</source> <translation type="unfinished"></translation> </message> <message> <source>Select none</source> <translation type="unfinished"></translation> </message> <message> <source>select all details</source> <translation type="unfinished"></translation> </message> <message> <source>select none details</source> <translation type="unfinished"></translation> </message> <message> <source>Invert selection</source> <translation type="unfinished"></translation> </message> <message> <source>invert selection</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VWidgetGroups</name> <message> <source>Rename</source> <translation type="unfinished"></translation> </message> <message> <source>Delete</source> <translation type="unfinished">hapus</translation> </message> </context> <context> <name>VisToolCubicBezierPath</name> <message> <source>&lt;b&gt;Curved path&lt;/b&gt;: select seven or more points</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;b&gt;Curved path&lt;/b&gt;: select seven or more points, &lt;b&gt;Enter&lt;/b&gt; - finish creation</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;b&gt;Curved path&lt;/b&gt;: select more points for complete segment</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VisToolCurveIntersectAxis</name> <message> <source>&lt;b&gt;Intersection curve and axis&lt;/b&gt;: angle = %1°; &lt;b&gt;Shift&lt;/b&gt; - sticking angle, &lt;b&gt;Enter&lt;/b&gt; - finish creation</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VisToolEndLine</name> <message> <source>&lt;b&gt;Point at distance and angle&lt;/b&gt;: angle = %1°, length = %2%3; &lt;b&gt;Shift&lt;/b&gt; - sticking angle, &lt;b&gt;Enter&lt;/b&gt; - finish creation</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VisToolLineIntersectAxis</name> <message> <source>&lt;b&gt;Intersection line and axis&lt;/b&gt;: angle = %1°; &lt;b&gt;Shift&lt;/b&gt; - sticking angle, &lt;b&gt;Enter&lt;/b&gt; - finish creation</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VisToolMove</name> <message> <source>Length = %1%2, angle = %3°, &lt;b&gt;Shift&lt;/b&gt; - sticking angle, &lt;b&gt;Mouse click&lt;/b&gt; - finish creation</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VisToolRotation</name> <message> <source>Rotating angle = %1°, &lt;b&gt;Shift&lt;/b&gt; - sticking angle, &lt;b&gt;Mouse click&lt;/b&gt; - finish creation</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VisToolSpline</name> <message> <source>Use &lt;b&gt;Shift&lt;/b&gt; for sticking angle!</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VisToolSplinePath</name> <message> <source>&lt;b&gt;Curved path&lt;/b&gt;: select three or more points</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;b&gt;Curved path&lt;/b&gt;: select three or more points, &lt;b&gt;Enter&lt;/b&gt; - finish creation</source> <translation type="unfinished"></translation> </message> <message> <source>Use &lt;b&gt;Shift&lt;/b&gt; for sticking angle!</source> <translation type="unfinished"></translation> </message> </context> <context> <name>mNoisyHandler</name> <message> <source>DEBUG:</source> <translation type="unfinished"></translation> </message> <message> <source>WARNING:</source> <translation type="unfinished"></translation> </message> <message> <source>CRITICAL:</source> <translation type="unfinished"></translation> </message> <message> <source>FATAL:</source> <translation type="unfinished"></translation> </message> <message> <source>INFO:</source> <translation type="unfinished"></translation> </message> <message> <source>Warning</source> <translation type="unfinished"></translation> </message> <message> <source>Critical error</source> <translation type="unfinished"></translation> </message> <message> <source>Fatal error</source> <translation type="unfinished"></translation> </message> <message> <source>Information</source> <translation type="unfinished"></translation> </message> </context> <context> <name>vNoisyHandler</name> <message> <source>DEBUG:</source> <translation type="unfinished"></translation> </message> <message> <source>WARNING:</source> <translation type="unfinished"></translation> </message> <message> <source>CRITICAL:</source> <translation type="unfinished"></translation> </message> <message> <source>FATAL:</source> <translation type="unfinished"></translation> </message> <message> <source>INFO:</source> <translation type="unfinished"></translation> </message> <message> <source>Warning.</source> <translation type="unfinished"></translation> </message> <message> <source>Critical error.</source> <translation type="unfinished"></translation> </message> <message> <source>Fatal error.</source> <translation type="unfinished"></translation> </message> <message> <source>Information.</source> <translation type="unfinished"></translation> </message> </context> </TS>
FashionFreedom/Seamly2D
share/translations/seamly2d_id_ID.ts
TypeScript
gpl-3.0
356,916
<?php $auth = "24\tLewis Carroll"; $n = sscanf($auth, "%d\t%s %s", $id, $first, $last); echo "<pre><author id='$id'> <firstname>$first</firstname> <surname>$last</surname> </author></pre>\n"; $auth1 = "div.class#id(style:$style){phpcode}"; $n1 = sscanf($auth1, "%[^.].%s#%s(%s){%s}",$tagname,$class,$id,$attr,$phpcode); echo "tagname: $tagname<br>class: $class<br>id: $id<br>attr: $attr<br>phpcode: $phpcode";
madcaplaughs/Qwik-PHP
temp/V2VkLCAxNCBTZXAgMTEgMTM6MDA6MDYgKzA1MzA23642.php
PHP
gpl-3.0
418
/* Copyright (C) 2015, Embecosm Limited This file is part of MAGEEC 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/>. */ //===---------------------------- MAGEEC driver ---------------------------===// // // This implements the standalone driver for the MAGEEC framework. This // provides the ability to train the database to the user, as well as a // number of other standalone utilites needed by MAGEEC // //===----------------------------------------------------------------------===// #include "mageec/Database.h" #include "mageec/Framework.h" #include "mageec/ML/C5.h" #include "mageec/ML/1NN.h" #include "mageec/Util.h" #include <fstream> #include <memory> #include <set> #include <sstream> namespace mageec { /// \enum DriverMode /// /// \brief Mode which the driver is running in enum class DriverMode { /// No mode, only debug utilities available kNone, /// Database creation mode kCreate, /// Database appending mode kAppend, /// Training mode kTrain, /// Mode to add results from a file kAddResults, /// Mode to garbage collect stale entries in the file kGarbageCollect }; } // end of namespace mageec using namespace mageec; /// \brief Print out the version of the MAGEEC framework static void printVersion(const Framework &framework) { util::out() << MAGEEC_PREFIX "Framework version: " << static_cast<std::string>(framework.getVersion()) << '\n'; } /// \brief Print out the version of the database /// /// \return 0 on success, 1 if the database could not be opened. static int printDatabaseVersion(Framework &framework, const std::string &db_path) { std::unique_ptr<Database> db = framework.getDatabase(db_path, false); if (!db) { MAGEEC_ERR("Error retrieving database. The database may not exist, " "or you may not have sufficient permissions to read it"); return -1; } util::out() << MAGEEC_PREFIX "Database version: " << static_cast<std::string>(db->getVersion()) << '\n'; return 0; } /// \brief Print out a help string static void printHelp() { util::out() << "Usage: mageec [options]\n" " mageec foo.db <mode> [options]\n" "\n" "Utility methods used alongside the MAGEEC framework. Used to create a new\n" "database, train an existing database, add results, or access other\n" "framework functionality.\n" "\n" "mode:\n" " --create Create a new empty database.\n" " --train Train an existing database, using machine\n" " learners provided via the --ml flag\n" " --garbage-collect Delete anything from the database which is not\n" " associated with a result\n" " --add-results <arg> Add results from the provided file into the\n" " database\n" "\n" "options:\n" " --help Print this help information\n" " --version Print the version of the MAGEEC framework\n" " --debug Enable debug output in the framework\n" " --database-version Print the version of the provided database\n" " --ml <arg> string or shared object identifying a machine\n" " learner interface to be used\n" " --print-ml-interfaces Print the interfaces registered with the MAGEEC\n" " framework, and therefore usable for training and\n" " decision making\n" " --print-mls Print information about the machine learners\n" " available to make compiler configuration\n" " decisions\n" // FIXME: ml-config " --metric <arg> Adds a new metric which the provided machine\n" " learners should be trained with\n" "\n" "examples:\n" " mageec --help --version\n" " mageec foo.db --create\n" " mageec bar.db --train --ml path/to/ml_plugin.so\n" " mageec baz.db --train --ml deadbeef-ca75-4096-a935-15cabba9e5\n"; } /// \brief Retrieve or load machine learners provided on the command line /// /// \param framework The framework to register the machine learners with /// \param ml_strs A list of strings from the command line to be parsed /// and loaded into the framework. /// /// \return A list of names of loaded machine learners, which may be empty /// if none were successfully loaded. static std::set<std::string> getMachineLearners(Framework &framework, std::set<std::string> ml_strs) { // Load machine learners std::set<std::string> mls; for (auto str : ml_strs) { MAGEEC_DEBUG("Retrieving machine learner '" << str << "'"); // Try and parse the argument as a string identifier of a machine learner if (framework.hasMachineLearner(str)) { MAGEEC_DEBUG("Found machine learner '" << str << "'"); } else { // Not a string identifier, try and load as a shared object str = framework.loadMachineLearner(str); if (str != "") { MAGEEC_DEBUG("Loading machine learner from library"); } else { MAGEEC_WARN("Unable to load machine learner '" << str << "'. This machine learner will be ignored"); continue; } } assert(str != ""); // add the string identifier to the machine learners mls.insert(str); } if (mls.empty()) { MAGEEC_ERR("No machine learners were successfully loaded"); return std::set<std::string>(); } MAGEEC_DEBUG("Retrieved " << mls.size() << " machine learners"); return mls; } /// \brief Print a description of all of the machine learners trained /// for this database. /// /// If a database is not provided, then print the machine learners which /// do not require training. /// /// \param framework Framework holding the machine learner interface /// \param db_path Path to the database holding the trained machine learners /// /// \return true on success static bool printTrainedMLs(Framework &framework, const util::Option<std::string> db_path) { // Add any machine learners which do not require training (and therefore // do not have any entry in the database) std::vector<TrainedML> trained_mls; for (const auto ml : framework.getMachineLearners()) { if (!ml->requiresTraining()) { trained_mls.push_back(TrainedML(*ml)); } } if (db_path) { std::unique_ptr<Database> db = framework.getDatabase(db_path.get(), false); if (!db) { MAGEEC_ERR("Error retrieving database. The database may not exist, " "or you may not have sufficient permissions to read it"); return false; } // Add trained machine learners from the database for (const auto &ml : db->getTrainedMachineLearners()) { trained_mls.push_back(ml); } } // Print out the trained machine learners for (auto &ml : trained_mls) { util::out() << ml.getName() << '\n' << ml.getMetric() << "\n\n"; } return true; } /// \brief Print a description of all of the machine learner interfaces /// known by the framework. /// /// \param framework Framework holding the machine learner interfaces static void printMLInterfaces(Framework &framework) { std::set<IMachineLearner *> mls = framework.getMachineLearners(); for (const auto *ml : mls) { util::out() << ml->getName() << '\n'; } } /// \brief Create a new database /// /// \param framework Framework instance to create the database /// \param db_path Path of the database to be created /// /// \return true on success, false if the database could not be created. static bool createDatabase(Framework &framework, const std::string &db_path) { std::unique_ptr<Database> db = framework.getDatabase(db_path, true); if (!db) { MAGEEC_ERR("Error creating new database. The database may already exist, " "or you may not have sufficient permissions to create the " "file"); return false; } return true; } /// \brief Append one database to another /// /// \param framework Framework instance to load the databases /// \param db_path Database to be appended to /// \param append_db_path Database to append /// /// \return true on success, false if the database could not be appended static bool appendDatabase(Framework &framework, const std::string &db_path, const std::string &append_db_path) { std::unique_ptr<Database> db = framework.getDatabase(db_path, false); if (!db) { MAGEEC_ERR("Error loading database '" + db_path + "'. The database may not " "exist, or you may not have sufficient permissions to " "read/write to it"); return false; } std::unique_ptr<Database> append_db = framework.getDatabase(append_db_path, false); if (!append_db) { MAGEEC_ERR("Error loading database for appending '" + append_db_path + "'. " "The database may not exist, or you may not have sufficient " "permissions to read/write to it"); return false; } return db->appendDatabase(*append_db); } /// \brief Train a database /// /// \param framework Framework instance to load the database /// \param db_path Path of the database to train /// \param mls Machine learners to train /// \param metric_strs Metrics to train for /// /// \return true on success, false if the database could not be trained. static bool trainDatabase(Framework &framework, const std::string &db_path, const std::set<std::string> mls, const std::set<std::string> &metric_strs) { assert(metric_strs.size() > 0); // Parse the metrics we are training against. MAGEEC_DEBUG("Parsing training metrics"); std::set<std::string> metrics; for (auto metric : metric_strs) { metrics.insert(metric); } if (metrics.size() == 0) { MAGEEC_ERR("No metrics specified"); return false; } // The database to be trained. MAGEEC_DEBUG("Retrieving database '" << db_path << "' for training"); std::unique_ptr<Database> db = framework.getDatabase(db_path, false); if (!db) { MAGEEC_ERR("Error retrieving database. The database may not exist, " "or you may not have sufficient permissions to read it"); return false; } // Train against every combination of provided machine learner, metric, and // class of features. This will insert training blobs generated by the // machine learner into the database. for (auto ml : mls) { for (auto metric : metrics) { MAGEEC_DEBUG("Training for metric: " << metric); for (auto feature_class = FeatureClass::kFIRST_FEATURE_CLASS; feature_class <= FeatureClass::kLAST_FEATURE_CLASS; /*empty*/) { db->trainMachineLearner(ml, feature_class, metric); feature_class = static_cast<FeatureClass>(static_cast<TypeID>(feature_class) + 1); } } } return true; } /// \brief parseResults from an results file /// /// \param result_path Path for the results file /// /// \return Map from a CompilationID and identifier for the program unit, to /// the result value as a double. static util::Option<std::map<std::pair<CompilationID, std::string>, double>> parseResults(const std::string &result_path) { std::map<std::pair<CompilationID, std::string>, double> results; MAGEEC_DEBUG("Opening file '" << result_path << "' to parse results"); std::ifstream result_file(result_path); if (!result_file) { MAGEEC_ERR("Could not open results file '" << result_path << "', the " "file may not exist, or you may not have permissions to " "read it"); return nullptr; } std::string line; while (std::getline(result_file, line)) { std::string id_str; std::string metric_str; std::string value_str; auto line_it = line.begin(); // file name string std::string tmp_str; for (; line_it != line.end() && *line_it != ','; line_it++) tmp_str.push_back(*line_it); if (line_it == line.end() || tmp_str.size() == 0) { MAGEEC_ERR("Malformed results file line\n" << line); continue; } assert(*line_it == ','); line_it++; // compilation type for (; line_it != line.end() && *line_it != ','; line_it++) tmp_str.push_back(*line_it); if (line_it == line.end() || tmp_str.size() == 0) { MAGEEC_ERR("Malformed results file line\n" << line); continue; } assert(*line_it == ','); line_it++; // compilation name for (; line_it != line.end() && *line_it != ','; line_it++) tmp_str.push_back(*line_it); if (line_it == line.end() || tmp_str.size() == 0) { MAGEEC_ERR("Malformed results file line\n" << line); continue; } assert(*line_it == ','); line_it++; // Read the identifier identifying that this is a "result" field // Check that this is a result line std::string type_str; for (; line_it != line.end() && *line_it != ','; line_it++) type_str.push_back(*line_it); if (line_it == line.end() || type_str.size() == 0) { MAGEEC_ERR("Malformed results file line\n" << line); continue; } // If it's not a result line, ignore it if (type_str != "result") continue; assert(*line_it == ','); line_it++; // read the compilation id for (; line_it != line.end() && *line_it != ','; line_it++) id_str.push_back(*line_it); if (line_it == line.end() || id_str.size() == 0) { MAGEEC_ERR("Malformed results file line\n" << line); continue; } assert(*line_it == ','); line_it++; // read the metric string for (; line_it != line.end() && *line_it != ','; line_it++) metric_str.push_back(*line_it); if (line_it == line.end() || metric_str.size() == 0) { MAGEEC_WARN("Malformed results file line\n" << line); continue; } assert(*line_it == ','); line_it++; // read the result value string for (; line_it != line.end() && *line_it != ','; line_it++) value_str.push_back(*line_it); if (line_it != line.end() || value_str.size() == 0) { // junk on the end of the line MAGEEC_WARN("Malformed results file line\n" << line); continue; } // Convert each field to its expected type. uint64_t tmp; std::istringstream id_stream(id_str); id_stream >> tmp; if (id_stream.fail()) { MAGEEC_ERR("Malformed compilation id in results file line:\n" << line); return nullptr; } CompilationID compilation_id = static_cast<CompilationID>(tmp); double value; std::istringstream value_stream(value_str); value_stream >> value; if (id_stream.fail()) { MAGEEC_ERR("Malformed result value '" << value_str << "' in result " "file line:\n" << line); return nullptr; } // Add the now parsed result into the dataset if (results.count({compilation_id, metric_str})) { MAGEEC_WARN("Multiple results for compilation id '" << id_str << "'. " "compilation id will be ignored"); } else { results.insert({{compilation_id, metric_str}, value}); } } return results; } /// \brief Parse results and add them to a database /// /// \param framework Framework instance to load the database /// \param db_path Path to the database to add the result to /// \param result_path Path for the results file /// /// \return true on successful addition of the results, false otherwise static bool addResults(Framework &framework, const std::string &db_path, const std::string &results_path) { std::unique_ptr<Database> db = framework.getDatabase(db_path, false); if (!db) { MAGEEC_ERR("Error retrieving database. The database may not exist, " "or you may not have sufficient permissions to read it"); return false; } // Parse the results file, then add them to the database. auto results = parseResults(results_path); if (!results) { MAGEEC_ERR("Error parsing results file"); return false; } if (results.get().size() == 0) { MAGEEC_WARN("No results found in the provided file, nothing will be " "added to the database"); return true; } MAGEEC_DEBUG("Adding parsed results to the database"); db->addResults(results.get()); return true; } static bool garbageCollect(Framework &framework, const std::string &db_path) { std::unique_ptr<Database> db = framework.getDatabase(db_path, false); if (!db) { MAGEEC_ERR("Error retrieving database. The database may not exist, " "or you may not have sufficient permissions to read it"); return false; } MAGEEC_DEBUG("Garbage collecting unreachable values from the database"); db->garbageCollect(); return true; } /// \brief Entry point for the MAGEEC driver int main(int argc, const char *argv[]) { DriverMode mode = DriverMode::kNone; // The database to be created or trained util::Option<std::string> db_str; // The second database to be appended when in 'append' mode util::Option<std::string> append_db_str; // Metrics to train the machine learners std::set<std::string> metric_strs; // Machine learners to train std::set<std::string> ml_strs; // The path to the results to be inserted into the database util::Option<std::string> results_path; bool with_db = false; bool with_metric = false; bool with_ml = false; bool with_db_version = false; bool with_debug = false; bool with_sql_trace = false; bool with_help = false; bool with_print_ml_interfaces = false; bool with_print_mls = false; bool with_version = false; for (int i = 1; i < argc; ++i) { std::string arg = argv[i]; // If this is the first argument, it may specify the database which the // tool is to use. if (i == 1) { if (arg[0] != '-') { db_str = arg; with_db = true; continue; } } // If a database is specified, then the second argument *might* be the // mode if ((i == 2) && with_db) { if (arg == "--create") { mode = DriverMode::kCreate; continue; } else if (arg == "--append") { ++i; if (i >= argc) { MAGEEC_ERR("No second database provided for '--append' mode"); return -1; } append_db_str = std::string(argv[i]); mode = DriverMode::kAppend; continue; } else if (arg == "--add-results") { ++i; if (i >= argc) { MAGEEC_ERR("No results file provided for '--add-results' mode"); return -1; } results_path = std::string(argv[i]); mode = DriverMode::kAddResults; continue; } else if (arg == "--train") { mode = DriverMode::kTrain; continue; } else if (arg == "--garbage-collect") { mode = DriverMode::kGarbageCollect; continue; } } // Common flags if (arg == "--help") { with_help = true; } else if (arg == "--version") { with_version = true; } else if (arg == "--debug") { with_debug = true; } else if (arg == "--sql-trace") { with_sql_trace = true; } else if (arg == "--print-ml-interfaces") { with_print_ml_interfaces = true; } else if (arg == "--print-mls") { with_print_mls = true; } else if (arg == "--database-version") { with_db_version = true; } else if (arg == "--metric") { ++i; if (i >= argc) { MAGEEC_ERR("No '--metric' value provided"); return -1; } metric_strs.insert(std::string(argv[i])); with_metric = true; } else if (arg == "--ml") { ++i; if (i >= argc) { MAGEEC_ERR("No '--ml' value provided"); return -1; } ml_strs.insert(std::string(argv[i])); with_ml = true; } else if (arg == "--add-results") { MAGEEC_ERR("'--add-results' must be the second argument"); return -1; } else if (arg == "--append") { MAGEEC_ERR("'--append' must be the second argument"); return -1; } else { MAGEEC_ERR("Unrecognized argument: '" << arg << "'"); return -1; } } // Errors if (mode == DriverMode::kTrain && !with_ml) { MAGEEC_ERR("Training mode specified without machine learners"); return -1; } if (mode == DriverMode::kTrain && !with_metric) { MAGEEC_ERR("Training mode specified without any metric to train for"); return -1; } // Warnings if (with_db_version && !with_db) { MAGEEC_WARN("Cannot get database version as no database was specified"); } // Unused arguments if ((mode == DriverMode::kNone) || (mode == DriverMode::kCreate) || (mode == DriverMode::kAppend) || (mode == DriverMode::kAddResults) || (mode == DriverMode::kGarbageCollect)) { if (with_metric) { MAGEEC_WARN("--metric arguments will be ignored for the specified mode"); } if (with_ml) { MAGEEC_WARN("--ml arguments will be ignored for the specified mode"); } } // Initialize the framework, and register some built in machine learners // so that they can be selected by name by the user. Framework framework(with_debug, with_sql_trace); // C5 classifier MAGEEC_DEBUG("Registering C5.0 machine learner interface"); std::unique_ptr<IMachineLearner> c5_ml(new C5Driver()); framework.registerMachineLearner(std::move(c5_ml)); MAGEEC_DEBUG("Register 1-NN machine learner interface"); std::unique_ptr<IMachineLearner> nn_ml(new OneNN()); framework.registerMachineLearner(std::move(nn_ml)); // Get the machine learners provided on the command line std::set<std::string> mls; if (with_ml) { assert(ml_strs.size() != 0); mls = getMachineLearners(framework, ml_strs); if (mls.size() <= 0) { return -1; } } // Handle common arguments if (with_version) { printVersion(framework); } if (with_help) { printHelp(); } if (with_db_version) { if (!printDatabaseVersion(framework, db_str.get())) { return -1; } } if (with_print_mls) { if (!printTrainedMLs(framework, db_str)) { return -1; } } if (with_print_ml_interfaces) { printMLInterfaces(framework); } // Handle modes switch (mode) { case DriverMode::kNone: return 0; case DriverMode::kCreate: if (!createDatabase(framework, db_str.get())) { return -1; } return 0; case DriverMode::kAppend: if (!appendDatabase(framework, db_str.get(), append_db_str.get())) { return -1; } return 0; case DriverMode::kTrain: if (!trainDatabase(framework, db_str.get(), mls, metric_strs)) { return -1; } return 0; case DriverMode::kAddResults: if (!addResults(framework, db_str.get(), results_path.get())) { return -1; } return 0; case DriverMode::kGarbageCollect: if (!garbageCollect(framework, db_str.get())) { return -1; } return 0; } return 0; }
mageec/mageec
lib/Driver.cpp
C++
gpl-3.0
23,825
/* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team * * 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/>. */ #ifdef HAVE_CONFIG_H # include "config.h" #include "claws-features.h" #endif #include "defs.h" #include <glib.h> #include <glib/gi18n.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> #include "alertpanel.h" #include "stock_pixmap.h" #include "mgutils.h" #include "addressbook.h" #include "addressitem.h" #include "addritem.h" #include "addrbook.h" #include "manage_window.h" #include "gtkutils.h" #include "filesel.h" #include "codeconv.h" #include "editaddress.h" #include "editaddress_other_attributes_ldap.h" #include "prefs_common.h" #include "menu.h" #include "combobox.h" /* transient data */ static struct _PersonEdit_dlg personeditdlg; static AddressBookFile *current_abf = NULL; static ItemPerson *current_person = NULL; static ItemFolder *current_parent_folder = NULL; static EditAddressPostUpdateCallback edit_person_close_post_update_cb = NULL; typedef enum { EMAIL_COL_EMAIL = 0, EMAIL_COL_ALIAS = 1, EMAIL_COL_REMARKS = 2 } PersonEditEMailColumnPos; typedef enum { ATTRIB_COL_NAME = 0, ATTRIB_COL_VALUE = 1 } PersonEditAttribColumnPos; #define EDITPERSON_WIDTH 520 #define EDITPERSON_HEIGHT 320 #ifndef GENERIC_UMPC # define EMAIL_N_COLS 3 # define EMAIL_COL_WIDTH_EMAIL 180 # define EMAIL_COL_WIDTH_ALIAS 80 #else # define EMAIL_N_COLS 1 # define EMAIL_COL_WIDTH_EMAIL 130 # define EMAIL_COL_WIDTH_ALIAS 130 #endif #ifndef GENERIC_UMPC # define ATTRIB_N_COLS 2 # define ATTRIB_COL_WIDTH_NAME 240 # define ATTRIB_COL_WIDTH_VALUE 0 #else # define ATTRIB_N_COLS 2 # define ATTRIB_COL_WIDTH_NAME 120 # define ATTRIB_COL_WIDTH_VALUE 120 #endif #define PAGE_BASIC 0 #define PAGE_EMAIL 1 #define PAGE_ATTRIBUTES 2 static gboolean addressbook_edit_person_close( gboolean cancelled ); static GList *edit_person_build_email_list(); static GList *edit_person_build_attrib_list(); static gchar* edit_person_get_common_name_from_widgets(void) { gchar *cn = NULL; /* cn must be freed by caller */ #ifndef GENERIC_UMPC { cn = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_name), 0, -1 ); if ( cn == NULL || *cn == '\0' ) { gchar *first = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_first), 0, -1 ); gchar *last = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_last), 0, -1 ); cn = g_strdup_printf("%s%s%s", first?first:"", (first && last && *first && *last)?" ":"", last?last:""); g_free(first); g_free(last); } if ( cn == NULL || *cn == '\0' ) { g_free(cn); cn = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_nick), 0, -1 );; } } #else { gchar *first = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_first), 0, -1 ); gchar *last = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_last), 0, -1 ); cn = g_strdup_printf("%s%s%s", first?first:"", (first && last && *first && *last)?" ":"", last?last:""); g_free(first); g_free(last); } #endif if ( cn != NULL ) g_strstrip(cn); return cn; } static void edit_person_status_show( gchar *msg ) { if( personeditdlg.statusbar != NULL ) { gtk_statusbar_pop( GTK_STATUSBAR(personeditdlg.statusbar), personeditdlg.status_cid ); if( msg ) { gtk_statusbar_push( GTK_STATUSBAR(personeditdlg.statusbar), personeditdlg.status_cid, msg ); } } } static void edit_person_cancel(GtkWidget *widget, gboolean *cancelled) { *cancelled = TRUE; if (prefs_common.addressbook_use_editaddress_dialog) gtk_main_quit(); else addressbook_edit_person_close( *cancelled ); } static void edit_person_ok(GtkWidget *widget, gboolean *cancelled) { GList *listEMail = edit_person_build_email_list(); GList *listAttrib = edit_person_build_attrib_list(); gchar *cn = edit_person_get_common_name_from_widgets(); if( (cn == NULL || *cn == '\0') && listEMail == NULL && listAttrib == NULL ) { gint val; val = alertpanel( _("Add New Person"), #ifndef GENERIC_UMPC _("Adding a new person requires at least one of the\n" "following values to be set:\n" " - Display Name\n" " - First Name\n" " - Last Name\n" " - Nickname\n" " - any email address\n" " - any additional attribute\n\n" "Click OK to keep editing this contact.\n" "Click Cancel to close without saving."), #else _("Adding a new person requires at least one of the\n" "following values to be set:\n" " - First Name\n" " - Last Name\n" " - any email address\n" " - any additional attribute\n\n" "Click OK to keep editing this contact.\n" "Click Cancel to close without saving."), #endif GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL, ALERTFOCUS_SECOND ); if( val == G_ALERTDEFAULT ) { edit_person_cancel(widget, cancelled); } g_free( cn ); return; } g_free( cn ); *cancelled = FALSE; if (prefs_common.addressbook_use_editaddress_dialog) gtk_main_quit(); else addressbook_edit_person_close( *cancelled ); } static gint edit_person_delete_event(GtkWidget *widget, GdkEventAny *event, gboolean *cancelled) { *cancelled = TRUE; if (prefs_common.addressbook_use_editaddress_dialog) gtk_main_quit(); else addressbook_edit_person_close( *cancelled ); return TRUE; } static gboolean edit_person_key_pressed(GtkWidget *widget, GdkEventKey *event, gboolean *cancelled) { if (prefs_common.addressbook_use_editaddress_dialog) { if (event && event->keyval == GDK_KEY_Escape) { *cancelled = TRUE; gtk_main_quit(); } } return FALSE; } static gchar *_title_new_ = NULL; static gchar *_title_edit_ = NULL; static void edit_person_set_widgets_title( gchar *text ) { gchar *label = NULL; cm_return_if_fail( text != NULL ); gtk_label_set_text(GTK_LABEL(personeditdlg.title), ""); label = g_markup_printf_escaped("<b>%s</b>", text); gtk_label_set_markup(GTK_LABEL(personeditdlg.title), label); g_free(label); } static void edit_person_set_window_title( gint pageNum ) { gchar *sTitle; if( _title_new_ == NULL ) { _title_new_ = g_strdup( _("Add New Person") ); _title_edit_ = g_strdup( _("Edit Person Details") ); } if( pageNum == PAGE_BASIC ) { if( personeditdlg.editNew ) { if (prefs_common.addressbook_use_editaddress_dialog) gtk_window_set_title( GTK_WINDOW(personeditdlg.container), _title_new_ ); else edit_person_set_widgets_title( _title_new_ ); } else { if (prefs_common.addressbook_use_editaddress_dialog) gtk_window_set_title( GTK_WINDOW(personeditdlg.container), _title_edit_ ); else edit_person_set_widgets_title( _title_edit_ ); } } else { if( personeditdlg.entry_name == NULL ) { sTitle = g_strdup( _title_edit_ ); } else { gchar *name; name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_name), 0, -1 ); g_strstrip(name); if ( *name != '\0' ) sTitle = g_strdup_printf( "%s - %s", _title_edit_, name ); else sTitle = g_strdup( _title_edit_ ); g_free( name ); } if (prefs_common.addressbook_use_editaddress_dialog) gtk_window_set_title( GTK_WINDOW(personeditdlg.container), sTitle ); else edit_person_set_widgets_title( sTitle ); g_free( sTitle ); } } static void edit_person_email_clear( gpointer data ) { gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_email), "" ); gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_alias), "" ); gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_remarks), "" ); } static void edit_person_attrib_clear( gpointer data ) { if (!personeditdlg.ldap) { gtk_entry_set_text( GTK_ENTRY(gtk_bin_get_child(GTK_BIN((personeditdlg.entry_atname)))), "" ); gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_atvalue), "" ); } } static void edit_person_switch_page( GtkNotebook *notebook, gpointer page, gint pageNum, gpointer user_data) { edit_person_set_window_title( pageNum ); edit_person_status_show( "" ); } /* * Load clist with a copy of person's email addresses. */ static void edit_person_load_email( ItemPerson *person ) { GList *node = person->listEMail; GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_email); gchar *text[ EMAIL_N_COLS ]; while( node ) { ItemEMail *emorig = ( ItemEMail * ) node->data; ItemEMail *email = addritem_copyfull_item_email( emorig ); gint row; text[ EMAIL_COL_EMAIL ] = email->address; #ifndef GENERIC_UMPC text[ EMAIL_COL_ALIAS ] = email->obj.name; text[ EMAIL_COL_REMARKS ] = email->remarks; #endif row = gtk_cmclist_append( clist, text ); gtk_cmclist_set_row_data( clist, row, email ); node = g_list_next( node ); } } static void edit_person_email_list_selected( GtkCMCList *clist, gint row, gint column, GdkEvent *event, gpointer data ) { ItemEMail *email = gtk_cmclist_get_row_data( clist, row ); if( email ) { if( email->address ) gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_email), email->address ); if( ADDRITEM_NAME(email) ) gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_alias), ADDRITEM_NAME(email) ); if( email->remarks ) gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_remarks), email->remarks ); if (!personeditdlg.read_only) { gtk_widget_set_sensitive(personeditdlg.email_del, TRUE); gtk_widget_set_sensitive(personeditdlg.email_up, row > 0); gtk_widget_set_sensitive(personeditdlg.email_down, gtk_cmclist_get_row_data(clist, row + 1) != NULL); } } else { gtk_widget_set_sensitive(personeditdlg.email_del, FALSE); gtk_widget_set_sensitive(personeditdlg.email_up, FALSE); gtk_widget_set_sensitive(personeditdlg.email_down, FALSE); } personeditdlg.rowIndEMail = row; edit_person_status_show( NULL ); } static void edit_person_email_move( gint dir ) { GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_email); gint row = personeditdlg.rowIndEMail + dir; ItemEMail *email = gtk_cmclist_get_row_data( clist, row ); if( email ) { gtk_cmclist_row_move( clist, personeditdlg.rowIndEMail, row ); personeditdlg.rowIndEMail = row; if (!personeditdlg.read_only) { gtk_widget_set_sensitive(personeditdlg.email_up, row > 0); gtk_widget_set_sensitive(personeditdlg.email_down, gtk_cmclist_get_row_data(clist, row + 1) != NULL); } } else { gtk_widget_set_sensitive(personeditdlg.email_up, FALSE); gtk_widget_set_sensitive(personeditdlg.email_down, FALSE); } edit_person_email_clear( NULL ); edit_person_status_show( NULL ); } static void edit_person_email_move_up( gpointer data ) { edit_person_email_move( -1 ); } static void edit_person_email_move_down( gpointer data ) { edit_person_email_move( +1 ); } static void edit_person_email_delete( gpointer data ) { GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_email); gint row = personeditdlg.rowIndEMail; ItemEMail *email = gtk_cmclist_get_row_data( clist, row ); edit_person_email_clear( NULL ); if( email ) { /* Remove list entry */ gtk_cmclist_remove( clist, row ); addritem_free_item_email( email ); email = NULL; } /* Position hilite bar */ email = gtk_cmclist_get_row_data( clist, row ); if( ! email ) { personeditdlg.rowIndEMail = -1 + row; } if (!personeditdlg.read_only) { gtk_widget_set_sensitive(personeditdlg.email_del, gtk_cmclist_get_row_data(clist, 0) != NULL); gtk_widget_set_sensitive(personeditdlg.email_up, gtk_cmclist_get_row_data(clist, personeditdlg.rowIndEMail + 1) != NULL); gtk_widget_set_sensitive(personeditdlg.email_down, gtk_cmclist_get_row_data(clist, personeditdlg.rowIndEMail - 1) != NULL); } edit_person_status_show( NULL ); } static ItemEMail *edit_person_email_edit( gboolean *error, ItemEMail *email ) { ItemEMail *retVal = NULL; gchar *sEmail, *sAlias, *sRemarks, *sEmail_; *error = TRUE; sEmail_ = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_email), 0, -1 ); sAlias = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_alias), 0, -1 ); sRemarks = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_remarks), 0, -1 ); sEmail = mgu_email_check_empty( sEmail_ ); g_free( sEmail_ ); if( sEmail ) { if( email == NULL ) { email = addritem_create_item_email(); } addritem_email_set_address( email, sEmail ); addritem_email_set_alias( email, sAlias ); addritem_email_set_remarks( email, sRemarks ); retVal = email; *error = FALSE; } else { edit_person_status_show( _( "An Email address must be supplied." ) ); } g_free( sEmail ); g_free( sAlias ); g_free( sRemarks ); return retVal; } static void edit_person_email_modify( gpointer data ) { gboolean errFlg = FALSE; GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_email); gint row = personeditdlg.rowIndEMail; ItemEMail *email = gtk_cmclist_get_row_data( clist, row ); if( email ) { edit_person_email_edit( &errFlg, email ); if( ! errFlg ) { gtk_cmclist_set_text( clist, row, EMAIL_COL_EMAIL, email->address ); gtk_cmclist_set_text( clist, row, EMAIL_COL_ALIAS, email->obj.name ); gtk_cmclist_set_text( clist, row, EMAIL_COL_REMARKS, email->remarks ); edit_person_email_clear( NULL ); } } } static void edit_person_email_add( gpointer data ) { GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_email); gboolean errFlg = FALSE; ItemEMail *email = NULL; gint row = personeditdlg.rowIndEMail; if( gtk_cmclist_get_row_data( clist, row ) == NULL ) row = 0; email = edit_person_email_edit( &errFlg, NULL ); if( ! errFlg ) { gchar *text[ EMAIL_N_COLS ]; text[ EMAIL_COL_EMAIL ] = email->address; #ifndef GENERIC_UMPC text[ EMAIL_COL_ALIAS ] = email->obj.name; text[ EMAIL_COL_REMARKS ] = email->remarks; #endif row = gtk_cmclist_insert( clist, 1 + row, text ); gtk_cmclist_set_row_data( clist, row, email ); gtk_cmclist_select_row( clist, row, 0 ); edit_person_email_clear( NULL ); } } /* * Comparison using cell contents (text in first column). Used for sort * address index widget. */ static gint edit_person_attrib_compare_func( GtkCMCList *clist, gconstpointer ptr1, gconstpointer ptr2 ) { GtkCMCell *cell1 = ((GtkCMCListRow *)ptr1)->cell; GtkCMCell *cell2 = ((GtkCMCListRow *)ptr2)->cell; gchar *name1 = NULL, *name2 = NULL; if( cell1 ) name1 = cell1->u.text; if( cell2 ) name2 = cell2->u.text; if( ! name1 ) return ( name2 != NULL ); if( ! name2 ) return -1; return g_utf8_collate( name1, name2 ); } static gboolean list_find_attribute(const gchar *attr) { GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_attrib); UserAttribute *attrib; gint row = 0; while( (attrib = gtk_cmclist_get_row_data( clist, row )) ) { if (!g_ascii_strcasecmp(attrib->name, attr)) { gtk_cmclist_select_row(clist, row, 0); return TRUE; } row++; } return FALSE; } static gboolean list_find_email(const gchar *addr) { GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_email); ItemEMail *email; gint row = 0; while( (email = gtk_cmclist_get_row_data( clist, row )) ) { if (!g_ascii_strcasecmp(email->address, addr)) { gtk_cmclist_select_row(clist, row, 0); return TRUE; } row++; } return FALSE; } /* * Load clist with a copy of person's email addresses. */ static void edit_person_load_attrib( ItemPerson *person ) { GList *node = person->listAttrib; GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_attrib); gchar *text[ ATTRIB_N_COLS ]; while( node ) { UserAttribute *atorig = ( UserAttribute * ) node->data; UserAttribute *attrib = addritem_copy_attribute( atorig ); gint row; debug_print("name: %s value: %s\n", attrib->name, attrib->value); text[ ATTRIB_COL_NAME ] = attrib->name; text[ ATTRIB_COL_VALUE ] = attrib->value; row = gtk_cmclist_append( clist, text ); gtk_cmclist_set_row_data( clist, row, attrib ); node = g_list_next( node ); } } static void edit_person_attrib_list_selected( GtkCMCList *clist, gint row, gint column, GdkEvent *event, gpointer data ) { UserAttribute *attrib = gtk_cmclist_get_row_data( clist, row ); if( attrib && !personeditdlg.read_only && !personeditdlg.ldap ) { gtk_entry_set_text( GTK_ENTRY(gtk_bin_get_child(GTK_BIN((personeditdlg.entry_atname))) ), attrib->name ); gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_atvalue), attrib->value ); gtk_widget_set_sensitive(personeditdlg.attrib_del, TRUE); } else { gtk_widget_set_sensitive(personeditdlg.attrib_del, FALSE); } personeditdlg.rowIndAttrib = row; edit_person_status_show( NULL ); } static void edit_person_attrib_delete( gpointer data ) { GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_attrib); gint row = personeditdlg.rowIndAttrib; UserAttribute *attrib = gtk_cmclist_get_row_data( clist, row ); edit_person_attrib_clear( NULL ); if( attrib ) { /* Remove list entry */ gtk_cmclist_remove( clist, row ); addritem_free_attribute( attrib ); attrib = NULL; } /* Position hilite bar */ attrib = gtk_cmclist_get_row_data( clist, row ); if( ! attrib ) { personeditdlg.rowIndAttrib = -1 + row; } if (!personeditdlg.read_only && !personeditdlg.ldap) gtk_widget_set_sensitive(personeditdlg.attrib_del, gtk_cmclist_get_row_data(clist, 0) != NULL); edit_person_status_show( NULL ); } static UserAttribute *edit_person_attrib_edit( gboolean *error, UserAttribute *attrib ) { UserAttribute *retVal = NULL; gchar *sName, *sValue, *sName_, *sValue_; *error = TRUE; sName_ = gtk_editable_get_chars( GTK_EDITABLE(gtk_bin_get_child(GTK_BIN((personeditdlg.entry_atname)))), 0, -1 ); sValue_ = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_atvalue), 0, -1 ); sName = mgu_email_check_empty( sName_ ); sValue = mgu_email_check_empty( sValue_ ); g_free( sName_ ); g_free( sValue_ ); if( sName && sValue ) { if( attrib == NULL ) { attrib = addritem_create_attribute(); } addritem_attrib_set_name( attrib, sName ); addritem_attrib_set_value( attrib, sValue ); retVal = attrib; *error = FALSE; } else { edit_person_status_show( _( "A Name and Value must be supplied." ) ); } g_free( sName ); g_free( sValue ); return retVal; } static void edit_person_attrib_modify( gpointer data ) { gboolean errFlg = FALSE; GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_attrib); gint row = personeditdlg.rowIndAttrib; UserAttribute *attrib = gtk_cmclist_get_row_data( clist, row ); if( attrib ) { edit_person_attrib_edit( &errFlg, attrib ); if( ! errFlg ) { gtk_cmclist_set_text( clist, row, ATTRIB_COL_NAME, attrib->name ); gtk_cmclist_set_text( clist, row, ATTRIB_COL_VALUE, attrib->value ); edit_person_attrib_clear( NULL ); } } } static void edit_person_attrib_add( gpointer data ) { GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_attrib); gboolean errFlg = FALSE; UserAttribute *attrib = NULL; gint row = personeditdlg.rowIndAttrib; if( gtk_cmclist_get_row_data( clist, row ) == NULL ) row = 0; attrib = edit_person_attrib_edit( &errFlg, NULL ); if( ! errFlg ) { gchar *text[ ATTRIB_N_COLS ]; text[ ATTRIB_COL_NAME ] = attrib->name; text[ ATTRIB_COL_VALUE ] = attrib->value; row = gtk_cmclist_insert( clist, 1 + row, text ); gtk_cmclist_set_row_data( clist, row, attrib ); gtk_cmclist_select_row( clist, row, 0 ); edit_person_attrib_clear( NULL ); } } /*! *\brief Save Gtk object size to prefs dataset */ static void edit_person_size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation) { cm_return_if_fail(allocation != NULL); prefs_common.addressbookeditpersonwin_width = allocation->width; prefs_common.addressbookeditpersonwin_height = allocation->height; } /* build edit person widgets, return a pointer to the main container of the widgetset (a vbox) */ static GtkWidget* addressbook_edit_person_widgets_create( GtkWidget* container, gboolean *cancelled ) { GtkWidget *vbox; GtkWidget *vnbox; GtkWidget *notebook; GtkWidget *hbbox; GtkWidget *ok_btn; GtkWidget *cancel_btn; vbox = gtk_vbox_new(FALSE, 4); gtk_container_set_border_width(GTK_CONTAINER(vbox), BORDER_WIDTH); gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(container), vbox); vnbox = gtk_vbox_new(FALSE, 4); gtk_container_set_border_width(GTK_CONTAINER(vnbox), 4); gtk_widget_show(vnbox); gtk_box_pack_start(GTK_BOX(vbox), vnbox, TRUE, TRUE, 0); /* Notebook */ notebook = gtk_notebook_new(); gtk_widget_show(notebook); gtk_box_pack_start(GTK_BOX(vnbox), notebook, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(notebook), 6); /* Button panel */ if (prefs_common.addressbook_use_editaddress_dialog) gtkut_stock_button_set_create(&hbbox, &cancel_btn, GTK_STOCK_CANCEL, &ok_btn, GTK_STOCK_OK, NULL, NULL); else gtkut_stock_with_text_button_set_create(&hbbox, &cancel_btn, GTK_STOCK_CANCEL, _("Discard"), &ok_btn, GTK_STOCK_OK, _("Apply"), NULL, NULL, NULL); gtk_box_pack_end(GTK_BOX(vnbox), hbbox, FALSE, FALSE, 0); gtk_widget_grab_default(ok_btn); g_signal_connect(G_OBJECT(ok_btn), "clicked", G_CALLBACK(edit_person_ok), cancelled); g_signal_connect(G_OBJECT(cancel_btn), "clicked", G_CALLBACK(edit_person_cancel), cancelled); g_signal_connect(G_OBJECT(notebook), "switch_page", G_CALLBACK(edit_person_switch_page), NULL ); gtk_widget_show_all(vbox); personeditdlg.notebook = notebook; personeditdlg.ok_btn = ok_btn; personeditdlg.cancel_btn = cancel_btn; return vbox; } static void addressbook_edit_person_dialog_create( gboolean *cancelled ) { GtkWidget *window; GtkWidget *hsbox; GtkWidget *vbox; GtkWidget *statusbar; static GdkGeometry geometry; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "editaddress"); /* gtk_container_set_border_width(GTK_CONTAINER(window), 0); */ gtk_window_set_title(GTK_WINDOW(window), _("Edit Person Data")); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_modal(GTK_WINDOW(window), TRUE); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(edit_person_delete_event), cancelled); g_signal_connect(G_OBJECT(window), "size_allocate", G_CALLBACK(edit_person_size_allocate_cb), cancelled); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(edit_person_key_pressed), cancelled); vbox = addressbook_edit_person_widgets_create(window, cancelled); /* Status line */ hsbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, BORDER_WIDTH); statusbar = gtk_statusbar_new(); gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH); if (!geometry.min_height) { geometry.min_width = EDITPERSON_WIDTH; geometry.min_height = EDITPERSON_HEIGHT; } gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry, GDK_HINT_MIN_SIZE); gtk_widget_set_size_request(window, prefs_common.addressbookeditpersonwin_width, prefs_common.addressbookeditpersonwin_height); personeditdlg.container = window; personeditdlg.statusbar = statusbar; personeditdlg.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Edit Person Dialog" ); } /* parent must be a box */ static void addressbook_edit_person_widgetset_create( GtkWidget *parent, gboolean *cancelled ) { GtkWidget *vbox; GtkWidget *label; if ( parent == NULL ) g_warning("addressbook_edit_person_widgetset_create: parent is NULL"); vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_end(GTK_BOX(parent), vbox, TRUE, TRUE, 0); label = gtk_label_new(_("Edit Person Data")); gtk_label_set_justify( GTK_LABEL(label), GTK_JUSTIFY_CENTER); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); addressbook_edit_person_widgets_create(vbox, cancelled); gtk_widget_set_size_request(vbox, EDITPERSON_WIDTH, EDITPERSON_HEIGHT); personeditdlg.container = vbox; personeditdlg.title = label; personeditdlg.statusbar = NULL; personeditdlg.status_cid = 0; } void addressbook_edit_person_widgetset_hide( void ) { if ( personeditdlg.container ) gtk_widget_hide( personeditdlg.container ); } static void addressbook_edit_person_set_picture(void) { GError *error = NULL; gchar *filename; int width, height, scalewidth, scaleheight; if (personeditdlg.ldap) return; if ( (filename = filesel_select_file_open(_("Choose a picture"), NULL)) ) { GdkPixbuf *pixbuf = NULL; gdk_pixbuf_get_file_info(filename, &width, &height); if ( width > 128 || height > 128 ) { if (width > height) { scaleheight = (height * 128) / width; scalewidth = 128; } else { scalewidth = (width * 128) / height; scaleheight = 128; } pixbuf = gdk_pixbuf_new_from_file_at_scale(filename, scalewidth, scaleheight, TRUE, &error); } else { pixbuf = gdk_pixbuf_new_from_file(filename, &error); } if (error) { alertpanel_error(_("Failed to import image: \n%s"), error->message); g_error_free(error); error = NULL; /* keep the previous picture if any */ g_free(filename); if (pixbuf) g_object_unref(pixbuf); return; } personeditdlg.picture_set = TRUE; cm_menu_set_sensitive("EditAddressPopup/UnsetPicture", personeditdlg.picture_set); g_free(filename); gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf); g_object_unref(pixbuf); } } static void addressbook_edit_person_clear_picture(void) { GdkPixbuf *pixbuf; stock_pixbuf_gdk(STOCK_PIXMAP_ANONYMOUS, &pixbuf); personeditdlg.picture_set = FALSE; cm_menu_set_sensitive("EditAddressPopup/UnsetPicture", personeditdlg.picture_set); gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf); } static void addressbook_edit_person_set_picture_menu_cb (GtkAction *action, gpointer data) { addressbook_edit_person_set_picture(); } static void addressbook_edit_person_unset_picture_menu_cb (GtkAction *action, gpointer data) { addressbook_edit_person_clear_picture(); } static GtkWidget *editaddr_popup_menu = NULL; static GtkActionEntry editaddr_popup_entries[] = { {"EditAddressPopup", NULL, "EditAddressPopup" }, {"EditAddressPopup/SetPicture", NULL, N_("_Set picture"), NULL, NULL, G_CALLBACK(addressbook_edit_person_set_picture_menu_cb) }, {"EditAddressPopup/UnsetPicture", NULL, N_("_Unset picture"), NULL, NULL, G_CALLBACK(addressbook_edit_person_unset_picture_menu_cb) }, }; static void addressbook_edit_person_set_picture_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) { if (event->button == 1) { addressbook_edit_person_set_picture(); } else { gtk_menu_popup(GTK_MENU(editaddr_popup_menu), NULL, NULL, NULL, NULL, event->button, event->time); } } static gboolean addressbook_edit_person_picture_popup_menu(GtkWidget *widget, gpointer data) { GdkEventButton event; event.button = 3; event.time = gtk_get_current_event_time(); addressbook_edit_person_set_picture_cb(NULL, &event, data); return TRUE; } static void addressbook_edit_person_page_basic( gint pageNum, gchar *pageLbl ) { GtkWidget *vbox; GtkWidget *hbox; GtkWidget *table; GtkWidget *label; GtkWidget *ebox_picture; GtkWidget *frame_picture; GtkWidget *entry_name; GtkWidget *entry_fn; GtkWidget *entry_ln; GtkWidget *entry_nn; const gchar *locale; gint top = 0; vbox = gtk_vbox_new( FALSE, 20 ); hbox = gtk_hbox_new( FALSE, 8 ); gtk_widget_show( vbox ); if (!editaddr_popup_menu) { cm_menu_create_action_group("EditAddressPopup", editaddr_popup_entries, G_N_ELEMENTS(editaddr_popup_entries), (gpointer)NULL); MENUITEM_ADDUI("/Menus", "EditAddressPopup", "EditAddressPopup", GTK_UI_MANAGER_MENU) MENUITEM_ADDUI("/Menus/EditAddressPopup", "SetPicture", "EditAddressPopup/SetPicture", GTK_UI_MANAGER_MENUITEM) MENUITEM_ADDUI("/Menus/EditAddressPopup", "UnsetPicture", "EditAddressPopup/UnsetPicture", GTK_UI_MANAGER_MENUITEM) editaddr_popup_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM( gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/EditAddressPopup")) ); } /* User's picture */ ebox_picture = gtk_event_box_new(); frame_picture = gtk_frame_new(_("Photo")); /* Room for a photo */ personeditdlg.image = gtk_image_new(); addressbook_edit_person_clear_picture(); gtk_container_add(GTK_CONTAINER(ebox_picture), personeditdlg.image); gtk_container_add(GTK_CONTAINER(frame_picture), ebox_picture); gtk_container_add(GTK_CONTAINER( personeditdlg.notebook ), hbox ); gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH ); gtk_container_set_border_width( GTK_CONTAINER (hbox), BORDER_WIDTH ); label = gtk_label_new_with_mnemonic( pageLbl ); gtk_widget_show( label ); gtk_box_pack_start(GTK_BOX(hbox), frame_picture, TRUE, TRUE, 0); gtk_notebook_set_tab_label( GTK_NOTEBOOK( personeditdlg.notebook ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( personeditdlg.notebook ), pageNum ), label ); g_signal_connect(G_OBJECT(ebox_picture), "popup-menu", G_CALLBACK(addressbook_edit_person_picture_popup_menu), NULL); g_signal_connect(G_OBJECT(ebox_picture), "button_press_event", G_CALLBACK(addressbook_edit_person_set_picture_cb), NULL); table = gtk_table_new( 3, 3, FALSE); #define ATTACH_ROW(text, entry) \ { \ label = gtk_label_new(text); \ gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), \ GTK_FILL, 0, 0, 0); \ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); \ \ entry = gtk_entry_new(); \ gtk_table_attach(GTK_TABLE(table), entry, 1, 2, top, (top + 1), \ GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); \ top++; \ } #define ATTACH_HIDDEN_ROW(text, entry) \ { \ entry = gtk_entry_new(); \ } #ifndef GENERIC_UMPC ATTACH_ROW(_("Display Name"), entry_name); #else ATTACH_HIDDEN_ROW(_("Display Name"), entry_name); #endif locale = conv_get_current_locale(); if (locale && (!g_ascii_strncasecmp(locale, "hu", 2) || !g_ascii_strncasecmp(locale, "ja", 2) || !g_ascii_strncasecmp(locale, "ko", 2) || !g_ascii_strncasecmp(locale, "vi", 2) || !g_ascii_strncasecmp(locale, "zh", 2))) { ATTACH_ROW(_("Last Name"), entry_ln); ATTACH_ROW(_("First Name"), entry_fn); } else { ATTACH_ROW(_("First Name"), entry_fn); ATTACH_ROW(_("Last Name"), entry_ln); } #ifndef GENERIC_UMPC ATTACH_ROW(_("Nickname"), entry_nn); #else ATTACH_HIDDEN_ROW(_("Nickname"), entry_nn); #endif #undef ATTACH_ROW #undef ATTACH_HIDDEN_ROW gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); gtk_box_pack_end(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); gtk_container_set_border_width( GTK_CONTAINER(table), 8 ); gtk_table_set_row_spacings(GTK_TABLE(table), 15); gtk_table_set_col_spacings(GTK_TABLE(table), 8); gtk_widget_show_all(vbox); personeditdlg.entry_name = entry_name; personeditdlg.entry_first = entry_fn; personeditdlg.entry_last = entry_ln; personeditdlg.entry_nick = entry_nn; } static gboolean email_adding = FALSE, email_saving = FALSE; static void edit_person_entry_email_changed (GtkWidget *entry, gpointer data) { gboolean non_empty = gtk_cmclist_get_row_data(GTK_CMCLIST(personeditdlg.clist_email), 0) != NULL; if (personeditdlg.read_only) return; if (gtk_entry_get_text(GTK_ENTRY(personeditdlg.entry_email)) == NULL || strlen(gtk_entry_get_text(GTK_ENTRY(personeditdlg.entry_email))) == 0) { gtk_widget_set_sensitive(personeditdlg.email_add,FALSE); gtk_widget_set_sensitive(personeditdlg.email_mod,FALSE); email_adding = FALSE; email_saving = FALSE; } else if (list_find_email(gtk_entry_get_text(GTK_ENTRY(personeditdlg.entry_email)))) { gtk_widget_set_sensitive(personeditdlg.email_add,FALSE); gtk_widget_set_sensitive(personeditdlg.email_mod,non_empty); email_adding = FALSE; email_saving = non_empty; } else { gtk_widget_set_sensitive(personeditdlg.email_add,TRUE); gtk_widget_set_sensitive(personeditdlg.email_mod,non_empty); email_adding = TRUE; email_saving = non_empty; } } static gboolean edit_person_entry_email_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data) { if (event && event->keyval == GDK_KEY_Return) { if (email_saving) edit_person_email_modify(NULL); else if (email_adding) edit_person_email_add(NULL); } return FALSE; } static void addressbook_edit_person_page_email( gint pageNum, gchar *pageLbl ) { GtkWidget *vbox; GtkWidget *hbox; GtkWidget *vboxl; GtkWidget *vboxb; GtkWidget *vbuttonbox; GtkWidget *buttonUp; GtkWidget *buttonDown; GtkWidget *buttonDel; GtkWidget *buttonMod; GtkWidget *buttonAdd; GtkWidget *table; GtkWidget *label; GtkWidget *clist_swin; GtkWidget *clist; GtkWidget *entry_email; GtkWidget *entry_alias; GtkWidget *entry_remarks; gint top; gchar *titles[ EMAIL_N_COLS ]; gint i; titles[ EMAIL_COL_EMAIL ] = _("Email Address"); #ifndef GENERIC_UMPC titles[ EMAIL_COL_ALIAS ] = _("Alias"); titles[ EMAIL_COL_REMARKS ] = _("Remarks"); #endif vbox = gtk_vbox_new( FALSE, 8 ); gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( personeditdlg.notebook ), vbox ); gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH ); label = gtk_label_new_with_mnemonic( pageLbl ); gtk_widget_show( label ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( personeditdlg.notebook ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( personeditdlg.notebook ), pageNum ), label ); /* Split into two areas */ hbox = gtk_hbox_new( FALSE, 0 ); gtk_container_add( GTK_CONTAINER( vbox ), hbox ); /* Address list */ vboxl = gtk_vbox_new( FALSE, 4 ); gtk_container_add( GTK_CONTAINER( hbox ), vboxl ); gtk_container_set_border_width( GTK_CONTAINER(vboxl), 4 ); clist_swin = gtk_scrolled_window_new( NULL, NULL ); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clist_swin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); clist = gtk_cmclist_new_with_titles( EMAIL_N_COLS, titles ); gtk_container_add( GTK_CONTAINER(clist_swin), clist ); gtk_cmclist_set_selection_mode( GTK_CMCLIST(clist), GTK_SELECTION_BROWSE ); gtk_cmclist_set_column_width( GTK_CMCLIST(clist), EMAIL_COL_EMAIL, EMAIL_COL_WIDTH_EMAIL ); gtk_cmclist_set_column_width( GTK_CMCLIST(clist), EMAIL_COL_ALIAS, EMAIL_COL_WIDTH_ALIAS ); for( i = 0; i < EMAIL_N_COLS; i++ ) gtk_widget_set_can_focus(GTK_CMCLIST(clist)->column[i].button, FALSE); /* Data entry area */ table = gtk_table_new( 4, 2, FALSE); #ifndef GENERIC_UMPC gtk_container_add( GTK_CONTAINER(vboxl), clist_swin ); gtk_box_pack_start(GTK_BOX(vboxl), table, FALSE, FALSE, 0); #else gtk_box_pack_start(GTK_BOX(vboxl), table, FALSE, FALSE, 0); gtk_container_add( GTK_CONTAINER(vboxl), clist_swin ); gtk_cmclist_column_titles_hide(GTK_CMCLIST(clist)); #endif gtk_container_set_border_width( GTK_CONTAINER(table), 4 ); gtk_table_set_row_spacings(GTK_TABLE(table), 4); gtk_table_set_col_spacings(GTK_TABLE(table), 4); entry_email = gtk_entry_new(); entry_alias = gtk_entry_new(); entry_remarks = gtk_entry_new(); /* First row */ top = 0; label = gtk_label_new(_("Email Address")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), entry_email, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); #ifndef GENERIC_UMPC /* Next row */ ++top; label = gtk_label_new(_("Alias")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), entry_alias, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); /* Next row */ ++top; label = gtk_label_new(_("Remarks")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), entry_remarks, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); #endif /* Button box */ vboxb = gtk_vbox_new( FALSE, 4 ); gtk_box_pack_start(GTK_BOX(hbox), vboxb, FALSE, FALSE, 2); vbuttonbox = gtk_vbutton_box_new(); gtk_button_box_set_layout( GTK_BUTTON_BOX(vbuttonbox), GTK_BUTTONBOX_START ); gtk_box_set_spacing( GTK_BOX(vbuttonbox), 8 ); gtk_container_set_border_width( GTK_CONTAINER(vbuttonbox), 4 ); gtk_container_add( GTK_CONTAINER(vboxb), vbuttonbox ); /* Buttons */ buttonUp = gtk_button_new_from_stock(GTK_STOCK_GO_UP); buttonDown = gtk_button_new_from_stock(GTK_STOCK_GO_DOWN); buttonDel = gtk_button_new_from_stock(GTK_STOCK_DELETE); buttonMod = gtk_button_new_from_stock(GTK_STOCK_SAVE); buttonAdd = gtk_button_new_from_stock(GTK_STOCK_ADD); #ifndef GENERIC_UMPC gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonUp ); gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonDown ); #endif gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonDel ); gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonMod ); gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonAdd ); gtk_widget_show_all(vbox); /* Event handlers */ g_signal_connect( G_OBJECT(clist), "select_row", G_CALLBACK( edit_person_email_list_selected), NULL ); g_signal_connect( G_OBJECT(buttonUp), "clicked", G_CALLBACK( edit_person_email_move_up ), NULL ); g_signal_connect( G_OBJECT(buttonDown), "clicked", G_CALLBACK( edit_person_email_move_down ), NULL ); g_signal_connect( G_OBJECT(buttonDel), "clicked", G_CALLBACK( edit_person_email_delete ), NULL ); g_signal_connect( G_OBJECT(buttonMod), "clicked", G_CALLBACK( edit_person_email_modify ), NULL ); g_signal_connect( G_OBJECT(buttonAdd), "clicked", G_CALLBACK( edit_person_email_add ), NULL ); g_signal_connect(G_OBJECT(entry_email), "changed", G_CALLBACK(edit_person_entry_email_changed), NULL); g_signal_connect(G_OBJECT(entry_email), "key_press_event", G_CALLBACK(edit_person_entry_email_pressed), NULL); g_signal_connect(G_OBJECT(entry_alias), "key_press_event", G_CALLBACK(edit_person_entry_email_pressed), NULL); g_signal_connect(G_OBJECT(entry_remarks), "key_press_event", G_CALLBACK(edit_person_entry_email_pressed), NULL); personeditdlg.clist_email = clist; personeditdlg.entry_email = entry_email; personeditdlg.entry_alias = entry_alias; personeditdlg.entry_remarks = entry_remarks; personeditdlg.email_up = buttonUp; personeditdlg.email_down = buttonDown; personeditdlg.email_del = buttonDel; personeditdlg.email_mod = buttonMod; personeditdlg.email_add = buttonAdd; } static gboolean attrib_adding = FALSE, attrib_saving = FALSE; static void edit_person_entry_att_changed (GtkWidget *entry, gpointer data) { gboolean non_empty = gtk_cmclist_get_row_data(GTK_CMCLIST(personeditdlg.clist_attrib), 0) != NULL; const gchar *atname; if (personeditdlg.read_only || personeditdlg.ldap) return; atname = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((personeditdlg.entry_atname))))); if ( atname == NULL || strlen(atname) == 0) { gtk_widget_set_sensitive(personeditdlg.attrib_add,FALSE); gtk_widget_set_sensitive(personeditdlg.attrib_mod,FALSE); attrib_adding = FALSE; attrib_saving = FALSE; } else if (list_find_attribute(atname)) { gtk_widget_set_sensitive(personeditdlg.attrib_add,FALSE); gtk_widget_set_sensitive(personeditdlg.attrib_mod,non_empty); attrib_adding = FALSE; attrib_saving = non_empty; } else { gtk_widget_set_sensitive(personeditdlg.attrib_add,TRUE); gtk_widget_set_sensitive(personeditdlg.attrib_mod,non_empty); attrib_adding = TRUE; attrib_saving = non_empty; } } static gboolean edit_person_entry_att_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data) { if (event && event->keyval == GDK_KEY_Return) { if (attrib_saving) edit_person_attrib_modify(NULL); else if (attrib_adding) edit_person_attrib_add(NULL); } return FALSE; } static void addressbook_edit_person_page_attrib( gint pageNum, gchar *pageLbl ) { GtkWidget *vbox; GtkWidget *hbox; GtkWidget *vboxl; GtkWidget *vboxb; GtkWidget *vbuttonbox; GtkWidget *buttonDel; GtkWidget *buttonMod; GtkWidget *buttonAdd; GtkWidget *table; GtkWidget *label; GtkWidget *clist_swin; GtkWidget *clist; GtkWidget *entry_name; GtkWidget *entry_value; gint top; gchar *titles[ ATTRIB_N_COLS ]; gint i; titles[ ATTRIB_COL_NAME ] = _("Name"); titles[ ATTRIB_COL_VALUE ] = _("Value"); vbox = gtk_vbox_new( FALSE, 8 ); gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( personeditdlg.notebook ), vbox ); gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH ); label = gtk_label_new_with_mnemonic( pageLbl ); gtk_widget_show( label ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( personeditdlg.notebook ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( personeditdlg.notebook ), pageNum ), label ); /* Split into two areas */ hbox = gtk_hbox_new( FALSE, 0 ); gtk_container_add( GTK_CONTAINER( vbox ), hbox ); /* Attribute list */ vboxl = gtk_vbox_new( FALSE, 4 ); gtk_container_add( GTK_CONTAINER( hbox ), vboxl ); gtk_container_set_border_width( GTK_CONTAINER(vboxl), 4 ); clist_swin = gtk_scrolled_window_new( NULL, NULL ); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clist_swin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); clist = gtk_cmclist_new_with_titles( ATTRIB_N_COLS, titles ); gtk_container_add( GTK_CONTAINER(clist_swin), clist ); gtk_cmclist_set_selection_mode( GTK_CMCLIST(clist), GTK_SELECTION_BROWSE ); gtk_cmclist_set_compare_func( GTK_CMCLIST(clist), edit_person_attrib_compare_func ); gtk_cmclist_set_auto_sort( GTK_CMCLIST(clist), TRUE ); gtk_cmclist_set_column_width( GTK_CMCLIST(clist), ATTRIB_COL_NAME, ATTRIB_COL_WIDTH_NAME ); gtk_cmclist_set_column_width( GTK_CMCLIST(clist), ATTRIB_COL_VALUE, ATTRIB_COL_WIDTH_VALUE ); for( i = 0; i < ATTRIB_N_COLS; i++ ) gtk_widget_set_can_focus(GTK_CMCLIST(clist)->column[i].button, FALSE); /* Data entry area */ #ifndef GENERIC_UMPC table = gtk_table_new( 4, 2, FALSE); gtk_container_add( GTK_CONTAINER(vboxl), clist_swin ); gtk_box_pack_start(GTK_BOX(vboxl), table, FALSE, FALSE, 0); #else table = gtk_table_new( 2, 4, FALSE); gtk_box_pack_start(GTK_BOX(vboxl), table, FALSE, FALSE, 0); gtk_container_add( GTK_CONTAINER(vboxl), clist_swin ); gtk_cmclist_column_titles_hide(GTK_CMCLIST(clist)); #endif gtk_container_set_border_width( GTK_CONTAINER(table), 4 ); gtk_table_set_row_spacings(GTK_TABLE(table), 4); gtk_table_set_col_spacings(GTK_TABLE(table), 4); /* First row */ top = 0; #ifndef GENERIC_UMPC label = gtk_label_new(_("Name")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); entry_name = gtk_combo_box_text_new_with_entry (); gtk_table_attach(GTK_TABLE(table), entry_name, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); /* Next row */ ++top; label = gtk_label_new(_("Value")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); entry_value = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), entry_value, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); #else label = gtk_label_new(_("Name")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); entry_name = gtk_combo_box_text_new_with_entry (); gtk_table_attach(GTK_TABLE(table), entry_name, 1, 2, 0, 1, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); /* Next row */ ++top; label = gtk_label_new(_("Value")); gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); entry_value = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), entry_value, 3, 4, 0, 1, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); #endif gtk_combo_box_set_active(GTK_COMBO_BOX(entry_name), -1); if (prefs_common.addressbook_custom_attributes) combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(entry_name), prefs_common.addressbook_custom_attributes); /* Button box */ vboxb = gtk_vbox_new( FALSE, 4 ); gtk_box_pack_start(GTK_BOX(hbox), vboxb, FALSE, FALSE, 2); vbuttonbox = gtk_vbutton_box_new(); gtk_button_box_set_layout( GTK_BUTTON_BOX(vbuttonbox), GTK_BUTTONBOX_START ); gtk_box_set_spacing( GTK_BOX(vbuttonbox), 8 ); gtk_container_set_border_width( GTK_CONTAINER(vbuttonbox), 4 ); gtk_container_add( GTK_CONTAINER(vboxb), vbuttonbox ); /* Buttons */ buttonDel = gtk_button_new_from_stock(GTK_STOCK_DELETE); gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonDel ); buttonMod = gtk_button_new_from_stock(GTK_STOCK_SAVE); gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonMod ); buttonAdd = gtk_button_new_from_stock(GTK_STOCK_ADD); gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonAdd ); gtk_widget_set_sensitive(buttonDel,FALSE); gtk_widget_set_sensitive(buttonMod,FALSE); gtk_widget_set_sensitive(buttonAdd,FALSE); gtk_widget_show_all(vbox); /* Event handlers */ g_signal_connect( G_OBJECT(clist), "select_row", G_CALLBACK( edit_person_attrib_list_selected), NULL ); g_signal_connect( G_OBJECT(buttonDel), "clicked", G_CALLBACK( edit_person_attrib_delete ), NULL ); g_signal_connect( G_OBJECT(buttonMod), "clicked", G_CALLBACK( edit_person_attrib_modify ), NULL ); g_signal_connect( G_OBJECT(buttonAdd), "clicked", G_CALLBACK( edit_person_attrib_add ), NULL ); g_signal_connect(G_OBJECT(entry_name), "changed", G_CALLBACK(edit_person_entry_att_changed), NULL); g_signal_connect(G_OBJECT(entry_name), "key_press_event", G_CALLBACK(edit_person_entry_att_pressed), NULL); g_signal_connect(G_OBJECT(entry_value), "key_press_event", G_CALLBACK(edit_person_entry_att_pressed), NULL); personeditdlg.clist_attrib = clist; personeditdlg.entry_atname = entry_name; personeditdlg.entry_atvalue = entry_value; personeditdlg.attrib_add = buttonAdd; personeditdlg.attrib_del = buttonDel; personeditdlg.attrib_mod = buttonMod; } static void addressbook_edit_person_create( GtkWidget *parent, gboolean *cancelled ) { if (prefs_common.addressbook_use_editaddress_dialog) addressbook_edit_person_dialog_create( cancelled ); else addressbook_edit_person_widgetset_create( parent, cancelled ); addressbook_edit_person_page_basic( PAGE_BASIC, _( "_User Data" ) ); addressbook_edit_person_page_email( PAGE_EMAIL, _( "_Email Addresses" ) ); #ifdef USE_LDAP if (personeditdlg.ldap) addressbook_edit_person_page_attrib_ldap(&personeditdlg, PAGE_ATTRIBUTES, _("O_ther Attributes")); else #endif addressbook_edit_person_page_attrib( PAGE_ATTRIBUTES, _( "O_ther Attributes" ) ); gtk_widget_show_all( personeditdlg.container ); } /* * Return list of email items. */ static GList *edit_person_build_email_list() { GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_email); GList *listEMail = NULL; ItemEMail *email; gint row = 0; while( (email = gtk_cmclist_get_row_data( clist, row )) ) { listEMail = g_list_append( listEMail, email ); row++; } return listEMail; } /* * Return list of attributes. */ static GList *edit_person_build_attrib_list() { GtkCMCList *clist = GTK_CMCLIST(personeditdlg.clist_attrib); GList *listAttrib = NULL; UserAttribute *attrib; gint row = 0; while( (attrib = gtk_cmclist_get_row_data( clist, row )) ) { listAttrib = g_list_append( listAttrib, attrib ); row++; } return listAttrib; } static void update_sensitivity(void) { gtk_widget_set_sensitive(personeditdlg.entry_name, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.entry_first, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.entry_last, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.entry_nick, !personeditdlg.read_only && !personeditdlg.ldap); gtk_widget_set_sensitive(personeditdlg.entry_email, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.entry_alias, !personeditdlg.read_only && !personeditdlg.ldap); gtk_widget_set_sensitive(personeditdlg.entry_remarks, !personeditdlg.read_only && !personeditdlg.ldap); gtk_widget_set_sensitive(personeditdlg.email_up, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.email_down, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.email_del, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.email_mod, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.email_add, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.entry_atname, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.entry_atvalue, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.attrib_add, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.attrib_del, !personeditdlg.read_only); gtk_widget_set_sensitive(personeditdlg.attrib_mod, !personeditdlg.read_only); } static void addressbook_edit_person_flush_transient( void ) { ItemPerson *person = current_person; EditAddressPostUpdateCallback callback = edit_person_close_post_update_cb; /* reset transient data */ current_abf = NULL; current_person = NULL; current_parent_folder = NULL; edit_person_close_post_update_cb = NULL; /* post action to perform on addressbook side */ if (callback) callback( person ); } void addressbook_edit_person_invalidate( AddressBookFile *abf, ItemFolder *parent_folder, ItemPerson *person ) { if (current_abf == NULL && current_person == NULL && current_parent_folder == NULL) /* edit address form is already hidden */ return; /* unconditional invalidation or invalidating the currently edited item */ if ( ( abf == NULL && person == NULL && parent_folder == NULL ) || (current_abf == abf || current_person == person || current_parent_folder == parent_folder)) addressbook_edit_person_close( TRUE ); } static gboolean addressbook_edit_person_close( gboolean cancelled ) { GList *listEMail = NULL; GList *listAttrib = NULL; GError *error = NULL; listEMail = edit_person_build_email_list(); listAttrib = edit_person_build_attrib_list(); if( cancelled ) { addritem_free_list_email( listEMail ); addritem_free_list_attribute( listAttrib ); gtk_cmclist_clear( GTK_CMCLIST(personeditdlg.clist_email) ); gtk_cmclist_clear( GTK_CMCLIST(personeditdlg.clist_attrib) ); if (!prefs_common.addressbook_use_editaddress_dialog) gtk_widget_hide( personeditdlg.container ); /* no callback, as we're discarding the form */ edit_person_close_post_update_cb = NULL; addressbook_edit_person_flush_transient(); current_person = NULL; /* set focus to the address list (this is done by the post_update_cb usually) */ addressbook_address_list_set_focus(); return FALSE; } if( current_person && current_abf ) { /* Update email/attribute list for existing current_person */ addrbook_update_address_list( current_abf, current_person, listEMail ); addrbook_update_attrib_list( current_abf, current_person, listAttrib ); } else { /* Create new current_person and email/attribute list */ if( ! cancelled && current_abf ) { current_person = addrbook_add_address_list( current_abf, current_parent_folder, listEMail ); addrbook_add_attrib_list( current_abf, current_person, listAttrib ); } } listEMail = NULL; listAttrib = NULL; if(!cancelled && current_person != NULL) { /* Set current_person stuff */ gchar *name; gchar *cn = edit_person_get_common_name_from_widgets(); addritem_person_set_common_name( current_person, cn ); g_free( cn ); if (personeditdlg.picture_set) { GdkPixbuf * pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(personeditdlg.image)); if (!current_person->picture) name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S, ADDRITEM_ID(current_person), ".png", NULL ); else name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S, current_person->picture, ".png", NULL ); gdk_pixbuf_save(pixbuf, name, "png", &error, NULL); if (error) { alertpanel_error(_("Failed to save image: \n%s"), error->message); g_error_free(error); } else { debug_print("saved picture to %s\n", name); } if (!current_person->picture) addritem_person_set_picture( current_person, ADDRITEM_ID(current_person) ) ; g_free( name ); } else { if (!current_person->picture) name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S, ADDRITEM_ID(current_person), ".png", NULL ); else name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S, current_person->picture, ".png", NULL ); claws_unlink(name); g_free(name); } name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_first), 0, -1 ); addritem_person_set_first_name( current_person, name ); g_free( name ); name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_last), 0, -1 ); addritem_person_set_last_name( current_person, name ); g_free( name ); name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_nick), 0, -1 ); addritem_person_set_nick_name( current_person, name ); g_free( name ); } gtk_cmclist_clear( GTK_CMCLIST(personeditdlg.clist_email) ); gtk_cmclist_clear( GTK_CMCLIST(personeditdlg.clist_attrib) ); if (!prefs_common.addressbook_use_editaddress_dialog) gtk_widget_hide( personeditdlg.container ); addressbook_edit_person_flush_transient(); return TRUE; } /* * Edit person. * Enter: abf Address book. * parent Parent folder for person (or NULL if adding to root folder). Argument is * only required for new objects). * person Person to edit, or NULL for a new person object. * pgMail If TRUE, E-Mail page will be activated. * Return: Edited object, or NULL if cancelled.*/ ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent_folder, ItemPerson *person, gboolean pgMail, GtkWidget *parent_container, void (*post_update_cb) (ItemPerson *person), gboolean get_focus) { static gboolean cancelled; GError *error = NULL; GdkPixbuf *pixbuf = NULL; /* set transient data */ current_abf = abf; current_person = person; current_parent_folder = parent_folder; edit_person_close_post_update_cb = post_update_cb; personeditdlg.ldap = (abf && abf->type == ADBOOKTYPE_LDAP)? TRUE : FALSE; if( personeditdlg.container ) { gtk_widget_destroy(personeditdlg.container); personeditdlg.container = NULL; } addressbook_edit_person_create(parent_container, &cancelled); /* typically, get focus when dialog mode is enabled, or when editing a new address */ if( get_focus ) { gtk_widget_grab_focus(personeditdlg.ok_btn); gtk_widget_grab_focus(personeditdlg.entry_name); } personeditdlg.read_only = (current_abf == NULL); update_sensitivity(); gtk_widget_show(personeditdlg.container); if (prefs_common.addressbook_use_editaddress_dialog) manage_window_set_transient(GTK_WINDOW(personeditdlg.container)); else if (get_focus) addressbook_address_list_disable_some_actions(); /* Clear all fields */ personeditdlg.rowIndEMail = -1; personeditdlg.rowIndAttrib = -1; edit_person_status_show( "" ); gtk_cmclist_clear( GTK_CMCLIST(personeditdlg.clist_email) ); gtk_cmclist_clear( GTK_CMCLIST(personeditdlg.clist_attrib) ); gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_name), "" ); gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_first), "" ); gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_last), "" ); gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_nick), "" ); personeditdlg.editNew = FALSE; if( current_person ) { gchar *filename = NULL; if( ADDRITEM_NAME(current_person) ) gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_name), ADDRITEM_NAME(person) ); cm_menu_set_sensitive("EditAddressPopup/SetPicture", !personeditdlg.ldap); cm_menu_set_sensitive("EditAddressPopup/UnsetPicture", !personeditdlg.ldap); if( current_person->picture ) { filename = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S, current_person->picture, ".png", NULL ); if (is_file_exist(filename)) { pixbuf = gdk_pixbuf_new_from_file(filename, &error); if (error) { debug_print("Failed to import image: %s\n", error->message); g_error_free(error); goto no_img; } personeditdlg.picture_set = TRUE; cm_menu_set_sensitive("EditAddressPopup/UnsetPicture", !personeditdlg.ldap && personeditdlg.picture_set); } else { goto no_img; } gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf); } else { no_img: addressbook_edit_person_clear_picture(); } g_free(filename); if (pixbuf) { g_object_unref(pixbuf); pixbuf = NULL; } if( current_person->firstName ) gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_first), current_person->firstName ); if( current_person->lastName ) gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_last), current_person->lastName ); if( current_person->nickName ) gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_nick), current_person->nickName ); edit_person_load_email( current_person ); edit_person_load_attrib( current_person ); gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_atvalue), ""); } else { personeditdlg.editNew = TRUE; } /* Select appropriate start page */ if( pgMail ) { gtk_notebook_set_current_page( GTK_NOTEBOOK(personeditdlg.notebook), PAGE_EMAIL ); } else { gtk_notebook_set_current_page( GTK_NOTEBOOK(personeditdlg.notebook), PAGE_BASIC ); } gtk_cmclist_select_row( GTK_CMCLIST(personeditdlg.clist_email), 0, 0 ); gtk_cmclist_select_row( GTK_CMCLIST(personeditdlg.clist_attrib), 0, 0 ); edit_person_email_clear( NULL ); if (current_person) edit_person_email_list_selected(GTK_CMCLIST(personeditdlg.clist_email), 0, 0, NULL, NULL); edit_person_attrib_clear( NULL ); if (prefs_common.addressbook_use_editaddress_dialog) { gtk_main(); gtk_widget_hide( personeditdlg.container ); if (!addressbook_edit_person_close( cancelled )) { return NULL; } } return person; } void addressbook_edit_reload_attr_list( void ) { if (personeditdlg.entry_atname) { combobox_unset_popdown_strings(GTK_COMBO_BOX_TEXT(personeditdlg.entry_atname)); if (prefs_common.addressbook_custom_attributes) combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(personeditdlg.entry_atname), prefs_common.addressbook_custom_attributes); } } /* * End of Source. */
sadjehwty/claws
src/editaddress.c
C
gpl-3.0
58,885
from time import time from gi.repository import GLib, GObject from pychess.Utils.const import WHITE, BLACK from pychess.System.Log import log class TimeModel(GObject.GObject): __gsignals__ = { "player_changed": (GObject.SignalFlags.RUN_FIRST, None, ()), "time_changed": (GObject.SignalFlags.RUN_FIRST, None, ()), "zero_reached": (GObject.SignalFlags.RUN_FIRST, None, (int, )), "pause_changed": (GObject.SignalFlags.RUN_FIRST, None, (bool, )) } ############################################################################ # Initing # ############################################################################ def __init__(self, secs=0, gain=0, bsecs=-1, minutes=-1): GObject.GObject.__init__(self) if bsecs < 0: bsecs = secs if minutes < 0: minutes = secs / 60 self.minutes = minutes # The number of minutes for the original starting # time control (not necessarily where the game was resumed, # i.e. self.intervals[0][0]) self.intervals = [[secs], [bsecs]] self.gain = gain self.secs = secs # in FICS games we don't count gain self.handle_gain = True self.paused = False # The left number of secconds at the time pause was turned on self.pauseInterval = 0 self.counter = None self.started = False self.ended = False self.movingColor = WHITE self.connect('time_changed', self.__zerolistener, 'time_changed') self.connect('player_changed', self.__zerolistener, 'player_changed') self.connect('pause_changed', self.__zerolistener, 'pause_changed') self.zero_listener_id = None self.zero_listener_time = 0 self.zero_listener_source = None def __repr__(self): text = "<TimeModel object at %s (White: %s Black: %s ended=%s)>" % \ (id(self), str(self.getPlayerTime(WHITE)), str(self.getPlayerTime(BLACK)), self.ended) return text def __zerolistener(self, *args): if self.ended: return False cur_time = time() whites_time = cur_time + self.getPlayerTime(WHITE) blacks_time = cur_time + self.getPlayerTime(BLACK) if whites_time <= blacks_time: the_time = whites_time color = WHITE else: the_time = blacks_time color = BLACK remaining_time = the_time - cur_time + 0.01 if remaining_time > 0 and remaining_time != self.zero_listener_time: if (self.zero_listener_id is not None) and \ (self.zero_listener_source is not None) and \ not self.zero_listener_source.is_destroyed(): GLib.source_remove(self.zero_listener_id) self.zero_listener_time = remaining_time self.zero_listener_id = GLib.timeout_add(10, self.__checkzero, color) default_context = GLib.main_context_get_thread_default( ) or GLib.main_context_default() if hasattr(default_context, "find_source_by_id"): self.zero_listener_source = default_context.find_source_by_id( self.zero_listener_id) def __checkzero(self, color): if self.getPlayerTime(color) <= 0 and self.started: self.emit('zero_reached', color) return False return True ############################################################################ # Interacting # ############################################################################ def setMovingColor(self, movingColor): self.movingColor = movingColor self.emit("player_changed") def tap(self): if self.paused: return gain = self.gain if self.handle_gain else 0 ticker = self.intervals[self.movingColor][-1] + gain if self.started: if self.counter is not None: ticker -= time() - self.counter else: # FICS rule if self.ply >= 1: self.started = True self.intervals[self.movingColor].append(ticker) self.movingColor = 1 - self.movingColor if self.started: self.counter = time() self.emit("time_changed") self.emit("player_changed") def start(self): if self.started: return self.counter = time() self.emit("time_changed") def end(self): log.debug("TimeModel.end: self=%s" % self) self.pause() self.ended = True if (self.zero_listener_id is not None) and \ (self.zero_listener_source is not None) and \ not self.zero_listener_source.is_destroyed(): GLib.source_remove(self.zero_listener_id) def pause(self): log.debug("TimeModel.pause: self=%s" % self) if self.paused: return self.paused = True if self.counter is not None: self.pauseInterval = time() - self.counter self.counter = None self.emit("time_changed") self.emit("pause_changed", True) def resume(self): log.debug("TimeModel.resume: self=%s" % self) if not self.paused: return self.paused = False self.counter = time() - self.pauseInterval self.emit("pause_changed", False) ############################################################################ # Undo and redo in TimeModel # ############################################################################ def undoMoves(self, moves): """ Sets time and color to move, to the values they were having in the beginning of the ply before the current. his move. Example: White intervals (is thinking): [120, 130, ...] Black intervals: [120, 115] Is undoed to: White intervals: [120, 130] Black intervals (is thinking): [120, ...] """ if not self.started: self.start() for move in range(moves): self.movingColor = 1 - self.movingColor del self.intervals[self.movingColor][-1] if len(self.intervals[0]) + len(self.intervals[1]) >= 4: self.counter = time() else: self.started = False self.counter = None self.emit("time_changed") self.emit("player_changed") ############################################################################ # Updating # ############################################################################ def updatePlayer(self, color, secs): self.intervals[color][-1] = secs if color == self.movingColor and self.started: self.counter = secs + time() - self.intervals[color][-1] self.emit("time_changed") ############################################################################ # Info # ############################################################################ def getPlayerTime(self, color, movecount=-1): if color == self.movingColor and self.started and movecount == -1: if self.paused: return self.intervals[color][movecount] - self.pauseInterval elif self.counter: return self.intervals[color][movecount] - (time() - self.counter) return self.intervals[color][movecount] def getInitialTime(self): return self.intervals[WHITE][0] def getElapsedMoveTime(self, ply): movecount, color = divmod(ply + 1, 2) gain = self.gain if ply > 2 else 0 if len(self.intervals[color]) > movecount: return self.intervals[color][movecount - 1] - self.intervals[ color][movecount] + gain if movecount > 1 else 0 else: return 0 @property def display_text(self): text = ("%d " % self.minutes) + _("min") if self.gain != 0: text += (" + %d " % self.gain) + _("sec") return text @property def hasTimes(self): return len(self.intervals[0]) > 1 @property def ply(self): return len(self.intervals[BLACK]) + len(self.intervals[WHITE]) - 2 def hasBWTimes(self, bmovecount, wmovecount): return len(self.intervals[BLACK]) > bmovecount and len(self.intervals[ WHITE]) > wmovecount
cajone/pychess
lib/pychess/Utils/TimeModel.py
Python
gpl-3.0
8,916
/************************************************************************** * * Copyright 2009 VMware, Inc. * All Rights Reserved. * * 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, sub license, 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 (including the * next paragraph) 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 NON-INFRINGEMENT. * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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. * **************************************************************************/ #include "util/u_format.h" #include "lp_bld_type.h" #include "lp_bld_const.h" #include "lp_bld_conv.h" #include "lp_bld_format.h" static LLVMValueRef lp_build_format_swizzle_chan_soa(struct lp_type type, const LLVMValueRef *unswizzled, enum util_format_swizzle swizzle) { switch (swizzle) { case UTIL_FORMAT_SWIZZLE_X: case UTIL_FORMAT_SWIZZLE_Y: case UTIL_FORMAT_SWIZZLE_Z: case UTIL_FORMAT_SWIZZLE_W: return unswizzled[swizzle]; case UTIL_FORMAT_SWIZZLE_0: return lp_build_zero(type); case UTIL_FORMAT_SWIZZLE_1: return lp_build_one(type); case UTIL_FORMAT_SWIZZLE_NONE: return lp_build_undef(type); default: assert(0); return lp_build_undef(type); } } void lp_build_format_swizzle_soa(const struct util_format_description *format_desc, struct lp_type type, const LLVMValueRef *unswizzled, LLVMValueRef *swizzled) { if(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { enum util_format_swizzle swizzle = format_desc->swizzle[0]; LLVMValueRef depth = lp_build_format_swizzle_chan_soa(type, unswizzled, swizzle); swizzled[2] = swizzled[1] = swizzled[0] = depth; swizzled[3] = lp_build_one(type); } else { unsigned chan; for (chan = 0; chan < 4; ++chan) { enum util_format_swizzle swizzle = format_desc->swizzle[chan]; swizzled[chan] = lp_build_format_swizzle_chan_soa(type, unswizzled, swizzle); } } } void lp_build_unpack_rgba_soa(LLVMBuilderRef builder, const struct util_format_description *format_desc, struct lp_type type, LLVMValueRef packed, LLVMValueRef *rgba) { LLVMValueRef inputs[4]; unsigned start; unsigned chan; /* FIXME: Support more formats */ assert(format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN); assert(format_desc->block.width == 1); assert(format_desc->block.height == 1); assert(format_desc->block.bits <= 32); /* Decode the input vector components */ start = 0; for (chan = 0; chan < 4; ++chan) { unsigned width = format_desc->channel[chan].size; unsigned stop = start + width; LLVMValueRef input; input = packed; switch(format_desc->channel[chan].type) { case UTIL_FORMAT_TYPE_VOID: input = NULL; break; case UTIL_FORMAT_TYPE_UNSIGNED: if(type.floating) { if(start) input = LLVMBuildLShr(builder, input, lp_build_int_const_scalar(type, start), ""); if(stop < format_desc->block.bits) { unsigned mask = ((unsigned long long)1 << width) - 1; input = LLVMBuildAnd(builder, input, lp_build_int_const_scalar(type, mask), ""); } if(format_desc->channel[chan].normalized) input = lp_build_unsigned_norm_to_float(builder, width, type, input); else input = LLVMBuildFPToSI(builder, input, lp_build_vec_type(type), ""); } else { /* FIXME */ assert(0); input = lp_build_undef(type); } break; default: /* fall through */ input = lp_build_undef(type); break; } inputs[chan] = input; start = stop; } lp_build_format_swizzle_soa(format_desc, type, inputs, rgba); }
CPFDSoftware-Tony/gmv
utils/Mesa/Mesa-7.8.2/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
C
gpl-3.0
4,878
using System; using System.ComponentModel; using System.Diagnostics; using System.Threading; using AutoJITRuntime.Exceptions; namespace AutoJITRuntime.Services { public class ProcessService { public Variant ShellExecute( Variant filename, Variant parameters, Variant workingdir, Variant verb, Variant showflag ) { var startInfo = new ProcessStartInfo( filename ); if ( verb != string.Empty ) { startInfo.Verb = verb; } if ( workingdir != string.Empty ) { startInfo.WorkingDirectory = workingdir; } if ( parameters != string.Empty ) { startInfo.Arguments = parameters; } int flag = showflag.GetInt(); if ( flag == 0 ) { startInfo.WindowStyle = ProcessWindowStyle.Hidden; } else if ( flag == 6 ) { startInfo.WindowStyle = ProcessWindowStyle.Minimized; } else if ( flag == 3 ) { startInfo.WindowStyle = ProcessWindowStyle.Maximized; } startInfo.UseShellExecute = true; try { Process process = Process.Start( startInfo ); return process.Id; } catch (Win32Exception exception) { throw new ShellExcuteException( exception.NativeErrorCode, null, 0 ); } catch (Exception) { throw new ShellExcuteException( 1, null, 0 ); } } public Variant ShellExecuteWait( Variant filename, Variant parameters, Variant workingdir, Variant verb, Variant showflag ) { Variant pid = ShellExecute( filename, parameters, workingdir, verb, showflag ); if ( pid ) { Process process = Process.GetProcessById( pid ); while ( !process.HasExited ) { Thread.Sleep( 10 ); } return process.ExitCode; } return 0; } } }
lawl-dev/AutoJit
src/AutoJIT.Runtime/Services/ProcessService.cs
C#
gpl-3.0
2,075
/* * Copyright (C) 2012 The Android Open Source Project * * 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. */ #define LOG_TAG "NBAIO" //#define LOG_NDEBUG 0 #include <utils/Log.h> #include <media/nbaio/NBAIO.h> namespace android { size_t Format_frameSize(const NBAIO_Format& format) { return format.mFrameSize; } const NBAIO_Format Format_Invalid = { 0, 0, AUDIO_FORMAT_INVALID, 0 }; unsigned Format_sampleRate(const NBAIO_Format& format) { if (!Format_isValid(format)) { return 0; } return format.mSampleRate; } unsigned Format_channelCount(const NBAIO_Format& format) { if (!Format_isValid(format)) { return 0; } return format.mChannelCount; } NBAIO_Format Format_from_SR_C(unsigned sampleRate, unsigned channelCount, audio_format_t format) { if (sampleRate == 0 || channelCount == 0 || !audio_is_valid_format(format)) { return Format_Invalid; } NBAIO_Format ret; ret.mSampleRate = sampleRate; ret.mChannelCount = channelCount; ret.mFormat = format; ret.mFrameSize = audio_is_linear_pcm(format) ? channelCount * audio_bytes_per_sample(format) : sizeof(uint8_t); return ret; } // This is a default implementation; it is expected that subclasses will optimize this. ssize_t NBAIO_Sink::writeVia(writeVia_t via, size_t total, void *user, size_t block) { if (!mNegotiated) { return (ssize_t) NEGOTIATE; } static const size_t maxBlock = 32; size_t frameSize = Format_frameSize(mFormat); ALOG_ASSERT(frameSize > 0 && frameSize <= 8); // double guarantees alignment for stack similar to what malloc() gives for heap if (block == 0 || block > maxBlock) { block = maxBlock; } double buffer[((frameSize * block) + sizeof(double) - 1) / sizeof(double)]; size_t accumulator = 0; while (accumulator < total) { size_t count = total - accumulator; if (count > block) { count = block; } ssize_t ret = via(user, buffer, count); if (ret > 0) { ALOG_ASSERT((size_t) ret <= count); size_t maxRet = ret; ret = write(buffer, maxRet); if (ret > 0) { ALOG_ASSERT((size_t) ret <= maxRet); accumulator += ret; continue; } } return accumulator > 0 ? accumulator : ret; } return accumulator; } // This is a default implementation; it is expected that subclasses will optimize this. ssize_t NBAIO_Source::readVia(readVia_t via, size_t total, void *user, int64_t readPTS, size_t block) { if (!mNegotiated) { return (ssize_t) NEGOTIATE; } static const size_t maxBlock = 32; size_t frameSize = Format_frameSize(mFormat); ALOG_ASSERT(frameSize > 0 && frameSize <= 8); // double guarantees alignment for stack similar to what malloc() gives for heap if (block == 0 || block > maxBlock) { block = maxBlock; } double buffer[((frameSize * block) + sizeof(double) - 1) / sizeof(double)]; size_t accumulator = 0; while (accumulator < total) { size_t count = total - accumulator; if (count > block) { count = block; } ssize_t ret = read(buffer, count, readPTS); if (ret > 0) { ALOG_ASSERT((size_t) ret <= count); size_t maxRet = ret; ret = via(user, buffer, maxRet, readPTS); if (ret > 0) { ALOG_ASSERT((size_t) ret <= maxRet); accumulator += ret; continue; } } return accumulator > 0 ? accumulator : ret; } return accumulator; } // Default implementation that only accepts my mFormat ssize_t NBAIO_Port::negotiate(const NBAIO_Format offers[], size_t numOffers, NBAIO_Format counterOffers[], size_t& numCounterOffers) { ALOGV("negotiate offers=%p numOffers=%zu countersOffers=%p numCounterOffers=%zu", offers, numOffers, counterOffers, numCounterOffers); if (Format_isValid(mFormat)) { for (size_t i = 0; i < numOffers; ++i) { if (Format_isEqual(offers[i], mFormat)) { mNegotiated = true; return i; } } if (numCounterOffers > 0) { counterOffers[0] = mFormat; } numCounterOffers = 1; } else { numCounterOffers = 0; } return (ssize_t) NEGOTIATE; } bool Format_isValid(const NBAIO_Format& format) { return format.mSampleRate != 0 && format.mChannelCount != 0 && format.mFormat != AUDIO_FORMAT_INVALID && format.mFrameSize != 0; } bool Format_isEqual(const NBAIO_Format& format1, const NBAIO_Format& format2) { return format1.mSampleRate == format2.mSampleRate && format1.mChannelCount == format2.mChannelCount && format1.mFormat == format2.mFormat && format1.mFrameSize == format2.mFrameSize; } } // namespace android
s20121035/rk3288_android5.1_repo
frameworks/av/media/libnbaio/NBAIO.cpp
C++
gpl-3.0
5,551
<?php /** * @license http://www.mailcleaner.net/open/licence_en.html Mailcleaner Public License * @package mailcleaner * @author Olivier Diserens * @copyright 2006, Olivier Diserens */ ### newsl $txt['NEWSLETTERMODULE'] = "Bülten"; $txt['NEWSLETTERSTOPIC'] = "Bültenler"; $txt['NEWSLETTERSTOPICTITLE'] = "Bültenler"; $txt['NEWSLETTERSSHORTHELP'] = "Bültenlerinizi buradan yönetebilirsiniz."; $txt['NEWSLETTERSALLOW'] = "teslim et"; $txt['NEWSLETTERACCEPT'] = "Bu bülteni kabul et"; $txt['SPAM_WHITELIST_DISABLED'] = "Bu etki alanı için liste etkinleştirilmedi (yöneticinizle iletişim kurun)."; /* * generic buttons */ $txt['SUBMIT'] = "Gönder"; $txt['CANCEL'] = "İptal"; $txt['CLOSE'] = "Kapat"; // old $txt['ADD'] = "ekle"; $txt['CONFIRM'] = "Onayla"; $txt['REFRESH'] = "Yenile"; $txt['SEARCH'] = "Arama"; $txt['SEND'] = "Gönder"; // old $txt['CLEAR'] = "temizle"; /* * generic texts */ $txt['GB'] = "GB"; $txt['MB'] = "MB"; $txt['KB'] = "KB"; $txt['BYTES'] = "bytes"; $txt['DATEFORMAT'] = "_D__M__Y_"; $txt['MONTHAB1'] = 'Oca.'; $txt['MONTHAB2'] = 'Şub.'; $txt['MONTHAB3'] = 'Mar.'; $txt['MONTHAB4'] = 'Nis.'; $txt['MONTHAB5'] = 'Mayıs'; $txt['MONTHAB6'] = 'Haziran'; $txt['MONTHAB7'] = 'Temmuz'; $txt['MONTHAB8'] = 'Ağustos'; $txt['MONTHAB9'] = 'Eyl.'; $txt['MONTHAB10'] = 'Eki.'; $txt['MONTHAB11'] = 'Kas.'; $txt['MONTHAB12'] = 'Ara.'; $txt['MONTH1'] = 'Ocak'; $txt['MONTH2'] = 'Şubat'; $txt['MONTH3'] = 'Mart'; $txt['MONTH4'] = 'Nisan'; $txt['MONTH5'] = 'Mayıs'; $txt['MONTH6'] = 'Haziran'; $txt['MONTH7'] = 'Temmuz'; $txt['MONTH8'] = 'Ağustos'; $txt['MONTH9'] = 'Eylül'; $txt['MONTH10'] = 'Ekim'; $txt['MONTH11'] = 'Kasım'; $txt['MONTH12'] = 'Aralık'; /* * login page */ $txt['BADLOGIN'] = "Geçersiz kullanıcı adı ya da parola."; $txt['SESSIONEXPIRED'] = "Oturum zaman aşımına uğradı."; $txt['LOGININFO'] = "Hatırlatma: Kullanıcı adınız ve şifreniz e-posta hesabınızla aynı"; $txt['USERNAME'] = "Kullanıcı adı"; $txt['PASSWORD'] = "Şifre"; //old $txt['ASKLOGIN'] = "Lütfen kullanıcı adınızı ve şifrenizi giriniz:"; $txt['ORGANIZATIONUNIT'] = "Organizasyon birimi"; $txt['FORGOTPASSWORD'] = "Kayıp şifre ?"; $txt['PASSWORDRESET'] = "Şifre sıfırlandı. E-posta adresinize gönderildi."; /* * menu */ $txt['CONFIGURATIONMENU'] = "Konfigürasyon"; $txt['HELPMENU'] = "Yardım"; $txt['QUARANTINEMENU'] = "Karantina"; $txt['STATISTICSMENU'] = "İstatistikler"; $txt['LOGOUT'] = "Çıkış"; //old $txt['LOGGEDAS'] = "şu şekilde giriş yapmış bulunuyorsunuz:"; // old $txt['MAINADDRESS'] = "ana adres"; $txt['PARAMETERS'] = "Ayarlar"; $txt['QUARANTINE'] = "Karantina"; $txt['NAVSUPPORT'] = "Destek"; /* * quarantaine */ $txt['SELECTEDADDRESS'] = "Görüntülenen adres"; $txt['QUARANTINESUMMARY'] = "<strong>Karantinada:</strong> __PARAM__ mesaj"; $txt['SEARCHSUMMARY'] = "<strong>Arama:</strong> __PARAM__ mesaj"; $txt['ORDEREDBYPARAM'] = "sırala __PARAM__"; $txt['RESETSEARCH'] = "Tüm karantina listesini görüntüle"; $txt['ODATE'] = "tarih"; $txt['OTIME'] = "zaman"; $txt['OSCORE'] = "score"; $txt['ODESTINATION'] = "alıcı"; $txt['OSENDER'] = "gönderen"; $txt['OSCORE'] = "skor"; $txt['OSUBJECT'] = "konu"; //old $txt['CRITERIAS'] = "Filtreleme kuralları"; $txt['FORCEMESSAGE'] = "Mesajı serbest bırak"; $txt['MESSAGEFORCING'] = "Mesaj serbest bırak"; $txt['MESSAGEPREVIEW'] = "Display the contents of the message"; $txt['ANALYSEREQUEST'] = "Filtre ayarlama talebi"; $txt['ANALYSEREQUESTV'] = "Bir filtre ayarlaması isteğinde bulunun"; $txt['SCORETEXT'] = "Skor: __PARAM__"; $txt['CLOSEWINDOW'] = "Pencereyi kapat"; $txt['CURRENTPAGE'] = "Sayfa __PARAM1__ de __PARAM2__"; $txt['PURGEINFOS'] = "<strong>sonra otomatik temizle:</strong> __PARAM__ gün"; $txt['DISPLAYEDINFOS'] = "<strong>Görüntülenen mesajlar: </strong> son __PARAM1__ gün (<a href=\"__PARAM2__\">Değiştir…</a>). "; $txt['DISPLAYEDINFOSS'] = "<strong>Görüntülenen Mesalar: </strong> son __PARAM__ günde. "; //old $txt['QUARANTINETITLE'] = "Karantina listesi __PARAM__"; //old $txt['FILTER'] = "Filtre"; //old $txt['ADVANCEDSEARCH'] = "gelişmiş arama"; //old $txt['SHOWEDMESSAGES'] = "görüntülenen mesajlar"; //old $txt['COMINGFROM'] = "gönderen"; $txt['DATE'] = "Tarih"; $txt['HOUR'] = "Zaman"; $txt['FROM'] = "Kimden"; $txt['TO'] = "Kime"; $txt['SUBJECT'] = "Konu"; $txt['SENDER'] = "Sender"; $txt['FORCED'] = "Serbest bırakıldı"; $txt['ACTION'] = "Eylem"; //old $txt['TOTALSPAMS'] = "Toplam: __PARAM__ spam"; //old $txt['FORTHEXLASTDAYS'] = "son __PARAM__ gün"; $txt['PURGESELECTEDSPAMS'] = "Karantinayı manuel olarak temizle"; //old $txt['HIDEFORCED'] = "Kullanıcı tarafından serbest bırakılan mesajları gizle"; //old $txt['FORCESPAM'] = "mesajı serbest bırak"; //old $txt['ASKREASON'] = "filtreleme kurallarını göster"; $txt['CONFSENDANALYSE'] = "MailCleaner Çözümleme Merkezine bir filtre ayar talebi gönderilecektir; yanlışlıkla engellenmiş mesajın bir kopyasını içerir.</br>Not: Bir filtre ayarı beyaz veya kara listeye almakla aynı şey değildir."; $txt['AREYOUSURE'] = "<span class=\"question\">Bu mesajın analiz edilmesini ve filtre ayarlamalarının uygulanmasını istediğinizden emin misiniz?</span>"; $txt['ASKANALYSE'] = "Filtre ayarlama talebi"; $txt['PAGE'] = "Sayfa"; $txt['NEXTPAGE'] = "Sonraki"; $txt['PREVIOUSPAGE'] = "Önceki"; //old $txt['GETREASONSTITLE'] = "Filtreleme nedenleri"; $txt['HITRULE'] = "Kural"; $txt['SCORE'] = "Skor"; $txt['TOTAL'] = "Toplam"; //old $txt['SENDANALYSETITLE'] = "Filtre düzenleme talebi"; $txt['SENTTOANALYSE'] = "MailCleaner Çözümleme Merkezine bir filtre düzenleme talebi gönderildi; bu mesaj incelenecek ve filtre düzeltmeleri bir iş günü içerisinde uygulanacaktır."; /* * quick actions */ //old $txt['SENDSUMTITLE'] = "Karantina raporunu manuel gönder"; $txt['SENDSUM'] = "Karantina raporunu manuel gönder"; $txt['SUMSENTTO'] = "Karantina raporu şu adrese gönderildi: <strong>__PARAM__</strong>"; $txt['SUMNOTSENTTO'] = "Karantina raporu <strong>__PARAM__</strong> hatası yüzünden gönderilemedi. Lüften daha sonra tekrar deneyin."; $txt['SUMMARYSENDING'] = "Karantina raporu iletimi"; $txt['PURGETITLE'] = "Karantinayı elle temizle"; $txt['PURGEDONE'] = "Karantina <strong>__PARAM__</strong> temizlendi"; $txt['COULDNOTPURGE'] = "Karantina raporu <strong>__PARAM__</strong> hatası yüzünden gönderilemedi. Lüften daha sonra tekrar deneyin."; $txt['ASKPURGECONFIRM'] = "Karantinanın son __PARAM1__ gününü <strong>__PARAM2__</strong> boşaltmak istediğinize eminmisiniz?"; $txt['QUARANTINEPURGE'] = "Karantinayı elle boşalt"; $txt['GROUPQUARANTINES'] = "Tüm adresler"; /* * preview panel */ $txt['INFORMATIONSABOUTMSG'] = "Mesajın içeriği"; $txt['PREFILTERHITS'] = "ön filtre"; $txt['BLACKLISTS'] = "Kara liste"; $txt['FITLERSCORE'] = "Skor"; $txt['NONE'] = "hiçbiri"; $txt['HEADERS'] = "Başlıklar"; $txt['BODY'] = "Gövde"; $txt['PARTS'] = "Kısımlar"; $txt['STORESLAVE'] = "Depolama"; $txt['SPAMCSCORE'] = "kural skoru"; $txt['DESCRIPTION'] = "Açıklama"; $txt['MESSAGEPREVIEW'] = "İleti önizleme"; $txt['ID'] = "Tanımlayıcı"; /* * logout page */ $txt['LOGOUTTEXT'] = "<p>MailCleaner oturumunuz kapandı.</p><p>Yeni oturum açmak için şu bağlantıyı takip edin:</p>"; /* * parameters page */ //old $txt['PARAMTITLE'] = "Kişisel MailCleaner ayarları"; //old $txt['USERPARAM'] = "Kullanıcı ayarları"; //old $txt['ADDRESSPARAM'] = "Adres ayarları"; //old $txt['LANGUAGE'] = "Dil"; $txt['ADDRESS'] = "Adres"; //old $txt['ADDRALIASTITLE'] = "Adres grubu"; //old $txt['FILTERACTIONTITLE'] = "Spam işleme modu"; //old $txt['SUMMARYPARAMSTITLE'] = "Karantina raporlama ayarları"; //old $txt['ADDRESSESLISTTITLE'] = "Kişisel adres gurubu: (__PARAM__ adres)"; //old $txt['APPLYALLADDRESSES'] = "Değişiklikleri tüm adreslere uygula"; //old $txt['MAIN'] = "ana"; //old $txt['SPAMACTION'] = "Spam işleme modu"; //old $txt['PUTINQUARANTINE'] = "karantina"; //old $txt['TAGSUBJECT'] = "etiket"; //old $txt['QUARBOUNCES'] = "E-posta iletim raporlarını sistemsel olarak karantinaya al"; //old $txt['DROP'] = "düşür"; //old $txt['SUBJECTTAG'] = "Etiket anahtar kelime"; //old $txt['SUMMARYFREQ'] = "Rapor iletim sıklığı"; $txt['DAILY'] = "Günlük"; $txt['WEEKLY'] = "Haftalık"; $txt['MONTHLY'] = "Aylık"; $txt['NOSUMMARY'] = "Rapor yok"; //old $txt['SUMMARYTYPE'] = "Rapor formatı"; $txt['USEDEFAULT'] = "varsayılanı kullan"; $txt['SUMMHTML'] = "HTML"; $txt['SUMMTEXT'] = "düz metin"; //old $txt['EDITWHITELIST'] = "beyaz listeyi düzenle"; //old $txt['EDITWARNLIST'] = "uyarı listesini düzenle"; /* * wwlist management */ //old $txt['SENDER'] = "Gönderen"; $txt['COMMENT'] = "Yorum"; //old $txt['ACTIONS'] = "Eylem"; //old $txt['ACTIVE'] = "aktif"; //old $txt['INNACTIVE'] = "pasif"; //old $txt['WWENTRY'] = "Girdi"; //old $txt['CONFIRMWWENTRYDELETE'] = "Bu girdiyi kalıcı olarak silmek istediğinizden emin misiniz?"; //old $txt['WHITELISTFOR'] = "__PARAM__ için beyaz liste"; //old $txt['WARNLISTFOR'] = "__PARAM__ için uyarı listesi"; //old $txt['STATUS'] = "Durum"; /* * alias stuff */ //old $txt['ADDALIASTITLE'] = "Bir adres ekle"; //old $txt['ADDALIASFORM'] = "Adres"; //old $txt['REMADDRESSALT'] = "adresi kaldır"; //old $txt['ADDADDRESSALT'] = "adres ekle"; $txt['BADADDRESSFORMAT'] = "Girilen adres geçersiz. Lütfen tekrar deneyin."; $txt['NOTFILTEREDDOMAIN'] = "Bu etki alanı MailCleaner tarafından filtrelenmiyor. Adres eklenemedi."; $txt['ALIASALREADYREGISTERD'] = "Bu adres zaten bir MailCleaner hesabı tarafından kullanılıyor. Eklenemedi."; $txt['ALIASALREADYPENDING'] = "Bu hesap için zaten bir doğrulama işlemi bekliyor."; $txt['ALIASPENDING'] = "Bu adrese bir doğrulama mesajı gönderildi. <br/> Güvenlik sebeplerinden dolayı, sadece 24 saat içinde onaylandığı takdirde adres eklenir."; $txt['ALIASREQUESTSUBJECT'] = "[MailCleaner] Adres ekleme talebi"; $txt['ALIASERRORSENDIG'] = "Dahili bir hata nedeniyle istek gönderilemedi. Lütfen daha sonra tekrar deneyin."; $txt['ALIASNOTPENDING'] = "Şu anda bu adres için bekleyen bir talep yok."; $txt['ALIASADDED'] = "Adres eklendi."; $txt['ALIASREQUESTREMOVED'] = "Talep iptal edildi."; //old $txt['REMALIASTITLE'] = "Adres kaldırıldı"; //old $txt['REMALIASCONFIRM'] = "Adresi kaldırmak istediğinizden emin misiniz: __PARAM__?"; $txt['ALIASREMOVED'] = "Adres __PARAM__ kaldırıldı."; $txt['CANNOTREMOVEMAINADD'] = "Adres __PARAM__ ana adrestir. Kaldırılamaz."; /* * statistics page */ //old $txt['USERSTATS'] = "İstatistik"; //old $txt['USERMESGSSTAT'] = "__PARAM__ alınan mesajlar"; //old $txt['USERSPAMSSTAT'] = "__PARAM__ spam"; //old $txt['USERSDANGEROUSSTAT'] = "__PARAM__ tehlikeli"; //old $txt['USERCLEANSTAT'] = "__PARAM__ temiz"; $txt['ALL'] = "tümü…"; $txt['SEARCHPERIOD'] = "Analiz dönemi"; $txt['LASTDAYS'] = "son günler"; $txt['LASTMONTHS'] = "son aylar"; $txt['LASTYEARS'] = "son yıllar"; $txt['DATESTART'] = "Kimden"; $txt['DATESTOP'] = "kime"; $txt['STATFORADDRESS'] = "Etkinlik istatistikleri: <strong>__PARAM__</strong>"; $txt['RECEIVEDMESSAGES'] = "Alınan mesajlar"; $txt['RECEIVEDVIRUS'] = "Virüslü ve tehlikeli mesajlar"; $txt['RECEIVEDSPAM'] = "Spam mesajlar"; $txt['RECEIVEDCLEAN'] = "Temiz mesajlar"; $txt['NBPROCESSEDMSGS'] = "__PARAM__ alınan mesajlar"; $txt['GLOBALSTATSTITLE'] = "Tüm adresler için özet"; $txt['FROMDATETODATE'] = "kimden __PARAM1__.__PARAM2__.__PARAM3__ kime __PARAM4__.__PARAM5__.__PARAM6__"; /* * some error messages */ $txt['BADARGS'] = "MailCleaner iç hatası (__PARAM__). Lütfen hata ayrıntılarıyla birlikte sistem yöneticisine başvurun."; $txt['INCORRECTMSGID'] = "İleti tanımlayıcısı yanlış olduğu için istenilen eylem tamamlanamadı."; $txt['NOSUCHADDR'] = "Verilen adres MailCleaner tarafından korunamaz."; $txt['ERRORSENDING'] = "Mesaj gönderilirken bir hata oluştu. Lütfen tekrar deneyin. Sorun devam ederse, lütfen sistem yöneticinize başvurun."; $txt['MSGFORCED'] = "Mesaj serbest bırakıldı ve posta kutunuza teslim edildi. Önümüzdeki birkaç dakika içinde hazır olacaktır."; $txt['MSGFILENOTFOUND'] = "İleti artık karantinada olmadığından, istenilen eylem tamamlanamadı."; /* * support page (deprecated) */ //old $txt['COMPANY'] = "Şirket"; //old $txt['NAME'] = "İsim"; //old $txt['FIRSTNAME'] = "Adı"; //old $txt['EMAIL'] = "E-posta"; //old $txt['YOURPHONENUMBER'] = "Telefon numarası"; //old $txt['WHATCANWEDO'] = "Sizin için ne yapabiliriz?"; //old $txt['NEEDEDFIELDS'] = "Gerekli alanlar"; //old $txt['SUPPORT'] = "Destek"; //old $txt['SUPFORMSENT'] = "Mesajınız gönderildi."; //old $txt['CANNOTSENDSUPFORM'] = "Mesajınız gönderilemedi. Lütfen daha sonra tekrar deneyin."; //old $txt['BADFORMFIELDS'] = "Bazı alanlar yanlış. Lütfen kontrol ediniz."; /* * help page (new) */ $txt['HELP'] = "Yardım"; $txt['INTERFACETOPIC'] = "Arayüz ayarları"; $txt['INTRODUCTIONTOPIC'] = 'Giriş'; $txt['INTRODUCTIONTOPICTITLE'] = 'giriş'; $txt['FIRSTCONTACTTOPIC'] = "Hızlı rehber"; $txt['FIRSTCONTACTTOPICTITLE'] = "hızlı rehber"; $txt['ADDRESSESTOPIC'] = "Faydalı adresler"; $txt['ADDRESSESTOPICTITLE'] = "faydalı adresler"; $txt['PLUGINTOPIC'] = "Outlook eklentisi"; $txt['PLUGINTOPICTITLE'] = "Outlook eklentisi"; $txt['MOREHELPTOPIC'] = "Tam kılavuz"; $txt['MOREHELPTOPICTITLE'] = "tam kılavuz"; $txt['USERMANUALTOPICTITLE'] = "kullanıcı kılavuzu"; $txt['USERMANUALTOPIC'] = "Kullanıcı kılavuzu"; $txt['FAQTOPIC'] = "Sıkça Sorulan Sorular"; $txt['FAQTOPICTITLE'] = "sıkça sorulan sorular"; $txt['GLOSSARYTOPIC'] = "Sözlük"; $txt['GLOSSARYTOPICTITLE'] = "sözlük"; $txt['SUPPORTTOPIC'] = "Destek"; $txt['SUPPORTTOPICTITLE'] = "destek"; $txt['ANALYSETOPIC'] = "Filtre düzenleme isteği"; $txt['ANALYSETOPICTITLE'] = "filtre düzenleme isteği"; /* * configuration menu (new) */ $txt['CONFIGURATION'] = "Yapılandırma"; $txt['ADDRESSLISTTOPIC'] = "Adres grubu"; $txt['ADDRESSPARAMTOPIC'] = "Adres ayarları"; $txt['QUARPARAMTOPIC'] = "Karantina görüntüsü"; $txt['WARNLISTTOPIC'] = "Uyarı listesi"; $txt['WHITELISTTOPIC'] = "Beyaz liste"; $txt['BLACKLISTTOPIC'] = "Kara liste"; $txt['INTERFACETOPICTITLE'] = "arayüz ayarları"; $txt['ADDRESSLISTTOPICTITLE'] = "adres grubu"; $txt['ADDRESSPARAMTOPICTITLE'] = "adres ayarları"; $txt['QUARPARAMTOPICTITLE'] = "karantina görüntüle"; $txt['WARNLISTTOPICTITLE'] = "uyarı listesi"; $txt['WHITELISTTOPICTITLE'] = "beyaz liste"; $txt['BLACKLISTTOPICTITLE'] = "kara liste"; /* * interface (new) */ $txt['SAVE'] = "Kaydet"; $txt['CHOOSETHISLANG'] = "Ana dil olarak İngilizce kullan"; $txt['CHOOSELANGUAGE'] = "Dil seçimi"; /* * aliases (new) */ $txt['ADDLISTSHORTHELP'] = "Bu grup, bu hesaptan yönetmek istediğiniz tüm adresleri ve takma adları içerir. Daha sonra karantina, istatistikler ve ayarlarınıza geçerli kimlik bilgilerinizle merkezi bir şekilde erişebilirsiniz."; $txt['ADDANADDRESS'] = "Adresi gruba ekle"; $txt['ADDTHEADDRESS'] = "&lt; Adresi gruba ekle"; $txt['ADDANADDRESSSHORTHELP'] = "Eklemek istediğiniz adresi giriniz."; $txt['REMANADDRESS'] = "Bir ya da daha fazla adresi grupdan kaldır"; $txt['REMTHEADDRESS'] = "Seçimi kaldır"; $txt['REMANADDRESSSHORTHELP'] = "Kaldırmak istediğiniz her adresin yanındaki kutuyu işaretleyin ve Seçimi kaldır düğmesini tıklayın."; $txt['WAITINGCONFIRMATION'] = "onay bekleniyor"; /* * addresses settings (new) */ $txt['ADDPARAMSHORTHELP'] = "Spam işleme modu, adreslerinizin her biri için özelleştirilebilir. Kullanılabilen farklı işleme modları hakkında daha fazla bilgi için kullanım kılavuzunu (<a href=\"help.php\">\"Yardım\"</a> bölümünde mevcuttur) kontrol edin."; $txt['FOREACHSPAMDO'] = "Spam olarak algılanan her ileti için:"; $txt['FOREACHNEWSLETTERDO'] = "Bülten olarak algılanan her ileti için:"; $txt['KEEPMESSAGEINQUARANTINE'] = "karantinada tut"; $txt['TAGMESSAGEWITHTAG'] = "konu ile teslim et"; $txt['DROPMESSAGE'] = "hemen sil"; $txt['SUMMARYSENTFREQ'] = "Karantina rapor sıklığı"; $txt['SUMMARYFORMAT'] = "Karantina rapor biçimi"; $txt['SUMMARYTO'] = "Raporu bu adrese gönder"; $txt['OTHER'] = "diğer…"; $txt['APPLYTOALLADDRESSES'] = "Ayarları tüm adresler için uygula"; $txt['PLAINTEXT'] = "Düz metin"; $txt['HTML'] = "HTML"; $txt['DIGEST'] = "Özet"; $txt['KEEPBOUNCESINQUARANTINE'] = "Hata mesajlarını sakla"; $txt['PARAMETERSSAVED'] = "Ayarlarınız kaydedildi."; $txt['NOTSAVED'] = "Ayarlarınız kaydedilemedi."; $txt['INVALIDSUMMARYTO'] = "Rapor için verilen eposta adresi yanlış"; /* * quarantine (new) */ $txt['CONFIGQUARSHORTHELP'] = "Karantina ekranı ihtiyaç ve alışkanlıklarınıza göre özelleştirilebilir (gün sayısı ve satırlar)."; $txt['QUARNBLINESDISPLAYED'] = "Görüntülenecek satır sayısı"; $txt['QUARNBDAYSDISAPLYED'] = "Görüntülenen gün sayısını"; $txt['MASKEALREADYFORCED'] = "Kullanıcı tarafından serbest bırakılan mesajları gizle"; $txt['DEFAULTADDRESDISPPLAYED'] = "Varsayılan olarak görüntülenen adres"; $txt['YESTERDAY'] = "Dün"; $txt['TODAY'] = "Bugün"; /* * wwlists (new) */ $txt['WARNLISTSHORTHELP'] = "Uyarı listesi, bir mesaj spam olarak algılandığında e-posta ile bilgilendirilmek istediğiniz güvenilir gönderen adreslerini içerir. Ardından bir filtreleme hatası durumunda mesajı derhal serbest bırakabilirsiniz..<br /> \t\t\t\t\t\t\t\t Uyarı: Bu fonksiyon, genel korumayı azalttığı için geçici bir çözüm olarak kullanılmalıdır. \t\t\t\t\t\t\t\t Uyarı listesi kullanımı hakkında daha fazla bilgi için kılavuza bakın (<a href=\"help.php\">\"Yardım\"</a> bölümünde bulunur). "; $txt['WARNLISTFORADDRESS'] = "adresi için uyarı listesi"; $txt['ADDAWARNENTRY'] = "Listeye bir adres ekle"; $txt['WARNLISTENTRYTOADD'] = "Uayrı listesi için eklemek istediğiniz adresi girin. İsteğe bağlı bir açıklama da ekleyebilirsiniz."; $txt['ADDTHEENTRY'] = "&lt; Adres Ekle"; $txt['REMOVEANENTRY'] = "Devre dışı bırak, etkinleştir veya listeden bir adresi kaldır"; $txt['REMOVEAWARNENTRYSHORTHELP'] = "Listeden değiştirmek istediğiniz adresi veya adresleri seçin ve istediğiniz işlem düğmesine tıklayın."; $txt['REMTHEENTRY'] = "Seçimi Kaldır"; $txt['DISABLETHEENTRY'] = "Devre dışı bırakın/etkinleştirin"; $txt['WHITELISTSHORTHELP'] = "Beyaz liste, hiçbir karantina korumasının gerçekleşmeyeceği güvenilir gönderen adreslerini içerir.<br /> Uyarı: Bu işlev, genel korumayı azalttığı için geçici çözüm olarak kullanılmalıdır. Beyaz liste kullanımı hakkında daha fazla bilgi için kullanıcı kılavuzuna bakın (<a href=\"help.php\"> \"Yardım\"</a> bölümünde kullanılabilir) . "; $txt['BLACKLISTSHORTHELP'] = "Kara kara listeye gönderen adresleri içerir. Kara liste kullanımı hakkında daha fazla bilgi için (<a href=\"help.php\"> \"Yardım\"</a> bölümünde kullanılabilir) kılavuzuna bakın. "; $txt['WHITELISTFORADDRESS'] = "Adres için beyazliste"; $txt['ADDAWHITEENTRY'] = "Lİsteye bir adres ekle"; $txt['WHITELISTENTRYTOADD'] = "Beyaz listeye eklemek için istediğiniz adresi girin. İsteğe bağlı bir açıklama da ekleyebilirsiniz."; $txt['REMOVEAWHITEENTRYSHORTHELP'] = "Listeden değiştirmek istediğiniz adresi veya adresleri seçin ve istediğiniz işlem düğmesine tıklayın."; $txt['BLACKLISTFORADDRESS'] = "Adres için karaliste"; $txt['ADDABLACKENTRY'] = "Listeye bir adres ekle"; $txt['BLACKLISTENTRYTOADD'] = "Kara listeye eklemek için bir adres girin. İsteğe bağlı bir yorum da girebilirsiniz."; $txt['REMOVEABLACKENTRYSHORTHELP'] = "Listeden değiştirmek istediğiniz adresi veya adresleri seçin ve istediğiniz işlem düğmesine tıklayın."; $txt['RECORDALREADYEXISTS'] = "Bu adres listede zaten var."; /* * logout (new) */ $txt['SESSIONTERMINATED'] = "Oturumunuz sona erdi."; $txt['BEENLOGGEDOUT'] = "Eğer yeni bir oturum başlatmak istiyorsunuz, bu bağlantıyı tıklatın: <a href=\"__PARAM__\" >__PARAM__</a>"; //old $txt['EDITNEWSLIST'] = "bülteni düzenle"; //old $txt['NEWSLISTFOR'] = "__PARAM__ için bülten"; $txt['NEWSLISTFORADDRESS'] = "Adres için bülten listesi"; $txt['ADDANEWSENTRY'] = "Lİsteye bir adres ekle"; $txt['NEWSLISTTOPIC'] = "Bülten"; $txt['NEWSLISTTOPICTITLE'] = "bülten"; $txt['NEWSLISTSHORTHELP'] = "Bülten listesi istediğiniz haber bültenleri adreslerini içerir.<br /> Bülten listesi kullanımı hakkında daha fazla bilgi için kılavuza (<a href=\"help.php\">\"Yardım\"</a> bölümünden kullanılabilir) bakın. "; $txt['NEWSLISTENTRYTOADD'] = "Bülten listesine eklemek istediğiniz adresi girin. İsteğe bağlı bir açıklama da ekleyebilirsiniz."; $txt['REMOVEANEWSENTRYSHORTHELP'] = "Listeden değiştirmek istediğiniz adresi veya adresleri seçin ve istediğiniz işlem düğmesine tıklayın."; /* * Newsletters release */ $txt['NLRELEASEDHEAD'] = "Bültene izin verildi ve serbest bırakıldı."; $txt['NLRELEASEDBODY'] = "Bültene izin verildi ve serbest bırakıldı. Birkaç dakika içinde posta kutunuza teslim edilecektir."; $txt['NLNOTRELEASEDHEAD'] = "Bülten serbest bırakılmadı"; $txt['NLNOTRELEASEDBODY'] = "Mesajınızı serbest bırakırken bir sorun oluştu."; $txt['ADDTOGROUP'] = "Gruptaki tüm adresler için ekle"; $txt['NEWSLONLY'] = "Yalnızca bültenleri göster"; $txt['SPAMONLY'] = "Yalnızca spam göster"; $txt['ADDRULE'] = "WWList kuralı ekleme"; // $txt['ADDITIONALACTION'] = "Ek eylemler:"; $txt['NOTBLACKLISTBODY'] = "Kara liste eklenirken bir sorun oluştu."; $txt['NOTBLACKLISTHEAD'] = "Kara liste kuralı eklenmedi."; $txt['BLACKLISTBODY'] = "Bir kara liste kuralı eklendi. Bu gönderenden gelecek mesajlar her zaman spam olarak işaretlenecektir."; $txt['BLACKLISTHEAD'] = "Kara liste kuralı eklendi."; /* * Blacklist rule (not currently implemented) */ $txt['ADDBLACKLIST'] = "Aynı gönderenden gelecek tüm e-postalar kara listeye alınsın mı?"; $txt['NOTNEWSWHITEBODY'] = "Bu kurallar eklenirken bir sorun oluştu."; $txt['NOTNEWSWHITEHEAD'] = "Ne bülten ne de beyaz liste kuralı eklenmedi."; $txt['WHITENOTNEWSBODY'] = "Bir beyaz liste kuralı eklendi, ancak bülten beyaz liste kuralı eklenirken bir sorun oluştu."; $txt['WHITENOTNEWSHEAD'] = "Beyaz liste eklendi ancak bülten eklenmedi."; $txt['NEWSNOTWHITEBODY'] = "Bir bülten kuralı eklendi, ancak beyaz liste kuralı eklenirken bir sorun oluştu."; $txt['NEWSNOTWHITEHEAD'] = "Bülten eklendi ancak beyaz liste eklenmedi."; $txt['NEWSWHITELISTBODY'] = "Bir bülten ve beyaz liste kuralı eklendi. Bu gönderenden gelecek mesajlar, bülten veya spam olarak algılanırsa işaretlenmeyecektir."; $txt['NEWSWHITELISTHEAD'] = "Bülten ve beyaz liste kuralları eklendi."; $txt['ADDWHITENEWSLIST'] = "Aynı gönderenden gelecek tüm spamlar beyaz listeye eklensin mi? Ayrıca bu gönderenden gelen her bülten kabul edilsin mi?"; /* * Newslist and Whitelist rule */ $txt['ADDNEWSWHITELIST'] = "Aynı gönderenden gelecek tüm bültenler kabul edilsin mi? Ayrıca bu gönderenden gelen tüm spam mesajlar beyaz listeye eklensin mi?"; $txt['NOTWHITELISTBODY'] = "Beyaz liste eklenirken bir sorun oluştu."; $txt['NOTWHITELISTHEAD'] = "Beyaz liste kuralı eklenmedi."; $txt['WHITELISTBODY'] = "Beyaz liste kuralı eklendi. Bu gönderenden gelecek mesajlar, spam olarak algılanırsa işaretlenmeyecektir."; $txt['WHITELISTHEAD'] = "Beyaz liste kuralı eklendi."; /* * Whitelist rule */ $txt['ADDWHITELIST'] = "Aynı gönderenden gelecek tüm spamlar beyaz listeye eklensin mi?"; $txt['NOTNEWSLISTBODY'] = "Bülten beyaz listesi eklenirken bir sorun oluştu."; $txt['NOTNEWSLISTHEAD'] = "Bülten kuralı eklenmedi."; $txt['NEWSLISTBODY'] = "Bir bülten beyaz listesi kuralı eklendi. Bu gönderenden gelecek mesajlar, bülten olarak algılanırsa işaretlenmeyecektir."; $txt['NEWSLISTHEAD'] = "Bülten kuralı eklendi."; /* * Newsletter rule */ $txt['ADDNEWSLIST'] = "Aynı gönderenin gelecekteki tüm bültenleri kabul edilsin mi?"; $txt['UNKNOWNERROR'] = "Bilinmeyen bir hata oluştu."; $txt['SENDERNOTVALID'] = "Geçersiz gönderen adresi."; $txt['DESTNOTVALID'] = "Geçersiz hedef adresi."; $txt['DUPLICATEENTRY'] = "Yinelenen bir girdi zaten var."; $txt['CONFIGREADFAIL'] = "Yapılandırma dosyası okunamadı."; $txt['CANNOTINSERTDB'] = "Veri tabanına eklenemedi."; $txt['CANNOTSELECTDB'] = "Veri tabanı aranamadı."; $txt['CANNOTCONNECTDB'] = "Veri tabanına bağlanılamadı."; /* * SOAP errors */ $txt['CANNOTLOADMESSAGE'] = "Mesaj yüklenemedi (artık var olmayabilir)."; $txt['ENTIREDOMAIN'] = "Tüm etki alanı"; $txt['SENDERVARIATIONS'] = "Gönderen adresinin tüm çeşitleri"; /* * Type of WWList */ $txt['ORIGINALSENDER'] = "Yalnızca orijinal gönderen adresi";
MailCleaner/MailCleaner
www/user/htdocs/lang/tr/texts.php
PHP
gpl-3.0
24,894
/* * Copyright © 2009 Leliksan Floyd <leliksan@Quadrafon2> * * 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, see <https://www.gnu.org/licenses/>. * * In addition, as a special exception, compiling, linking, and/or * using OpenSSL with this program is allowed. */ /* patch changelog: * [05.11.09] модификация исходного кода, убрал лишний код. * [05.11.09] масштабирование изображения иконки. * [06.11.09] исправлена ошибка, "забивание" экрана уведомлениями, когда период сообщений меньше периода уведомления. * [07.11.09] установка уровня уведомления в зависимости от типа сообщения (critical-ошибки, normal-все остальные). * [08.11.09] исправлена ошибка, после выхода не закрывалось уведомление. * [08.11.09] исправлена ошибка, не обновлялась иконка. * * Copyright © 2009-2010, author patch: troll, freedcpp, http://code.google.com/p/freedcpp * * 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. */ #pragma once #ifdef USE_LIBNOTIFY #include <libnotify/notify.h> #else // USE_LIBNOTIFY enum NotifyUrgency { NOTIFY_URGENCY_LOW, NOTIFY_URGENCY_NORMAL, NOTIFY_URGENCY_CRITICAL }; typedef int NotifyNotification; #endif // USE_LIBNOTIFY class Notify { public: enum TypeNotify { DOWNLOAD_FINISHED, DOWNLOAD_FINISHED_USER_LIST, PRIVATE_MESSAGE, HUB_CONNECT, HUB_DISCONNECT, FAVORITE_USER_JOIN, FAVORITE_USER_QUIT, NONE }; static Notify* get(); static void start(); static void stop(); Notify() { init(); } ~Notify() { finalize(); } void showNotify(const std::string &head, const std::string &body, TypeNotify notify); void showNotify(const std::string &title, const std::string &head, const std::string &body, const std::string &icon, const int iconSize, NotifyUrgency urgency); private: static Notify *notify; enum { x16, x22, x24, x32, x36, x48, x64, DEFAULT }; void init(); void finalize(); void setCurrIconSize(const int size); int icon_width = 16; int icon_height = 16; int currIconSize = x16; NotifyNotification *notification = nullptr; bool bAction = false; //GUI callback functions static void onAction(NotifyNotification *notify, const char *action, gpointer data); };
pavel-pimenov/eiskaltdcpp
eiskaltdcpp-gtk/src/notify.hh
C++
gpl-3.0
3,352
Testcode ======== This repository contains unrelated stuff, and a [reading list](reading-list) in particular [patterns](reading-list/patterns.md), [linux-api](reading-list/linux-api.md), [books](reading-list/books.md). Parser ------ Prototype algorithm _Parsing with Context_ implemented which parses simple expressions. See [context_oriented_parser.c](parser/context_oriented_parser.c). See [regex-main.c](parser/automat/main.c) for usage of the regex-parser which supports operators and(&) and and-not(&!) <br> Example: `"[a-zA-Z0-9_]+ &! [0-9].*"` The trick to implement this is to build the deterministic version for the left and right hand side of `&!` and combine the results [`makedfa2_automat(ndfa, OP_AND_NOT, ndfa2)`](parser/automat/automat.c#L2913). JavaScript ---------- [Test Framework in 110 LOC](https://github.com/je-so/testcode/blob/master/javascript/test.js) ```javascript <script type="module"> import { RUN_TEST } from "./jslib/test.js" RUN_TEST(unittest_of_some_module) function unittest_of_some_module(TEST) { TEST(1,"==",1,"no message shown") TEST(1,"<",1,"message shown") TEST(() => { throw Error("abc") },"throw","abc","test for exception with message abc") // use cmpUser to compare objects const cmpUser=(o1,o2) => (o1.name === o2.name) TEST({name:"JOhn"},cmpUser,{name:"John"},"test for same user (is not)") // or use "user" TEST.setCompare("user",cmpUser,true/*return value for success*/) TEST({name:"JOhn"},"user",{name:"John"},"test for same user") // compare array and show `value[2]` in error message const a=[5,10,15] for (let i=0; i<a.length; ++i) TEST(a[i],"==",5*(i+1)+(i==2),"index=2 should cause an error",`[${i}]`) // but TEST does array comparison for us TEST([[1,2],[3,4,5]],"==",[[1,2],[3,4,6]],"digits 5 and 6 differ") } </script> ``` OS API ------------- * How to read and check a user/password in a terminal on Linux [checkpass.c](checkpass.c). iperf ----- **Measure performance of multiple threads/processes.** See directory [iperf/](iperf/). Sudoku Solver ------------- Jump to directory [sudoku/](old-projects/sudoku). License ------- All source code is licensed under the GNU GENERAL PUBLIC LICENSE Version 3. Feel free to use it.
je-so/testcode
README.md
Markdown
gpl-3.0
2,242
//keep track of the total number of meshes var meshCount = 0; // refresh view port function onNewOptionClick () { if ( confirm( 'Are you sure?' ) ) { editor.config.clear(); editor.storage.clear( function () { location.href = location.pathname; } ); } } // event handlers for adding geometry function addGeo(geo_type,x,y,z,w,h,d){ if(geo_type == "plane"){ onPlaneOptionClick (); } if(geo_type == "box"){ onBoxOptionClick (x,y,z,w,h,d); } if(geo_type == "circle"){ onCircleOptionClick (); } if(geo_type == "cylinder" ){ onCylinderOptionClick (); } if(geo_type == "sphere"){ onSphereOptionClick () } if(geo_type == "icosahedron"){ onIcosahedronOptionClick () } if(geo_type == "torus"){ onTorusOptionClick (); } if(geo_type == "torusknot"){ onTorusKnotOptionClick(); } } function onPlaneOptionClick () { var width = 200; var height = 200; var widthSegments = 1; var heightSegments = 1; var geometry = new THREE.PlaneGeometry( width, height, widthSegments, heightSegments ); var material = new THREE.MeshPhongMaterial(); var mesh = new THREE.Mesh( geometry, material ); mesh.name = 'Plane ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } function onCircleOptionClick () { var radius = 20; var segments = 8; var geometry = new THREE.CircleGeometry( radius, segments ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Circle ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } function onCylinderOptionClick () { var radiusTop = 20; var radiusBottom = 20; var height = 100; var radiusSegments = 8; var heightSegments = 1; var openEnded = false; var geometry = new THREE.CylinderGeometry( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Cylinder ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } function onSphereOptionClick () { var radius = 75; var widthSegments = 32; var heightSegments = 16; var geometry = new THREE.SphereGeometry( radius, widthSegments, heightSegments ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Sphere ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } function onIcosahedronOptionClick () { var radius = 75; var detail = 2; var geometry = new THREE.IcosahedronGeometry ( radius, detail ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Icosahedron ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } function onTorusOptionClick () { var radius = 100; var tube = 40; var radialSegments = 8; var tubularSegments = 6; var arc = Math.PI * 2; var geometry = new THREE.TorusGeometry( radius, tube, radialSegments, tubularSegments, arc ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Torus ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } function onTorusKnotOptionClick () { var radius = 100; var tube = 40; var radialSegments = 64; var tubularSegments = 8; var p = 2; var q = 3; var heightScale = 1; var geometry = new THREE.TorusKnotGeometry( radius, tube, radialSegments, tubularSegments, p, q, heightScale ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'TorusKnot ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); }
chepilot/vidamo
js/threejs/add.js
JavaScript
gpl-3.0
3,866
/* * Copyright 2011-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio 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, or (at your option) * any later version. * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GR_EXTRAS_ADD_H #define INCLUDED_GR_EXTRAS_ADD_H #include <gnuradio/extras/api.h> #include <gnuradio/block.h> namespace gnuradio{ namespace extras{ class GR_EXTRAS_API add : virtual public block{ public: typedef boost::shared_ptr<add> sptr; static sptr make_fc32_fc32(const size_t num_inputs, const size_t vlen = 1); static sptr make_sc32_sc32(const size_t num_inputs, const size_t vlen = 1); static sptr make_sc16_sc16(const size_t num_inputs, const size_t vlen = 1); static sptr make_sc8_sc8(const size_t num_inputs, const size_t vlen = 1); static sptr make_f32_f32(const size_t num_inputs, const size_t vlen = 1); static sptr make_s32_s32(const size_t num_inputs, const size_t vlen = 1); static sptr make_s16_s16(const size_t num_inputs, const size_t vlen = 1); static sptr make_s8_s8(const size_t num_inputs, const size_t vlen = 1); }; }} #endif /* INCLUDED_GR_EXTRAS_ADD_H */
levelrf/level_basestation
grextras/include/gnuradio/extras/add.h
C
gpl-3.0
1,753
using System.Collections.Generic; using com.riotgames.platform.gameclient.domain; namespace com.riotgames.platform.statistics { public class PlayerStatSummaries : AbstractDomainObject { public PlayerStatSummaries() { } public List<PlayerStatSummary> playerStatSummarySet; //May be a real value, using int out of convenience public int userId; } }
kappakairi/daLibOfLegends
LibOfLegends/com/riotgames/platform/statistics/PlayerStatSummaries.cs
C#
gpl-3.0
369
/* * Copyright 2014 Christian Weber * * 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 org.arrow.runtime.execution.service.data; import org.arrow.runtime.execution.Execution; import org.arrow.runtime.execution.ProcessInstance; /** * The process instance repository definition. * * @author christian.weber * @since 1.0.0 */ public interface ProcessInstanceRepository { /** * Returns the latest process instance of the process with the given key. * * @param key the process key * @return ProcessInstance */ ProcessInstance findLatestProcessInstance(String key); /** * Returns the process instance with the given process instance id. * * @param piId the process instance id * @return ProcessInstance */ ProcessInstance findById(String piId); /** * Returns the sub process instance by the given sub process execution. * * @param subProcessExecution the sub process execution instance * @return ProcessInstance */ ProcessInstance findSubProcessInstance(Execution subProcessExecution); /** * Returns the process instance by the given process instance node id. * * @param id the process instance node id * @return ProcessInstance */ ProcessInstance findOne(Long id); /** * Returns the ad hoc sub process instance by the given super process instance node id and ad hoc sub process id. * * @param piNodeId the super process instance node id * @param adHocId the ad hoc sub process id * @return ProcessInstance */ ProcessInstance findAdHocSubProcess(Long piNodeId, String adHocId); }
christian-weber/arrow
arrow-runtime/src/main/java/org/arrow/runtime/execution/service/data/ProcessInstanceRepository.java
Java
gpl-3.0
2,179
<?php error_reporting (0); session_start(); include ("includes/functions_db.php"); include ("includes/config.php"); include ("includes/functions_common.php"); include ("includes/functions_formtools.php"); ?> <!DOCTYPE html> <html> <head> <title>Inserter Maintenance</title> <?php $scriptname=end(explode("/",$_SERVER['SCRIPT_NAME'])); //lets load the javascript files $sql="SELECT * FROM core_system_files WHERE file_type='script' AND head_load=1 ORDER BY load_order ASC"; $dbScripts=dbselectmulti($sql); if($dbScripts['numrows']>0) { foreach($dbScripts['data'] as $script) { if($script['specific_page']=='' || $script['specific_page']==$scriptname) { print "<script type='text/javascript' src='includes/jscripts/$script[file_name]'></script>\n"; } else { print "<!-- when loading $script[file_name] looked for $script[specific_page] compared to $scriptname -->\n"; } } } //lets load the stylesheets $sql="SELECT * FROM core_system_files WHERE file_type='style' AND head_load=1 ORDER BY load_order ASC"; $dbStyles=dbselectmulti($sql); if($dbStyles['numrows']>0) { foreach($dbStyles['data'] as $style) { if($style['specific_page']=='' || $style['specific_page']==$scriptname) { print "<link rel='stylesheet' type='text/css' href='styles/$style[file_name]' />\n"; } } } ?> <script> function chgInserter(id) { window.location='?inserterid='+id; } </script> </head> <body> <div style='width:940px;height:60px;border-bottom:8px solid #AC1D23;padding-bottom:0px;margin-bottom: 0px;'> <div style='float:left;'> <img src='artwork/mango.png' border=0 width="120"> </div> <div style='margin-left:10px;float:left;font-family:Trebuchet MS;font-size:48px;font-weight:bold;color:#AC1D23;' > Inserter Maintenance </div> <div style='margin-left:10px;float:right;'> <?php if (isset($_GET['type'])) { ?> <input type='button' onClick='document.location.href="?main";' value='Return to start'> <?php } else { ?> <input type='button' onClick='document.location.href="?type=ticket&ticketonly=true&equipmentid=0&componentid=0";' value='Submit General Ticket'> <?php } ?> <input type='button' onClick='self.close();' value='Close'> </div> </div> <div class='clear'></div> <?php if ($_POST) { if ($_POST['submit']=='Submit Trouble Ticket') { save_ticket(); } } else { init_ticket(); } function init_ticket($saved=false) { global $inserterid; if ($_GET['equipmentid'] || $_GET['ticketonly']) { show_maintenance($_GET['type'],$_GET['equipmentid'],$_GET['componentid'],$saved); } else { print "<div style='margin-left:auto;margin-right:auto;'>\n"; //we should be passed at a minimum the press id if (isset($_GET['inserterid'])) { $inserterid=$_GET['inserterid']; } else { $inserterid=$GLOBALS['defaultInserter']; } $sql="SELECT id,inserter_name FROM inserters"; $dbInserters=dbselectmulti($sql); $inserters=array(); if($dbInserters['numrows']>1) { foreach($dbInserters['data'] as $i) { $inserters[$i['id']]=$i['inserter_name']; } print "Please select an inserter: ".input_select('inserterid',$inserters[$inserterid],$inserters,'',"chgInserter(this.value)"); } build_inserter($inserterid); print "</div>\n"; //now show other 'mailroom' department equipment $sql="SELECT * FROM equipment WHERE equipment_department IN (".$GLOBALS['productionDepartmentID'].','.$GLOBALS['mailroomDepartmentID'].") ORDER BY equipment_name"; print "<div class='clear'></div>\n"; $dbEquipment=dbselectmulti($sql); if($dbEquipment['numrows']>0) { $equipment[0]='Select other equipment'; foreach($dbEquipment['data'] as $eq) { $equipment[$eq['id']]=stripslashes($eq['equipment_name']); } print "<div class='clear'></div>\n"; print "<hr>"; print "<span style='font-weight:bold;font-size:16px;float:left;'>Work on other mailroom equipment: </span>"; print "<span style='float:left;margin-left:10px;font-size:24px !important;'>"; print input_select('equipmentid',$equipment[0],$equipment,false,"if(this.value!=0){\$('#comp').css('display','block');}else{\$('#comp').css('display','none');}"); print "</span>"; print "<span id='comp' style='float:left;margin-left:10px;display:none;font-size:24px;'>"; print input_select('componentid',$components[0],$components); print "</span>\n"; print "<span style='float:left;margin-left:10px'><input type='button' onClick='pressMaintenanceGeneric();' value='Proceed'></span>"; print "<span class='clear'></span>"; print ' <script type="text/javascript"> $("#equipmentid").selectChain({ target: $("#componentid"), type: "post", url: "includes/ajax_handlers/maintenanceComponentHandler.php", data: { ajax: true } }); </script> '; print "</div>\n"; } } } function save_ticket() { global $siteID; $sql="SELECT * FROM helpdesk_statuses WHERE site_id=$siteID ORDER BY status_order ASC LIMIT 1"; $dbStatus=dbselectsingle($sql); $statusid=$dbStatus['data']['id']; $componentid=$_POST['componentid']; $equipmentid=$_POST['equipmentid']; $type=$_POST['type']; $location=$_POST['location']; $submittedby=$_POST['submittedby']; $priorityid=$_POST['priority']; $topic=$_POST['topic']; $problem=addslashes($_POST['problem']); $attempted=addslashes($_POST['attempted']); $full=$problem."<br />".$attempted; if($_POST['alertme']){$alertme=1;}else{$alertme=0;} $submitdatetime=date("Y-m-d H:i:s"); $sql="INSERT INTO maintenance_tickets (type_id, status_id, priority_id, submitted_by, submitted_datetime, problem, attempt, wants_email, object_type, object_id, object_unit) VALUES ('$topic', '$statusid', '$priorityid', '$submittedby', '$submitdatetime', '$problem', '$attempted', '$alertme', '$type', '$equipmentid', '$componentid')"; $dbInsert=dbinsertquery($sql); if ($dbInsert['error']=='') { //see if this ticket is highest priority, if so, send an email to the director //first, lets pull in the helpdesk priorities $sql="SELECT * FROM helpdesk_priorities ORDER BY priority_order DESC LIMIT 1"; $dbPriorities=dbselectsingle($sql); $highest=$dbPriorities['data']['id']; if($priorityid==$highest) { //highest priority!!!! need to send the email $sql="SELECT A.id, B.group_email FROM helpdesk_types A, user_groups B WHERE A.group_responsible=B.id"; $dbGroups=dbselectmulti($sql); $owners[0]='tech@idahopress.com'; if ($dbGroups['numrows']>0) { foreach($dbGroups['data'] as $group) { $owners[$group['id']]=$group['group_email']; } } $ticket['submitted_datetime']=$submitdatetime; $ticket['attempt']=$attempted; $ticket['problem']=$problem; send_ticket_message($owners[$ticket['type_id']],$ticket,$dbPriorities['data']['priority_name'],'helpdesk',true); } init_ticket(true); } else { print $dbInsert['error']; } } function show_maintenance($equipmenttype,$equipmentid=0,$componentid=0,$submitted=false) { global $productionStaff,$generalProductionTicketType,$siteID, $defaultInserter; $ticketonly=$_GET['ticketonly']; $helpStatuses=array(); $sql="SELECT * FROM helpdesk_statuses ORDER BY status_order"; $dbStatuses=dbselectmulti($sql); if ($dbStatuses['numrows']>0) { foreach($dbStatuses['data'] as $status) { $helpStatuses[$status['id']]=$status['status_name']; } } else { $helpStatuses[0]="None set!"; } $helpPriorities=array(); $sql="SELECT * FROM helpdesk_priorities ORDER BY priority_order"; $dbPriorities=dbselectmulti($sql); if ($dbPriorities['numrows']>0) { foreach($dbPriorities['data'] as $priority) { $helpPriorities[$priority['id']]=$priority['priority_name']; } } else { $helpPriorities[0]=="None set!"; } $helpTypes=array(); $sql="SELECT * FROM helpdesk_types WHERE production_specific=1 ORDER BY type_name"; $dbTypes=dbselectmulti($sql); if ($dbTypes['numrows']>0) { foreach($dbTypes['data'] as $type) { $helpTypes[$type['id']]=$type['type_name']; } } else { $helpTypes[0]=="None set!"; } print "<div id='unitdisplay' style='float:left;height:580px;background-color:#FEFE78;width:120px;'>\n"; if($ticketonly) { print "<p style='font-weight:bold;'>General Trouble Ticket</p>"; } else { if ($equipmenttype=='generic') { //see if there is also a specified component if($componentid!=0){ $sql="SELECT * FROM equipment_component WHERE id=$componentid"; $dbComponent=dbselectsingle($sql); if($dbComponent['data']['component_image']!='') { $image=$dbComponent['data']['component_image']; print "<img src='artwork/equipmentImages/$image' width=80 border=0><br>\n"; } $componentname=$dbComponent['data']['component_name']; } //lets show the name of the component and equipment $sql="SELECT * FROM equipment WHERE id=$equipmentid AND equipment_type='generic'"; $dbE=dbselectsingle($sql); $equipmentname=$dbE['data']['equipment_name']; print "<p style='font-weight:bold;'>$equipmentname<br>$componentname</p>"; } else if ($equipmenttype=='inserter') { print "<div style='width:80px;margin-left:auto;margin-right:auto;text-align:center;vertical-align:center;font-weight:bold;'>\n"; $sql="SELECT * FROM inserters_hoppers WHERE id=$componentid"; $dbHopper=dbselectsingle($sql); $hoppername=$dbHopper['data']['hopper_number']; print "Station<br>$hoppername"; print "</div>\n"; } } print "</div>\n"; print "<div id='partsreplace' style='float:left;margin-left:10px;width:830px;height:600px;overflow:hidden;'>\n"; print "<div id='tabs'>\n"; print "<ul id='maintenance'>\n"; print "<li><a href='#report'>Report A Problem</a></li>\n"; if(!$ticketonly) { print "<li><a href='#perform'>Perform Maintenance</a></li>\n"; } print "<li><a href='#search'>Look for existing solutions!</a></li>\n"; if(!$ticketonly) { print "<li><a href='#history'>View history of this unit</a></li>\n"; } print "</ul>\n"; print "<div id='report' style='height:510px;'>\n"; if ($submitted) { print "<p style='margin-top:10px;margin-bottom:10px;color:#AC1D23;text-align:center;font-weight:bold;font-size:14px;'>Your trouble ticket has been submitted.</p>\n"; } print "<form method=post>\n"; print "<p style='text-align:center;color:#AC1D23;font-size:16px;'>If you replaced any parts, please indicate that in the 'Perform Maintenance' tab.</p>\n"; make_select('topic',$helpTypes[$generalProductionTicketType],$helpTypes,'Topic','Select general category for this issue to help categorize it.'); make_select('priority',$helpPriorities[0],$helpPriorities,'Priority'); make_textarea('problem','','What<br />is the problem?','Tell us what happened as clearly as possible.',83,6,false); make_textarea('attempted','','What did you try?','Tell us how you tried to fix it or your workaround for the problem.',83,6,false); print "<div class='label'>Reported By</div><div class='input'>\n"; print input_select('submittedby',$productionStaff[$_SESSION['cmsuser']['userid']],$productionStaff)." "; print input_checkbox('alertme',0)." Send me an email with the solution when the problem is fixed."; print "</div><div class='clear'></div>\n"; make_submit('submit','Submit Trouble Ticket'); if($ticketonly) { $equipmentid=0; $componentid=0; $type='general'; $unit=''; $subid=0; } make_hidden('equipmentid',$equipmentid); make_hidden('componentid',$componentid); make_hidden('type',$equipmenttype); make_hidden('location',"Unit:$unitid|Sub:$subid"); print "</form>\n"; print "</div>\n"; if(!$ticketonly) { print "<div id='perform' style='height:510px;'>\n"; print "<div id='col1' style='float:left;width:380px;height:500px;overflow-y:scroll;'>\n"; print "<p><b>Parts</b></p>\n"; //get all the components that are sub as well $components=$componentid.","; $sql="SELECT DISTINCT(id) FROM equipment_component WHERE equipment_id=$equipmentid OR parent_id=$componentid"; $dbComponents=dbselectmulti($sql); if($dbComponents['numrows']>0) { foreach($dbComponents['data'] as $c) { $components.=$c['id'].","; } } $components=substr($components,0,strlen($components)-1); $sql="SELECT A.*, B.component_id FROM equipment_part A, equipment_part_xref B WHERE A.id=B.part_id AND B.equipment_id='$equipmentid' AND B.component_id IN($components) AND B.equipment_type='$equipmenttype'"; $dbParts=dbselectmulti($sql); if ($dbParts['numrows']>0) { foreach($dbParts['data'] as $part) { print "<div id='partholder_$part[id]' style='width:330px;background-color:white;padding:4px;margin-bottom:4px;'>\n"; print "<div style='font-size:14px;float:left;width:300px;'>$part[part_name]</span>\n"; //lets see if we can find an open instance of this part $sql="SELECT * FROM part_instances WHERE equipment_type='$equipmenttype' AND equipment_id='$equipmentid' AND component_id='$componentid' AND sub_component_id='$part[component_id]' AND part_id=$part[id] AND replaced=0"; $dbInstance=dbselectsingle($sql); print "<div id='part_info_$part[id]' style='font-size:10px;'>\n"; if ($dbInstance['numrows']>0) { $instance=$dbInstance['data']; $installed=date("m/d/Y", strtotime($instance['install_datetime'])); $curCount=$instance['cur_count']; $curTime=round($instance['cur_count']/60,2); print "Installed on $installed, current impressions $curCount and $curTime days.<br>"; if($part['part_life_type']=='impressions') { $lifeCount=$part['part_life_impressions']; if($lifeCount<$curCount) { print "<span style='color:red;'>Part is beyond the recommended life of $lifeCount. Please check and replace soon.</span>"; } else { print "There are at least ".($lifeCount-$curCount)." cycles remaining before this part reaches its recommended replacement point."; } } else { $lifeCount=$part['part_life_days']; if($lifeCount<$curTime) { print "<span style='color:red;'>Part is beyond the recommended life of $lifeCount. Please check and replace soon.</span>"; } else { print "There are at least ".($lifeCount-$curTime)." days remaining before this part reaches its recommended replacement point."; } } } else { print "Not installed on this unit. "; } print "</div><!--closing the info box area -->\n"; print "</div>\n"; print "<div style='margin-left:5px;float:right;'>\n"; print "<a title='Part Replacement' href='includes/ajax_handlers/partReplacement.php?action=perform&item=$item&equipmenttype=$equipmenttype&equipmentid=$equipmentid&componentid=$componentid&subcomponentid=$part[component_id]&partid=$part[id]' class='ajaxload'><img src='artwork/icons/spanner_48.png' border=0 width=24'></a>\n"; print "</div>\n"; print "<div class='clear'></div>\n"; print "</div>\n"; } } print "</div>\n"; //column 2 - maintenance - tasks will be stacked for printing units print "<div id='col2' style='margin-left:10px;float:left;width:380px;height:500px;overflow-y:scroll;'>\n"; print "<p><b>Maintenance Tasks</b></p>\n"; $sql="SELECT A.*, B.component_id FROM equipment_pm A, equipment_pm_xref B WHERE A.id=B.pm_id AND B.equipment_id='$equipmentid' AND B.component_id IN ($components) AND B.equipment_type='$equipmenttype'"; $dbTasks=dbselectmulti($sql); if ($dbTasks['numrows']>0) { foreach($dbTasks['data'] as $task) { print "<div id='task_$task[id]' style='width:330px;background-color:white;padding:4px;margin-bottom:4px;'>\n"; print "<div style='font-size:14px;float:left;'>$task[pm_name]<br>\n"; //lets see if we can find an open instance of this part $sql="SELECT * FROM pm_instances WHERE equipment_type='$equipmenttype' AND equipment_id='$equipmentid' AND component_id='$componentid' AND sub_component_id='$part[component_id]' AND pm_id=$task[id] AND replaced=0"; $dbInstance=dbselectsingle($sql); print "<div id='pm_info_$task[id]' style='font-size:10px;'>\n"; if ($dbInstance['numrows']>0) { $instance=$dbInstance['data']; $curCount=$instance['cur_count']; $curTime=round($instance['cur_count']/60,2); $installed=date("m/d/Y", strtotime($instance['install_datetime'])); $duedate=date("m/d/Y",strtotime($installed."+$curTime days")); print "Last performed on $installed<br>"; if($task['pm_life_type']=='impressions') { $lifeCount=$task['pm_life_impressions']; if($lifeCount<$curCount) { print "<span style='color:red;'>Maintence task should have been done at $lifeCount. Please check and perform task soon.</span>"; } else { print "There are at least ".($lifeCount-$curCount)." cycles remaining before this task needs to be done."; } } else { $lifeCount=$task['pm_life_days']; if($lifeCount<$curTime) { print "<span style='color:red;'>Maintence task should have been done at $lifeCount. Please check and perform task soon.</span>"; } else { print "There are at least ".($lifeCount-$curTime)." days remaining before this task needs to be done."; } } } else { print "Not yet performed on this unit."; } print "</div><!--closing the info box area -->\n"; print "</div>\n"; print "<div style='margin-left:5px;float:right;'>\n"; print "<a title='PM Task' href='includes/ajax_handlers/partReplacement.php?action=performpm&item=$item&equipmenttype=$equipmenttype&equipmentid=$equipmentid&componentid=$componentid]&subcomponentid=$part[component_id]&partid=$task[id]' class='ajaxload'><img src='artwork/icons/spanner_48.png' border=0 width=24'></a>\n"; print "</div>\n"; print "<div class='clear'></div>\n"; print "</div>\n"; } } print "</div>\n"; print "</div><!-- closes the perform maintenance tab -->\n"; } //closing conditional ticket only /* SEARCH TAB * utilizes a script called getMaintenanceHelpTopics that queries a script called findTroubleSolutions in ajax_helpers * returns an html block that is rendered in the search_results div */ print "<div id='search' style='height:510px;'>\n"; print "<b>Keywords:</b><input type='text' id='keywords' placeholder='Search terms...' style='width:200px;margin-left:20px;margin-right:10px;' />\n"; print "<input type='button' value='Search' onclick='getMaintenanceHelpTopics(\"mailroom\");'>\n<br><br>\n"; print "<div id='search_results' style='width:800px;height:470px;overflow-y:scroll;'></div>\n"; print "</div><!-- closes the search tab -->\n"; if(!$ticketonly) { print "<div id='history' style='height:510px;'>\n"; print "<div id='mainthistory' style='float:left;width:400px;height:500px;overflow-y:scroll;'>\n"; print "<p style='font-weight:bold;'>Here is the history of issues for this unit</p>\n"; $sql="SELECT * FROM maintenance_tickets WHERE object_id='$equipmentid' AND object_unit='$componentid' AND object_type='$equipmenttype'"; $dbTickets=dbselectmulti($sql); if ($dbTickets['numrows']>0) { foreach($dbTickets['data'] as $ticket) { $priority=$helpPriorities[$ticket['priority_id']]; $type=$helpTypes[$ticket['type_id']]; $id=$ticket['id']; $brief=$ticket['problem']; print "<p class='dashboardHeadline'><a href='maintenanceTickets.php?action=edit&id=$id' target='_parent'>Maintence Ticket # $id</a></p>\n"; print "<p style='font-size:12px;'>Priority: $priority<br>\n"; print "Trouble type: $type<br>\n"; print "$brief</p>\n"; } } else { print "<h3>No trouble tickets submitted for this unit yet.</h3>\n"; } print "</div>\n"; print "<div id='parthistory' style='float:left;margin-left:20px;width:350px;height:500px;overflow-y:scroll;'>\n"; print "<p style='font-weight:bold;'>Here is the part replacement history for the past 6 months for this unit</p>\n"; $dateback=date("Y-m-d",strtotime("-6 months")); $sql="SELECT B.part_name, A.install_datetime, A.cur_time, A.cur_count FROM part_instances A, equipment_part B WHERE A.part_id=B.id AND A.equipment_id='$equipmentid' AND A.component_id='$componentid' AND A.equipment_type='$equipmenttype' AND install_datetime>='$dateback' ORDER BY install_datetime DESC"; $dbParts=dbselectmulti($sql); if ($dbParts['numrows']>0) { foreach($dbParts['data'] as $part) { $partname=$part['part_name']; $installdate=$part['install_datetime']; $currenttime=round($part['cur_time']/60/24,2); $currentcount=$part['cur_count']; print "<div style='font-size:10px;margin-bottom:4px;padding-bottom:4px;border-bottom:thin solid black;'>\n"; print "$partname - installed on $installdate<br>\n"; print "<div style='float:left;width:150px;'>Run time: $currenttime days</div>\n"; print "<div style='float:left;width:150px;'>Run impressions: $currentcount</div><div class='clear'></div></p>\n"; print "</div>\n"; } } print "</div>\n"; print "</div><!-- closes the history tab -->\n"; } //closing ticket only conditional print "</div>\n";//ends wrapper for tabbed area print "<div id='dialog'></div>\n"; ?> <script type='text/javascript'> $(function() { $( '#tabs' ).tabs(); }); var ajaxdialog=$("#dialog").dialog({ title: 'Perform Maintenance', autoOpen: false, height: '400', width: 600, modal:true, buttons: [ { text: 'Cancel', click: function() { $(this).dialog('close'); } }, { text: 'Perform Maintenance', click: function() { $('#ajaxRepairForm').submit(); $(this).dialog('close'); } } ] }) $('a.ajaxload').click(function() { var url = this.href; ajaxdialog.load(url).dialog('open'); return false; }) // post-submit callback function showResponse(responseText, statusText, xhr, $form) { // for normal html responses, the first argument to the success callback // is the XMLHttpRequest object's responseText property // if the ajaxForm method was passed an Options Object with the dataType // property set to 'xml' then the first argument to the success callback // is the XMLHttpRequest object's responseXML property // if the ajaxForm method was passed an Options Object with the dataType // property set to 'json' then the first argument to the success callback // is the json data object returned by the server var response=responseText.split("|"); if ($.trim(response[0])=='success') { $('#'+$.trim(response[2])).html($.trim(response[1])); } else { var $dialog = $('<div id="jConfirm"></div>') .html('<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>'+response[1]+'</p>') .dialog({ autoOpen: true, modal: true, title: 'An error occurred:', buttons:[ { text: 'Close', click: function() { $(this).dialog('destroy'); } }] }) } } </script> <?php print "</div>\n"; } function build_inserter($inserterid) { $sql="SELECT * FROM inserters WHERE id=$inserterid"; $dbInserter=dbselectsingle($sql); $inserter=$dbInserter['data']; if($inserter['inserter_type']=='oval') { //this means we have two rows, with half in reverse order print "<div id='inserterholder_top' style='margin-bottom:20px;'>\n"; $sql="SELECT * FROM inserters_hoppers WHERE inserter_id=$inserterid AND hopper_number>$inserter[inserter_turn] ORDER BY hopper_number DESC"; $dbPockets=dbselectmulti($sql); if ($dbPockets['numrows']>0) { foreach($dbPockets['data'] as $pocket) { print "<div id='station_$pocket[id]' class='station' style='float:left;width:80px;height:80px;text-align:center;font-weight:bold;font-size:18px;border:thin solid black;margin-right:2px;'>$pocket[hopper_number]</div>"; ?> <script> $(document).ready(function(){ $('#station_<?php echo $pocket['id']?>').click(function(){ window.location="maintenanceInserter.php?type=inserter&equipmentid=<?php echo $inserterid ?>&componentid=<?php echo $pocket['id']; ?>"; }) }) </script> <?php } } print "<div class='clear'></div>\n"; print "</div>\n"; print "<div id='inserterholder_bottom' style='margin-bottom:20px;'>\n"; $sql="SELECT * FROM inserters_hoppers WHERE inserter_id=$inserterid AND hopper_number<=$inserter[inserter_turn] ORDER BY hopper_number"; $dbPockets=dbselectmulti($sql); if ($dbPockets['numrows']>0) { foreach($dbPockets['data'] as $pocket) { print "<div id='station_$pocket[id]' class='station' style='float:left;width:80px;height:80px;text-align:center;font-weight:bold;font-size:18px;border:thin solid black;margin-right:2px;'>$pocket[hopper_number]</div>"; ?> <script> $(document).ready(function(){ $('#station_<?php echo $pocket['id']?>').click(function(){ window.location="maintenanceInserter.php?type=inserter&equipment=<?php echo $inserterid ?>&componentid=<?php echo $pocket['id']; ?>"; }) }) </script> <?php } } print "<div class='clear'></div>\n"; print "</div>\n"; } else { //now we build it! $sql="SELECT * FROM inserters_hoppers WHERE inserter_id=$inserterid ORDER BY hopper_number"; $dbPockets=dbselectmulti($sql); if ($dbPockets['numrows']>0) { print "<div id='inserterholder' style='margin-bottom:20px;'>\n"; foreach($dbPockets['data'] as $pocket) { print "<div id='station_$pocket[id]' class='station' style='float:left;width:80px;height:80px;text-align:center;font-weight:bold;font-size:18px;border:thin solid black;margin-right:2px;'>$pocket[hopper_number]</div>"; ?> <script> $(document).ready(function(){ $('#station_<?php echo $pocket['id']?>').click(function(){ window.location="maintenanceInserter.php?type=inserter&equipmentid=<?php echo $inserterid ?>&componentid=<?php echo $pocket['id']; ?>"; }) }) </script> <?php } print "</div>\n"; } } ?> <script> $('.station').mouseover(function(){ $(this).css('background-color','yellow'); }) $('.station').mouseout(function(){ $(this).css('background-color','white'); }) </script> <?php } footer(); ?>
Pioneer-Web-Development/Mango
maintenanceInserter.php
PHP
gpl-3.0
32,770
package es.lavandadelpatio.auto.service; import com.ibm.watson.developer_cloud.conversation.v1.model.Entity; import com.ibm.watson.developer_cloud.conversation.v1.model.Intent; import com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse; import es.lavandadelpatio.auto.TelegramModels.Message; import es.lavandadelpatio.auto.TelegramModels.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; /** * Created by raulm on 30/06/2017. */ @Service public class MessageService { private static final String FILTRO_ACTIVACION = "@lavanda_chat_bot"; private static final String REEMPLAZAR_POR_USER = "{}"; private static final Logger logger = LoggerFactory.getLogger(MessageService.class); Map<Long, Map<String, Object>> contextData = new HashMap<>(); Set<String> listaConfianza = new HashSet<>(Arrays.asList("54567045")); // Para debug List<Entity> entidades = new ArrayList<>(); List<Intent> intenciones = new ArrayList<>(); @Autowired WatsonConversationService wcs; public Optional<String> processMessage(Message message){ if(!debemosProcesador(message)) return Optional.empty(); String entrada = preProcesado(message.getText().get()).trim(); String respuesta; if(entrada.startsWith("/")){ logger.info("Procesando como comando"); respuesta = processAsCommand(entrada.substring(1).split(" "), message); } else { logger.info("Enviando mensaje para procesar a Watson"); respuesta = processAsWatson(entrada, message.getChat().getId()); } return Optional.of(postProcesado(respuesta, message.getFrom().get().getUsername().get())); } private String processAsCommand(String[] params, Message message){ StringBuilder sb; switch(params[0]){ case "ayuda": return "No me apetece mucho ayudarte la verdad. Es broma, esta en construcción"; case "resetcontext": if(esDeConfianza(message.getFrom().get())){ this.contextData = new HashMap<>(); return "Contexto destruido, empezando de 0"; } return "Tu no eres mi amigo, no confio en ti."; case "desactivar": return "Pendiente de implementacion"; case "activar": return "Pendiente de implementacion"; case "getId": return "Tu codigo de usuario es :" +Long.toString(message.getFrom().get().getId()); case "ping": return "pong"; case "entidades": sb = new StringBuilder().append("Posibles entidades detectadas en el ultimo mensaje: "); entidades.forEach(e -> sb.append(e.getEntity()).append(":").append(e.getValue()).append(" ")); return sb.toString(); case "intenciones": sb = new StringBuilder().append("Intenciones del ultimo mensaje: "); intenciones.forEach(i -> sb.append(i.getIntent()).append(" - ").append(i.getConfidence()).append(" ")); return sb.toString(); default: return "Comando no reconocido, para ver la lista de comandos pon /ayuda"; } } /** * Send the message to Watson Conversation for further processing. * @param message The message to be sent * @param id The key that will be used in order to identify a context, both for retrieving it and updating it. * @return Watson response */ private String processAsWatson(String message, long id){ MessageResponse mr = wcs.sendMessage(message, getContextData(id)); entidades = mr.getEntities(); intenciones = mr.getIntents(); //logger.info("Entidades: {}, Intenciones: {}", entidades, intenciones); saveContextData(mr.getContext(), id); if(mr.getText().isEmpty()) return generateResponse(mr); return String.join("\n", mr.getText()); } /** * Genera la respuesta si Watson no lo ha hecho. * @param mr * @return */ private String generateResponse(MessageResponse mr) { if(mr.getIntents().isEmpty()) throw new IllegalArgumentException("Cannot generate the response without intent data"); switch (mr.getIntents().get(0).getIntent()){ case "pregunta": return ""; default: return "No implementado"; } } private void saveContextData(Map<String, Object> context, long id){ this.contextData.put(id, context); } private Map<String, Object> getContextData(long id){ return this.contextData.get(id); } /** * Comprueba si cumple los requisitos para ser procesado * @param message Mensaje a ser procesado * @return Verdadero si lo ignoramos, falso en caso contrario */ private boolean debemosProcesador(Message message){ return message.getText() != null && message.getText().isPresent() && message.getText().get().contains(FILTRO_ACTIVACION) && message.getFrom().isPresent(); } /** * Operaciones a realizar sobre la entrada antes de enviarla a Watson * @param s String a procesar antes de enviar * @return String procesado */ private String preProcesado(String s){ return s.replace(FILTRO_ACTIVACION, ""); } /** * Operaciones a realizar una vez que tenemos la respuesta de Watson, por ahora solo inyectar el * nombre del usuario si es necesario * @param s1 String base * @param s2 String para reemplazar * @return String procesado */ private String postProcesado(String s1, String s2){ return s1.replace(REEMPLAZAR_POR_USER, s2); } private boolean esDeConfianza(User user){ return listaConfianza.contains(Long.toString(user.getId())); } }
ExtremoBlando/LavandaBot
src/main/java/es/lavandadelpatio/auto/service/MessageService.java
Java
gpl-3.0
6,159
<?php /** * URL helper class. * * @package Kohana * @category Helpers * @author Kohana Team * @copyright (c) 2007-2011 Kohana Team * @license http://kohanaframework.org/license */ class URL { /** * Gets the base URL to the application. * To specify a protocol, provide the protocol as a string or request object. * If a protocol is used, a complete URL will be generated using the * `$_SERVER['HTTP_HOST']` variable. * * // Absolute URL path with no host or protocol * echo URL::base(); * * // Absolute URL path with host, https protocol and index.php if set * echo URL::base('https', TRUE); * * // Absolute URL path with host and protocol from $request * echo URL::base($request); * * @param mixed $protocol Protocol string, [Request], or boolean * @param boolean $index Add index file to URL? * @return string * @uses Kohana::$index_file * @uses Request::protocol() */ public static function base($protocol = NULL, $index = FALSE) { // Start with the configured base URL $base_url = Kohana::$base_url; if ($protocol === TRUE) { // Use the initial request to get the protocol $protocol = Request::$initial; } if ($protocol instanceof Request) { // Use the current protocol list($protocol) = explode('/', strtolower($protocol->protocol())); } if ( ! $protocol) { // Use the configured default protocol $protocol = parse_url($base_url, PHP_URL_SCHEME); } if ($index === TRUE AND ! empty(Kohana::$index_file)) { // Add the index file to the URL $base_url .= Kohana::$index_file.'/'; } if (is_string($protocol)) { if ($port = parse_url($base_url, PHP_URL_PORT)) { // Found a port, make it usable for the URL $port = ':'.$port; } if ($domain = parse_url($base_url, PHP_URL_HOST)) { // Remove everything but the path from the URL $base_url = parse_url($base_url, PHP_URL_PATH); } else { // Attempt to use HTTP_HOST and fallback to SERVER_NAME $domain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; } // Add the protocol and domain to the base URL $base_url = $protocol.'://'.$domain.$port.$base_url; } return $base_url; } /** * Fetches an absolute site URL based on a URI segment. * * echo URL::site('foo/bar'); * * @param string $uri Site URI to convert * @param mixed $protocol Protocol string or [Request] class to use protocol from * @param boolean $index Include the index_page in the URL * @return string * @uses URL::base */ public static function site($uri = '', $protocol = NULL, $index = TRUE) { // Chop off possible scheme, host, port, user and pass parts $path = preg_replace('~^[-a-z0-9+.]++://[^/]++/?~', '', trim($uri, '/')); if ( ! UTF8::is_ascii($path)) { // Encode all non-ASCII characters, as per RFC 1738 $path = preg_replace('~([^/]+)~e', 'rawurlencode("$1")', $path); } // Concat the URL return URL::base($protocol, $index).$path; } /** * Merges the current GET parameters with an array of new or overloaded * parameters and returns the resulting query string. * * // Returns "?sort=title&limit=10" combined with any existing GET values * $query = URL::query(array('sort' => 'title', 'limit' => 10)); * * Typically you would use this when you are sorting query results, * or something similar. * * [!!] Parameters with a NULL value are left out. * * @param array $params Array of GET parameters * @param boolean $use_get Include current request GET parameters * @return string */ public static function query(array $params = NULL, $use_get = TRUE) { if ($use_get) { if ($params === NULL) { // Use only the current parameters $params = $_GET; } else { // Merge the current and new parameters $params = array_merge($_GET, $params); } } if (empty($params)) { // No query parameters return ''; } // Note: http_build_query returns an empty string for a params array with only NULL values $query = http_build_query($params, '', '&'); // Don't prepend '?' to an empty string return ($query === '') ? '' : ('?'.$query); } /** * Convert a phrase to a URL-safe title. * * echo URL::title('My Blog Post'); // "my-blog-post" * * @param string $title Phrase to convert * @param string $separator Word separator (any single character) * @param boolean $ascii_only Transliterate to ASCII? * @return string * @uses UTF8::transliterate_to_ascii */ public static function title($title, $separator = '-', $ascii_only = FALSE) { if ($ascii_only === TRUE) { // Transliterate non-ASCII characters $title = UTF8::transliterate_to_ascii($title); // Remove all characters that are not the separator, a-z, 0-9, or whitespace $title = preg_replace('![^'.preg_quote($separator).'a-z0-9\s]+!', '', strtolower($title)); } else { // Remove all characters that are not the separator, letters, numbers, or whitespace $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', UTF8::strtolower($title)); } // Replace all separator characters and whitespace by a single separator $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title); // Trim separators from the beginning and end return trim($title, $separator); } } // End url
ericperez/squerly
vendor/url.php
PHP
gpl-3.0
5,504
#ifndef COMPMODELSTATICSERIAL_H #define COMPMODELSTATICSERIAL_H #include "../CompSerialize.h" #include "../../../ModelLayer/ObjData/SPos.h" namespace SerialCompModelStatic{ /** Identifiers for each serializable type */ enum Enum{ /** Dummy entry for serialization of incomplete types */ Invalid = 0, ObjEnter = 1, ObjExit = 2, }; } struct SerialObjEnter : public SerialComp{ SerialObjEnter(OBJID objId, SPos* pos, uint32_t modelId): SerialComp(objId, COMPID::modelStatic, (uint32_t)SerialCompModelStatic::ObjEnter, sizeof(SerialObjEnter)){ this->modelId = modelId; this->pos = *pos; } SPos pos; uint32_t modelId; }; struct SerialObjExit : public SerialComp{ SerialObjExit(OBJID objId, SPos* pos, uint32_t fadetime): SerialComp(objId, COMPID::modelStatic, (uint32_t)SerialCompModelStatic::ObjExit, sizeof(SerialObjExit)){ this->fadetime = fadetime; this->pos = *pos; } SPos pos; uint32_t fadetime; }; #endif /* COMPMODELSTATICSERIAL_H */
protective/Wreckage
Server/NetworkLayer/Components/CompModelStatic/CompModelStaticSerial.h
C
gpl-3.0
993
package org.pistonmc.protocol.data; import org.pistonmc.inventory.ItemStack; import org.pistonmc.protocol.stream.PacketOutputStream; import java.io.IOException; public class DataObject<T> { private int index; private DataType type; private T value; public DataObject(int index, byte type, T value) { this.index = index; this.type = DataType.valueOf(type); this.value = value; } public int getIndex() { return index; } public DataType getType() { return type; } public T getValue() { return value; } public void write(PacketOutputStream stream) throws IOException { switch (type.getType()) { case 0: stream.writeByte((Byte) value); break; case 1: stream.writeShort((Short) value); break; case 2: stream.writeInt((Integer) value); break; case 3: stream.writeFloat((Float) value); break; case 4: stream.writeString((String) value); break; case 5: stream.writeItemStack((ItemStack) value); break; case 6: // stream.writeLocation((Location) value); break; } } }
TexasLoki/Piston
src/main/java/org/pistonmc/protocol/data/DataObject.java
Java
gpl-3.0
1,391
#!/bin/bash backup_path=/backup/mysql expired=10 tgl=`date +%Y-%m-%d` if [ ! -d $backup_path/$tgl ] then mkdir -p $backup_path/$tgl if [ ! -f $backup_path/$tgl/db-`date +%H%M`.sql ] then mysqldump --all-databases | gzip -c > $backup_path/$tgl/db-`date +%H%M`.sql fi else if [ ! -f $backup_path/$tgl/db-`date +%H%M`.sql ] then mysqldump --all-databases | gzip -c > $backup_path/$tgl/db-`date +%H%M`.sql fi # echo $tgl " File sudah ada." fi # hapus bila lebih dari nilai expired day # find $backup_path -type d -mtime +$expired | xargs rm -Rf
sentabi/scripts
backup-mysql.sh
Shell
gpl-3.0
561
/* * Copyright (C) 2017 Jacek Sztajnke * * 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 com.grinnotech.patientsorig.view; import static com.grinnotech.patients.model.address.Utils.address; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import com.grinnotech.patients.model.Patient; import com.grinnotech.patientsorig.service.ExportController.Attributes; import com.itextpdf.text.BaseColor; import com.itextpdf.text.Document; import com.itextpdf.text.Font; import com.itextpdf.text.FontFactory; import com.itextpdf.text.Paragraph; import com.itextpdf.text.Phrase; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; import java.time.LocalDate; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class PdfView extends AbstractPdfView { @Override protected void buildPdfDocument(Map<String, Object> model, Document document, PdfWriter writer, HttpServletRequest request, HttpServletResponse response) throws Exception { // change the file name response.setHeader("Content-Disposition", "attachment; filename=\"patients.pdf\""); List<Patient> patients = (List<Patient>) model.get(Attributes.patients.name()); document.add(new Paragraph("Generated patients list " + LocalDate.now())); // PdfPTable table = new PdfPTable(users.stream().findAny().get().getColumnCount()); PdfPTable table = new PdfPTable(5); table.setWidthPercentage(100.0f); table.setSpacingBefore(10); // define font for table header row Font font = FontFactory.getFont(FontFactory.TIMES); font.setColor(BaseColor.WHITE); // define table header cell PdfPCell cell = new PdfPCell(); cell.setBackgroundColor(BaseColor.DARK_GRAY); cell.setPadding(5); MessageSource msgSrc = new MessageSource(ENGLISH); // write table header cell.setPhrase(new Phrase(msgSrc.getMessage("patient_fullname"), font)); table.addCell(cell); cell.setPhrase(new Phrase(msgSrc.getMessage("patient_birthday"), font)); table.addCell(cell); cell.setPhrase(new Phrase(msgSrc.getMessage("patient_pesel"), font)); table.addCell(cell); cell.setPhrase(new Phrase(msgSrc.getMessage("patient_address"), font)); table.addCell(cell); cell.setPhrase(new Phrase(msgSrc.getMessage("patient_status"), font)); table.addCell(cell); for (Patient patient : patients) { table.addCell(format("%s %s", patient.getFirstName(), patient.getLastName())); table.addCell(patient.getBirthday().toString()); table.addCell(patient.getPesel()); table.addCell(address(patient)); table.addCell(patient.getStatus().name()); } document.add(table); } }
sjacek/patients
backend/patients-legacy/src/main/java/com/grinnotech/patientsorig/view/PdfView.java
Java
gpl-3.0
3,359
#region References using System; using System.Diagnostics; using DiagELog = System.Diagnostics.EventLog; #endregion namespace Server { public static class EventLog { static EventLog() { if (!DiagELog.SourceExists("GOW")) { DiagELog.CreateEventSource("GOW", "Application"); } } public static void Error(int eventID, string text) { DiagELog.WriteEntry("GOW", text, EventLogEntryType.Error, eventID); } public static void Error(int eventID, string format, params object[] args) { Error(eventID, String.Format(format, args)); } public static void Warning(int eventID, string text) { DiagELog.WriteEntry("GOW", text, EventLogEntryType.Warning, eventID); } public static void Warning(int eventID, string format, params object[] args) { Warning(eventID, String.Format(format, args)); } public static void Inform(int eventID, string text) { DiagELog.WriteEntry("GOW", text, EventLogEntryType.Information, eventID); } public static void Inform(int eventID, string format, params object[] args) { Inform(eventID, String.Format(format, args)); } } }
GenerationOfWorlds/GOW
Server/EventLog.cs
C#
gpl-3.0
1,122
<?php /** * The Header for our theme. * * Displays all of the <head> section and everything up till <div id="content"> * * @package AccesspressLite */ ?><!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalabe=no"> <title><?php wp_title( '|', true, 'right' ); ?></title> <link rel="profile" href="http://gmpg.org/xfn/11"> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> <!--[if lt IE 9]> <script src="<?php echo get_template_directory_uri(); ?>/js/html5.min.js"></script> <![endif]--> <?php wp_head(); ?> </head> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <body <?php body_class(); ?>> <?php global $accesspresslite_options; $accesspresslite_settings = get_option( 'accesspresslite_options', $accesspresslite_options ); ?> <div id="page" class="site"> <header id="masthead" class="site-header"> <div id="top-header"> <div class="ak-container"> <div class="site-branding"> <?php if ( get_header_image() ) { ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"> <img src="<?php header_image(); ?>" alt="<?php bloginfo('name') ?>"> </a> <?php } ?> <p class="header_text"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">Nazmul Hossain</a></p> <p class="header_para"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">Win or Learn, Never Lose.</a></p> </div><!-- .site-branding --> <div class="right-header clearfix"> <?php do_action( 'accesspresslite_header_text' ); ?> <div class="clearfix"></div> <?php /** * @hooked accesspresslite_social_cb - 10 */ if($accesspresslite_settings['show_social_header'] == 0){ do_action( 'accesspresslite_social_links' ); } if($accesspresslite_settings['show_search'] == 1){ ?> <div class="ak-search"> <?php get_search_form(); ?> </div> <?php } ?> </div><!-- .right-header --> </div><!-- .ak-container --> </div><!-- #top-header --> <nav id="site-navigation" class="main-navigation <?php do_action( 'accesspresslite_menu_alignment' ); ?>"> <div class="ak-container"> <h1 class="menu-toggle"><?php _e( 'Menu', 'accesspresslite' ); ?></h1> <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?> </div> </nav><!-- #site-navigation --> </header><!-- #masthead --> <?php if((is_home() || is_front_page()) && 'page' == get_option( 'show_on_front' )){ $accesspresslite_content_id = "content"; }elseif(is_home() || is_front_page() ){ $accesspresslite_content_id = "home-content"; }else{ $accesspresslite_content_id ="content"; } ?> <div id="<?php echo $accesspresslite_content_id; ?>" class="site-content">
somratcste/somrat.info
header.php
PHP
gpl-3.0
3,168
package minicraft.screen; import minicraft.core.Game; import minicraft.core.io.InputHandler; import minicraft.gfx.Color; import minicraft.gfx.Font; import minicraft.gfx.Point; import minicraft.gfx.Screen; import minicraft.screen.entry.KeyInputEntry; import minicraft.screen.entry.StringEntry; public class KeyInputDisplay extends Display { private boolean listeningForBind, confirmReset; private static Menu.Builder builder; private static KeyInputEntry[] getEntries() { String[] prefs = Game.input.getKeyPrefs(); KeyInputEntry[] entries = new KeyInputEntry[prefs.length]; for (int i = 0; i < entries.length; i++) entries[i] = new KeyInputEntry(prefs[i]); return entries; } public KeyInputDisplay() { super(true); builder = new Menu.Builder(false, 0, RelPos.CENTER, getEntries()) .setTitle("Controls") .setPositioning(new Point(Screen.w/2, Screen.h - Font.textHeight()*5), RelPos.TOP); Menu.Builder popupBuilder = new Menu.Builder(true, 4, RelPos.CENTER) .setShouldRender(false) .setSelectable(false); menus = new Menu[] { builder.createMenu(), popupBuilder .setEntries(StringEntry.useLines(Color.YELLOW, "Press the desired", "key sequence")) .createMenu(), popupBuilder .setEntries(StringEntry.useLines(Color.RED, "Are you sure you want to reset all key bindings to the default keys?", "enter to confirm", "escape to cancel")) .setTitle("Confirm Action") .createMenu() }; listeningForBind = false; confirmReset = false; } @Override public void tick(InputHandler input) { if(listeningForBind) { if(input.keyToChange == null) { // the key has just been set listeningForBind = false; menus[1].shouldRender = false; menus[0].updateSelectedEntry(new KeyInputEntry(input.getChangedKey())); selection = 0; } return; } if(confirmReset) { if(input.getKey("exit").clicked) { confirmReset = false; menus[2].shouldRender = false; selection = 0; } else if(input.getKey("select").clicked) { confirmReset = false; input.resetKeyBindings(); menus[2].shouldRender = false; menus[0] = builder.setEntries(getEntries()) .setSelection(menus[0].getSelection(), menus[0].getDispSelection()) .createMenu() ; selection = 0; } return; } super.tick(input); // ticks menu if(input.keyToChange != null) { listeningForBind = true; selection = 1; menus[selection].shouldRender = true; } else if(input.getKey("shift-d").clicked && !confirmReset) { confirmReset = true; selection = 2; menus[selection].shouldRender = true; } } public void render(Screen screen) { if(selection == 0) // not necessary to put in if statement now, but it's probably more efficient anyway screen.clear(0); super.render(screen); if(!listeningForBind && !confirmReset) { String[] lines = { "Press C/Enter to change key binding", "Press A to add key binding", "Shift-D to reset all keys to default", Game.input.getMapping("exit")+" to Return to menu" }; for(int i = 0; i < lines.length; i++) Font.drawCentered(lines[i], screen, Screen.h-Font.textHeight()*(4-i), Color.WHITE); } } }
chrisj42/minicraft-plus-revived
src/main/java/minicraft/screen/KeyInputDisplay.java
Java
gpl-3.0
3,226
/* * Copyright (C) 2014 Roland Dobai * * This file is part of ZyEHW. * * ZyEHW 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. * * ZyEHW 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 ZyEHW. If not, see <http://www.gnu.org/licenses/>. */ #include "dpr.h" #include <stdlib.h> #include <string.h> #include "bitstream.h" #include "xdevcfg.h" #if 0 #define DPR_DEBUG #endif #if 0 #define DPR_BITSTREAM_OUT #endif static XDcfg_Config *devc = NULL; static XDcfg dev; #ifdef DPR_BITSTREAM_OUT static inline void print_bitstream(const u32 *stream, int size) { int i; for (i = 0; i < size; ++i) xil_printf("0x%X\n\r", stream[i]); } #endif void dpr_reconfigure() { volatile u32 reg; if (!devc) { devc = XDcfg_LookupConfig(XPAR_XDCFG_0_DEVICE_ID); if (XDcfg_CfgInitialize(&dev, devc, devc->BaseAddr) != XST_SUCCESS) { print("DevC initialization failed\n"); exit(-1); } XDcfg_Unlock(&dev); if (XDcfg_SelfTest(&dev) != XST_SUCCESS) print("DevC self-test failed\n\r"); XDcfg_EnablePCAP(&dev); XDcfg_SetControlRegister(&dev, XDCFG_CTRL_PCAP_PR_MASK); } XDcfg_IntrClear(&dev, (XDCFG_IXR_DMA_DONE_MASK | XDCFG_IXR_D_P_DONE_MASK)); #ifdef DPR_DEBUG print("Starting the DMA transfer\n\r"); #endif /* Download bitstream in non secure mode */ if (XDcfg_Transfer(&dev, lut_stream, size_of_lut_stream(), (void *) XDCFG_DMA_INVALID_ADDRESS, 0, XDCFG_NON_SECURE_PCAP_WRITE) != XST_SUCCESS) { print("DMA transfer failed\n\r"); exit(-1); } #ifdef DPR_DEBUG else print("DMA transfer OK\n\r"); #endif for (reg = 0; (reg & XDCFG_IXR_DMA_DONE_MASK) != XDCFG_IXR_DMA_DONE_MASK; reg = XDcfg_IntrGetStatus(&dev)); for (reg = 0; (reg & XDCFG_IXR_D_P_DONE_MASK) != XDCFG_IXR_D_P_DONE_MASK; reg = XDcfg_IntrGetStatus(&dev)); #ifdef DPR_DEBUG print("DPR complete :-)\n\r"); #endif #ifdef DPR_BITSTREAM_OUT print("Bitstream:\n\r"); print_bitstream(lut_stream, size_of_lut_stream()); #endif }
dobairoland/ZyEHW
sw/vidproc/cpu1/dpr.c
C
gpl-3.0
2,945