code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
<!-- Give the category a name. --> <p> {!! Form::label('title','Title:') !!} {!! Form::text('title', old('title'), ['class' => 'form-control']) !!} </p> <!-- Give a good description. --> <p> {!! Form::label('description', 'Description:') !!} {!! Form::textarea('description', old('description'), ['class' => 'form-control']) !!} </p> <!-- Provide the slug. A slug is what the browser will read for SEO. --> <p> {!! Form::label('slug','Slug:') !!} {!! Form::text('slug', old('slug'), ['class' => 'form-control']) !!} </p> <!-- Submit the form --> <p> {!! Form::submit($submitButtonText, ['class' => 'btn btn-success']) !!} </p>
pchater/flommerce.dev
resources/views/categories/form.blade.php
PHP
gpl-3.0
627
/* * Copyright (C) 2017 GedMarc * * 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.jwebmp.core.base.servlets; import com.google.inject.Singleton; import com.guicedee.guicedinjection.json.StaticStrings; import com.guicedee.guicedinjection.GuiceContext; import com.guicedee.guicedservlets.GuicedServletKeys; import com.guicedee.logger.LogFactory; import jakarta.servlet.http.HttpServletResponse; import java.util.logging.Level; import java.util.logging.Logger; /** * The base Servlet for the JWebSwing environment. Constructs each page on call * * @author GedMarc * @version 1.1 * @since 2012/10/09 */ @Singleton public class JWebMPServlet extends JWDefaultServlet { /** * The logger for the swing Servlet */ private static final Logger log = LogFactory.getInstance() .getLogger("JWebSwingServlet"); /** * Constructs a new JWebSwing Servlet that is not session aware */ public JWebMPServlet() { //Nothing Needed } /** * When to perform any commands */ @Override public void perform() { HttpServletResponse response = GuiceContext.get(GuicedServletKeys.getHttpServletResponseKey()); sendPage(response); } /** * Sends the page out * * @param response * The response object */ private void sendPage(HttpServletResponse response) { response.setContentType(StaticStrings.HTML_HEADER_DEFAULT_CONTENT_TYPE); writeOutput(getPageHTML(), StaticStrings.HTML_HEADER_DEFAULT_CONTENT_TYPE, StaticStrings.UTF_CHARSET); } /** * Destroys this object and all references to it */ @Override public void destroy() { try { JWebMPServlet.log.log(Level.INFO, "Destroying Servlet JWebMP Servlet and all Static Objects"); GuiceContext.destroy(); } catch (Exception t) { JWebMPServlet.log.log(Level.SEVERE, "Unable to destroy", t); } super.destroy(); } }
GedMarc/JWebSwing
src/main/java/com/jwebmp/core/base/servlets/JWebMPServlet.java
Java
gpl-3.0
2,483
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.iescomercio.tema5.cuentas_bancarias; /** * * @author VESPERTINO */ public class CuentaAhorro extends CuentaCorriente { private double interes; public CuentaAhorro(Titular t, Numero_de_Cuenta nc, double saldo, double interes){ super(t, nc, saldo); this.interes = interes; } public CuentaAhorro(Titular t, Numero_de_Cuenta nc, double interes){ this(t, nc, 15.3, interes); } public CuentaAhorro(Titular t, Numero_de_Cuenta nc){ this(t, nc, 15.3, 2.5); } public double getInteres(){ return interes; } public void calcularInteres(){ ingresar(getSaldo() * (interes / 100)); } }
sagasta95/DAW1
src/com/iescomercio/tema5/cuentas_bancarias/CuentaAhorro.java
Java
gpl-3.0
921
#pragma once #include "GLTexture.hpp" namespace mls { template<GLenum textureType> class GLTextureHandle { GLuint64 m_nHandle = 0u; public: explicit GLTextureHandle(GLuint64 handle = 0u) : m_nHandle(handle) { } explicit GLTextureHandle(const GLTextureBase<textureType>& texture): m_nHandle(glGetTextureHandleNV(texture.glId())) { } explicit operator bool() const { return m_nHandle != 0u; } explicit operator GLuint64() const { return m_nHandle; } bool isResident() const { assert(m_nHandle); return glIsTextureHandleResidentNV(m_nHandle); } void makeResident() const { assert(m_nHandle); return glMakeTextureHandleResidentNV(m_nHandle); } void makeNonResident() const { assert(m_nHandle); return glMakeTextureHandleNonResidentNV(m_nHandle); } }; template<GLenum textureType> class GLImageHandle { GLuint64 m_nHandle = 0u; public: explicit GLImageHandle(GLuint64 handle = 0u) : m_nHandle(handle) { } explicit GLImageHandle(const GLTextureBase<textureType>& texture, GLint level, GLint layer, GLenum format): m_nHandle(glGetImageHandleNV(texture.glId(), level, GL_FALSE, layer, format)) { } explicit GLImageHandle(const GLTextureBase<textureType>& texture, GLint level, GLenum format): m_nHandle(glGetImageHandleNV(texture.glId(), level, GL_TRUE, 0, format)) { } explicit operator bool() const { return m_nHandle != 0u; } explicit operator GLuint64() const { return m_nHandle; } void makeResident(GLenum access) const { glMakeImageHandleResidentNV(m_nHandle, access); } bool isResident() const { return glIsImageHandleResidentNV(m_nHandle); } void makeNonResident() const { glMakeImageHandleNonResidentNV(m_nHandle); } }; using GLTexture2DHandle = GLTextureHandle<GL_TEXTURE_2D>; using GLTexture3DHandle = GLTextureHandle<GL_TEXTURE_3D>; using GLTextureCubeMapHandle = GLTextureHandle<GL_TEXTURE_CUBE_MAP>; using GLTexture2DArrayHandle = GLTextureHandle<GL_TEXTURE_2D_ARRAY>; using GLTextureCubeMapArrayHandle = GLTextureHandle<GL_TEXTURE_CUBE_MAP_ARRAY>; using GLImage2DHandle = GLImageHandle<GL_TEXTURE_2D>; using GLImage3DHandle = GLImageHandle<GL_TEXTURE_3D>; using GLImageCubeMapHandle = GLImageHandle<GL_TEXTURE_CUBE_MAP>; using GLImage2DArrayHandle = GLImageHandle<GL_TEXTURE_2D_ARRAY>; using GLImageCubeMapArrayHandle = GLImageHandle<GL_TEXTURE_CUBE_MAP_ARRAY>; }
Celeborn2BeAlive/melisandre
melisandre/src/melisandre/opengl/utils/GLBindlessTexture.hpp
C++
gpl-3.0
2,692
using System; using System.Collections.Generic; using System.Linq; using ColossalFramework; namespace CWS_MrSlurpExtensions { public class DistrictInfo { public int DistrictID { get; set; } public String DistrictName { get; set; } public DistrictServiceData Population { get; set; } public int TotalBuildingCount { get; set; } public int TotalVehicleCount { get; set; } public int WeeklyTouristVisits { get; set; } public int AverageLandValue { get; set; } public Double Pollution { get; set; } public DistrictDoubleServiceData Jobs { get; set; } public DistrictDoubleServiceData Households { get; set; } public Dictionary<string, DistrictServiceData> Privates { get; set; } public DistrictServiceData Happiness { get; set; } public DistrictServiceData Crime { get; set; } public DistrictServiceData Health { get; set; } public Dictionary<string, DistrictServiceData> Productions { get; set; } public Dictionary<string, DistrictServiceData> Consumptions { get; set; } public Dictionary<string, DistrictServiceData> Educated { get; set; } public DistrictServiceData BirthDeath { get; set; } public Dictionary<string, DistrictServiceData> Students { get; set; } public Dictionary<string, DistrictServiceData> Graduations { get; set; } public Dictionary<string, DistrictServiceData> ImportExport { get; set; } public VehiclesInfo Vehicles { get; set; } public PolicyInfo[] Policies { get; set; } #region servica data structure classes // simple city service data with only name and current value field (most of services) public class ServiceData { public string Name { get; set; } public int Current { get; set; } } // add a second field for city serices that provide the availability value (households/jobs) public class DoubleServiceData : ServiceData { public int Available { get; set; } } public class DistrictServiceData { public int TotalCurrent { get { return Categories.Sum(x=> x.Current); } set {} } public List<ServiceData> Categories { get; set; } } public class DistrictDoubleServiceData { public int TotalCurrent { get { return Categories.Sum(x => x.Current); } set { } } // allow to use a global game value (total power/water production) // or automatic sum private int? totalAvailable; public int TotalAvailable { get { if (totalAvailable.HasValue) return totalAvailable.Value; else return Categories.Sum(x => (x.Available != 0) ? x.Available : x.Current); } set { totalAvailable = value; } } public List<DoubleServiceData> Categories { get; set; } } #endregion public class DistrictServiceDataCollection : Dictionary<string, DistrictServiceData>{} public static IEnumerable<int> GetDistricts() { var districtManager = Singleton<DistrictManager>.instance; return districtManager.GetDistrictIds(); } public static DistrictInfo GetDistrictInfo(int districtID) { var districtManager = Singleton<DistrictManager>.instance; var district = GetDistrict(districtID); if (!district.IsValid()) { return null; } String districtName = String.Empty; if (districtID == 0) { // The district with ID 0 is always the global district. // It receives an auto-generated name by default, but the game always displays the city name instead. districtName = "City"; } else { districtName = districtManager.GetDistrictName(districtID); } var pollution = Math.Round((district.m_groundData.m_finalPollution / (Double) byte.MaxValue), 2); #region data model familly to game service/zone type list & dictionary // // warning these strings match object field names in game models and should not be changed // see specified class to understand // in DistrictPrivateData List<string> ServiceZoneTypes = new List<string> { "Residential", "Commercial", "Industrial", "Office", "Player" }; List<string> NoPlayerZoneTypes = new List<string> { "Residential", "Commercial", "Industrial", "Office" }; List<string> JobServiceZoneTypes = new List<string> { "Commercial", "Industrial", "Office", "Player" }; List<string> ImportExportTypes = new List<string> { "Agricultural", "Forestry", "Goods", "Oil", "Ore" }; // in DistrictProductionData Dictionary<string, string> ProductionsTypes = new Dictionary<string, string> { {"Electricity", "ElectricityCapacity"}, {"Water","WaterCapacity"}, {"Sewage", "SewageCapacity"}, {"GarbageA", "GarbageCapacity"} , {"GarbageC", "GarbageAmount"} , {"Incineration", "IncinerationCapacity"}, {"Cremate", "CremateCapacity"}, {"DeadA", "DeadAmount"}, {"DeadC", "DeadCapacity"}, {"Heal", "HealCapacity"}, {"LowEducation", "Education1Capacity"}, {"MediumEducation", "Education2Capacity"}, {"HighEducation", "Education3Capacity"}, }; // in DistrictConsumptionData // NOTE : consumptions are stored in each kind of service, cool we can create consumption distributions pie Dictionary<string, string> ConsumptionsTypes = new Dictionary<string, string> { {"Dead", "DeadCount"}, {"Sick", "SickCount"}, {"Electricity","ElectricityConsumption"}, {"Water","WaterConsumption"}, {"Sewage","SewageAccumulation"}, {"Garbage","GarbageAccumulation"}, {"Income", "IncomeAccumulation"}, {"WaterPollution", "WaterPollution"}, {"Building", "BuildingCount"}, {"GarbagePiles", "GarbagePiles"}, {"ImportAmount", "ImportAmount"}, }; Dictionary<string, string> PrivateDataTypes = new Dictionary<string, string> { {"Abandoned","AbandonedCount"}, {"BuildingArea","BuildingArea"}, //{"BuildingCount","BuildingCount"}, same data as in DistrictConsumptionData {"Burned","BurnedCount"}, {"EmptyCount","EmptyCount"}, //{"Happiness","Happiness"}, do in diffferent way to be easyly able to display hapiness by type //{"CrimeRate","CrimeRate"}, //{"Health","Health"}, /* to re add if a day I understand usage {"Level","Level"}, {"Level1","Level1"}, {"Level2","Level2"}, {"Level3","Level3"}, {"Level4","Level4"}, {"Level5","Level5"},*/ }; // in DistrictEducationData Dictionary<string, string> EducatedLevels = new Dictionary<string, string> { {"No","educated0"}, {"Low","educated1"}, {"Medium","educated2"}, {"High","educated3"} }; Dictionary<string, string> EducatedDataTypes = new Dictionary<string, string> { {"Total", "Count"}, {"EligibleWorkers", "EligibleWorkers"}, {"Homeless", "Homeless"}, {"Unemployed","Unemployed"}, }; // in DistrictAgeData Dictionary<string, string> GraduationTypes = new Dictionary<string, string> { {"LowEducation","education1"}, {"MediumEducation","education2"}, {"HighEducation","education3"}, }; Dictionary<string, string> StudentTypes = new Dictionary<string, string> { {"LowStudent","student1"}, {"MediumStudent","student2"}, {"HighStudent","student3"}, }; Dictionary<string, string> BirthDeathTypes = new Dictionary<string, string> { {"Births","birth"}, {"Deaths","death"} }; Dictionary<string, string> PopulationType = new Dictionary<string,string>{ {"Childs","child"}, {"Teens","teen"}, {"Youngs","young"}, {"Adults","adult"}, {"Seniors","senior"}, }; #endregion var model = new DistrictInfo { DistrictID = districtID, DistrictName = districtName, #region service data generation Population = new DistrictServiceData{ Categories = new List<ServiceData>(PopulationType.Keys.Select(x => district.GetAgeServiceData(PopulationType[x], x))), }, Happiness = new DistrictServiceData{ Categories = new List<ServiceData>(NoPlayerZoneTypes.Select(y => district.GetPrivateServiceData(y, "Happiness")) ) }, Crime = new DistrictServiceData{ Categories = new List<ServiceData>(NoPlayerZoneTypes.Select(y => district.GetPrivateServiceData(y, "CrimeRate"))) }, Health = new DistrictServiceData{ Categories = new List<ServiceData>(NoPlayerZoneTypes.Select(y => district.GetPrivateServiceData(y, "Health"))) }, // warning double lambda, but pretty magical effect Privates = new Dictionary<string, DistrictServiceData>( PrivateDataTypes.Keys.ToDictionary(x => x, x => new DistrictServiceData { Categories = new List<ServiceData>(ServiceZoneTypes.Select(y => district.GetPrivateServiceData(y, PrivateDataTypes[x]))) } ) ), Households = new DistrictDoubleServiceData{Categories = new List<DoubleServiceData>{district.GetCountAndAliveServiceData("residential"),},}, Jobs = new DistrictDoubleServiceData{Categories = new List<DoubleServiceData>(JobServiceZoneTypes.Select(x => district.GetCountAndAliveServiceData(x)))}, ImportExport = new Dictionary<string, DistrictServiceData>{ {"Import", new DistrictServiceData{Categories = new List<ServiceData>(ImportExportTypes.Select(x => district.GetImportExportServiceData("import", x)))}}, {"Export", new DistrictServiceData{Categories = new List<ServiceData>(ImportExportTypes.Select(x => district.GetImportExportServiceData("export", x)))}}, }, Productions = new Dictionary<string,DistrictServiceData>( ProductionsTypes.Keys.ToDictionary(x => x, x => new DistrictServiceData { Categories = new List<ServiceData> { district.GetProductionServiceData(x, ProductionsTypes[x]) } } ) ), // warning double lambda, but pretty magical effect Consumptions = new Dictionary<string,DistrictServiceData>( ConsumptionsTypes.Keys.ToDictionary(x => x, x => new DistrictServiceData { Categories = new List<ServiceData>(ServiceZoneTypes.Select(y => district.GetConsumptionServiceData(y, ConsumptionsTypes[x]))) } ) ), // warning double lambda, but pretty magical effect Educated = new Dictionary<string, DistrictServiceData>( EducatedDataTypes.Keys.ToDictionary(x => x, x => new DistrictServiceData { Categories = new List<ServiceData>(EducatedLevels.Keys.Select(y => district.GetEducatedServiceData(EducatedLevels[y], EducatedDataTypes[x], y))) } ) ), BirthDeath = new DistrictServiceData{ Categories = new List<ServiceData>(BirthDeathTypes.Keys.Select(x => district.GetAgeServiceData(BirthDeathTypes[x], x))), }, Graduations = new Dictionary<string, DistrictServiceData>( GraduationTypes.Keys.ToDictionary(x => x, x => new DistrictServiceData { Categories = new List<ServiceData> { district.GetAgeServiceData(GraduationTypes[x]) } } ) ), Students= new Dictionary<string, DistrictServiceData>( StudentTypes.Keys.ToDictionary(x => x, x => new DistrictServiceData { Categories = new List<ServiceData> { district.GetAgeServiceData(StudentTypes[x]) } } ) ), #endregion AverageLandValue = district.GetLandValue(), Pollution = pollution, WeeklyTouristVisits = (int)district.m_tourist1Data.m_averageCount + (int)district.m_tourist2Data.m_averageCount + (int)district.m_tourist3Data.m_averageCount, Policies = GetPolicies().ToArray(), }; if (districtID != 0) { CityInfoRequestHandler.LogMessages("Building vehicles for", districtID.ToString()); model.Vehicles = new VehiclesInfo(districtID); } else { CityInfoRequestHandler.LogMessages("Building vehicles for city"); model.Vehicles = new VehiclesInfo(); } return model; } private static District GetDistrict(int? districtID = null) { if (districtID == null) { districtID = 0; } var districtManager = Singleton<DistrictManager>.instance; var district = districtManager.m_districts.m_buffer[districtID.Value]; return district; } private static IEnumerable<PolicyInfo> GetPolicies() { var policies = EnumHelper.GetValues<DistrictPolicies.Policies>(); var districtManager = Singleton<DistrictManager>.instance; foreach (var policy in policies) { String policyName = Enum.GetName(typeof(DistrictPolicies.Policies), policy); Boolean isEnabled = districtManager.IsCityPolicySet(DistrictPolicies.Policies.AlligatorBan); yield return new PolicyInfo { Name = policyName, Enabled = isEnabled }; } } } }
MrSlurp/CityWebServerExtension
CWS_MrSlurpExtensions/Models/DistrictInfo.cs
C#
gpl-3.0
15,313
package com.abm.mainet.common.jbpm.domain; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.validation.ObjectError; import com.abm.mainet.common.jbpm.util.ResponseType; public class ActionResponse { private ResponseType response; private List<ObjectError> errorList; private String error; private Map<String, String> responseData; private List<? extends Object> dataList; private WorkflowRequest document; //private ComplaintAcknowledgementModel complaintAcknowledgementModel; private Date actionDate; /** * Constructor */ public ActionResponse() { this.responseData = new HashMap<String, String>(); this.dataList = new ArrayList<Object>(); this.errorList = new ArrayList<ObjectError>(); } /** * Constructor with Arguements * * @param response */ public ActionResponse(ResponseType response) { this.response = response; this.responseData = new HashMap<String, String>(); this.errorList = new ArrayList<ObjectError>(); } public Map<String, String> getResponseData() { return responseData; } public void setResponseData(Map<String, String> responseData) { this.responseData = responseData; } public void addResponseData(String key, String data) { responseData.put(key, data); } public String getResponseData(String key) { return responseData.get(key); } public ResponseType getResponse() { return response; } public void setResponse(ResponseType response) { this.response = response; } public List<ObjectError> getErrorList() { return errorList; } public void setErrorList(List<ObjectError> errorList) { this.errorList = errorList; } public String getError() { return error; } public void setError(String error) { this.error = error; } public List<? extends Object> getDataList() { return dataList; } public void setDataList(List<? extends Object> dataList) { this.dataList = dataList; } public WorkflowRequest getDocument() { return document; } public void setDocument(WorkflowRequest document) { this.document = document; } /*public ComplaintAcknowledgementModel getComplaintAcknowledgementModel() { return complaintAcknowledgementModel; } public void setComplaintAcknowledgementModel( ComplaintAcknowledgementModel complaintAcknowledgementModel) { this.complaintAcknowledgementModel = complaintAcknowledgementModel; }*/ public Date getActionDate() { return actionDate; } public void setActionDate(Date actionDate) { this.actionDate = actionDate; } }
abmindiarepomanager/ABMOpenMainet
Mainet1.0/MainetServiceParent/MainetServiceCommon/src/main/java/com/abm/mainet/common/jbpm/domain/ActionResponse.java
Java
gpl-3.0
2,602
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_25) on Mon Nov 16 09:23:33 GMT 2015 --> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>ZeroFilter (leJOS EV3 API documentation)</title> <meta name="date" content="2015-11-16"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="ZeroFilter (leJOS EV3 API documentation)"; } } catch(err) { } //--> var methods = {"i0":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../lejos/robotics/filter/SumFilter.html" title="class in lejos.robotics.filter"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li>Next&nbsp;Class</li> </ul> <ul class="navList"> <li><a href="../../../index.html?lejos/robotics/filter/ZeroFilter.html" target="_top">Frames</a></li> <li><a href="ZeroFilter.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#fields.inherited.from.class.lejos.robotics.filter.AbstractFilter">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">lejos.robotics.filter</div> <h2 title="Class ZeroFilter" class="title">Class ZeroFilter</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li><a href="../../../lejos/robotics/filter/AbstractFilter.html" title="class in lejos.robotics.filter">lejos.robotics.filter.AbstractFilter</a></li> <li> <ul class="inheritance"> <li>lejos.robotics.filter.ZeroFilter</li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd><a href="../../../lejos/robotics/SampleProvider.html" title="interface in lejos.robotics">SampleProvider</a></dd> </dl> <hr> <br> <pre>public class <span class="typeNameLabel">ZeroFilter</span> extends <a href="../../../lejos/robotics/filter/AbstractFilter.html" title="class in lejos.robotics.filter">AbstractFilter</a></pre> <div class="block">Simple filter that adjusts the sample to use a specified zero value</div> <dl> <dt><span class="simpleTagLabel">Author:</span></dt> <dd>Lawrie Griffiths</dd> </dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- =========== FIELD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="field.summary"> <!-- --> </a> <h3>Field Summary</h3> <ul class="blockList"> <li class="blockList"><a name="fields.inherited.from.class.lejos.robotics.filter.AbstractFilter"> <!-- --> </a> <h3>Fields inherited from class&nbsp;lejos.robotics.filter.<a href="../../../lejos/robotics/filter/AbstractFilter.html" title="class in lejos.robotics.filter">AbstractFilter</a></h3> <code><a href="../../../lejos/robotics/filter/AbstractFilter.html#sampleSize">sampleSize</a>, <a href="../../../lejos/robotics/filter/AbstractFilter.html#source">source</a></code></li> </ul> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../lejos/robotics/filter/ZeroFilter.html#ZeroFilter-lejos.robotics.SampleProvider-float:A-">ZeroFilter</a></span>(<a href="../../../lejos/robotics/SampleProvider.html" title="interface in lejos.robotics">SampleProvider</a>&nbsp;source, float[]&nbsp;zeroValue)</code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../lejos/robotics/filter/ZeroFilter.html#fetchSample-float:A-int-">fetchSample</a></span>(float[]&nbsp;sample, int&nbsp;offset)</code> <div class="block">Fetches a sample from a sensor or filter.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.lejos.robotics.filter.AbstractFilter"> <!-- --> </a> <h3>Methods inherited from class&nbsp;lejos.robotics.filter.<a href="../../../lejos/robotics/filter/AbstractFilter.html" title="class in lejos.robotics.filter">AbstractFilter</a></h3> <code><a href="../../../lejos/robotics/filter/AbstractFilter.html#sampleSize--">sampleSize</a></code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="ZeroFilter-lejos.robotics.SampleProvider-float:A-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>ZeroFilter</h4> <pre>public&nbsp;ZeroFilter(<a href="../../../lejos/robotics/SampleProvider.html" title="interface in lejos.robotics">SampleProvider</a>&nbsp;source, float[]&nbsp;zeroValue)</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="fetchSample-float:A-int-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>fetchSample</h4> <pre>public&nbsp;void&nbsp;fetchSample(float[]&nbsp;sample, int&nbsp;offset)</pre> <div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="../../../lejos/robotics/SampleProvider.html#fetchSample-float:A-int-">SampleProvider</a></code></span></div> <div class="block">Fetches a sample from a sensor or filter.</div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../../lejos/robotics/SampleProvider.html#fetchSample-float:A-int-">fetchSample</a></code>&nbsp;in interface&nbsp;<code><a href="../../../lejos/robotics/SampleProvider.html" title="interface in lejos.robotics">SampleProvider</a></code></dd> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code><a href="../../../lejos/robotics/filter/AbstractFilter.html#fetchSample-float:A-int-">fetchSample</a></code>&nbsp;in class&nbsp;<code><a href="../../../lejos/robotics/filter/AbstractFilter.html" title="class in lejos.robotics.filter">AbstractFilter</a></code></dd> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>sample</code> - The array to store the sample in.</dd> <dd><code>offset</code> - The elements of the sample are stored in the array starting at the offset position.</dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../lejos/robotics/filter/SumFilter.html" title="class in lejos.robotics.filter"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li>Next&nbsp;Class</li> </ul> <ul class="navList"> <li><a href="../../../index.html?lejos/robotics/filter/ZeroFilter.html" target="_top">Frames</a></li> <li><a href="ZeroFilter.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#fields.inherited.from.class.lejos.robotics.filter.AbstractFilter">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
Haldoryn/Kartierung-eines-Raums
Robot/leJOS_EV3_0.9.1-beta_win32/docs/ev3/lejos/robotics/filter/ZeroFilter.html
HTML
gpl-3.0
12,391
#Region "Microsoft.VisualBasic::c9e811b581ea1958c7869c6a65f1bbd7, ..\R.Bioconductor\RDotNET\R.NET\RawVector.vb" ' Author: ' ' asuka (amethyst.asuka@gcmodeller.org) ' xieguigang (xie.guigang@live.com) ' xie (genetics@smrucc.org) ' ' Copyright (c) 2016 GPL3 Licensed ' ' ' GNU GENERAL PUBLIC LICENSE (GPL3) ' ' 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/>. #End Region Imports RDotNet.Internals Imports System.Collections.Generic Imports System.Runtime.InteropServices Imports System.Security.Permissions ''' <summary> ''' A sequence of byte values. ''' </summary> <SecurityPermission(SecurityAction.Demand, Flags := SecurityPermissionFlag.UnmanagedCode)> _ Public Class RawVector Inherits Vector(Of Byte) ''' <summary> ''' Creates a new RawVector with the specified length. ''' </summary> ''' <param name="engine">The <see cref="REngine"/> handling this instance.</param> ''' <param name="length">The length.</param> Public Sub New(engine As REngine, length As Integer) MyBase.New(engine, SymbolicExpressionType.RawVector, length) End Sub ''' <summary> ''' Creates a new RawVector with the specified values. ''' </summary> ''' <param name="engine">The <see cref="REngine"/> handling this instance.</param> ''' <param name="vector">The values.</param> ''' <seealso cref="REngineExtension.CreateRawVector"/> Public Sub New(engine As REngine, vector As IEnumerable(Of Byte)) MyBase.New(engine, SymbolicExpressionType.RawVector, vector) End Sub ''' <summary> ''' Creates a new RawVector with the specified values. ''' </summary> ''' <param name="engine">The <see cref="REngine"/> handling this instance.</param> ''' <param name="vector">The values.</param> ''' <seealso cref="REngineExtension.CreateRawVector"/> Public Sub New(engine As REngine, vector As Byte()) MyBase.New(engine, SymbolicExpressionType.RawVector, vector.Length) Marshal.Copy(vector, 0, DataPointer, vector.Length) End Sub ''' <summary> ''' Creates a new instance for a raw vector. ''' </summary> ''' <param name="engine">The <see cref="REngine"/> handling this instance.</param> ''' <param name="coerced">The pointer to a raw vector.</param> ''' <seealso cref="REngineExtension.CreateRawVector"/> Protected Friend Sub New(engine As REngine, coerced As IntPtr) MyBase.New(engine, coerced) End Sub ''' <summary> ''' Gets or sets the element at the specified index. ''' </summary> ''' <param name="index">The zero-based index of the element to get or set.</param> ''' <returns>The element at the specified index.</returns> Public Overrides Default Property Item(index As Integer) As Byte Get If index < 0 OrElse Length <= index Then Throw New ArgumentOutOfRangeException() End If Using New ProtectedPointer(Me) Dim offset As Integer = GetOffset(index) Return Marshal.ReadByte(DataPointer, offset) End Using End Get Set If index < 0 OrElse Length <= index Then Throw New ArgumentOutOfRangeException() End If Using New ProtectedPointer(Me) Dim offset As Integer = GetOffset(index) Marshal.WriteByte(DataPointer, offset, value) End Using End Set End Property ''' <summary> ''' Efficient conversion from R vector representation to the array equivalent in the CLR ''' </summary> ''' <returns>Array equivalent</returns> Protected Overrides Function GetArrayFast() As Byte() Dim res As Byte() = New Byte(Me.Length - 1) {} Marshal.Copy(DataPointer, res, 0, res.Length) Return res End Function ''' <summary> ''' Sets the values of this RawVector ''' </summary> ''' <param name="values">Managed values, to be converted to unmanaged equivalent</param> Protected Overrides Sub SetVectorDirect(values As Byte()) Marshal.Copy(values, 0, DataPointer, values.Length) End Sub ''' <summary> ''' Gets the size of a byte value in byte. ''' </summary> Protected Overrides ReadOnly Property DataSize() As Integer Get Return 1 End Get End Property ''' <summary> ''' Copies the elements to the specified array. ''' </summary> ''' <param name="destination">The destination array.</param> ''' <param name="length__1">The length to copy.</param> ''' <param name="sourceIndex">The first index of the vector.</param> ''' <param name="destinationIndex">The first index of the destination array.</param> Public Shadows Sub CopyTo(destination As Byte(), length__1 As Integer, Optional sourceIndex As Integer = 0, Optional destinationIndex As Integer = 0) If destination Is Nothing Then Throw New ArgumentNullException("destination") End If If length__1 < 0 Then Throw New IndexOutOfRangeException("length") End If If sourceIndex < 0 OrElse Length < sourceIndex + length__1 Then Throw New IndexOutOfRangeException("sourceIndex") End If If destinationIndex < 0 OrElse destination.Length < destinationIndex + length__1 Then Throw New IndexOutOfRangeException("destinationIndex") End If Dim offset As Integer = GetOffset(sourceIndex) Dim pointer As IntPtr = IntPtr.Add(DataPointer, offset) Marshal.Copy(pointer, destination, destinationIndex, length__1) End Sub End Class
amethyst-asuka/GCModeller
src/R.Bioconductor/RDotNET/R.NET/RawVector.vb
Visual Basic
gpl-3.0
5,814
package andriell.cxor; public class Constants { public static final String CHARSET = "UTF-8"; public static final int MAX_SIZE = 1048576; }
andriell/cXor
src/main/java/andriell/cxor/Constants.java
Java
gpl-3.0
149
const router = require('express').Router({ mergeParams: true }); const HttpStatus = require('http-status-codes'); const path = '/status'; function health(_, res) { res.status(HttpStatus.OK); res.send('ok'); } function ready(_, res) { res.send('ok'); } router.get('/health', health); router.get('/ready', ready); module.exports = { router, path, };
omarcinp/cronos
src/api/routes/status.js
JavaScript
gpl-3.0
363
package sk.upjs.doctororganizer.Entities; import java.math.BigInteger; public class Patient { private Long id; private String name; private String surname; private String adress; private String date_of_birth; private BigInteger id_number; private String insured_at; private String phone_number; private String email; private String password; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public String getAdress() { return adress; } public void setAdress(String adress) { this.adress = adress; } public String getDate_of_birth() { return date_of_birth; } public void setDate_of_birth(String date_of_birth) { this.date_of_birth = date_of_birth; } public BigInteger getId_number() { return id_number; } public void setId_number(BigInteger id_number) { this.id_number = id_number; } public String getInsured_at() { return insured_at; } public void setInsured_at(String insured_at) { this.insured_at = insured_at; } public String getPhone_number() { return phone_number; } public void setPhone_number(String phone_number) { this.phone_number = phone_number; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public String toString() { return "Patient{" + "id=" + id + ", name=" + name + ", surname=" + surname + ", adress=" + adress + ", date_of_birth=" + date_of_birth + ", id_number=" + id_number + ", insured_at=" + insured_at + ", phone_number=" + phone_number + ", email=" + email + ", password=" + password + '}'; } }
mohnanskygabriel/DoctorOrganizer
DoctorOrganizer/src/main/java/sk/upjs/doctororganizer/Entities/Patient.java
Java
gpl-3.0
2,365
#region Copyright ///////////////////////////////////////////////////////////////////////////// // Altaxo: a data processing and data plotting program // Copyright (C) 2014 Dr. Dirk Lellinger // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // ///////////////////////////////////////////////////////////////////////////// #endregion Copyright #nullable enable using System; using System.Collections.Generic; using System.Linq; using System.Text; using Altaxo.Calc.Fourier; namespace Altaxo.Worksheet.Commands.Analysis { /// <summary> /// User options for 2D Fourier transformations. /// </summary> public class RealFourierTransformation2DOptions : Main.SuspendableDocumentLeafNodeWithEventArgs, ICloneable { // Input options protected double _rowIncrementValue; protected bool _isUserDefinedRowIncrementValue; protected double _columnIncrementValue; protected bool _isUserDefinedColumnIncrementValue; protected double? _replacementValueForNaNMatrixElements; protected double? _replacementValueForInfiniteMatrixElements; protected int? _dataPretreatmentCorrectionOrder; protected Altaxo.Calc.Fourier.Windows.IWindows2D? _fourierWindow; // Output options protected RealFourierTransformationOutputKind _kindOfOutputResult = RealFourierTransformationOutputKind.Amplitude; protected bool _centerResult; protected double _resultFractionOfRows = 1; protected double _resultFractionOfColumns = 1; protected bool _outputFrequencyHeaderColumns = true; protected string _frequencyRowHeaderColumnName = string.Empty; protected string _frequencyColumnHeaderColumnName = string.Empty; protected bool _outputPeriodHeaderColumns = false; protected string _periodRowHeaderColumnName = string.Empty; protected string _periodColumnHeaderColumnName = string.Empty; // Helper members - not serialized [NonSerialized] protected string? _rowIncrementMessage; [NonSerialized] protected string? _columnIncrementMessage; public object Clone() { return MemberwiseClone(); } #region Serialization #region Version 0 /// <summary> /// 2014-07-08 initial version. /// </summary> [Altaxo.Serialization.Xml.XmlSerializationSurrogateFor(typeof(RealFourierTransformation2DOptions), 0)] private class XmlSerializationSurrogate0 : Altaxo.Serialization.Xml.IXmlSerializationSurrogate { public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { var s = (RealFourierTransformation2DOptions)obj; info.AddValue("RowIncrementValue", s._rowIncrementValue); info.AddValue("ColumnIncrementValue", s._columnIncrementValue); info.AddValue("ReplacementValueForNaNMatrixElements", s._replacementValueForNaNMatrixElements); info.AddValue("ReplacementValueForInfiniteMatrixElements", s._replacementValueForInfiniteMatrixElements); info.AddValue("DataPretreatmentCorrectionOrder", s._dataPretreatmentCorrectionOrder); info.AddValueOrNull("FourierWindow", s._fourierWindow); info.AddEnum("KindOfOutputResult", s._kindOfOutputResult); info.AddValue("CenterResult", s._centerResult); info.AddValue("ResultFractionOfRows", s._resultFractionOfRows); info.AddValue("ResultFractionOfColumns", s._resultFractionOfColumns); info.AddValue("OutputFrequencyHeaderColumns", s._outputFrequencyHeaderColumns); info.AddValue("FrequencyRowHeaderColumnName", s._frequencyRowHeaderColumnName); info.AddValue("FrequencyColumnHeaderColumnName", s._frequencyColumnHeaderColumnName); info.AddValue("OutputPeriodHeaderColumns", s._outputPeriodHeaderColumns); info.AddValue("PeriodRowHeaderColumnName", s._periodRowHeaderColumnName); info.AddValue("PeriodColumnHeaderColumnName", s._periodColumnHeaderColumnName); } protected virtual RealFourierTransformation2DOptions SDeserialize(object? o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object? parent) { var s = (RealFourierTransformation2DOptions?)o ?? new RealFourierTransformation2DOptions(); s._rowIncrementValue = info.GetDouble("RowIncrementValue"); s._columnIncrementValue = info.GetDouble("ColumnIncrementValue"); s._replacementValueForNaNMatrixElements = info.GetNullableDouble("ReplacementValueForNaNMatrixElements"); s._replacementValueForInfiniteMatrixElements = info.GetNullableDouble("ReplacementValueForInfiniteMatrixElements"); s._dataPretreatmentCorrectionOrder = info.GetNullableInt32("DataPretreatmentCorrectionOrder"); s._fourierWindow = (Altaxo.Calc.Fourier.Windows.IWindows2D?)info.GetValueOrNull("FourierWindow", s); s._kindOfOutputResult = (RealFourierTransformationOutputKind)info.GetEnum("KindOfOutputResult", typeof(RealFourierTransformationOutputKind)); s._centerResult = info.GetBoolean("CenterResult"); s._resultFractionOfRows = info.GetDouble("ResultFractionOfRows"); s._resultFractionOfColumns = info.GetDouble("ResultFractionOfColumns"); s._outputFrequencyHeaderColumns = info.GetBoolean("OutputFrequencyHeaderColumns"); s._frequencyRowHeaderColumnName = info.GetString("FrequencyRowHeaderColumnName"); s._frequencyColumnHeaderColumnName = info.GetString("FrequencyColumnHeaderColumnName"); s._outputPeriodHeaderColumns = info.GetBoolean("OutputPeriodHeaderColumns"); s._periodRowHeaderColumnName = info.GetString("PeriodRowHeaderColumnName"); s._periodColumnHeaderColumnName = info.GetString("PeriodColumnHeaderColumnName"); return s; } public object Deserialize(object? o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object? parent) { var s = SDeserialize(o, info, parent); return s; } } #endregion Version 0 #region Version 1 /// <summary> /// 2015-05-19 Added IsUserDefinedRowIncrementValue and IsUserDefinedColumnIncrementValue /// </summary> [Altaxo.Serialization.Xml.XmlSerializationSurrogateFor(typeof(RealFourierTransformation2DOptions), 1)] private class XmlSerializationSurrogate1 : Altaxo.Serialization.Xml.IXmlSerializationSurrogate { public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { var s = (RealFourierTransformation2DOptions)obj; info.AddValue("IsUserDefinedRowIncrementValue", s._isUserDefinedRowIncrementValue); info.AddValue("RowIncrementValue", s._rowIncrementValue); info.AddValue("IsUserDefinedColumnIncrementValue", s._isUserDefinedColumnIncrementValue); info.AddValue("ColumnIncrementValue", s._columnIncrementValue); info.AddValue("ReplacementValueForNaNMatrixElements", s._replacementValueForNaNMatrixElements); info.AddValue("ReplacementValueForInfiniteMatrixElements", s._replacementValueForInfiniteMatrixElements); info.AddValue("DataPretreatmentCorrectionOrder", s._dataPretreatmentCorrectionOrder); info.AddValueOrNull("FourierWindow", s._fourierWindow); info.AddEnum("KindOfOutputResult", s._kindOfOutputResult); info.AddValue("CenterResult", s._centerResult); info.AddValue("ResultFractionOfRows", s._resultFractionOfRows); info.AddValue("ResultFractionOfColumns", s._resultFractionOfColumns); info.AddValue("OutputFrequencyHeaderColumns", s._outputFrequencyHeaderColumns); info.AddValue("FrequencyRowHeaderColumnName", s._frequencyRowHeaderColumnName); info.AddValue("FrequencyColumnHeaderColumnName", s._frequencyColumnHeaderColumnName); info.AddValue("OutputPeriodHeaderColumns", s._outputPeriodHeaderColumns); info.AddValue("PeriodRowHeaderColumnName", s._periodRowHeaderColumnName); info.AddValue("PeriodColumnHeaderColumnName", s._periodColumnHeaderColumnName); } protected virtual RealFourierTransformation2DOptions SDeserialize(object? o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object? parent) { var s = (o is null ? new RealFourierTransformation2DOptions() : (RealFourierTransformation2DOptions)o); s._isUserDefinedRowIncrementValue = info.GetBoolean("IsUserDefinedRowIncrementValue"); s._rowIncrementValue = info.GetDouble("RowIncrementValue"); s._isUserDefinedColumnIncrementValue = info.GetBoolean("IsUserDefinedColumnIncrementValue"); s._columnIncrementValue = info.GetDouble("ColumnIncrementValue"); s._replacementValueForNaNMatrixElements = info.GetNullableDouble("ReplacementValueForNaNMatrixElements"); s._replacementValueForInfiniteMatrixElements = info.GetNullableDouble("ReplacementValueForInfiniteMatrixElements"); s._dataPretreatmentCorrectionOrder = info.GetNullableInt32("DataPretreatmentCorrectionOrder"); s._fourierWindow = (Altaxo.Calc.Fourier.Windows.IWindows2D?)info.GetValueOrNull("FourierWindow", s); s._kindOfOutputResult = (RealFourierTransformationOutputKind)info.GetEnum("KindOfOutputResult", typeof(RealFourierTransformationOutputKind)); s._centerResult = info.GetBoolean("CenterResult"); s._resultFractionOfRows = info.GetDouble("ResultFractionOfRows"); s._resultFractionOfColumns = info.GetDouble("ResultFractionOfColumns"); s._outputFrequencyHeaderColumns = info.GetBoolean("OutputFrequencyHeaderColumns"); s._frequencyRowHeaderColumnName = info.GetString("FrequencyRowHeaderColumnName"); s._frequencyColumnHeaderColumnName = info.GetString("FrequencyColumnHeaderColumnName"); s._outputPeriodHeaderColumns = info.GetBoolean("OutputPeriodHeaderColumns"); s._periodRowHeaderColumnName = info.GetString("PeriodRowHeaderColumnName"); s._periodColumnHeaderColumnName = info.GetString("PeriodColumnHeaderColumnName"); return s; } public object Deserialize(object? o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object? parent) { var s = SDeserialize(o, info, parent); return s; } } #endregion Version 1 #endregion Serialization public bool IsUserDefinedRowIncrementValue { get { return _isUserDefinedRowIncrementValue; } set { _isUserDefinedRowIncrementValue = value; } } public bool IsUserDefinedColumnIncrementValue { get { return _isUserDefinedColumnIncrementValue; } set { _isUserDefinedColumnIncrementValue = value; } } public double RowIncrementValue { get { return _rowIncrementValue; } set { SetMemberAndRaiseSelfChanged(ref _rowIncrementValue, value); } } public double ColumnIncrementValue { get { return _columnIncrementValue; } set { SetMemberAndRaiseSelfChanged(ref _columnIncrementValue, value); } } public double? ReplacementValueForNaNMatrixElements { get { return _replacementValueForNaNMatrixElements; } set { SetMemberAndRaiseSelfChanged(ref _replacementValueForNaNMatrixElements, value); } } public double? ReplacementValueForInfiniteMatrixElements { get { return _replacementValueForInfiniteMatrixElements; } set { SetMemberAndRaiseSelfChanged(ref _replacementValueForInfiniteMatrixElements, value); } } public int? DataPretreatmentCorrectionOrder { get { return _dataPretreatmentCorrectionOrder; } set { SetMemberAndRaiseSelfChanged(ref _dataPretreatmentCorrectionOrder, value); } } public Altaxo.Calc.Fourier.Windows.IWindows2D? FourierWindow { get { return _fourierWindow; } set { if (!object.ReferenceEquals(_fourierWindow, value)) { _fourierWindow = value; EhSelfChanged(EventArgs.Empty); } } } public Altaxo.Calc.Fourier.RealFourierTransformationOutputKind OutputKind { get { return _kindOfOutputResult; } set { SetMemberEnumAndRaiseSelfChanged(ref _kindOfOutputResult, value); } } public bool CenterResult { get { return _centerResult; } set { SetMemberAndRaiseSelfChanged(ref _centerResult, value); } } public double ResultingFractionOfRowsUsed { get { return _resultFractionOfRows; } set { if (!(value >= 0 && (value <= 1))) throw new ArgumentOutOfRangeException("Value has to be in the range between 0 and 1"); SetMemberAndRaiseSelfChanged(ref _resultFractionOfRows, value); } } public double ResultingFractionOfColumnsUsed { get { return _resultFractionOfColumns; } set { if (!(value >= 0 && (value <= 1))) throw new ArgumentOutOfRangeException("Value has to be in the range between 0 and 1"); SetMemberAndRaiseSelfChanged(ref _resultFractionOfColumns, value); } } public bool OutputFrequencyHeaderColumns { get { return _outputFrequencyHeaderColumns; } set { SetMemberAndRaiseSelfChanged(ref _outputFrequencyHeaderColumns, value); } } public string FrequencyRowHeaderColumnName { get { return _frequencyRowHeaderColumnName; } set { SetMemberAndRaiseSelfChanged(ref _frequencyRowHeaderColumnName, value); } } public string FrequencyColumnHeaderColumnName { get { return _frequencyColumnHeaderColumnName; } set { SetMemberAndRaiseSelfChanged(ref _frequencyColumnHeaderColumnName, value); } } public bool OutputPeriodHeaderColumns { get { return _outputPeriodHeaderColumns; } set { SetMemberAndRaiseSelfChanged(ref _outputPeriodHeaderColumns, value); } } public string PeriodRowHeaderColumnName { get { return _periodRowHeaderColumnName; } set { SetMemberAndRaiseSelfChanged(ref _periodRowHeaderColumnName, value); } } public string PeriodColumnHeaderColumnName { get { return _periodColumnHeaderColumnName; } set { SetMemberAndRaiseSelfChanged(ref _periodColumnHeaderColumnName, value); } } public string? RowIncrementMessage { get { return _rowIncrementMessage; } set { SetMemberAndRaiseSelfChanged(ref _rowIncrementMessage, value); } } public string? ColumnIncrementMessage { get { return _columnIncrementMessage; } set { SetMemberAndRaiseSelfChanged(ref _columnIncrementMessage, value); } } } }
Altaxo/Altaxo
Altaxo/Base/Worksheet/Commands/Analysis/RealFourierTransformation2DOptions.cs
C#
gpl-3.0
14,821
{- Merch.Race.Data.Serialize - Serialization class for data types. Copyright 2013 Alan Manuel K. Gloria This file is part of Merchant's Race. Merchant's Race 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. Merchant's Race 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 Merchant's Race. If not, see <http://www.gnu.org/licenses/>. -} module Merch.Race.Data.Serialize ( Serialize(..) , hPutConvert , hGetConvert ) where import Control.Monad import Data.Bits import Data.Int import Data.List import qualified Data.Map as Map import Data.Map(Map) import Data.Ratio import qualified Data.Set as Set import Data.Set(Set) import Data.Word import Foreign.Marshal.Alloc import Foreign.Storable import System.IO class Serialize a where hPut :: Handle -> a -> IO () hGet :: Handle -> IO a {- Although we *could* use Storable instances directly, doing that leaves us to the mercy of the target machine's endianness. By splitting up words "manually" without the help of Storable, we can mandate the ONE TRUE WAY to correctly store data, which is, of course, as everybody knows, little-endian. -} instance Serialize Word8 where hPut h w = alloca $ \p -> do poke p w hPutBuf h p 1 hGet h = alloca $ \p -> do hGetBuf h p 1 peek p instance Serialize Word16 where hPut h w = allocaBytes 2 $ \p -> do let bs = [ fromIntegral $ (w `shiftR` 0) .&. 255 , fromIntegral $ (w `shiftR` 8) .&. 255 ] forM_ (zip [0..1] bs) $ \ (n, b) -> do pokeByteOff p n (b :: Word8) hPutBuf h p 2 hGet h = allocaBytes 2 $ \p -> do hGetBuf h p 2 [b0, b1] <- forM [0..1] $ \n -> do peekByteOff p n :: IO Word8 return $ ((fromIntegral b0) `shiftL` 0) .|. ((fromIntegral b1) `shiftL` 8) instance Serialize Word32 where hPut h w = allocaBytes 2 $ \p -> do let bs = [ fromIntegral $ (w `shiftR` 0) .&. 255 , fromIntegral $ (w `shiftR` 8) .&. 255 , fromIntegral $ (w `shiftR` 16) .&. 255 , fromIntegral $ (w `shiftR` 24) .&. 255 ] forM_ (zip [0..3] bs) $ \ (n, b) -> do pokeByteOff p n (b :: Word8) hPutBuf h p 4 hGet h = allocaBytes 2 $ \p -> do hGetBuf h p 4 [b0, b1, b2, b3] <- forM [0..3] $ \n -> do peekByteOff p n :: IO Word8 return $ ((fromIntegral b0) `shiftL` 0) .|. ((fromIntegral b1) `shiftL` 8) .|. ((fromIntegral b2) `shiftL` 16) .|. ((fromIntegral b3) `shiftL` 24) instance Serialize Word64 where hPut h w = allocaBytes 2 $ \p -> do let bs = [ fromIntegral $ (w `shiftR` 0) .&. 255 , fromIntegral $ (w `shiftR` 8) .&. 255 , fromIntegral $ (w `shiftR` 16) .&. 255 , fromIntegral $ (w `shiftR` 24) .&. 255 , fromIntegral $ (w `shiftR` 32) .&. 255 , fromIntegral $ (w `shiftR` 40) .&. 255 , fromIntegral $ (w `shiftR` 48) .&. 255 , fromIntegral $ (w `shiftR` 56) .&. 255 ] forM_ (zip [0..7] bs) $ \ (n, b) -> do pokeByteOff p n (b :: Word8) hPutBuf h p 8 hGet h = allocaBytes 2 $ \p -> do hGetBuf h p 8 [b0, b1, b2, b3, b4, b5, b6, b7] <- forM [0..7] $ \n -> do peekByteOff p n :: IO Word8 return $ ((fromIntegral b0) `shiftL` 0) .|. ((fromIntegral b1) `shiftL` 8) .|. ((fromIntegral b2) `shiftL` 16) .|. ((fromIntegral b3) `shiftL` 24) .|. ((fromIntegral b4) `shiftL` 32) .|. ((fromIntegral b5) `shiftL` 40) .|. ((fromIntegral b6) `shiftL` 48) .|. ((fromIntegral b7) `shiftL` 56) -- For easy implementation of Serialize instances of -- data types which can be trivially converted to -- simpler Serialize data types. hPutConvert :: Serialize basetype => (a -> basetype) -> Handle -> a -> IO () hPutConvert convert h a = hPut h (convert a) hGetConvert :: Serialize basetype => (basetype -> a) -> Handle -> IO a hGetConvert convert h = hGet h >>= return . convert -- We assume that Word fits into Word32. instance Serialize Word where hPut = hPutConvert (fromIntegral :: Word -> Word32) hGet = hGetConvert (fromIntegral :: Word32 -> Word ) -- We assume that Int types are trivially convertible -- to the corresponding Word types, and that the -- conversion back to Int will restore negative signs. instance Serialize Int where hPut = hPutConvert (fromIntegral :: Int -> Word ) hGet = hGetConvert (fromIntegral :: Word -> Int ) instance Serialize Int8 where hPut = hPutConvert (fromIntegral :: Int8 -> Word8 ) hGet = hGetConvert (fromIntegral :: Word8 -> Int8 ) instance Serialize Int16 where hPut = hPutConvert (fromIntegral :: Int16 -> Word16) hGet = hGetConvert (fromIntegral :: Word16 -> Int16 ) instance Serialize Int32 where hPut = hPutConvert (fromIntegral :: Int32 -> Word32) hGet = hGetConvert (fromIntegral :: Word32 -> Int32 ) instance Serialize Int64 where hPut = hPutConvert (fromIntegral :: Int64 -> Word64) hGet = hGetConvert (fromIntegral :: Word64 -> Int64 ) -- Serializing common builtin datatypes instance Serialize Bool where hPut h t = hPut h (if t then 1 else 0 :: Word8) hGet h = (hGet h :: IO Word8) >>= \i -> return $ if i == 0 then False else True instance Serialize a => Serialize (Maybe a) where hPut h Nothing = do hPut h (0 :: Word8) hPut h (Just a) = do hPut h (1 :: Word8) hPut h a hGet h = do i <- hGet h :: IO Word8 if i == 0 then return Nothing else hGet h >>= return . Just instance (Serialize a, Serialize b) => Serialize (Either a b) where hPut h (Left a) = do hPut h (0 :: Word8) hPut h a hPut h (Right b) = do hPut h (1 :: Word8) hPut h b hGet h = do i <- hGet h :: IO Word8 if i == 0 then hGet h >>= return . Left else hGet h >>= return . Right instance Serialize a => Serialize [a] where hPut h as = do hPut h (length as :: Int) forM_ as $ hPut h hGet h = do n <- hGet h :: IO Int forM [1..n] $ \_ -> hGet h -- important data structures in base. instance (Serialize a, Serialize b, Ord a) => Serialize (Map a b) where hPut h s = hPut h $ Map.toList s hGet h = hGet h >>= return . Map.fromList instance (Serialize a, Integral a) => Serialize (Ratio a) where hPut h x = do let n = numerator x d = denominator x hPut h n hPut h d hGet h = do n <- hGet h d <- hGet h return $ n % d instance (Serialize a, Ord a) => Serialize (Set a) where hPut h s = hPut h $ Set.toList s hGet h = hGet h >>= return . Set.fromList {- Integer serialization. We observe that most Integers are small, fitting in one or two bytes. So, we use the following format: 1. The first byte is either 0 to indicate nothing follows and the number is a 0, or a signed number of bytes (the absolute value is the number of bytes, the sign is the sign of the Integer). 2. If the signed number of bytes has magnitude 127, it means that the integer is so freaking huge that it takes 127 or more bytes to store it. If so, this means there's a serialized Word after the first byte, which contains the real number of bytes in the Integer. 3. The Integer's magnitude is stored, lowest byte first, in the succeeding space. The sign is the sign of the first byte. -} -- split/unsplit Integers into bytes blast :: Integer -> (Bool, [Word8]) blast i | i < 0 = (True, loop $ negate i) | otherwise = (False, loop i) where loop i | i == 0 = [] | otherwise = let (q, r) = i `divMod` 256 in fromIntegral r:loop q unblast :: (Bool, [Word8]) -> Integer unblast (s, ws) | s = negate $ loop ws | otherwise = loop ws where loop = core 0 1 core acc mult [] = acc core acc mult (w:ws) = core (acc + fromIntegral w * mult) (mult * 256) ws instance Serialize Integer where hPut h i = do let (s, ws) = blast i num = genericLength ws :: Word sign | s = negate | otherwise = id if num <= 126 then do hPut h (sign $ fromIntegral num :: Int8 ) else do hPut h (sign 127 :: Int8) hPut h (num :: Word) forM_ ws $ hPut h hGet h = do nb <- hGet h :: IO Int8 let s = nb < 0 sign | s = negate | otherwise = id num | s = negate nb | otherwise = nb num <- if num <= 126 then return $ fromIntegral num else hGet h :: IO Word ws <- forM [1..num] $ \_ -> hGet h return $ unblast (s, ws) {- Encode Char using UTF-8. -} instance Serialize Char where hPut h c = do case fromEnum c of i | i <= 0x007F -> hPut h (fromIntegral i :: Word8) | i <= 0x07FF -> encode2 h i | i <= 0xFFFF -> encode3 h i | i <= 0x1FFFFF -> encode4 h i | i <= 0x3FFFFFF -> encode5 h i | i <= 0x7FFFFFFF -> encode6 h i | otherwise -> fail "Character too large to write." where encode2 h i = do let (i0, i1) = ( (i `shiftR` 6) , (i `shiftR` 0) .&. 0x3F ) ws = [ 0xC0 .|. fromIntegral i0 , 0x80 .|. fromIntegral i1 ] :: [Word8] forM_ ws $ hPut h encode3 h i = do let (i0, i1, i2) = ( (i `shiftR` 12) , (i `shiftR` 6) .&. 0x3F , (i `shiftR` 0) .&. 0x3F ) ws = [ 0xE0 .|. fromIntegral i0 , 0x80 .|. fromIntegral i1 , 0x80 .|. fromIntegral i2 ] :: [Word8] forM_ ws $ hPut h encode4 h i = do let (i0, i1, i2, i3) = ( (i `shiftR` 18) , (i `shiftR` 12) .&. 0x3F , (i `shiftR` 6) .&. 0x3F , (i `shiftR` 0) .&. 0x3F ) ws = [ 0xF0 .|. fromIntegral i0 , 0x80 .|. fromIntegral i1 , 0x80 .|. fromIntegral i2 , 0x80 .|. fromIntegral i3 ] :: [Word8] forM_ ws $ hPut h encode5 h i = do let (i0, i1, i2, i3, i4) = ( (i `shiftR` 24) , (i `shiftR` 18) .&. 0x3F , (i `shiftR` 12) .&. 0x3F , (i `shiftR` 6) .&. 0x3F , (i `shiftR` 0) .&. 0x3F ) ws = [ 0xF0 .|. fromIntegral i0 , 0x80 .|. fromIntegral i1 , 0x80 .|. fromIntegral i2 , 0x80 .|. fromIntegral i3 , 0x80 .|. fromIntegral i4 ] :: [Word8] forM_ ws $ hPut h encode6 h i = do let (i0, i1, i2, i3, i4, i5) = ( (i `shiftR` 30) , (i `shiftR` 24) .&. 0x3F , (i `shiftR` 18) .&. 0x3F , (i `shiftR` 12) .&. 0x3F , (i `shiftR` 6) .&. 0x3F , (i `shiftR` 0) .&. 0x3F ) ws = [ 0xF0 .|. fromIntegral i0 , 0x80 .|. fromIntegral i1 , 0x80 .|. fromIntegral i2 , 0x80 .|. fromIntegral i3 , 0x80 .|. fromIntegral i4 , 0x80 .|. fromIntegral i5 ] :: [Word8] forM_ ws $ hPut h hGet h = do i <- hGet h :: IO Word8 case i of i | (i .&. 0x80) == 0x00 -> return $ toEnum $ fromIntegral i | (i .&. 0xE0) == 0xC0 -> decode2 h (i .&. 0x1F) | (i .&. 0xF0) == 0xE0 -> decode3 h (i .&. 0x0F) | (i .&. 0xF8) == 0xF0 -> decode4 h (i .&. 0x07) | (i .&. 0xFC) == 0xF8 -> decode5 h (i .&. 0x03) | (i .&. 0xFE) == 0xFC -> decode6 h (i .&. 0x01) | otherwise -> fail "Invalid UTF-8 encoding." where readCont h = do w <- hGet h :: IO Word8 when ((w .&. 0xC0) /= 0x80) $ do fail "Expecting continuation character in UTF-8 encoding." return $ w .&. 0x3F decode2 h w0 = do [w1] <- forM [2..2] $ \_ -> readCont h return $ toEnum $ (fromIntegral w0 `shiftL` 6) .|. (fromIntegral w1 `shiftL` 0) decode3 h w0 = do [w1, w2] <- forM [2..3] $ \_ -> readCont h return $ toEnum $ (fromIntegral w0 `shiftL` 12) .|. (fromIntegral w1 `shiftL` 6) .|. (fromIntegral w2 `shiftL` 0) decode4 h w0 = do [w1, w2, w3] <- forM [2..4] $ \_ -> readCont h return $ toEnum $ (fromIntegral w0 `shiftL` 18) .|. (fromIntegral w1 `shiftL` 12) .|. (fromIntegral w2 `shiftL` 6) .|. (fromIntegral w3 `shiftL` 0) decode5 h w0 = do [w1, w2, w3, w4] <- forM [2..5] $ \_ -> readCont h return $ toEnum $ (fromIntegral w0 `shiftL` 24) .|. (fromIntegral w1 `shiftL` 18) .|. (fromIntegral w2 `shiftL` 12) .|. (fromIntegral w3 `shiftL` 6) .|. (fromIntegral w4 `shiftL` 0) decode6 h w0 = do [w1, w2, w3, w4, w5] <- forM [2..6] $ \_ -> readCont h return $ toEnum $ (fromIntegral w0 `shiftL` 30) .|. (fromIntegral w1 `shiftL` 24) .|. (fromIntegral w2 `shiftL` 18) .|. (fromIntegral w3 `shiftL` 12) .|. (fromIntegral w4 `shiftL` 6) .|. (fromIntegral w5 `shiftL` 0) -- Freaking Tuples! instance (Serialize i0, Serialize i1) => Serialize (i0, i1) where hPut h (i0,i1) = do hPut h i0 hPut h i1 hGet h = do i0 <- hGet h i1 <- hGet h return (i0,i1) instance (Serialize i0, Serialize i1, Serialize i2) => Serialize (i0, i1, i2) where hPut h (i0,i1,i2) = do hPut h i0 hPut h i1 hPut h i2 hGet h = do i0 <- hGet h i1 <- hGet h i2 <- hGet h return (i0,i1,i2) instance (Serialize i0, Serialize i1, Serialize i2, Serialize i3) => Serialize (i0, i1, i2, i3) where hPut h (i0,i1,i2,i3) = do hPut h i0 hPut h i1 hPut h i2 hPut h i3 hGet h = do i0 <- hGet h i1 <- hGet h i2 <- hGet h i3 <- hGet h return (i0,i1,i2,i3) instance (Serialize i0, Serialize i1, Serialize i2, Serialize i3, Serialize i4) => Serialize (i0, i1, i2, i3, i4) where hPut h (i0,i1,i2,i3,i4) = do hPut h i0 hPut h i1 hPut h i2 hPut h i3 hPut h i4 hGet h = do i0 <- hGet h i1 <- hGet h i2 <- hGet h i3 <- hGet h i4 <- hGet h return (i0,i1,i2,i3,i4) -- Freaking Tuples! Ends
AmkG/merchants-race
Merch/Race/Data/Serialize.hs
Haskell
gpl-3.0
14,816
import pytest import nengo def pytest_funcarg__Simulator(request): """the Simulator class being tested. Please use this, and not nengo.Simulator directly, unless the test is reference simulator specific. """ return nengo.Simulator def pytest_generate_tests(metafunc): if "nl" in metafunc.funcargnames: metafunc.parametrize("nl", [nengo.LIF, nengo.LIFRate, nengo.Direct]) if "nl_nodirect" in metafunc.funcargnames: metafunc.parametrize("nl_nodirect", [nengo.LIF, nengo.LIFRate]) def pytest_addoption(parser): parser.addoption('--benchmarks', action='store_true', default=False, help='Also run benchmarking tests') parser.addoption('--noexamples', action='store_false', default=True, help='Do not run examples') parser.addoption( '--optional', action='store_true', default=False, help='Also run optional tests that may use optional packages') def pytest_runtest_setup(item): for mark, option, message in [ ('benchmark', 'benchmarks', "benchmarks not requested"), ('example', 'noexamples', "examples not requested"), ('optional', 'optional', "optional tests not requested")]: if getattr(item.obj, mark, None) and not item.config.getvalue(option): pytest.skip(message)
ZeitgeberH/nengo
nengo/tests/conftest.py
Python
gpl-3.0
1,348
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import os import socket import sys from argparse import ArgumentParser from setproctitle import setproctitle from amavisvt.config import Configuration BUFFER_SIZE = 4096 class AmavisVTClient(object): def __init__(self, socket_path): self.config = Configuration() self.socket_path = socket_path or self.config.socket_path def execute(self, command, *arguments): logger.debug("Executing command '%s' with args: %s", command, arguments) translate = { 'ping': 'PING', 'scan': 'CONTSCAN', 'report': 'REPORT', } sock = None try: sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(self.socket_path) # send absolute paths to amavisvtd absolute_args = [os.path.abspath(p) for p in arguments] s = "%s %s" % (translate.get(command, command.upper()), ' '.join(absolute_args)) payload = s.strip() + "\n" sock.sendall(payload.encode('utf-8')) data = sock.recv(BUFFER_SIZE) return data.decode('utf-8') finally: if sock: sock.close() if __name__ == "__main__": # pragma: no cover setproctitle("amavisvtd") parser = ArgumentParser() parser.add_argument('-v', '--verbose', action='count', help='Increase verbosity', default=2) parser.add_argument('-d', '--debug', action='store_true', default=False, help='Send verbose log messages to stdout too') parser.add_argument('-s', '--socket', help='Socket path') parser.add_argument('command', choices=('ping', 'scan', 'report')) parser.add_argument('command_args', nargs='*') args = parser.parse_args() logging.basicConfig( level=logging.FATAL - (10 * args.verbose), format='%(asctime)s %(levelname)-7s [%(threadName)s] %(message)s', ) logger = logging.getLogger() if not args.debug: for h in logger.handlers: h.setLevel(logging.ERROR) if not args.command.lower() in ('ping', 'scan', 'report'): print("Invalid command: %s" % args.command) sys.exit(1) error = False try: client = AmavisVTClient(args.socket) response = client.execute(args.command, *tuple(args.command_args)) error = response.startswith('ERROR:') print(response) except Exception as ex: error = True logger.exception("Command '%s' failed", args.command) print(ex) finally: sys.exit(int(error))
ercpe/amavisvt
amavisvt/amavisvtc.py
Python
gpl-3.0
2,613
'use strict'; const express = require('express'); const service = express(); var os = require('os'); var networkInterfaces = os.networkInterfaces(); module.exports = service; module.exports.networkInterfaces = networkInterfaces;
orhaneee/SlackBotHeroku
server/service.js
JavaScript
gpl-3.0
232
# Folly Details [FBVector](https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md) and [FBString](https://github.com/facebook/folly/blob/master/folly/docs/FBString.md) only. # For linux - In this version, jemalloc is included. if you do not want to use jemalloc, you can remove jemalloc folder and change CMakeLists.txt. - To use jemalloc, you also can install jemalloc in your computer, and in this case, jemalloc in this project can be removed. - Boost library is required in linux, you can install boost by `sudo apt-get install libboost-all-dev`/. - **Attention**: GCC version must be 4.8 or above. ## usage ``` make build cmake (fooly中CMakeLists.txt 所在目录) make ./bin/testMain ``` # For windows on the way # For Macos on the way
QunxingHu/folly-lite
readme.md
Markdown
gpl-3.0
764
<?php /** * The template for displaying search results pages * * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result * * @package ibreatheart */ get_header(); ?> <section id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php if ( have_posts() ) : ?> <header class="page-header"> <h1 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', 'ibreatheart' ), '<span>' . get_search_query() . '</span>' ); ?></h1> </header><!-- .page-header --> <?php /* Start the Loop */ while ( have_posts() ) : the_post(); /** * Run the loop for the search to output the results. * If you want to overload this in a child theme then include a file * called content-search.php and that will be used instead. */ get_template_part( 'template-parts/content', 'search' ); endwhile; the_posts_navigation(); else : get_template_part( 'template-parts/content', 'none' ); endif; ?> </main><!-- #main --> </section><!-- #primary --> <?php get_sidebar(); get_footer();
BracketMonks/hackathon-frontend
wordpress-project/ibreatheart-underscores/search.php
PHP
gpl-3.0
1,111
package bio.singa.simulation.model.modules; import bio.singa.simulation.entities.ChemicalEntity; import bio.singa.features.model.Evidence; import bio.singa.features.model.Feature; import bio.singa.simulation.model.modules.concentration.ModuleState; import bio.singa.simulation.model.simulation.Simulation; import java.util.Collection; import java.util.List; import java.util.Set; /** * @author cl */ public interface UpdateModule extends Runnable { String getIdentifier(); ModuleState getState(); void setSimulation(Simulation simulation); Set<ChemicalEntity> getReferencedChemicalEntities(); Set<Class<? extends Feature>> getRequiredFeatures(); void checkFeatures(); void setFeature(Feature<?> feature); Collection<Feature<?>> getFeatures(); List<Evidence> getEvidence(); void initialize(); void reset(); void onReset(); void onCompletion(); }
cleberecht/singa
singa-simulation/src/main/java/bio/singa/simulation/model/modules/UpdateModule.java
Java
gpl-3.0
906
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; class Main{ public static class Agency { String name; int A, B; public Agency(String s) { StringTokenizer st=new StringTokenizer(s,":"); this.name=st.nextToken(); st=new StringTokenizer(st.nextToken(),","); this.A=Integer.parseInt(st.nextToken()); this.B=Integer.parseInt(st.nextToken()); } } public static class Result implements Comparable<Result> { Agency a; int cost; public int compareTo(Result r) { return (this.cost!=r.cost) ? this.cost-r.cost : this.a.name.compareTo(r.a.name); } } public static void main (String [] args) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int testCaseCount=Integer.parseInt(br.readLine()); for (int testCase=1;testCase<=testCaseCount;testCase++) { StringTokenizer st=new StringTokenizer(br.readLine()); int N=Integer.parseInt(st.nextToken()); int M=Integer.parseInt(st.nextToken()); int L=Integer.parseInt(st.nextToken()); Agency [] agencies=new Agency [L]; for (int l=0;l<L;l++) agencies[l]=new Agency(br.readLine()); Result [] results=new Result[L]; for (int l=0;l<L;l++) { Agency agency=agencies[l]; results[l]=new Result(); results[l].a=agency; int curr=N; int cost=0; while (curr>M) { if (curr/2>=M) { int c1=agency.B; int c2=(curr-curr/2)*agency.A; curr/=2; if (c1<c2) cost+=c1; else cost+=c2; } else { cost+=(curr-M)*agency.A; curr=M; } } results[l].cost=cost; } Arrays.sort(results); StringBuilder sb=new StringBuilder(); sb.append("Case "); sb.append(testCase); sb.append('\n'); for (Result r: results) { sb.append(r.a.name); sb.append(' '); sb.append(r.cost); sb.append('\n'); } System.out.print(sb.toString()); } } }
PuzzlesLab/UVA
King/10670 Work Reduction.java
Java
gpl-3.0
1,957
<?xml version="1.0" encoding="utf-8"?> <!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" xml:lang="en" lang="en"> <head> <title>head.rb</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="../../../../../../../../../../../css/reset.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../../../../../../../../../../../css/main.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../../../../../../../../../../../css/github.css" type="text/css" media="screen" /> <script src="../../../../../../../../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../../../../../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../../../../../../../../js/main.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../../../../../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script> </head> <body> <div class="banner"> <span>Ruby on Rails 4.2.0</span><br /> <h1> head.rb </h1> <ul class="files"> <li> ../../.rvm/gems/ruby-2.1.1/gems/actionpack-4.2.0/lib/action_controller/metal/head.rb </li> <li>Last modified: 2015-02-02 12:11:53 -0200</li> </ul> </div> <div id="bodyContent"> <div id="content"> <!-- Namespace --> <div class="sectiontitle">Namespace</div> <ul> <li> <span class="type">MODULE</span> <a href="../../../../../../../../../../../classes/ActionController.html">ActionController</a> </li> <li> <span class="type">MODULE</span> <a href="../../../../../../../../../../../classes/ActionController/Head.html">ActionController::Head</a> </li> </ul> <!-- Methods --> </div> </div> </body> </html>
rafaellc28/Portfolio
doc/api/files/__/__/_rvm/gems/ruby-2_1_1/gems/actionpack-4_2_0/lib/action_controller/metal/head_rb.html
HTML
gpl-3.0
2,240
/** * @file lv_span.c * */ /********************* * INCLUDES *********************/ #include "lv_span.h" #if LV_USE_SPAN != 0 /********************* * DEFINES *********************/ #define MY_CLASS &lv_spangroup_class /********************** * TYPEDEFS **********************/ typedef struct { lv_span_t * span; const char * txt; const lv_font_t * font; uint16_t bytes; lv_coord_t txt_w; lv_coord_t line_h; lv_coord_t letter_space; } lv_snippet_t; struct _snippet_stack { lv_snippet_t stack[LV_SPAN_SNIPPET_STACK_SIZE]; uint16_t index; }; /********************** * STATIC PROTOTYPES **********************/ static void lv_spangroup_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_spangroup_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_spangroup_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_main(lv_event_t * e); static void refresh_self_size(lv_obj_t * obj); static const lv_font_t * lv_span_get_style_text_font(lv_obj_t * par, lv_span_t * span); static lv_coord_t lv_span_get_style_text_letter_space(lv_obj_t * par, lv_span_t * span); static lv_color_t lv_span_get_style_text_color(lv_obj_t * par, lv_span_t * span); static lv_color_t lv_span_get_style_text_color(lv_obj_t * par, lv_span_t * span); static lv_opa_t lv_span_get_style_text_opa(lv_obj_t * par, lv_span_t * span); static lv_opa_t lv_span_get_style_text_blend_mode(lv_obj_t * par, lv_span_t * span); static int32_t lv_span_get_style_text_decor(lv_obj_t * par, lv_span_t * span); static inline void span_text_check(const char ** text); static void lv_draw_span(lv_obj_t * spans, const lv_area_t * coords, const lv_area_t * mask); static bool lv_txt_get_snippet(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width, lv_text_flag_t flag, lv_coord_t * use_width, uint32_t * end_ofs); static void lv_snippet_clear(void); static uint16_t lv_get_snippet_cnt(); static void lv_snippet_push(lv_snippet_t * item); static lv_snippet_t * lv_get_snippet(uint16_t index); /********************** * STATIC VARIABLES **********************/ static struct _snippet_stack snippet_stack; const lv_obj_class_t lv_spangroup_class = { .base_class = &lv_obj_class, .constructor_cb = lv_spangroup_constructor, .destructor_cb = lv_spangroup_destructor, .event_cb = lv_spangroup_event, .instance_size = sizeof(lv_spangroup_t), .width_def = LV_SIZE_CONTENT, .height_def = LV_SIZE_CONTENT, }; /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ /** * Create a spangroup objects * @param par pointer to an object, it will be the parent of the new spangroup * @return pointer to the created spangroup */ lv_obj_t * lv_spangroup_create(lv_obj_t * par) { lv_obj_t * obj = lv_obj_class_create_obj(&lv_spangroup_class, par); lv_obj_class_init_obj(obj); return obj; } /** * Create a span string descriptor and add to spangroup. * @param obj pointer to a spangroup object. * @return pointer to the created span. */ lv_span_t * lv_spangroup_new_span(lv_obj_t * obj) { if(obj == NULL) { return NULL; } lv_spangroup_t * spans = (lv_spangroup_t *)obj; lv_span_t * span = _lv_ll_ins_tail(&spans->child_ll); LV_ASSERT_MALLOC(span); lv_style_init(&span->style); span->txt = (char *)""; span->static_flag = 1; span->spangroup = obj; refresh_self_size(obj); return span; } /** * Remove the span from the spangroup and free memory. * @param obj pointer to a spangroup object. * @param span pointer to a span. */ void lv_spangroup_del_span(lv_obj_t * obj, lv_span_t * span) { if(obj == NULL || span == NULL) { return; } lv_spangroup_t * spans = (lv_spangroup_t *)obj; lv_span_t * cur_span; _LV_LL_READ(&spans->child_ll, cur_span) { if(cur_span == span) { _lv_ll_remove(&spans->child_ll, cur_span); if(cur_span->txt && cur_span->static_flag == 0) { lv_mem_free(cur_span->txt); } lv_style_reset(&cur_span->style); lv_mem_free(cur_span); break; } } refresh_self_size(obj); } /*===================== * Setter functions *====================*/ /** * Set a new text for a span. Memory will be allocated to store the text by the span. * @param span pointer to a span. * @param text pointer to a text. */ void lv_span_set_text(lv_span_t * span, const char * text) { if(span == NULL || text == NULL) { return; } if(span->txt == NULL || span->static_flag == 1) { span->txt = lv_mem_alloc(strlen(text) + 1); } else { lv_mem_realloc(span->txt, strlen(text) + 1); } span->static_flag = 0; strcpy(span->txt, text); refresh_self_size(span->spangroup); } /** * Set a static text. It will not be saved by the span so the 'text' variable * has to be 'alive' while the span exist. * @param span pointer to a span. * @param text pointer to a text. */ void lv_span_set_text_static(lv_span_t * span, const char * text) { if(span == NULL || text == NULL) { return; } if(span->txt && span->static_flag == 0) { lv_mem_free(span->txt); } span->static_flag = 1; span->txt = (char *)text; refresh_self_size(span->spangroup); } /** * Set the align of the spangroup. * @param obj pointer to a spangroup object. * @param align see lv_text_align_t for details. */ void lv_spangroup_set_align(lv_obj_t * obj, lv_text_align_t align) { lv_obj_set_style_text_align(obj, align, LV_PART_MAIN); } /** * Set the overflow of the spangroup. * @param obj pointer to a spangroup object. * @param overflow see lv_span_overflow_t for details. */ void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; if(spans->overflow == overflow) return; spans->overflow = overflow; lv_obj_invalidate(obj); } /** * Set the indent of the spangroup. * @param obj pointer to a spangroup object. * @param indent The first line indentation */ void lv_spangroup_set_indent(lv_obj_t * obj, lv_coord_t indent) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; if(spans->indent == indent) return; spans->indent = indent; refresh_self_size(obj); } /** * Set the mode of the spangroup. * @param obj pointer to a spangroup object. * @param mode see lv_span_mode_t for details. */ void lv_spangroup_set_mode(lv_obj_t * obj, lv_span_mode_t mode) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; if(spans->mode == mode) return; spans->mode = mode; lv_spangroup_refr_mode(obj); } /*===================== * Getter functions *====================*/ /** * get the align of the spangroup. * @param obj pointer to a spangroup object. * @return the align value. */ lv_text_align_t lv_spangroup_get_align(lv_obj_t * obj) { return lv_obj_get_style_text_align(obj, LV_PART_MAIN); } /** * get the overflow of the spangroup. * @param obj pointer to a spangroup object. * @return the overflow value. */ lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t * obj) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; return spans->overflow; } /** * get the indent of the spangroup. * @param obj pointer to a spangroup object. * @return the indent value. */ lv_coord_t lv_spangroup_get_indent(lv_obj_t * obj) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; return spans->indent; } /** * Set the mode of the spangroup. * @param obj pointer to a spangroup object. * @return the mode value. */ lv_span_mode_t lv_spangroup_get_mode(lv_obj_t * obj) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; return spans->mode; } /** * update the mode of the spangroup. * @param obj pointer to a spangroup object. */ void lv_spangroup_refr_mode(lv_obj_t * obj) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; if(spans->mode == LV_SPAN_MODE_EXPAND) { lv_obj_set_width(obj, LV_SIZE_CONTENT); lv_obj_set_height(obj, LV_SIZE_CONTENT); } else if(spans->mode == LV_SPAN_MODE_BREAK) { if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) { lv_obj_set_width(obj, 100); } lv_obj_set_height(obj, LV_SIZE_CONTENT); } else if(spans->mode == LV_SPAN_MODE_FIXED) { /* use this mode, The user needs to set the size. */ /* This is just to prevent an infinite loop. */ if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) { lv_obj_set_width(obj, 100); } if(lv_obj_get_style_height(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) { lv_coord_t width = lv_obj_get_style_width(obj, LV_PART_MAIN); if(LV_COORD_IS_PCT(width)) { width = 100; } lv_coord_t height = lv_spangroup_get_expand_height(obj, width); lv_obj_set_content_height(obj, height); } } refresh_self_size(obj); } /** * get max line height of all span in the spangroup. * @param obj pointer to a spangroup object. */ lv_coord_t lv_spangroup_get_max_line_h(lv_obj_t * obj) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; lv_coord_t max_line_h = 0; lv_span_t * cur_span; _LV_LL_READ(&spans->child_ll, cur_span) { const lv_font_t * font = lv_span_get_style_text_font(obj, cur_span); lv_coord_t line_h = lv_font_get_line_height(font); if(line_h > max_line_h) { max_line_h = line_h; } } return max_line_h; } /** * get the width when all span of spangroup on a line. not included spangroup pad, border width. * @param obj pointer to a spangroup object. */ lv_coord_t lv_spangroup_get_expand_width(lv_obj_t * obj) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; if(_lv_ll_get_head(&spans->child_ll) == NULL) { return 0; } lv_coord_t width = 0; lv_span_t * cur_span; _LV_LL_READ(&spans->child_ll, cur_span) { const lv_font_t * font = lv_span_get_style_text_font(obj, cur_span); lv_coord_t letter_space = lv_span_get_style_text_letter_space(obj, cur_span); uint32_t j = 0; const char * cur_txt = cur_span->txt; span_text_check(&cur_txt); while(cur_txt[j] != 0) { uint32_t letter = _lv_txt_encoded_next(cur_txt, &j); uint32_t letter_next = _lv_txt_encoded_next(&cur_txt[j], NULL); int32_t letter_w = lv_font_get_glyph_width(font, letter, letter_next); width = width + letter_w + letter_space; } } return width; } /** * get the height with width fixed. Height and width are not included spangroup pad, border width. * @param obj pointer to a spangroup object. */ lv_coord_t lv_spangroup_get_expand_height(lv_obj_t * obj, lv_coord_t width) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; if(_lv_ll_get_head(&spans->child_ll) == NULL || width <= 0) { return 0; } /* init draw variable */ lv_text_flag_t txt_flag = LV_TEXT_FLAG_NONE; lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); lv_coord_t max_width = width; lv_coord_t max_w = max_width - spans->indent; /* first line need minus indent */ /* coords of draw span-txt */ lv_point_t txt_pos; txt_pos.y = 0; txt_pos.x = 0 + spans->indent; /* first line need add indent */ lv_span_t * cur_span = _lv_ll_get_head(&spans->child_ll); const char * cur_txt = cur_span->txt; span_text_check(&cur_txt); uint32_t cur_txt_ofs = 0; lv_snippet_t snippet; /* use to save cur_span info and push it to stack */ memset(&snippet, 0, sizeof(snippet)); /* the loop control how many lines need to draw */ while(cur_span) { int snippet_cnt = 0; lv_coord_t max_line_h = 0; /* the max height of span-font when a line have a lot of span */ /* the loop control to find a line and push the relevant span info into stack */ while(1) { /* switch to the next span when current is end */ if(cur_txt[cur_txt_ofs] == '\0') { cur_span = _lv_ll_get_next(&spans->child_ll, cur_span); if(cur_span == NULL) break; cur_txt = cur_span->txt; span_text_check(&cur_txt); cur_txt_ofs = 0; } /* init span info to snippet. */ if(cur_txt_ofs == 0) { snippet.span = cur_span; snippet.font = lv_span_get_style_text_font(obj, cur_span); snippet.letter_space = lv_span_get_style_text_letter_space(obj, cur_span); snippet.line_h = lv_font_get_line_height(snippet.font) + line_space; } /* get current span text line info */ uint32_t next_ofs = 0; lv_coord_t use_width = 0; bool isfill = lv_txt_get_snippet(&cur_txt[cur_txt_ofs], snippet.font, snippet.letter_space, max_w, txt_flag, &use_width, &next_ofs); /* break word deal width */ if(isfill && next_ofs > 0 && snippet_cnt > 0) { uint32_t letter = (uint32_t)cur_txt[cur_txt_ofs + next_ofs - 1]; if(!(letter == '\0' || letter == '\n' || letter == '\r' || _lv_txt_is_break_char(letter))) { letter = (uint32_t)cur_txt[cur_txt_ofs + next_ofs]; if(!(letter == '\0' || letter == '\n' || letter == '\r' || _lv_txt_is_break_char(letter))) { break; } } } snippet.txt = &cur_txt[cur_txt_ofs]; snippet.bytes = next_ofs; snippet.txt_w = use_width; cur_txt_ofs += next_ofs; if(max_line_h < snippet.line_h) { max_line_h = snippet.line_h; } snippet_cnt ++; if(isfill) { break; } max_w -= use_width; } /* next line init */ txt_pos.x = 0; txt_pos.y += max_line_h; max_w = max_width; } return txt_pos.y; } /********************** * STATIC FUNCTIONS **********************/ static void lv_spangroup_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { LV_UNUSED(class_p); lv_spangroup_t * spans = (lv_spangroup_t *)obj; _lv_ll_init(&spans->child_ll, sizeof(lv_span_t)); spans->indent = 0; spans->mode = LV_SPAN_MODE_EXPAND; spans->overflow = LV_SPAN_OVERFLOW_CLIP; spans->cache_w = 0; spans->cache_h = 0; spans->refresh = 1; } static void lv_spangroup_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { LV_UNUSED(class_p); lv_spangroup_t * spans = (lv_spangroup_t *)obj; lv_span_t * cur_span = _lv_ll_get_head(&spans->child_ll); while(cur_span) { _lv_ll_remove(&spans->child_ll, cur_span); if(cur_span->txt && cur_span->static_flag == 0) { lv_mem_free(cur_span->txt); } lv_style_reset(&cur_span->style); lv_mem_free(cur_span); cur_span = _lv_ll_get_head(&spans->child_ll); } } static void lv_spangroup_event(const lv_obj_class_t * class_p, lv_event_t * e) { LV_UNUSED(class_p); /* Call the ancestor's event handler */ if(lv_obj_event_base(MY_CLASS, e) != LV_RES_OK) return; lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); lv_spangroup_t * spans = (lv_spangroup_t *)obj; if(code == LV_EVENT_DRAW_MAIN) { draw_main(e); } else if(code == LV_EVENT_STYLE_CHANGED) { refresh_self_size(obj); } else if(code == LV_EVENT_SIZE_CHANGED) { refresh_self_size(obj); } else if(code == LV_EVENT_GET_SELF_SIZE) { lv_coord_t width = 0; lv_coord_t height = 0; lv_point_t * self_size = lv_event_get_param(e); if(spans->mode == LV_SPAN_MODE_EXPAND) { if(spans->refresh) { spans->cache_w = lv_spangroup_get_expand_width(obj); spans->cache_h = lv_spangroup_get_max_line_h(obj); spans->refresh = 0; } width = spans->cache_w; height = spans->cache_h; } else if(spans->mode == LV_SPAN_MODE_BREAK) { width = lv_obj_get_content_width(obj); if(self_size->y >= 0) { if(width != spans->cache_w || spans->refresh) { height = lv_spangroup_get_expand_height(obj, width); spans->cache_w = width; spans->cache_h = height; spans->refresh = 0; } else { height = spans->cache_h; } } } else if(spans->mode == LV_SPAN_MODE_FIXED) { width = self_size->x >= 0 ? lv_obj_get_content_width(obj) : 0; height = self_size->y >= 0 ? lv_obj_get_content_height(obj) : 0; } self_size->x = LV_MAX(self_size->x, width); self_size->y = LV_MAX(self_size->y, height); } } static void draw_main(lv_event_t * e) { lv_obj_t * obj = lv_event_get_target(e); const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t txt_coords; lv_obj_get_content_coords(obj, &txt_coords); lv_draw_span(obj, &txt_coords, clip_area); } /** * @return true for txt fill the max_width. */ static bool lv_txt_get_snippet(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width, lv_text_flag_t flag, lv_coord_t * use_width, uint32_t * end_ofs) { uint32_t ofs = _lv_txt_get_next_line(txt, font, letter_space, max_width, flag); lv_coord_t width = lv_txt_get_width(txt, ofs, font, letter_space, flag); *end_ofs = ofs; *use_width = width; if(txt[ofs] == '\0' && width < max_width) { return false; } else { return true; } } static void lv_snippet_push(lv_snippet_t * item) { if(snippet_stack.index < LV_SPAN_SNIPPET_STACK_SIZE) { memcpy(&snippet_stack.stack[snippet_stack.index], item, sizeof(lv_snippet_t)); snippet_stack.index++; } else { LV_LOG_ERROR("span draw stack overflow, please set LV_SPAN_SNIPPET_STACK_SIZE too larger"); } } static uint16_t lv_get_snippet_cnt() { return snippet_stack.index; } static lv_snippet_t * lv_get_snippet(uint16_t index) { return &snippet_stack.stack[index]; } static void lv_snippet_clear(void) { snippet_stack.index = 0; } static const lv_font_t * lv_span_get_style_text_font(lv_obj_t * par, lv_span_t * span) { const lv_font_t * font; lv_style_value_t value; lv_res_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_FONT, &value); if(res != LV_RES_OK) { font = lv_obj_get_style_text_font(par, LV_PART_MAIN); } else { font = (const lv_font_t *)value.ptr; } return font; } static lv_coord_t lv_span_get_style_text_letter_space(lv_obj_t * par, lv_span_t * span) { lv_coord_t letter_space; lv_style_value_t value; lv_res_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_LETTER_SPACE, &value); if(res != LV_RES_OK) { letter_space = lv_obj_get_style_text_letter_space(par, LV_PART_MAIN); } else { letter_space = (lv_coord_t)value.num; } return letter_space; } static lv_color_t lv_span_get_style_text_color(lv_obj_t * par, lv_span_t * span) { lv_style_value_t value; lv_res_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_COLOR, &value); if(res != LV_RES_OK) { value.color = lv_obj_get_style_text_color(par, LV_PART_MAIN); } return value.color; } static lv_opa_t lv_span_get_style_text_opa(lv_obj_t * par, lv_span_t * span) { lv_opa_t opa; lv_style_value_t value; lv_res_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_OPA, &value); if(res != LV_RES_OK) { opa = (lv_opa_t)lv_obj_get_style_text_opa(par, LV_PART_MAIN); } else { opa = (lv_opa_t)value.num; } return opa; } static lv_blend_mode_t lv_span_get_style_text_blend_mode(lv_obj_t * par, lv_span_t * span) { lv_blend_mode_t mode; lv_style_value_t value; lv_res_t res = lv_style_get_prop(&span->style, LV_STYLE_BLEND_MODE, &value); if(res != LV_RES_OK) { mode = (lv_blend_mode_t)lv_obj_get_style_blend_mode(par, LV_PART_MAIN); } else { mode = (lv_blend_mode_t)value.num; } return mode; } static int32_t lv_span_get_style_text_decor(lv_obj_t * par, lv_span_t * span) { LV_UNUSED(par); int32_t decor; lv_style_value_t value; lv_res_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_DECOR, &value); if(res != LV_RES_OK) { decor = LV_TEXT_DECOR_NONE; } else { decor = (int32_t)value.num; } return decor; } static inline void span_text_check(const char ** text) { if(*text == NULL) { *text = ""; LV_LOG_ERROR("occur an error that span text == NULL"); } } /** * draw span group * @param spans obj handle * @param coords coordinates of the label * @param mask the label will be drawn only in this area */ static void lv_draw_span(lv_obj_t * obj, const lv_area_t * coords, const lv_area_t * mask) { /* return if no draw area */ lv_area_t clipped_area; bool clip_ok = _lv_area_intersect(&clipped_area, coords, mask); if(!clip_ok) return; lv_spangroup_t * spans = (lv_spangroup_t *)obj; /* return if not span */ if(_lv_ll_get_head(&spans->child_ll) == NULL) { return; } /* init draw variable */ lv_text_flag_t txt_flag = LV_TEXT_FLAG_NONE; lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN);; lv_coord_t max_width = lv_area_get_width(coords); lv_coord_t max_w = max_width - spans->indent; /* first line need minus indent */ /* coords of draw span-txt */ lv_point_t txt_pos; txt_pos.y = coords->y1; txt_pos.x = coords->x1 + spans->indent; /* first line need add indent */ lv_span_t * cur_span = _lv_ll_get_head(&spans->child_ll); const char * cur_txt = cur_span->txt; span_text_check(&cur_txt); uint32_t cur_txt_ofs = 0; lv_snippet_t snippet; /* use to save cur_span info and push it to stack */ memset(&snippet, 0, sizeof(snippet)); /* the loop control how many lines need to draw */ while(cur_span) { lv_coord_t max_line_h = 0; /* the max height of span-font when a line have a lot of span */ lv_snippet_clear(); /* the loop control to find a line and push the relevant span info into stack */ while(1) { /* switch to the next span when current is end */ if(cur_txt[cur_txt_ofs] == '\0') { cur_span = _lv_ll_get_next(&spans->child_ll, cur_span); if(cur_span == NULL) break; cur_txt = cur_span->txt; span_text_check(&cur_txt); cur_txt_ofs = 0; } /* init span info to snippet. */ if(cur_txt_ofs == 0) { snippet.span = cur_span; snippet.font = lv_span_get_style_text_font(obj, cur_span); snippet.letter_space = lv_span_get_style_text_letter_space(obj, cur_span); snippet.line_h = lv_font_get_line_height(snippet.font) + line_space; } if(spans->overflow == LV_SPAN_OVERFLOW_ELLIPSIS) { /* span txt overflow, don't push */ if(txt_pos.y + snippet.line_h - line_space > coords->y2 + 1) { break; } } /* get current span text line info */ uint32_t next_ofs = 0; lv_coord_t use_width = 0; bool isfill = lv_txt_get_snippet(&cur_txt[cur_txt_ofs], snippet.font, snippet.letter_space, max_w, txt_flag, &use_width, &next_ofs); /* break word deal width */ if(isfill && next_ofs > 0 && lv_get_snippet_cnt() > 0) { uint32_t letter = (uint32_t)cur_txt[cur_txt_ofs + next_ofs - 1]; if(!(letter == '\0' || letter == '\n' || letter == '\r' || _lv_txt_is_break_char(letter))) { letter = (uint32_t)cur_txt[cur_txt_ofs + next_ofs]; if(!(letter == '\0' || letter == '\n' || letter == '\r' || _lv_txt_is_break_char(letter))) { break; } } } snippet.txt = &cur_txt[cur_txt_ofs]; snippet.bytes = next_ofs; snippet.txt_w = use_width; cur_txt_ofs += next_ofs; if(max_line_h < snippet.line_h) { max_line_h = snippet.line_h; } lv_snippet_push(&snippet); if(isfill) { break; } max_w -= use_width; } /* start current line deal width */ uint16_t item_cnt = lv_get_snippet_cnt(); if(item_cnt == 0) { /* break if stack is empty */ break; } /*Go the first visible line*/ if(txt_pos.y + max_line_h < mask->y1) { goto Next_line_init; } /* overflow deal width */ bool ellipsis_valid = false; if(spans->overflow == LV_SPAN_OVERFLOW_ELLIPSIS) { lv_coord_t next_line_h = snippet.line_h; if(cur_txt[cur_txt_ofs] == '\0') { /* current span deal with ok, need get next line first line height */ next_line_h = 0; if(cur_span) { lv_span_t * next_span = _lv_ll_get_next(&spans->child_ll, cur_span); if(next_span) { /* have the next line */ next_line_h = lv_font_get_line_height(lv_span_get_style_text_font(obj, next_span)) + line_space; } } } if(txt_pos.y + max_line_h + next_line_h > coords->y2 + 1) { ellipsis_valid = true; } } /* align deal with */ lv_text_align_t align = lv_obj_get_style_text_align(obj, LV_PART_MAIN); if(align != LV_TEXT_ALIGN_LEFT) { lv_coord_t align_ofs = 0; lv_coord_t txts_w = 0; for(int i = 0; i < item_cnt; i++) { lv_snippet_t * pinfo = lv_get_snippet(i); txts_w += pinfo->txt_w; } if(align == LV_TEXT_ALIGN_CENTER) { align_ofs = (max_width - txts_w) / 2; } else if(align == LV_TEXT_ALIGN_RIGHT) { align_ofs = max_width - txts_w; } txt_pos.x += align_ofs; } /* draw line letters */ for(int i = 0; i < item_cnt; i++) { lv_snippet_t * pinfo = lv_get_snippet(i); /* bidi deal with:todo */ const char * bidi_txt = pinfo->txt; lv_point_t pos; pos.x = txt_pos.x; pos.y = txt_pos.y + max_line_h - pinfo->line_h; lv_color_t letter_color = lv_span_get_style_text_color(obj, pinfo->span); lv_opa_t letter_opa = lv_span_get_style_text_opa(obj, pinfo->span); lv_blend_mode_t blend_mode = lv_span_get_style_text_blend_mode(obj, pinfo->span); uint32_t txt_bytes = pinfo->bytes; /* overflow */ uint16_t dot_letter_w = 0; uint16_t dot_width = 0; if(ellipsis_valid) { txt_bytes = strlen(bidi_txt); dot_letter_w = lv_font_get_glyph_width(pinfo->font, '.', '.'); dot_width = dot_letter_w * 3; } lv_coord_t ellipsis_width = coords->x1 + max_width - dot_width; uint32_t j = 0; while(j < txt_bytes) { /* skip invalid fields */ if(pos.x > clipped_area.x2) { break; } uint32_t letter = _lv_txt_encoded_next(bidi_txt, &j); uint32_t letter_next = _lv_txt_encoded_next(&bidi_txt[j], NULL); int32_t letter_w = lv_font_get_glyph_width(pinfo->font, letter, letter_next); /* skip invalid fields */ if(pos.x + letter_w + pinfo->letter_space < clipped_area.x1) { if(letter_w > 0) { pos.x = pos.x + letter_w + pinfo->letter_space; } continue; } if(ellipsis_valid && pos.x + letter_w + pinfo->letter_space > ellipsis_width) { for(int ell = 0; ell < 3; ell++) { lv_draw_letter(&pos, &clipped_area, pinfo->font, '.', letter_color, letter_opa, blend_mode); pos.x = pos.x + dot_letter_w + pinfo->letter_space; } break; } else { lv_draw_letter(&pos, &clipped_area, pinfo->font, letter, letter_color, letter_opa, blend_mode); if(letter_w > 0) { pos.x = pos.x + letter_w + pinfo->letter_space; } } } if(ellipsis_valid && i == item_cnt - 1 && pos.x <= ellipsis_width) { for(int ell = 0; ell < 3; ell++) { lv_draw_letter(&pos, &clipped_area, pinfo->font, '.', letter_color, letter_opa, blend_mode); pos.x = pos.x + dot_letter_w + pinfo->letter_space; } } /* draw decor */ lv_text_decor_t decor = lv_span_get_style_text_decor(obj, pinfo->span); if(decor != LV_TEXT_DECOR_NONE) { lv_draw_line_dsc_t line_dsc; lv_draw_line_dsc_init(&line_dsc); line_dsc.color = letter_color; line_dsc.width = pinfo->font->underline_thickness ? pinfo->font->underline_thickness : 1; line_dsc.opa = letter_opa; line_dsc.blend_mode = blend_mode; if(decor & LV_TEXT_DECOR_STRIKETHROUGH) { lv_point_t p1; lv_point_t p2; p1.x = txt_pos.x; p1.y = pos.y + (pinfo->line_h / 2) + line_dsc.width / 2; p2.x = pos.x; p2.y = p1.y; lv_draw_line(&p1, &p2, mask, &line_dsc); } if(decor & LV_TEXT_DECOR_UNDERLINE) { lv_point_t p1; lv_point_t p2; p1.x = txt_pos.x; p1.y = pos.y + pinfo->line_h + line_dsc.width / 2; p2.x = pos.x; p2.y = p1.y; lv_draw_line(&p1, &p2, &clipped_area, &line_dsc); } } txt_pos.x = pos.x; } Next_line_init: /* next line init */ txt_pos.x = coords->x1; txt_pos.y += max_line_h; if(txt_pos.y > clipped_area.y2 + 1) { return; } max_w = max_width; } } static void refresh_self_size(lv_obj_t * obj) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; spans->refresh = 1; lv_obj_refresh_self_size(obj); lv_obj_invalidate(obj); } #endif
stefanbode/Sonoff-Tasmota
lib/libesp32_lvgl/LVGL8/src/extra/widgets/span/lv_span.c
C
gpl-3.0
31,752
--- layout: politician title: Satyanarayan Jatiya constituency: Ujjain party: BJP state: Madhya Pradesh education: photo: Satyanarayan Jatiya.jpg sex: Male caste: SC religion: crime-accusation-instances: NO previous-office-title: MP (Lok Sabha 2004) date-of-birth: 1947 education: profession: email: jatiya@sansad.nic.in twitter: website: http://164.100.47.134/newls/HomePage.aspx?mpsno=160 tags: candidature: LokSabha2009 networth: 2794387 pan: NO date: 2013-12-18 --- ## Early Education Details available at [Wikipedia](http://www.wikipedia.org/wiki/) ## Political Career Details available at [Wikipedia](http://www.wikipedia.org/wiki/) ## Causes Check for the political parties agenda. You can list or vote on your cause at on [VoiceOfTheNation](http://www.voiceofthenation.org). ## Criminal Profile ### Criminal Cases Based on data from [NoCriminals.org](http://www.nocriminals.org) NO ## Personal Wealth Details of assets. ## Track record in Public Office Check details on [Govcheck](http://www.govcheck.org) for Rajya Sabha and Lok Sabha attendance and work resume. Check details on [MumbaiVotes](http://www.mumbaivotes.org) for local or city body attendance and work resume.
vaibhavb/wisevoter
data/output/2013-12-18-satyanarayan-jatiya.md
Markdown
gpl-3.0
1,201
/* * 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/>. */ /* * CleanUpHandler.java * Copyright (C) 2009 University of Waikato, Hamilton, New Zealand */ package adams.core; /** * Interface for classes that support cleaning up of memory. * * @author FracPete (fracpete at waikato dot ac dot nz) * @version $Revision$ */ public interface CleanUpHandler { /** * Cleans up data structures, frees up memory. */ public void cleanUp(); }
waikato-datamining/adams-base
adams-core/src/main/java/adams/core/CleanUpHandler.java
Java
gpl-3.0
1,068
/* Copyright (C) 2012 Andrew Cotter 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/>. */ /** \file svm_optimizer_classification_unbiased_perceptron.cpp \brief SVM::Optimizer::Unbiased::Perceptron implementation */ #include "svm_optimizer_classification_unbiased_perceptron.hpp" namespace SVM { namespace Optimizer { namespace Classification { namespace Unbiased { //============================================================================ // Perceptron methods //============================================================================ Perceptron::~Perceptron() { } unsigned int const Perceptron::TrainingSize() const { return m_pKernel->TrainingSize(); } unsigned int const Perceptron::ValidationSize() const { return( m_pKernel->Size() - m_pKernel->TrainingSize() ); } void Perceptron::GetAlphas( double* const begin, double* const end ) const { unsigned int const trainingSize = m_pKernel->TrainingSize(); if ( end != begin + trainingSize ) throw std::runtime_error( "Perceptron::GetAlphas parameter array has incorrect length" ); double const scale = 1 / std::sqrt( m_normSquared ); for ( unsigned int ii = 0; ii < trainingSize; ++ii ) begin[ ii ] = m_alphas[ ii ] * scale; } double const Perceptron::NormSquared() const { return 1; } void Perceptron::GetValidationResponses( double* const begin, double* const end ) const { unsigned int const trainingSize = m_pKernel->TrainingSize(); unsigned int const totalSize = m_pKernel->Size(); BOOST_ASSERT( trainingSize <= totalSize ); if ( trainingSize >= totalSize ) throw std::runtime_error( "Perceptron::GetValidationResponses requires a validation set" ); if ( end != begin + totalSize - trainingSize ) throw std::runtime_error( "Perceptron::GetValidationResponses parameter array has incorrect length" ); { double const scale = 1 / std::sqrt( m_normSquared ); double* pDestination = begin; double* pDestinationEnd = end; double const* pResponse = m_responses.get() + trainingSize; double const* pLabel = m_pKernel->Labels() + trainingSize; for ( ; pDestination != pDestinationEnd; ++pDestination, ++pResponse, ++pLabel ) { double const response = *pResponse * scale; *pDestination = ( ( *pLabel > 0 ) ? response : -response ); } } } double const Perceptron::Evaluate( Random::Generator::LaggedFibonacci4<>& generator, SparseVector< float > const& otherVector ) const { return EvaluateHelper( otherVector ); } double const Perceptron::Evaluate( Random::Generator::LaggedFibonacci4<>& generator, SparseVector< double > const& otherVector ) const { return EvaluateHelper( otherVector ); } double const Perceptron::Evaluate( Random::Generator::LaggedFibonacci4<>& generator, SpanVector< float > const& otherVector ) const { return EvaluateHelper( otherVector ); } double const Perceptron::Evaluate( Random::Generator::LaggedFibonacci4<>& generator, SpanVector< double > const& otherVector ) const { return EvaluateHelper( otherVector ); } double const Perceptron::Evaluate( Random::Generator::LaggedFibonacci4<>& generator, DenseVector< float > const& otherVector ) const { return EvaluateHelper( otherVector ); } double const Perceptron::Evaluate( Random::Generator::LaggedFibonacci4<>& generator, DenseVector< double > const& otherVector ) const { return EvaluateHelper( otherVector ); } void Perceptron::Iterate( Random::Generator::LaggedFibonacci4<>& generator ) { unsigned int const trainingSize = m_pKernel->TrainingSize(); double const scaledMargin = m_margin * std::sqrt( m_normSquared ); FindKappa(); if ( m_kappa < scaledMargin ) { unsigned int index = m_index; double kappa = scaledMargin; { double const* pAlpha = m_alphas.get(); double const* pAlphaEnd = pAlpha + trainingSize; double const* pResponse = m_responses.get(); double const* pLabel = m_pKernel->Labels(); for ( ; pAlpha != pAlphaEnd; ++pAlpha, ++pResponse, ++pLabel ) { if ( *pAlpha != 0 ) { double const response = ( ( *pLabel > 0 ) ? *pResponse : -*pResponse ); if ( UNLIKELY( response <= kappa ) ) { index = ( pAlpha - m_alphas.get() ); kappa = response; } } } } if ( m_pKernel->Labels()[ index ] > 0 ) { m_normSquared += 2 * m_responses[ index ] + m_normsSquared[ index ]; m_pKernel->SetAlpha( m_alphas.get(), m_responses.get(), index, m_alphas[ index ] + 1 ); } else { m_normSquared += -2 * m_responses[ index ] + m_normsSquared[ index ]; m_pKernel->SetAlpha( m_alphas.get(), m_responses.get(), index, m_alphas[ index ] - 1 ); } m_index = trainingSize; m_kappa = std::numeric_limits< double >::quiet_NaN(); } } void Perceptron::Recalculate() { unsigned int const trainingSize = m_pKernel->TrainingSize(); m_pKernel->RecalculateResponses( m_alphas.get(), m_responses.get() ); { double accumulator = 0; double const* pAlpha = m_alphas.get(); double const* pAlphaEnd = pAlpha + trainingSize; double const* pResponse = m_responses.get(); for ( ; pAlpha != pAlphaEnd; ++pAlpha, ++pResponse ) accumulator += *pAlpha * *pResponse; BOOST_ASSERT( accumulator >= 0 ); m_normSquared = accumulator; } m_index = trainingSize; m_kappa = std::numeric_limits< double >::quiet_NaN(); } void Perceptron::FindKappa() const { if ( boost::math::isnan( m_kappa ) ) { unsigned int const trainingSize = m_pKernel->TrainingSize(); m_index = trainingSize; m_kappa = std::numeric_limits< double >::infinity(); double const* pResponse = m_responses.get(); double const* pResponseEnd = pResponse + trainingSize; double const* pLabel = m_pKernel->Labels(); for ( ; pResponse != pResponseEnd; ++pResponse, ++pLabel ) { double const response = ( ( *pLabel > 0 ) ? *pResponse : -*pResponse ); if ( UNLIKELY( response < m_kappa ) ) { m_index = ( pResponse - m_responses.get() ); m_kappa = response; } } } BOOST_ASSERT( m_index < m_pKernel->TrainingSize() ); BOOST_ASSERT( ! boost::math::isnan( m_kappa ) ); } } // namespace Unbiased } // namespace Classification } // namespace Optimizer } // namespace SVM
maliq/issvm
svm_optimizer_classification_unbiased_perceptron.cpp
C++
gpl-3.0
6,718
<?php /** * Normatividad Torreón - ReglamentoArchivoMunicipal * * Copyright (C) 2017 Guillermo Valdés Lozano <guivaloz@movimientolibre.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package NormatividadTorreon */ namespace ReglamentosVigentes; /** * Clase ReglamentoArchivoMunicipal */ class ReglamentoArchivoMunicipal extends \Base\PublicacionSchemaArticle { /** * Constructor */ public function __construct() { // Ejecutar constructor en el padre parent::__construct(); // Título, autor y fecha $this->nombre = 'Reglamento del Archivo Municipal de Torreón'; //~ $this->autor = ''; $this->fecha = '2013-01-01T00:00'; // El nombre del archivo a crear $this->archivo = 'reglamento-archivo-municipal'; // La descripción y claves dan información a los buscadores y redes sociales $this->descripcion = 'El presente reglamento tiene por objeto la guarda, preservación, conservación preventiva, restauración, conducción, depuración y aprovechamiento institucional y social del patrimonio archivístico municipal.'; $this->claves = 'Reglamento, Vigente, Archivo, Municipal'; // Ruta al archivo markdown con el contenido $this->contenido_archivo_markdown = 'lib/ReglamentosVigentes/ReglamentoArchivoMunicipal.md'; } // constructor } // Clase ReglamentoArchivoMunicipal ?>
normatividadtorreon/normatividadtorreon.github.io
lib/ReglamentosVigentes/ReglamentoArchivoMunicipal.php
PHP
gpl-3.0
2,138
/************************* Coppermine Photo Gallery ************************ Copyright (c) 2003-2016 Coppermine Dev Team v1.0 originally written by Gregory DEMAR This program 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. ******************************************** Coppermine version: 1.6.01 $HeadURL$ $Revision$ **********************************************/ /* * Date prototype extensions. Doesn't depend on any * other code. Doesn't overwrite existing methods. * * Adds dayNames, abbrDayNames, monthNames and abbrMonthNames static properties and isLeapYear, * isWeekend, isWeekDay, getDaysInMonth, getDayName, getMonthName, getDayOfYear, getWeekOfYear, * setDayOfYear, addYears, addMonths, addDays, addHours, addMinutes, addSeconds methods * * Copyright (c) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) * * Additional methods and properties added by Kelvin Luck: firstDayOfWeek, dateFormat, zeroTime, asString, fromString - * I've added my name to these methods so you know who to blame if they are broken! * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * An Array of day names starting with Sunday. * * @example dayNames[0] * @result 'Sunday' * * @name dayNames * @type Array * @cat Plugins/Methods/Date */ Date.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; /** * An Array of abbreviated day names starting with Sun. * * @example abbrDayNames[0] * @result 'Sun' * * @name abbrDayNames * @type Array * @cat Plugins/Methods/Date */ Date.abbrDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; /** * An Array of month names starting with Janurary. * * @example monthNames[0] * @result 'January' * * @name monthNames * @type Array * @cat Plugins/Methods/Date */ Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; /** * An Array of abbreviated month names starting with Jan. * * @example abbrMonthNames[0] * @result 'Jan' * * @name monthNames * @type Array * @cat Plugins/Methods/Date */ Date.abbrMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; /** * The first day of the week for this locale. * * @name firstDayOfWeek * @type Number * @cat Plugins/Methods/Date * @author Kelvin Luck */ Date.firstDayOfWeek = 1; /** * The format that string dates should be represented as (e.g. 'dd/mm/yyyy' for UK, 'mm/dd/yyyy' for US, 'yyyy-mm-dd' for Unicode etc). * * @name format * @type String * @cat Plugins/Methods/Date * @author Kelvin Luck */ Date.format = 'dd/mm/yyyy'; //Date.format = 'mm/dd/yyyy'; //Date.format = 'yyyy-mm-dd'; //Date.format = 'dd mmm yy'; /** * The first two numbers in the century to be used when decoding a two digit year. Since a two digit year is ambiguous (and date.setYear * only works with numbers < 99 and so doesn't allow you to set years after 2000) we need to use this to disambiguate the two digit year codes. * * @name format * @type String * @cat Plugins/Methods/Date * @author Kelvin Luck */ Date.fullYearStart = '20'; (function() { /** * Adds a given method under the given name * to the Date prototype if it doesn't * currently exist. * * @private */ function add(name, method) { if( !Date.prototype[name] ) { Date.prototype[name] = method; } }; /** * Checks if the year is a leap year. * * @example var dtm = new Date("01/12/2008"); * dtm.isLeapYear(); * @result true * * @name isLeapYear * @type Boolean * @cat Plugins/Methods/Date */ add("isLeapYear", function() { var y = this.getFullYear(); return (y%4==0 && y%100!=0) || y%400==0; }); /** * Checks if the day is a weekend day (Sat or Sun). * * @example var dtm = new Date("01/12/2008"); * dtm.isWeekend(); * @result false * * @name isWeekend * @type Boolean * @cat Plugins/Methods/Date */ add("isWeekend", function() { return this.getDay()==0 || this.getDay()==6; }); /** * Check if the day is a day of the week (Mon-Fri) * * @example var dtm = new Date("01/12/2008"); * dtm.isWeekDay(); * @result false * * @name isWeekDay * @type Boolean * @cat Plugins/Methods/Date */ add("isWeekDay", function() { return !this.isWeekend(); }); /** * Gets the number of days in the month. * * @example var dtm = new Date("01/12/2008"); * dtm.getDaysInMonth(); * @result 31 * * @name getDaysInMonth * @type Number * @cat Plugins/Methods/Date */ add("getDaysInMonth", function() { return [31,(this.isLeapYear() ? 29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()]; }); /** * Gets the name of the day. * * @example var dtm = new Date("01/12/2008"); * dtm.getDayName(); * @result 'Saturday' * * @example var dtm = new Date("01/12/2008"); * dtm.getDayName(true); * @result 'Sat' * * @param abbreviated Boolean When set to true the name will be abbreviated. * @name getDayName * @type String * @cat Plugins/Methods/Date */ add("getDayName", function(abbreviated) { return abbreviated ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()]; }); /** * Gets the name of the month. * * @example var dtm = new Date("01/12/2008"); * dtm.getMonthName(); * @result 'Janurary' * * @example var dtm = new Date("01/12/2008"); * dtm.getMonthName(true); * @result 'Jan' * * @param abbreviated Boolean When set to true the name will be abbreviated. * @name getDayName * @type String * @cat Plugins/Methods/Date */ add("getMonthName", function(abbreviated) { return abbreviated ? Date.abbrMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()]; }); /** * Get the number of the day of the year. * * @example var dtm = new Date("01/12/2008"); * dtm.getDayOfYear(); * @result 11 * * @name getDayOfYear * @type Number * @cat Plugins/Methods/Date */ add("getDayOfYear", function() { var tmpdtm = new Date("1/1/" + this.getFullYear()); return Math.floor((this.getTime() - tmpdtm.getTime()) / 86400000); }); /** * Get the number of the week of the year. * * @example var dtm = new Date("01/12/2008"); * dtm.getWeekOfYear(); * @result 2 * * @name getWeekOfYear * @type Number * @cat Plugins/Methods/Date */ add("getWeekOfYear", function() { return Math.ceil(this.getDayOfYear() / 7); }); /** * Set the day of the year. * * @example var dtm = new Date("01/12/2008"); * dtm.setDayOfYear(1); * dtm.toString(); * @result 'Tue Jan 01 2008 00:00:00' * * @name setDayOfYear * @type Date * @cat Plugins/Methods/Date */ add("setDayOfYear", function(day) { this.setMonth(0); this.setDate(day); return this; }); /** * Add a number of years to the date object. * * @example var dtm = new Date("01/12/2008"); * dtm.addYears(1); * dtm.toString(); * @result 'Mon Jan 12 2009 00:00:00' * * @name addYears * @type Date * @cat Plugins/Methods/Date */ add("addYears", function(num) { this.setFullYear(this.getFullYear() + num); return this; }); /** * Add a number of months to the date object. * * @example var dtm = new Date("01/12/2008"); * dtm.addMonths(1); * dtm.toString(); * @result 'Tue Feb 12 2008 00:00:00' * * @name addMonths * @type Date * @cat Plugins/Methods/Date */ add("addMonths", function(num) { var tmpdtm = this.getDate(); this.setMonth(this.getMonth() + num); if (tmpdtm > this.getDate()) this.addDays(-this.getDate()); return this; }); /** * Add a number of days to the date object. * * @example var dtm = new Date("01/12/2008"); * dtm.addDays(1); * dtm.toString(); * @result 'Sun Jan 13 2008 00:00:00' * * @name addDays * @type Date * @cat Plugins/Methods/Date */ add("addDays", function(num) { this.setDate(this.getDate() + num); return this; }); /** * Add a number of hours to the date object. * * @example var dtm = new Date("01/12/2008"); * dtm.addHours(24); * dtm.toString(); * @result 'Sun Jan 13 2008 00:00:00' * * @name addHours * @type Date * @cat Plugins/Methods/Date */ add("addHours", function(num) { this.setHours(this.getHours() + num); return this; }); /** * Add a number of minutes to the date object. * * @example var dtm = new Date("01/12/2008"); * dtm.addMinutes(60); * dtm.toString(); * @result 'Sat Jan 12 2008 01:00:00' * * @name addMinutes * @type Date * @cat Plugins/Methods/Date */ add("addMinutes", function(num) { this.setMinutes(this.getMinutes() + num); return this; }); /** * Add a number of seconds to the date object. * * @example var dtm = new Date("01/12/2008"); * dtm.addSeconds(60); * dtm.toString(); * @result 'Sat Jan 12 2008 00:01:00' * * @name addSeconds * @type Date * @cat Plugins/Methods/Date */ add("addSeconds", function(num) { this.setSeconds(this.getSeconds() + num); return this; }); /** * Sets the time component of this Date to zero for cleaner, easier comparison of dates where time is not relevant. * * @example var dtm = new Date(); * dtm.zeroTime(); * dtm.toString(); * @result 'Sat Jan 12 2008 00:01:00' * * @name zeroTime * @type Date * @cat Plugins/Methods/Date * @author Kelvin Luck */ add("zeroTime", function() { this.setMilliseconds(0); this.setSeconds(0); this.setMinutes(0); this.setHours(0); return this; }); /** * Returns a string representation of the date object according to Date.format. * (Date.toString may be used in other places so I purposefully didn't overwrite it) * * @example var dtm = new Date("01/12/2008"); * dtm.asString(); * @result '12/01/2008' // (where Date.format == 'dd/mm/yyyy' * * @name asString * @type Date * @cat Plugins/Methods/Date * @author Kelvin Luck */ add("asString", function() { var r = Date.format; return r .split('yyyy').join(this.getFullYear()) .split('yy').join((this.getFullYear() + '').substring(2)) .split('mmm').join(this.getMonthName(true)) .split('mm').join(_zeroPad(this.getMonth()+1)) .split('dd').join(_zeroPad(this.getDate())); }); /** * Returns a new date object created from the passed String according to Date.format or false if the attempt to do this results in an invalid date object * (We can't simple use Date.parse as it's not aware of locale and I chose not to overwrite it incase it's functionality is being relied on elsewhere) * * @example var dtm = Date.fromString("12/01/2008"); * dtm.toString(); * @result 'Sat Jan 12 2008 00:00:00' // (where Date.format == 'dd/mm/yyyy' * * @name fromString * @type Date * @cat Plugins/Methods/Date * @author Kelvin Luck */ Date.fromString = function(s) { var f = Date.format; var d = new Date('01/01/1977'); var iY = f.indexOf('yyyy'); if (iY > -1) { d.setFullYear(Number(s.substr(iY, 4))); } else { // TODO - this doesn't work very well - are there any rules for what is meant by a two digit year? d.setFullYear(Number(Date.fullYearStart + s.substr(f.indexOf('yy'), 2))); } var iM = f.indexOf('mmm'); if (iM > -1) { var mStr = s.substr(iM, 3); for (var i=0; i<Date.abbrMonthNames.length; i++) { if (Date.abbrMonthNames[i] == mStr) break; } d.setMonth(i); } else { d.setMonth(Number(s.substr(f.indexOf('mm'), 2)) - 1); } d.setDate(Number(s.substr(f.indexOf('dd'), 2))); if (isNaN(d.getTime())) { return false; } return d; }; // utility method var _zeroPad = function(num) { var s = '0'+num; return s.substring(s.length-2) //return ('0'+num).substring(-2); // doesn't work on IE :( }; })();
CatBerg-TestOrg/coppermine
js/date.js
JavaScript
gpl-3.0
13,375
from biot import * # display_wires(N_wires=6, r_wires=r_wires) display_quiver() display_particles(mode_name="boris_exact", colormap="Blues") # display_particles(mode_name="RK4_exact", colormap="Reds") print("Finished display") mlab.show()
StanczakDominik/PythonBiotSavart
plot.py
Python
gpl-3.0
240
# ./sass This folder contains the styling for the application's views. ## Styling Sencha Cmd supports styling using Sass and integrates the styling from the theme and required packages (specified in `"app.json"`) with application-defined views. ### ./sass/etc This folder contains misc. support code for Sass builds (global functions, etc.). ### ./sass/src This folder contains Sass files defining CSS rules corresponding to classes included in the application's JavaScript code build. By default, files in this folder are mapped to the application's root namespace, 'Products'. This is set in `"app.json"`: "sass": { "namespace": "Products" } ### ./sass/var This folder contains Sass files defining Sass variables corresponding to classes included in the application's JavaScript code build. By default, files in this folder are mapped to the application's root namespace, 'Products' in the same way as `"Products/sass/src"`. ## Slicing Internet Explorer 8 and 9 do not support linear gradients and IE8 does not support border-radius. To compensate for this, Sencha Cmd provides "image slicing" using an internal WebKit based renderer. To enable this, there is a special web page that renders all components and states so they can be captured and turned into image sprites. ### ./sass/example This folder contains the web page used to present all components and states so they can be captured as an image and used to produce images for IE8 and 9. This web page is also helpful when loaded in Chrome to view all components in their styled form.
linea-it/dri
frontend/products/sass/Readme.md
Markdown
gpl-3.0
1,578
# This should hold main initialization logic puts "hello world"
benweissmann/rise
src/src/main.rb
Ruby
gpl-3.0
63
package info.jlibrarian.stringutils; /* Original source code (c) 2013 C. Ivan Cooper. Licensed under GPLv3, see file COPYING for terms. */ import java.util.Comparator; /** * Represents a comparable wildcard string, also contains static functions for comparing wildcard strings. * * A wildcard string is any String. If the wildcard string includes an asterisk '*', then for the purpose * of comparison, only the characters before the asterisk need match the other wildcard string. * * if any wildcards are used, this comparison is symmetric and reflexive, but it is NOT transitive - * e.g. a=b and b=c but maybe not a=c * * for example, these pairs of wildcard strings are all considered "equal" * foobar foobar * foo* foobar * foobar foo* * * foobar * foobar foobar* * * @author C. Ivan Cooper (ivan@4levity.net) * */ public class WildcardString implements Comparable<WildcardString>,Comparator<String> { private final String string; /** * Compares two strings with a simple wildcard rule (see WildcardString) * * @param a * @param b * @return comparison result or 0 if equal */ static public int compareWildcardString(String a,String b) { if(a==null && b==null) return 0; //else if(a==null) return -1; //else if(b==null) return 1; int wca=a.indexOf("*"); int wcb=b.indexOf("*"); if(wcb>=0) { b = b.substring(0,wcb); // remove * and trailing chars if(a.length()>wcb) a = a.substring(0,wcb); } if(wca>=0) { a = a.substring(0,wca); // remove * and trailing chars if(b.length()>wca) b = b.substring(0,wca); } return a.compareToIgnoreCase(b); //return a.compareTo(b); } static public String generalizeWildcard(String s) { if (s==null) return "*"; int ix=s.length()-1; if(ix<=1) return "*"; while(ix>0 && s.charAt(ix)=='*') ix--; // skip any * fields starting from the end return s.substring(0, ix)+"*"; } public WildcardString(String s) { if(s==null) string="*"; else string=s; } public WildcardString() { string="*"; } /** * note: violates transitivity of equality * @param arg0 * @param arg1 * @return */ public int compare(String arg0, String arg1) { return compareWildcardString(arg0,arg1); } /** * note: violates transitivity of equality * @param arg0 * @return */ public int compareTo(WildcardString arg0) { if(arg0==null) throw new NullPointerException("cannot compare WildcardString to null"); return compareWildcardString(string,arg0.toString()); } @Override public String toString() { return string; } /** * note: violates transitivity of equality * @param obj * @return */ @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final WildcardString other = (WildcardString) obj; return (0==compareTo(other)); } @Override public int hashCode() { int hash = 3; hash = 79 * hash + (this.string != null ? this.string.hashCode() : 0); return hash; } }
4levity/Conan
src/main/java/info/jlibrarian/stringutils/WildcardString.java
Java
gpl-3.0
3,562
<?php /** * acm : Algae Culture Management (https://github.com/singularfactory/ACM) * Copyright 2012, Singular Factory <info@singularfactory.com> * * This file is part of ACM * * ACM 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. * * ACM 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 ACM. If not, see <http://www.gnu.org/licenses/>. * * @copyright Copyright 2012, Singular Factory <info@singularfactory.com> * @package ACM.Frontend * @since 1.0 * @link https://github.com/singularfactory/ACM * @license GPLv3 License (http://www.gnu.org/licenses/gpl.txt) */ ?> <?php use_helper('BarCode'); ?> <!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" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="title" content="Algae culture management | Banco Español de Algas" /> <meta name="description" content="Algae culture management of Banco Español de Algas" /> <meta name="keywords" content="bea, banco, español, algas, marine, biotechnology, spanish, banl, algae" /> <meta name="language" content="en" /> <meta name="robots" content="index, follow" /> <title>Algae culture management | Banco Español de Algas</title> <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" type="text/css" media="screen" href="/css/labels.css" /> </head> <body> <?php foreach ($strains as $strain):?> <table width="100%"> <tr> <th width="25%" style="text-align:right;">BEA Number</th> <td style="text-align:left;"><?php echo $strain->getFullCode();?></td> </tr> <tr> <th width="25%" style="text-align:right;">Genus</th> <td style="text-align:left;"><?php echo $strain->getGenus();?></td> </tr> <tr> <th width="25%" style="text-align:right;">Species</th> <td style="text-align:left;"><?php echo $strain->getSpecies();?></td> </tr> <tr> <th width="25%" style="text-align:right;">Class</th> <td style="text-align:left;"><?php echo $strain->getTaxonomicClass();?></td> </tr> <tr> <th width="25%" style="text-align:right;">Public</th> <td style="text-align:left;"><?php echo $strain->getIsPublic();?></td> </tr> <tr> <th width="25%" style="text-align:right;">Internal Code</th> <td style="text-align:left;"><?php echo $strain->getInternalCode();?></td> </tr> <tr> <th width="25%" style="text-align:right;">Remarks</th> <td style="text-align:left;"><?php echo $strain->getRemarks();?></td> </tr> </table> <hr/> <?php endforeach; ?> </body> </html>
singularfactory/ACM
apps/frontend/modules/report/templates/_maintenance_pdf.php
PHP
gpl-3.0
3,157
package TFC.Handlers.Client; import org.lwjgl.opengl.GL11; import TFC.*; import TFC.Core.TFC_Core; import TFC.Core.TFC_Settings; import TFC.Core.TFC_Time; import TFC.Core.Player.PlayerInfo; import TFC.Core.Player.PlayerManagerTFC; import TFC.Items.*; import TFC.TileEntities.TileEntityWoodConstruct; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.entity.*; import net.minecraft.client.gui.inventory.*; import net.minecraft.client.renderer.Tessellator; import net.minecraft.block.*; import net.minecraft.block.material.*; import net.minecraft.crash.*; import net.minecraft.creativetab.*; import net.minecraft.entity.*; import net.minecraft.entity.ai.*; import net.minecraft.entity.effect.*; import net.minecraft.entity.item.*; import net.minecraft.entity.monster.*; import net.minecraft.entity.player.*; import net.minecraft.entity.projectile.*; import net.minecraft.inventory.*; import net.minecraft.item.*; import net.minecraft.nbt.*; import net.minecraft.network.*; import net.minecraft.network.packet.*; import net.minecraft.pathfinding.*; import net.minecraft.potion.*; import net.minecraft.server.*; import net.minecraft.stats.*; import net.minecraft.tileentity.*; import net.minecraft.util.*; import net.minecraft.village.*; import net.minecraft.world.*; import net.minecraft.world.biome.*; import net.minecraft.world.chunk.*; import net.minecraft.world.gen.feature.*; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.event.ForgeSubscribe; public class PlankHighlightHandler{ @ForgeSubscribe public void DrawBlockHighlightEvent(DrawBlockHighlightEvent evt) { World world = evt.player.worldObj; double var8 = evt.player.lastTickPosX + (evt.player.posX - evt.player.lastTickPosX) * (double)evt.partialTicks; double var10 = evt.player.lastTickPosY + (evt.player.posY - evt.player.lastTickPosY) * (double)evt.partialTicks; double var12 = evt.player.lastTickPosZ + (evt.player.posZ - evt.player.lastTickPosZ) * (double)evt.partialTicks; if(evt.currentItem != null && evt.currentItem.getItem() instanceof ItemPlank) { //Setup GL for the depthbox //GL11.glEnable(GL11.GL_BLEND); //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); //GL11.glColor3f(1,1,1); //GL11.glDisable(GL11.GL_CULL_FACE); //GL11.glDepthMask(false); //ForgeHooksClient.bindTexture("/bioxx/woodoverlay.png", ModLoader.getMinecraftInstance().renderEngine.getTexture("/bioxx/woodoverlay.png")); // double blockMinX = evt.target.blockX; // double blockMinY = evt.target.blockY; // double blockMinZ = evt.target.blockZ; // double blockMaxX = evt.target.blockX+1; // double blockMaxY = evt.target.blockY+1; // double blockMaxZ = evt.target.blockZ+1; // drawFaceUV(AxisAlignedBB.getAABBPool().addOrModifyAABBInPool( // blockMinX, // blockMinY, // blockMinZ, // blockMaxX, // blockMaxY, // blockMaxZ // ).expand(0.002F, 0.002F, 0.002F).getOffsetBoundingBox(-var8, -var10, -var12), evt.target.sideHit); GL11.glDisable(GL11.GL_TEXTURE_2D); boolean isConstruct = world.getBlockId(evt.target.blockX, evt.target.blockY, evt.target.blockZ) == TFCBlocks.WoodConstruct.blockID; float div = 1f / TileEntityWoodConstruct.PlankDetailLevel; //Get the hit location in local box coords double hitX = Math.round((evt.target.hitVec.xCoord - evt.target.blockX)*100)/100.0d; double hitY = Math.round((evt.target.hitVec.yCoord - evt.target.blockY)*100)/100.0d; double hitZ = Math.round((evt.target.hitVec.zCoord - evt.target.blockZ)*100)/100.0d; //get the targeted sub block coords double subX = (double)((int)((hitX)*8))/8; double subY = (double)((int)((hitY)*8))/8; double subZ = (double)((int)((hitZ)*8))/8; //create the box size double minX = evt.target.blockX + subX; double minY = evt.target.blockY + subY; double minZ = evt.target.blockZ + subZ; double maxX = minX + 0.125; double maxY = minY + 0.125; double maxZ = minZ + 0.125; if(isConstruct && hitY != 0 && hitY != 1 && hitZ != 0 && hitZ != 1 && hitX != 0 && hitX != 1) { if(evt.target.sideHit == 0) { minY = evt.target.blockY; maxY = evt.target.blockY + 1; } else if(evt.target.sideHit == 1) { minY = evt.target.blockY; maxY = evt.target.blockY + 1; } else if(evt.target.sideHit == 2) { minZ = evt.target.blockZ; maxZ = evt.target.blockZ+1; } else if(evt.target.sideHit == 3) { minZ = evt.target.blockZ; maxZ = evt.target.blockZ+1; } else if(evt.target.sideHit == 4) { minX = evt.target.blockX; maxX = evt.target.blockX+1; } else if(evt.target.sideHit == 5) { minX = evt.target.blockX; maxX = evt.target.blockX+1; } } else { if(evt.target.sideHit == 0) { maxY = minY; minY = minY - 1; } else if(evt.target.sideHit == 1) { maxY = minY + 1; } else if(evt.target.sideHit == 2) { maxZ = minZ; minZ = minZ - 1; } else if(evt.target.sideHit == 3) { maxZ = minZ + 1; } else if(evt.target.sideHit == 4) { maxX = minX; minX = minX - 1; } else if(evt.target.sideHit == 5) { maxX = minX + 1; } } //Setup GL for the depthbox GL11.glEnable(GL11.GL_BLEND); //Setup the GL stuff for the outline GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); //Draw the mini Box drawBox(AxisAlignedBB.getAABBPool().getAABB(minX,minY,minZ,maxX,maxY,maxZ).expand(0.002F, 0.002F, 0.002F).getOffsetBoundingBox(-var8, -var10, -var12)); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); } } void drawFaceUV(AxisAlignedBB par1AxisAlignedBB, int side) { Tessellator var2 = Tessellator.instance; var2.setColorRGBA_F(1, 1, 1, 1); //Top var2.startDrawing(GL11.GL_QUADS); if(side == 0) { var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ, 0, 0); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ, 1, 0); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ, 1, 1); var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ, 0, 1); } else if(side == 1) { var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ, 0, 0); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ, 1, 0); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ, 1, 1); var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ, 0, 1); } else if(side == 2) { var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ, 0, 0); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ, 1, 0); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ, 1, 1); var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ, 0, 1); } else if(side == 3) { var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ, 0, 0); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ, 1, 0); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ, 1, 1); var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ, 0, 1); } else if(side == 4 ) { var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ, 0, 0); var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ, 1, 0); var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ, 1, 1); var2.addVertexWithUV(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ, 0, 1); } else if( side == 5) { var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ, 0, 0); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ, 1, 0); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ, 1, 1); var2.addVertexWithUV(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ, 0, 1); } var2.draw(); } void drawFace(AxisAlignedBB par1AxisAlignedBB) { Tessellator var2 = Tessellator.instance; //Top var2.startDrawing(GL11.GL_QUADS); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.draw(); } void drawBox(AxisAlignedBB par1AxisAlignedBB) { Tessellator var2 = Tessellator.instance; //Top var2.startDrawing(GL11.GL_QUADS); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.draw(); //Bottom var2.startDrawing(GL11.GL_QUADS); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ); var2.draw(); //-x var2.startDrawing(GL11.GL_QUADS); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ); var2.draw(); //+x var2.startDrawing(GL11.GL_QUADS); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.draw(); //-z var2.startDrawing(GL11.GL_QUADS); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.draw(); //+z var2.startDrawing(GL11.GL_QUADS); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ); var2.draw(); } void drawOutlinedBoundingBox(AxisAlignedBB par1AxisAlignedBB) { Tessellator var2 = Tessellator.instance; var2.startDrawing(3); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.draw(); var2.startDrawing(3); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.draw(); var2.startDrawing(GL11.GL_LINES); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ); var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); var2.draw(); } }
Timeslice42/TFCraft
TFC_Shared/src/TFC/Handlers/Client/PlankHighlightHandler.java
Java
gpl-3.0
14,157
return ["nasty: bgp med ordering", "cbgp_valid_nasty_bgp_med_ordering"]; # -----[ cbgp_valid_nasty_bgp_med_ordering ]------------------------- # # ------------------------------------------------------------------- sub cbgp_valid_nasty_bgp_med_ordering($) { my ($cbgp)= @_; $cbgp->send_cmd("net add domain 1 igp"); $cbgp->send_cmd("net add node 1.0.0.1"); $cbgp->send_cmd("net node 1.0.0.1 domain 1"); $cbgp->send_cmd("net add node 1.0.0.2"); $cbgp->send_cmd("net node 1.0.0.2 domain 1"); $cbgp->send_cmd("net add node 1.0.0.3"); $cbgp->send_cmd("net node 1.0.0.3 domain 1"); $cbgp->send_cmd("net add node 1.0.0.4"); $cbgp->send_cmd("net node 1.0.0.4 domain 1"); $cbgp->send_cmd("net add link 1.0.0.1 1.0.0.2"); $cbgp->send_cmd("net link 1.0.0.1 1.0.0.2 igp-weight --bidir 20"); $cbgp->send_cmd("net add link 1.0.0.1 1.0.0.3"); $cbgp->send_cmd("net link 1.0.0.1 1.0.0.3 igp-weight --bidir 5"); $cbgp->send_cmd("net add link 1.0.0.1 1.0.0.4"); $cbgp->send_cmd("net link 1.0.0.1 1.0.0.4 igp-weight --bidir 10"); $cbgp->send_cmd("net domain 1 compute"); $cbgp->send_cmd("bgp add router 1 1.0.0.1"); $cbgp->send_cmd("bgp router 1.0.0.1"); $cbgp->send_cmd("\tadd peer 2 1.0.0.2"); $cbgp->send_cmd("\tpeer 1.0.0.2 up"); $cbgp->send_cmd("\tadd peer 2 1.0.0.3"); $cbgp->send_cmd("\tpeer 1.0.0.3 up"); $cbgp->send_cmd("\tadd peer 3 1.0.0.4"); $cbgp->send_cmd("\tpeer 1.0.0.4 up"); $cbgp->send_cmd("\texit"); $cbgp->send_cmd("bgp add router 2 1.0.0.2"); $cbgp->send_cmd("bgp router 1.0.0.2"); $cbgp->send_cmd("\tadd network 255/8"); $cbgp->send_cmd("\tadd peer 1 1.0.0.1"); $cbgp->send_cmd("\tpeer 1.0.0.1"); $cbgp->send_cmd("\t\tfilter out"); $cbgp->send_cmd("\t\t\tadd-rule"); $cbgp->send_cmd("\t\t\t\tmatch any"); $cbgp->send_cmd("\t\t\t\taction \"metric 10\""); $cbgp->send_cmd("\t\t\t\texit"); $cbgp->send_cmd("\t\t\texit"); $cbgp->send_cmd("\t\texit"); $cbgp->send_cmd("\tpeer 1.0.0.1 up"); $cbgp->send_cmd("\texit"); $cbgp->send_cmd("bgp add router 2 1.0.0.3"); $cbgp->send_cmd("bgp router 1.0.0.3"); $cbgp->send_cmd("\tadd network 255/8"); $cbgp->send_cmd("\tadd peer 1 1.0.0.1"); $cbgp->send_cmd("\tpeer 1.0.0.1"); $cbgp->send_cmd("\t\tfilter out"); $cbgp->send_cmd("\t\t\tadd-rule"); $cbgp->send_cmd("\t\t\t\tmatch any"); $cbgp->send_cmd("\t\t\t\taction \"metric 20\""); $cbgp->send_cmd("\t\t\t\texit"); $cbgp->send_cmd("\t\t\texit"); $cbgp->send_cmd("\t\texit"); $cbgp->send_cmd("\tpeer 1.0.0.1 up"); $cbgp->send_cmd("\texit"); $cbgp->send_cmd("bgp add router 3 1.0.0.4"); $cbgp->send_cmd("bgp router 1.0.0.4"); $cbgp->send_cmd("\tadd network 255/8"); $cbgp->send_cmd("\tadd peer 1 1.0.0.1"); $cbgp->send_cmd("\tpeer 1.0.0.1 up"); $cbgp->send_cmd("\texit"); $cbgp->send_cmd("sim run"); my $rib= cbgp_get_rib($cbgp, '1.0.0.1', '255/8'); return TEST_FAILURE if (!check_has_bgp_route($rib, "255/8", -nexthop=>'1.0.0.4')); $cbgp->send_cmd("net link 1.0.0.1 1.0.0.2 down"); $cbgp->send_cmd("net domain 1 compute"); $cbgp->send_cmd("bgp router 1.0.0.1 rescan"); $cbgp->send_cmd("bgp router 1.0.0.2 rescan"); $cbgp->send_cmd("sim run"); $rib= cbgp_get_rib($cbgp, '1.0.0.1', '255/8'); return TEST_FAILURE if (!check_has_bgp_route($rib, "255/8", -nexthop=>'1.0.0.3')); $cbgp->send_cmd("net link 1.0.0.1 1.0.0.2 up"); $cbgp->send_cmd("net domain 1 compute"); $cbgp->send_cmd("bgp router 1.0.0.1 rescan"); $cbgp->send_cmd("bgp router 1.0.0.2 rescan"); $cbgp->send_cmd("sim run"); $rib= cbgp_get_rib($cbgp, '1.0.0.1', '255/8'); return TEST_FAILURE if (!check_has_bgp_route($rib, "255/8", -nexthop=>'1.0.0.4')); $cbgp->send_cmd("bgp router 1.0.0.2 del network 255/8"); $cbgp->send_cmd("sim run"); $rib= cbgp_get_rib($cbgp, '1.0.0.1', '255/8'); return TEST_FAILURE if (!check_has_bgp_route($rib, "255/8", -nexthop=>'1.0.0.3')); return TEST_SUCCESS; }
lvanbever/cbgp
valid/tests/bgp_med_ordering.pl
Perl
gpl-3.0
3,966
--- title: Cluster configuration category: Reference order: 50 --- For now, you can only use a very restricted set of commands, because we have not yet configured our client how to communicate with the Accio cluster. Configuration is done inside a `clusters.json` file, that is searched in two locations: * `/etc/accio/` for system-wide configuration (can be overriden with the `ACCIO_CONFIG_ROOT` environment variable); * `~/.accio/` for user-specific configuration. This path cannot be overriden. You may define multiple clusters, each one having at least a name and an address where to contact it. Clusters defined in these two files are merged, the latter file having the precedence in case of a cluster defined in both files. The first cluster ever defined is the default cluster, that is used if none is explicitly given. A simple configuration file looks like this: ```json [{ "name": "default", "server": "192.168.50.4:9999" }] ``` Each cluster is a JSON object formed of the following fields. | Name | Type | Description | |:-----|:-----|:------------| | name | string | Cluster name, that will be referenced later in commands. | | server | string | Address to contact one of the masters of this cluster, specified as a [Finagle name](https://twitter.github.io/finagle/guide/Names.html). | | credentials | string; optional | Credentials to use when communicating with this server. The format of this string depends on the configured [authentication strategies](../_deploy/security.html). | {: .table .table-striped}
privamov/accio
docs/_docs/configuration.md
Markdown
gpl-3.0
1,540
<?php global $_MODULE; $_MODULE = array(); $_MODULE['<{blocksearch}prestashop>blocksearch-top_13348442cc6a27032d2b4aa28b75a5d3'] = 'Cerca'; $_MODULE['<{blocksearch}prestashop>blocksearch_31a0c03d7fbd1dc61d3b8e02760e703b'] = 'Blocco ricerca rapida'; $_MODULE['<{blocksearch}prestashop>blocksearch_99e20473c0bf3c22d7420eff03ce66c3'] = 'Aggiunge un blocco con un campo di ricerca rapida'; $_MODULE['<{blocksearch}prestashop>blocksearch_13348442cc6a27032d2b4aa28b75a5d3'] = 'Cerca'; $_MODULE['<{blocksearch}prestashop>blocksearch_52d578d063d6101bbdae388ece037e60'] = 'Inserisci il nome di un prodotto'; $_MODULE['<{blocksearch}prestashop>blocksearch_34d1f91fb2e514b8576fab1a75a89a6b'] = 'Vai';
desarrollosimagos/puroextremo.com.ve
modules/blocksearch_mod/translations/it.php
PHP
gpl-3.0
691
{% extends "./preregistration/preregbase.html" %} {% block title %}Register Group Member{% endblock %} {% block backlink %}{% endblock %} {% block content %} <form method="post" action="register_group_member"> {% csrf_token %} <input type="hidden" name="id" value="{{ attendee.db_id }}" /> <input type="hidden" name="group_id" value="{{ group_id }}" /> <table width="100%" cellspacing="5" cellpadding="5"> <tr> <td width="25%"> <b><nobr>First and Last Name:</nobr></b> </td> <td width="75%"> <input type="text" style="width:10em" name="first_name" value="{{ attendee.first_name }}" class="focus" /> <input type="text" style="width:15em" name="last_name" value="{{ attendee.last_name }}" /> </td> </tr> {% include "preregistration/extra.html" %} {% include "preregistration/age_and_staffing.html" %} <tr> <td> <b>Email Address:</b> </td> <td> <input type="text" name="email" value="{{ attendee.email }}" /> </td> </tr> <tr> <td> <b>Postal Code:</b> </td> <td> <input type="text" name="zip_code" value="{{ attendee.zip_code }}" /> <input type="checkbox" name="international" value="1" {% if attendee.international %}checked{% endif %} /> I'm coming from outside the US. </td> </tr> {% include "preregistration/phone_numbers.html" %} <tr> <td> <nobr>What interests you?</nobr> </td> <td> {% checkgroup attendee.interests %} </td> </tr> <tr> <td> <nobr>How did you</nobr> <nobr>find {{ EVENT_NAME }}?</nobr> </td> <td> <input type="text" name="found_how" value="{{ attendee.found_how }}" /> </td> </tr> <tr> <td> Comments: </td> <td> <input type="text" name="comments" value="{{ attendee.comments }}" /> </td> </tr> <tr> <td> <nobr>Keep Me Updated:</nobr> </td> <td> <input type="checkbox" name="can_spam" value="1" {% if attendee.can_spam %}checked{% endif %} /> Send me emails relating to {{ EVENT_NAME }} in future years. &nbsp;&nbsp; <span class="popup">{% popup_link "../static_views/privacy.html" "View Our Privacy Policy" %}</span> </td> </tr> <tr> <td></td> <td> <input type="submit" value="Claim This Badge" /> </td> </tr> </table> </form> {% endblock %}
bds002/ubersystem
uber/templates/preregistration/register_group_member.html
HTML
gpl-3.0
2,206
/* * RusHub - hub server for Direct Connect peer to peer network. * * Copyright (C) 2009-2013 by Setuper * E-Mail: setuper at gmail dot com (setuper@gmail.com) * * This program 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. * * 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/>. */ #ifndef WEB_CONN_H #define WEB_CONN_H #include "Conn.h" #include "Plugin.h" #include "Server.h" using namespace ::server; using namespace ::dcserver; namespace dcserver { class DcServer; } namespace webserver { /// Factory for Web connetion class WebConnFactory : public ConnFactory { public: WebConnFactory(Protocol *, Server *); virtual ~WebConnFactory(); Conn * createConn(tSocket sock = 0); void deleteConn(Conn * &); void onNewData(Conn *, string *); int onNewConn(Conn *); }; // class WebConnFactory class WebConn; /// Web user class WebUser : public WebUserBase { public: WebConn * mWebConn; public: WebUser(int type) : WebUserBase(type), mWebConn(NULL) {} virtual ~WebUser() {} virtual const char * getCommand(); /// Disconnect this client virtual void disconnect(); /** Get string of ip */ virtual const string & getIp(); /** Get string of server IP (host) */ virtual const string & getIpConn() const; /** Get mac address */ virtual const string & getMacAddress(); /** Get real port */ virtual int getPort(); /** Get conn port */ virtual int getPortConn(); private: WebUser(const WebUser &); WebUser & operator = (const WebUser &); }; // class WebUser /// Web connection class WebConn : public Conn { public: WebUser * mWebUser; public: WebConn(tSocket sock = 0, Server * server = NULL); virtual ~WebConn(); virtual size_t send(const string & data, bool flush = true); DcServer * server(); private: /// Timer of the connection virtual int onTimer(Time & now); WebConn(const WebConn &); WebConn & operator = (const WebConn &); }; // class WebConn } // namespace webserver #endif // WEB_CONN_H /** * $Id$ * $HeadURL$ */
dkhabarov/rushub
rushub/src/WebConn.h
C
gpl-3.0
2,464
package com.bahram.relationshippoints.logistical.Lifecycle; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.View; /** * Created by bahram on 23.05.2015. */ public abstract class SupportFragmentLifecycle extends Fragment implements LifecycleDataHandling { /** * Called to retrieve per-instance state from an activity before being killed * so that the state can be restored in {@link #onCreate} or * {@link #onRestoreInstanceState} (the {@link Bundle} populated by this method * will be passed to both). * <p/> * <p>This method is called before an activity may be killed so that when it * comes back some time in the future it can restore its state. For example, * if activity B is launched in front of activity A, and at some point activity * A is killed to reclaim resources, activity A will have a chance to save the * current state of its user interface via this method so that when the user * returns to activity A, the state of the user interface can be restored * via {@link #onCreate} or {@link #onRestoreInstanceState}. * <p/> * <p>Do not confuse this method with activity lifecycle callbacks such as * {@link #onPause}, which is always called when an activity is being placed * in the background or on its way to destruction, or {@link #onStop} which * is called before destruction. One example of when {@link #onPause} and * {@link #onStop} is called and not this method is when a user navigates back * from activity B to activity A: there is no need to call {@link #onSaveInstanceState} * on B because that particular instance will never be restored, so the * system avoids calling it. An example when {@link #onPause} is called and * not {@link #onSaveInstanceState} is when activity B is launched in front of activity A: * the system may avoid calling {@link #onSaveInstanceState} on activity A if it isn't * killed during the lifetime of B since the state of the user interface of * A will stay intact. * <p/> * <p>The default implementation takes care of most of the UI per-instance * state for you by calling {@link View#onSaveInstanceState()} on each * view in the hierarchy that has an id, and by saving the id of the currently * focused view (all of which is restored by the default implementation of * {@link #onRestoreInstanceState}). If you override this method to save additional * information not captured by each individual view, you will likely want to * call through to the default implementation, otherwise be prepared to save * all of the state of each view yourself. * <p/> * <p>If called, this method will occur before {@link #onStop}. There are * no guarantees about whether it will occur before or after {@link #onPause}. * * @param outState Bundle in which to place your saved state. * @see #onCreate * @see #onRestoreInstanceState * @see #onPause */ @Override public void onSaveInstanceState(Bundle outState) { saveNecessaryData(outState); storeStateGUI(outState); super.onSaveInstanceState(outState); } }
Mithrandir21/RelationshipPoints
app/src/main/java/com/bahram/relationshippoints/logistical/Lifecycle/SupportFragmentLifecycle.java
Java
gpl-3.0
3,247
/* !!!! AUTOGENERATED FILE generated by svg-12-blend.rb !!!!! * * This file is an image processing operation for GEGL * * GEGL is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * GEGL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with GEGL; if not, see <http://www.gnu.org/licenses/>. * * Copyright 2006, 2007 Øyvind Kolås <pippin@gimp.org> * 2007 John Marshall * * SVG rendering modes; see: * http://www.w3.org/TR/SVG12/rendering.html * http://www.w3.org/TR/2004/WD-SVG12-20041027/rendering.html#comp-op-prop * * aA = aux(src) alpha aB = in(dst) alpha aD = out alpha * cA = aux(src) colour cB = in(dst) colour cD = out colour * * !!!! AUTOGENERATED FILE !!!!! */ #include "config.h" #include <glib/gi18n-lib.h> #ifdef GEGL_CHANT_PROPERTIES /* no properties */ #else #define GEGL_CHANT_TYPE_POINT_COMPOSER #define GEGL_CHANT_C_FILE "exclusion.c" #include "gegl-chant.h" static void prepare (GeglOperation *operation) { const Babl *format = babl_format ("RaGaBaA float"); gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "aux", format); gegl_operation_set_format (operation, "output", format); } /* Fast paths */ static gboolean operation_process (GeglOperation *operation, GeglOperationContext *context, const gchar *output_prop, const GeglRectangle *result, gint level) { GeglOperationClass *operation_class; gpointer input, aux; operation_class = GEGL_OPERATION_CLASS (gegl_chant_parent_class); /* get the raw values this does not increase the reference count */ input = gegl_operation_context_get_object (context, "input"); aux = gegl_operation_context_get_object (context, "aux"); /* pass the input/aux buffers directly through if they are alone*/ { const GeglRectangle *in_extent = NULL; const GeglRectangle *aux_extent = NULL; if (input) in_extent = gegl_buffer_get_abyss (input); if ((!input || (aux && !gegl_rectangle_intersect (NULL, in_extent, result)))) { gegl_operation_context_take_object (context, "output", g_object_ref (aux)); return TRUE; } if (aux) aux_extent = gegl_buffer_get_abyss (aux); if (!aux || (input && !gegl_rectangle_intersect (NULL, aux_extent, result))) { gegl_operation_context_take_object (context, "output", g_object_ref (input)); return TRUE; } } /* chain up, which will create the needed buffers for our actual * process function */ return operation_class->process (operation, context, output_prop, result, level); } static gboolean process (GeglOperation *op, void *in_buf, void *aux_buf, void *out_buf, glong n_pixels, const GeglRectangle *roi, gint level) { gfloat * GEGL_ALIGNED in = in_buf; gfloat * GEGL_ALIGNED aux = aux_buf; gfloat * GEGL_ALIGNED out = out_buf; gint i; if(aux == NULL) return TRUE; for (i = 0; i < n_pixels; i++) { gfloat aA, aB, aD; gint j; aB = in[3]; aA = aux[3]; aD = aA + aB - aA * aB; for (j = 0; j < 3; j++) { gfloat cA, cB; cB = in[j]; cA = aux[j]; out[j] = CLAMP ((cA * aB + cB * aA - 2 * cA * cB) + cA * (1 - aB) + cB * (1 - aA), 0, aD); } out[3] = aD; in += 4; aux += 4; out += 4; } return TRUE; } static void gegl_chant_class_init (GeglChantClass *klass) { GeglOperationClass *operation_class; GeglOperationPointComposerClass *point_composer_class; operation_class = GEGL_OPERATION_CLASS (klass); point_composer_class = GEGL_OPERATION_POINT_COMPOSER_CLASS (klass); point_composer_class->process = process; operation_class->process = operation_process; operation_class->prepare = prepare; operation_class->compat_name = "gegl:exclusion"; gegl_operation_class_set_keys (operation_class, "name" , "svg:exclusion", "description" , _("SVG blend operation exclusion (<code>d = (cA * aB + cB * aA - 2 * cA * cB) + cA * (1 - aB) + cB * (1 - aA)</code>)"), NULL); gegl_operation_class_set_key (operation_class, "categories", "compositors:svgfilter"); } #endif
dankamongmen/gegl
operations/generated/exclusion.c
C
gpl-3.0
5,106
<?php /** * * UEA Style report * * This is the report suggested from the team using WebPA at UEA, UK * * * @copyright 2007 Loughborough University * @license http://www.gnu.org/licenses/gpl.txt * @version 0.0.0.1 * @since 8 Aug 2008 * */ require_once("../../../includes/inc_global.php"); require_once(DOC__ROOT . 'includes/classes/class_assessment.php'); require_once(DOC__ROOT . 'includes/classes/class_algorithm_factory.php'); require_once(DOC__ROOT . 'includes/functions/lib_array_functions.php'); if (!check_user($_user, APP__USER_TYPE_TUTOR)){ header('Location:'. APP__WWW .'/logout.php?msg=denied'); exit; } // -------------------------------------------------------------------------------- // Process GET/POST $assessment_id = fetch_GET('a'); $type = fetch_GET('t', 'view'); $tab = fetch_GET('tab'); $year = fetch_GET('y', date('Y')); $marking_date = fetch_GET('md'); // -------------------------------------------------------------------------------- $assessment = new Assessment($DB); if (!$assessment->load($assessment_id)) { $assessment = null; echo(gettext('Error: The requested assessment could not be loaded.')); exit; } else { // ---------------------------------------- // Get the marking parameters used for the marksheet this report will display $marking_params = $assessment->get_marking_params($marking_date); if (!$marking_params) { echo(gettext('Error: The requested marksheet could not be loaded.')); exit; } // ---------------------------------------- // Get the appropriate algorithm and calculate the grades $algorithm = AlgorithmFactory::get_algorithm($marking_params['algorithm']); if (!$algorithm) { echo(gettext('Error: The requested algorithm could not be loaded.')); exit; } else { $algorithm->set_assessment($assessment); $algorithm->set_marking_params($marking_params); $algorithm->calculate(); $group_members = $algorithm->get_group_members(); $member_names = array(); for ($i =0; $i<count($group_members); $i++){ $array_key = array_keys($group_members); $temp = $group_members[$array_key[$i]]; for ($j=0; $j<count($temp);$j++){ array_push($member_names, $CIS->get_user($temp[$j])); } } }// /if-else(is algorithm) }// /if-else(is assessment) // ---------------------------------------- // Get the questions used in this assessment $form = new Form($DB); $form_xml =& $assessment->get_form_xml(); $form->load_from_xml($form_xml); $question_count = (int) $form->get_question_count(); // Create the actual array (question_ids are 0-based) if ($question_count>0) { $questions = range(0, $question_count-1); } else { $questions = array(); } //get the information in the format required $score_array = null; //get the information in the format required //get an array of the group names $group_names = $algorithm->get_group_names(); if ($assessment) { foreach ($group_members as $group_id => $g_members) { $g_member_count = count($group_members[$group_id]); foreach ($questions as $question_id) { $q_index = $question_id+1; $question = $form->get_question($question_id); $q_text = "Q{$q_index} : {$question['text']['_data']}"; foreach ($g_members as $i => $member_id) { $individ = $CIS->get_user($member_id); $mark_recipient = "{$individ['lastname']}, {$individ['forename']}"; foreach ($g_members as $j => $target_member_id) { $individ = $CIS->get_user($target_member_id); $marker = "{$individ['lastname']}, {$individ['forename']}"; if ($assessment->assessment_type == '0') { if ($member_id == $target_member_id) { $score_array[$group_names[$group_id]][$mark_recipient][$q_text][$marker] = 'n/a'; } else { $score_array[$group_names[$group_id]][$mark_recipient][$q_text][$marker] = $algorithm->get_member_response($group_id, $target_member_id, $question_id,$member_id ); } } else { $score_array[$group_names[$group_id]][$mark_recipient][$q_text][$marker] = $algorithm->get_member_response($group_id, $target_member_id, $question_id, $member_id); } if (is_null($score_array[$group_names[$group_id]][$mark_recipient][$q_text][$marker])) { $score_array[$group_names[$group_id]][$mark_recipient][$q_text][$marker] = '-'; } } } } } } /* * -------------------------------------------------------------------------------- * If report type is HTML view * -------------------------------------------------------------------------------- */ if ($type == 'view') { // Begin Page $page_title = ($assessment) ? "{$assessment->name}" : gettext('report'); $UI->page_title = APP__NAME . ' ' . $page_title; $UI->head(); ?> <style type="text/css"> <!-- #side_bar { display: none; } #main { margin: 0px; } table.grid th { padding: 8px; } table.grid td { padding: 8px; text-align: center; } table.grid td.important { background-color: #eec; } --> </style> <?php $UI->body(); $UI->content_start(); ?> <div class="content_box"> <h1 style="font-size: 150%;"><?php echo gettext('Student Responses');?></h1> <table class="grid" cellpadding="2" cellspacing="1"> <tr> <td> <?php //get an array of the group names $group_names = $algorithm->get_group_names(); $teams = array_keys($score_array); foreach ($teams as $i=> $team) { echo "<h2>{$team}</h2>"; $team_members = array_keys($score_array[$team]); foreach ($team_members as $team_member) { echo "<h3>".gettext("Results for:")." {$team_member}</h3>"; $questions = array_keys($score_array[$team][$team_member]); //print_r($questions); echo "<table class='grid' cellpadding='2' cellspacing='1' style='font-size: 0.8em'>"; $q_count = 0; foreach ($questions as $question) { $markers = array_keys($score_array[$team][$team_member][$question]); $markers_row = ''; $scores_row = ''; foreach ($markers as $marker) { $markers_row = $markers_row ."<th>{$marker}</th>"; $score = $score_array[$team][$team_member][$question][$marker]; $scores_row = $scores_row . "<td>{$score}</td>"; } if ($q_count == 0) { echo "<tr><th>&nbsp;</th>"; echo $markers_row; } echo "</tr><tr><th>{$question}</th>"; echo $scores_row; $q_count++; } echo "</tr></table><br/><br/>"; } } ?> </td> </tr> </table> </div> <?php $UI->content_end(false, false, false); } /* * -------------------------------------------------------------------------------- * If report type is download RTF (Rich Text Files) * -------------------------------------------------------------------------------- */ if ($type == 'download-rtf') { header("Content-Disposition: attachment; filename=uea.rtf"); header("Content-Type: text/enriched\n"); $group_names = $algorithm->get_group_names(); $teams = array_keys($score_array); foreach ($teams as $i=> $team) { echo "\n{$team}\n"; $team_members = array_keys($score_array[$team]); foreach ($team_members as $team_member) { echo "\n".gettext("Results for:")." {$team_member}\n"; $questions = array_keys($score_array[$team][$team_member]); $q_count = 0; foreach ($questions as $question) { $markers = array_keys($score_array[$team][$team_member][$question]); $markers_row = ''; $scores_row = ''; foreach ($markers as $marker) { $markers_row = $markers_row ."{$marker}\t"; $score = $score_array[$team][$team_member][$question][$marker]; $scores_row = $scores_row . "{$score}\t"; } if ($q_count == 0) { echo "\n\t"; echo $markers_row ."\t"; } echo "\n{$question}\t"; echo $scores_row . "\n"; $q_count++; } echo "\n"; } } } if ($type == 'download-csv') { header("Content-Disposition: attachment; filename=\"uea_report_style.csv\""); header('Content-Type: text/csv'); $group_names = $algorithm->get_group_names(); $teams = array_keys($score_array); foreach ($teams as $i=> $team) { echo "\n{$team}\n"; $team_members = array_keys($score_array[$team]); foreach ($team_members as $team_member) { echo "\n\"".gettext("Results for:")." {$team_member}\""; $questions = array_keys($score_array[$team][$team_member]); $q_count = 0; foreach ($questions as $question) { $markers = array_keys($score_array[$team][$team_member][$question]); $markers_row = ''; $scores_row = ''; foreach ($markers as $marker) { $markers_row .= APP__SEPARATION."\"{$marker}\""; $score = $score_array[$team][$team_member][$question][$marker]; $scores_row = $scores_row . "\"{$score}\"".APP__SEPARATION; } if ($q_count == 0) { echo "\n"; echo $markers_row; } echo "\n\"{$question}\"".APP__SEPARATION; echo $scores_row; $q_count++; } echo "\n"; } } } ?>
ICTO/WebPA-Source
tutors/assessments/reports/report_uea.php
PHP
gpl-3.0
9,239
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; using System.Drawing; using System.IO; using FeedReader; using FeedReader.Xml.Interfaces; namespace FeedReader.Xml { internal class FeedRdfImageXmlParser : IFeedTypeImageXmlParser { private Image _feedImage; private string _feedImagePath = string.Empty; public Image GetParsedImage() { return _feedImage; } public string GetImagePath() { return _feedImagePath; } public bool TryParseFeedImageUrl(XDocument xmlFeed, string cacheFolder, string feedTitle) { bool returnValue = false; _feedImage = null; _feedImagePath = string.Empty; //1. Try string url = FeedXmlParser.ParseString(xmlFeed.Descendants("channel").Elements("image").Attributes("resource"), "channel/image/attribute[resource]"); returnValue = DownloadAndCheckFeedImageValid(cacheFolder, url, feedTitle); if (returnValue) return true; LogEvents.InvokeOnDebug(new FeedArgs("No feed image could be parsed")); return false; } public bool TryParseFeedItemImageUrl(XDocument xmlFeed, string cacheFolder, string feedTitle, string feedItemTitle, int itemNumber) { XElement item = xmlFeed.Descendants("item").ElementAt(itemNumber); bool returnValue = false; _feedImage = null; _feedImagePath = string.Empty; if (item != null) { //1. Try string url = FeedXmlParser.ParseString(item.Element("item"), "about", "item[" + itemNumber + "]/attribute[about]"); if (Path.GetExtension(url) == ".gif" || Path.GetExtension(url) == ".bmp" || Path.GetExtension(url) == ".jpg" || Path.GetExtension(url) == ".png" || Path.GetExtension(url) == ".jpeg") { returnValue = DownloadAndCheckFeedItemImageValid(cacheFolder, url, feedTitle, feedItemTitle); if (returnValue) return true; } //Last Try LogEvents.InvokeOnDebug(new FeedArgs("Try to get feed item image out of description field...")); string description = FeedXmlParser.ParseString(item.Element("description"), "item[" + itemNumber + "]/description"); url = Utils.GetImageOutOfDescription(Utils.ReplaceHTMLSpecialChars(description)); returnValue = DownloadAndCheckFeedItemImageValid(cacheFolder, url, feedTitle, feedItemTitle); if (returnValue) return true; } LogEvents.InvokeOnDebug(new FeedArgs("No feed item image could be parsed")); return false; } public bool DownloadAndCheckFeedImageValid(string cacheFolder, string url, string feedTitle) { if (Utils.IsValidUrl(ref url)) { LogEvents.InvokeOnDebug(new FeedArgs("Parsed feed image \"" + url + "\" successfull. Downloading image/Load image from cache...")); if (string.IsNullOrEmpty(cacheFolder)) { if (Utils.LoadFeedImage(url, feedTitle, out _feedImage)) return true; } else { if (Utils.LoadFeedImage(url, feedTitle, cacheFolder, out _feedImage, out _feedImagePath)) return true; } } return false; } public bool DownloadAndCheckFeedItemImageValid(string cacheFolder, string url, string feedTitle, string feedItemTitle) { if (Utils.IsValidUrl(ref url)) { LogEvents.InvokeOnDebug(new FeedArgs("Parsed feed item image \"" + url + "\" successfull. Downloading image/Load image from cache...")); if (string.IsNullOrEmpty(cacheFolder)) { if (Utils.LoadFeedItemImage(url, feedTitle, feedItemTitle, out _feedImage)) return true; } else { if (Utils.LoadFeedItemImage(url, feedTitle, feedItemTitle, cacheFolder, out _feedImage, out _feedImagePath)) return true; } } return false; } public bool TryParseFeedImageUrl(XDocument xmlFeed, string feedTitle) { return TryParseFeedImageUrl(xmlFeed, string.Empty, feedTitle); } public bool TryParseFeedItemImageUrl(XDocument xmlFeed, string feedTitle, string feedItemTitle, int itemNumber) { return TryParseFeedItemImageUrl(xmlFeed, string.Empty, feedTitle, feedItemTitle, itemNumber); } } }
hasenbolle/InfoService
InfoService/InfoService/Feeds/FeedReader/Xml/FeedRdfImageXmlParser.cs
C#
gpl-3.0
4,835
<?php /** * New Offer email * * @since 0.1.0 * @package public/includes/emails * @author AngellEYE <andrew@angelleye.com> */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> <?php do_action( 'woocommerce_email_header', $email_heading ); ?> <?php printf( '<p><strong>' . __('New offer submitted on', 'offers-for-woocommerce') . ' %s.</strong><br />' . __('To manage this offer please use the following link:', 'offers-for-woocommerce') . '</p> %s', get_bloginfo( 'name' ), '<a style="background:#EFEFEF; color:#161616; padding:8px 15px; margin:10px; border:1px solid #CCCCCC; text-decoration:none; " href="'. admin_url( 'post.php?post='. $offer_args['offer_id'] .'&action=edit' ) .'"><span style="border-bottom:1px dotted #666; ">' . __( 'Manage Offer', 'offers-for-woocommerce') . '</span></a>' ); ?> <h2><?php echo __( 'Offer ID:', 'offers-for-woocommerce') . ' ' . $offer_args['offer_id']; ?> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', time() ), date_i18n( wc_date_format(), time() ) ); ?>)</h2> <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee"> <thead> <tr> <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Product', 'woocommerce' ); ?></th> <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Quantity', 'woocommerce' ); ?></th> <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Price', 'woocommerce' ); ?></th> </tr> </thead> <tbody> <tr> <td style="text-align:left; vertical-align:middle; border: 1px solid #eee; padding:12px;"><?php echo stripslashes($offer_args['product_title_formatted']); ?></td> <td style="text-align:left; vertical-align:middle; border: 1px solid #eee; padding:12px;"><?php echo number_format( $offer_args['product_qty'], 0 ); ?></td> <td style="text-align:left; vertical-align:middle; border: 1px solid #eee; padding:12px;"><?php echo get_woocommerce_currency_symbol() . ' ' . number_format( $offer_args['product_price_per'], 2 ); ?></td> </tr> </tbody> <tfoot> <tr> <th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; border-top-width: 4px; "><?php _e( 'Subtotal', 'woocommerce' ); ?></th> <td style="text-align:left; border: 1px solid #eee; border-top-width: 4px; "><?php echo get_woocommerce_currency_symbol() . ' ' . number_format( $offer_args['product_total'], 2 ); ?></td> </tr> </tfoot> </table> <h4><?php echo __('Offer Contact Details:', 'offers-for-woocommerce'); ?></h4> <?php echo (isset($offer_args['offer_name']) && $offer_args['offer_name'] != '') ? '<strong>' . __('Name:', 'offers-for-woocommerce') . '&nbsp;</strong>'.stripslashes($offer_args['offer_name']) : ''; ?> <?php echo (isset($offer_args['offer_company_name']) && $offer_args['offer_company_name'] != '') ? '<br /><strong>' . __('Company Name:', 'offers-for-woocommerce') . '&nbsp;</strong>'.stripslashes($offer_args['offer_company_name']) : ''; ?> <?php echo (isset($offer_args['offer_email']) && $offer_args['offer_email'] != '') ? '<br /><strong>' . __('Email:', 'offers-for-woocommerce') . '&nbsp;</strong>'.stripslashes($offer_args['offer_email']) : ''; ?> <?php echo (isset($offer_args['offer_phone']) && $offer_args['offer_phone'] != '') ? '<br /><strong>' . __('Phone:', 'offers-for-woocommerce') . '&nbsp;</strong>'.stripslashes($offer_args['offer_phone']) : ''; ?> <?php if(isset($offer_args['offer_notes']) && $offer_args['offer_notes'] != '') { echo '<h4>'. __( 'Offer Notes:', 'offers-for-woocommerce' ) .'</h4>'. stripslashes($offer_args['offer_notes']); } ?> <?php do_action( 'woocommerce_email_footer' ); ?>
wp-plugins/offers-for-woocommerce
public/includes/emails/woocommerce-new-offer.php
PHP
gpl-3.0
3,810
using System.Diagnostics; using System.Security.Claims; using System.Security.Principal; namespace DotnetSpider.Portal.Common { /// <summary> /// Extension methods for <see cref="System.Security.Principal.IPrincipal"/> and <see cref="System.Security.Principal.IIdentity"/> . /// </summary> public static class PrincipalExtensions { /// <summary> /// Gets the name. /// </summary> /// <param name="principal">The principal.</param> /// <returns></returns> [DebuggerStepThrough] public static string GetDisplayName(this ClaimsPrincipal principal) { var name = principal.Identity.Name; if (!string.IsNullOrWhiteSpace(name)) return name; var sub = principal.FindFirst("sub"); if (sub != null) return sub.Value; return string.Empty; } /// <summary> /// Determines whether this instance is authenticated. /// </summary> /// <param name="principal">The principal.</param> /// <returns> /// <c>true</c> if the specified principal is authenticated; otherwise, <c>false</c>. /// </returns> [DebuggerStepThrough] public static bool IsAuthenticated(this IPrincipal principal) { return principal != null && principal.Identity != null && principal.Identity.IsAuthenticated; } } }
zlzforever/DotnetSpider
src/DotnetSpider.Portal/Common/PrincipalExtensions.cs
C#
gpl-3.0
1,235
/* * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds * * Modified by Fred N. van Kempen, 01/29/93, to add line disciplines * which can be dynamically activated and de-activated by the line * discipline handling modules (like SLIP). */ #include <linux/types.h> #include <linux/termios.h> #include <linux/errno.h> #include <linux/sched.h> #include <linux/kernel.h> #include <linux/major.h> #include <linux/tty.h> #include <linux/fcntl.h> #include <linux/string.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/bitops.h> #include <linux/mutex.h> #include <linux/compat.h> #include <asm/io.h> #include <asm/uaccess.h> #undef TTY_DEBUG_WAIT_UNTIL_SENT #ifdef TTY_DEBUG_WAIT_UNTIL_SENT #define tty_debug_wait_until_sent(tty, f, args...) tty_debug(tty, f, ##args) #else #define tty_debug_wait_until_sent(tty, f, args...) do {} while (0) #endif #undef DEBUG /* * Internal flag options for termios setting behavior */ #define TERMIOS_FLUSH 1 #define TERMIOS_WAIT 2 #define TERMIOS_TERMIO 4 #define TERMIOS_OLD 8 /** * tty_chars_in_buffer - characters pending * @tty: terminal * * Return the number of bytes of data in the device private * output queue. If no private method is supplied there is assumed * to be no queue on the device. */ int tty_chars_in_buffer(struct tty_struct *tty) { if (tty->ops->chars_in_buffer) { return tty->ops->chars_in_buffer(tty); } else { return 0; } } EXPORT_SYMBOL(tty_chars_in_buffer); /** * tty_write_room - write queue space * @tty: terminal * * Return the number of bytes that can be queued to this device * at the present time. The result should be treated as a guarantee * and the driver cannot offer a value it later shrinks by more than * the number of bytes written. If no method is provided 2K is always * returned and data may be lost as there will be no flow control. */ int tty_write_room(struct tty_struct *tty) { if (tty->ops->write_room) { return tty->ops->write_room(tty); } return 2048; } EXPORT_SYMBOL(tty_write_room); /** * tty_driver_flush_buffer - discard internal buffer * @tty: terminal * * Discard the internal output buffer for this device. If no method * is provided then either the buffer cannot be hardware flushed or * there is no buffer driver side. */ void tty_driver_flush_buffer(struct tty_struct *tty) { if (tty->ops->flush_buffer) { tty->ops->flush_buffer(tty); } } EXPORT_SYMBOL(tty_driver_flush_buffer); /** * tty_throttle - flow control * @tty: terminal * * Indicate that a tty should stop transmitting data down the stack. * Takes the termios rwsem to protect against parallel throttle/unthrottle * and also to ensure the driver can consistently reference its own * termios data at this point when implementing software flow control. */ void tty_throttle(struct tty_struct *tty) { down_write(&tty->termios_rwsem); /* check TTY_THROTTLED first so it indicates our state */ if (!test_and_set_bit(TTY_THROTTLED, &tty->flags) && tty->ops->throttle) { tty->ops->throttle(tty); } tty->flow_change = 0; up_write(&tty->termios_rwsem); } EXPORT_SYMBOL(tty_throttle); /** * tty_unthrottle - flow control * @tty: terminal * * Indicate that a tty may continue transmitting data down the stack. * Takes the termios rwsem to protect against parallel throttle/unthrottle * and also to ensure the driver can consistently reference its own * termios data at this point when implementing software flow control. * * Drivers should however remember that the stack can issue a throttle, * then change flow control method, then unthrottle. */ void tty_unthrottle(struct tty_struct *tty) { down_write(&tty->termios_rwsem); if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) && tty->ops->unthrottle) { tty->ops->unthrottle(tty); } tty->flow_change = 0; up_write(&tty->termios_rwsem); } EXPORT_SYMBOL(tty_unthrottle); /** * tty_throttle_safe - flow control * @tty: terminal * * Similar to tty_throttle() but will only attempt throttle * if tty->flow_change is TTY_THROTTLE_SAFE. Prevents an accidental * throttle due to race conditions when throttling is conditional * on factors evaluated prior to throttling. * * Returns 0 if tty is throttled (or was already throttled) */ int tty_throttle_safe(struct tty_struct *tty) { int ret = 0; mutex_lock(&tty->throttle_mutex); if (!tty_throttled(tty)) { if (tty->flow_change != TTY_THROTTLE_SAFE) { ret = 1; } else { set_bit(TTY_THROTTLED, &tty->flags); if (tty->ops->throttle) { tty->ops->throttle(tty); } } } mutex_unlock(&tty->throttle_mutex); return ret; } /** * tty_unthrottle_safe - flow control * @tty: terminal * * Similar to tty_unthrottle() but will only attempt unthrottle * if tty->flow_change is TTY_UNTHROTTLE_SAFE. Prevents an accidental * unthrottle due to race conditions when unthrottling is conditional * on factors evaluated prior to unthrottling. * * Returns 0 if tty is unthrottled (or was already unthrottled) */ int tty_unthrottle_safe(struct tty_struct *tty) { int ret = 0; mutex_lock(&tty->throttle_mutex); if (tty_throttled(tty)) { if (tty->flow_change != TTY_UNTHROTTLE_SAFE) { ret = 1; } else { clear_bit(TTY_THROTTLED, &tty->flags); if (tty->ops->unthrottle) { tty->ops->unthrottle(tty); } } } mutex_unlock(&tty->throttle_mutex); return ret; } /** * tty_wait_until_sent - wait for I/O to finish * @tty: tty we are waiting for * @timeout: how long we will wait * * Wait for characters pending in a tty driver to hit the wire, or * for a timeout to occur (eg due to flow control) * * Locking: none */ void tty_wait_until_sent(struct tty_struct *tty, long timeout) { tty_debug_wait_until_sent(tty, "wait until sent, timeout=%ld\n", timeout); if (!timeout) { timeout = MAX_SCHEDULE_TIMEOUT; } timeout = wait_event_interruptible_timeout(tty->write_wait, !tty_chars_in_buffer(tty), timeout); if (timeout <= 0) { return; } if (timeout == MAX_SCHEDULE_TIMEOUT) { timeout = 0; } if (tty->ops->wait_until_sent) { tty->ops->wait_until_sent(tty, timeout); } } EXPORT_SYMBOL(tty_wait_until_sent); /* * Termios Helper Methods */ static void unset_locked_termios(struct tty_struct *tty, struct ktermios *old) { struct ktermios *termios = &tty->termios; struct ktermios *locked = &tty->termios_locked; int i; #define NOSET_MASK(x, y, z) (x = ((x) & ~(z)) | ((y) & (z))) NOSET_MASK(termios->c_iflag, old->c_iflag, locked->c_iflag); NOSET_MASK(termios->c_oflag, old->c_oflag, locked->c_oflag); NOSET_MASK(termios->c_cflag, old->c_cflag, locked->c_cflag); NOSET_MASK(termios->c_lflag, old->c_lflag, locked->c_lflag); termios->c_line = locked->c_line ? old->c_line : termios->c_line; for (i = 0; i < NCCS; i++) termios->c_cc[i] = locked->c_cc[i] ? old->c_cc[i] : termios->c_cc[i]; /* FIXME: What should we do for i/ospeed */ } /* * Routine which returns the baud rate of the tty * * Note that the baud_table needs to be kept in sync with the * include/asm/termbits.h file. */ static const speed_t baud_table[] = { 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, #ifdef __sparc__ 76800, 153600, 307200, 614400, 921600 #else 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000 #endif }; #ifndef __sparc__ static const tcflag_t baud_bits[] = { B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400, B460800, B500000, B576000, B921600, B1000000, B1152000, B1500000, B2000000, B2500000, B3000000, B3500000, B4000000 }; #else static const tcflag_t baud_bits[] = { B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400, B460800, B76800, B153600, B307200, B614400, B921600 }; #endif static int n_baud_table = ARRAY_SIZE(baud_table); /** * tty_termios_baud_rate * @termios: termios structure * * Convert termios baud rate data into a speed. This should be called * with the termios lock held if this termios is a terminal termios * structure. May change the termios data. Device drivers can call this * function but should use ->c_[io]speed directly as they are updated. * * Locking: none */ speed_t tty_termios_baud_rate(struct ktermios *termios) { unsigned int cbaud; cbaud = termios->c_cflag & CBAUD; #ifdef BOTHER /* Magic token for arbitrary speed via c_ispeed/c_ospeed */ if (cbaud == BOTHER) { return termios->c_ospeed; } #endif if (cbaud & CBAUDEX) { cbaud &= ~CBAUDEX; if (cbaud < 1 || cbaud + 15 > n_baud_table) { termios->c_cflag &= ~CBAUDEX; } else { cbaud += 15; } } return baud_table[cbaud]; } EXPORT_SYMBOL(tty_termios_baud_rate); /** * tty_termios_input_baud_rate * @termios: termios structure * * Convert termios baud rate data into a speed. This should be called * with the termios lock held if this termios is a terminal termios * structure. May change the termios data. Device drivers can call this * function but should use ->c_[io]speed directly as they are updated. * * Locking: none */ speed_t tty_termios_input_baud_rate(struct ktermios *termios) { #ifdef IBSHIFT unsigned int cbaud = (termios->c_cflag >> IBSHIFT) & CBAUD; if (cbaud == B0) { return tty_termios_baud_rate(termios); } /* Magic token for arbitrary speed via c_ispeed*/ if (cbaud == BOTHER) { return termios->c_ispeed; } if (cbaud & CBAUDEX) { cbaud &= ~CBAUDEX; if (cbaud < 1 || cbaud + 15 > n_baud_table) { termios->c_cflag &= ~(CBAUDEX << IBSHIFT); } else { cbaud += 15; } } return baud_table[cbaud]; #else return tty_termios_baud_rate(termios); #endif } EXPORT_SYMBOL(tty_termios_input_baud_rate); /** * tty_termios_encode_baud_rate * @termios: ktermios structure holding user requested state * @ispeed: input speed * @ospeed: output speed * * Encode the speeds set into the passed termios structure. This is * used as a library helper for drivers so that they can report back * the actual speed selected when it differs from the speed requested * * For maximal back compatibility with legacy SYS5/POSIX *nix behaviour * we need to carefully set the bits when the user does not get the * desired speed. We allow small margins and preserve as much of possible * of the input intent to keep compatibility. * * Locking: Caller should hold termios lock. This is already held * when calling this function from the driver termios handler. * * The ifdefs deal with platforms whose owners have yet to update them * and will all go away once this is done. */ void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud) { int i = 0; int ifound = -1, ofound = -1; int iclose = ibaud / 50, oclose = obaud / 50; int ibinput = 0; if (obaud == 0) /* CD dropped */ { ibaud = 0; /* Clear ibaud to be sure */ } termios->c_ispeed = ibaud; termios->c_ospeed = obaud; #ifdef BOTHER /* If the user asked for a precise weird speed give a precise weird answer. If they asked for a Bfoo speed they may have problems digesting non-exact replies so fuzz a bit */ if ((termios->c_cflag & CBAUD) == BOTHER) { oclose = 0; } if (((termios->c_cflag >> IBSHIFT) & CBAUD) == BOTHER) { iclose = 0; } if ((termios->c_cflag >> IBSHIFT) & CBAUD) { ibinput = 1; /* An input speed was specified */ } #endif termios->c_cflag &= ~CBAUD; /* * Our goal is to find a close match to the standard baud rate * returned. Walk the baud rate table and if we get a very close * match then report back the speed as a POSIX Bxxxx value by * preference */ do { if (obaud - oclose <= baud_table[i] && obaud + oclose >= baud_table[i]) { termios->c_cflag |= baud_bits[i]; ofound = i; } if (ibaud - iclose <= baud_table[i] && ibaud + iclose >= baud_table[i]) { /* For the case input == output don't set IBAUD bits if the user didn't do so */ if (ofound == i && !ibinput) { ifound = i; } #ifdef IBSHIFT else { ifound = i; termios->c_cflag |= (baud_bits[i] << IBSHIFT); } #endif } } while (++i < n_baud_table); /* * If we found no match then use BOTHER if provided or warn * the user their platform maintainer needs to wake up if not. */ #ifdef BOTHER if (ofound == -1) { termios->c_cflag |= BOTHER; } /* Set exact input bits only if the input and output differ or the user already did */ if (ifound == -1 && (ibaud != obaud || ibinput)) { termios->c_cflag |= (BOTHER << IBSHIFT); } #else if (ifound == -1 || ofound == -1) { pr_warn_once("tty: Unable to return correct speed data as your architecture needs updating.\n"); } #endif } EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate); /** * tty_encode_baud_rate - set baud rate of the tty * @ibaud: input baud rate * @obad: output baud rate * * Update the current termios data for the tty with the new speed * settings. The caller must hold the termios_rwsem for the tty in * question. */ void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud) { tty_termios_encode_baud_rate(&tty->termios, ibaud, obaud); } EXPORT_SYMBOL_GPL(tty_encode_baud_rate); /** * tty_termios_copy_hw - copy hardware settings * @new: New termios * @old: Old termios * * Propagate the hardware specific terminal setting bits from * the old termios structure to the new one. This is used in cases * where the hardware does not support reconfiguration or as a helper * in some cases where only minimal reconfiguration is supported */ void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old) { /* The bits a dumb device handles in software. Smart devices need to always provide a set_termios method */ new->c_cflag &= HUPCL | CREAD | CLOCAL; new->c_cflag |= old->c_cflag & ~(HUPCL | CREAD | CLOCAL); new->c_ispeed = old->c_ispeed; new->c_ospeed = old->c_ospeed; } EXPORT_SYMBOL(tty_termios_copy_hw); /** * tty_termios_hw_change - check for setting change * @a: termios * @b: termios to compare * * Check if any of the bits that affect a dumb device have changed * between the two termios structures, or a speed change is needed. */ int tty_termios_hw_change(struct ktermios *a, struct ktermios *b) { if (a->c_ispeed != b->c_ispeed || a->c_ospeed != b->c_ospeed) { return 1; } if ((a->c_cflag ^ b->c_cflag) & ~(HUPCL | CREAD | CLOCAL)) { return 1; } return 0; } EXPORT_SYMBOL(tty_termios_hw_change); /** * tty_set_termios - update termios values * @tty: tty to update * @new_termios: desired new value * * Perform updates to the termios values set on this terminal. * A master pty's termios should never be set. * * Locking: termios_rwsem */ int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios) { struct ktermios old_termios; struct tty_ldisc *ld; WARN_ON(tty->driver->type == TTY_DRIVER_TYPE_PTY && tty->driver->subtype == PTY_TYPE_MASTER); /* * Perform the actual termios internal changes under lock. */ /* FIXME: we need to decide on some locking/ordering semantics for the set_termios notification eventually */ down_write(&tty->termios_rwsem); old_termios = tty->termios; tty->termios = *new_termios; unset_locked_termios(tty, &old_termios); if (tty->ops->set_termios) { tty->ops->set_termios(tty, &old_termios); } else { tty_termios_copy_hw(&tty->termios, &old_termios); } ld = tty_ldisc_ref(tty); if (ld != NULL) { if (ld->ops->set_termios) { ld->ops->set_termios(tty, &old_termios); } tty_ldisc_deref(ld); } up_write(&tty->termios_rwsem); return 0; } EXPORT_SYMBOL_GPL(tty_set_termios); /** * set_termios - set termios values for a tty * @tty: terminal device * @arg: user data * @opt: option information * * Helper function to prepare termios data and run necessary other * functions before using tty_set_termios to do the actual changes. * * Locking: * Called functions take ldisc and termios_rwsem locks */ static int set_termios(struct tty_struct *tty, void __user *arg, int opt) { struct ktermios tmp_termios; struct tty_ldisc *ld; int retval = tty_check_change(tty); if (retval) { return retval; } down_read(&tty->termios_rwsem); tmp_termios = tty->termios; up_read(&tty->termios_rwsem); if (opt & TERMIOS_TERMIO) { if (user_termio_to_kernel_termios(&tmp_termios, (struct termio __user *)arg)) { return -EFAULT; } #ifdef TCGETS2 } else if (opt & TERMIOS_OLD) { if (user_termios_to_kernel_termios_1(&tmp_termios, (struct termios __user *)arg)) { return -EFAULT; } } else { if (user_termios_to_kernel_termios(&tmp_termios, (struct termios2 __user *)arg)) { return -EFAULT; } } #else } else if (user_termios_to_kernel_termios(&tmp_termios, (struct termios __user *)arg)) { return -EFAULT; } #endif /* If old style Bfoo values are used then load c_ispeed/c_ospeed * with the real speed so its unconditionally usable */ tmp_termios.c_ispeed = tty_termios_input_baud_rate(&tmp_termios); tmp_termios.c_ospeed = tty_termios_baud_rate(&tmp_termios); ld = tty_ldisc_ref(tty); if (ld != NULL) { if ((opt & TERMIOS_FLUSH) && ld->ops->flush_buffer) { ld->ops->flush_buffer(tty); } tty_ldisc_deref(ld); } if (opt &TERMIOS_WAIT) { tty_wait_until_sent(tty, 0); if (signal_pending(current)) { return -ERESTARTSYS; } } tty_set_termios(tty, &tmp_termios); /* FIXME: Arguably if tmp_termios == tty->termios AND the actual requested termios was not tmp_termios then we may want to return an error as no user requested change has succeeded */ return 0; } static void copy_termios(struct tty_struct *tty, struct ktermios *kterm) { down_read(&tty->termios_rwsem); *kterm = tty->termios; up_read(&tty->termios_rwsem); } static void copy_termios_locked(struct tty_struct *tty, struct ktermios *kterm) { down_read(&tty->termios_rwsem); *kterm = tty->termios_locked; up_read(&tty->termios_rwsem); } static int get_termio(struct tty_struct *tty, struct termio __user *termio) { struct ktermios kterm; copy_termios(tty, &kterm); if (kernel_termios_to_user_termio(termio, &kterm)) { return -EFAULT; } return 0; } #ifdef TCGETX /** * set_termiox - set termiox fields if possible * @tty: terminal * @arg: termiox structure from user * @opt: option flags for ioctl type * * Implement the device calling points for the SYS5 termiox ioctl * interface in Linux */ static int set_termiox(struct tty_struct *tty, void __user *arg, int opt) { struct termiox tnew; struct tty_ldisc *ld; if (tty->termiox == NULL) { return -EINVAL; } if (copy_from_user(&tnew, arg, sizeof(struct termiox))) { return -EFAULT; } ld = tty_ldisc_ref(tty); if (ld != NULL) { if ((opt & TERMIOS_FLUSH) && ld->ops->flush_buffer) { ld->ops->flush_buffer(tty); } tty_ldisc_deref(ld); } if (opt & TERMIOS_WAIT) { tty_wait_until_sent(tty, 0); if (signal_pending(current)) { return -ERESTARTSYS; } } down_write(&tty->termios_rwsem); if (tty->ops->set_termiox) { tty->ops->set_termiox(tty, &tnew); } up_write(&tty->termios_rwsem); return 0; } #endif #ifdef TIOCGETP /* * These are deprecated, but there is limited support.. * * The "sg_flags" translation is a joke.. */ static int get_sgflags(struct tty_struct *tty) { int flags = 0; if (!L_ICANON(tty)) { if (L_ISIG(tty)) { flags |= 0x02; /* cbreak */ } else { flags |= 0x20; /* raw */ } } if (L_ECHO(tty)) { flags |= 0x08; /* echo */ } if (O_OPOST(tty)) if (O_ONLCR(tty)) { flags |= 0x10; /* crmod */ } return flags; } static int get_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb) { struct sgttyb tmp; down_read(&tty->termios_rwsem); tmp.sg_ispeed = tty->termios.c_ispeed; tmp.sg_ospeed = tty->termios.c_ospeed; tmp.sg_erase = tty->termios.c_cc[VERASE]; tmp.sg_kill = tty->termios.c_cc[VKILL]; tmp.sg_flags = get_sgflags(tty); up_read(&tty->termios_rwsem); return copy_to_user(sgttyb, &tmp, sizeof(tmp)) ? -EFAULT : 0; } static void set_sgflags(struct ktermios *termios, int flags) { termios->c_iflag = ICRNL | IXON; termios->c_oflag = 0; termios->c_lflag = ISIG | ICANON; if (flags & 0x02) /* cbreak */ { termios->c_iflag = 0; termios->c_lflag &= ~ICANON; } if (flags & 0x08) /* echo */ { termios->c_lflag |= ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE | IEXTEN; } if (flags & 0x10) /* crmod */ { termios->c_oflag |= OPOST | ONLCR; } if (flags & 0x20) /* raw */ { termios->c_iflag = 0; termios->c_lflag &= ~(ISIG | ICANON); } if (!(termios->c_lflag & ICANON)) { termios->c_cc[VMIN] = 1; termios->c_cc[VTIME] = 0; } } /** * set_sgttyb - set legacy terminal values * @tty: tty structure * @sgttyb: pointer to old style terminal structure * * Updates a terminal from the legacy BSD style terminal information * structure. * * Locking: termios_rwsem */ static int set_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb) { int retval; struct sgttyb tmp; struct ktermios termios; retval = tty_check_change(tty); if (retval) { return retval; } if (copy_from_user(&tmp, sgttyb, sizeof(tmp))) { return -EFAULT; } down_write(&tty->termios_rwsem); termios = tty->termios; termios.c_cc[VERASE] = tmp.sg_erase; termios.c_cc[VKILL] = tmp.sg_kill; set_sgflags(&termios, tmp.sg_flags); /* Try and encode into Bfoo format */ #ifdef BOTHER tty_termios_encode_baud_rate(&termios, termios.c_ispeed, termios.c_ospeed); #endif up_write(&tty->termios_rwsem); tty_set_termios(tty, &termios); return 0; } #endif #ifdef TIOCGETC static int get_tchars(struct tty_struct *tty, struct tchars __user *tchars) { struct tchars tmp; down_read(&tty->termios_rwsem); tmp.t_intrc = tty->termios.c_cc[VINTR]; tmp.t_quitc = tty->termios.c_cc[VQUIT]; tmp.t_startc = tty->termios.c_cc[VSTART]; tmp.t_stopc = tty->termios.c_cc[VSTOP]; tmp.t_eofc = tty->termios.c_cc[VEOF]; tmp.t_brkc = tty->termios.c_cc[VEOL2]; /* what is brkc anyway? */ up_read(&tty->termios_rwsem); return copy_to_user(tchars, &tmp, sizeof(tmp)) ? -EFAULT : 0; } static int set_tchars(struct tty_struct *tty, struct tchars __user *tchars) { struct tchars tmp; if (copy_from_user(&tmp, tchars, sizeof(tmp))) { return -EFAULT; } down_write(&tty->termios_rwsem); tty->termios.c_cc[VINTR] = tmp.t_intrc; tty->termios.c_cc[VQUIT] = tmp.t_quitc; tty->termios.c_cc[VSTART] = tmp.t_startc; tty->termios.c_cc[VSTOP] = tmp.t_stopc; tty->termios.c_cc[VEOF] = tmp.t_eofc; tty->termios.c_cc[VEOL2] = tmp.t_brkc; /* what is brkc anyway? */ up_write(&tty->termios_rwsem); return 0; } #endif #ifdef TIOCGLTC static int get_ltchars(struct tty_struct *tty, struct ltchars __user *ltchars) { struct ltchars tmp; down_read(&tty->termios_rwsem); tmp.t_suspc = tty->termios.c_cc[VSUSP]; /* what is dsuspc anyway? */ tmp.t_dsuspc = tty->termios.c_cc[VSUSP]; tmp.t_rprntc = tty->termios.c_cc[VREPRINT]; /* what is flushc anyway? */ tmp.t_flushc = tty->termios.c_cc[VEOL2]; tmp.t_werasc = tty->termios.c_cc[VWERASE]; tmp.t_lnextc = tty->termios.c_cc[VLNEXT]; up_read(&tty->termios_rwsem); return copy_to_user(ltchars, &tmp, sizeof(tmp)) ? -EFAULT : 0; } static int set_ltchars(struct tty_struct *tty, struct ltchars __user *ltchars) { struct ltchars tmp; if (copy_from_user(&tmp, ltchars, sizeof(tmp))) { return -EFAULT; } down_write(&tty->termios_rwsem); tty->termios.c_cc[VSUSP] = tmp.t_suspc; /* what is dsuspc anyway? */ tty->termios.c_cc[VEOL2] = tmp.t_dsuspc; tty->termios.c_cc[VREPRINT] = tmp.t_rprntc; /* what is flushc anyway? */ tty->termios.c_cc[VEOL2] = tmp.t_flushc; tty->termios.c_cc[VWERASE] = tmp.t_werasc; tty->termios.c_cc[VLNEXT] = tmp.t_lnextc; up_write(&tty->termios_rwsem); return 0; } #endif /** * tty_change_softcar - carrier change ioctl helper * @tty: tty to update * @arg: enable/disable CLOCAL * * Perform a change to the CLOCAL state and call into the driver * layer to make it visible. All done with the termios rwsem */ static int tty_change_softcar(struct tty_struct *tty, int arg) { int ret = 0; int bit = arg ? CLOCAL : 0; struct ktermios old; down_write(&tty->termios_rwsem); old = tty->termios; tty->termios.c_cflag &= ~CLOCAL; tty->termios.c_cflag |= bit; if (tty->ops->set_termios) { tty->ops->set_termios(tty, &old); } if (C_CLOCAL(tty) != bit) { ret = -EINVAL; } up_write(&tty->termios_rwsem); return ret; } /** * tty_mode_ioctl - mode related ioctls * @tty: tty for the ioctl * @file: file pointer for the tty * @cmd: command * @arg: ioctl argument * * Perform non line discipline specific mode control ioctls. This * is designed to be called by line disciplines to ensure they provide * consistent mode setting. */ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { struct tty_struct *real_tty; void __user *p = (void __user *)arg; int ret = 0; struct ktermios kterm; BUG_ON(file == NULL); if (tty->driver->type == TTY_DRIVER_TYPE_PTY && tty->driver->subtype == PTY_TYPE_MASTER) { real_tty = tty->link; } else { real_tty = tty; } switch (cmd) { #ifdef TIOCGETP case TIOCGETP: return get_sgttyb(real_tty, (struct sgttyb __user *) arg); case TIOCSETP: case TIOCSETN: return set_sgttyb(real_tty, (struct sgttyb __user *) arg); #endif #ifdef TIOCGETC case TIOCGETC: return get_tchars(real_tty, p); case TIOCSETC: return set_tchars(real_tty, p); #endif #ifdef TIOCGLTC case TIOCGLTC: return get_ltchars(real_tty, p); case TIOCSLTC: return set_ltchars(real_tty, p); #endif case TCSETSF: return set_termios(real_tty, p, TERMIOS_FLUSH | TERMIOS_WAIT | TERMIOS_OLD); case TCSETSW: return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_OLD); case TCSETS: return set_termios(real_tty, p, TERMIOS_OLD); #ifndef TCGETS2 case TCGETS: copy_termios(real_tty, &kterm); if (kernel_termios_to_user_termios((struct termios __user *)arg, &kterm)) { ret = -EFAULT; } return ret; #else case TCGETS: copy_termios(real_tty, &kterm); if (kernel_termios_to_user_termios_1((struct termios __user *)arg, &kterm)) { ret = -EFAULT; } return ret; case TCGETS2: copy_termios(real_tty, &kterm); if (kernel_termios_to_user_termios((struct termios2 __user *)arg, &kterm)) { ret = -EFAULT; } return ret; case TCSETSF2: return set_termios(real_tty, p, TERMIOS_FLUSH | TERMIOS_WAIT); case TCSETSW2: return set_termios(real_tty, p, TERMIOS_WAIT); case TCSETS2: return set_termios(real_tty, p, 0); #endif case TCGETA: return get_termio(real_tty, p); case TCSETAF: return set_termios(real_tty, p, TERMIOS_FLUSH | TERMIOS_WAIT | TERMIOS_TERMIO); case TCSETAW: return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO); case TCSETA: return set_termios(real_tty, p, TERMIOS_TERMIO); #ifndef TCGETS2 case TIOCGLCKTRMIOS: copy_termios_locked(real_tty, &kterm); if (kernel_termios_to_user_termios((struct termios __user *)arg, &kterm)) { ret = -EFAULT; } return ret; case TIOCSLCKTRMIOS: if (!capable(CAP_SYS_ADMIN)) { return -EPERM; } copy_termios_locked(real_tty, &kterm); if (user_termios_to_kernel_termios(&kterm, (struct termios __user *) arg)) { return -EFAULT; } down_write(&real_tty->termios_rwsem); real_tty->termios_locked = kterm; up_write(&real_tty->termios_rwsem); return 0; #else case TIOCGLCKTRMIOS: copy_termios_locked(real_tty, &kterm); if (kernel_termios_to_user_termios_1((struct termios __user *)arg, &kterm)) { ret = -EFAULT; } return ret; case TIOCSLCKTRMIOS: if (!capable(CAP_SYS_ADMIN)) { return -EPERM; } copy_termios_locked(real_tty, &kterm); if (user_termios_to_kernel_termios_1(&kterm, (struct termios __user *) arg)) { return -EFAULT; } down_write(&real_tty->termios_rwsem); real_tty->termios_locked = kterm; up_write(&real_tty->termios_rwsem); return ret; #endif #ifdef TCGETX case TCGETX: { struct termiox ktermx; if (real_tty->termiox == NULL) { return -EINVAL; } down_read(&real_tty->termios_rwsem); memcpy(&ktermx, real_tty->termiox, sizeof(struct termiox)); up_read(&real_tty->termios_rwsem); if (copy_to_user(p, &ktermx, sizeof(struct termiox))) { ret = -EFAULT; } return ret; } case TCSETX: return set_termiox(real_tty, p, 0); case TCSETXW: return set_termiox(real_tty, p, TERMIOS_WAIT); case TCSETXF: return set_termiox(real_tty, p, TERMIOS_FLUSH); #endif case TIOCGSOFTCAR: copy_termios(real_tty, &kterm); ret = put_user((kterm.c_cflag & CLOCAL) ? 1 : 0, (int __user *)arg); return ret; case TIOCSSOFTCAR: if (get_user(arg, (unsigned int __user *) arg)) { return -EFAULT; } return tty_change_softcar(real_tty, arg); default: return -ENOIOCTLCMD; } } EXPORT_SYMBOL_GPL(tty_mode_ioctl); /* Caller guarantees ldisc reference is held */ static int __tty_perform_flush(struct tty_struct *tty, unsigned long arg) { struct tty_ldisc *ld = tty->ldisc; switch (arg) { case TCIFLUSH: if (ld && ld->ops->flush_buffer) { ld->ops->flush_buffer(tty); tty_unthrottle(tty); } break; case TCIOFLUSH: if (ld && ld->ops->flush_buffer) { ld->ops->flush_buffer(tty); tty_unthrottle(tty); } /* fall through */ case TCOFLUSH: tty_driver_flush_buffer(tty); break; default: return -EINVAL; } return 0; } int tty_perform_flush(struct tty_struct *tty, unsigned long arg) { struct tty_ldisc *ld; int retval = tty_check_change(tty); if (retval) { return retval; } ld = tty_ldisc_ref_wait(tty); retval = __tty_perform_flush(tty, arg); if (ld) { tty_ldisc_deref(ld); } return retval; } EXPORT_SYMBOL_GPL(tty_perform_flush); int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { int retval; switch (cmd) { case TCXONC: retval = tty_check_change(tty); if (retval) { return retval; } switch (arg) { case TCOOFF: spin_lock_irq(&tty->flow_lock); if (!tty->flow_stopped) { tty->flow_stopped = 1; __stop_tty(tty); } spin_unlock_irq(&tty->flow_lock); break; case TCOON: spin_lock_irq(&tty->flow_lock); if (tty->flow_stopped) { tty->flow_stopped = 0; __start_tty(tty); } spin_unlock_irq(&tty->flow_lock); break; case TCIOFF: if (STOP_CHAR(tty) != __DISABLED_CHAR) { retval = tty_send_xchar(tty, STOP_CHAR(tty)); } break; case TCION: if (START_CHAR(tty) != __DISABLED_CHAR) { retval = tty_send_xchar(tty, START_CHAR(tty)); } break; default: return -EINVAL; } return retval; case TCFLSH: retval = tty_check_change(tty); if (retval) { return retval; } return __tty_perform_flush(tty, arg); default: /* Try the mode commands */ return tty_mode_ioctl(tty, file, cmd, arg); } } EXPORT_SYMBOL(n_tty_ioctl_helper); #ifdef CONFIG_COMPAT long n_tty_compat_ioctl_helper(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { switch (cmd) { case TIOCGLCKTRMIOS: case TIOCSLCKTRMIOS: return tty_mode_ioctl(tty, file, cmd, (unsigned long) compat_ptr(arg)); default: return -ENOIOCTLCMD; } } EXPORT_SYMBOL(n_tty_compat_ioctl_helper); #endif
williamfdevine/PrettyLinux
drivers/tty/tty_ioctl.c
C
gpl-3.0
31,950
<p class="quote"><?php echo $quote->quoteText; ?></p> <p class="author">-<?php echo $quote->quoteAuthor; ?></p>
Hammercake/pi-kiosk-alarm
modules/quote/view.php
PHP
gpl-3.0
111
#include "../Prereqs.h" #include "../TypeDefs.h" #include "../Defs.h" #include "../Macros.h" _Success_(return != FALSE, ...) PODNET_API VOID QuickSort( LPLONG lplArray, LONG lLow, LONG lHigh );
zachpodbielniak/PodNet
Linux/CSort/CSort.h
C
gpl-3.0
222
/* ============================================================================== MouseModule.h Created: 12 Mar 2020 3:08:47pm Author: bkupe ============================================================================== */ #pragma once class MouseModule : public Module, public MouseListener, public Timer { public: MouseModule(); ~MouseModule(); void clearItem() override; MouseInputSource* source; IntParameter* updateRate; IntParameter* currentScreen; Point2DParameter* absolutePosition; Point2DParameter* relativePosition; BoolParameter* leftButtonDown; BoolParameter* middleButtonDown; BoolParameter* rightButtonDown; void setCursorPosition(Point<float>& pos, bool isRelative); void setButtonDown(int buttonID); void setButtonUp(int buttonID); void setButtonClick(int buttonID); void sendButtonEvent(int buttonEvent); void mouseDown(const MouseEvent& e) override; void mouseUp(const MouseEvent& e) override; void onContainerParameterChangedInternal(Parameter* p) override; void onControllableFeedbackUpdateInternal(ControllableContainer* cc, Controllable* c) override; void updateMouseInfos(); void timerCallback() override; String getTypeString() const override { return getTypeStringStatic(); } const static String getTypeStringStatic() { return "Mouse"; } static MouseModule* create() { return new MouseModule(); } };
benkuper/Chataigne
Source/Module/modules/controller/mouse/MouseModule.h
C
gpl-3.0
1,391
EnduranceLogger =============== Program that is intended to help you to track your fitness progress ### Binary #### Windows Endurance Logger 1.0(binary + source): https://dl.dropboxusercontent.com/u/107033883/EnduranceLoggerSetup.exe #### Linux https://dl.dropboxusercontent.com/u/107033883/EnduranceLogger.tar.gz ### Web You can find it on Kongregate: http://www.kongregate.com/games/as3boyan/endurance-logger or MochiMedia: http://www.mochimedia.com/games/play/endurance-logger or on Google Play: https://play.google.com/store/apps/details?id=com.as3boyan.EnduranceLogger ### Build from source You can build it using FlashDevelop(Neko target). Dependencies: You will need msvcr71.dll file, which you can find in binary distribution. It needs to be located in same folder with exe. Made using Haxe/OpenFL. Licensed under GPL v3 license. If you have questions, suggestions, please tweet me @AS3Boyan. Contributions are welcome!
as3boyan/EnduranceLogger
README.md
Markdown
gpl-3.0
947
#!/usr/bin/env python3 # # Copyright (C) 2016 Canonical, Ltd. # Author: Scott Sweeny <scott.sweeny@canonical.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 3. # # 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/>. import os class Rule: def __init__(self, path): # Make sure path ends in a separator to make things easier self.path = os.path.join(path, '') def get_file_list(self): '''Return a list of files in the snap''' file_list = [] for root, dirs, files in os.walk(self.path): for f in files: file_list.append(os.path.relpath(os.path.join(root, f), self.path)) return file_list def get_dir_list(self): '''Return a list of directories in the snap''' dir_list = [] for root, dirs, files in os.walk(self.path): for d in dirs: dir_list.append(os.path.relpath(os.path.join(root, d), self.path)) return dir_list def scan(self): '''Override this method to implement your rule checking logic''' pass
ssweeny/snaplint
snaplint/_rule.py
Python
gpl-3.0
1,643
module Mudblood.Contrib.MG.Profile ( MGProfile (..) , readProfile , mkMGProfile ) where import Text.ParserCombinators.Parsec import Mudblood data MGProfile = MGProfile { profChar :: Maybe String , profPassword :: Maybe String , profLogfile :: Maybe FilePath , profMap :: Maybe FilePath } mkMGProfile = MGProfile { profChar = Nothing , profPassword = Nothing , profLogfile = Nothing , profMap = Nothing } readProfile :: String -> Either String MGProfile readProfile f = do case parse pFile "" f of Left err -> Left $ "Error reading profile: " ++ show err Right a -> Right a pFile :: Parser MGProfile pFile = do settings <- many pSetting eof return $ foldr ($) mkMGProfile settings pSetting :: Parser (MGProfile -> MGProfile) pSetting = choice [ pStringSetting "char" >>= \x -> return $ \p -> p { profChar = Just x } , pStringSetting "password" >>= \x -> return $ \p -> p { profPassword = Just x } , pStringSetting "logfile" >>= \x -> return $ \p -> p { profLogfile = Just x } , pStringSetting "map" >>= \x -> return $ \p -> p { profMap = Just x } ] pStringSetting :: String -> Parser String pStringSetting name = do string name spaces anyChar `manyTill` newline
talanis85/mudblood
src/Mudblood/Contrib/MG/Profile.hs
Haskell
gpl-3.0
1,317
using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.Security; namespace System.Threading { [ComVisibleAttribute(false)] [DebuggerDisplayAttribute("Participant Count={ParticipantCount},Participants Remaining={ParticipantsRemaining}")] public class Barrier : IDisposable { public int ParticipantsRemaining { get { throw new NotImplementedException(); } } public int ParticipantCount { get { throw new NotImplementedException(); } } public long CurrentPhaseNumber { get { throw new NotImplementedException(); } } public Barrier(int participantCount) { throw new NotImplementedException(); } public Barrier(int participantCount, Action<Barrier> postPhaseAction) { throw new NotImplementedException(); } public long AddParticipant() { throw new NotImplementedException(); } public long AddParticipants(int participantCount) { throw new NotImplementedException(); } public void RemoveParticipant() { throw new NotImplementedException(); } public void RemoveParticipants(int participantCount) { throw new NotImplementedException(); } public void SignalAndWait() { throw new NotImplementedException(); } public void SignalAndWait(CancellationToken cancellationToken) { throw new NotImplementedException(); } public bool SignalAndWait(TimeSpan timeout) { throw new NotImplementedException(); } public bool SignalAndWait(TimeSpan timeout, CancellationToken cancellationToken) { throw new NotImplementedException(); } public bool SignalAndWait(int millisecondsTimeout) { throw new NotImplementedException(); } public bool SignalAndWait(int millisecondsTimeout, CancellationToken cancellationToken) { throw new NotImplementedException(); } public void Dispose() { throw new NotImplementedException(); } protected virtual void Dispose(bool disposing) { throw new NotImplementedException(); } } }
zebraxxl/CIL2Java
StdLibs/System/System/Threading/Barrier.cs
C#
gpl-3.0
2,746
// Copyright (c) Clickberry, Inc. All rights reserved. // Licensed under the GNU GENERAL PUBLIC LICENSE Version 3. See License.txt in the project root for license information. define("datacontext", ["jquery"], function($) { return function(resourceUri) { if (!resourceUri) { throw Error("Invalid resource uri."); } function getUri(uri, id) { return id ? uri + "/" + id : uri; } this.post = function(requestData) { return $.Deferred(function(deferred) { $.ajax({ type: 'POST', url: getUri(resourceUri), data: requestData, error: function(responseData) { deferred.reject(responseData); }, success: function(responseData) { deferred.resolve(responseData); } }); }).promise(); }; this.get = function(id) { return $.Deferred(function(deferred) { $.ajax({ url: getUri(resourceUri, id), dataType: 'json', error: function(responseData) { deferred.reject(responseData); }, success: function(responseData) { deferred.resolve(responseData); } }); }).promise(); }; this.put = function(id, requestData) { return $.Deferred(function(deferred) { $.ajax({ type: 'POST', url: getUri(resourceUri, id), data: requestData, headers: { 'X-HTTP-Method-Override': "PUT" }, error: function(responseData) { deferred.reject(responseData); }, success: function(responseData) { deferred.resolve(responseData); } }); }).promise(); }; this.remove = function(id, requestData) { return $.Deferred(function(deferred) { $.ajax({ type: 'POST', url: getUri(resourceUri, id), data: requestData, headers: { 'X-HTTP-Method-Override': "DELETE" }, error: function(responseData) { deferred.reject(responseData); }, success: function(responseData) { deferred.resolve(responseData); } }); }).promise(); }; }; });
clickberry/video-portal
Source/FrontEnd/Portal.Web/Cdn/js/spa/datacontext.js
JavaScript
gpl-3.0
2,802
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * Copyright (C) 2012-2015 Marco Craveiro <marco.craveiro@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * */ #include <string> #include <ostream> #include <stdexcept> #include "masd.dogen.extraction/io/editors_io.hpp" namespace masd::dogen::extraction { std::ostream& operator<<(std::ostream& s, const editors& v) { s << "{ " << "\"__type__\": " << "\"editors\", " << "\"value\": "; std::string attr; switch (v) { case editors::invalid: attr = "\"invalid\""; break; case editors::emacs: attr = "\"emacs\""; break; case editors::vi: attr = "\"vi\""; break; case editors::vim: attr = "\"vim\""; break; case editors::ex: attr = "\"ex\""; break; default: throw std::invalid_argument("Invalid value for editors"); } s << attr << " }"; return s; } }
DomainDrivenConsulting/dogen
projects/masd.dogen.extraction/src/io/editors_io.cpp
C++
gpl-3.0
1,654
<?php /** * Kunena Component * @package Kunena.Template.Crypsis * @subpackage Layout.User * * @copyright (C) 2008 - 2015 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.kunena.org **/ defined('_JEXEC') or die; ?> <h2> <?php echo JText::_('COM_KUNENA_USER_PROFILE'); ?> <?php echo $this->escape($this->profile->getName()); ?> <?php echo $this->profile->getLink( '<i class="glyphicon glyphicon-arrow-left"></i> ' . JText::_('COM_KUNENA_BACK'), JText::_('COM_KUNENA_BACK'), 'nofollow', '', 'btn pull-right' ); ?> </h2> <form action="<?php echo KunenaRoute::_('index.php?option=com_kunena&view=user'); ?>" method="post" enctype="multipart/form-data" name="kuserform" class="form-validate" id="kuserform"> <input type="hidden" name="task" value="save" /> <input type="hidden" name="userid" value="<?php echo (int) $this->user->id; ?>" /> <?php echo JHtml::_('form.token'); ?> <div class="tabs"> <ul id="KunenaUserEdit" class="nav nav-tabs"> <li class="active"> <a href="#home" data-toggle="tab"> <?php echo JText::_('COM_KUNENA_PROFILE_EDIT_USER'); ?> </a> </li> <li> <a href="#editprofile" data-toggle="tab"> <?php echo JText::_('COM_KUNENA_PROFILE_EDIT_PROFILE'); ?> </a> </li> <li> <a href="#editavatar" data-toggle="tab"> <?php echo JText::_('COM_KUNENA_PROFILE_EDIT_AVATAR'); ?> </a> </li> <li> <a href="#editsettings" data-toggle="tab"> <?php echo JText::_('COM_KUNENA_PROFILE_EDIT_SETTINGS'); ?> </a> </li> </ul> <div id="KunenaUserEdit" class="tab-content"> <div class="tab-pane fade in active" id="home"> <?php echo $this->subRequest('User/Edit/User'); ?> </div> <div class="tab-pane fade" id="editprofile"> <?php echo $this->subRequest('User/Edit/Profile'); ?> </div> <div class="tab-pane fade" id="editavatar"> <?php echo $this->subRequest('User/Edit/Avatar'); ?> </div> <div class="tab-pane fade" id="editsettings"> <?php echo $this->subRequest('User/Edit/Settings'); ?> </div> <br /> <div class="center"> <button class="btn btn-primary validate" type="submit"> <?php echo JText::_('COM_KUNENA_SAVE'); ?> </button> <input type="button" name="cancel" class="btn" value="<?php echo (' ' . JText::_('COM_KUNENA_CANCEL') . ' '); ?>" onclick="window.history.back();" title="<?php echo (JText::_('COM_KUNENA_EDITOR_HELPLINE_CANCEL')); ?>" /> </div> </div> </div> </form>
OSTraining/Kunena-Forum
components/com_kunena/site/template/crypsisb3/layouts/user/edit/default.php
PHP
gpl-3.0
2,560
#pragma once /* This file is part of Imagine. Imagine 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. Imagine 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 Imagine. If not, see <http://www.gnu.org/licenses/> */ #include <type_traits> #include <imagine/io/IO.hh> #include <imagine/io/PosixFileIO.hh> using FileIO = PosixFileIO; #ifdef __ANDROID__ #include <imagine/io/AAssetIO.hh> using AssetIO = AAssetIO; #else using AssetIO = FileIO; #endif namespace FileUtils { AssetIO openAppAsset(const char *name, IO::AccessHint access, const char *appName); ssize_t writeToPath(const char *path, void *data, size_t size, std::error_code *ecOut = nullptr); ssize_t writeToPath(const char *path, IO &io, std::error_code *ecOut = nullptr); ssize_t readFromPath(const char *path, void *data, size_t size); }
DarkCaster/emu-ex-plus-alpha
imagine/include/imagine/io/FileIO.hh
C++
gpl-3.0
1,248
Bitrix 16.5 Business Demo = 8f171ffc9030f2723728e1ddcf02755b
gohdan/DFC
known_files/hashes/bitrix/modules/blog/install/components/bitrix/blog/templates/general_page/style.css
CSS
gpl-3.0
61
ModX Revolution 2.5.0 = 539f52dd202abe6bff3cf711e1c09993 MODX Revolution 2.2.8 = 93c2ffd8a497f42474f7b4a3e49503ca
gohdan/DFC
known_files/hashes/core/lexicon/de/filters.inc.php
PHP
gpl-3.0
114
/* * Copyright (C) 2016 Daniel Saukel * * 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 io.github.dre2n.factionscosmetics.listener; import io.github.dre2n.factionscosmetics.FactionsCosmetics; import io.github.dre2n.factionsone.api.event.FactionsReloadEvent; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; /** * @author Daniel Saukel */ public class FactionsListener implements Listener { protected static FactionsCosmetics plugin = FactionsCosmetics.getInstance(); @EventHandler public void onReload(FactionsReloadEvent event) { plugin.loadFCConfig(plugin.getFCConfig().getFile()); } }
DRE2N/FactionsCosmetics
src/main/java/io/github/dre2n/factionscosmetics/listener/FactionsListener.java
Java
gpl-3.0
1,254
#include <iostream> #include <Eigen/Dense> #include "gtest/gtest.h" #include "observability.h" TEST(ObservabilityTest, Simple) { Eigen::MatrixXd A(2, 2); Eigen::MatrixXd C(2, 2); A << 1, 1, 4, -2; C << 1, 0, 0, 1; Eigen::MatrixXd O = control::observability_matrix(A, C); Eigen::MatrixXd O_expected(4, 2); O_expected << 1, 0, 0, 1, 1, 1, 4, -2; // From Matlab. EXPECT_EQ(O, O_expected) << "Observability matrix differs: " << O_expected << std::endl << O << std::endl; }
hazelnusse/libcontrol
source/tests/test_observability.cc
C++
gpl-3.0
541
package org.halvors.nuclearphysics.common.event.handler; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.item.ItemExpireEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.halvors.nuclearphysics.common.ConfigurationManager.General; import org.halvors.nuclearphysics.common.effect.explosion.AntimatterExplosion; import org.halvors.nuclearphysics.common.init.ModItems; @EventBusSubscriber public class ItemEventHandler { @SubscribeEvent public static void onItemExpireEvent(final ItemExpireEvent event) { if (General.enableAntimatterPower) { final EntityItem entityItem = event.getEntityItem(); if (entityItem != null) { final ItemStack itemStack = entityItem.getEntityItem(); if (itemStack.getItem() == ModItems.itemAntimatterCell) { final AntimatterExplosion explosion = new AntimatterExplosion(entityItem.getEntityWorld(), entityItem, entityItem.getPosition(), 4, itemStack.getMetadata()); explosion.explode(); } } } } }
halvors/Nuclear-Physics
src/main/java/org/halvors/nuclearphysics/common/event/handler/ItemEventHandler.java
Java
gpl-3.0
1,244
package com.jeewd.web_store.security; import java.util.Collection; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; public class User implements UserDetails { private static final long serialVersionUID = -3849758589040177326L; private boolean accountNonExpired; private boolean accountNonLocked; private boolean credentialsNonExpired; private boolean enabled; private String username; private String password; private Collection<GrantedAuthority> authorities; public User(String username, String password, Collection<GrantedAuthority> authorities) { this.enabled = true; this.accountNonExpired = true; this.credentialsNonExpired = true; this.accountNonLocked = true; this.username = username; this.password = password; this.authorities = authorities; } public void setAccountNonExpired(boolean accountNonExpired) { this.accountNonExpired = accountNonExpired; } public void setAccountNonLocked(boolean accountNonLocked) { this.accountNonLocked = accountNonLocked; } public void setCredentialsNonExpired(boolean credentialsNonExpired) { this.credentialsNonExpired = credentialsNonExpired; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public void setUsername(String username) { this.username = username; } public void setPassword(String password) { this.password = password; } public void setAuthorities(Collection<GrantedAuthority> authorities) { this.authorities = authorities; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorities; } @Override public String getPassword() { return password; } @Override public String getUsername() { return username; } @Override public boolean isAccountNonExpired() { return accountNonExpired; } @Override public boolean isAccountNonLocked() { return accountNonLocked; } @Override public boolean isCredentialsNonExpired() { return credentialsNonExpired; } @Override public boolean isEnabled() { return enabled; } }
slavidlancer/JavaEEWebDevelopment
11_CourseProject_Java_Web_Development/CourseProjectWebStore/src/main/java/com/jeewd/web_store/security/User.java
Java
gpl-3.0
2,377
# -*- coding: utf-8 -*- import numpy as np import config from feature.feature_multi import FeatureMulti from similarity.similarity_base import SimiliarityBase class SimilarityStyle(SimiliarityBase): def calculate(self, image1, image2): # 获取特征 multi_feature_extractor = FeatureMulti() luminance_sample_p, mu_p, sigma_p = multi_feature_extractor.extract(image1) luminance_sample_s, mu_s, sigma_s = multi_feature_extractor.extract(image2) # 实际相似度计算 return self.__class__.calculate_inner(luminance_sample_p, luminance_sample_s, mu_p, mu_s, sigma_p, sigma_s) @classmethod def calculate_inner(cls, luminance_sample_p, luminance_sample_s, mu_p, mu_s, sigma_p, sigma_s): # 参数 lambda_l = config.style_ranking['lambda_l'] lambda_c = config.style_ranking['lambda_c'] epsilon = config.style_ranking['epsilon'] # 求亮度之间的欧式距离 de = np.power(np.linalg.norm(luminance_sample_p - luminance_sample_s, 2), 2) # 求色彩之间的距离 mu = np.matrix(np.abs(mu_p - mu_s) + epsilon).T sigma = np.matrix((sigma_p + sigma_s) / 2) dh_1 = np.power(np.linalg.norm(sigma_s.dot(sigma_p), 1), 1 / 4) / (np.power(np.linalg.norm(sigma, 1), 1 / 2)) dh_2 = (-1 / 8) * mu.T * np.linalg.inv(sigma) * mu dh = 1 - dh_1 * np.exp(dh_2) ans = np.exp(-de / lambda_l) * np.exp(-np.power(dh, 2) / lambda_c) # 因为ans是一个 1x1 Matrix,所以必须弄成一个值 return np.max(ans)
jinyu121/ACACTS
similarity/similarity_style.py
Python
gpl-3.0
1,581
/* * SLD Editor - The Open Source Java SLD Editor * * Copyright (C) 2018, SCISYS UK Limited * * 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.sldeditor.test.unit.tool.batchupdatefont; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import com.sldeditor.common.LoadSLDInterface; import com.sldeditor.common.SLDDataInterface; import com.sldeditor.common.SLDEditorInterface; import com.sldeditor.common.data.SLDUtils; import com.sldeditor.test.unit.datasource.impl.DummyInternalSLDFile3; import com.sldeditor.tool.batchupdatefont.BatchUpdateFontPanel; import java.awt.GraphicsEnvironment; import java.net.URL; import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; import org.geotools.factory.CommonFactoryFinder; import org.geotools.styling.Font; import org.geotools.styling.NamedLayer; import org.geotools.styling.StyleFactoryImpl; import org.geotools.styling.StyledLayerDescriptor; import org.geotools.styling.TextSymbolizer; import org.junit.jupiter.api.Test; import org.opengis.filter.FilterFactory; /** * The unit test for BatchUpdateFontData. * * <p>{@link com.sldeditor.tool.batchupdatefont.BatchUpdateFontPanel} * * @author Robert Ward (SCISYS) */ class BatchUpdateFontPanelTest { class TestBatchUpdateFontPanel extends BatchUpdateFontPanel { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1L; /** * Instantiates a new test batch update font panel. * * @param application the application */ public TestBatchUpdateFontPanel(SLDEditorInterface application) { super(application); } public void testApplyData() { applyData(); } /** Save data. */ public void testSaveData() { saveData(); } /** * Sets the selected option to update font, used for testing. * * @param font the new update font */ public void setUpdateFont(Font font) { super.setUpdateFont(font); } /** * Sets the selected option to update font size, used for testing. * * @param font the new update font size */ public void setUpdateFontSize(Font font) { super.setUpdateFontSize(font); } } class TestSLDEditorInterface implements SLDEditorInterface { public SLDDataInterface savedSldData = null; public Class<?> savedParent = null; public Class<?> savedPanelClass = null; /* * (non-Javadoc) * * @see com.sldeditor.common.SLDEditorInterface#getAppPanel() */ @Override public JPanel getAppPanel() { return null; } /* * (non-Javadoc) * * @see com.sldeditor.common.SLDEditorInterface#updateWindowTitle(boolean) */ @Override public void updateWindowTitle(boolean dataEditedFlag) {} /* * (non-Javadoc) * * @see com.sldeditor.common.SLDEditorInterface#chooseNewSLD() */ @Override public void chooseNewSLD() {} /* * (non-Javadoc) * * @see com.sldeditor.common.SLDEditorInterface#exitApplication() */ @Override public void exitApplication() {} /* * (non-Javadoc) * * @see com.sldeditor.common.SLDEditorInterface#saveFile(java.net.URL) */ @Override public void saveFile(URL url) {} /* * (non-Javadoc) * * @see com.sldeditor.common.SLDEditorInterface#saveSLDData(com.sldeditor.common. * SLDDataInterface) */ @Override public void saveSLDData(SLDDataInterface sldData) { savedSldData = sldData; } /* * (non-Javadoc) * * @see com.sldeditor.common.SLDEditorInterface#getLoadSLDInterface() */ @Override public LoadSLDInterface getLoadSLDInterface() { return null; } /* * (non-Javadoc) * * @see com.sldeditor.common.SLDEditorInterface#openFile(java.net.URL) */ @Override public void openFile(URL selectedURL) {} /* * (non-Javadoc) * * @see com.sldeditor.common.SLDEditorInterface#refreshPanel(java.lang.Class, * java.lang.Class) */ @Override public void refreshPanel(Class<?> parent, Class<?> panelClass) { savedParent = parent; savedPanelClass = panelClass; } } /** * Test method for {@link * com.sldeditor.tool.batchupdatefont.BatchUpdateFontPanel#populate(java.util.List)}. */ @Test void testPopulateUpdateFontSize() { TestSLDEditorInterface app = new TestSLDEditorInterface(); TestBatchUpdateFontPanel testObj = new TestBatchUpdateFontPanel(app); List<SLDDataInterface> sldDataList = new ArrayList<SLDDataInterface>(); DummyInternalSLDFile3 dummy = new DummyInternalSLDFile3(); sldDataList.add(dummy.getSLDData()); Double originalFontSize = getFontSize(dummy.getSLDData()); testObj.populate(sldDataList); testObj.testSaveData(); assertNull(app.savedParent); Double expectedFontSizeIncrease = 24.0; StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory(); FilterFactory ff = CommonFactoryFinder.getFilterFactory(); String originalFontname = "Serif"; String originalFontStyle = "normal"; String originalFontWeight = "normal"; Font expectedFont = styleFactory.createFont( ff.literal(originalFontname), ff.literal(originalFontStyle), ff.literal(originalFontWeight), ff.literal(expectedFontSizeIncrease)); testObj.setUpdateFontSize(expectedFont); testObj.testApplyData(); testObj.testSaveData(); Double actualFontSize = getFontSize(app.savedSldData); Double expectedFontSize = originalFontSize + expectedFontSizeIncrease; assertEquals(actualFontSize.doubleValue(), expectedFontSize.doubleValue()); } /** * Test method for {@link * com.sldeditor.tool.batchupdatefont.BatchUpdateFontPanel#populate(java.util.List)}. */ @Test void testPopulateUpdateFontData() { TestSLDEditorInterface app = new TestSLDEditorInterface(); TestBatchUpdateFontPanel testObj = new TestBatchUpdateFontPanel(app); List<SLDDataInterface> sldDataList = new ArrayList<SLDDataInterface>(); DummyInternalSLDFile3 dummy = new DummyInternalSLDFile3(); sldDataList.add(dummy.getSLDData()); testObj.populate(sldDataList); testObj.testSaveData(); assertNull(app.savedParent); Double expectedFontSizeIncrease = 24.0; StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory(); FilterFactory ff = CommonFactoryFinder.getFilterFactory(); String[] families = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); String originalFontname = families[0]; String originalFontStyle = "normal"; String originalFontWeight = "normal"; Font expectedFont = styleFactory.createFont( ff.literal(originalFontname), ff.literal(originalFontStyle), ff.literal(originalFontWeight), ff.literal(expectedFontSizeIncrease)); testObj.setUpdateFont(expectedFont); testObj.testApplyData(); testObj.testSaveData(); assertEquals(originalFontname, getFontName(app.savedSldData)); } private Double getFontSize(SLDDataInterface sldData) { StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData); NamedLayer namedLayer = (NamedLayer) sld.layers().get(0); TextSymbolizer text = (TextSymbolizer) namedLayer .styles() .get(0) .featureTypeStyles() .get(0) .rules() .get(0) .symbolizers() .get(2); return Double.valueOf(text.getFont().getSize().toString()); } private String getFontName(SLDDataInterface sldData) { StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData); NamedLayer namedLayer = (NamedLayer) sld.layers().get(0); TextSymbolizer text = (TextSymbolizer) namedLayer .styles() .get(0) .featureTypeStyles() .get(0) .rules() .get(0) .symbolizers() .get(2); return text.getFont().getFamily().get(0).toString(); } }
robward-scisys/sldeditor
modules/application/src/test/java/com/sldeditor/test/unit/tool/batchupdatefont/BatchUpdateFontPanelTest.java
Java
gpl-3.0
10,111
// ***************************************************************************** // randpool.cpp Tao3D project // ***************************************************************************** // // File description: // // // // // // // // // ***************************************************************************** // This software is licensed under the GNU General Public License v3 // (C) 2019, Christophe de Dinechin <christophe@dinechin.org> // (C) 2011, Jérôme Forissier <jerome@taodyne.com> // ***************************************************************************** // This file is part of Tao3D // // Tao3D is free software: you can r 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. // // Tao3D 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 Tao3D, in a file named COPYING. // If not, see <https://www.gnu.org/licenses/>. // ***************************************************************************** // randpool.cpp - written and placed in the public domain by Wei Dai // RandomPool used to follow the design of randpool in PGP 2.6.x, // but as of version 5.5 it has been redesigned to reduce the risk // of reusing random numbers after state rollback (which may occur // when running in a virtual machine like VMware). #include "pch.h" #ifndef CRYPTOPP_IMPORTS #include "randpool.h" #include "aes.h" #include "sha.h" #include "hrtimer.h" #include <time.h> NAMESPACE_BEGIN(CryptoPP) RandomPool::RandomPool() : m_pCipher(new AES::Encryption), m_keySet(false) { memset(m_key, 0, m_key.SizeInBytes()); memset(m_seed, 0, m_seed.SizeInBytes()); } void RandomPool::IncorporateEntropy(const byte *input, size_t length) { SHA256 hash; hash.Update(m_key, 32); hash.Update(input, length); hash.Final(m_key); m_keySet = false; } void RandomPool::GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size) { if (size > 0) { if (!m_keySet) m_pCipher->SetKey(m_key, 32); Timer timer; TimerWord tw = timer.GetCurrentTimerValue(); CRYPTOPP_COMPILE_ASSERT(sizeof(tw) <= 16); *(TimerWord *)m_seed.data() += tw; time_t t = time(NULL); CRYPTOPP_COMPILE_ASSERT(sizeof(t) <= 8); *(time_t *)(m_seed.data()+8) += t; do { m_pCipher->ProcessBlock(m_seed); size_t len = UnsignedMin(16, size); target.ChannelPut(channel, m_seed, len); size -= len; } while (size > 0); } } NAMESPACE_END #endif
c3d/tao-3D
libcryptopp/cryptopp/randpool.cpp
C++
gpl-3.0
2,879
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr> // Copyright (C) 2010,2012 Jitse Niesen <jitse@maths.leeds.ac.uk> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include <limits> #include <Eigen/Eigenvalues> template<typename MatrixType> void eigensolver(const MatrixType& m) { typedef typename MatrixType::Index Index; /* this test covers the following files: EigenSolver.h */ Index rows = m.rows(); Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; typedef Matrix<RealScalar, MatrixType::RowsAtCompileTime, 1> RealVectorType; typedef typename std::complex<typename NumTraits<typename MatrixType::Scalar>::Real> Complex; MatrixType a = MatrixType::Random(rows,cols); MatrixType a1 = MatrixType::Random(rows,cols); MatrixType symmA = a.adjoint() * a + a1.adjoint() * a1; EigenSolver<MatrixType> ei0(symmA); VERIFY_IS_EQUAL(ei0.info(), Success); VERIFY_IS_APPROX(symmA * ei0.pseudoEigenvectors(), ei0.pseudoEigenvectors() * ei0.pseudoEigenvalueMatrix()); VERIFY_IS_APPROX((symmA.template cast<Complex>()) * (ei0.pseudoEigenvectors().template cast<Complex>()), (ei0.pseudoEigenvectors().template cast<Complex>()) * (ei0.eigenvalues().asDiagonal())); EigenSolver<MatrixType> ei1(a); VERIFY_IS_EQUAL(ei1.info(), Success); VERIFY_IS_APPROX(a * ei1.pseudoEigenvectors(), ei1.pseudoEigenvectors() * ei1.pseudoEigenvalueMatrix()); VERIFY_IS_APPROX(a.template cast<Complex>() * ei1.eigenvectors(), ei1.eigenvectors() * ei1.eigenvalues().asDiagonal()); VERIFY_IS_APPROX(ei1.eigenvectors().colwise().norm(), RealVectorType::Ones(rows).transpose()); VERIFY_IS_APPROX(a.eigenvalues(), ei1.eigenvalues()); EigenSolver<MatrixType> ei2; ei2.setMaxIterations(RealSchur<MatrixType>::m_maxIterationsPerRow * rows).compute(a); VERIFY_IS_EQUAL(ei2.info(), Success); VERIFY_IS_EQUAL(ei2.eigenvectors(), ei1.eigenvectors()); VERIFY_IS_EQUAL(ei2.eigenvalues(), ei1.eigenvalues()); if (rows > 2) { ei2.setMaxIterations(1).compute(a); VERIFY_IS_EQUAL(ei2.info(), NoConvergence); VERIFY_IS_EQUAL(ei2.getMaxIterations(), 1); } EigenSolver<MatrixType> eiNoEivecs(a, false); VERIFY_IS_EQUAL(eiNoEivecs.info(), Success); VERIFY_IS_APPROX(ei1.eigenvalues(), eiNoEivecs.eigenvalues()); VERIFY_IS_APPROX(ei1.pseudoEigenvalueMatrix(), eiNoEivecs.pseudoEigenvalueMatrix()); MatrixType id = MatrixType::Identity(rows, cols); VERIFY_IS_APPROX(id.operatorNorm(), RealScalar(1)); if (rows > 2) { // Test matrix with NaN a(0,0) = std::numeric_limits<typename MatrixType::RealScalar>::quiet_NaN(); EigenSolver<MatrixType> eiNaN(a); VERIFY_IS_EQUAL(eiNaN.info(), NoConvergence); } } template<typename MatrixType> void eigensolver_verify_assert(const MatrixType& m) { EigenSolver<MatrixType> eig; VERIFY_RAISES_ASSERT(eig.eigenvectors()); VERIFY_RAISES_ASSERT(eig.pseudoEigenvectors()); VERIFY_RAISES_ASSERT(eig.pseudoEigenvalueMatrix()); VERIFY_RAISES_ASSERT(eig.eigenvalues()); MatrixType a = MatrixType::Random(m.rows(),m.cols()); eig.compute(a, false); VERIFY_RAISES_ASSERT(eig.eigenvectors()); VERIFY_RAISES_ASSERT(eig.pseudoEigenvectors()); } void test_eigensolver_generic() { int s; for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( eigensolver(Matrix4f()) ); s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4); CALL_SUBTEST_2( eigensolver(MatrixXd(s,s)) ); // some trivial but implementation-wise tricky cases CALL_SUBTEST_2( eigensolver(MatrixXd(1,1)) ); CALL_SUBTEST_2( eigensolver(MatrixXd(2,2)) ); CALL_SUBTEST_3( eigensolver(Matrix<double,1,1>()) ); CALL_SUBTEST_4( eigensolver(Matrix2d()) ); } CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4f()) ); s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4); CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXd(s,s)) ); CALL_SUBTEST_3( eigensolver_verify_assert(Matrix<double,1,1>()) ); CALL_SUBTEST_4( eigensolver_verify_assert(Matrix2d()) ); // Test problem size constructors CALL_SUBTEST_5(EigenSolver<MatrixXf>(s)); // regression test for bug 410 CALL_SUBTEST_2( { MatrixXd A(1,1); A(0,0) = std::sqrt(-1.); Eigen::EigenSolver<MatrixXd> solver(A); MatrixXd V(1, 1); V(0,0) = solver.eigenvectors()(0,0).real(); } ); EIGEN_UNUSED_VARIABLE(s) }
anders-dc/cppfem
eigen/test/eigensolver_generic.cpp
C++
gpl-3.0
4,745
#!/usr/bin/env python3 """ Copyright 2020 Paul Willworth <ioscode@gmail.com> This file is part of Galaxy Harvester. Galaxy Harvester is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Galaxy Harvester 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Galaxy Harvester. If not, see <http://www.gnu.org/licenses/>. """ import os import sys import dbSession import pymysql import cgi from http import cookies import ghShared import ghLists import dbShared # form = cgi.FieldStorage() C = cookies.SimpleCookie() errorstr = '' try: C.load(os.environ['HTTP_COOKIE']) except KeyError: errorstr = 'no cookies\n' if errorstr == '': try: currentUser = C['userID'].value except KeyError: currentUser = '' try: sid = C['gh_sid'].value except KeyError: sid = form.getfirst('gh_sid', '') else: currentUser = '' sid = form.getfirst('gh_sid', '') # Get a session logged_state = 0 sess = dbSession.getSession(sid) if (sess != ''): logged_state = 1 currentUser = sess groupType = form.getfirst('groupType', '') profession = form.getfirst('profession', '') craftingTab = form.getfirst('craftingTab', '') resType = form.getfirst('resType', '') resSecondary = form.getfirst('resSecondary', '') resGroup = form.getfirst('resGroup', '') selectSchematic = form.getfirst('selectSchematic', '') listFormat = form.getfirst('listFormat', 'list') galaxy = form.getfirst('galaxy', '') # escape input to prevent sql injection groupType = dbShared.dbInsertSafe(groupType) profession = dbShared.dbInsertSafe(profession) craftingTab = dbShared.dbInsertSafe(craftingTab) resType = dbShared.dbInsertSafe(resType) resSecondary = dbShared.dbInsertSafe(resSecondary) resGroup = dbShared.dbInsertSafe(resGroup) selectSchematic = dbShared.dbInsertSafe(selectSchematic) listFormat = dbShared.dbInsertSafe(listFormat) # groupType determines the filtering method for narrowing down schematic list filterStr = '' joinStr = '' if (groupType == 'prof'): if (profession.isdigit()): filterStr = ' WHERE tSkillGroup.profID = ' + str(profession) elif (groupType == 'tab'): if (craftingTab.isdigit()): filterStr = ' WHERE tSchematic.craftingTab = ' + str(craftingTab) elif (groupType == 'res'): if (resGroup != '' and resGroup != None): if resSecondary == '1': joinStr = ' INNER JOIN (SELECT resourceType FROM tResourceTypeGroup WHERE resourceGroup="' + resGroup + '") rtg ON ingredientObject = rtg.resourceType' else: filterStr = ' WHERE ingredientObject = "' + resGroup + '"' else: if resSecondary == '1': filterStr = ' WHERE ingredientObject IN (SELECT tResourceTypeGroup.resourceGroup FROM tResourceTypeGroup INNER JOIN tResourceGroup ON tResourceTypeGroup.resourceGroup=tResourceGroup.resourceGroup WHERE resourceType="' + resType + '" AND groupLevel=(SELECT Max(rg.groupLevel) FROM tResourceTypeGroup rtg INNER JOIN tResourceGroup rg ON rtg.resourceGroup = rg.resourceGroup WHERE rtg.resourceType="' + resType + '") GROUP BY tResourceTypeGroup.resourceGroup)' joinStr = ' INNER JOIN (SELECT tResourceTypeGroup.resourceGroup FROM tResourceTypeGroup INNER JOIN tResourceGroup ON tResourceTypeGroup.resourceGroup=tResourceGroup.resourceGroup WHERE resourceType="' + resType + '" AND groupLevel=(SELECT Max(rg.groupLevel) FROM tResourceTypeGroup rtg INNER JOIN tResourceGroup rg ON rtg.resourceGroup = rg.resourceGroup WHERE rtg.resourceType="' + resType + '") GROUP BY tResourceTypeGroup.resourceGroup) rtgg ON ingredientObject = rtgg.resourceGroup' else: filterStr = ' WHERE ingredientObject = "' + resType + '"' elif (groupType == 'favorite'): filterStr = ' WHERE tFavorites.userID = "' + currentUser + '" AND favType = 4' joinStr = ' INNER JOIN tFavorites ON tSchematic.schematicID = tFavorites.favGroup' conn = dbShared.ghConn() # Some schematics are custom entered per galaxy but those with galaxyID 0 are for all if galaxy.isdigit(): baseProfs = '0, 1337' checkCursor = conn.cursor() if (checkCursor): checkCursor.execute('SELECT galaxyNGE FROM tGalaxy WHERE galaxyID={0};'.format(str(galaxy))) checkRow = checkCursor.fetchone() if (checkRow != None) and (checkRow[0] > 0): baseProfs = '-1, 1337' checkCursor.close() filterStr = filterStr + ' AND tSchematic.galaxy IN ({1}, {0}) AND tSchematic.schematicID NOT IN (SELECT schematicID FROM tSchematicOverrides WHERE galaxyID={0})'.format(galaxy, baseProfs) # We output an unordered list or a bunch of select element options depending on listFormat currentGroup = '' currentIngredient = '' print('Content-type: text/html\n') if listFormat != 'option': print(' <ul class="schematics">') cursor = conn.cursor() if (cursor): if (groupType == 'tab' or groupType == 'favorite'): sqlStr1 = 'SELECT schematicID, tSchematic.craftingTab, typeName, schematicName FROM tSchematic INNER JOIN tObjectType ON tSchematic.objectType = tObjectType.objectType' + joinStr + filterStr + ' ORDER BY craftingTab, typeName, schematicName' elif (groupType == 'res'): sqlStr1 = 'SELECT DISTINCT tSchematic.schematicID, tSchematic.craftingTab, typeName, schematicName, ingredientObject, res.resName FROM tSchematic INNER JOIN tObjectType ON tSchematic.objectType = tObjectType.objectType INNER JOIN tSchematicIngredients ON tSchematic.schematicID = tSchematicIngredients.schematicID' + joinStr + ' LEFT JOIN (SELECT resourceGroup AS resID, groupName AS resName FROM tResourceGroup UNION ALL SELECT resourceType, resourceTypeName FROM tResourceType) res ON ingredientObject = res.resID' + filterStr + ' ORDER BY res.resName, craftingTab, typeName, schematicName' else: sqlStr1 = 'SELECT schematicID, profName, skillGroupName, schematicName FROM tSchematic INNER JOIN tSkillGroup ON tSchematic.skillGroup = tSkillGroup.skillGroup LEFT JOIN tProfession ON tSkillGroup.profID = tProfession.profID' + joinStr + filterStr if listFormat == 'option': sqlStr1 += ' ORDER BY schematicName' else: sqlStr1 += ' ORDER BY profName, skillGroupName, schematicName' cursor.execute(sqlStr1) row = cursor.fetchone() if (row == None): print(' <li><h3>No Schematics Found</h3></li>') while (row != None): if listFormat == 'option': print('<option value="' + row[0] + '">' + row[3] + '</option>') else: if (groupType == 'res'): if (currentIngredient != row[5]): print(' </ul>') print(' <div style="margin-top:14px;"><a class="bigLink" href="' + ghShared.BASE_SCRIPT_URL + 'resourceType.py/' + str(row[4]) + '">' + str(row[5]) + '</a></div>') print(' <ul class="schematics">') currentIngredient = row[5] currentGroup = '' if (currentGroup != row[2]): print(' <li><h3>' + row[2] + '</h3></li>') currentGroup = row[2] if row[0] == selectSchematic: print(' <li class="listSelected"><a href="' + ghShared.BASE_SCRIPT_URL + 'schematics.py/' + row[0] + '">' + row[3] + '</a></li>') else: print(' <li><a href="' + ghShared.BASE_SCRIPT_URL + 'schematics.py/' + row[0] + '">' + row[3] + '</a></li>') row = cursor.fetchone() cursor.close() conn.close() if listFormat != 'option': print(' </ul>')
pwillworth/galaxyharvester
html/getSchematicList.py
Python
gpl-3.0
7,494
#include "mounter.h" #include "manager.h" #include <iostream> #include <QStringList> #include <QDir> #include <QDebug> #include <QQueue> class MounterItem { public: MounterItem( const QString & f , const QString & m ) { file = f ; mount_point = m; } QString file; QString mount_point; }; class MounterPrivate { public: QProcess *process; QString command; QQueue<MounterItem> queue; }; Mounter::Mounter(QObject *parent) : QObject(parent) { p = new MounterPrivate; p->process = new QProcess( this ); p->command = "mount"; connect( p->process , SIGNAL(finished(int,QProcess::ExitStatus)) , SLOT(finished(int,QProcess::ExitStatus)) , Qt::QueuedConnection ); } void Mounter::mount( const QString & file , const QString & mount_point ) { p->queue.enqueue( MounterItem( file , mount_point ) ); if( p->queue.count() == 1 ) mount_prev( file , mount_point ); Manager::increase(); } void Mounter::mount_prev( const QString & file , const QString & mount_point ) { QDir dir( mount_point ); dir.mkpath( mount_point ); QStringList arguments; arguments << "-o"; arguments << "loop"; arguments << file; arguments << mount_point; p->process->start( p->command , arguments ); } void Mounter::finished( int exit_code , QProcess::ExitStatus state ) { p->queue.dequeue(); if( !p->queue.isEmpty() ) { const MounterItem & item = p->queue.dequeue(); mount_prev( item.file , item.mount_point ); } if( state == QProcess::CrashExit ) { qDebug() << "The mount process has unexpectedly finished."; Manager::decrease(); return; } if( exit_code == 0 ) { Manager::decrease(); return; } if( exit_code & 1 ) qDebug() << "Incorrect invocation or permissions."; if( exit_code & 2 ) qDebug() << "System error (out of memory, cannot fork, no more loop devices)."; if( exit_code & 4 ) qDebug() << "Internal mount bug."; if( exit_code & 8 ) qDebug() << "User interrupt."; if( exit_code & 16 ) qDebug() << "Problems writing or locking /etc/mtab ."; if( exit_code & 32 ) qDebug() << "Mount failure."; if( exit_code & 64 ) qDebug() << "Some mount succeeded."; Manager::decrease(); } Mounter::~Mounter() { delete p; }
realbardia/silicon
SPlugins/RootMount/Binary/mounter.cpp
C++
gpl-3.0
2,378
/*---------------------------------------------------------------------------*\ * interactive networked Virtual Reality system (inVRs) * * * * Copyright (C) 2005-2009 by the Johannes Kepler University, Linz * * * * www.inVRs.org * * * * contact: canthes@inVRs.org, rlander@inVRs.org * \*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*\ * License * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Library General Public License as published * * by the Free Software Foundation, version 2. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Library General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \*---------------------------------------------------------------------------*/ #include "AllInOneTranslationModel.h" #include <inVRs/SystemCore/ArgumentVector.h> #include <inVRs/SystemCore/DebugOutput.h> AllInOneTranslationModel::AllInOneTranslationModel(unsigned upDownIdx, unsigned speedIdx, float forBackSpeed, float upDownSpeed) { this->upDownIdx = upDownIdx; this->speedIdx = speedIdx; this->upDownSpeed = upDownSpeed; this->forBackSpeed = forBackSpeed; } void AllInOneTranslationModel::getTranslation(ControllerInterface* controller, const gmtl::Quatf& rotationChange, gmtl::Vec3f& result, float dt) { gmtl::Vec3f temp; gmtl::Vec3f frontBackDir = gmtl::Vec3f(0, 0, 1); gmtl::Vec3f upDownDir = gmtl::Vec3f(0, 1, 0); result = gmtl::Vec3f(0, 0, 0); if(controller->getNumberOfAxes() <= (int)speedIdx) return; result += frontBackDir*controller->getAxisValue(speedIdx)*forBackSpeed; if(controller->getNumberOfAxes() <= (int)upDownIdx) return; result += upDownDir*controller->getAxisValue(upDownIdx)*upDownSpeed; } AllInOneTranslationModelFactory::~AllInOneTranslationModelFactory() { } TranslationModel* AllInOneTranslationModelFactory::create( std::string className, ArgumentVector* args) { if (className != "AllInOneTranslationModel") { return NULL; } unsigned upDownIdx = 0; unsigned speedIdx = 1; float upDownSpeed = 1; float forBackSpeed = 1; if (args && args->keyExists("upDownIdx")) args->get("upDownIdx", upDownIdx); else printd(WARNING, "AllInOneTranslationModelFactory::create(): WARNING: missing attribute upDownIdx, assuming default!\n"); if (args && args->keyExists("speedIdx")) args->get("speedIdx", speedIdx); else printd(WARNING, "AllInOneTranslationModelFactory::create(): WARNING: missing attribute speedIdx, assuming default!\n"); if (args && args->keyExists("upDownSpeed")) args->get("upDownSpeed", upDownSpeed); else printd(WARNING, "AllInOneTranslationModelFactory::create(): WARNING: missing attribute upDownSpeed, assuming default!\n"); if (args && args->keyExists("forBackSpeed")) args->get("forBackSpeed", forBackSpeed); else printd(WARNING, "AllInOneTranslationModelFactory::create(): WARNING: missing attribute forBackSpeed, assuming default!\n"); return new AllInOneTranslationModel(upDownIdx, speedIdx, forBackSpeed, upDownSpeed); }
jzarl/inVRs
src/inVRs/Modules/Navigation/AllInOneTranslationModel.cpp
C++
gpl-3.0
4,248
#!/usr/bin/env python # -*- coding: utf-8 -*- # -*- Python -*- """ @file outTemp.py @brief ModuleDescription @date $Date$ """ import sys import time sys.path.append(".") # Import RTM module import RTC import OpenRTM_aist # Import Service implementation class # <rtc-template block="service_impl"> # </rtc-template> # Import Service stub modules # <rtc-template block="consumer_import"> # </rtc-template> # This module's spesification # <rtc-template block="module_spec"> outtemp_spec = ["implementation_id", "outTemp", "type_name", "outTemp", "description", "ModuleDescription", "version", "1.0.0", "vendor", "VenderName", "category", "Category", "activity_type", "STATIC", "max_instance", "1", "language", "Python", "lang_type", "SCRIPT", ""] # </rtc-template> ## # @class outTemp # @brief ModuleDescription # # get original temperature and output by celius. # # class outTemp(OpenRTM_aist.DataFlowComponentBase): ## # @brief constructor # @param manager Maneger Object # def __init__(self, manager): OpenRTM_aist.DataFlowComponentBase.__init__(self, manager) origin_Temp_arg = [None] * ((len(RTC._d_TimedDouble) - 4) / 2) self._d_origin_Temp = RTC.TimedDouble(*origin_Temp_arg) """ """ self._origin_TempIn = OpenRTM_aist.InPort("origin_Temp", self._d_origin_Temp,OpenRTM_aist.RingBuffer(1)) # initialize of configuration-data. # <rtc-template block="init_conf_param"> # </rtc-template> ## # # The initialize action (on CREATED->ALIVE transition) # formaer rtc_init_entry() # # @return RTC::ReturnCode_t # # def onInitialize(self): # Bind variables and configuration variabl print "onInitialize" print # Set InPort buffers self.addInPort("origin_Temp",self._origin_TempIn) # Set OutPort buffers # Set service provider to Ports # Set service consumers to Ports # Set CORBA Service Ports return RTC.RTC_OK # ## # # # # The finalize action (on ALIVE->END transition) # # formaer rtc_exiting_entry() # # # # @return RTC::ReturnCode_t # # # #def onFinalize(self): # # return RTC.RTC_OK # ## # # # # The startup action when ExecutionContext startup # # former rtc_starting_entry() # # # # @param ec_id target ExecutionContext Id # # # # @return RTC::ReturnCode_t # # # # #def onStartup(self, ec_id): # # return RTC.RTC_OK # ## # # # # The shutdown action when ExecutionContext stop # # former rtc_stopping_entry() # # # # @param ec_id target ExecutionContext Id # # # # @return RTC::ReturnCode_t # # # # #def onShutdown(self, ec_id): # # return RTC.RTC_OK # ## # # # # The activated action (Active state entry action) # # former rtc_active_entry() # # # # @param ec_id target ExecutionContext Id # # # # @return RTC::ReturnCode_t # # # # #def onActivated(self, ec_id): # # return RTC.RTC_OK # ## # # # # The deactivated action (Active state exit action) # # former rtc_active_exit() # # # # @param ec_id target ExecutionContext Id # # # # @return RTC::ReturnCode_t # # # # #def onDeactivated(self, ec_id): # # return RTC.RTC_OK ## # # The execution action that is invoked periodically # former rtc_active_do() # # @param ec_id target ExecutionContext Id # # @return RTC::ReturnCode_t # # def onExecute(self, ec_id): self._origin_TempIn.read() # if(self._origin_TempIn.isNew()): self._d_origin_Temp = self._origin_TempIn.read() temp = self._d_origin_Temp.data #print "Temp: %4.2lf" % self._d_origin_Temp.data #print self._d_origin_Temp.data print temp #else: # print "no new data" time.sleep(5) return RTC.RTC_OK # ## # # # # The aborting action when main logic error occurred. # # former rtc_aborting_entry() # # # # @param ec_id target ExecutionContext Id # # # # @return RTC::ReturnCode_t # # # # #def onAborting(self, ec_id): # # return RTC.RTC_OK # ## # # # # The error action in ERROR state # # former rtc_error_do() # # # # @param ec_id target ExecutionContext Id # # # # @return RTC::ReturnCode_t # # # # #def onError(self, ec_id): # # return RTC.RTC_OK # ## # # # # The reset action that is invoked resetting # # This is same but different the former rtc_init_entry() # # # # @param ec_id target ExecutionContext Id # # # # @return RTC::ReturnCode_t # # # # #def onReset(self, ec_id): # # return RTC.RTC_OK # ## # # # # The state update action that is invoked after onExecute() action # # no corresponding operation exists in OpenRTm-aist-0.2.0 # # # # @param ec_id target ExecutionContext Id # # # # @return RTC::ReturnCode_t # # # # #def onStateUpdate(self, ec_id): # # return RTC.RTC_OK # ## # # # # The action that is invoked when execution context's rate is changed # # no corresponding operation exists in OpenRTm-aist-0.2.0 # # # # @param ec_id target ExecutionContext Id # # # # @return RTC::ReturnCode_t # # # # #def onRateChanged(self, ec_id): # # return RTC.RTC_OK def outTempInit(manager): profile = OpenRTM_aist.Properties(defaults_str=outtemp_spec) manager.registerFactory(profile, outTemp, OpenRTM_aist.Delete) def MyModuleInit(manager): outTempInit(manager) # Create a component comp = manager.createComponent("outTemp") def main(): mgr = OpenRTM_aist.Manager.init(sys.argv) mgr.setModuleInitProc(MyModuleInit) mgr.activateManager() mgr.runManager() if __name__ == "__main__": main()
max-koara/OutTemp
outTemp.py
Python
gpl-3.0
5,559
# Paperwork - Using OCR to grep dead trees the easy way # Copyright (C) 2014 Jerome Flesch # # Paperwork 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. # # Paperwork 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 Paperwork. If not, see <http://www.gnu.org/licenses/>. import os import logging from gi.repository import Gdk from gi.repository import GdkPixbuf from gi.repository import Gtk from paperwork.backend.labels import Label from paperwork.frontend.util import load_uifile from paperwork.frontend.util.actions import SimpleAction logger = logging.getLogger(__name__) DROPPER_BITS = ( "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377\377" "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\377" "\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377" "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377" "\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0" "\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\377\0\0\0\377\0" "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377" "\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0" "\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\377\0\0\0\377\0\0" "\0\377\0\0\0\377\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377" "\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\377\377" "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377" "\0\0\0\377\377\377\377\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377" "\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\0\0\0\0\0\377\377" "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0" "\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377\377" "\377\377\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\377" "\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377\0\0" "\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\377\0\0\0" "\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ) DROPPER_WIDTH = 17 DROPPER_HEIGHT = 17 DROPPER_X_HOT = 2 DROPPER_Y_HOT = 16 class PickColorAction(SimpleAction): """ Hack taken from libgtk3/gtk/deprecated/gtkcolorsel.c """ def __init__(self, label_editor): super(PickColorAction, self).__init__("Pick color") self.__editor = label_editor self.__dropper_grab_widget = None self.__grab_time = None self.__has_grab = False self.__pointer_device = None def do(self): self._get_screen_color() def _make_picker_cursor(self, display): # XXX(Jflesch) ... do not work try: return Gdk.Cursor.new_from_name(display, "color-picker") except TypeError: pass try: # happens when new_from_name returns NULL at C level pixbuf = GdkPixbuf.Pixbuf.new_from_data( DROPPER_BITS, GdkPixbuf.Colorspace.RGB, True, 8, DROPPER_WIDTH, DROPPER_HEIGHT, DROPPER_WIDTH * 4 ) cursor = Gdk.Cursor.new_from_pixbuf(display, pixbuf, DROPPER_X_HOT, DROPPER_Y_HOT) return cursor except TypeError: pass return None def _get_screen_color(self): time = Gtk.get_current_event_time() screen = self.__editor._pick_button.get_screen() display = self.__editor._pick_button.get_display() # XXX(JFlesch): Assumption: mouse is used pointer_device = Gtk.get_current_event_device() if not self.__dropper_grab_widget: self.__dropper_grab_widget = Gtk.Window.new(Gtk.WindowType.POPUP) self.__dropper_grab_widget.set_screen(screen) self.__dropper_grab_widget.resize(1, 1) self.__dropper_grab_widget.move(-100, -100) self.__dropper_grab_widget.show() self.__dropper_grab_widget.add_events( Gdk.EventMask.BUTTON_RELEASE_MASK ) toplevel = self.__editor._pick_button.get_toplevel() if isinstance(toplevel, Gtk.Window): if toplevel.has_group(): toplevel.get_group().add_window(self.__dropper_grab_widget) window = self.__dropper_grab_widget.get_window() picker_cursor = self._make_picker_cursor(display) if (pointer_device.grab( window, Gdk.GrabOwnership.APPLICATION, False, Gdk.EventMask.BUTTON_RELEASE_MASK, picker_cursor, time) != Gdk.GrabStatus.SUCCESS): logger.warning("Pointer device grab failed !") return Gtk.device_grab_add(self.__dropper_grab_widget, pointer_device, True) self.__grab_time = time self.__pointer_device = pointer_device self.__has_grab = True self.__dropper_grab_widget.connect("button-release-event", self._on_mouse_release) def _grab_color_at_pointer(self, screen, device, x, y): root_window = screen.get_root_window() pixbuf = Gdk.pixbuf_get_from_window(root_window, x, y, 1, 1) # XXX(Jflesch): bad shortcut here ... pixels = pixbuf.get_pixels() rgb = ( float(ord(pixels[0]) * 0x101) / 65535, float(ord(pixels[1]) * 0x101) / 65535, float(ord(pixels[2]) * 0x101) / 65535, ) logger.info("Picked color: %s" % str(rgb)) return rgb def _on_mouse_release(self, invisible_widget, event): if not self.__has_grab: return try: color = self._grab_color_at_pointer( event.get_screen(), event.get_device(), event.x_root, event.y_root ) self.__editor._color_chooser.set_rgba( Gdk.RGBA( red=color[0], green=color[1], blue=color[2], alpha=1.0 ) ) finally: self.__pointer_device.ungrab(self.__grab_time) Gtk.device_grab_remove(self.__dropper_grab_widget, self.__pointer_device) self.__has_grab = False self.__pointer_device = None class LabelEditor(object): """ Dialog to create / edit labels """ def __init__(self, label_to_edit=None): if label_to_edit is None: label_to_edit = Label() self.label = label_to_edit self.__ok_button = None def edit(self, main_window): """ Open the edit dialog, and update the label according to user changes """ widget_tree = load_uifile( os.path.join("labeleditor", "labeleditor.glade")) dialog = widget_tree.get_object("dialogLabelEditor") dialog.set_transient_for(main_window) self.__ok_button = widget_tree.get_object("buttonOk") self._pick_button = widget_tree.get_object("buttonPickColor") PickColorAction(self).connect([self._pick_button]) self._color_chooser = widget_tree.get_object("labelColorChooser") self._color_chooser.set_rgba(self.label.color) name_entry = widget_tree.get_object("entryLabelName") name_entry.connect("changed", self.__on_label_entry_changed) name_entry.set_text(self.label.name) response = dialog.run() if (response == Gtk.ResponseType.OK and name_entry.get_text().strip() == ""): response = Gtk.ResponseType.CANCEL if (response == Gtk.ResponseType.OK): logger.info("Label validated") self.label.name = unicode(name_entry.get_text(), encoding='utf-8') self.label.color = self._color_chooser.get_rgba() else: logger.info("Label editing cancelled") dialog.destroy() logger.info("Label after editing: %s" % self.label) return (response == Gtk.ResponseType.OK) def __on_label_entry_changed(self, label_entry): txt = unicode(label_entry.get_text(), encoding='utf-8').strip() ok_enabled = True ok_enabled = ok_enabled and txt != u"" ok_enabled = ok_enabled and u"," not in txt self.__ok_button.set_sensitive(ok_enabled)
kschwank/paperwork
src/paperwork/frontend/labeleditor/__init__.py
Python
gpl-3.0
10,471
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>E:/Users/Jesse/Documents/Palm Studios/sh3redux/include/SH3/system Directory Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="logo_small.png"/></td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_d2025db5ee4520e82e2aeb5716e460dc.html">sh3redux</a></li><li class="navelem"><a class="el" href="dir_6c5a8a32da54cdd19479506ccd5b9c0e.html">include</a></li><li class="navelem"><a class="el" href="dir_dfd28f9b5fc67e6fb258a8094566358c.html">SH3</a></li><li class="navelem"><a class="el" href="dir_e1091c435e15a21ffac52f7c788baca4.html">system</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">system Directory Reference</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a> Files</h2></td></tr> <tr class="memitem:assert_8hpp"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="assert_8hpp.html">assert.hpp</a> <a href="assert_8hpp_source.html">[code]</a></td></tr> <tr class="memdesc:assert_8hpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">Assertion macros. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:config_8hpp"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="config_8hpp.html">config.hpp</a> <a href="config_8hpp_source.html">[code]</a></td></tr> <tr class="memdesc:config_8hpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">SILENT HILL 3: Redux Configuration parser. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:exit__code_8hpp"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="exit__code_8hpp.html">exit_code.hpp</a> <a href="exit__code_8hpp_source.html">[code]</a></td></tr> <tr class="memdesc:exit__code_8hpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">Definition of exit codes. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:glcontext_8hpp"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="glcontext_8hpp.html">glcontext.hpp</a> <a href="glcontext_8hpp_source.html">[code]</a></td></tr> <tr class="memdesc:glcontext_8hpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">Defines a logical OpenGL Context. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:log_8hpp"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8hpp.html">log.hpp</a> <a href="log_8hpp_source.html">[code]</a></td></tr> <tr class="memdesc:log_8hpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">Defines logging functions. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:sdl__destroyer_8hpp"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sdl__destroyer_8hpp.html">sdl_destroyer.hpp</a> <a href="sdl__destroyer_8hpp_source.html">[code]</a></td></tr> <tr class="memdesc:sdl__destroyer_8hpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">A functor to destroy SDL objects. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:window_8hpp"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="window_8hpp.html">window.hpp</a> <a href="window_8hpp_source.html">[code]</a></td></tr> <tr class="memdesc:window_8hpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">Window class and related functions. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Sat Jan 28 2017 23:21:16 by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>
Palm-Studios/Palm-Studios.github.io
sh3-redux/doc/html/dir_e1091c435e15a21ffac52f7c788baca4.html
HTML
gpl-3.0
6,520
#!/usr/bin/env bash # # This script assumes a linux environment set -e DES=$1 mkdir -p $DES/js cp src/js/base64-custom.js $DES/js cp src/js/biditrie.js $DES/js cp src/js/dynamic-net-filtering.js $DES/js cp src/js/filtering-context.js $DES/js cp src/js/hnswitches.js $DES/js cp src/js/hntrie.js $DES/js cp src/js/static-filtering-parser.js $DES/js cp src/js/static-net-filtering.js $DES/js cp src/js/static-filtering-io.js $DES/js cp src/js/tasks.js $DES/js cp src/js/text-utils.js $DES/js cp src/js/uri-utils.js $DES/js cp src/js/url-net-filtering.js $DES/js mkdir -p $DES/lib cp -R src/lib/punycode.js $DES/lib/ cp -R src/lib/regexanalyzer $DES/lib/ cp -R src/lib/publicsuffixlist $DES/lib/ # Convert wasm modules into json arrays mkdir -p $DES/js/wasm cp src/js/wasm/* $DES/js/wasm/ node -pe "JSON.stringify(Array.from(fs.readFileSync('src/js/wasm/hntrie.wasm')))" \ > $DES/js/wasm/hntrie.wasm.json node -pe "JSON.stringify(Array.from(fs.readFileSync('src/js/wasm/biditrie.wasm')))" \ > $DES/js/wasm/biditrie.wasm.json node -pe "JSON.stringify(Array.from(fs.readFileSync('src/lib/publicsuffixlist/wasm/publicsuffixlist.wasm')))" \ > $DES/lib/publicsuffixlist/wasm/publicsuffixlist.wasm.json cp platform/nodejs/*.js $DES/ cp platform/nodejs/README.md $DES/ cp LICENSE.txt $DES/
gorhill/uBlock
tools/make-nodejs.sh
Shell
gpl-3.0
1,465
var searchData= [ ['adc_20channel_20numbers',['ADC Channel Numbers',['../group__adc__channel.html',1,'']]], ['adc_20number_20of_20channels_20in_20discontinuous_20mode_2e',['ADC Number of channels in discontinuous mode.',['../group__adc__cr1__discnum.html',1,'']]], ['adc_20mode_20selection',['ADC Mode Selection',['../group__adc__cr1__dualmod.html',1,'']]], ['adc_20defines',['ADC Defines',['../group__adc__defines.html',1,'']]], ['adc',['ADC',['../group__adc__file.html',1,'']]], ['adc_20number_20of_20channels_20in_20discontinuous_20injected_20mode',['ADC Number of channels in discontinuous injected mode',['../group__adc__jsqr__jl.html',1,'']]], ['adc_20register_20base_20addresses',['ADC register base addresses',['../group__adc__reg__base.html',1,'']]], ['adc_20sample_20time_20selection_20for_20all_20channels',['ADC Sample Time Selection for All Channels',['../group__adc__sample__rg.html',1,'']]], ['adc_20injected_20trigger_20identifier_20for_20adc1',['ADC Injected Trigger Identifier for ADC1',['../group__adc__trigger__injected__12.html',1,'']]], ['adc_20injected_20trigger_20identifier_20for_20adc3',['ADC Injected Trigger Identifier for ADC3',['../group__adc__trigger__injected__3.html',1,'']]], ['adc_20trigger_20identifier_20for_20adc1_20and_20adc2',['ADC Trigger Identifier for ADC1 and ADC2',['../group__adc__trigger__regular__12.html',1,'']]], ['adc_20trigger_20identifier_20for_20adc3',['ADC Trigger Identifier for ADC3',['../group__adc__trigger__regular__3.html',1,'']]], ['adc_20watchdog_20channel',['ADC watchdog channel',['../group__adc__watchdog__channel.html',1,'']]], ['alternate_20function_20exti_20pin_20number',['Alternate Function EXTI pin number',['../group__afio__exti.html',1,'']]], ['alternate_20function_20remap_20controls',['Alternate Function Remap Controls',['../group__afio__remap.html',1,'']]], ['alternate_20function_20remap_20controls_20secondary_20set',['Alternate Function Remap Controls Secondary Set',['../group__afio__remap2.html',1,'']]], ['alternate_20function_20remap_20controls_20for_20can_201',['Alternate Function Remap Controls for CAN 1',['../group__afio__remap__can1.html',1,'']]], ['alternate_20function_20remap_20controls_20for_20connectivity',['Alternate Function Remap Controls for Connectivity',['../group__afio__remap__cld.html',1,'']]], ['alternate_20function_20remap_20controls_20for_20timer_201',['Alternate Function Remap Controls for Timer 1',['../group__afio__remap__tim1.html',1,'']]], ['alternate_20function_20remap_20controls_20for_20timer_202',['Alternate Function Remap Controls for Timer 2',['../group__afio__remap__tim2.html',1,'']]], ['alternate_20function_20remap_20controls_20for_20timer_203',['Alternate Function Remap Controls for Timer 3',['../group__afio__remap__tim3.html',1,'']]], ['alternate_20function_20remap_20controls_20for_20usart_203',['Alternate Function Remap Controls for USART 3',['../group__afio__remap__usart3.html',1,'']]] ];
Aghosh993/TARS_codebase
libopencm3/doc/stm32f1/html/search/groups_0.js
JavaScript
gpl-3.0
2,969
package com.cloudera.cmf.service; import com.cloudera.cmf.command.ConfirmCommandInfo; import com.cloudera.cmf.command.ServiceCommandHandler; import com.cloudera.cmf.command.SvcCmdArgs; import com.cloudera.cmf.model.DbCommand; import com.cloudera.cmf.model.DbRole; import com.cloudera.cmf.model.DbService; import com.cloudera.cmf.model.TypedDbBase; import com.cloudera.cmf.persist.CmfEntityManager; import com.cloudera.server.web.common.I18n; import com.google.common.collect.ImmutableList; import java.util.Collections; import java.util.List; import java.util.Set; @Deprecated public abstract class AbstractServiceCommand<A extends SvcCmdArgs> extends AbstractCommandHandler<DbService, A> implements ServiceCommandHandler<A> { protected AbstractServiceCommand(ServiceDataProvider sdp) { super(sdp); } public final DbCommand execute(DbService service, A arg, DbCommand parent) { Set roles = Collections.emptySet(); if (arg != null) { roles = arg.targetRoles; } if ((isExclusive()) && (hasActiveCommands(service, roles, parent))) { return CommandUtils.createFailedCommand(getName(), service, "There is already a pending command on this service.", parent); } DbCommand cmd = DbCommand.of(service, getName()); cmd.setParent(parent); CmfEntityManager.currentCmfEntityManager().persistCommand(cmd); executeImpl(cmd, service, roles, arg); return cmd; } protected abstract void executeImpl(DbCommand paramDbCommand, DbService paramDbService, Set<DbRole> paramSet, A paramA); public boolean isApplicableToAllRoleInstances() { return false; } public ConfirmCommandInfo getConfirmCommandInfo(DbService target, A args) { String msg; String msg; if (args.targetRoles.isEmpty()) msg = I18n.t("message.service.commandConfirm", new String[] { getDisplayName(), target.getDisplayName() }); else { msg = I18n.t("message.roleInstances.commandConfirm", new String[] { getDisplayName() }); } return ConfirmCommandInfo.create(msg, getConfirmCommandWarning(target, args)); } protected String getConfirmCommandWarning(DbService target, A args) { return null; } public List<? extends TypedDbBase> getContext(CmfEntityManager em, DbCommand cmd) { return ImmutableList.of(cmd.getService()); } }
Mapleroid/cm-server
server-5.11.0.src/com/cloudera/cmf/service/AbstractServiceCommand.java
Java
gpl-3.0
2,398
CREATE TABLE tau ( rate FLOAT NOT NULL, decay VARCHAR(3) NOT NULL );
kept-io/r-datasets
datasets/boot/tau.schema.sql
SQL
gpl-3.0
72
package HHCP; import causalgraph.Edge; import org.jgrapht.graph.ClassBasedEdgeFactory; import org.jgrapht.graph.DefaultDirectedWeightedGraph; import java.util.*; /** * Created by ignasi on 21/08/17. */ public class JustificationGraph { private DefaultDirectedWeightedGraph<String, Edge> graph; public BitSet relevants = new BitSet(); public JustificationGraph(Problem p){ graph = createStringGraph(); for(VAction va : p.getVaList()){ if(va.isObservation){ feedObservations(va); }else if(va.isNondeterministic){ feedNonDetActions(va); }else{ feedActions(va); } } } private void feedActions(VAction a) { for(VEffect e : a.getEffects()){ for(int to = e.getAddList().nextSetBit(0);to>=0;to = e.getAddList().nextSetBit(to+1)){ graph.addVertex(String.valueOf(to)); BitSet origins = (BitSet) e.getCondition().clone(); origins.or(a.getPreconditions()); for(int from = origins.nextSetBit(0);from>=0;from = origins.nextSetBit(from+1)){ if(from == to) continue; graph.addVertex(String.valueOf(from)); Edge<String> edge = new Edge<String>(String.valueOf(from), String.valueOf(to), a.getName()); graph.addEdge(String.valueOf(from), String.valueOf(to), edge); graph.setEdgeWeight(edge, a.cost * -1); } } } } private void feedObservations(VAction a) { for(VEffect e : a.getEffects()){ for(int to = e.getAddList().nextSetBit(0);to>=0;to = e.getAddList().nextSetBit(to+1)){ graph.addVertex(String.valueOf(to)); for(int from = a.getPreconditions().nextSetBit(0);from>=0;from = a.getPreconditions().nextSetBit(from+1)){ if(from == to) continue; graph.addVertex(String.valueOf(from)); Edge<String> edge = new Edge<String>(String.valueOf(from), String.valueOf(to), a.getName()); graph.addEdge(String.valueOf(from), String.valueOf(to), edge); graph.setEdgeWeight(edge, a.cost * -1); } } } } private void feedNonDetActions(VAction a){ for(VEffect e : a.getEffects()){ for(int to = e.getAddList().nextSetBit(0);to>=0;to = e.getAddList().nextSetBit(to+1)){ graph.addVertex(String.valueOf(to)); for(int from = a.getPreconditions().nextSetBit(0);from>=0;from = a.getPreconditions().nextSetBit(from+1)){ if(from == to) continue; graph.addVertex(String.valueOf(from)); Edge<String> edge = new Edge<String>(String.valueOf(from), String.valueOf(to), a.getName()); graph.addEdge(String.valueOf(from), String.valueOf(to), edge); graph.setEdgeWeight(edge, a.cost * -1); } } } } private DefaultDirectedWeightedGraph<String, Edge> createStringGraph(){ DefaultDirectedWeightedGraph<String, Edge> g = new DefaultDirectedWeightedGraph<String, Edge>( new ClassBasedEdgeFactory<String, Edge>(Edge.class)); return g; } public Set<Edge> getIncomingEdgesOf(String goal) { Set<Edge> hS = graph.incomingEdgesOf(goal); return hS; } public double getEdgeWeight(Edge e) { return graph.getEdgeWeight(e)*-1; } public void setRelevantLiterals(Problem p, HashSet<String> relevantList){ for(String lit : relevantList){ relevants.set(p.getPredicate(lit)); } } public BitSet getReachableLiterals(BitSet goalState, BitSet initial){ BitSet next = new BitSet(); BitSet current = (BitSet) initial.clone(); HashSet<String> visited = new HashSet<String>(); boolean reached = false; while(!reached || !contained(current, goalState)){ if(current.equals(next)){ reached = true; } for(int i = current.nextSetBit(0); i>=0; i=current.nextSetBit(i+1)){ if(!graph.containsVertex(String.valueOf(i))) continue; Set<Edge> edges = graph.outgoingEdgesOf(String.valueOf(i)); for(Edge e : edges){ if(!visited.contains(e.getTarget())) { visited.add(e.getTarget()); next.set(Integer.parseInt(e.getTarget())); } } } current.or(next); } return current; } private boolean contained(BitSet current, BitSet goalState) { BitSet aux = new BitSet(); aux.or(goalState); aux.and(current); if(goalState.equals(aux)) return true; return false; } }
ignasiet/Translator
src/HHCP/JustificationGraph.java
Java
gpl-3.0
4,984
#ifndef _args_h_ #define _args_h_ #include <iostream> #include <sstream> #include <cstdlib> using namespace std; class args { public: const char * program; const char * input; const char * output; const char * progress; stringstream params; args(const char* p="nuwro",const char* i="params.txt",const char* o="eventsout.root"): program(p),input(i),output(o) {} int read(int argc, char** argv) { if(argc%2==0) usage(); for(int i=1;i<argc-1;i++) { if(string(argv[i])=="-i" and argv[i+1][0]!='-') input=argv[++i]; else if(string(argv[i])=="-o" and argv[i+1][0]!='-') output=argv[++i]; else if(string(argv[i])=="-progress" and argv[i+1][0]!='-') progress=argv[++i]; else if(string(argv[i])=="-p" and argv[i+1][0]!='-') params<<argv[++i]<<endl; else usage(); } return 0; } void usage() { cout <<"usage: "<< program <<" [-i input_paramaters_file] [-o output_root_file] [-p \"param1=value1\"] [-p \"param2=value2\"]...\n"; exit(22); } }; #endif
cjusz/nuwro
src/args.h
C
gpl-3.0
1,060
package database; import java.sql.Connection; import java.sql.Driver; import java.sql.DriverManager; import java.sql.SQLException; /** * Singleton class for connecting to the database through JDBC. * * @author Maks (original) * @author Brett Commandeur (modified by) * @reference https://github.com/MaksJS/jdbc-singleton/blob/master/JDBC.java on March 1, 2015 **/ public class JDBC { private static Connection connection = null; private static String username = null; private static String password = null; private static Boolean connectingFromLab = null; private final static String REMOTE_URL = "jdbc:oracle:thin:@localhost:1525:CRS"; // Work from Home private final static String LAB_URL = "jdbc:oracle:thin:@gwynne.cs.ualberta.ca:1521:CRS"; // Lab Machines private final static String DRIVER = "oracle.jdbc.driver.OracleDriver"; private static final int LOGIN_TIMEOUT = 3; /** * Method that loads the specified driver * * @return void **/ private static void loadDriver() { try { Class drvClass = Class.forName(DRIVER); DriverManager.registerDriver((Driver)drvClass.newInstance()); } catch (Exception e) { errorHandler("Failed to load the driver " + DRIVER, e); } } /** * Method that loads the connection into the right property * * @return void **/ private static void loadConnection() { if (username == null || password == null || connectingFromLab == null) { errorHandler("Please configure username, password, connecting from lab", null); } else { String url = (connectingFromLab) ? LAB_URL : REMOTE_URL; DriverManager.setLoginTimeout(LOGIN_TIMEOUT); try { connection = DriverManager.getConnection(url, username, password); } catch (SQLException e) { errorHandler("Failed to connect to the database " + url, e); } } } /** * Method that shows the errors thrown by the singleton * * @param {String} Message * @option {Exception} e * @return void **/ private static void errorHandler(String message, Exception e) { System.out.println(message); if (e != null) System.out.println(e.getMessage()); } /** * Method that sets the user and password for the connection * * @param newUser * @param newPassword * @return void */ public static void configure(String newUsername, String newPassword, boolean isConnectingFromLab) { username = newUsername; password = newPassword; connectingFromLab = isConnectingFromLab; } /*** * Method that checks whether db info has been set. * * @return Whether the necessary db info is configured. */ public static boolean isConfigured() { return (username != null && password != null && connectingFromLab != null); } /** * Static method that returns the instance for the singleton * * @return {Connection} connection **/ public static Connection connect() { if (connection == null) { loadDriver(); loadConnection(); } return connection; } /** * Static method that closes the connection to the database * * @return true on success. **/ public static boolean closeConnection() { if (connection == null) { errorHandler("No connection found", null); } else { try { connection.close(); connection = null; return true; } catch (SQLException e) { errorHandler("Failed to close the connection", e); } } return false; } /** * Method to execute a given SQL update on the connection * * @param sql * @return void **/ public static boolean hasConnection() { boolean valid = false; if (connection != null) { valid = true; } return valid; } }
C391-Project/RadiologyApp
src/database/JDBC.java
Java
gpl-3.0
4,195
/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */ /* This file is prepared for Doxygen automatic documentation generation. */ /* ! \file ********************************************************************* \brief Preprocessor token pasting utils. - Compiler: IAR EWAVR32 and GNU GCC for AVR32 - Supported devices: All AVR32 devices can be used. \author Atmel Corporation: http://www.atmel.com \n Support and FAQ: http://support.atmel.no/ **************************************************************************** */ /* Copyright (c) 2009 Atmel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of Atmel may not be used to endorse or promote products derived from this software without specific prior written permission. 4. This software may only be redistributed and used in connection with an Atmel AVR product. THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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 */ #ifndef _TPASTE_H_ #define _TPASTE_H_ /* ! \name Token Paste Paste N preprocessing tokens together, these tokens being allowed to be \#defined. May be used only within macros with the tokens passed as arguments if the tokens are \#defined. For example, writing TPASTE2(U, WIDTH) within a macro \#defined by UTYPE(WIDTH) and invoked as UTYPE(UL_WIDTH) with UL_WIDTH \#defined as 32 is equivalent to writing U32. */ // ! @{ #define TPASTE2( a, b) a##b #define TPASTE3( a, b, c) a##b##c #define TPASTE4( a, b, c, d) a##b##c##d #define TPASTE5( a, b, c, d, e) a##b##c##d##e #define TPASTE6( a, b, c, d, e, f) a##b##c##d##e##f #define TPASTE7( a, b, c, d, e, f, g) a##b##c##d##e##f##g #define TPASTE8( a, b, c, d, e, f, g, h) a##b##c##d##e##f##g##h #define TPASTE9( a, b, c, d, e, f, g, h, i) a##b##c##d##e##f##g##h##i #define TPASTE10(a, b, c, d, e, f, g, h, i, j) a##b##c##d##e##f##g##h##i##j // ! @} /* ! \name Absolute Token Paste Paste N preprocessing tokens together, these tokens being allowed to be \#defined. No restriction of use if the tokens are \#defined. For example, writing ATPASTE2(U, UL_WIDTH) anywhere with UL_WIDTH \#defined as 32 is equivalent to writing U32. */ // ! @{ #define ATPASTE2( a, b) TPASTE2( a, b) #define ATPASTE3( a, b, c) TPASTE3( a, b, c) #define ATPASTE4( a, b, c, d) TPASTE4( a, b, c, d) #define ATPASTE5( a, b, c, d, e) TPASTE5( a, b, c, d, e) #define ATPASTE6( a, b, c, d, e, f) TPASTE6( a, b, c, d, e, f) #define ATPASTE7( a, b, c, d, e, f, g) TPASTE7( a, b, c, d, e, f, g) #define ATPASTE8( a, b, c, d, e, f, g, h) TPASTE8( a, b, c, d, e, f, g, h) #define ATPASTE9( a, b, c, d, e, f, g, h, i) TPASTE9( a, b, c, d, e, f, g, h, i) #define ATPASTE10(a, b, c, d, e, f, g, h, i, j) TPASTE10(a, b, c, d, e, f, g, h, i, j) // ! @} #endif // _TPASTE_H_
Nitrokey/nitrokey-storage-firmware
src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR/tpaste.h
C
gpl-3.0
4,159
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="es"> <head> <!-- Generated by javadoc (1.8.0_111) on Wed Jan 04 19:28:25 CET 2017 --> <title>Overview</title> <meta name="date" content="2017-01-04"> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> <script type="text/javascript" src="script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Overview"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li class="navBarCell1Rev">Overview</li> <li>Package</li> <li>Class</li> <li>Use</li> <li><a href="overview-tree.html">Tree</a></li> <li><a href="deprecated-list.html">Deprecated</a></li> <li><a href="index-files/index-1.html">Index</a></li> <li><a href="help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="index.html?overview-summary.html" target="_top">Frames</a></li> <li><a href="overview-summary.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="contentContainer"> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Packages table, listing packages, and an explanation"> <caption><span>Packages</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="action/package-summary.html">action</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="action/controller/package-summary.html">action.controller</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="action/locale/package-summary.html">action.locale</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="action/user/package-summary.html">action.user</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="domain/dao/package-summary.html">domain.dao</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="domain/model/package-summary.html">domain.model</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="domain/model/users/package-summary.html">domain.model.users</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="helpers/package-summary.html">helpers</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="hibernate/package-summary.html">hibernate</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="initialization/package-summary.html">initialization</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="interceptor/package-summary.html">interceptor</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="notification/package-summary.html">notification</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="simulator/package-summary.html">simulator</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li class="navBarCell1Rev">Overview</li> <li>Package</li> <li>Class</li> <li>Use</li> <li><a href="overview-tree.html">Tree</a></li> <li><a href="deprecated-list.html">Deprecated</a></li> <li><a href="index-files/index-1.html">Index</a></li> <li><a href="help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="index.html?overview-summary.html" target="_top">Frames</a></li> <li><a href="overview-summary.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
Maracars/POPBL5
doc/overview-summary.html
HTML
gpl-3.0
5,685
/* This file is part of the KDE libraries Copyright (C) 2002 Laurence Anderson <l.d.anderson@warwick.ac.uk> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KAR_H #define KAR_H #include <karchive.h> /** * @class KAr kar.h KAr * * KAr is a class for reading archives in ar format. Writing * is not supported. Reading archives that contain files bigger than * INT_MAX - 32 bytes is not supported. * @short A class for reading ar archives. * @author Laurence Anderson <l.d.anderson@warwick.ac.uk> */ class KARCHIVE_EXPORT KAr : public KArchive { Q_DECLARE_TR_FUNCTIONS(KAr) public: /** * Creates an instance that operates on the given filename. * * @param filename is a local path (e.g. "/home/holger/myfile.ar") */ KAr(const QString &filename); /** * Creates an instance that operates on the given device. * The device can be compressed (KFilterDev) or not (QFile, etc.). * @param dev the device to read from */ KAr(QIODevice *dev); /** * If the ar file is still opened, then it will be * closed automatically by the destructor. */ virtual ~KAr(); protected: /* * Writing is not supported by this class, will always fail. * @return always false */ bool doPrepareWriting(const QString &name, const QString &user, const QString &group, qint64 size, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override; /* * Writing is not supported by this class, will always fail. * @return always false */ bool doFinishWriting(qint64 size) override; /* * Writing is not supported by this class, will always fail. * @return always false */ bool doWriteDir(const QString &name, const QString &user, const QString &group, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override; bool doWriteSymLink(const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override; /** * Opens the archive for reading. * Parses the directory listing of the archive * and creates the KArchiveDirectory/KArchiveFile entries. * */ bool openArchive(QIODevice::OpenMode mode) override; bool closeArchive() override; protected: void virtual_hook(int id, void *data) override; private: class KArPrivate; KArPrivate *const d; }; #endif
variar/klogg
3rdparty/karchive/karchive/src/kar.h
C
gpl-3.0
3,274
#ifndef FO_BASE_BUFFER_HPP_ #define FO_BASE_BUFFER_HPP_ #include <stdint.h> #include <cstdlib> #include "Common.hpp" namespace fonline { class Buffer { public: FONLINE_COMMON_API Buffer(); FONLINE_COMMON_API Buffer(size_t alen); FONLINE_COMMON_API ~Buffer(); FONLINE_COMMON_API void Reset(); FONLINE_COMMON_API void Write(const void* buf, size_t alen); FONLINE_COMMON_API void Read(void *buf, size_t alen); // XXX[1.8.2012 alex]: new names FONLINE_COMMON_API bool IsError(); FONLINE_COMMON_API bool NeedProcess(); FONLINE_COMMON_API void EnsureCapacity(size_t capacity); FONLINE_COMMON_API void EnsureWriteCapacity(size_t dataSize); template<class T> Buffer& operator<<(const T& value) { // XXX[1.8.2012 alex]: endianness? Write(&value, sizeof(value)); return *this; } template<class T> Buffer& operator>>(T& value) { // XXX[1.8.2012 alex]: endianness? Read(&value, sizeof(value)); return *this; } bool error; char* data; size_t capacity; size_t writePosition; size_t readPosition; }; }; // namespace fonline #endif // FO_BASE_BUFFER_HPP_
alexknvl/fonline
src/FOnlineCommon/buffer.hpp
C++
gpl-3.0
1,163
# Log Merger (LMRG) This tool merges multiple access logs from dispersed servers into a single contiguous file with records ordered by access time
ffeast/lmrg
README.md
Markdown
gpl-3.0
148
# Repair Master Boot Record (MBR) -- Windows 10 / 8 / 7 > SYMPTOMS: Common reasons why MBRs get corrupted are: malware infections, improper shutdowns, Linux Grub being installed and Windows is not able to detect it. On some occasions, you may get the Bootmgr is missing error. In such cases you can run the rebuild or repair MBR to fix these issues. The process is almost same for Windows 10 / 8 / 7. First and foremost you need a Windows 8 or Windows 7 installation DVD. 1. **Boot the system while pressing [F8]** to go into the 'Windows Recovery Menu': > NOTE: Unlike other version Windows 8’s recovery menu has the Metro UI style: ![Windows recovery menu](assets/01_windows-recovery-menu.png) 2. **Click 'Troubleshoot'**. 3. **Click 'Advanced options'** to be presented to the `Automatic Repair` option: ![Windows recovery menu](assets/02_advanced-options.png) 4. **Click 'Automatic repair'** to get into the Automatic Repair menu. 5. **Click on command prompt** to be able to use the 'Bootrec.exe' tool. 6. **Issue the following commands**: ``` > bootrec /RebuildBcd > bootrec /fixMbr > bootrec /fixboot > Exit ``` ![Windows recovery menu](assets/03_fix-commands.png) 7. **Reboot the system**. 8. **Run some additional commands**, if required: ``` > bootsect /nt60 SYS > bootsect /nt60 ALL ``` ![Windows recovery menu](assets/04_additional-commands.png) ## Prevention [Create a system recovery disk][1] with the latter for Windows 8: 1. **Open a DOS command prompt** to have a CLI: ``` [Win]+[R] ``` 2. **Start the recovery drive utility** from the CLI: ``` > RecoveryDrive.exe ``` ![Windows recovery menu](assets/05_recovery-drive-creation-tool.png) 3. **Click Next** to proceed to the next step: 4. **Insert an USB drive** and the program will start creating the Recovery (USB) drive. > ALTERNATIVE: Make a backup of a functional Master Boot Record (MBR). ## References > Adapted from: The windows club > [Repair Master Boot Record (MBR) Windows][3] > Also see: The windows club > [Create a System Recovery Disk][1] > Also see: Youtube > [Video for Windows 7][2] <!-- REFERENCES --> [1]:http://www.thewindowsclub.com/create-recovery-drive-windows-8 [2]:https://www.youtube.com/watch?v=3xkMT8Hyhqc [3]:http://www.thewindowsclub.com/repair-master-boot-record-mbr-windows
woosting/linux-notes
contents/mbr/repair/repair.md
Markdown
gpl-3.0
2,336
#ifndef __PGRAPHH__ #define __PGRAPHH__ #include <vector> #include <map> #include <string> class GEdge{ private: /** The next neighbourhood node. */ GEdge *next; /** The rank of the node in the graph array. */ long incident_node; //GNode ? /** The number which identifies the object. */ long edge_id; public: /** The attribute of the edge */ int attr; /** * Creates a new edge to the specified node, with * the specified weight and the specified next edge. * @param n the connected node. * @param adj the next edge. * @param attr the label. */ GEdge( long n, GEdge *adj, int attr ): next(adj), incident_node(n), edge_id(-1), attr(attr) {}; /** * Creates a new edge to the specified incident_node, with * the specified weight and the specified next edge. * @param n the connected incident_node. * @param adj the next edge. * @param i the identifier of the edge * @param w the weight. */ GEdge( long n, GEdge *adj, long i,int attr): next(adj), incident_node(n), edge_id(i), attr(attr) {}; /** * Deletes the edge */ ~GEdge(){}; /** * Returns the number of the incident incident_node. * @return the number of the connected incident_node. */ long IncidentNode() const { return incident_node; }; /** * Returns the next neighbourhood incident_node. * @return the next edge. */ GEdge* Next() const { return next; }; /** * Sets a new neighbourhood incident_node. * @param n the neighbourhood edge. * @return the neighbourhood edge. */ GEdge* Next( GEdge* n ) { return next=n; }; /** * Returns the index of the referenced object. * @return the index. */ long EdgeId() const { return edge_id; } /** * Sets the new index of the referenced object. * @param i the new index. * @return the new index of the object. */ long EdgeId( long i ) { return edge_id=i; } }; /** @brief A node of a graph. * * The class <code>GNode</code> defines a node. * A node indexes an object in a separate array of objects * at specified coordinates in the related image. * It is characterized by a value and a list * of connected nodes. */ class GNode{ private: /** The list of the adjacent nodes. */ GEdge *adjacents; /** The number which identifies the object. */ long item; // /** Trash for removed edges */ // std::vector<GEdge *> etrash; //XXX : A virer ? public : /** The valuation of the node. */ int attr; /** * Creates a new node with the specified index, * and the specified coordinates. * @param i the index of the referenced object. * @param p the specified coordinates. */ GNode( long i, int attr ): adjacents(0), attr(attr) { }; /** * Deletes the node. */ ~GNode(); /** * Returns the list of all the connected nodes. * @return the list of connected nodes. */ GEdge* getIncidentEdges() const { return adjacents; }; GEdge * Connect( long incidentNode, int attr); GEdge * Connect( long incidentNode, long edge_id, int attr); int Degree(); /** * Deletes the specified node from the list of connected nodes. * @param n the specified node. * @return the new list of edges. */ GEdge* UnConnect( long n ); /** * Returns the index of the referenced object. * @return the index. */ long Item() const { return item; } /** * Sets the new index of the referenced object. * @param i the new index. * @return the new index of the object. */ long Item( long i ) { return item=i; } }; /** @brief A 2D graph. * * A graph is a set of nodes connected to some other nodes. * The two types of graph are supported: directed and undirected; * the type must be specified with the constructor. * A node is characterized by a value which determines if the * node is active in the representation of the graph or not. * A node can be any of the Pandore object. It indexes an * item in a separate array of items. (The secret is to use an * item as a pointer to a specific objet in an array [no type]). * <br>For the use of Graph2d see @ref graph_page. */ class Graph { private : std::vector<GNode *> tnode; long nbNodes; long nbEdges; bool _directed; friend class GEdge; public : static std::map<std::string, int> AtomTable; // The correspondance table static void initTable (); //Initialization of AtomTable /** * Deletes the graph. */ ~Graph(); /** * @return true if the graph is directed. */ bool isDirected() const { return _directed; } /** * Returns the number of nodes. * @return the size. */ long Size() const { return nbNodes; } long getNbEdges() const { return _directed?nbEdges:nbEdges/2; } /** * Creates a new graph with no data. * @param directed true for creating a directed graph. */ Graph( bool directed =false): tnode(0), nbNodes(0), nbEdges(0), _directed(directed) { } /** * Initialize a graph nb_nodes and corresponding to adjacency matrix am * the format of am is the following : * am[i][j] : label of edge between nodes i and j, 0 if no edge * am[i][i] : label of node i */ Graph(int * am, int nb_nodes, bool directed=false); /** * Build a graph according to information encoded in filename. * The file corresponding to filename must be in ct (chemDraw) format. */ Graph(char * ct_filename); /** * Returns the node at the specified coordinates. * @param pos the coordinates. * @return the node at the specified coordinates. */ GNode *operator[]( long pos ){ return(tnode[pos]); } /** * Returns the node at the specified coordinates. * @param pos the coordinates. * @return the node at the specified coordinates. */ const GNode *operator[]( long pos ) const { return(tnode[pos]); } /** * Adds the specified node that references the specified item. * @param node the new Node * @return index du noeud. */ int Add( GNode* node ); /** * Deletes the specified node from the graph. Unlinks it * from connected nodes. * @param s the node to be deleted. * @return SUCCESS or FAILURE. */ GNode * Del( long s ); GEdge * Link(long firstNode, long SecondNode , int label); //TODO : UnLink ! bool isLinked(long firstNode, long SecondNode); GEdge * getEdge(long firstNode, long SecondNode); GEdge * getSymmetricEdge(long nodeId,const GEdge * p); }; #endif // __PGRAPHH__
bgauzere/ged-toolbox
graph-lib/include/graph.h
C
gpl-3.0
6,496
#ifndef _SIPGREP_H #define _SIPGREP_H /* * sipgrep.h, v 2.0 2014/03/18 * * Copyright (c) 2013-14 Alexandr Dubovikov <alexandr.dubovikov@gmail.com> * */ /* * We cache the standard frame sizes here to save us time and * additional dependencies on more operating system include files. */ #define ETHHDR_SIZE 14 #define TOKENRING_SIZE 22 #define PPPHDR_SIZE 4 #define SLIPHDR_SIZE 16 #define RAWHDR_SIZE 0 #define LOOPHDR_SIZE 4 #define FDDIHDR_SIZE 21 #define ISDNHDR_SIZE 16 #define IEEE80211HDR_SIZE 32 /* * Default patterns for BPF and regular expression filters. */ #if USE_IPv6 #define BPF_FILTER_IP "(ip or ip6)" #else #define BPF_FILTER_IP "(ip)" #endif #define BPF_FILTER_OTHER " and ( %s)" #define BPF_MAIN_FILTER BPF_FILTER_IP BPF_FILTER_OTHER #define BPF_FILTER_PORTRANGE " and ( portrange %s)" #define BPF_MAIN_PORTRANGE_FILTER BPF_FILTER_IP BPF_FILTER_PORTRANGE #define BPF_DEFRAGMENTION_FILTER BPF_MAIN_PORTRANGE_FILTER " or (udp and ip[6:2] & 0x3fff != 0)" #define WORD_REGEX "((^%s\\W)|(\\W%s$)|(\\W%s\\W))" /* * For retarded operating systems like Solaris that don't have this, * when everyone else does. Good job, Sun! */ #ifndef IP_OFFMASK #define IP_OFFMASK 0x1fff #endif /* * "Newer" flags that older operating systems don't yet recognize. */ #ifndef TH_ECE #define TH_ECE 0x40 #endif #ifndef TH_CWR #define TH_CWR 0x80 #endif #define SIP_FROM_MATCH "(From:|f:) (.*)%s(.*)" #define SIP_TO_MATCH "(To:|t:) (.*)%s(.*)" #define SIP_CONTACT_MATCH "(Contact:|c:) (.*)%s(.*)" #define SIP_REPLY_MATCH "^SIP/2.0 %s" #define SIP_FROM_TO_MATCH "(" SIP_FROM_MATCH "|" SIP_TO_MATCH ")" /* colors */ #define RESET "\033[0m" #define BLACK "\033[30m" /* Black */ #define RED "\033[31m" /* Red */ #define GREEN "\033[32m" /* Green */ #define YELLOW "\033[33m" /* Yellow */ #define BLUE "\033[34m" /* Blue */ #define MAGENTA "\033[35m" /* Magenta */ #define CYAN "\033[36m" /* Cyan */ #define WHITE "\033[37m" /* White */ #define BOLDBLACK "\033[1m\033[30m" /* Bold Black */ #define BOLDRED "\033[1m\033[31m" /* Bold Red */ #define BOLDGREEN "\033[1m\033[32m" /* Bold Green */ #define BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */ #define BOLDBLUE "\033[1m\033[34m" /* Bold Blue */ #define BOLDMAGENTA "\033[1m\033[35m" /* Bold Magenta */ #define BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */ #define BOLDWHITE "\033[1m\033[37m" /* Bold White */ #define DURATION_SPLIT 1 #define FILESIZE_SPLIT 2 /* * Single-char packet "ident" flags. */ typedef enum { TCP = 'T', UDP = 'U', ICMP = 'I', ICMPv6 = 'I', IGMP = 'G', UNKNOWN = '?' } netident_t; /* * Prototypes function signatures. */ void process(u_char *, struct pcap_pkthdr *, u_char *); void version(void); void usage(int8_t); void clean_exit(int32_t); void dump_packet(struct pcap_pkthdr *, u_char *, uint8_t, unsigned char *, uint32_t, const char *, const char *, uint16_t, uint16_t, uint8_t, uint16_t, uint8_t, uint16_t, uint32_t, uint32_t); void dump_unwrapped(unsigned char *, uint32_t); void dump_formatted(unsigned char *, uint32_t); void dump_byline (unsigned char *, uint32_t); void dump_delay_proc_init(struct pcap_pkthdr *); void dump_delay_proc (struct pcap_pkthdr *); int8_t re_match_func (unsigned char *, uint32_t); int8_t bin_match_func (unsigned char *, uint32_t); int8_t blank_match_func(unsigned char *, uint32_t); void print_time_absolute(struct pcap_pkthdr *); void print_time_diff (struct pcap_pkthdr *); char *get_filter_from_string(char *); char *get_filter_from_argv (char **); char *get_filter_from_portrange(char *); void create_dump(unsigned int now); /* Call ID extract */ int extract_callid(char *msg, int len); uint8_t strishex(char *); void update_windowsize(int32_t); void drop_privs(void); int parse_stop_request(char *request); int parse_split_request(char *request); int check_split_deadline(unsigned int now); int check_exit_deadline(unsigned int now); void mass_friendlyscanner_kill(char *data); struct SIPGREP_rtaphdr_t { uint8_t it_version; uint8_t it_pad; uint16_t it_len; uint32_t it_present; }; /* HASH table */ struct callid_table { char callid[256]; /* key (string is WITHIN the structure) */ uint32_t transaction; uint32_t init_cseq; uint8_t terminated; uint16_t termination_reason; uint32_t cdr_init; uint32_t cdr_ringing; uint32_t cdr_connect; uint32_t cdr_disconnect; uint8_t registered; char from[256]; char to[256]; char uac[256]; UT_hash_handle hh; /* makes this structure hashable */ }; /* HASH table */ struct callid_remove { char callid[256]; /* key (string is WITHIN the structure) */ int removed; int time; UT_hash_handle hh; /* makes this structure hashable */ }; /* HASH table */ struct statistics_table { char method[100]; /* key (string is WITHIN the structure) */ char orig_method[50]; /* key (string is WITHIN the structure) */ char cseq_method[50]; /* key (string is WITHIN the structure) */ int count; int req; int time; UT_hash_handle hh; /* makes this structure hashable */ }; void delete_dialogs_remove_element (char *callid); void delete_dialogs_element (char *callid); void check_dialogs_delete (); void print_dialogs_stats(struct callid_table *s); void clear_all_dialogs_element(); void send_kill_to_friendly_scanner(const char *ip, uint16_t port); int dump_statistics (unsigned int last, unsigned int now); #define SIP_CRASH "SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 8.7.6.5:5061;branch=z9hG4bK-573841574;rport\r\n\r\nContent-length: 0\r\n" \ "From: \"100\"<sip:100@localhost>; tag=683a653a7901746865726501627965\r\nUser-agent: Telkom Box 2.4\r\n" \ "To: \"100\"<sip:100@localhost>\r\nCseq: 1 REGISTER\r\nCall-id: 469585712\r\nMax-forwards: 70\r\n\r\n" #endif /* _SIPGREP_H */
sipcapture/sipgrep
src/include/sipgrep.h
C
gpl-3.0
6,178
/* Editor: http://www.visualmicro.com visual micro and the arduino ide ignore this code during compilation. this code is automatically maintained by visualmicro, manual changes to this file will be overwritten the contents of the Visual Micro sketch sub folder can be deleted prior to publishing a project all non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!). note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again Hardware: Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328, Platform=avr, Package=arduino */ #ifndef _VSARDUINO_H_ #define _VSARDUINO_H_ #define __AVR_ATmega328p__ #define __AVR_ATmega328P__ #define ARDUINO 106 #define ARDUINO_MAIN #define __AVR__ #define __avr__ #define F_CPU 16000000L #define __cplusplus 201103L #define GCC_VERSION 40302 #define ARDUINO_ARCH_AVR #define ARDUINO_AVR_PRO5V328 #define __inline__ #define __asm__(x) #define __extension__ #define __ATTR_PURE__ #define __ATTR_CONST__ #define __inline__ #define __asm__ #define __volatile__ #define __AVR__ typedef void *__builtin_va_list; #define __builtin_va_start #define __builtin_va_end //#define __DOXYGEN__ #define __attribute__(x) #define NOINLINE __attribute__((noinline)) #define prog_void #define PGM_VOID_P int #define NEW_H typedef unsigned char byte; extern "C" void __cxa_pure_virtual() {;} #include <arduino.h> #include <pins_arduino.h> #undef F #define F(string_literal) ((const PROGMEM char *)(string_literal)) #undef PSTR #define PSTR(string_literal) ((const PROGMEM char *)(string_literal)) #undef cli #define cli() #define pgm_read_byte(address_short) #define pgm_read_word(address_short) #define pgm_read_word2(address_short) #define digitalPinToPort(P) #define digitalPinToBitMask(P) #define digitalPinToTimer(P) #define analogInPinToBit(P) #define portOutputRegister(P) #define portInputRegister(P) #define portModeRegister(P) #include <..\Mavlink\Mavlink.ino> #include <..\Mavlink\GK_in_WGS84.h> #include <..\Mavlink\WGS84_in_GK.h> #endif
CodingGhost/MAFM
__vm/.Mavlink.vsarduino.h
C
gpl-3.0
2,380
@extends('layouts.app') @section('title') Account Settings - Barmate POS @stop @section('custom-css') @stop @section('content') <div class="row paper"> <div class="paper-header"> <h2><i class="fa fa-gear"></i>&nbsp;&nbsp;Account Settings</h2> </div> @if ( Session::has('error') ) <div class="paper-notify error"> <i class="fa fa-exclamation-triangle"></i>&nbsp; {{ Session::get('error') }} </div> @elseif ( Session::has('success') ) <div class="paper-notify success"> <i class="fa fa-check"></i>&nbsp; {{ Session::get('success') }} </div> @endif <div class="paper-body"> {!! Form::open(['url'=>'app/account', 'method'=>'POST']) !!} <!-- GENERAL INFORMATIONS --> <div class="col-md-4"> <label>First name</label> <input type="text" class="form-control" name="firstname" value="{{ $user->firstname }}"> </div> <div class="col-md-4"> <label>Last name</label> <input type="text" class="form-control" name="lastname" value="{{ $user->lastname }}"> </div> <div class="col-md-4"> <label>Role</label> <input type="text" class="form-control" disabled value="{{ $roleDescription }}"> </div> <!-- EMAIL --> <div class="col-md-12"> <label>Email</label> <input type="text" class="form-control" name="email" value="{{ $user->email }}"> </div> <!-- PASSWORD --> <div class="col-md-4"> <label>Current password</label> <input type="password" class="form-control" disabled value="password"> </div> <div class="col-md-4"> <label>New password</label> <input type="password" name="password" class="form-control"> </div> <div class="col-md-4"> <label>Repeat new password</label> <input type="password" name="repeat_password" class="form-control"> </div> <!-- NOTES --> <div class="col-md-12"> <label>About me</label> <textarea class="form-control" name="notes">{{ $user->notes }}</textarea> <br> <input type="submit" class="btn btn-primary pull-right" value="Save settings"> </div> <!-- TRICKY PATCH TO ALLOW PADDING BOTTOM --> &nbsp; </form> </div> </div> @stop @section('custom-js') @stop
Saluki/Barmate
resources/views/account/main.blade.php
PHP
gpl-3.0
2,925
package com.hhd.breath.app.main.ui; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.RelativeLayout; import android.widget.TextView; import com.hhd.breath.app.BaseActivity; import com.hhd.breath.app.R; import com.hhd.breath.app.utils.ShareUtils; public class ModifyNameActivity extends BaseActivity { private TextView mTextTop ; private RelativeLayout mLayoutBackRe ; private RelativeLayout mLayoutRight ; private EditText mEditName ; private InputMethodManager imm ; private String userName ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_modify_name); userName = getIntent().getExtras().getString("userName") ; imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); initView(); initEvent(); } @Override protected void initView() { mTextTop = (TextView)findViewById(R.id.topText) ; mLayoutBackRe = (RelativeLayout)findViewById(R.id.back_re) ; mLayoutRight = (RelativeLayout)findViewById(R.id.layout_right) ; mEditName = (EditText)findViewById(R.id.edit_username) ; mLayoutRight.setVisibility(View.VISIBLE); } public static void actionActivity(Activity mActivity , String userName){ Bundle mBundle = new Bundle() ; mBundle.putString("userName",userName); Intent mIntent = new Intent() ; mIntent.setClass(mActivity,ModifyNameActivity.class) ; mIntent.putExtras(mBundle) ; mActivity.startActivity(mIntent); } @Override protected void initEvent() { mTextTop.setText("修改用户名"); mEditName.setText(userName); mLayoutBackRe.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (imm.isActive()) { imm.hideSoftInputFromWindow(mEditName.getWindowToken(), 0); //强制隐藏键盘 } ModifyNameActivity.this.finish(); } }); mLayoutRight.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (imm.isActive()) { imm.hideSoftInputFromWindow(mEditName.getWindowToken(), 0); //强制隐藏键盘 } ShareUtils.setUserName(ModifyNameActivity.this,mEditName.getText().toString().trim()); ModifyNameActivity.this.finish(); } }); } }
weibingithub/BreathApp
app/src/main/java/com/hhd/breath/app/main/ui/ModifyNameActivity.java
Java
gpl-3.0
2,791
""" SicPy """ # __version__ = '0.1' # __author__ = 'disrupts' # __license__ = 'GPLv3' # Cryptobox should only be used to implement ciphers #from sicpy.cryptobox import Cryptobox # Ciphers are imported directly with sicpy #  not requiring an aditional import from sicpy.ciphers.caesar import Caesar from sicpy.ciphers.vigenere import Vigenere from sicpy.ciphers.railfence import RailFence # Alphabet can be used to build alphabets easily # >>> myalpha = Alphabet('ABSDE') from sicpy.alphabet import Alphabet # LATIN is imported by cryptobox.py
disrupts/SicPy
sicpy/__init__.py
Python
gpl-3.0
557
<?php /** * Membership Settings meta box * * @package LifterLMS/Admin/PostTypes/MetaBoxes/Classes * * @since 1.0.0 * @version 5.9.0 */ defined( 'ABSPATH' ) || exit; /** * Membership Settings meta box class * * @since 1.0.0 * @since 3.30.3 Fixed spelling errors; removed duplicate array keys. * @since 3.35.0 Verify nonces and sanitize `$_POST` data. * @since 3.36.0 Allow some fields to store values with quotes. * @since 3.36.3 In the `save() method Added logic to correctly sanitize fields of type * 'multi' (array) and 'shortcode' (preventing quotes encode). * Also align the method return type to the parent `save()` method. */ class LLMS_Meta_Box_Membership extends LLMS_Admin_Metabox { /** * This function allows extending classes to configure required class properties * $this->id, $this->title, and $this->screens should be configured in this function. * * @return void * @since 3.0.0 */ public function configure() { $this->id = 'lifterlms-membership'; $this->title = __( 'Membership Settings', 'lifterlms' ); $this->screens = array( 'llms_membership', ); $this->priority = 'high'; } /** * Get array of data to pass to the auto enrollment courses table. * * @since 3.0.0 * @since 3.30.0 Removed sorting by title. * @since 3.30.3 Fixed spelling errors. * * @param obj $membership instance of LLMS_Membership for the current post. * @return array */ private function get_content_table( $membership ) { $data = array(); $data[] = array( '', '<br>' . __( 'No automatic enrollment courses found. Add a course below.', 'lifterlms' ) . '<br><br>', '', ); foreach ( $membership->get_auto_enroll_courses() as $course_id ) { $course = new LLMS_Course( $course_id ); $title = $course->get( 'title' ); $data[] = array( '<span class="llms-drag-handle" style="color:#999;"><i class="fa fa-ellipsis-v" aria-hidden="true" style="margin-right:2px;"></i><i class="fa fa-ellipsis-v" aria-hidden="true"></i></span>', '<a href="' . get_edit_post_link( $course->get( 'id' ) ) . '">' . $title . ' (ID#' . $course_id . ')</a>', '<a class="llms-button-danger small" data-id="' . $course_id . '" href="#llms-course-remove" style="float:right;">' . __( 'Remove course', 'lifterlms' ) . '</a> <a class="llms-button-secondary small" data-id="' . $course_id . '" href="#llms-course-bulk-enroll" style="float:right;">' . __( 'Enroll All Members', 'lifterlms' ) . '</a>', ); } return apply_filters( 'llms_membership_get_content_table_data', $data, $membership ); } /** * This function is where extending classes can configure all the fields within the metabox. * The function must return an array which can be consumed by the "output" function. * * @since 3.0.0 * @since 3.30.0 Removed empty field settings. Modified settings to accommodate sortable auto-enrollment table. * @since 3.30.3 Removed duplicate array keys. * @since 3.36.0 Allow some fields to store values with quotes. * * @return array */ public function get_fields() { global $post; $membership = new LLMS_Membership( $this->post ); $redirect_options = array(); $redirect_page_id = $membership->get( 'redirect_page_id' ); if ( $redirect_page_id ) { $redirect_options[] = array( 'key' => $redirect_page_id, 'title' => get_the_title( $redirect_page_id ) . '(ID#' . $redirect_page_id . ')', ); } $sales_page_content_type = 'none'; if ( $post && 'auto-draft' !== $post->post_status && $post->post_excerpt ) { $sales_page_content_type = 'content'; } return array( array( 'title' => __( 'Sales Page', 'lifterlms' ), 'fields' => array( array( 'allow_null' => false, 'class' => 'llms-select2', 'desc' => __( 'Customize the content displayed to visitors and students who are not enrolled in the membership.', 'lifterlms' ), 'desc_class' => 'd-3of4 t-3of4 m-1of2', 'default' => $sales_page_content_type, 'id' => $this->prefix . 'sales_page_content_type', 'is_controller' => true, 'label' => __( 'Sales Page Content', 'lifterlms' ), 'type' => 'select', 'value' => llms_get_sales_page_types(), ), array( 'controller' => '#' . $this->prefix . 'sales_page_content_type', 'controller_value' => 'content', 'desc' => __( 'This content will only be shown to visitors who are not enrolled in this membership.', 'lifterlms' ), 'id' => '', 'label' => __( 'Sales Page Custom Content', 'lifterlms' ), 'type' => 'post-excerpt', ), array( 'controller' => '#' . $this->prefix . 'sales_page_content_type', 'controller_value' => 'page', 'data_attributes' => array( 'post-type' => 'page', 'placeholder' => __( 'Select a page', 'lifterlms' ), ), 'class' => 'llms-select2-post', 'id' => $this->prefix . 'sales_page_content_page_id', 'type' => 'select', 'label' => __( 'Select a Page', 'lifterlms' ), 'value' => $membership->get( 'sales_page_content_page_id' ) ? llms_make_select2_post_array( array( $membership->get( 'sales_page_content_page_id' ) ) ) : array(), ), array( 'controller' => '#' . $this->prefix . 'sales_page_content_type', 'controller_value' => 'url', 'type' => 'text', 'label' => __( 'Sales Page Redirect URL', 'lifterlms' ), 'id' => $this->prefix . 'sales_page_content_url', 'class' => 'input-full', 'value' => '', 'desc_class' => 'd-all', 'group' => 'top', ), ), ), array( 'title' => __( 'Restrictions', 'lifterlms' ), 'fields' => array( array( 'allow_null' => false, 'class' => '', 'desc' => __( 'When a non-member attempts to access content restricted to this membership', 'lifterlms' ), 'id' => $this->prefix . 'restriction_redirect_type', 'is_controller' => true, 'type' => 'select', 'label' => __( 'Restricted Access Redirect', 'lifterlms' ), 'value' => array( array( 'key' => 'none', 'title' => __( 'Stay on page', 'lifterlms' ), ), array( 'key' => 'membership', 'title' => __( 'Redirect to this membership page', 'lifterlms' ), ), array( 'key' => 'page', 'title' => __( 'Redirect to a WordPress page', 'lifterlms' ), ), array( 'key' => 'custom', 'title' => __( 'Redirect to a Custom URL', 'lifterlms' ), ), ), ), array( 'class' => 'llms-select2-post', 'controller' => '#' . $this->prefix . 'restriction_redirect_type', 'controller_value' => 'page', 'data_attributes' => array( 'post-type' => 'page', ), 'id' => $this->prefix . 'redirect_page_id', 'label' => __( 'Select a WordPress Page', 'lifterlms' ), 'type' => 'select', 'value' => $redirect_options, ), array( 'class' => '', 'controller' => '#' . $this->prefix . 'restriction_redirect_type', 'controller_value' => 'custom', 'id' => $this->prefix . 'redirect_custom_url', 'label' => __( 'Enter a Custom URL', 'lifterlms' ), 'type' => 'text', 'value' => 'test', ), array( 'class' => '', 'controls' => '#' . $this->prefix . 'restriction_notice', 'default' => 'yes', 'desc' => __( 'Check this box to output a message after redirecting. If no redirect is selected this message will replace the normal content that would be displayed.', 'lifterlms' ), 'desc_class' => 'd-3of4 t-3of4 m-1of2', 'id' => $this->prefix . 'restriction_add_notice', 'label' => __( 'Display a Message', 'lifterlms' ), 'type' => 'checkbox', 'value' => 'yes', ), array( 'class' => 'full-width', 'desc' => sprintf( __( 'Shortcodes like %s can be used in this message', 'lifterlms' ), '[lifterlms_membership_link id="' . $this->post->ID . '"]' ), 'default' => sprintf( __( 'You must belong to the %s membership to access this content.', 'lifterlms' ), '[lifterlms_membership_link id="' . $this->post->ID . '"]' ), 'id' => $this->prefix . 'restriction_notice', 'label' => __( 'Restricted Content Notice', 'lifterlms' ), 'type' => 'text', 'sanitize' => 'shortcode', ), ), ), array( 'title' => __( 'Auto Enrollment', 'lifterlms' ), 'fields' => array( array( 'label' => __( 'Automatic Enrollment', 'lifterlms' ), 'desc' => sprintf( __( 'When a student joins this membership they will be automatically enrolled in these courses. Click %1$shere%2$s for more information.', 'lifterlms' ), '<a href="https://lifterlms.com/docs/membership-auto-enrollment/" target="_blank">', '</a>' ), 'id' => $this->prefix . 'content_table', 'titles' => array( '', __( 'Course Name', 'lifterlms' ), '' ), 'type' => 'table', 'table_data' => $this->get_content_table( $membership ), ), array( 'class' => 'llms-select2-post', 'data_attributes' => array( 'placeholder' => __( 'Select course(s)', 'lifterlms' ), 'post-type' => 'course', 'no-view-button' => true, ), 'id' => $this->prefix . 'auto_enroll', 'label' => __( 'Add Course(s)', 'lifterlms' ), 'type' => 'select', 'value' => array(), ), ), ), ); } /** * Save field data. * * @since 3.0.0 * @since 3.30.0 Autoenroll courses saved via AJAX and removed from this method. * @since 3.35.0 Verify nonces and sanitize `$_POST` data. * @since 3.36.3 Added logic to correctly sanitize fields of type 'multi' (array) * and 'shortcode' (preventing quotes encode). * Also align the return type to the parent `save()` method. * @since 5.9.0 Stop using deprecated `FILTER_SANITIZE_STRING`. * * @see LLMS_Admin_Metabox::save_actions() * * @param int $post_id WP_Post ID of the post being saved. * @return int `-1` When no user or user is missing required capabilities or when there's no or invalid nonce. * `0` during inline saves or ajax requests or when no fields are found for the metabox. * `1` if fields were found. This doesn't mean there weren't errors during saving. */ public function save( $post_id ) { if ( ! llms_verify_nonce( 'lifterlms_meta_nonce', 'lifterlms_save_data' ) ) { return -1; } // Return early during quick saves and ajax requests. if ( isset( $_POST['action'] ) && 'inline-save' === $_POST['action'] ) { return 0; } elseif ( llms_is_ajax() ) { return 0; } $membership = new LLMS_Membership( $post_id ); if ( ! isset( $_POST[ $this->prefix . 'restriction_add_notice' ] ) ) { $_POST[ $this->prefix . 'restriction_add_notice' ] = 'no'; } // Get all defined fields. $fields = $this->get_fields(); // save all the fields. $save_fields = array( $this->prefix . 'restriction_redirect_type', $this->prefix . 'redirect_page_id', $this->prefix . 'redirect_custom_url', $this->prefix . 'restriction_add_notice', $this->prefix . 'restriction_notice', $this->prefix . 'sales_page_content_page_id', $this->prefix . 'sales_page_content_type', $this->prefix . 'sales_page_content_url', ); if ( ! is_array( $fields ) ) { return 0; } $to_return = 0; // Loop through the fields. foreach ( $fields as $group => $data ) { // Find the fields in each tab. if ( isset( $data['fields'] ) && is_array( $data['fields'] ) ) { // loop through the fields. foreach ( $data['fields'] as $field ) { // don't save things that don't have an ID or that are not listed in $save_fields. if ( isset( $field['id'] ) && in_array( $field['id'], $save_fields, true ) ) { if ( isset( $field['sanitize'] ) && 'shortcode' === $field['sanitize'] ) { $val = llms_filter_input_sanitize_string( INPUT_POST, $field['id'], array( FILTER_FLAG_NO_ENCODE_QUOTES ) ); } elseif ( isset( $field['multi'] ) && $field['multi'] ) { $val = llms_filter_input_sanitize_string( INPUT_POST, $field['id'], array( FILTER_REQUIRE_ARRAY ) ); } else { $val = llms_filter_input_sanitize_string( INPUT_POST, $field['id'] ); } $membership->set( substr( $field['id'], strlen( $this->prefix ) ), $val ); $to_return = 1; } } } } return $to_return; } }
gocodebox/lifterlms
includes/admin/post-types/meta-boxes/class.llms.meta.box.membership.php
PHP
gpl-3.0
13,071
package ru.mos.polls.quests.model.quest; import android.content.Context; import com.google.gson.annotations.SerializedName; import ru.mos.polls.quests.model.QuestFamilyElement; import ru.mos.polls.quests.vm.QuestsFragmentVM; public class OtherQuest extends BackQuest { public static final String TYPE = "other"; private static final String LINK_URL = "link_url"; @SerializedName("link_url") private String linkUrl; public OtherQuest(long innerId, QuestFamilyElement questFamilyElement) { super(innerId, questFamilyElement); linkUrl = questFamilyElement.getLinkUrl(); } @Override public void onClick(Context context, QuestsFragmentVM.Listener listener) { listener.onNews(getTitle(), linkUrl, Integer.valueOf(getId())); } }
active-citizen/android.java
app/src/main/java/ru/mos/polls/quests/model/quest/OtherQuest.java
Java
gpl-3.0
788
<?php /** * This runs all of the tests associated with HUGnetLib. * * PHP Version 5 * * <pre> * HUGnetLib is a library of HUGnet code * Copyright (C) 2014 Hunt Utilities Group, LLC * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * </pre> * * @category Libraries * @package HUGnetLibTest * @subpackage SuiteBase * @author Scott Price <prices@hugllc.com> * @copyright 2014 Hunt Utilities Group, LLC * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @link http://dev.hugllc.com/index.php/Project:HUGnetLib */ /** This is the HUGnet namespace */ namespace HUGnet\devices\inputTable; /** This is a required class */ require_once CODE_BASE.'devices/inputTable/DriverVirtual.php'; /** This is a required class */ require_once CODE_BASE.'system/System.php'; /** This is a required class */ require_once TEST_CONFIG_BASE.'stubs/DummyTable.php'; /** This is our base class */ require_once dirname(__FILE__)."/drivers/DriverTestBase.php"; /** This is our interface */ require_once CODE_BASE."devices/inputTable/DriverInterface.php"; /** * Test class for HUGnetDB. * Generated by PHPUnit on 2007-12-13 at 10:28:11. * * @category Libraries * @package HUGnetLibTest * @subpackage SuiteBase * @author Scott Price <prices@hugllc.com> * @copyright 2014 Hunt Utilities Group, LLC * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version Release: 0.14.3 * @link http://dev.hugllc.com/index.php/Project:HUGnetLib */ class DriverVirtualTest extends drivers\DriverTestBase { /** This is the class we are testing */ protected $class = "DriverVirtualTestClass"; /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @access protected * * @return null */ protected function setUp() { $sensor = new \HUGnet\DummyBase("Sensor"); $sensor->resetMock(array()); $this->o = DriverVirtual::factory( "DriverVirtualTestClass", $sensor ); } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. * * @access protected * * @return null */ protected function tearDown() { unset($this->o); } /** * data provider for testDeviceID * * @return array */ public static function dataPresent() { return array( array( "ThisIsABadName", false, ), array( "unitType", true, ), array( "storageType", true, ), array( "testParam", true, ), ); } /** * test the set routine when an extra class exists * * @param string $name The name of the variable to test. * @param array $expect The expected return * * @return null * * @dataProvider dataPresent */ public function testPresent($name, $expect) { $this->assertSame($expect, $this->o->present($name, 1)); } /** * data provider for testDeviceID * * @return array */ public static function dataGet() { return array( array( "ThisIsABadName", array(), null, ), array( "storageType", array(), \HUGnet\devices\datachan\Driver::TYPE_RAW, ), array( "testParam", array(), "12345", ), array( "unitType", array(), 'asdf', ), ); } /** * test the set routine when an extra class exists * * @param string $name The name of the variable to test. * @param array $mock The mocks to use * @param array $expect The expected return * * @return null * * @dataProvider dataGet */ public function testGet($name, $mock, $expect) { $this->assertSame($expect, $this->o->get($name, 1)); } /** * Data provider for testGetReading * * testGetReading($sensor, $A, $deltaT, $data, $prev, $expect) * * @return array */ public static function dataGetReading() { return array( array( array( "Sensor" => array( "get" => array( "location" => "asdf", ), ), ), 256210, 1, array(), array(), array( array( "value" => null, "decimals" => 2, "units" => "unknown", "maxDecimals" => 2, "storageUnit" => "unknown", "unitType" => "asdf", "dataType" => "raw", "label" => "asdf", "index" => 0, "epChannel" => false, "port" => null, "raw" => null, ), ), ), ); } /** * Generic function for testing sensor routines * * This is called by using parent::sensorTest() * * @param array $sensor The sensor data array * @param mixed $A Data for the sensor to work on * @param float $deltaT The time differenct * @param array $data The data array being built * @param array $prev The previous record * @param mixed $expect The return data to expect * @param int $channel The channel to test * * @return null * * @dataProvider dataGetReading() */ public function testGetReading( $sensor, $A, $deltaT, $data, $prev, $expect, $channel = 0 ) { $sen = new \HUGnet\DummyBase("Sensor"); $sen->resetMock($sensor); $chan = 0; $ret = $this->o->decodeData($A, $chan, $deltaT, $data, $prev); $this->assertEquals($expect, $ret, 0.00001); } /** * Data provider for testEncodeData * * @return array */ public static function dataEncodeDataPoint() { return array( array( // #0 array( "Sensor" => array( "id" => 1, "get" => array( "sensor" => 2, "extra" => array(), ), ), ), "", 1, array(), array(), 14.314713, 0, ), ); } /** * data provider for testChannels * * @return array */ public static function dataChannels() { return array( array( array( ), "", array( array( 'decimals' => 2, 'units' => 'unknown', 'maxDecimals' => 2, 'storageUnit' => 'unknown', 'unitType' => 'asdf', 'dataType' => 'raw', 'label' => '', 'index' => 0, 'epChannel' => false, 'port' => null, ), ), ), ); } } /** This is the HUGnet namespace */ namespace HUGnet\devices\inputTable\drivers; /** * Base driver class for devices. * * This class deals with loading the drivers and figuring out what driver needs * to be loaded. * * @category Libraries * @package HUGnetLib * @subpackage Devices * @author Scott Price <prices@hugllc.com> * @copyright 2014 Hunt Utilities Group, LLC * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version Release: 0.14.3 * @link http://dev.hugllc.com/index.php/Project:HUGnetLib * @since 0.9.7 */ class DriverVirtualTestClass extends \HUGnet\devices\inputTable\DriverVirtual implements \HUGnet\devices\inputTable\DriverInterface { /** * This is where the data for the driver is stored. This array must be * put into all derivative classes, even if it is empty. */ protected $params = array( "longName" => "Unknown Sensor", "shortName" => "Unknown", "unitType" => "asdf", /* This is for test value only */ "testParam" => "12345", /* This is for test value only */ "extraDefault" => array(2,3,5,7,11), "extraText" => array("a","b","c","d","e"), "extraDesc" => array("A","B","C","D","E"), "extraValues" => array(5, 5, 5, 5, 5), ); /** * Gets the extra values * * @param int $index The extra index to use * * @return The extra value (or default if empty) */ public function getExtra($index) { return parent::getExtra($index); } /** * Changes a raw reading into a output value * * @param int $A Output of the A to D converter * @param float $deltaT The time delta in seconds between this record * @param array &$data The data from the other sensors that were crunched * @param mixed $prev The previous value for this sensor * * @return mixed The value in whatever the units are in the sensor * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function getReading( $A, $deltaT = 0, &$data = array(), $prev = null ) { return null; } } ?>
hugllc/HUGnetLib
test/suite/devices/inputTable/DriverVirtualTest.php
PHP
gpl-3.0
10,696
<?php /** * Display the upload transaction file screen * * @author Fabrice Douteaud <admin@clearbudget.net> * @package snippets * @access public */ /*********************************************************************** Copyright (C) 2008 Fabrice Douteaud (admin@clearbudget.net) This file is part of ClearBudget. ClearBudget 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. ClearBudget 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 ClearBudget. If not, see <http://www.gnu.org/licenses/>. ************************************************************************/ //prevent direct access if(!defined('ENGINEON')) die('Direct access forbidden'); ?> <h2><img src="style/icons/table_add.png"/> <?php echo $keys->pageTitle_UploadQif; ?></h2> <form id="QIFUploadForm" enctype="multipart/form-data" action="" method="POST"> <div id="qifUploadError" style="display: none" class="error"><blockquote><?php echo $keys->error_UploadQif; ?>: <span id="qifUploadErrorText"></span></blockquote></div> <table class="tableReport"> <tr> <td colspan="3"> <span id="qifUploadLoading" style="display:none;"><?php echo $keys->text_pageUploadQifLoading; ?></span> <span id="qifUploadResultCount" style="display:none; color: #3A7;"></span> </td> </tr> <tr> <td style="width: 350px"> <input name="MAX_FILE_SIZE" value="300000" type="hidden" /> <input name="action" id="action" value="uploadQifSubmit" type="hidden" /> <input name="datafile" id="fileToUpload" type="file" size="60"/> </td> <td style="width: 300px"> <?php echo $keys->text_dateFormat; ?>: <input type="radio" name="QIFLocaleType" id="QIFLocaleType" value="us" checked>MM/DD/YYYY <input type="radio" name="QIFLocaleType" id="QIFLocaleType" value="eu">DD/MM/YYYY </td> <td style="width: 150px"> <span class="jqUploader" id="jqUploader"> <button class="button" id="buttonUpload" onclick="return ajaxFileUpload();"><?php echo $keys->text_SendButton;?></button> </span> </td> </td> </tr> <!-- <tr> <td colspan="3"><small><?php echo $keys->text_qifFile; ?></small></td> </tr> --> </table> </form> <div id="importDetails"></div> <br/>
thunderace/clearbudget
snippets/uploadQif.php
PHP
gpl-3.0
2,711
<?php namespace common\modules\prj\models; use Yii; /** * This is the model class for table "{{%prj_burden_cost_base}}". * * @property string $prj_burden_cost_base_id * @property string $cost_base * @property string $description * @property string $cost_base_type * @property string $effective_from * @property string $effective_to * @property integer $priority * @property integer $created_by * @property string $creation_date * @property integer $last_update_by * @property string $last_update_date * @property integer $company_id */ class PrjBurdenCostBase extends \yii\db\ActiveRecord { /** * @inheritdoc */ public static function tableName() { return '{{%prj_burden_cost_base}}'; } /** * @inheritdoc */ public function rules() { return [ [['cost_base', 'created_by', 'last_update_by'], 'required'], [['effective_from', 'effective_to', 'creation_date', 'last_update_date'], 'safe'], [['priority', 'created_by', 'last_update_by', 'company_id'], 'integer'], [['cost_base', 'cost_base_type'], 'string', 'max' => 25], [['description'], 'string', 'max' => 255], [['cost_base'], 'unique'], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'prj_burden_cost_base_id' => Yii::t('app', 'Prj Burden Cost Base ID'), 'cost_base' => Yii::t('app', 'Cost Base'), 'description' => Yii::t('app', 'Description'), 'cost_base_type' => Yii::t('app', 'Cost Base Type'), 'effective_from' => Yii::t('app', 'Effective From'), 'effective_to' => Yii::t('app', 'Effective To'), 'priority' => Yii::t('app', 'Priority'), 'created_by' => Yii::t('app', 'Created By'), 'creation_date' => Yii::t('app', 'Creation Date'), 'last_update_by' => Yii::t('app', 'Last Update By'), 'last_update_date' => Yii::t('app', 'Last Update Date'), 'company_id' => Yii::t('app', 'Company ID'), ]; } }
zeddarn/yinoerp
_protected/common/modules/prj/models/PrjBurdenCostBase.php
PHP
gpl-3.0
2,128
--- layout: page title: About permalink: /about/ --- #### Tagline Your tagline. #### Introduction Introduce yourself. #### This theme This [jekyll](https://jekyllrb.com) theme is based on [materialize](http://materializecss.com). For more detail, you can view the github repo: [mumuxme/materialize-jekyll](https://github.com/mumuxme/materialize-jekyll) #### License Copyright&nbsp;&copy;&nbsp;{{ site.author }} - - - If any <b>question</b>, please send an <b>email</b> to me or just open an <b>issue</b> on the github repository. As for all articles(except reference) are under [CC Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/), you are free to <b>share</b> and <b>adapt</b> for any purpose. - - - #### Personal information Email: {{ site.email }}
mumuxme/materialize-jekyll
about.md
Markdown
gpl-3.0
817
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Global median</title> <link rel="stylesheet" href="../../../boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> <link rel="home" href="../../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> <link rel="up" href="../../../accumulators/reference.html#header.boost.accumulators.statistics.median_hpp" title="Header &lt;boost/accumulators/statistics/median.hpp&gt;"> <link rel="prev" href="../feature_of_tag_immediat_id553581.html" title="Struct template feature_of&lt;tag::immediate_weighted_mean_of_variates&lt; VariateType, VariateTag &gt;&gt;"> <link rel="next" href="with_density_median.html" title="Global with_density_median"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> <td align="center"><a href="../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="../feature_of_tag_immediat_id553581.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../accumulators/reference.html#header.boost.accumulators.statistics.median_hpp"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="with_density_median.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a> </div> <div class="refentry" title="Global median"> <a name="boost.accumulators.extract.median"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Global median</span></h2> <p>boost::accumulators::extract::median</p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="emphasis"><em>// In header: &lt;<a class="link" href="../../../accumulators/reference.html#header.boost.accumulators.statistics.median_hpp" title="Header &lt;boost/accumulators/statistics/median.hpp&gt;">boost/accumulators/statistics/median.hpp</a>&gt; </em></span><a class="link" href="../extractor.html" title="Struct template extractor">extractor</a>&lt; <a class="link" href="../tag/median.html" title="Struct median">tag::median</a> &gt; const median;</pre></div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2005, 2006 Eric Niebler<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="../feature_of_tag_immediat_id553581.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../accumulators/reference.html#header.boost.accumulators.statistics.median_hpp"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="with_density_median.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a> </div> </body> </html>
kelvindk/Video-Stabilization
boost_1_42_0/doc/html/boost/accumulators/extract/median.html
HTML
gpl-3.0
4,034
<span class="fright"> <?php if($this->phpsession->get('menu_type') == FRONT_END_MENU):?> <a class="button back" href="/dashboard/menu/<?php echo isset($lang) && $lang != '' ? $lang :$this->phpsession->get('current_menus_lang'); ?>"><em>&nbsp;</em>Quay lại trang Menu</a> <?php endif;?> <?php if($this->phpsession->get('menu_type') == BACK_END_MENU):?> <a class="button back" href="/dashboard/menu-admin/<?php echo isset($lang) && $lang != '' ? $lang :$this->phpsession->get('current_menus_lang'); ?>" ><em>&nbsp;</em>Quay lại trang Menu</a> <?php endif;?> </span>
dzung2t/noithatgo
ci_app/modules/menus/views/admin/back-menu-nav.php
PHP
gpl-3.0
591
var express = require('express'); var router = express.Router(); var seminar = require('../controllers/seminar.controllers'); router.get('/', function(req, res) { res.json({status: false, message: 'None API Implemented'}); }); router.get('/user/:id', function(req, res) { seminar.get(req, res); }); // router.get('/seminar/:id', function(req, res) { // seminar.getById(req, res); // }); router.get('/all', function(req, res) { seminar.getAll(req, res); }); router.post('/register', function(req, res) { seminar.register(req, res); }); router.delete('/delete', function(req, res) { seminar.delete(req, res); }); router.post('/attend', function(req, res) { seminar.attend(req, res); }); module.exports = router;
Rajamuda/ittoday-2017
api/routes/seminar.routes.js
JavaScript
gpl-3.0
733