text
stringlengths
2
100k
meta
dict
/* * NOTE: This copyright does *not* cover user programs that use HQ * program services by normal system calls through the application * program interfaces provided as part of the Hyperic Plug-in Development * Kit or the Hyperic Client Development Kit - this is merely considered * normal use of the program, and does *not* fall under the heading of * "derived work". * * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify * it under the terms version 2 of the GNU General Public License 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. */ package org.hyperic.hq.galerts.server.session; import java.util.Collection; import java.util.Iterator; import java.util.ResourceBundle; import org.hyperic.hq.authz.server.session.AuthzSubject; import org.hyperic.hq.context.Bootstrap; import org.hyperic.hq.escalation.server.session.Escalatable; import org.hyperic.hq.escalation.server.session.Escalation; import org.hyperic.hq.escalation.server.session.EscalationAlertType; import org.hyperic.hq.escalation.server.session.EscalationStateChange; import org.hyperic.hq.escalation.server.session.PerformsEscalations; import org.hyperic.hq.events.server.session.Action; import org.hyperic.hq.galerts.shared.GalertManager; public final class GalertEscalationAlertType extends EscalationAlertType { private static final String BUNDLE = "org.hyperic.hq.galerts.Resources"; public static final GalertEscalationAlertType GALERT = new GalertEscalationAlertType(0xbadbabe, "Group Alert", "escalation.type.galert"); private GalertManager getGalertMan() { return Bootstrap.getBean(GalertManager.class); } public Escalatable findEscalatable(Integer id) { return getGalertMan().findEscalatableAlert(id); } public PerformsEscalations findDefinition(Integer defId) { return getGalertMan().findById(defId); } protected void setEscalation(Integer defId, Escalation escalation) { GalertManager gMan = getGalertMan(); GalertDef def = gMan.findById(defId); gMan.update(def, escalation); } protected void changeAlertState(Escalatable esc, AuthzSubject who, EscalationStateChange newState) { GalertLog alert = (GalertLog) esc.getAlertInfo(); if (newState.isFixed()) { GalertManager gAlertMan = getGalertMan(); gAlertMan.fixAlert(alert); // HQ-1207: Reset the internal state of the group alert // after it is marked as fixed so the alert will not // be triggered off of old events. gAlertMan.reloadAlertDef(alert.getAlertDef()); } } protected void logActionDetails(Escalatable esc, Action action, String detail, AuthzSubject subject) { GalertLog alert = (GalertLog) esc.getAlertInfo(); getGalertMan().createActionLog(alert, detail, action, subject); } private GalertEscalationAlertType(int code, String desc, String localeProp){ super(code, desc, localeProp, ResourceBundle.getBundle(BUNDLE)); } protected String getLastFixedNote(PerformsEscalations def) { GalertLog alert = getGalertMan().findLastFixedByDef((GalertDef) def); if (alert != null) { long lastlog = 0; String fixedNote = null; for (Iterator it = alert.getActionLog().iterator(); it.hasNext(); ) { GalertActionLog log = (GalertActionLog) it.next(); if (log.getAction() == null && log.getTimeStamp() > lastlog) { fixedNote = log.getDetail(); } } return fixedNote; } return null; } protected Collection getPerformersOfEscalation(Escalation escalation) { return getGalertMan().getUsing(escalation); } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ #include "precompiled.hpp" #include "gc/z/zMapper_windows.hpp" #include "gc/z/zSyscall_windows.hpp" #include "logging/log.hpp" #include "utilities/debug.hpp" #include <Windows.h> // Memory reservation, commit, views, and placeholders. // // To be able to up-front reserve address space for the heap views, and later // multi-map the heap views to the same physical memory, without ever losing the // reservation of the reserved address space, we use "placeholders". // // These placeholders block out the address space from being used by other parts // of the process. To commit memory in this address space, the placeholder must // be replaced by anonymous memory, or replaced by mapping a view against a // paging file mapping. We use the later to support multi-mapping. // // We want to be able to dynamically commit and uncommit the physical memory of // the heap (and also unmap ZPages), in granules of ZGranuleSize bytes. There is // no way to grow and shrink the committed memory of a paging file mapping. // Therefore, we create multiple granule-sized page file mappings. The memory is // committed by creating a page file mapping, map a view against it, commit the // memory, unmap the view. The memory will stay committed until all views are // unmapped, and the paging file mapping handle is closed. // // When replacing a placeholder address space reservation with a mapped view // against a paging file mapping, the virtual address space must exactly match // an existing placeholder's address and size. Therefore we only deal with // granule-sized placeholders at this layer. Higher layers that keep track of // reserved available address space can (and will) coalesce placeholders, but // they will be split before being used. #define fatal_error(msg, addr, size) \ fatal(msg ": " PTR_FORMAT " " SIZE_FORMAT "M (%d)", \ (addr), (size) / M, GetLastError()) uintptr_t ZMapper::reserve(uintptr_t addr, size_t size) { void* const res = ZSyscall::VirtualAlloc2( GetCurrentProcess(), // Process (void*)addr, // BaseAddress size, // Size MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, // AllocationType PAGE_NOACCESS, // PageProtection NULL, // ExtendedParameters 0 // ParameterCount ); // Caller responsible for error handling return (uintptr_t)res; } void ZMapper::unreserve(uintptr_t addr, size_t size) { const bool res = ZSyscall::VirtualFreeEx( GetCurrentProcess(), // hProcess (void*)addr, // lpAddress size, // dwSize MEM_RELEASE // dwFreeType ); if (!res) { fatal_error("Failed to unreserve memory", addr, size); } } HANDLE ZMapper::create_paging_file_mapping(size_t size) { // Create mapping with SEC_RESERVE instead of SEC_COMMIT. // // We use MapViewOfFile3 for two different reasons: // 1) When commiting memory for the created paging file // 2) When mapping a view of the memory created in (2) // // The non-platform code is only setup to deal with out-of-memory // errors in (1). By using SEC_RESERVE, we prevent MapViewOfFile3 // from failing because of "commit limit" checks. To actually commit // memory in (1), a call to VirtualAlloc2 is done. HANDLE const res = ZSyscall::CreateFileMappingW( INVALID_HANDLE_VALUE, // hFile NULL, // lpFileMappingAttribute PAGE_READWRITE | SEC_RESERVE, // flProtect size >> 32, // dwMaximumSizeHigh size & 0xFFFFFFFF, // dwMaximumSizeLow NULL // lpName ); // Caller responsible for error handling return res; } bool ZMapper::commit_paging_file_mapping(HANDLE file_handle, uintptr_t file_offset, size_t size) { const uintptr_t addr = map_view_no_placeholder(file_handle, file_offset, size); if (addr == 0) { log_error(gc)("Failed to map view of paging file mapping (%d)", GetLastError()); return false; } const uintptr_t res = commit(addr, size); if (res != addr) { log_error(gc)("Failed to commit memory (%d)", GetLastError()); } unmap_view_no_placeholder(addr, size); return res == addr; } uintptr_t ZMapper::map_view_no_placeholder(HANDLE file_handle, uintptr_t file_offset, size_t size) { void* const res = ZSyscall::MapViewOfFile3( file_handle, // FileMapping GetCurrentProcess(), // ProcessHandle NULL, // BaseAddress file_offset, // Offset size, // ViewSize 0, // AllocationType PAGE_NOACCESS, // PageProtection NULL, // ExtendedParameters 0 // ParameterCount ); // Caller responsible for error handling return (uintptr_t)res; } void ZMapper::unmap_view_no_placeholder(uintptr_t addr, size_t size) { const bool res = ZSyscall::UnmapViewOfFile2( GetCurrentProcess(), // ProcessHandle (void*)addr, // BaseAddress 0 // UnmapFlags ); if (!res) { fatal_error("Failed to unmap memory", addr, size); } } uintptr_t ZMapper::commit(uintptr_t addr, size_t size) { void* const res = ZSyscall::VirtualAlloc2( GetCurrentProcess(), // Process (void*)addr, // BaseAddress size, // Size MEM_COMMIT, // AllocationType PAGE_NOACCESS, // PageProtection NULL, // ExtendedParameters 0 // ParameterCount ); // Caller responsible for error handling return (uintptr_t)res; } HANDLE ZMapper::create_and_commit_paging_file_mapping(size_t size) { HANDLE const file_handle = create_paging_file_mapping(size); if (file_handle == 0) { log_error(gc)("Failed to create paging file mapping (%d)", GetLastError()); return 0; } const bool res = commit_paging_file_mapping(file_handle, 0 /* file_offset */, size); if (!res) { close_paging_file_mapping(file_handle); return 0; } return file_handle; } void ZMapper::close_paging_file_mapping(HANDLE file_handle) { const bool res = CloseHandle( file_handle // hObject ); if (!res) { fatal("Failed to close paging file handle (%d)", GetLastError()); } } void ZMapper::split_placeholder(uintptr_t addr, size_t size) { const bool res = VirtualFree( (void*)addr, // lpAddress size, // dwSize MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER // dwFreeType ); if (!res) { fatal_error("Failed to split placeholder", addr, size); } } void ZMapper::coalesce_placeholders(uintptr_t addr, size_t size) { const bool res = VirtualFree( (void*)addr, // lpAddress size, // dwSize MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS // dwFreeType ); if (!res) { fatal_error("Failed to coalesce placeholders", addr, size); } } void ZMapper::map_view_replace_placeholder(HANDLE file_handle, uintptr_t file_offset, uintptr_t addr, size_t size) { void* const res = ZSyscall::MapViewOfFile3( file_handle, // FileMapping GetCurrentProcess(), // ProcessHandle (void*)addr, // BaseAddress file_offset, // Offset size, // ViewSize MEM_REPLACE_PLACEHOLDER, // AllocationType PAGE_READWRITE, // PageProtection NULL, // ExtendedParameters 0 // ParameterCount ); if (res == NULL) { fatal_error("Failed to map memory", addr, size); } } void ZMapper::unmap_view_preserve_placeholder(uintptr_t addr, size_t size) { const bool res = ZSyscall::UnmapViewOfFile2( GetCurrentProcess(), // ProcessHandle (void*)addr, // BaseAddress MEM_PRESERVE_PLACEHOLDER // UnmapFlags ); if (!res) { fatal_error("Failed to unmap memory", addr, size); } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <Workspace version = "1.0"> <FileRef location = "self:YBSlantedCollectionViewLayout.xcodeproj"> </FileRef> </Workspace>
{ "pile_set_name": "Github" }
package com.redknot.activity; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import com.redknot.adapter.FragmentAdapter; import com.redknot.domain.FractalItem; import com.redknot.domain.Tab; import com.redknot.fractalandroid.FractalActivity; import com.redknot.fractalandroid.R; import com.redknot.fragment.MainFragment; import com.redknot.g.G; import com.redknot.setting.JuliaSetting; import com.redknot.setting.Tree2Setting; import com.redknot.util.ID; import java.util.ArrayList; import java.util.List; public class ListActivity extends AppCompatActivity { private TabLayout main_tablayout; private ViewPager main_viewpage; private FragmentAdapter fragmentAdapter; private List<FractalItem> list = new ArrayList<>(); private List<Tab> tabList = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_list); /*Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle("Fractal"); setSupportActionBar(toolbar);*/ main_tablayout = (TabLayout) findViewById(R.id.main_tablayout); main_viewpage = (ViewPager) findViewById(R.id.main_viewpage); tabList.add(new Tab("Geometry", new MainFragment(1))); tabList.add(new Tab("Set", new MainFragment(2))); fragmentAdapter = new FragmentAdapter(getSupportFragmentManager(), tabList); main_viewpage.setAdapter(fragmentAdapter); main_tablayout.setupWithViewPager(main_viewpage); main_tablayout.setTabsFromPagerAdapter(fragmentAdapter); } }
{ "pile_set_name": "Github" }
<!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 (version 1.7.0_121) on Thu Feb 02 18:54:44 CET 2017 --> <title>MultiRootFileSet.SetType (Apache Ant API)</title> <meta name="date" content="2017-02-02"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="MultiRootFileSet.SetType (Apache Ant API)"; } } 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><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li 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="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.html" title="class in org.apache.tools.ant.types.resources"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../../../org/apache/tools/ant/types/resources/PropertyResource.html" title="class in org.apache.tools.ant.types.resources"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" target="_top">Frames</a></li> <li><a href="MultiRootFileSet.SetType.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#enum_constant_summary">Enum Constants</a>&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#enum_constant_detail">Enum Constants</a>&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.apache.tools.ant.types.resources</div> <h2 title="Enum MultiRootFileSet.SetType" class="title">Enum MultiRootFileSet.SetType</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>java.lang.Enum&lt;<a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" title="enum in org.apache.tools.ant.types.resources">MultiRootFileSet.SetType</a>&gt;</li> <li> <ul class="inheritance"> <li>org.apache.tools.ant.types.resources.MultiRootFileSet.SetType</li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd>java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" title="enum in org.apache.tools.ant.types.resources">MultiRootFileSet.SetType</a>&gt;</dd> </dl> <dl> <dt>Enclosing class:</dt> <dd><a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.html" title="class in org.apache.tools.ant.types.resources">MultiRootFileSet</a></dd> </dl> <hr> <br> <pre>public static enum <span class="strong">MultiRootFileSet.SetType</span> extends java.lang.Enum&lt;<a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" title="enum in org.apache.tools.ant.types.resources">MultiRootFileSet.SetType</a>&gt;</pre> <div class="block">What to return from the set: files, directories or both.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- =========== ENUM CONSTANT SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="enum_constant_summary"> <!-- --> </a> <h3>Enum Constant Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Constant Summary table, listing enum constants, and an explanation"> <caption><span>Enum Constants</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Enum Constant and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html#both">both</a></strong></code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colOne"><code><strong><a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html#dir">dir</a></strong></code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html#file">file</a></strong></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="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" title="enum in org.apache.tools.ant.types.resources">MultiRootFileSet.SetType</a></code></td> <td class="colLast"><code><strong><a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html#valueOf(java.lang.String)">valueOf</a></strong>(java.lang.String&nbsp;name)</code> <div class="block">Returns the enum constant of this type with the specified name.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static <a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" title="enum in org.apache.tools.ant.types.resources">MultiRootFileSet.SetType</a>[]</code></td> <td class="colLast"><code><strong><a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html#values()">values</a></strong>()</code> <div class="block">Returns an array containing the constants of this enum type, in the order they are declared.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.lang.Enum"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Enum</h3> <code>clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf</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>getClass, notify, notifyAll, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ ENUM CONSTANT DETAIL =========== --> <ul class="blockList"> <li class="blockList"><a name="enum_constant_detail"> <!-- --> </a> <h3>Enum Constant Detail</h3> <a name="file"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>file</h4> <pre>public static final&nbsp;<a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" title="enum in org.apache.tools.ant.types.resources">MultiRootFileSet.SetType</a> file</pre> </li> </ul> <a name="dir"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>dir</h4> <pre>public static final&nbsp;<a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" title="enum in org.apache.tools.ant.types.resources">MultiRootFileSet.SetType</a> dir</pre> </li> </ul> <a name="both"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>both</h4> <pre>public static final&nbsp;<a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" title="enum in org.apache.tools.ant.types.resources">MultiRootFileSet.SetType</a> both</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="values()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>values</h4> <pre>public static&nbsp;<a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" title="enum in org.apache.tools.ant.types.resources">MultiRootFileSet.SetType</a>[]&nbsp;values()</pre> <div class="block">Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows: <pre> for (MultiRootFileSet.SetType c : MultiRootFileSet.SetType.values()) &nbsp; System.out.println(c); </pre></div> <dl><dt><span class="strong">Returns:</span></dt><dd>an array containing the constants of this enum type, in the order they are declared</dd></dl> </li> </ul> <a name="valueOf(java.lang.String)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>valueOf</h4> <pre>public static&nbsp;<a href="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" title="enum in org.apache.tools.ant.types.resources">MultiRootFileSet.SetType</a>&nbsp;valueOf(java.lang.String&nbsp;name)</pre> <div class="block">Returns the enum constant of this type with the specified name. The string must match <i>exactly</i> an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - the name of the enum constant to be returned.</dd> <dt><span class="strong">Returns:</span></dt><dd>the enum constant with the specified name</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.lang.IllegalArgumentException</code> - if this enum type has no constant with the specified name</dd> <dd><code>java.lang.NullPointerException</code> - if the argument is null</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><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li 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="../../../../../../org/apache/tools/ant/types/resources/MultiRootFileSet.html" title="class in org.apache.tools.ant.types.resources"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../../../org/apache/tools/ant/types/resources/PropertyResource.html" title="class in org.apache.tools.ant.types.resources"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/apache/tools/ant/types/resources/MultiRootFileSet.SetType.html" target="_top">Frames</a></li> <li><a href="MultiRootFileSet.SetType.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#enum_constant_summary">Enum Constants</a>&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#enum_constant_detail">Enum Constants</a>&nbsp;|&nbsp;</li> <li>Field&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>
{ "pile_set_name": "Github" }
// Copyright (c) 2015-2020 Vladimir Schneider <[email protected]> Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.vladsch.md.nav.psi.element; import org.jetbrains.annotations.NotNull; public interface MdLinkRefElement extends MdRenameElement { @NotNull String getNameWithAnchor(); @NotNull String getFileName(); @NotNull String getFileNameWithAnchor(); }
{ "pile_set_name": "Github" }
# created by tools/tclZIC.tcl - do not edit set TZData(:Etc/GMT-14) { {-9223372036854775808 50400 0 +14} }
{ "pile_set_name": "Github" }
/** * Copyright 2017-2018 Gregory Moyer and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.openhab.binding.lametrictime.api.impl; import java.net.URI; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; public class HTTPIcon extends AbstractDataIcon { private final URI uri; public HTTPIcon(String uri) { this(URI.create(uri)); } public HTTPIcon(URI uri) { this.uri = uri; } @Override protected void populateFields() { Client client = ClientBuilder.newBuilder().build(); Response response = client.target(uri).request().get(); setType(response.getMediaType().toString()); setData(response.readEntity(byte[].class)); } }
{ "pile_set_name": "Github" }
#ifndef XFS_DISCARD_H #define XFS_DISCARD_H 1 struct fstrim_range; struct list_head; extern int xfs_ioc_trim(struct xfs_mount *, struct fstrim_range __user *); extern int xfs_discard_extents(struct xfs_mount *, struct list_head *); #endif /* XFS_DISCARD_H */
{ "pile_set_name": "Github" }
# -------------------------------------------------------- # Relation Networks for Object Detection # Copyright (c) 2017 Microsoft # Licensed under The MIT License [see LICENSE for details] # Modified by Jiayuan Gu, Dazhi Cheng, Yuwen Xiong # -------------------------------------------------------- # Based on: # MX-RCNN # Copyright (c) 2016 by Contributors # Licence under The Apache 2.0 License # https://github.com/ijkguo/mx-rcnn/ # -------------------------------------------------------- import _init_paths import argparse import os import sys import time import logging from config.config import config, update_config def parse_args(): parser = argparse.ArgumentParser(description='Test a Faster R-CNN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) # rcnn parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true') parser.add_argument('--thresh', help='valid detection threshold', default=1e-3, type=float) parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true') parser.add_argument('--test_epoch', help='the epoch model to be test', default=config.TEST.test_epoch, type=int) # nms parser.add_argument('--nms', help='params for nms or softnms', default=config.TEST.NMS, type=float) parser.add_argument('--softnms', help='whether to enable softnms', default=config.TEST.SOFTNMS, action='store_true') parser.add_argument('--naive_nms', help='whether to enable naive nms', default=False, action='store_true') parser.add_argument('--first_n', help='first_n for learn nms or nms', default=config.TEST.FIRST_N, type=int) parser.add_argument('--merge', help='merge method for learn nms', default=config.TEST.MERGE_METHOD, type=int) parser.add_argument('--debug', help='whether to enable debug mode', default=False, action='store_true') # dataset parser.add_argument('--test_set', help='which set to be tested', default=config.dataset.test_image_set, type=str) args, rest = parser.parse_known_args() # update config config.TEST.test_epoch = args.test_epoch config.TEST.NMS = args.nms config.TEST.SOFTNMS = args.softnms and (not args.naive_nms) config.TEST.FIRST_N = args.first_n config.TEST.MERGE_METHOD = args.merge config.dataset.test_image_set = args.test_set return args args = parse_args() curr_path = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.join(curr_path, '../external/mxnet', config.MXNET_VERSION)) import mxnet as mx import numpy as np from function.test_rcnn import test_rcnn from utils.create_logger import create_logger def main(): ctx = [mx.gpu(int(i)) for i in config.gpus.split(',')] print args np.random.seed(0) mx.random.seed(0) logger, final_output_path = create_logger(config.output_path, args.cfg, config.dataset.test_image_set) test_rcnn(config, config.dataset.dataset, config.dataset.test_image_set, config.dataset.root_path, config.dataset.dataset_path, ctx, os.path.join(final_output_path, '..', '_'.join([iset for iset in config.dataset.image_set.split('+')]), config.TRAIN.model_prefix), config.TEST.test_epoch, args.vis, args.ignore_cache, args.shuffle, config.TEST.HAS_RPN, config.dataset.proposal, args.thresh, logger=logger, output_path=final_output_path) if __name__ == '__main__': main()
{ "pile_set_name": "Github" }
А Б В Г Ӷ Д Е Ж З Ӡ И К Қ Ҟ Л М Н О П Ԥ Р С Т Ҭ У Ф Х Ҳ Ц Ҵ Ч Ҷ Ҽ Ҿ Ш Ы Ҩ Џ Ь Ә а б в г ӷ д е ж з ӡ и к қ ҟ л м н о п ԥ р с т ҭ у ф х ҳ ц ҵ ч ҷ ҽ ҿ ш ы ҩ џ ь ә
{ "pile_set_name": "Github" }
/***************************************************************************/ /* */ /* cfftoken.h */ /* */ /* CFF token definitions (specification only). */ /* */ /* Copyright 1996-2003, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #undef FT_STRUCTURE #define FT_STRUCTURE CFF_FontRecDictRec #undef CFFCODE #define CFFCODE CFFCODE_TOPDICT CFF_FIELD_STRING ( 0, version, "Version" ) CFF_FIELD_STRING ( 1, notice, "Notice" ) CFF_FIELD_STRING ( 0x100, copyright, "Copyright" ) CFF_FIELD_STRING ( 2, full_name, "FullName" ) CFF_FIELD_STRING ( 3, family_name, "FamilyName" ) CFF_FIELD_STRING ( 4, weight, "Weight" ) CFF_FIELD_BOOL ( 0x101, is_fixed_pitch, "isFixedPitch" ) CFF_FIELD_FIXED ( 0x102, italic_angle, "ItalicAngle" ) CFF_FIELD_FIXED ( 0x103, underline_position, "UnderlinePosition" ) CFF_FIELD_FIXED ( 0x104, underline_thickness, "UnderlineThickness" ) CFF_FIELD_NUM ( 0x105, paint_type, "PaintType" ) CFF_FIELD_NUM ( 0x106, charstring_type, "CharstringType" ) CFF_FIELD_CALLBACK( 0x107, font_matrix, "FontMatrix" ) CFF_FIELD_NUM ( 13, unique_id, "UniqueID" ) CFF_FIELD_CALLBACK( 5, font_bbox, "FontBBox" ) CFF_FIELD_NUM ( 0x108, stroke_width, "StrokeWidth" ) CFF_FIELD_NUM ( 15, charset_offset, "charset" ) CFF_FIELD_NUM ( 16, encoding_offset, "Encoding" ) CFF_FIELD_NUM ( 17, charstrings_offset, "CharStrings" ) CFF_FIELD_CALLBACK( 18, private_dict, "Private" ) CFF_FIELD_NUM ( 0x114, synthetic_base, "SyntheticBase" ) CFF_FIELD_STRING ( 0x115, embedded_postscript, "PostScript" ) #if 0 CFF_FIELD_STRING ( 0x116, base_font_name, "BaseFontName" ) CFF_FIELD_DELTA ( 0x117, base_font_blend, 16, "BaseFontBlend" ) CFF_FIELD_CALLBACK( 0x118, multiple_master, "MultipleMaster" ) CFF_FIELD_CALLBACK( 0x119, blend_axis_types, "BlendAxisTypes" ) #endif CFF_FIELD_CALLBACK( 0x11E, cid_ros, "ROS" ) CFF_FIELD_NUM ( 0x11F, cid_font_version, "CIDFontVersion" ) CFF_FIELD_NUM ( 0x120, cid_font_revision, "CIDFontRevision" ) CFF_FIELD_NUM ( 0x121, cid_font_type, "CIDFontType" ) CFF_FIELD_NUM ( 0x122, cid_count, "CIDCount" ) CFF_FIELD_NUM ( 0x123, cid_uid_base, "UIDBase" ) CFF_FIELD_NUM ( 0x124, cid_fd_array_offset, "FDArray" ) CFF_FIELD_NUM ( 0x125, cid_fd_select_offset, "FDSelect" ) CFF_FIELD_STRING ( 0x126, cid_font_name, "FontName" ) #if 0 CFF_FIELD_NUM ( 0x127, chameleon, "Chameleon" ) #endif #undef FT_STRUCTURE #define FT_STRUCTURE CFF_PrivateRec #undef CFFCODE #define CFFCODE CFFCODE_PRIVATE CFF_FIELD_DELTA ( 6, blue_values, 14, "BlueValues" ) CFF_FIELD_DELTA ( 7, other_blues, 10, "OtherBlues" ) CFF_FIELD_DELTA ( 8, family_blues, 14, "FamilyBlues" ) CFF_FIELD_DELTA ( 9, family_other_blues, 10, "FamilyOtherBlues" ) CFF_FIELD_FIXED_1000( 0x109, blue_scale, "BlueScale" ) CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" ) CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" ) CFF_FIELD_NUM ( 10, standard_width, "StdHW" ) CFF_FIELD_NUM ( 11, standard_height, "StdVW" ) CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" ) CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" ) CFF_FIELD_BOOL ( 0x10E, force_bold, "ForceBold" ) CFF_FIELD_FIXED ( 0x10F, force_bold_threshold, "ForceBoldThreshold" ) CFF_FIELD_NUM ( 0x110, lenIV, "lenIV" ) CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" ) CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" ) CFF_FIELD_NUM ( 0x113, initial_random_seed, "initialRandomSeed" ) CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" ) CFF_FIELD_NUM ( 20, default_width, "defaultWidthX" ) CFF_FIELD_NUM ( 21, nominal_width, "nominalWidthX" ) /* END */
{ "pile_set_name": "Github" }
/* * NOTE: This copyright does *not* cover user programs that use HQ * program services by normal system calls through the application * program interfaces provided as part of the Hyperic Plug-in Development * Kit or the Hyperic Client Development Kit - this is merely considered * normal use of the program, and does *not* fall under the heading of * "derived work". * * Copyright (C) [2004-2008], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify * it under the terms version 2 of the GNU General Public License 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. */ package org.hyperic.hq.appdef.server.session; import java.util.Collection; import org.hyperic.hq.appdef.shared.AppdefEntityConstants; import org.hyperic.hq.appdef.shared.AppdefResourceTypeValue; import org.hyperic.hq.authz.shared.AuthzConstants; public class ApplicationType extends AppdefResourceType { private Collection serviceTypes; private Collection applications; /** * default constructor */ public ApplicationType() { super(); } public ApplicationType(Integer id) { super(id); } public int getAuthzType() { return AuthzConstants.authzApplicationProto.intValue(); } // Property accessors public Collection getServiceTypes() { return this.serviceTypes; } public void setServiceTypes(Collection serviceTypes) { this.serviceTypes = serviceTypes; } public Collection getApplications() { return this.applications; } public void setApplications(Collection applications) { this.applications = applications; } public boolean equals(Object obj) { return (obj instanceof ApplicationType) && super.equals(obj); } public int getAppdefType() { return AppdefEntityConstants.APPDEF_TYPE_APPLICATION; } public AppdefResourceTypeValue getAppdefResourceTypeValue() { return new AppdefResourceTypeValue() { public int getAppdefType() { return AppdefEntityConstants.APPDEF_TYPE_APPLICATION; } public Long getCTime() { return new Long(ApplicationType.this.getCreationTime()); } public String getDescription() { return ApplicationType.this.getDescription(); } public Integer getId() { return ApplicationType.this.getId(); } public Long getMTime() { return new Long(ApplicationType.this.getModifiedTime()); } public String getName() { return ApplicationType.this.getName(); } public void setDescription(String desc) {} public void setId(Integer id) {} public void setName(String name) {} }; } }
{ "pile_set_name": "Github" }
'use strict'; module.exports = { NODE_ENV: '"production"', SWAGGER_URL: '""' }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <resources xmlns:tools="http://schemas.android.com/tools" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" tools:ignore="MissingTranslation"> <string name="ime_name">AnySoftKeyboard</string> <string name="debug_tracing_starting">Tracing started!\nMake sure you stop it at some point </string> <string name="debug_tracing_starting_failed">Tracing initiating failed! Check logcat for details. </string> <string name="debug_tracing_finished">Tracing finished!\nTrace file is <xliff:g id="trace_file">%s</xliff:g> </string> <string name="menu_about_item">Thông tin</string> <string name="how_to_pointer_title">Chào mừng đến với AnySoftKeyboard</string> <string name="change_log_card_version_title_template">\u0020\u0020Latest changes for v<xliff:g id="name">%s</xliff:g>\u0020\u0020 </string> <string name="change_log_entry_header_template_without_name">\u0020\u0020v<xliff:g id="code"> %s</xliff:g>\u0020\u0020 </string> <string name="change_log_url">More:\u0020 <xliff:g id="url">%s</xliff:g> </string> <string name="ime_name_beta">AnySoftKeyboard BETA</string> <string name="notification_text_testers">This is a beta version. Use with caution!</string> <string name="testers_version">Testers build!</string> <string name="language_root_tile">Language</string> <string name="language_keyboards_settings_tile">Enable keyboards and languages.</string> <string name="language_grammar_settings_tile">Configure correction behavior and other dictionaries. </string> <string name="language_tweaks_settings_tile">Tweaks and more.</string> <!-- UI root menu --> <string name="ui_root_tile">UI</string> <string name="ui_theme_settings_tile">Pick and configure keyboard themes.</string> <string name="ui_effects_settings_tile">Keyboard effects and experience.</string> <!-- welcome --> <!-- changelog --> <string name="changelog">Change Log</string> <string name="search_market_for_addons">Search for add-ons</string> <string name="search_market_for_keyboard_addons">Get more keyboards at the app store</string> <string name="search_market_for_quick_key_addons">Get more <i>Quick-Text</i> add-ons at the app store… </string> <!-- Indicates that a word has been added to the dictionary --> <!-- voice --> <!-- Options menu --> <!-- Dictionary override strings --> <!-- Dictionary override toast messages --> <!-- settings - effects--> <!-- settings - keyboard group --> <!-- settings - quick text keys --> <!-- settings - top generic row --> <!-- settings - bottom generic row --> <!-- extension keyboard type --> <!-- Tutorials --> <!-- Special soft keyboard keys text --> <!-- dictionaries --> <!-- User dictionary settings --> <!-- User dictionary settings, The titlebar text of the User dictionary settings screen. --> <!-- abbreviations editor --> <!-- User dictionary settings. The title of the dialog to add a new word to the user dictionary. --> <!-- User dictionary settings. The title of the dialog to edit an existing word in the user dictionary. --> <!-- User dictionary settings. The text to show when there are no user-defined words in the dictionary --> <!-- Strings for possible PreferenceActivity Back/Next buttons --> <!-- Optional button to Skip a PreferenceActivity [CHAR LIMIT=20] --> <!-- this URL should be localized - it should point to a web-site with information in the locale language. --> </resources>
{ "pile_set_name": "Github" }
define( "dojox/editor/plugins/nls/ar/PasteFromWord", ({ "pasteFromWord": "لصق من Word", "instructions": "لصق المحتويات من Word الى مربع النص بأسفل. بمجرد أن تكون راضيا عن المحتوى المراد ادراجه، اضغط على اختيار لصق. للتوقف عن ادراج النص، اضغط اختيار الغاء." }) );
{ "pile_set_name": "Github" }
============== Authentication ============== .. contents:: :local: Introduction ============ Websuna uses session-based authentication on the default settings (:py:class:`websauna.system.auth.policy.SessionAuthenticationPolicy`). When a user logs in the logged in user id is stored in the session. All anonymous user ``request.session`` variables are carried over to logged in session. Activating users ================ By default created user instances are not activated and thus cannot login. To activate user: .. code-block:: python from websauna.utils.time import now from websauna.system.user.models import User from websauna.system.user.utils import get_user_registry def my_view(request): u = User(email="[email protected]") password = None # Do not give password or give plain text entry here if password: # How to set a password on freshly created user user_registry = get_user_registry(request) user_registry.set_password(u, password) # Where did this user came to our site u.registration_source = "command_line" # Turn user activated u.activated_at = now() request.dbsession.add(u) Authenticating user =================== With username (email) and password ---------------------------------- See :py:meth:`websauna.system.user.loginservice.DefaultLoginService.check_credentials`. Without password check ---------------------- See :py:meth:`websauna.system.user.loginservice.DefaultLoginService.authenticate_user`. Invalidating session ==================== To protect against :term:`session fixation` attacks there exist :py:class:`websauna.system.user.events.UserAuthSensitiveOperation` event. * Always fire this event when you change user authentication sensitive details (email, password) * If you implement a custom session handling listen for this event and drop all user sessions on receiving it Disabling default log in and sign up views ========================================== pass
{ "pile_set_name": "Github" }
# typed: true # assert-slow-path: true class A extend T::Sig sig {params(x: Integer).returns(String)} def bar(x) x.to_s end sig{void} def foo end end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <preApproval> <name>Seguro Notebook</name> <code>C08984</code> <date>2011-11-23T13:40:00.000-02:00</date> <tracker>538C53</tracker> <status>CANCELLED</status> <reference>REF1234</reference> <lastEventDate>2011-11-25T20:04:00.000-02:00</lastEventDate> <charge>auto</charge> <sender> <name>Nome Comprador</name> <email>[email protected]</email> <phone> <areaCode>11</areaCode> <number>30389678</number> </phone> <address> <street>ALAMEDAITU</street> <number>78</number> <complement>ap.2601</complement> <district>J Paulista</district> <city>SAO PAULO</city> <state>SP</state> <country>BRA</country> <postalCode>01421000</postalCode> </address> </sender> </preApproval>
{ "pile_set_name": "Github" }
#tb 0: 1/5 #media_type 0: video #codec_id 0: rawvideo #dimensions 0: 320x240 #sar 0: 1/1 0, 0, 0, 1, 230400, 0x8c0018bb 0, 1, 1, 1, 230400, 0x8c0018bb 0, 2, 2, 1, 230400, 0x8c0018bb 0, 3, 3, 1, 230400, 0x8c0018bb 0, 4, 4, 1, 230400, 0x8c0018bb
{ "pile_set_name": "Github" }
function Set-ResourceDownload { <# .SYNOPSIS Downloads a (web) resource and creates a MD5 checksum. #> [CmdletBinding()] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions','')] param ( [Parameter(Mandatory, ValueFromPipeline)] [System.String] $DestinationPath, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [System.String] $Uri, [Parameter(ValueFromPipelineByPropertyName)] [AllowNull()] [System.String] $Checksum, [Parameter(ValueFromPipelineByPropertyName)] [System.UInt32] $BufferSize = 64KB, [Parameter(ValueFromPipelineByPropertyName)] [System.Management.Automation.SwitchParameter] $NoChecksum ##TODO: Support Headers and UserAgent ) begin { $parentDestinationPath = Split-Path -Path $DestinationPath -Parent; [ref] $null = New-Directory -Path $parentDestinationPath; } process { if (-not $PSBoundParameters.ContainsKey('BufferSize')) { $systemUri = New-Object -TypeName System.Uri -ArgumentList @($uri); if ($systemUri.IsFile) { $BufferSize = 1MB; } } Write-Verbose -Message ($localized.DownloadingResource -f $Uri, $DestinationPath); Invoke-WebClientDownload -DestinationPath $DestinationPath -Uri $Uri -BufferSize $BufferSize; if ($NoChecksum -eq $false) { ## Create the checksum file for future reference [ref] $null = Set-ResourceChecksum -Path $DestinationPath; } } #end process } #end function
{ "pile_set_name": "Github" }
(function() { var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-scss"); function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "scss"); } MT('url_with_quotation', "[tag foo] { [property background]:[atom url]([string test.jpg]) }"); MT('url_with_double_quotes', "[tag foo] { [property background]:[atom url]([string \"test.jpg\"]) }"); MT('url_with_single_quotes', "[tag foo] { [property background]:[atom url]([string \'test.jpg\']) }"); MT('string', "[def @import] [string \"compass/css3\"]"); MT('important_keyword', "[tag foo] { [property background]:[atom url]([string \'test.jpg\']) [keyword !important] }"); MT('variable', "[variable-2 $blue]:[atom #333]"); MT('variable_as_attribute', "[tag foo] { [property color]:[variable-2 $blue] }"); MT('numbers', "[tag foo] { [property padding]:[number 10px] [number 10] [number 10em] [number 8in] }"); MT('number_percentage', "[tag foo] { [property width]:[number 80%] }"); MT('selector', "[builtin #hello][qualifier .world]{}"); MT('singleline_comment', "[comment // this is a comment]"); MT('multiline_comment', "[comment /*foobar*/]"); MT('attribute_with_hyphen', "[tag foo] { [property font-size]:[number 10px] }"); MT('string_after_attribute', "[tag foo] { [property content]:[string \"::\"] }"); MT('directives', "[def @include] [qualifier .mixin]"); MT('basic_structure', "[tag p] { [property background]:[keyword red]; }"); MT('nested_structure', "[tag p] { [tag a] { [property color]:[keyword red]; } }"); MT('mixin', "[def @mixin] [tag table-base] {}"); MT('number_without_semicolon', "[tag p] {[property width]:[number 12]}", "[tag a] {[property color]:[keyword red];}"); MT('atom_in_nested_block', "[tag p] { [tag a] { [property color]:[atom #000]; } }"); MT('interpolation_in_property', "[tag foo] { #{[variable-2 $hello]}:[number 2]; }"); MT('interpolation_in_selector', "[tag foo]#{[variable-2 $hello]} { [property color]:[atom #000]; }"); MT('interpolation_error', "[tag foo]#{[error foo]} { [property color]:[atom #000]; }"); MT("divide_operator", "[tag foo] { [property width]:[number 4] [operator /] [number 2] }"); MT('nested_structure_with_id_selector', "[tag p] { [builtin #hello] { [property color]:[keyword red]; } }"); MT('indent_mixin', "[def @mixin] [tag container] (", " [variable-2 $a]: [number 10],", " [variable-2 $b]: [number 10])", "{}"); MT('indent_nested', "[tag foo] {", " [tag bar] {", " }", "}"); MT('indent_parentheses', "[tag foo] {", " [property color]: [variable darken]([variable-2 $blue],", " [number 9%]);", "}"); MT('indent_vardef', "[variable-2 $name]:", " [string 'val'];", "[tag tag] {", " [tag inner] {", " [property margin]: [number 3px];", " }", "}"); })();
{ "pile_set_name": "Github" }
/* PR middle-end/19551 */ extern void abort (); #define T(type, name) \ __attribute__((pure)) _Complex type \ foo_##name (int x) \ { \ _Complex type r; \ __real r = x + 1; \ __imag r = x - 1; \ return r; \ } \ \ void \ bar_##name (type *x) \ { \ *x = __real foo_##name (5); \ } \ \ void \ baz_##name (type *x) \ { \ *x = __imag foo_##name (5); \ } typedef long double ldouble_t; typedef long long llong; T (float, float) T (double, double) T (long double, ldouble_t) T (char, char) T (short, short) T (int, int) T (long, long) T (long long, llong) #undef T int main (void) { #define T(type, name) \ { \ type var = 0; \ bar_##name (&var); \ if (var != 6) \ abort (); \ var = 0; \ baz_##name (&var); \ if (var != 4) \ abort (); \ } T (float, float) T (double, double) T (long double, ldouble_t) T (char, char) T (short, short) T (int, int) T (long, long) T (long long, llong) return 0; }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" manifest="cll.appcache" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>14.2. The Four basic vowels</title> <link rel="stylesheet" type="text/css" href="final.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /> <link rel="home" href="index.html" title="The Complete Lojban Language" /> <link rel="up" href="chapter-connectives.html" title="Chapter 14. If Wishes Were Horses: The Lojban Connective System" /> <link rel="prev" href="chapter-connectives.html" title="Chapter 14. If Wishes Were Horses: The Lojban Connective System" /> <link rel="next" href="section-six-types.html" title="14.3. The six types of logical connectives" /> <script xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_HTMLorMML"></script> <meta xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" name="viewport" content="width=device-width, initial-scale=1" /> </head> <body> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="navheader"> <table width="100%" summary="Chapter Header"> <tr> <th colspan="3" align="center">Chapter 14. If Wishes Were Horses: The Lojban Connective System</th> </tr> </table> <table width="100%" summary="Navigation header"> <tr> <td width="50%" align="right"> <a accesskey="p" href="chapter-connectives.html">Prev: Chapter 14</a> </td> <td width="50%" align="left"> <a accesskey="n" href="section-six-types.html">Next: Section 14.3</a> </td> </tr> </table> </div> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="toc-link" align="center"> <a accesskey="h" href="index.html">Table of Contents</a> </div> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="back-to-info-link" align="center"> <a accesskey="b" href="http://www.lojban.org/cll">Book Info Page</a> </div> <hr xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" /> <div class="section"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="section-four-basics"></a>14.2. <a id="c14s2"></a>The Four basic vowels</h2> </div> </div> </div> <p><a id="idm47148549556528" class="indexterm"></a><a id="idm47148549555504" class="indexterm"></a><a id="idm47148549554352" class="indexterm"></a> Lojban regards four of these 16 truth functions as fundamental, and assigns them the four vowels <span class="logical-vowel">A</span>, <span class="logical-vowel">E</span>, <span class="logical-vowel">O</span>, and <span class="logical-vowel">U</span>. These letters do not represent actual cmavo or selma'o, but rather a component vowel from which actual logical-connective cmavo are built up, as explained in the next section. Here are the four vowels, their truth tables, and rough English equivalents: <a id="idm47148549549984" class="indexterm"></a> <a id="idm47148549548784" class="indexterm"></a> <a id="idm47148549547616" class="indexterm"></a> <a id="idm47148549546544" class="indexterm"></a> <a id="idm47148549545280" class="indexterm"></a></p> <div class="informaltable"> <table> <tr> <td> <span class="logical-vowel">A</span> </td> <td>TTTF</td> <td>or, and/or</td> </tr> <tr> <td> <span class="logical-vowel">E</span> </td> <td>TFFF</td> <td>and</td> </tr> <tr> <td> <span class="logical-vowel">O</span> </td> <td>TFFT</td> <td>if and only if</td> </tr> <tr> <td> <span class="logical-vowel">U</span> </td> <td>TTFF</td> <td>whether or not</td> </tr> </table> </div> <p>More precisely:</p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td><span class="logical-vowel">A</span> is true if either or both sentences are true</td> </tr> <tr> <td><span class="logical-vowel">E</span> is true if both sentences are true, but not otherwise</td> </tr> <tr> <td><span class="logical-vowel">O</span> is true if the sentences are both true or both false</td> </tr> <tr> <td><span class="logical-vowel">U</span> is true if the first sentence is true, regardless of the truth value of the second sentence</td> </tr> </table> <p><a id="idm47148549533904" class="indexterm"></a> With the four vowels, the ability to negate either sentence, and the ability to exchange the sentences, as if their order had been reversed, we can create all of the 16 possible truth functions except TTTT and FFFF, which are fairly useless anyway. The following table illustrates how to create each of the 14 remaining truth functions:</p> <div class="informaltable"> <table> <tr> <td>TTTF</td> <td> <span class="logical-vowel">A</span> </td> </tr> <tr> <td>TTFT</td> <td><span class="logical-vowel">A</span> with second sentence negated</td> </tr> <tr> <td>TTFF</td> <td> <span class="logical-vowel">U</span> </td> </tr> <tr> <td>TFTT</td> <td><span class="logical-vowel">A</span> with first sentence negated</td> </tr> <tr> <td>TFTF</td> <td><span class="logical-vowel">U</span> with sentences exchanged</td> </tr> <tr> <td>TFFT</td> <td> <span class="logical-vowel">O</span> </td> </tr> <tr> <td>TFFF</td> <td> <span class="logical-vowel">E</span> </td> </tr> <tr> <td>FTTT</td> <td><span class="logical-vowel">A</span> with both sentences negated</td> </tr> <tr> <td>FTTF</td> <td><span class="logical-vowel">O</span> with either first or second negated (not both)</td> </tr> <tr> <td>FTFT</td> <td><span class="logical-vowel">U</span> with sentences exchanged and then second negated</td> </tr> <tr> <td>FTFF</td> <td><span class="logical-vowel">E</span> with second sentence negated</td> </tr> <tr> <td>FFTT</td> <td><span class="logical-vowel">U</span> with first sentence negated</td> </tr> <tr> <td>FFTF</td> <td><span class="logical-vowel">E</span> with first sentence negated</td> </tr> <tr> <td>FFFT</td> <td><span class="logical-vowel">E</span> with both sentences negated</td> </tr> </table> </div> <p><a id="idm47148549502960" class="indexterm"></a><a id="idm47148549501952" class="indexterm"></a> Note that exchanging the sentences is only necessary with <span class="logical-vowel">U</span>. The three other basic truth functions are commutative; that is, they mean the same thing regardless of the order of the component sentences. There are other ways of getting some of these truth tables; these just happen to be the methods usually employed.</p> </div> <hr xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" /> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="navheader"> <table width="100%" summary="Chapter Header"> <tr> <th colspan="3" align="center">Chapter 14. If Wishes Were Horses: The Lojban Connective System</th> </tr> </table> <table width="100%" summary="Navigation header"> <tr> <td width="50%" align="right"> <a accesskey="p" href="chapter-connectives.html">Prev: Chapter 14</a> </td> <td width="50%" align="left"> <a accesskey="n" href="section-six-types.html">Next: Section 14.3</a> </td> </tr> </table> </div> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="toc-link" align="center"> <a accesskey="h" href="index.html">Table of Contents</a> </div> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="back-to-info-link" align="center"> <a accesskey="b" href="http://www.lojban.org/cll">Book Info Page</a> </div> </body> </html>
{ "pile_set_name": "Github" }
from django.contrib import admin import nested_admin from .models import ( TopLevel, LevelOne, LevelOneA, LevelOneB, LevelTwo, LevelTwoC, LevelTwoD, ALevelTwo, ALevelTwoC, ALevelTwoD, BLevelTwo, BLevelTwoC, BLevelTwoD, GFKX) class LevelTwoInline(nested_admin.NestedStackedPolymorphicInline): model = LevelTwo extra = 0 inline_classes = ("collapse", "open", "grp-collapse", "grp-open",) sortable_field_name = "position" class LevelTwoCInline(nested_admin.NestedStackedPolymorphicInline.Child): model = LevelTwoC class LevelTwoDInline(nested_admin.NestedStackedPolymorphicInline.Child): model = LevelTwoD child_inlines = (LevelTwoCInline, LevelTwoDInline) class GFKXInline(nested_admin.NestedGenericStackedInline): model = GFKX extra = 1 sortable_field_name = "position" inline_classes = ("collapse", "open", "grp-collapse", "grp-open", ) class ALevelTwoInline(nested_admin.NestedStackedPolymorphicInline): model = ALevelTwo extra = 0 inline_classes = ("collapse", "open", "grp-collapse", "grp-open",) sortable_field_name = "position" class ALevelTwoCInline(nested_admin.NestedStackedPolymorphicInline.Child): model = ALevelTwoC class ALevelTwoDInline(nested_admin.NestedStackedPolymorphicInline.Child): model = ALevelTwoD inlines = [GFKXInline] child_inlines = (ALevelTwoCInline, ALevelTwoDInline) class BLevelTwoInline(nested_admin.NestedStackedPolymorphicInline): model = BLevelTwo extra = 0 inline_classes = ("collapse", "open", "grp-collapse", "grp-open",) sortable_field_name = "position" class BLevelTwoCInline(nested_admin.NestedStackedPolymorphicInline.Child): model = BLevelTwoC class BLevelTwoDInline(nested_admin.NestedStackedPolymorphicInline.Child): model = BLevelTwoD child_inlines = (BLevelTwoCInline, BLevelTwoDInline) class LevelOneInline(nested_admin.NestedStackedPolymorphicInline): model = LevelOne extra = 0 inline_classes = ("collapse", "open", "grp-collapse", "grp-open",) sortable_field_name = "position" inlines = [LevelTwoInline] class LevelOneAInline(nested_admin.NestedStackedPolymorphicInline.Child): model = LevelOneA inlines = [ALevelTwoInline] class LevelOneBInline(nested_admin.NestedStackedPolymorphicInline.Child): model = LevelOneB inlines = [BLevelTwoInline] child_inlines = (LevelOneAInline, LevelOneBInline) @admin.register(TopLevel) class TopLevelAdmin(nested_admin.NestedPolymorphicModelAdmin): inlines = [LevelOneInline]
{ "pile_set_name": "Github" }
<?php namespace App\Notifications; use App\Models\Commentdd; use App\Models\Question; use App\Models\Reply; use App\Models\User; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use Illuminate\Contracts\Queue\ShouldQueue; class ReceivedReply extends Notification implements ShouldQueue { use Queueable; protected $reply; /** * Create a new notification instance. * * @return void */ public function __construct(Reply $reply) { $this->reply = $reply; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['database']; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { $comment = $this->reply; } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toArray($notifiable) { $comment = $this->reply; $question = Question::findOrFail($comment->question_id); $user = User::findOrFail($comment->user_id); return [ 'user_id' => $comment->user_id, 'user_name' => $user->user_name, 'question_id' => $comment->question_id, 'question_title' => $question->title, 'question_slug' => $question->slug, 'comment_content' => $comment->body, ]; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(SolutionDir)Build\VS\Rainmeter.Cpp.Default.props" /> <PropertyGroup Label="Globals"> <ProjectGuid>{19312085-AA51-4BD6-BE92-4B6098CCA539}</ProjectGuid> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(SolutionDir)Build\VS\Rainmeter.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <ItemDefinitionGroup> <ClCompile> <AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PrecompiledHeader>Use</PrecompiledHeader> </ClCompile> <Lib> <LinkTimeCodeGeneration Condition="'$(Configuration)'=='Release'">true</LinkTimeCodeGeneration> </Lib> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="CharacterEntityReference.cpp" /> <ClCompile Include="ControlTemplate.cpp" /> <ClCompile Include="Dialog.cpp" /> <ClCompile Include="FileUtil.cpp" /> <ClCompile Include="Gfx\Canvas.cpp" /> <ClCompile Include="Gfx\D2DBitmap.cpp" /> <ClCompile Include="Gfx\FontCollection.cpp" /> <ClCompile Include="Gfx\FontCollectionD2D.cpp" /> <ClCompile Include="Gfx\RenderTexture.cpp" /> <ClCompile Include="Gfx\Shape.cpp" /> <ClCompile Include="Gfx\Shapes\Arc.cpp" /> <ClCompile Include="Gfx\Shapes\Curve.cpp" /> <ClCompile Include="Gfx\Shapes\Ellipse.cpp" /> <ClCompile Include="Gfx\Shapes\Line.cpp" /> <ClCompile Include="Gfx\Shapes\Path.cpp" /> <ClCompile Include="Gfx\Shapes\QuadraticCurve.cpp" /> <ClCompile Include="Gfx\Shapes\Rectangle.cpp" /> <ClCompile Include="Gfx\Shapes\RoundedRectangle.cpp" /> <ClCompile Include="Gfx\TextFormat.cpp" /> <ClCompile Include="Gfx\TextFormatD2D.cpp" /> <ClCompile Include="Gfx\TextInlineFormat.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatCase.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatCharacterSpacing.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatColor.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatFace.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatGradientColor.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatItalic.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatOblique.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatShadow.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatSize.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatStretch.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatStrikethrough.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatTypography.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatUnderline.cpp" /> <ClCompile Include="Gfx\TextInlineFormat\TextInlineFormatWeight.cpp" /> <ClCompile Include="Gfx\Util\D2DBitmapLoader.cpp" /> <ClCompile Include="Gfx\Util\D2DEffectStream.cpp" /> <ClCompile Include="Gfx\Util\D2DUtil.cpp" /> <ClCompile Include="Gfx\Util\DWriteFontCollectionLoader.cpp" /> <ClCompile Include="Gfx\Util\DWriteFontFileEnumerator.cpp" /> <ClCompile Include="Gfx\Util\DWriteHelpers.cpp" /> <ClCompile Include="MathParser.cpp" /> <ClCompile Include="MenuTemplate.cpp" /> <ClCompile Include="PathUtil.cpp" /> <ClCompile Include="Platform.cpp" /> <ClCompile Include="StdAfx.cpp"> <PrecompiledHeader>Create</PrecompiledHeader> </ClCompile> <ClCompile Include="StringUtil.cpp" /> </ItemGroup> <ItemGroup> <ClInclude Include="ControlTemplate.h" /> <ClInclude Include="Dialog.h" /> <ClInclude Include="FileUtil.h" /> <ClInclude Include="Gfx\Canvas.h" /> <ClInclude Include="Gfx\D2DBitmap.h" /> <ClInclude Include="Gfx\FontCollection.h" /> <ClInclude Include="Gfx\FontCollectionD2D.h" /> <ClInclude Include="Gfx\RenderTexture.h" /> <ClInclude Include="Gfx\Shape.h" /> <ClInclude Include="Gfx\Shapes\Arc.h" /> <ClInclude Include="Gfx\Shapes\Curve.h" /> <ClInclude Include="Gfx\Shapes\Ellipse.h" /> <ClInclude Include="Gfx\Shapes\Line.h" /> <ClInclude Include="Gfx\Shapes\Path.h" /> <ClInclude Include="Gfx\Shapes\QuadraticCurve.h" /> <ClInclude Include="Gfx\Shapes\Rectangle.h" /> <ClInclude Include="Gfx\Shapes\RoundedRectangle.h" /> <ClInclude Include="Gfx\TextFormat.h" /> <ClInclude Include="Gfx\TextFormatD2D.h" /> <ClInclude Include="Gfx\TextInlineFormat.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatCase.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatCharacterSpacing.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatColor.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatFace.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatGradientColor.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatItalic.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatOblique.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatShadow.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatSize.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatStretch.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatStrikethrough.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatTypography.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatUnderline.h" /> <ClInclude Include="Gfx\TextInlineFormat\TextInlineFormatWeight.h" /> <ClInclude Include="Gfx\Util\D2DBitmapLoader.h" /> <ClInclude Include="Gfx\Util\D2DEffectStream.h" /> <ClInclude Include="Gfx\Util\D2DUtil.h" /> <ClInclude Include="Gfx\Util\DWriteFontCollectionLoader.h" /> <ClInclude Include="Gfx\Util\DWriteFontFileEnumerator.h" /> <ClInclude Include="Gfx\Util\DWriteHelpers.h" /> <ClInclude Include="ScopedFunction.h" /> <ClInclude Include="MathParser.h" /> <ClInclude Include="MenuTemplate.h" /> <ClInclude Include="PathUtil.h" /> <ClInclude Include="Platform.h" /> <ClInclude Include="RawString.h" /> <ClInclude Include="StdAfx.h" /> <ClInclude Include="StringUtil.h" /> <ClInclude Include="Timer.h" /> <ClInclude Include="UnitTest.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> </Project>
{ "pile_set_name": "Github" }
/* * Copyright (C) 2019 Tomohiro Kusumi <[email protected]> */ #include "../unittest.h" #ifndef CONFIG_STRCASESTR #include "../../oslib/strcasestr.h" #else #include <string.h> #endif static void test_strcasestr_1(void) { const char *haystack = "0123456789"; const char *p; p = strcasestr(haystack, "012"); CU_ASSERT_EQUAL(p, haystack); p = strcasestr(haystack, "12345"); CU_ASSERT_EQUAL(p, haystack + 1); p = strcasestr(haystack, "1234567890"); CU_ASSERT_EQUAL(p, NULL); p = strcasestr(haystack, ""); CU_ASSERT_EQUAL(p, haystack); /* is this expected ? */ } static void test_strcasestr_2(void) { const char *haystack = "ABCDEFG"; const char *p; p = strcasestr(haystack, "ABC"); CU_ASSERT_EQUAL(p, haystack); p = strcasestr(haystack, "BCD"); CU_ASSERT_EQUAL(p, haystack + 1); p = strcasestr(haystack, "ABCDEFGH"); CU_ASSERT_EQUAL(p, NULL); p = strcasestr(haystack, ""); CU_ASSERT_EQUAL(p, haystack); /* is this expected ? */ } static void test_strcasestr_3(void) { const char *haystack = "ABCDEFG"; const char *p; p = strcasestr(haystack, "AbC"); CU_ASSERT_EQUAL(p, haystack); p = strcasestr(haystack, "bCd"); CU_ASSERT_EQUAL(p, haystack + 1); p = strcasestr(haystack, "AbcdEFGH"); CU_ASSERT_EQUAL(p, NULL); p = strcasestr(haystack, ""); CU_ASSERT_EQUAL(p, haystack); /* is this expected ? */ } static struct fio_unittest_entry tests[] = { { .name = "strcasestr/1", .fn = test_strcasestr_1, }, { .name = "strcasestr/2", .fn = test_strcasestr_2, }, { .name = "strcasestr/3", .fn = test_strcasestr_3, }, { .name = NULL, }, }; CU_ErrorCode fio_unittest_oslib_strcasestr(void) { return fio_unittest_add_suite("oslib/strcasestr.c", NULL, NULL, tests); }
{ "pile_set_name": "Github" }
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- # # 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/. # from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict from uitest.uihelper.common import select_pos from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict, type_text from uitest.debug import sleep import org.libreoffice.unotest import pathlib def get_url_for_data_file(file_name): return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() #Chart Display Legend dialog class chartLegend(UITestCase): def test_chart_display_legend_dialog(self): calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") document = self.ui_test.get_component() gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) gridwin.executeAction("ACTIVATE", tuple()) xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) xDialog = self.xUITest.getTopFocusWindow() left = xDialog.getChild("left") right = xDialog.getChild("right") top = xDialog.getChild("top") bottom = xDialog.getChild("bottom") left.executeAction("CLICK", tuple()) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify InsertMenuLegend dialog gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) gridwin.executeAction("ACTIVATE", tuple()) xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) xDialog = self.xUITest.getTopFocusWindow() left = xDialog.getChild("left") right = xDialog.getChild("right") top = xDialog.getChild("top") bottom = xDialog.getChild("bottom") show = xDialog.getChild("show") self.assertEqual(get_state_as_dict(left)["Checked"], "true") self.assertEqual(get_state_as_dict(right)["Checked"], "false") self.assertEqual(get_state_as_dict(top)["Checked"], "false") self.assertEqual(get_state_as_dict(bottom)["Checked"], "false") show.executeAction("CLICK", tuple()) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify InsertMenuLegend dialog gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) gridwin.executeAction("ACTIVATE", tuple()) xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) xDialog = self.xUITest.getTopFocusWindow() left = xDialog.getChild("left") right = xDialog.getChild("right") top = xDialog.getChild("top") bottom = xDialog.getChild("bottom") show = xDialog.getChild("show") self.assertEqual(get_state_as_dict(left)["Checked"], "true") self.assertEqual(get_state_as_dict(right)["Checked"], "false") self.assertEqual(get_state_as_dict(top)["Checked"], "false") self.assertEqual(get_state_as_dict(bottom)["Checked"], "false") self.assertEqual(get_state_as_dict(show)["Selected"], "false") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab:
{ "pile_set_name": "Github" }
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#fff" android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/> </vector>
{ "pile_set_name": "Github" }
! ---------------------------------------------------------------------- ! File name: BisectU.f90 ! ! ---------------------------------------------------------------------- subroutine BisectU2(ap2, vf2) use Globals use Numerical_Libraries use ValueModule implicit none real(8), parameter:: tol=1.0e-6 REAL(8) ap2, vf2 real(8) x0, x1, x3, ff0, ff1, ff3 logical ifstop x0= amin x3 = min(agrid(ia)+10.0,amax) x1 = (x0+x3)/2.0D0 ff0 = ValueF2p(x0) ff1 = ValueF2p(x1) ff3 = ValueF2p(x3) if (ff0<0.0D0) then !corner ap2 = x0 vf2=ValueF2(ap2) else if (ff3>0.0D0) then ap2 = x3 ! vf2=ValueF2(ap2) else ! start the bisection loop. ifstop = .true. do while (ifstop) if (ff1>0.0D0) then x0=x1 x1 = (x0+x3)/2.0D0 ff1 = ValueF2p(x1) else x3=x1 x1 = (x0+x3)/2.0D0 ff1 = ValueF2p(x1) end if if (abs(x3-x0)<TOL) then ap2=x1 vf2=ValueF2(ap2) ifstop = .false. end if end do end if end subroutine
{ "pile_set_name": "Github" }
var mongoose = require('mongoose'); mongoose.connect('mongodb://127.0.0.1:27017/securing-rest-apis-with-jwt', { useMongoClient: true });
{ "pile_set_name": "Github" }
<!doctype html> <html> <meta charset="utf-8"> <title>CSS Text — WORD JOINER before atomic inline</title> <meta name=assert content="There is a soft wrap opportunity between an atomic inline and a preceeding WORD JOINER"> <link rel=help href="https://www.w3.org/TR/css-text-3/#line-break-details"> <link rel=match href="../../reference/ref-filled-green-100px-square.xht"> <link rel=author title="Florian Rivoal" href="https://florian.rivoal.net"> <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> <style> div { font: 50px/1 Ahem; color: green; width: 100px; height: 100px; background: red; } span { display: inline-block; } </style> <p>Test passes if there is a filled green square and <strong>no red</strong>. <div>AB&#8288;<span>CD</span></div>
{ "pile_set_name": "Github" }
ALL_TESTS = $(shell find test/ -name '*.test.js') ALL_INTEGRATION = $(shell find test/ -name '*.integration.js') run-tests: @./node_modules/.bin/mocha \ -t 5000 \ -s 2400 \ $(TESTFLAGS) \ $(TESTS) run-integrationtests: @./node_modules/.bin/mocha \ -t 5000 \ -s 6000 \ $(TESTFLAGS) \ $(TESTS) run-coverage: @./node_modules/.bin/istanbul cover --report html \ ./node_modules/.bin/_mocha -- \ -t 5000 \ -s 6000 \ $(TESTFLAGS) \ $(TESTS) test: @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests integrationtest: @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests coverage: @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-coverage benchmark: @node bench/sender.benchmark.js @node bench/parser.benchmark.js autobahn: @NODE_PATH=lib node test/autobahn.js autobahn-server: @NODE_PATH=lib node test/autobahn-server.js .PHONY: test coverage
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Type Name="SoapBodyBinding" FullName="System.Web.Services.Description.SoapBodyBinding"> <TypeSignature Language="C#" Maintainer="auto" Value="public class SoapBodyBinding : System.Web.Services.Description.ServiceDescriptionFormatExtension" /> <AssemblyInfo> <AssemblyName>System.Web.Services</AssemblyName> <AssemblyPublicKey> </AssemblyPublicKey> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> </AssemblyInfo> <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the &lt;link location="node:gtk-sharp/programming/threads"&gt;Gtk# Thread Programming&lt;/link&gt; for details.</ThreadSafetyStatement> <Base> <BaseTypeName>System.Web.Services.Description.ServiceDescriptionFormatExtension</BaseTypeName> </Base> <Interfaces /> <Attributes> <Attribute> <AttributeName>System.Web.Services.Configuration.XmlFormatExtension("body", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding), typeof(System.Web.Services.Description.MimePart))</AttributeName> </Attribute> </Attributes> <Docs> <remarks> <attribution license="cc4" from="Microsoft" modified="false" /> <para>This class specifies how messages, either abstract type definitions or concrete schema definitions, appear within the SOAP body element of the transmission.</para> <para>For more information about specifying protocols for XML Web services, see <format type="text/html"><a href="01DFC27C-C68E-4910-A0AA-5E4C2A766B0C">[&lt;topic://cpconbuildingaspnetwebservices&gt;]</a></format>. For more information about Web Services Description Language (WSDL), see the specification at http://www.w3.org/TR/wsdl/.</para> </remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Represents an extensibility element added to an <see cref="T:System.Web.Services.Description.InputBinding" /> or an <see cref="T:System.Web.Services.Description.OutputBinding" />.</para> </summary> </Docs> <Members> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public SoapBodyBinding ();" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters /> <Docs> <remarks>To be added</remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Initializes a new instance of the <see cref="T:System.Web.Services.Description.SoapBodyBinding" /> class. </para> </summary> </Docs> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> </AssemblyInfo> </Member> <Member MemberName="Encoding"> <MemberSignature Language="C#" Value="public string Encoding { set; get; }" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.String</ReturnType> </ReturnValue> <Parameters /> <Docs> <value>To be added: an object of type 'string'</value> <remarks> <attribution license="cc4" from="Microsoft" modified="false" /> <para>The value of this property should be set only if the value of the <see cref="P:System.Web.Services.Description.SoapBodyBinding.Use" /> property is Encoded. Otherwise this property value will be ignored.</para> </remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Gets or sets a string containing a list of space-delimited URIs. The URIs represent the encoding style (or styles) to be used to encode messages within the SOAP body.</para> </summary> </Docs> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> </AssemblyInfo> <Attributes> <Attribute> <AttributeName>System.Xml.Serialization.XmlAttribute("encodingStyle")</AttributeName> </Attribute> <Attribute> <AttributeName>System.ComponentModel.DefaultValue("")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="Namespace"> <MemberSignature Language="C#" Value="public string Namespace { set; get; }" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.String</ReturnType> </ReturnValue> <Parameters /> <Docs> <value>To be added: an object of type 'string'</value> <remarks> <attribution license="cc4" from="Microsoft" modified="false" /> <para>This property will return an empty string ("") if the property value has not been set. The value should only be set if the value of the <see cref="P:System.Web.Services.Description.SoapBodyBinding.Use" /> property is Encoded. Otherwise the property value will be ignored, thus leading to unexpected behavior by the XML Web service.</para> </remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Get or sets the URI representing the location of the specifications for encoding of content not specifically defined by the <see cref="P:System.Web.Services.Description.SoapBodyBinding.Encoding" /> property.</para> </summary> </Docs> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> </AssemblyInfo> <Attributes> <Attribute> <AttributeName>System.Xml.Serialization.XmlAttribute("namespace")</AttributeName> </Attribute> <Attribute> <AttributeName>System.ComponentModel.DefaultValue("")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="Parts"> <MemberSignature Language="C#" Value="public string[] Parts { set; get; }" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.String[]</ReturnType> </ReturnValue> <Parameters /> <Docs> <value>To be added: an object of type 'string []'</value> <remarks> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Some parts of the transmitted message can appear in portions other than the SOAP body, such as when SOAP is used with a <see cref="T:System.Web.Services.Description.MimeMultipartRelatedBinding" />. In such a case, the other members of the <see cref="P:System.Web.Services.Description.MimePart.Extensions" /> property determine the locations of the other parts of the message.</para> <para>This property returns exactly the same information as the <see cref="P:System.Web.Services.Description.SoapBodyBinding.PartsString" /> property, but the results are returned within an array rather than within a space-delimited string.</para> </remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Gets or sets a value indicating which parts of the transmitted message appear within the SOAP body portion of the transmission.</para> </summary> </Docs> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> </AssemblyInfo> <Attributes> <Attribute> <AttributeName>System.Xml.Serialization.XmlIgnore</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="PartsString"> <MemberSignature Language="C#" Value="public string PartsString { set; get; }" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.String</ReturnType> </ReturnValue> <Parameters /> <Docs> <value>To be added: an object of type 'string'</value> <remarks> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Some parts of the transmitted message can appear in portions other than the SOAP body, such as when SOAP is used with a <see cref="T:System.Web.Services.Description.MimeMultipartRelatedBinding" />. In such a case, the other members of the <see cref="P:System.Web.Services.Description.MimePart.Extensions" /> property determine the locations of other parts of the message.</para> <para>This property returns exactly the same information as the <see cref="P:System.Web.Services.Description.SoapBodyBinding.Parts" /> property, but the results are returned within a space-delimited string rather than within an array. PartsString is used internally for xml serialization and shouldn't be called directly. To return the transmitted message parts appearing within the SOAP body portion of the transmission, use the <see cref="P:System.Web.Services.Description.SoapBodyBinding.Parts" /> property.</para> </remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Gets or sets a value indicating which parts of the transmitted message appear within the SOAP body portion of the transmission.</para> </summary> </Docs> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> </AssemblyInfo> <Attributes> <Attribute> <AttributeName>System.Xml.Serialization.XmlAttribute("parts")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="Use"> <MemberSignature Language="C#" Value="public System.Web.Services.Description.SoapBindingUse Use { set; get; }" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Web.Services.Description.SoapBindingUse</ReturnType> </ReturnValue> <Parameters /> <Docs> <value>To be added: an object of type 'SoapBindingUse'</value> <remarks> <attribution license="cc4" from="Microsoft" modified="false" /> <para>The <see cref="P:System.Web.Services.Description.SoapBodyBinding.Namespace" /> and <see cref="P:System.Web.Services.Description.SoapBodyBinding.Encoding" /> properties depend on the value of this property. Their values should be set only if the value of this property is Encoded. Otherwise the XML Web service will produce unexpected behavior.</para> </remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Indicates whether the message parts are encoded using specified encoding rules, or define the concrete schema of the message.</para> </summary> </Docs> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> </AssemblyInfo> <Attributes> <Attribute> <AttributeName>System.Xml.Serialization.XmlAttribute("use")</AttributeName> </Attribute> <Attribute> <AttributeName>System.ComponentModel.DefaultValue(System.Web.Services.Description.SoapBindingUse.Default)</AttributeName> </Attribute> </Attributes> </Member> </Members> </Type>
{ "pile_set_name": "Github" }
/* Localizable.strings Created by Gabriele Petronella on 04.07.13. */ /* List separator */ " " = " "; /* #{Dimensional Quantity} #{Direction} #{Distance} #{Unit} #{Speed} #{Unit} Deictic Expression Format (#{Time} #{Ago/From Now} */ "%@ %@" = "%1$@ %2$@"; /* No comment provided by engineer. */ "&" = "&"; /* Coordinate format */ "(%@, %@)" = "(%1$@, %2$@)"; /* List delimiter */ "," = ","; /* Approximate Qualifier Format */ "about %@" = "circa %@"; /* Past Deictic Expression */ "ago" = "fa"; /* List conjunction */ "and" = "e"; /* Bit Unit */ "bits" = "bit"; /* Byte Unit */ "bytes" = "byte"; /* Error converting to NSArray */ "Couldn’t convert to NSArray" = "Impossibile convertire a NSArray"; /* Day Unit (Singular) */ "day" = "g"; /* Day Unit (Plural) */ "days" = "g"; /* Day Unit (Singular, Abbreviated) */ "d" = "g"; /* Day Unit (Plural, Abbreviated) */ "ds" = "g"; /* East Direction Abbreviation */ "E" = "E"; /* East Direction */ "East" = "Est"; /* Exabyte Unit */ "EB" = "EB"; /* Exbibyte Unit */ "EiB" = "EiB"; /* Future Deictic Expression */ "from now" = "da adesso"; /* Feet Unit */ "ft" = "ft"; /* Feet Per Second Unit */ "ft/s" = "ft/s"; /* Gigabyte Unit */ "GB" = "GB"; /* Gigabit Unit */ "Gbit" = "Gbit"; /* Gibibyte Unit */ "GiB" = "GiB"; /* Gibibit Unit */ "Gibit" = "Gibit"; /* Hour Unit (Singular) */ "hour" = "ora"; /* Hour Unit (Plural) */ "hours" = "ore"; /* Hour Unit (Singular, Abbreviated) */ "hr" = "h"; /* Hour Unit (Plural, Abbreviated) */ "hrs" = "h"; /* Present Deictic Expression */ "just now" = "adesso"; /* Kilobyte Unit */ "KB" = "KB"; /* Kilobit Unit */ "kbit" = "kbit"; /* Kibibyte Unit */ "KiB" = "KiB"; /* Kibibit Unit */ "Kibit" = "Kibit"; /* Kilometer Unit */ "km" = "km"; /* Kilometers Per Hour Unit */ "km/h" = "km/h"; /* No comment provided by engineer. */ "last month" = "un mese fa"; /* No comment provided by engineer. */ "last week" = "una settimana fa"; /* No comment provided by engineer. */ "last year" = "un anno fa"; /* Meter Unit */ "m" = "m"; /* Meters Per Second Unit */ "m/s" = "m/s"; /* Megabyte Unit */ "MB" = "MB"; /* Megabit Unit */ "Mbit" = "Mbit"; /* No comment provided by engineer. */ "Method Not Implemented" = "Metodo non implementato"; /* Mebibyte Unit */ "MiB" = "MiB"; /* Mebibit Unit */ "Mibit" = "Mibit"; /* Mile Unit (Singular) */ "mile" = "miglio"; /* Mile Unit (Plural) */ "miles" = "miglia"; /* Minute Unit (Singular, Abbreviated) */ "min" = "min"; /* Minute Unit (Plural, Abbreviated) */ "mins" = "min"; /* Minute Unit (Singular) */ "minute" = "minuto"; /* Minute Unit (Plural) */ "minutes" = "minuti"; /* Month Unit (Singular, Abbreviated) */ "mo" = "mese"; /* Month Unit (Singular) */ "month" = "mese"; /* Month Unit (Plural) */ "months" = "mesi"; /* Month Unit (Plural, Abbreviated) */ "mos" = "mesi"; /* Miles Per Hour Unit */ "mph" = "mph"; /* North Direction Abbreviation */ "N" = "N"; /* Northeast Direction Abbreviation */ "NE" = "NE"; /* No comment provided by engineer. */ "next month" = "il mese prossimo"; /* No comment provided by engineer. */ "next week" = "la prossima settimana"; /* No comment provided by engineer. */ "next year" = "l'anno prossimo"; /* North Direction */ "North" = "Nord"; /* Northeast Direction */ "Northeast" = "Nord-est"; /* Northwest Direction */ "Northwest" = "Nord-ovest"; /* Northwest Direction Abbreviation */ "NW" = "NO"; /* Petabyte Unit */ "PB" = "PB"; /* Petabit Unit */ "Pbit" = "Pbit"; /* Pebibyte Unit */ "PiB" = "PiB"; /* Pebibit Unit */ "Pibit" = "Pibit"; /* South Direction Abbreviation */ "S" = "S"; /* Second Unit (Plural, Abbreviated) Second Unit (Singular, Abbreviated) */ "s" = "sec"; /* Southeast Direction Abbreviation */ "SE" = "SE"; /* Second Unit (Singular) */ "second" = "secondo"; /* Second Unit (Plural) */ "seconds" = "secondi"; /* South Direction */ "South" = "South"; /* Southeast Direction */ "Southeast" = "Southeast"; /* Southwest Direction */ "Southwest" = "Southwest"; /* Southwest Direction Abbreviation */ "SW" = "SW"; /* Terabyte Unit */ "TB" = "TB"; /* Terabit Unit */ "Tbit" = "Tbit"; /* Tebibyte Unit */ "TiB" = "TiB"; /* Tebibit Unit */ "Tibit" = "Tibit"; /* No comment provided by engineer. */ "tomorrow" = "domani"; /* #{Value} #{Unit} */ "Unit of Information Format String" = "%1$@ %2$@"; /* West Direction Abbreviation */ "W" = "W"; /* Week Unit (Singular) */ "week" = "settimana"; /* Week Unit (Plural) */ "weeks" = "settimane"; /* West Direction */ "West" = "Ovest"; /* Week Unit (Singular, Abbreviated) */ "wk" = "sett"; /* Week Unit (Plural, Abbreviated) */ "wks" = "sett"; /* Yard Unit */ "yds" = "yds"; /* Year Unit (Singular) */ "year" = "anno"; /* Year Unit (Plural) */ "years" = "anni"; /* No comment provided by engineer. */ "yesterday" = "ieri"; /* Year Unit (Singular, Abbreviated) */ "yr" = "anno"; /* Year Unit (Plural, Abbreviated) */ "yrs" = "anni";
{ "pile_set_name": "Github" }
//===-- AArch64SelectionDAGInfo.cpp - AArch64 SelectionDAG Info -----------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements the AArch64SelectionDAGInfo class. // //===----------------------------------------------------------------------===// #include "AArch64TargetMachine.h" using namespace llvm; #define DEBUG_TYPE "aarch64-selectiondag-info" SDValue AArch64SelectionDAGInfo::EmitTargetCodeForMemset( SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo) const { // Check to see if there is a specialized entry-point for memory zeroing. ConstantSDNode *V = dyn_cast<ConstantSDNode>(Src); ConstantSDNode *SizeValue = dyn_cast<ConstantSDNode>(Size); const AArch64Subtarget &STI = DAG.getMachineFunction().getSubtarget<AArch64Subtarget>(); const char *bzeroName = (V && V->isNullValue()) ? DAG.getTargetLoweringInfo().getLibcallName(RTLIB::BZERO) : nullptr; // For small size (< 256), it is not beneficial to use bzero // instead of memset. if (bzeroName && (!SizeValue || SizeValue->getZExtValue() > 256)) { const AArch64TargetLowering &TLI = *STI.getTargetLowering(); EVT IntPtr = TLI.getPointerTy(DAG.getDataLayout()); Type *IntPtrTy = DAG.getDataLayout().getIntPtrType(*DAG.getContext()); TargetLowering::ArgListTy Args; TargetLowering::ArgListEntry Entry; Entry.Node = Dst; Entry.Ty = IntPtrTy; Args.push_back(Entry); Entry.Node = Size; Args.push_back(Entry); TargetLowering::CallLoweringInfo CLI(DAG); CLI.setDebugLoc(dl) .setChain(Chain) .setLibCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()), DAG.getExternalSymbol(bzeroName, IntPtr), std::move(Args)) .setDiscardResult(); std::pair<SDValue, SDValue> CallResult = TLI.LowerCallTo(CLI); return CallResult.second; } return SDValue(); } bool AArch64SelectionDAGInfo::generateFMAsInMachineCombiner( CodeGenOpt::Level OptLevel) const { return OptLevel >= CodeGenOpt::Aggressive; }
{ "pile_set_name": "Github" }
.Dd November 22 2016 .Dt citra-qt 6 .Os .Sh NAME .Nm Citra-Qt .Nd Nintendo 3DS Emulator/Debugger (Qt) .Sh SYNOPSIS .Nm citra-qt .Op Ar file .Sh DESCRIPTION Citra is an experimental open-source Nintendo 3DS emulator/debugger. .Pp .Nm citra-qt is the Qt implementation. .Sh FILES .Bl -tag -width Ds .It Pa $XDG_DATA_HOME/citra-emu Emulator storage. .It Pa $XDG_CONFIG_HOME/citra-emu Configuration files. .El .Sh AUTHORS This document is made available to you under the CC-BY license. .Pp Citra is made by a team of volunteers. These contributors are listed at <\fBhttps://github.com/citra-emu/citra/contributors\fR>. .Pp .Sh SEE ALSO .Bl -tag -width Ds .It Xr citra 6 The SDL frontend of the application .El .Pp Resources are available for this project: .Bl -tag -width Ds .It <\fBhttps://citra-emu.org\fR> The main homepage of the project. .It <\fBhttps://github.com/citra-emu/citra\fR> The main source code repository for the Citra emulator. .Pp
{ "pile_set_name": "Github" }
/* Copyright (c) 2008 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // GDataEntryYouTubeChannel.h // #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE #import "GDataEntryBase.h" #import "GDataEntryYouTubeFeedLinkBase.h" @interface GDataEntryYouTubeChannel : GDataEntryBase + (GDataEntryYouTubeChannel *)channelEntry; // channelType is a convenience accessor to get the term value from // the channel category element for this entry - (NSString *)channelType; - (NSArray *)feedLinks; // convenience accessors - (GDataFeedLink *)uploadsFeedLink; - (GDataFeedLink *)featuredFeedLink; @end #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE
{ "pile_set_name": "Github" }
import { prop,propObject,propArray,required,maxLength,range } from "@rxweb/reactive-form-validators" import { gridColumn } from "@rxweb/grid" export class DbConstantBase { //#region dbConstantId Prop @prop() dbConstantId : any; //#endregion dbConstantId Prop //#region constantName Prop @maxLength({value:2000}) constantName : string; //#endregion constantName Prop //#region eN_ConstantName Prop @required() eN_ConstantName : string; //#endregion eN_ConstantName Prop //#region fR_ConstantName Prop @prop() fR_ConstantName : string; //#endregion fR_ConstantName Prop }
{ "pile_set_name": "Github" }
// Copyright 2018 The Periph Authors. All rights reserved. // Use of this source code is governed under the Apache License, Version 2.0 // that can be found in the LICENSE file. package mcp9808 import ( "encoding/binary" "errors" "sync" "time" "periph.io/x/periph/conn" "periph.io/x/periph/conn/i2c" "periph.io/x/periph/conn/mmr" "periph.io/x/periph/conn/physic" ) // Opts holds the configuration options. // // Slave Address // // Depending which pins the A0, A1 and A2 pins are connected to will change the // slave address. Default configuration is address 0x18 (Ax pins to GND). For a // full address table see datasheet. type Opts struct { Addr int Res resolution } // DefaultOpts is the recommended default options. var DefaultOpts = Opts{ Addr: 0x18, Res: Maximum, } // New opens a handle to an mcp9808 sensor. func New(bus i2c.Bus, opts *Opts) (*Dev, error) { i2cAddress := DefaultOpts.Addr if opts.Addr != 0 { if opts.Addr < 0x18 || opts.Addr > 0x1f { return nil, errAddressOutOfRange } i2cAddress = opts.Addr } dev := &Dev{ m: mmr.Dev8{ Conn: &i2c.Dev{Bus: bus, Addr: uint16(i2cAddress)}, Order: binary.BigEndian, }, stop: make(chan struct{}, 1), res: opts.Res, enabled: false, } if err := dev.setResolution(opts.Res); err != nil { return nil, err } if err := dev.enable(); err != nil { return nil, err } return dev, nil } // Dev is a handle to the mcp9808 sensor. type Dev struct { m mmr.Dev8 stop chan struct{} res resolution mu sync.Mutex sensing bool critical physic.Temperature upper physic.Temperature lower physic.Temperature enabled bool } // Sense reads the current temperature. func (d *Dev) Sense(e *physic.Env) error { t, _, err := d.readTemperature() e.Temperature = t return err } // SenseContinuous returns measurements as °C, on a continuous basis. // The application must call Halt() to stop the sensing when done to stop the // sensor and close the channel. // It's the responsibility of the caller to retrieve the values from the channel // as fast as possible, otherwise the interval may not be respected. func (d *Dev) SenseContinuous(interval time.Duration) (<-chan physic.Env, error) { switch d.res { case Maximum: if interval < 250*time.Millisecond { return nil, errTooShortInterval } case High: if interval < 130*time.Millisecond { return nil, errTooShortInterval } case Medium: if interval < 65*time.Millisecond { return nil, errTooShortInterval } case Low: if interval < 30*time.Millisecond { return nil, errTooShortInterval } } env := make(chan physic.Env) d.mu.Lock() d.sensing = true d.mu.Unlock() var wg sync.WaitGroup wg.Add(1) go func() { for { select { case <-time.After(interval): t, _, _ := d.readTemperature() env <- physic.Env{Temperature: t} case <-d.stop: wg.Done() return } } }() go func() { wg.Wait() close(env) d.mu.Lock() d.sensing = false d.mu.Unlock() }() return env, nil } // Precision implement SenseEnv. func (d *Dev) Precision(e *physic.Env) { switch d.res { case Maximum: e.Temperature = 62500 * physic.MicroKelvin case High: e.Temperature = 125 * physic.MilliKelvin case Medium: e.Temperature = 250 * physic.MilliKelvin case Low: e.Temperature = 500 * physic.MilliKelvin } } // SenseTemp reads the current temperature. func (d *Dev) SenseTemp() (physic.Temperature, error) { t, _, err := d.readTemperature() return t, err } // SenseWithAlerts reads the ambient temperature and returns an slice of any // alerts that have been tripped. Lower must be less than upper which must be // less than critical. func (d *Dev) SenseWithAlerts(lower, upper, critical physic.Temperature) (physic.Temperature, []Alert, error) { if critical > upper && upper > lower { if err := d.setCriticalAlert(critical); err != nil { return 0, nil, err } if err := d.setUpperAlert(upper); err != nil { return 0, nil, err } if err := d.setLowerAlert(lower); err != nil { return 0, nil, err } } else { return 0, nil, errAlertInvalid } t, alertBits, err := d.readTemperature() if err != nil { return 0, nil, err } // Check for Alerts. if alertBits&0xe0 != 0 { var as []Alert if alertBits&0x80 != 0 { // Critical Alert bit set. crit, err := d.m.ReadUint16(critAlert) if err != nil { return t, nil, errReadCriticalAlert } as = append(as, Alert{"critical", bitsToTemperature(crit)}) } if alertBits&0x40 != 0 { // Upper Alert bit set. upper, err := d.m.ReadUint16(upperAlert) if err != nil { return t, nil, errReadUpperAlert } as = append(as, Alert{"upper", bitsToTemperature(upper)}) } if alertBits&0x20 != 0 { // Lower Alert bit set. lower, err := d.m.ReadUint16(lowerAlert) if err != nil { return t, nil, errReadLowerAlert } as = append(as, Alert{"lower", bitsToTemperature(lower)}) } return t, as, nil } return t, nil, nil } // Halt put the mcp9808 into shutdown mode. It will not read temperatures while // in shutdown mode. func (d *Dev) Halt() error { d.mu.Lock() if d.sensing { d.stop <- struct{}{} } d.mu.Unlock() if err := d.m.WriteUint16(configuration, 0x0100); err != nil { return errWritingConfiguration } d.mu.Lock() d.enabled = false d.mu.Unlock() return nil } func (d *Dev) String() string { return "MCP9808" } func (d *Dev) enable() error { d.mu.Lock() defer d.mu.Unlock() if !d.enabled { if err := d.m.WriteUint16(configuration, 0x0000); err != nil { return errWritingConfiguration } d.enabled = true } return nil } func (d *Dev) readTemperature() (physic.Temperature, uint8, error) { if err := d.enable(); err != nil { return 0, 0, err } tbits, err := d.m.ReadUint16(temperature) if err != nil { return 0, 0, errReadTemperature } return bitsToTemperature(tbits), uint8(tbits>>8) & 0xe0, nil } func (d *Dev) setResolution(r resolution) error { switch r { case Low: if err := d.m.WriteUint8(resolutionConfig, 0x00); err != nil { return errWritingResolution } case Medium: if err := d.m.WriteUint8(resolutionConfig, 0x01); err != nil { return errWritingResolution } case High: if err := d.m.WriteUint8(resolutionConfig, 0x02); err != nil { return errWritingResolution } case Maximum: if err := d.m.WriteUint8(resolutionConfig, 0x03); err != nil { return errWritingResolution } default: return errInvalidResolution } return nil } func (d *Dev) setCriticalAlert(t physic.Temperature) error { d.mu.Lock() defer d.mu.Unlock() if t == d.critical { return nil } crit, err := alertTemperatureToBits(t) if err != nil { return err } if err := d.m.WriteUint16(critAlert, crit); err != nil { return errWritingCritAlert } d.critical = t return nil } func (d *Dev) setUpperAlert(t physic.Temperature) error { d.mu.Lock() defer d.mu.Unlock() if t == d.upper { return nil } upper, err := alertTemperatureToBits(t) if err != nil { return err } if err := d.m.WriteUint16(upperAlert, upper); err != nil { return errWritingUpperAlert } d.upper = t return nil } func (d *Dev) setLowerAlert(t physic.Temperature) error { d.mu.Lock() defer d.mu.Unlock() if t == d.lower { return nil } lower, err := alertTemperatureToBits(t) if err != nil { return err } if err := d.m.WriteUint16(lowerAlert, lower); err != nil { return errWritingLowerAlert } d.lower = t return nil } // Alert represents an alert generated by the device. type Alert struct { AlertMode string AlertLevel physic.Temperature } const ( // Register addresses. configuration byte = 0x01 upperAlert byte = 0x02 lowerAlert byte = 0x03 critAlert byte = 0x04 temperature byte = 0x05 manifactureID byte = 0x06 deviceID byte = 0x07 resolutionConfig byte = 0x08 ) var ( errReadTemperature = errors.New("failed to read ambient temperature") errReadCriticalAlert = errors.New("failed to read critical temperature") errReadUpperAlert = errors.New("failed to read upper temperature") errReadLowerAlert = errors.New("failed to read lower temperature") errAddressOutOfRange = errors.New("i2c address out of range") errInvalidResolution = errors.New("invalid resolution") errWritingResolution = errors.New("failed to write resolution configuration") errWritingConfiguration = errors.New("failed to write configuration") errWritingCritAlert = errors.New("failed to write critical alert configuration") errWritingUpperAlert = errors.New("failed to write upper alert configuration") errWritingLowerAlert = errors.New("failed to write lower alert configuration") errAlertOutOfRange = errors.New("alert setting exceeds operating conditions") errAlertInvalid = errors.New("invalid alert temperature configuration") errTooShortInterval = errors.New("too short interval for resolution") ) // bitsToTemperature converts the given bits to a physic.Temperature, assuming the // bit layout common to the ambient temperature register and the alert registers. // This works for the alert registers because while they do not make use of the 2 // least significant bits (i.e. they have resolution of 0.25°C vs. 0.0625°C for the // ambient temp register) those 2 bits are always read as 0. See page 22 of the // datasheet. func bitsToTemperature(b uint16) physic.Temperature { t := physic.Temperature(b&0x0fff) * 62500 * physic.MicroKelvin if b&0x1000 != 0 { // Account for sign bit. t -= 256 * physic.Celsius } return t + physic.ZeroCelsius } func alertTemperatureToBits(t physic.Temperature) (uint16, error) { const maxAlert = 125*physic.Kelvin + physic.ZeroCelsius const minAlert = -40*physic.Kelvin + physic.ZeroCelsius if t > maxAlert || t < minAlert { return 0, errAlertOutOfRange } t -= physic.ZeroCelsius // 0.25°C per bit. t /= 250 * physic.MilliKelvin // We don't need to explicitly handle negative temperatures because both Go and the MCP9808 // store negative values using two's complement. We can rely on Go's implementation since // we know that the bits of a negative value are already in two's complement, implying that // the sign bit will already be set to 1 due to the range check. We need to be sure to mask // off the 3 most significant bits after shifting though: they will all be set to 1 if the // value is negative. Also mask off the 2 least significant bits. While not strictly necessary, // the MCP9808 doesn't use them. bits := (uint16(t) << 2) & 0x1ffc return bits, nil } type resolution uint8 // Valid resolution values. const ( Maximum resolution = 0 Low resolution = 1 Medium resolution = 2 High resolution = 3 ) var _ conn.Resource = &Dev{} var _ physic.SenseEnv = &Dev{}
{ "pile_set_name": "Github" }
<div class="shaft-load" ng-show="loading"> <div class="shaft1"></div> <div class="shaft2"></div> <div class="shaft3"></div> <div class="shaft4"></div> <div class="shaft5"></div> <div class="shaft6"></div> <div class="shaft7"></div> <div class="shaft8"></div> <div class="shaft9"></div> <div class="shaft10"></div> </div> <div class="panel panel-default" ng-show="!loading"> <div class="panel-heading"> <h3> {{'MyPreferences' | translate}} </h3> </div> <form class="form-horizontal" ng-submit="save()" role="form" name="form" ng-show="!loading" > <div class="panel-body"> <div class="col-xs-12"> <div class="col-xs-9 col-xs-offset-1"> <div class="col-xs-8 col-xs-offset-4 input-group"> <div class="alert alert-danger" role="alert" ng-show="error"> <strong>{{errorMessage | translate}}</strong> </div> <div class="alert alert-success" role="alert" ng-show="success"> <strong translate="saveCorrectamente"></strong> </div> </div> </div> </div> <div class="col-xs-12"> <div class="col-xs-12 col-sm-6"> <div class="form-group"> <label for="timezoneId" class="col-xs-4 control-label" translate="TimeZone"></label> <div class="col-xs-8 input-group"> <select name="timezoneId" class="form-control" required="required" ng-model="user.timezoneSelect" ng-options="timeZone.tz for timeZone in timeZones track by timeZone.id" ng-change="user.timezone.id = user.timezoneSelect.id" > </select> </div> </div> </div> <div class="col-xs-12 col-sm-6"> <div class="form-group"> <label for="doNotDisturb" class="col-xs-4 control-label" translate="DoNotDisturb"></label> <div class="col-xs-8 input-group"> <select name="doNotDisturb" class="form-control" id="doNotDisturb" ng-model="user.doNotDisturb" required="required" > <option value="1" translate="yes"></option> <option value="0" translate="no"></option> </select> </div> </div> </div> <div class="col-xs-12 col-sm-6"> <div class="form-group"> <label for="maxCalls" class="col-xs-4 control-label" translate="CallWaiting"></label> <div class="col-xs-8 input-group"> <input type="number" name="maxCalls" id="maxCalls" class="form-control" ng-model="user.maxCalls" /> </div> </div> </div> </div> <div class="col-xs-12" ng-show="user.isBoss"> <div class="col-xs-12 col-sm-6"> <div class="form-group"> <label for="bossAssistantId" class="col-xs-4 control-label" translate="bossAssistant"></label> <div class="col-xs-8 input-group"> <select name="bossAssistantId" class="form-control" id="bossAssistantId" ng-model="user.bossAssistant.id" ng-options="assistant.id as assistant.fullname for assistant in assistants" > <option value=""></option> </select> </div> </div> </div> </div> </div> <div class="panel-footer text-center"> <button type="submit" class="btn btn-success" ng-disabled="form.$invalid" translate="saveChanges" ></button> <a class="btn btn-danger" ng-href="#/index" translate="cancelAndIndex" ></a> </div> </form> </div>
{ "pile_set_name": "Github" }
function PlotHDF5FieldData(file, PlotArgs) % function PlotHDF5FieldData(file, PlotArgs) % % e.g. % PlotArgs.slice = {0 [10 20] 0}; % PlotArgs.pauseTime=0.01; % PlotArgs.component=2; % PlotArgs.Limit = 'auto'; % % PlotHDF5FieldData('tmp/Et.h5',PlotArgs) % % openEMS matlab interface % ----------------------- % author: Thorsten Liebig component = PlotArgs.component; if (isfield(PlotArgs,'pauseTime')) pauseT = PlotArgs.pauseTime; else pauseT = 0.01; end mesh = ReadHDF5Mesh(file); fields = ReadHDF5FieldData(file); if (mesh.type==0) % Cartesian mesh [X Y Z] = meshgrid(mesh.lines{1},mesh.lines{2},mesh.lines{3}); for n=1:numel(fields.TD.values) % since Matlab 7.1SP3 the field needs to be reordered fields.TD.values{n} = permute(fields.TD.values{n},[2 1 3 4]); % reorder: y,x,z (or y,x) end else disp(['PlotHDF5FieldData:: Error: unknown mesh type ' num2str(mesh.type)]); end max_amp = 0; if (component>0) for n=1:numel(fields.TD.values) Field{n} = fields.TD.values{n}(:,:,:,component); end else for n=1:numel(fields.TD.values) fx = fields.TD.values{n}(:,:,:,1); fy = fields.TD.values{n}(:,:,:,2); fz = fields.TD.values{n}(:,:,:,3); Field{n} = sqrt(fx.^2 + fy.^2 + fz.^2); end end for n=1:numel(Field) amp = max(max(max(abs(Field{n})))); if (amp>max_amp) max_amp = amp; end end if (max_amp==0) disp('max found amplitude was 0 --> nothing to plot'); return end for n=1:numel(Field) if size(Field{n},3) > 1 % Field is a volume hsurfaces = slice(X,Y,Z, Field{n} , PlotArgs.slice{:}); set(hsurfaces,'FaceColor','interp','EdgeColor','none'); else % Field is already a 2D cut pcolor(X,Y,Field{n}); shading( 'interp' ); xlabel( 'x' ); ylabel( 'y' ); end title(fields.TD.names{n}); %view(3) axis equal if (isfield(PlotArgs,'Limit')) if ~ischar(PlotArgs.Limit) caxis(PlotArgs.Limit); elseif strcmp(PlotArgs.Limit,'auto') if (component>0) caxis([-max_amp,max_amp]); else caxis([0,max_amp]); end end end drawnow pause(pauseT) end
{ "pile_set_name": "Github" }
{% extends "base.html" %} {% block title %}Groups{% endblock %} {% block page-content %} <div class="wrap"> {% if can_mod_groups %} <fieldset> <legend>Add New Groups</legend> {% if error %}<p style="color: #FF0000;">{{ error }}</p>{% endif %} <form method="POST"> <input type="hidden" name="xsrf_token" value="{{ xsrf_token }}" /> <input type="hidden" name="action" value="create" /> Group: <input type="text" name="group" /> <button type="submit" style="margin-left: 20px;">Create</button> </form> </fieldset> <h3>Existing Groups</h3> {% endif %} <table class="stats-table"> <tr class="multi-header"> <th>Groups</th><th>Admin</th><th>Users</th><th>Delete</th> </tr> {% for g in groups %} <tr> <td>{{ g.key.name }}</td> <td>{{ g.user }}</td> <td><a href="/admin?filter-type=group&amp;filter={{ g.key.name|urlencode }}"> {{ g.users|length }}</a></td> <td> {% if can_mod_groups %} <form method="POST"> <input type="hidden" name="xsrf_token" value="{{ xsrf_token }}" /> <input type="hidden" name="action" value="delete" /> <input type="hidden" name="group" value="{{ g.key.name }}" /> <button class="red delete">Delete</button> </form> {% else %} N/A {% endif %} </td> </tr> {% endfor %} </table> </div> {% endblock %}
{ "pile_set_name": "Github" }
version=$(git log sysinfo |grep commit |head -2 |tail -1|awk '{print $2}') echo "sysinfo:" git diff $version sysinfo |grep '^+' |sed -e 's/+/ /' echo "pkgsrc:" git diff $version ../pkgsrc/pkginfo |grep '^+' |sed -e 's/+/ /' |awk '{print " "$1}'
{ "pile_set_name": "Github" }
--TEST-- PHP Spec test generated from ./variables/variable_names.php --FILE-- <?php /* +-------------------------------------------------------------+ | Copyright (c) 2014 Facebook, Inc. (http://www.facebook.com) | +-------------------------------------------------------------+ */ error_reporting(-1); $v = 10; $$v = 99; var_dump($$v); ${$v} = 100; var_dump(${$v}); ${10} = 101; var_dump(${10}); ${1.2} = 102; ${'abc'} = 103; ${TRUE} = 104; ${FALSE} = 105; ${NULL} = 106; //${total} = 1000; // disallowed; undefined constant total //${t o tal} = 1000; // disallowed; ill-formed expression //${+} = 1000; // disallowed; ill-formed expression ${10 + 4} = 1000; // allowed ${'ab' . 'xy'} = 1000; // allowed function f1 () { return 2.5; } ${1 + f1()} = 1000; // allowed function print_globals() { $globals = array(); foreach ($GLOBALS as $k => $v) { if ($k != 'GLOBALS' && $k != 'php_errormsg' && $k != 'HTTP_RAW_POST_DATA' && (!$k || $k[0] != '_')) { $globals[$k] = $v; } } asort($globals); var_dump($globals); } print_globals(); --EXPECTF-- int(99) int(100) int(101) array(11) { ["argc"]=> int(1) ["v"]=> int(10) [10]=> int(101) ["1.2"]=> int(102) ["abc"]=> int(103) [1]=> int(104) [""]=> int(106) [14]=> int(1000) ["abxy"]=> int(1000) ["3.5"]=> int(1000) ["argv"]=> array(1) { [0]=> string(%d) "%s/tests/variables/variable_names.php" } }
{ "pile_set_name": "Github" }
# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. dnl --------------------------------------------------------------------------- dnl Support macros for makefiles generated by BAKEFILE. dnl --------------------------------------------------------------------------- dnl Lots of compiler & linker detection code contained here was taken from dnl wxWindows configure.in script (see http://www.wxwindows.org) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_GNUMAKE dnl dnl Detects GNU make dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_GNUMAKE], [ dnl does make support "-include" (only GNU make does AFAIK)? AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu, [ if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null | egrep -s GNU > /dev/null); then bakefile_cv_prog_makeisgnu="yes" else bakefile_cv_prog_makeisgnu="no" fi ]) if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then IF_GNU_MAKE="" else IF_GNU_MAKE="#" fi AC_SUBST(IF_GNU_MAKE) ]) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_PLATFORM dnl dnl Detects platform and sets PLATFORM_XXX variables accordingly dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_PLATFORM], [ PLATFORM_UNIX=0 PLATFORM_WIN32=0 PLATFORM_MSDOS=0 PLATFORM_MAC=0 PLATFORM_MACOS=0 PLATFORM_MACOSX=0 PLATFORM_OS2=0 PLATFORM_BEOS=0 if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then case "${BAKEFILE_HOST}" in *-*-mingw32* ) PLATFORM_WIN32=1 ;; *-pc-msdosdjgpp ) PLATFORM_MSDOS=1 ;; *-pc-os2_emx | *-pc-os2-emx ) PLATFORM_OS2=1 ;; *-*-darwin* ) PLATFORM_MAC=1 PLATFORM_MACOSX=1 ;; *-*-beos* ) PLATFORM_BEOS=1 ;; powerpc-apple-macos* ) PLATFORM_MAC=1 PLATFORM_MACOS=1 ;; * ) PLATFORM_UNIX=1 ;; esac else case "$BAKEFILE_FORCE_PLATFORM" in win32 ) PLATFORM_WIN32=1 ;; msdos ) PLATFORM_MSDOS=1 ;; os2 ) PLATFORM_OS2=1 ;; darwin ) PLATFORM_MAC=1 PLATFORM_MACOSX=1 ;; unix ) PLATFORM_UNIX=1 ;; beos ) PLATFORM_BEOS=1 ;; * ) AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM]) ;; esac fi AC_SUBST(PLATFORM_UNIX) AC_SUBST(PLATFORM_WIN32) AC_SUBST(PLATFORM_MSDOS) AC_SUBST(PLATFORM_MAC) AC_SUBST(PLATFORM_MACOS) AC_SUBST(PLATFORM_MACOSX) AC_SUBST(PLATFORM_OS2) AC_SUBST(PLATFORM_BEOS) ]) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_PLATFORM_SPECIFICS dnl dnl Sets misc platform-specific settings dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS], [ AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf], [use OMF object format (OS/2)]), [bk_os2_use_omf="$enableval"]) case "${BAKEFILE_HOST}" in *-*-darwin* ) dnl For Unix to MacOS X porting instructions, see: dnl http://fink.sourceforge.net/doc/porting/porting.html if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -fno-common" CXXFLAGS="$CXXFLAGS -fno-common" fi if test "x$XLCC" = "xyes"; then CFLAGS="$CFLAGS -qnocommon" CXXFLAGS="$CXXFLAGS -qnocommon" fi ;; *-pc-os2_emx | *-pc-os2-emx ) if test "x$bk_os2_use_omf" = "xyes" ; then AR=emxomfar RANLIB=: LDFLAGS="-Zomf $LDFLAGS" CFLAGS="-Zomf $CFLAGS" CXXFLAGS="-Zomf $CXXFLAGS" OS2_LIBEXT="lib" else OS2_LIBEXT="a" fi ;; i*86-*-beos* ) LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS" ;; esac ]) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_SUFFIXES dnl dnl Detects shared various suffixes for shared libraries, libraries, programs, dnl plugins etc. dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_SUFFIXES], [ SO_SUFFIX="so" SO_SUFFIX_MODULE="so" EXEEXT="" LIBPREFIX="lib" LIBEXT=".a" DLLPREFIX="lib" DLLPREFIX_MODULE="" DLLIMP_SUFFIX="" dlldir="$libdir" case "${BAKEFILE_HOST}" in *-hp-hpux* ) SO_SUFFIX="sl" SO_SUFFIX_MODULE="sl" ;; *-*-aix* ) dnl quoting from dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html: dnl Both archive libraries and shared libraries on AIX have an dnl .a extension. This will explain why you can't link with an dnl .so and why it works with the name changed to .a. SO_SUFFIX="a" SO_SUFFIX_MODULE="a" ;; *-*-cygwin* ) SO_SUFFIX="dll" SO_SUFFIX_MODULE="dll" DLLIMP_SUFFIX="dll.a" EXEEXT=".exe" DLLPREFIX="cyg" dlldir="$bindir" ;; *-*-mingw32* ) SO_SUFFIX="dll" SO_SUFFIX_MODULE="dll" DLLIMP_SUFFIX="dll.a" EXEEXT=".exe" DLLPREFIX="" dlldir="$bindir" ;; *-pc-msdosdjgpp ) EXEEXT=".exe" DLLPREFIX="" dlldir="$bindir" ;; *-pc-os2_emx | *-pc-os2-emx ) SO_SUFFIX="dll" SO_SUFFIX_MODULE="dll" DLLIMP_SUFFIX=$OS2_LIBEXT EXEEXT=".exe" DLLPREFIX="" LIBPREFIX="" LIBEXT=".$OS2_LIBEXT" dlldir="$bindir" ;; *-*-darwin* ) SO_SUFFIX="dylib" SO_SUFFIX_MODULE="bundle" ;; esac if test "x$DLLIMP_SUFFIX" = "x" ; then DLLIMP_SUFFIX="$SO_SUFFIX" fi AC_SUBST(SO_SUFFIX) AC_SUBST(SO_SUFFIX_MODULE) AC_SUBST(DLLIMP_SUFFIX) AC_SUBST(EXEEXT) AC_SUBST(LIBPREFIX) AC_SUBST(LIBEXT) AC_SUBST(DLLPREFIX) AC_SUBST(DLLPREFIX_MODULE) AC_SUBST(dlldir) ]) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_SHARED_LD dnl dnl Detects command for making shared libraries, substitutes SHARED_LD_CC dnl and SHARED_LD_CXX. dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_SHARED_LD], [ dnl the extra compiler flags needed for compilation of shared library PIC_FLAG="" if test "x$GCC" = "xyes"; then dnl the switch for gcc is the same under all platforms PIC_FLAG="-fPIC" fi dnl Defaults for GCC and ELF .so shared libs: SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o" SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o" WINDOWS_IMPLIB=0 case "${BAKEFILE_HOST}" in *-hp-hpux* ) dnl default settings are good for gcc but not for the native HP-UX if test "x$GCC" != "xyes"; then dnl no idea why it wants it, but it does LDFLAGS="$LDFLAGS -L/usr/lib" SHARED_LD_CC="${CC} -b -o" SHARED_LD_CXX="${CXX} -b -o" PIC_FLAG="+Z" fi ;; *-*-linux* ) if test "x$GCC" != "xyes"; then AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc, [ AC_TRY_COMPILE([], [ #ifndef __INTEL_COMPILER This is not ICC #endif ], bakefile_cv_prog_icc=yes, bakefile_cv_prog_icc=no ) ]) if test "$bakefile_cv_prog_icc" = "yes"; then PIC_FLAG="-KPIC" fi fi ;; *-*-solaris2* ) if test "x$GCC" != xyes ; then SHARED_LD_CC="${CC} -G -o" SHARED_LD_CXX="${CXX} -G -o" PIC_FLAG="-KPIC" fi ;; *-*-darwin* ) AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH chmod +x shared-ld-sh SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o" SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC" dnl Most apps benefit from being fully binded (its faster and static dnl variables initialized at startup work). dnl This can be done either with the exe linker flag -Wl,-bind_at_load dnl or with a double stage link in order to create a single module dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved dnl If using newer dev tools then there is a -single_module flag that dnl we can use to do this for dylibs, otherwise we'll need to use a helper dnl script. Check the version of gcc to see which way we can go: AC_CACHE_CHECK([for gcc 3.1 or later], bakefile_cv_gcc31, [ AC_TRY_COMPILE([], [ #if (__GNUC__ < 3) || \ ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)) This is old gcc #endif ], [ bakefile_cv_gcc31=yes ], [ bakefile_cv_gcc31=no ] ) ]) if test "$bakefile_cv_gcc31" = "no"; then dnl Use the shared-ld-sh helper script SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o" SHARED_LD_CXX="$SHARED_LD_CC" else dnl Use the -single_module flag and let the linker do it for us SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o" SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o" fi if test "x$GCC" == "xyes"; then PIC_FLAG="-dynamic -fPIC" fi if test "x$XLCC" = "xyes"; then PIC_FLAG="-dynamic -DPIC" fi ;; *-*-aix* ) if test "x$GCC" = "xyes"; then dnl at least gcc 2.95 warns that -fPIC is ignored when dnl compiling each and every file under AIX which is annoying, dnl so don't use it there (it's useless as AIX runs on dnl position-independent architectures only anyhow) PIC_FLAG="" dnl -bexpfull is needed by AIX linker to export all symbols (by dnl default it doesn't export any and even with -bexpall it dnl doesn't export all C++ support symbols, e.g. vtable dnl pointers) but it's only available starting from 5.1 (with dnl maintenance pack 2, whatever this is), see dnl http://www-128.ibm.com/developerworks/eserver/articles/gnu.html case "${BAKEFILE_HOST}" in *-*-aix5* ) LD_EXPFULL="-Wl,-bexpfull" ;; esac SHARED_LD_CC="\$(CC) -shared $LD_EXPFULL -o" SHARED_LD_CXX="\$(CXX) -shared $LD_EXPFULL -o" else dnl FIXME: makeC++SharedLib is obsolete, what should we do for dnl recent AIX versions? AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib, makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib) SHARED_LD_CC="$AIX_CC_LD -p 0 -o" SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o" fi ;; *-*-beos* ) dnl can't use gcc under BeOS for shared library creation because it dnl complains about missing 'main' SHARED_LD_CC="${LD} -nostart -o" SHARED_LD_CXX="${LD} -nostart -o" ;; *-*-irix* ) dnl default settings are ok for gcc if test "x$GCC" != "xyes"; then PIC_FLAG="-KPIC" fi ;; *-*-cygwin* | *-*-mingw32* ) PIC_FLAG="" SHARED_LD_CC="\$(CC) -shared -o" SHARED_LD_CXX="\$(CXX) -shared -o" WINDOWS_IMPLIB=1 ;; *-pc-os2_emx | *-pc-os2-emx ) SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o" SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o" PIC_FLAG="" AC_BAKEFILE_CREATE_FILE_DLLAR_SH chmod +x dllar.sh ;; powerpc-apple-macos* | \ *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | *-*-k*bsd*-gnu | \ *-*-sunos4* | \ *-*-osf* | \ *-*-dgux5* | \ *-*-sysv5* | \ *-pc-msdosdjgpp ) dnl defaults are ok ;; *) AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.) esac if test "x$PIC_FLAG" != "x" ; then PIC_FLAG="$PIC_FLAG -DPIC" fi if test "x$SHARED_LD_MODULE_CC" = "x" ; then SHARED_LD_MODULE_CC="$SHARED_LD_CC" fi if test "x$SHARED_LD_MODULE_CXX" = "x" ; then SHARED_LD_MODULE_CXX="$SHARED_LD_CXX" fi AC_SUBST(SHARED_LD_CC) AC_SUBST(SHARED_LD_CXX) AC_SUBST(SHARED_LD_MODULE_CC) AC_SUBST(SHARED_LD_MODULE_CXX) AC_SUBST(PIC_FLAG) AC_SUBST(WINDOWS_IMPLIB) ]) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_SHARED_VERSIONS dnl dnl Detects linker options for attaching versions (sonames) to shared libs. dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS], [ USE_SOVERSION=0 USE_SOVERLINUX=0 USE_SOVERSOLARIS=0 USE_SOVERCYGWIN=0 USE_SOSYMLINKS=0 USE_MACVERSION=0 SONAME_FLAG= case "${BAKEFILE_HOST}" in *-*-linux* | *-*-freebsd* | *-*-k*bsd*-gnu ) SONAME_FLAG="-Wl,-soname," USE_SOVERSION=1 USE_SOVERLINUX=1 USE_SOSYMLINKS=1 ;; *-*-solaris2* ) SONAME_FLAG="-h " USE_SOVERSION=1 USE_SOVERSOLARIS=1 USE_SOSYMLINKS=1 ;; *-*-darwin* ) USE_MACVERSION=1 USE_SOVERSION=1 USE_SOSYMLINKS=1 ;; *-*-cygwin* ) USE_SOVERSION=1 USE_SOVERCYGWIN=1 ;; esac AC_SUBST(USE_SOVERSION) AC_SUBST(USE_SOVERLINUX) AC_SUBST(USE_SOVERSOLARIS) AC_SUBST(USE_SOVERCYGWIN) AC_SUBST(USE_MACVERSION) AC_SUBST(USE_SOSYMLINKS) AC_SUBST(SONAME_FLAG) ]) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_DEPS dnl dnl Detects available C/C++ dependency tracking options dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_DEPS], [ AC_ARG_ENABLE([dependency-tracking], AS_HELP_STRING([--disable-dependency-tracking], [don't use dependency tracking even if the compiler can]), [bk_use_trackdeps="$enableval"]) AC_MSG_CHECKING([for dependency tracking method]) if test "x$bk_use_trackdeps" = "xno" ; then DEPS_TRACKING=0 AC_MSG_RESULT([disabled]) else DEPS_TRACKING=1 if test "x$GCC" = "xyes"; then DEPSMODE=gcc case "${BAKEFILE_HOST}" in *-*-darwin* ) dnl -cpp-precomp (the default) conflicts with -MMD option dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html) DEPSFLAG="-no-cpp-precomp -MMD" ;; * ) DEPSFLAG="-MMD" ;; esac AC_MSG_RESULT([gcc]) elif test "x$MWCC" = "xyes"; then DEPSMODE=mwcc DEPSFLAG="-MM" AC_MSG_RESULT([mwcc]) elif test "x$SUNCC" = "xyes"; then DEPSMODE=unixcc DEPSFLAG="-xM1" AC_MSG_RESULT([Sun cc]) elif test "x$SGICC" = "xyes"; then DEPSMODE=unixcc DEPSFLAG="-M" AC_MSG_RESULT([SGI cc]) elif test "x$HPCC" = "xyes"; then DEPSMODE=unixcc DEPSFLAG="+make" AC_MSG_RESULT([HP cc]) elif test "x$COMPAQCC" = "xyes"; then DEPSMODE=gcc DEPSFLAG="-MD" AC_MSG_RESULT([Compaq cc]) else DEPS_TRACKING=0 AC_MSG_RESULT([none]) fi if test $DEPS_TRACKING = 1 ; then AC_BAKEFILE_CREATE_FILE_BK_DEPS chmod +x bk-deps fi fi AC_SUBST(DEPS_TRACKING) ]) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_CHECK_BASIC_STUFF dnl dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib" dnl or "install" dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF], [ AC_PROG_RANLIB AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_SUBST(MAKE_SET) AC_CHECK_TOOL(AR, ar, ar) AC_CHECK_TOOL(STRIP, strip, :) AC_CHECK_TOOL(NM, nm, :) case ${BAKEFILE_HOST} in *-hp-hpux* ) dnl HP-UX install doesn't handle the "-d" switch so don't dnl use it there INSTALL_DIR="mkdir -p" ;; *) INSTALL_DIR="$INSTALL -d" ;; esac AC_SUBST(INSTALL_DIR) LDFLAGS_GUI= case ${BAKEFILE_HOST} in *-*-cygwin* | *-*-mingw32* ) LDFLAGS_GUI="-mwindows" esac AC_SUBST(LDFLAGS_GUI) ]) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_RES_COMPILERS dnl dnl Checks for presence of resource compilers for win32 or mac dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_RES_COMPILERS], [ case ${BAKEFILE_HOST} in *-*-cygwin* | *-*-mingw32* ) dnl Check for win32 resources compiler: AC_CHECK_TOOL(WINDRES, windres) ;; *-*-darwin* | powerpc-apple-macos* ) AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez) AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile) ;; esac AC_SUBST(WINDRES) AC_SUBST(REZ) AC_SUBST(SETFILE) ]) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE_PRECOMP_HEADERS dnl dnl Check for precompiled headers support (GCC >= 3.4) dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS], [ AC_ARG_ENABLE([precomp-headers], AS_HELP_STRING([--disable-precomp-headers], [don't use precompiled headers even if compiler can]), [bk_use_pch="$enableval"]) GCC_PCH=0 ICC_PCH=0 USE_PCH=0 case ${BAKEFILE_HOST} in *-*-cygwin* ) dnl PCH support is broken in cygwin gcc because of unportable dnl assumptions about mmap() in gcc code which make PCH generation dnl fail erratically; disable PCH completely until this is fixed bk_use_pch="no" ;; esac if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then if test "x$GCC" = "xyes"; then dnl test if we have gcc-3.4: AC_MSG_CHECKING([if the compiler supports precompiled headers]) AC_TRY_COMPILE([], [ #if !defined(__GNUC__) || !defined(__GNUC_MINOR__) There is no PCH support #endif #if (__GNUC__ < 3) There is no PCH support #endif #if (__GNUC__ == 3) && \ ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \ ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3))) || \ ( defined(__INTEL_COMPILER) ) There is no PCH support #endif ], [ AC_MSG_RESULT([yes]) GCC_PCH=1 ], [ AC_TRY_COMPILE([], [ #if !defined(__INTEL_COMPILER) || \ (__INTEL_COMPILER < 800) There is no PCH support #endif ], [ AC_MSG_RESULT([yes]) ICC_PCH=1 ], [ AC_MSG_RESULT([no]) ]) ]) if test $GCC_PCH = 1 -o $ICC_PCH = 1 ; then USE_PCH=1 AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH chmod +x bk-make-pch fi fi fi AC_SUBST(GCC_PCH) AC_SUBST(ICC_PCH) ]) dnl --------------------------------------------------------------------------- dnl AC_BAKEFILE([autoconf_inc.m4 inclusion]) dnl dnl To be used in configure.in of any project using Bakefile-generated mks dnl dnl Behaviour can be modified by setting following variables: dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to dnl to perform check for basic tools like ranlib dnl BAKEFILE_HOST set this to override host detection, defaults dnl to ${host} dnl BAKEFILE_FORCE_PLATFORM set to override platform detection dnl dnl Example usage: dnl dnl AC_BAKEFILE([FOO(autoconf_inc.m4)]) dnl dnl (replace FOO with m4_include above, aclocal would die otherwise) dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing dnl we can do...) dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE], [ AC_PREREQ(2.58) if test "x$BAKEFILE_HOST" = "x"; then if test "x${host}" = "x" ; then AC_MSG_ERROR([You must call the autoconf "CANONICAL_HOST" macro in your configure.ac (or .in) file.]) fi BAKEFILE_HOST="${host}" fi if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then AC_BAKEFILE_CHECK_BASIC_STUFF fi AC_BAKEFILE_GNUMAKE AC_BAKEFILE_PLATFORM AC_BAKEFILE_PLATFORM_SPECIFICS AC_BAKEFILE_SUFFIXES AC_BAKEFILE_SHARED_LD AC_BAKEFILE_SHARED_VERSIONS AC_BAKEFILE_DEPS AC_BAKEFILE_RES_COMPILERS BAKEFILE_BAKEFILE_M4_VERSION="0.2.0" dnl includes autoconf_inc.m4: $1 if test "$BAKEFILE_AUTOCONF_INC_M4_VERSION" = "" ; then AC_MSG_ERROR([No version found in autoconf_inc.m4 - bakefile macro was changed to take additional argument, perhaps configure.in wasn't updated (see the documentation)?]) fi if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.]) fi ]) dnl --------------------------------------------------------------------------- dnl Embedded copies of helper scripts follow: dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH], [ dnl ===================== dllar.sh begins here ===================== dnl (Created by merge-scripts.py from dllar.sh dnl file do not edit here!) D='$' cat <<EOF >dllar.sh #!/bin/sh # # dllar - a tool to build both a .dll and an .a file # from a set of object (.o) files for EMX/OS2. # # Written by Andrew Zabolotny, [email protected] # Ported to Unix like shell by Stefan Neis, [email protected] # # This script will accept a set of files on the command line. # All the public symbols from the .o files will be exported into # a .DEF file, then linker will be run (through gcc) against them to # build a shared library consisting of all given .o files. All libraries # (.a) will be first decompressed into component .o files then act as # described above. You can optionally give a description (-d "description") # which will be put into .DLL. To see the list of accepted options (as well # as command-line format) simply run this program without options. The .DLL # is built to be imported by name (there is no guarantee that new versions # of the library you build will have same ordinals for same symbols). # # dllar 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, or (at your option) # any later version. # # dllar 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 dllar; see the file COPYING. If not, write to the Free # Software Foundation, 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # To successfuly run this program you will need: # - Current drive should have LFN support (HPFS, ext2, network, etc) # (Sometimes dllar generates filenames which won't fit 8.3 scheme) # - gcc # (used to build the .dll) # - emxexp # (used to create .def file from .o files) # - emximp # (used to create .a file from .def file) # - GNU text utilites (cat, sort, uniq) # used to process emxexp output # - GNU file utilities (mv, rm) # - GNU sed # - lxlite (optional, see flag below) # (used for general .dll cleanup) # flag_USE_LXLITE=1; # # helper functions # basnam, variant of basename, which does _not_ remove the path, _iff_ # second argument (suffix to remove) is given basnam(){ case ${D}# in 1) echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//' ;; 2) echo ${D}1 | sed 's/'${D}2'${D}//' ;; *) echo "error in basnam ${D}*" exit 8 ;; esac } # Cleanup temporary files and output CleanUp() { cd ${D}curDir for i in ${D}inputFiles ; do case ${D}i in *!) rm -rf \`basnam ${D}i !\` ;; *) ;; esac done # Kill result in case of failure as there is just to many stupid make/nmake # things out there which doesn't do this. if @<:@ ${D}# -eq 0 @:>@; then rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile fi } # Print usage and exit script with rc=1. PrintHelp() { echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@' echo ' @<:@-name-mangler-script script.sh@:>@' echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@' echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"' echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@' echo ' @<:@*.o@:>@ @<:@*.a@:>@' echo '*> "output_file" should have no extension.' echo ' If it has the .o, .a or .dll extension, it is automatically removed.' echo ' The import library name is derived from this and is set to "name".a,' echo ' unless overridden by -import' echo '*> "importlib_name" should have no extension.' echo ' If it has the .o, or .a extension, it is automatically removed.' echo ' This name is used as the import library name and may be longer and' echo ' more descriptive than the DLL name which has to follow the old ' echo ' 8.3 convention of FAT.' echo '*> "script.sh may be given to override the output_file name by a' echo ' different name. It is mainly useful if the regular make process' echo ' of some package does not take into account OS/2 restriction of' echo ' DLL name lengths. It takes the importlib name as input and is' echo ' supposed to procude a shorter name as output. The script should' echo ' expect to get importlib_name without extension and should produce' echo ' a (max.) 8 letter name without extension.' echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)' echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)' echo ' These flags will be put at the start of GCC command line.' echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.' echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define' echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".' echo ' If the last character of a symbol is "*", all symbols beginning' echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).' echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or' echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.' echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s' echo ' C runtime DLLs.' echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.' echo '*> All other switches (for example -L./ or -lmylib) will be passed' echo ' unchanged to GCC at the end of command line.' echo '*> If you create a DLL from a library and you do not specify -o,' echo ' the basename for DLL and import library will be set to library name,' echo ' the initial library will be renamed to 'name'_s.a (_s for static)' echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial' echo ' library will be renamed into gcc_s.a.' echo '--------' echo 'Example:' echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord' echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"' CleanUp exit 1 } # Execute a command. # If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script. # @Uses Whatever CleanUp() uses. doCommand() { echo "${D}*" eval ${D}* rcCmd=${D}? if @<:@ ${D}rcCmd -ne 0 @:>@; then echo "command failed, exit code="${D}rcCmd CleanUp exit ${D}rcCmd fi } # main routine # setup globals cmdLine=${D}* outFile="" outimpFile="" inputFiles="" renameScript="" description="" CC=gcc.exe CFLAGS="-s -Zcrtdll" EXTRA_CFLAGS="" EXPORT_BY_ORDINALS=0 exclude_symbols="" library_flags="" curDir=\`pwd\` curDirS=curDir case ${D}curDirS in */) ;; *) curDirS=${D}{curDirS}"/" ;; esac # Parse commandline libsToLink=0 omfLinking=0 while @<:@ ${D}1 @:>@; do case ${D}1 in -ord*) EXPORT_BY_ORDINALS=1; ;; -o*) shift outFile=${D}1 ;; -i*) shift outimpFile=${D}1 ;; -name-mangler-script) shift renameScript=${D}1 ;; -d*) shift description=${D}1 ;; -f*) shift CFLAGS=${D}1 ;; -c*) shift CC=${D}1 ;; -h*) PrintHelp ;; -ex*) shift exclude_symbols=${D}{exclude_symbols}${D}1" " ;; -libf*) shift library_flags=${D}{library_flags}${D}1" " ;; -nocrt*) CFLAGS="-s" ;; -nolxl*) flag_USE_LXLITE=0 ;; -* | /*) case ${D}1 in -L* | -l*) libsToLink=1 ;; -Zomf) omfLinking=1 ;; *) ;; esac EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1 ;; *.dll) EXTRA_CFLAGS="${D}{EXTRA_CFLAGS} \`basnam ${D}1 .dll\`" if @<:@ ${D}omfLinking -eq 1 @:>@; then EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.lib" else EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.a" fi ;; *) found=0; if @<:@ ${D}libsToLink -ne 0 @:>@; then EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1 else for file in ${D}1 ; do if @<:@ -f ${D}file @:>@; then inputFiles="${D}{inputFiles} ${D}file" found=1 fi done if @<:@ ${D}found -eq 0 @:>@; then echo "ERROR: No file(s) found: "${D}1 exit 8 fi fi ;; esac shift done # iterate cmdline words # if @<:@ -z "${D}inputFiles" @:>@; then echo "dllar: no input files" PrintHelp fi # Now extract all .o files from .a files newInputFiles="" for file in ${D}inputFiles ; do case ${D}file in *.a | *.lib) case ${D}file in *.a) suffix=".a" AR="ar" ;; *.lib) suffix=".lib" AR="emxomfar" EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf" ;; *) ;; esac dirname=\`basnam ${D}file ${D}suffix\`"_%" mkdir ${D}dirname if @<:@ ${D}? -ne 0 @:>@; then echo "Failed to create subdirectory ./${D}dirname" CleanUp exit 8; fi # Append '!' to indicate archive newInputFiles="${D}newInputFiles ${D}{dirname}!" doCommand "cd ${D}dirname; ${D}AR x ../${D}file" cd ${D}curDir found=0; for subfile in ${D}dirname/*.o* ; do if @<:@ -f ${D}subfile @:>@; then found=1 if @<:@ -s ${D}subfile @:>@; then # FIXME: This should be: is file size > 32 byte, _not_ > 0! newInputFiles="${D}newInputFiles ${D}subfile" fi fi done if @<:@ ${D}found -eq 0 @:>@; then echo "WARNING: there are no files in archive \\'${D}file\\'" fi ;; *) newInputFiles="${D}{newInputFiles} ${D}file" ;; esac done inputFiles="${D}newInputFiles" # Output filename(s). do_backup=0; if @<:@ -z ${D}outFile @:>@; then do_backup=1; set outFile ${D}inputFiles; outFile=${D}2 fi # If it is an archive, remove the '!' and the '_%' suffixes case ${D}outFile in *_%!) outFile=\`basnam ${D}outFile _%!\` ;; *) ;; esac case ${D}outFile in *.dll) outFile=\`basnam ${D}outFile .dll\` ;; *.DLL) outFile=\`basnam ${D}outFile .DLL\` ;; *.o) outFile=\`basnam ${D}outFile .o\` ;; *.obj) outFile=\`basnam ${D}outFile .obj\` ;; *.a) outFile=\`basnam ${D}outFile .a\` ;; *.lib) outFile=\`basnam ${D}outFile .lib\` ;; *) ;; esac case ${D}outimpFile in *.a) outimpFile=\`basnam ${D}outimpFile .a\` ;; *.lib) outimpFile=\`basnam ${D}outimpFile .lib\` ;; *) ;; esac if @<:@ -z ${D}outimpFile @:>@; then outimpFile=${D}outFile fi defFile="${D}{outFile}.def" arcFile="${D}{outimpFile}.a" arcFile2="${D}{outimpFile}.lib" #create ${D}dllFile as something matching 8.3 restrictions, if @<:@ -z ${D}renameScript @:>@ ; then dllFile="${D}outFile" else dllFile=\`${D}renameScript ${D}outimpFile\` fi if @<:@ ${D}do_backup -ne 0 @:>@ ; then if @<:@ -f ${D}arcFile @:>@ ; then doCommand "mv ${D}arcFile ${D}{outFile}_s.a" fi if @<:@ -f ${D}arcFile2 @:>@ ; then doCommand "mv ${D}arcFile2 ${D}{outFile}_s.lib" fi fi # Extract public symbols from all the object files. tmpdefFile=${D}{defFile}_% rm -f ${D}tmpdefFile for file in ${D}inputFiles ; do case ${D}file in *!) ;; *) doCommand "emxexp -u ${D}file >> ${D}tmpdefFile" ;; esac done # Create the def file. rm -f ${D}defFile echo "LIBRARY \`basnam ${D}dllFile\` ${D}library_flags" >> ${D}defFile dllFile="${D}{dllFile}.dll" if @<:@ ! -z ${D}description @:>@; then echo "DESCRIPTION \\"${D}{description}\\"" >> ${D}defFile fi echo "EXPORTS" >> ${D}defFile doCommand "cat ${D}tmpdefFile | sort.exe | uniq.exe > ${D}{tmpdefFile}%" grep -v "^ *;" < ${D}{tmpdefFile}% | grep -v "^ *${D}" >${D}tmpdefFile # Checks if the export is ok or not. for word in ${D}exclude_symbols; do grep -v ${D}word < ${D}tmpdefFile >${D}{tmpdefFile}% mv ${D}{tmpdefFile}% ${D}tmpdefFile done if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then sed "=" < ${D}tmpdefFile | \\ sed ' N : loop s/^\\(@<:@0-9@:>@\\+\\)\\(@<:@^;@:>@*\\)\\(;.*\\)\\?/\\2 @\\1 NONAME/ t loop ' > ${D}{tmpdefFile}% grep -v "^ *${D}" < ${D}{tmpdefFile}% > ${D}tmpdefFile else rm -f ${D}{tmpdefFile}% fi cat ${D}tmpdefFile >> ${D}defFile rm -f ${D}tmpdefFile # Do linking, create implib, and apply lxlite. gccCmdl=""; for file in ${D}inputFiles ; do case ${D}file in *!) ;; *) gccCmdl="${D}gccCmdl ${D}file" ;; esac done doCommand "${D}CC ${D}CFLAGS -Zdll -o ${D}dllFile ${D}defFile ${D}gccCmdl ${D}EXTRA_CFLAGS" touch "${D}{outFile}.dll" doCommand "emximp -o ${D}arcFile ${D}defFile" if @<:@ ${D}flag_USE_LXLITE -ne 0 @:>@; then add_flags=""; if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then add_flags="-ynd" fi doCommand "lxlite -cs -t: -mrn -mln ${D}add_flags ${D}dllFile" fi doCommand "emxomf -s -l ${D}arcFile" # Successful exit. CleanUp 1 exit 0 EOF dnl ===================== dllar.sh ends here ===================== ]) AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS], [ dnl ===================== bk-deps begins here ===================== dnl (Created by merge-scripts.py from bk-deps dnl file do not edit here!) D='$' cat <<EOF >bk-deps #!/bin/sh # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf # script. It is used to track C/C++ files dependencies in portable way. # # Permission is given to use this file in any way. DEPSMODE=${DEPSMODE} DEPSDIR=.deps DEPSFLAG="${DEPSFLAG}" mkdir -p ${D}DEPSDIR if test ${D}DEPSMODE = gcc ; then ${D}* ${D}{DEPSFLAG} status=${D}? if test ${D}{status} != 0 ; then exit ${D}{status} fi # move created file to the location we want it in: while test ${D}# -gt 0; do case "${D}1" in -o ) shift objfile=${D}1 ;; -* ) ;; * ) srcfile=${D}1 ;; esac shift done depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\` depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\` if test -f ${D}depfile ; then sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d rm -f ${D}depfile else # "g++ -MMD -o fooobj.o foosrc.cpp" produces fooobj.d depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\` if test ! -f ${D}depfile ; then # "cxx -MD -o fooobj.o foosrc.cpp" creates fooobj.o.d (Compaq C++) depfile="${D}objfile.d" fi if test -f ${D}depfile ; then sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d rm -f ${D}depfile fi fi exit 0 elif test ${D}DEPSMODE = mwcc ; then ${D}* || exit ${D}? # Run mwcc again with -MM and redirect into the dep file we want # NOTE: We can't use shift here because we need ${D}* to be valid prevarg= for arg in ${D}* ; do if test "${D}prevarg" = "-o"; then objfile=${D}arg else case "${D}arg" in -* ) ;; * ) srcfile=${D}arg ;; esac fi prevarg="${D}arg" done ${D}* ${D}DEPSFLAG >${D}{DEPSDIR}/${D}{objfile}.d exit 0 elif test ${D}DEPSMODE = unixcc; then ${D}* || exit ${D}? # Run compiler again with deps flag and redirect into the dep file. # It doesn't work if the '-o FILE' option is used, but without it the # dependency file will contain the wrong name for the object. So it is # removed from the command line, and the dep file is fixed with sed. cmd="" while test ${D}# -gt 0; do case "${D}1" in -o ) shift objfile=${D}1 ;; * ) eval arg${D}#=\\${D}1 cmd="${D}cmd \\${D}arg${D}#" ;; esac shift done eval "${D}cmd ${D}DEPSFLAG" | sed "s|.*:|${D}objfile:|" >${D}{DEPSDIR}/${D}{objfile}.d exit 0 else ${D}* exit ${D}? fi EOF dnl ===================== bk-deps ends here ===================== ]) AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH], [ dnl ===================== shared-ld-sh begins here ===================== dnl (Created by merge-scripts.py from shared-ld-sh dnl file do not edit here!) D='$' cat <<EOF >shared-ld-sh #!/bin/sh #----------------------------------------------------------------------------- #-- Name: distrib/mac/shared-ld-sh #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X #-- Author: Gilles Depeyrot #-- Copyright: (c) 2002 Gilles Depeyrot #-- Licence: any use permitted #----------------------------------------------------------------------------- verbose=0 args="" objects="" linking_flag="-dynamiclib" ldargs="-r -keep_private_externs -nostdlib" while test ${D}# -gt 0; do case ${D}1 in -v) verbose=1 ;; -o|-compatibility_version|-current_version|-framework|-undefined|-install_name) # collect these options and values args="${D}{args} ${D}1 ${D}2" shift ;; -s|-Wl,*) # collect these load args ldargs="${D}{ldargs} ${D}1" ;; -l*|-L*|-flat_namespace|-headerpad_max_install_names) # collect these options args="${D}{args} ${D}1" ;; -dynamiclib|-bundle) linking_flag="${D}1" ;; -*) echo "shared-ld: unhandled option '${D}1'" exit 1 ;; *.o | *.a | *.dylib) # collect object files objects="${D}{objects} ${D}1" ;; *) echo "shared-ld: unhandled argument '${D}1'" exit 1 ;; esac shift done status=0 # # Link one module containing all the others # if test ${D}{verbose} = 1; then echo "c++ ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o" fi c++ ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o status=${D}? # # Link the shared library from the single module created, but only if the # previous command didn't fail: # if test ${D}{status} = 0; then if test ${D}{verbose} = 1; then echo "c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args}" fi c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args} status=${D}? fi # # Remove intermediate module # rm -f master.${D}${D}.o exit ${D}status EOF dnl ===================== shared-ld-sh ends here ===================== ]) AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH], [ dnl ===================== bk-make-pch begins here ===================== dnl (Created by merge-scripts.py from bk-make-pch dnl file do not edit here!) D='$' cat <<EOF >bk-make-pch #!/bin/sh # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf # script. It is used to generated precompiled headers. # # Permission is given to use this file in any way. outfile="${D}{1}" header="${D}{2}" shift shift compiler="" headerfile="" while test ${D}{#} -gt 0; do add_to_cmdline=1 case "${D}{1}" in -I* ) incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\` if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then headerfile="${D}{incdir}/${D}{header}" fi ;; -use-pch|-use_pch ) shift add_to_cmdline=0 ;; esac if test ${D}add_to_cmdline = 1 ; then compiler="${D}{compiler} ${D}{1}" fi shift done if test "x${D}{headerfile}" = "x" ; then echo "error: can't find header ${D}{header} in include paths" >&2 else if test -f ${D}{outfile} ; then rm -f ${D}{outfile} else mkdir -p \`dirname ${D}{outfile}\` fi depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d" mkdir -p .deps if test "x${GCC_PCH}" = "x1" ; then # can do this because gcc is >= 3.4: ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}" elif test "x${ICC_PCH}" = "x1" ; then filename=pch_gen-${D}${D} file=${D}{filename}.c dfile=${D}{filename}.d cat > ${D}file <<EOT #include "${D}header" EOT # using -MF icc complains about differing command lines in creation/use ${D}compiler -c -create_pch ${D}outfile -MMD ${D}file && \\ sed -e "s,^.*:,${D}outfile:," -e "s, ${D}file,," < ${D}dfile > ${D}depsfile && \\ rm -f ${D}file ${D}dfile ${D}{filename}.o fi exit ${D}{?} fi EOF dnl ===================== bk-make-pch ends here ===================== ]) dnl --------------------------------------------------------------------------- dnl Macros for wxWidgets detection. Typically used in configure.in as: dnl dnl AC_ARG_ENABLE(...) dnl AC_ARG_WITH(...) dnl ... dnl AM_OPTIONS_WXCONFIG dnl ... dnl ... dnl AM_PATH_WXCONFIG(2.6.0, wxWin=1) dnl if test "$wxWin" != 1; then dnl AC_MSG_ERROR([ dnl wxWidgets must be installed on your system dnl but wx-config script couldn't be found. dnl dnl Please check that wx-config is in path, the directory dnl where wxWidgets libraries are installed (returned by dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or dnl equivalent variable and wxWidgets version is 2.3.4 or above. dnl ]) dnl fi dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" dnl dnl LIBS="$LIBS $WX_LIBS" dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl AM_OPTIONS_WXCONFIG dnl dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and dnl --wx-config command line options dnl --------------------------------------------------------------------------- AC_DEFUN([AM_OPTIONS_WXCONFIG], [ AC_ARG_WITH(wxdir, [ --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH], [ wx_config_name="$withval/wx-config" wx_config_args="--inplace"]) AC_ARG_WITH(wx-config, [ --with-wx-config=CONFIG wx-config script to use (optional)], wx_config_name="$withval" ) AC_ARG_WITH(wx-prefix, [ --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)], wx_config_prefix="$withval", wx_config_prefix="") AC_ARG_WITH(wx-exec-prefix, [ --with-wx-exec-prefix=PREFIX Exec prefix where wxWidgets is installed (optional)], wx_config_exec_prefix="$withval", wx_config_exec_prefix="") ]) dnl Helper macro for checking if wx version is at least $1.$2.$3, set's dnl wx_ver_ok=yes if it is: AC_DEFUN([_WX_PRIVATE_CHECK_VERSION], [ wx_ver_ok="" if test "x$WX_VERSION" != x ; then if test $wx_config_major_version -gt $1; then wx_ver_ok=yes else if test $wx_config_major_version -eq $1; then if test $wx_config_minor_version -gt $2; then wx_ver_ok=yes else if test $wx_config_minor_version -eq $2; then if test $wx_config_micro_version -ge $3; then wx_ver_ok=yes fi fi fi fi fi fi ]) dnl --------------------------------------------------------------------------- dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]]) dnl dnl Test for wxWidgets, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC dnl (the latter is for static linking against wxWidgets). Set WX_CONFIG_NAME dnl environment variable to override the default name of the wx-config script dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this dnl case the macro won't even waste time on tests for its existence. dnl dnl Optional WX-LIBS argument contains comma- or space-separated list of dnl wxWidgets libraries to link against (it may include contrib libraries). If dnl it is not specified then WX_LIBS and WX_LIBS_STATIC will contain flags to dnl link with all of the core wxWidgets libraries. dnl dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config dnl invocation command in present. It can be used to fine-tune lookup of dnl best wxWidgets build available. dnl dnl Example use: dnl AM_PATH_WXCONFIG([2.6.0], [wxWin=1], [wxWin=0], [html,core,net] dnl [--unicode --debug]) dnl --------------------------------------------------------------------------- dnl dnl Get the cflags and libraries from the wx-config script dnl AC_DEFUN([AM_PATH_WXCONFIG], [ dnl do we have wx-config name: it can be wx-config or wxd-config or ... if test x${WX_CONFIG_NAME+set} != xset ; then WX_CONFIG_NAME=wx-config fi if test "x$wx_config_name" != x ; then WX_CONFIG_NAME="$wx_config_name" fi dnl deal with optional prefixes if test x$wx_config_exec_prefix != x ; then wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix" WX_LOOKUP_PATH="$wx_config_exec_prefix/bin" fi if test x$wx_config_prefix != x ; then wx_config_args="$wx_config_args --prefix=$wx_config_prefix" WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin" fi if test "$cross_compiling" = "yes"; then wx_config_args="$wx_config_args --host=$host_alias" fi dnl don't search the PATH if WX_CONFIG_NAME is absolute filename if test -x "$WX_CONFIG_NAME" ; then AC_MSG_CHECKING(for wx-config) WX_CONFIG_PATH="$WX_CONFIG_NAME" AC_MSG_RESULT($WX_CONFIG_PATH) else AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH") fi if test "$WX_CONFIG_PATH" != "no" ; then WX_VERSION="" min_wx_version=ifelse([$1], ,2.2.1,$1) if test -z "$5" ; then AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version]) else AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version ($5)]) fi WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5 $4" WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null` wx_config_major_version=`echo $WX_VERSION | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` wx_config_minor_version=`echo $WX_VERSION | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` wx_config_micro_version=`echo $WX_VERSION | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` wx_requested_major_version=`echo $min_wx_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` wx_requested_minor_version=`echo $min_wx_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` wx_requested_micro_version=`echo $min_wx_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` _WX_PRIVATE_CHECK_VERSION([$wx_requested_major_version], [$wx_requested_minor_version], [$wx_requested_micro_version]) if test -n "$wx_ver_ok"; then AC_MSG_RESULT(yes (version $WX_VERSION)) WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs` dnl is this even still appropriate? --static is a real option now dnl and WX_CONFIG_WITH_ARGS is likely to contain it if that is dnl what the user actually wants, making this redundant at best. dnl For now keep it in case anyone actually used it in the past. AC_MSG_CHECKING([for wxWidgets static library]) WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs 2>/dev/null` if test "x$WX_LIBS_STATIC" = "x"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) fi dnl starting with version 2.2.6 wx-config has --cppflags argument wx_has_cppflags="" if test $wx_config_major_version -gt 2; then wx_has_cppflags=yes else if test $wx_config_major_version -eq 2; then if test $wx_config_minor_version -gt 2; then wx_has_cppflags=yes else if test $wx_config_minor_version -eq 2; then if test $wx_config_micro_version -ge 6; then wx_has_cppflags=yes fi fi fi fi fi if test "x$wx_has_cppflags" = x ; then dnl no choice but to define all flags like CFLAGS WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags` WX_CPPFLAGS=$WX_CFLAGS WX_CXXFLAGS=$WX_CFLAGS WX_CFLAGS_ONLY=$WX_CFLAGS WX_CXXFLAGS_ONLY=$WX_CFLAGS else dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags` WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags` WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags` WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"` WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"` fi ifelse([$2], , :, [$2]) else if test "x$WX_VERSION" = x; then dnl no wx-config at all AC_MSG_RESULT(no) else AC_MSG_RESULT(no (version $WX_VERSION is not new enough)) fi WX_CFLAGS="" WX_CPPFLAGS="" WX_CXXFLAGS="" WX_LIBS="" WX_LIBS_STATIC="" ifelse([$3], , :, [$3]) fi else WX_CFLAGS="" WX_CPPFLAGS="" WX_CXXFLAGS="" WX_LIBS="" WX_LIBS_STATIC="" ifelse([$3], , :, [$3]) fi AC_SUBST(WX_CPPFLAGS) AC_SUBST(WX_CFLAGS) AC_SUBST(WX_CXXFLAGS) AC_SUBST(WX_CFLAGS_ONLY) AC_SUBST(WX_CXXFLAGS_ONLY) AC_SUBST(WX_LIBS) AC_SUBST(WX_LIBS_STATIC) AC_SUBST(WX_VERSION) ]) dnl --------------------------------------------------------------------------- dnl Get information on the wxrc program for making C++, Python and xrs dnl resource files. dnl dnl AC_ARG_ENABLE(...) dnl AC_ARG_WITH(...) dnl ... dnl AM_OPTIONS_WXCONFIG dnl AM_OPTIONS_WXRC dnl ... dnl AM_PATH_WXCONFIG(2.6.0, wxWin=1) dnl if test "$wxWin" != 1; then dnl AC_MSG_ERROR([ dnl wxWidgets must be installed on your system dnl but wx-config script couldn't be found. dnl dnl Please check that wx-config is in path, the directory dnl where wxWidgets libraries are installed (returned by dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or dnl equivalent variable and wxWidgets version is 2.6.0 or above. dnl ]) dnl fi dnl dnl AM_PATH_WXRC([HAVE_WXRC=1], [HAVE_WXRC=0]) dnl if test "x$HAVE_WXRC" != x1; then dnl AC_MSG_ERROR([ dnl The wxrc program was not installed or not found. dnl dnl Please check the wxWidgets installation. dnl ]) dnl fi dnl dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" dnl dnl LDFLAGS="$LDFLAGS $WX_LIBS" dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl AM_PATH_WXRC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl dnl Test for wxWidgets' wxrc program for creating either C++, Python or XRS dnl resources. The variable WXRC will be set and substituted in the configure dnl script and Makefiles. dnl dnl Example use: dnl AM_PATH_WXRC([wxrc=1], [wxrc=0]) dnl --------------------------------------------------------------------------- dnl dnl wxrc program from the wx-config script dnl AC_DEFUN([AM_PATH_WXRC], [ AC_ARG_VAR([WXRC], [Path to wxWidget's wxrc resource compiler]) if test "x$WX_CONFIG_NAME" = x; then AC_MSG_ERROR([The wxrc tests must run after wxWidgets test.]) else AC_MSG_CHECKING([for wxrc]) if test "x$WXRC" = x ; then dnl wx-config --utility is a new addition to wxWidgets: _WX_PRIVATE_CHECK_VERSION(2,5,3) if test -n "$wx_ver_ok"; then WXRC=`$WX_CONFIG_WITH_ARGS --utility=wxrc` fi fi if test "x$WXRC" = x ; then AC_MSG_RESULT([not found]) ifelse([$2], , :, [$2]) else AC_MSG_RESULT([$WXRC]) ifelse([$1], , :, [$1]) fi AC_SUBST(WXRC) fi ])
{ "pile_set_name": "Github" }
{% block chaptercontent %} <div class="row"> <div class="columns small-12"> <h1 id="iteration">Iteration</h1> <p></p> <h2 id="updating-variables">Updating variables</h2> <p> </p> <p>A common pattern in assignment statements is an assignment statement that updates a variable, where the new value of the variable depends on the old.</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python">x <span class="op">=</span> x <span class="op">+</span> <span class="dv">1</span></code></pre></div> <p>This means &quot;get the current value of <code>x</code>, add 1, and then update <code>x</code> with the new value.&quot;</p> <p>If you try to update a variable that doesn't exist, you get an error, because Python evaluates the right side before it assigns a value to <code>x</code>:</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python"><span class="op">&gt;&gt;&gt;</span> x <span class="op">=</span> x <span class="op">+</span> <span class="dv">1</span> <span class="pp">NameError</span>: name <span class="st">'x'</span> <span class="kw">is</span> <span class="kw">not</span> defined</code></pre></div> <p>Before you can update a variable, you have to <em>initialize</em> it, usually with a simple assignment:</p> <p></p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python"><span class="op">&gt;&gt;&gt;</span> x <span class="op">=</span> <span class="dv">0</span> <span class="op">&gt;&gt;&gt;</span> x <span class="op">=</span> x <span class="op">+</span> <span class="dv">1</span></code></pre></div> <p>Updating a variable by adding 1 is called an <em>increment</em>; subtracting 1 is called a <em>decrement</em>.</p> <p> </p> <h2 id="the-while-statement">The <code>while</code> statement</h2> <p> </p> <p>Computers are often used to automate repetitive tasks. Repeating identical or similar tasks without making errors is something that computers do well and people do poorly. Because iteration is so common, Python provides several language features to make it easier.</p> <p>One form of iteration in Python is the <code>while</code> statement. Here is a simple program that counts down from five and then says &quot;Blastoff!&quot;.</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python">n <span class="op">=</span> <span class="dv">5</span> <span class="cf">while</span> n <span class="op">&gt;</span> <span class="dv">0</span>: <span class="bu">print</span>(n) n <span class="op">=</span> n <span class="op">-</span> <span class="dv">1</span> <span class="bu">print</span>(<span class="st">'Blastoff!'</span>)</code></pre></div> <p>You can almost read the <code>while</code> statement as if it were English. It means, &quot;While <code>n</code> is greater than 0, display the value of <code>n</code> and then reduce the value of <code>n</code> by 1. When you get to 0, exit the <code>while</code> statement and display the word <code>Blastoff!</code>&quot;</p> <p></p> <p>More formally, here is the flow of execution for a <code>while</code> statement:</p> <ol style="list-style-type: decimal"> <li><p>Evaluate the condition, yielding <code>True</code> or <code>False</code>.</p></li> <li><p>If the condition is false, exit the <code>while</code> statement and continue execution at the next statement.</p></li> <li><p>If the condition is true, execute the body and then go back to step 1.</p></li> </ol> <p>This type of flow is called a <em>loop</em> because the third step loops back around to the top. We call each time we execute the body of the loop an <em>iteration</em>. For the above loop, we would say, &quot;It had five iterations&quot;, which means that the body of the loop was executed five times.</p> <p> </p> <p>The body of the loop should change the value of one or more variables so that eventually the condition becomes false and the loop terminates. We call the variable that changes each time the loop executes and controls when the loop finishes the <em>iteration variable</em>. If there is no iteration variable, the loop will repeat forever, resulting in an <em>infinite loop</em>.</p> <h2 id="infinite-loops">Infinite loops</h2> <p>An endless source of amusement for programmers is the observation that the directions on shampoo, &quot;Lather, rinse, repeat,&quot; are an infinite loop because there is no <em>iteration variable</em> telling you how many times to execute the loop.</p> <p> </p> <p>In the case of <code>countdown</code>, we can prove that the loop terminates because we know that the value of <code>n</code> is finite, and we can see that the value of <code>n</code> gets smaller each time through the loop, so eventually we have to get to 0. Other times a loop is obviously infinite because it has no iteration variable at all.</p> <p> </p> <p>Sometimes you don't know it's time to end a loop until you get half way through the body. In that case you can write an infinite loop on purpose and then use the <code>break</code> statement to jump out of the loop.</p> <p>This loop is obviously an <em>infinite loop</em> because the logical expression on the <code>while</code> statement is simply the logical constant <code>True</code>:</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python">n <span class="op">=</span> <span class="dv">10</span> <span class="cf">while</span> <span class="va">True</span>: <span class="bu">print</span>(n, end<span class="op">=</span><span class="st">' '</span>) n <span class="op">=</span> n <span class="op">-</span> <span class="dv">1</span> <span class="bu">print</span>(<span class="st">'Done!'</span>)</code></pre></div> <p>If you make the mistake and run this code, you will learn quickly how to stop a runaway Python process on your system or find where the power-off button is on your computer. This program will run forever or until your battery runs out because the logical expression at the top of the loop is always true by virtue of the fact that the expression is the constant value <code>True</code>.</p> <p>While this is a dysfunctional infinite loop, we can still use this pattern to build useful loops as long as we carefully add code to the body of the loop to explicitly exit the loop using <code>break</code> when we have reached the exit condition.</p> <p>For example, suppose you want to take input from the user until they type <code>done</code>. You could write:</p> <script type="text/javascript">(function(d,l,s,i,c){function n(e){e=e.nextSibling;return (!e||e.nodeType!=3)?e:n(e);};function r(f){/in/.test(d.readyState) ? setTimeout(function(){r(f);},9):f()};l=d.getElementsByTagName('script');s=l[l.length-1];r(function(){i=n(s),c=n(i);i.setAttribute('data-src','https://trinket.io/tools/1.0/jekyll/embed/python3#code='+encodeURIComponent(c.nodeValue.replace(/^\s+|\s+$/g,'')));});})(document)</script> <iframe width="100%" height="400" frameborder="0" marginwidth="0" marginheight="0" class="lazyload" allowfullscreen> </iframe> <!-- while True: line = input('> ') if line == 'done': break print(line) print('Done!') # Code: http://www.py4e.com/code3/copytildone1.py # Or select Download from this trinket's left-hand menu --> <p>The loop condition is <code>True</code>, which is always true, so the loop runs repeatedly until it hits the break statement.</p> <p>Each time through, it prompts the user with an angle bracket. If the user types <code>done</code>, the <code>break</code> statement exits the loop. Otherwise the program echoes whatever the user types and goes back to the top of the loop. Here's a sample run:</p> <pre><code>&gt; hello there hello there &gt; finished finished &gt; done Done!</code></pre> <p>This way of writing <code>while</code> loops is common because you can check the condition anywhere in the loop (not just at the top) and you can express the stop condition affirmatively (&quot;stop when this happens&quot;) rather than negatively (&quot;keep going until that happens.&quot;).</p> <h2 id="finishing-iterations-with-continue">Finishing iterations with <code>continue</code></h2> <p> </p> <p>Sometimes you are in an iteration of a loop and want to finish the current iteration and immediately jump to the next iteration. In that case you can use the <code>continue</code> statement to skip to the next iteration without finishing the body of the loop for the current iteration.</p> <p>Here is an example of a loop that copies its input until the user types &quot;done&quot;, but treats lines that start with the hash character as lines not to be printed (kind of like Python comments).</p> <script type="text/javascript">(function(d,l,s,i,c){function n(e){e=e.nextSibling;return (!e||e.nodeType!=3)?e:n(e);};function r(f){/in/.test(d.readyState) ? setTimeout(function(){r(f);},9):f()};l=d.getElementsByTagName('script');s=l[l.length-1];r(function(){i=n(s),c=n(i);i.setAttribute('data-src','https://trinket.io/tools/1.0/jekyll/embed/python3#code='+encodeURIComponent(c.nodeValue.replace(/^\s+|\s+$/g,'')));});})(document)</script> <iframe width="100%" height="400" frameborder="0" marginwidth="0" marginheight="0" class="lazyload" allowfullscreen> </iframe> <!-- while True: line = input('> ') if line[0] == '#': continue if line == 'done': break print(line) print('Done!') # Code: http://www.py4e.com/code3/copytildone2.py # Or select Download from this trinket's left-hand menu --> <p>Here is a sample run of this new program with <code>continue</code> added.</p> <pre><code>&gt; hello there hello there &gt; # don't print this &gt; print this! print this! &gt; done Done!</code></pre> <p>All the lines are printed except the one that starts with the hash sign because when the <code>continue</code> is executed, it ends the current iteration and jumps back to the <code>while</code> statement to start the next iteration, thus skipping the <code>print</code> statement.</p> <h2 id="definite-loops-using-for">Definite loops using <code>for</code></h2> <p> </p> <p>Sometimes we want to loop through a <em>set</em> of things such as a list of words, the lines in a file, or a list of numbers. When we have a list of things to loop through, we can construct a <em>definite</em> loop using a <code>for</code> statement. We call the <code>while</code> statement an <em>indefinite</em> loop because it simply loops until some condition becomes <code>False</code>, whereas the <code>for</code> loop is looping through a known set of items so it runs through as many iterations as there are items in the set.</p> <p>The syntax of a <code>for</code> loop is similar to the <code>while</code> loop in that there is a <code>for</code> statement and a loop body:</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python">friends <span class="op">=</span> [<span class="st">'Joseph'</span>, <span class="st">'Glenn'</span>, <span class="st">'Sally'</span>] <span class="cf">for</span> friend <span class="kw">in</span> friends: <span class="bu">print</span>(<span class="st">'Happy New Year:'</span>, friend) <span class="bu">print</span>(<span class="st">'Done!'</span>)</code></pre></div> <p>In Python terms, the variable <code>friends</code> is a list<a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a> of three strings and the <code>for</code> loop goes through the list and executes the body once for each of the three strings in the list resulting in this output:</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python">Happy New Year: Joseph Happy New Year: Glenn Happy New Year: Sally Done<span class="op">!</span></code></pre></div> <p>Translating this <code>for</code> loop to English is not as direct as the <code>while</code>, but if you think of friends as a <em>set</em>, it goes like this: &quot;Run the statements in the body of the for loop once for each friend <em>in</em> the set named friends.&quot;</p> <p>Looking at the <code>for</code> loop, <em>for</em> and <em>in</em> are reserved Python keywords, and <code>friend</code> and <code>friends</code> are variables.</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python"><span class="cf">for</span> friend <span class="kw">in</span> friends: <span class="bu">print</span>(<span class="st">'Happy New Year:'</span>, friend)</code></pre></div> <p>In particular, <code>friend</code> is the <em>iteration variable</em> for the for loop. The variable <code>friend</code> changes for each iteration of the loop and controls when the <code>for</code> loop completes. The <em>iteration variable</em> steps successively through the three strings stored in the <code>friends</code> variable.</p> <h2 id="loop-patterns">Loop patterns</h2> <p>Often we use a <code>for</code> or <code>while</code> loop to go through a list of items or the contents of a file and we are looking for something such as the largest or smallest value of the data we scan through.</p> <p>These loops are generally constructed by:</p> <ul> <li><p>Initializing one or more variables before the loop starts</p></li> <li><p>Performing some computation on each item in the loop body, possibly changing the variables in the body of the loop</p></li> <li><p>Looking at the resulting variables when the loop completes</p></li> </ul> <p>We will use a list of numbers to demonstrate the concepts and construction of these loop patterns.</p> <h3 id="counting-and-summing-loops">Counting and summing loops</h3> <p>For example, to count the number of items in a list, we would write the following <code>for</code> loop:</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python">count <span class="op">=</span> <span class="dv">0</span> <span class="cf">for</span> itervar <span class="kw">in</span> [<span class="dv">3</span>, <span class="dv">41</span>, <span class="dv">12</span>, <span class="dv">9</span>, <span class="dv">74</span>, <span class="dv">15</span>]: count <span class="op">=</span> count <span class="op">+</span> <span class="dv">1</span> <span class="bu">print</span>(<span class="st">'Count: '</span>, count)</code></pre></div> <p>We set the variable <code>count</code> to zero before the loop starts, then we write a <code>for</code> loop to run through the list of numbers. Our <em>iteration</em> variable is named <code>itervar</code> and while we do not use <code>itervar</code> in the loop, it does control the loop and cause the loop body to be executed once for each of the values in the list.</p> <p>In the body of the loop, we add 1 to the current value of <code>count</code> for each of the values in the list. While the loop is executing, the value of <code>count</code> is the number of values we have seen &quot;so far&quot;.</p> <p>Once the loop completes, the value of <code>count</code> is the total number of items. The total number &quot;falls in our lap&quot; at the end of the loop. We construct the loop so that we have what we want when the loop finishes.</p> <p>Another similar loop that computes the total of a set of numbers is as follows:</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python">total <span class="op">=</span> <span class="dv">0</span> <span class="cf">for</span> itervar <span class="kw">in</span> [<span class="dv">3</span>, <span class="dv">41</span>, <span class="dv">12</span>, <span class="dv">9</span>, <span class="dv">74</span>, <span class="dv">15</span>]: total <span class="op">=</span> total <span class="op">+</span> itervar <span class="bu">print</span>(<span class="st">'Total: '</span>, total)</code></pre></div> <p>In this loop we <em>do</em> use the <em>iteration variable</em>. Instead of simply adding one to the <code>count</code> as in the previous loop, we add the actual number (3, 41, 12, etc.) to the running total during each loop iteration. If you think about the variable <code>total</code>, it contains the &quot;running total of the values so far&quot;. So before the loop starts <code>total</code> is zero because we have not yet seen any values, during the loop <code>total</code> is the running total, and at the end of the loop <code>total</code> is the overall total of all the values in the list.</p> <p>As the loop executes, <code>total</code> accumulates the sum of the elements; a variable used this way is sometimes called an <em>accumulator</em>.</p> <p></p> <p>Neither the counting loop nor the summing loop are particularly useful in practice because there are built-in functions <code>len()</code> and <code>sum()</code> that compute the number of items in a list and the total of the items in the list respectively.</p> <h3 id="maximum-and-minimum-loops">Maximum and minimum loops</h3> <p> </p> <p>To find the largest value in a list or sequence, we construct the following loop:</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python">largest <span class="op">=</span> <span class="va">None</span> <span class="bu">print</span>(<span class="st">'Before:'</span>, largest) <span class="cf">for</span> itervar <span class="kw">in</span> [<span class="dv">3</span>, <span class="dv">41</span>, <span class="dv">12</span>, <span class="dv">9</span>, <span class="dv">74</span>, <span class="dv">15</span>]: <span class="cf">if</span> largest <span class="kw">is</span> <span class="va">None</span> <span class="kw">or</span> itervar <span class="op">&gt;</span> largest : largest <span class="op">=</span> itervar <span class="bu">print</span>(<span class="st">'Loop:'</span>, itervar, largest) <span class="bu">print</span>(<span class="st">'Largest:'</span>, largest)</code></pre></div> <p>When the program executes, the output is as follows:</p> <pre><code>Before: None Loop: 3 3 Loop: 41 41 Loop: 12 41 Loop: 9 41 Loop: 74 74 Loop: 15 74 Largest: 74</code></pre> <p>The variable <code>largest</code> is best thought of as the &quot;largest value we have seen so far&quot;. Before the loop, we set <code>largest</code> to the constant <code>None</code>. <code>None</code> is a special constant value which we can store in a variable to mark the variable as &quot;empty&quot;.</p> <p>Before the loop starts, the largest value we have seen so far is <code>None</code> since we have not yet seen any values. While the loop is executing, if <code>largest</code> is <code>None</code> then we take the first value we see as the largest so far. You can see in the first iteration when the value of <code>itervar</code> is 3, since <code>largest</code> is <code>None</code>, we immediately set <code>largest</code> to be 3.</p> <p>After the first iteration, <code>largest</code> is no longer <code>None</code>, so the second part of the compound logical expression that checks <code>itervar &gt; largest</code> triggers only when we see a value that is larger than the &quot;largest so far&quot;. When we see a new &quot;even larger&quot; value we take that new value for <code>largest</code>. You can see in the program output that <code>largest</code> progresses from 3 to 41 to 74.</p> <p>At the end of the loop, we have scanned all of the values and the variable <code>largest</code> now does contain the largest value in the list.</p> <p>To compute the smallest number, the code is very similar with one small change:</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python">smallest <span class="op">=</span> <span class="va">None</span> <span class="bu">print</span>(<span class="st">'Before:'</span>, smallest) <span class="cf">for</span> itervar <span class="kw">in</span> [<span class="dv">3</span>, <span class="dv">41</span>, <span class="dv">12</span>, <span class="dv">9</span>, <span class="dv">74</span>, <span class="dv">15</span>]: <span class="cf">if</span> smallest <span class="kw">is</span> <span class="va">None</span> <span class="kw">or</span> itervar <span class="op">&lt;</span> smallest: smallest <span class="op">=</span> itervar <span class="bu">print</span>(<span class="st">'Loop:'</span>, itervar, smallest) <span class="bu">print</span>(<span class="st">'Smallest:'</span>, smallest)</code></pre></div> <p>Again, <code>smallest</code> is the &quot;smallest so far&quot; before, during, and after the loop executes. When the loop has completed, <code>smallest</code> contains the minimum value in the list.</p> <p>Again as in counting and summing, the built-in functions <code>max()</code> and <code>min()</code> make writing these exact loops unnecessary.</p> <p>The following is a simple version of the Python built-in <code>min()</code> function:</p> <div class="sourceCode"><pre class="sourceCode python"><code class="sourceCode python"><span class="kw">def</span> <span class="bu">min</span>(values): smallest <span class="op">=</span> <span class="va">None</span> <span class="cf">for</span> value <span class="kw">in</span> values: <span class="cf">if</span> smallest <span class="kw">is</span> <span class="va">None</span> <span class="kw">or</span> value <span class="op">&lt;</span> smallest: smallest <span class="op">=</span> value <span class="cf">return</span> smallest</code></pre></div> <p>In the function version of the smallest code, we removed all of the <code>print</code> statements so as to be equivalent to the <code>min</code> function which is already built in to Python.</p> <h2 id="debugging">Debugging</h2> <p>As you start writing bigger programs, you might find yourself spending more time debugging. More code means more chances to make an error and more places for bugs to hide.</p> <p> </p> <p>One way to cut your debugging time is &quot;debugging by bisection.&quot; For example, if there are 100 lines in your program and you check them one at a time, it would take 100 steps.</p> <p>Instead, try to break the problem in half. Look at the middle of the program, or near it, for an intermediate value you can check. Add a <code>print</code> statement (or something else that has a verifiable effect) and run the program.</p> <p>If the mid-point check is incorrect, the problem must be in the first half of the program. If it is correct, the problem is in the second half.</p> <p>Every time you perform a check like this, you halve the number of lines you have to search. After six steps (which is much less than 100), you would be down to one or two lines of code, at least in theory.</p> <p>In practice it is not always clear what the &quot;middle of the program&quot; is and not always possible to check it. It doesn't make sense to count lines and find the exact midpoint. Instead, think about places in the program where there might be errors and places where it is easy to put a check. Then choose a spot where you think the chances are about the same that the bug is before or after the check.</p> <h2 id="glossary">Glossary</h2> <dl> <dt>accumulator</dt> <dd>A variable used in a loop to add up or accumulate a result. </dd> <dt>counter</dt> <dd>A variable used in a loop to count the number of times something happened. We initialize a counter to zero and then increment the counter each time we want to &quot;count&quot; something. </dd> <dt>decrement</dt> <dd>An update that decreases the value of a variable. </dd> <dt>initialize</dt> <dd>An assignment that gives an initial value to a variable that will be updated. </dd> <dt>increment</dt> <dd>An update that increases the value of a variable (often by one). </dd> <dt>infinite loop</dt> <dd>A loop in which the terminating condition is never satisfied or for which there is no terminating condition. </dd> <dt>iteration</dt> <dd>Repeated execution of a set of statements using either a function that calls itself or a loop. </dd> </dl> <h2 id="exercises">Exercises</h2> <p><strong>Exercise 1: Write a program which repeatedly reads numbers until the user enters &quot;done&quot;. Once &quot;done&quot; is entered, print out the total, count, and average of the numbers. If the user enters anything other than a number, detect their mistake using <code>try</code> and <code>except</code> and print an error message and skip to the next number.</strong></p> <pre><code>Enter a number: 4 Enter a number: 5 Enter a number: bad data Invalid input Enter a number: 7 Enter a number: done 16 3 5.333333333333333</code></pre> <p><strong>Exercise 2: Write another program that prompts for a list of numbers as above and at the end prints out both the maximum and minimum of the numbers instead of the average.</strong></p> <div class="footnotes"> <hr /> <ol> <li id="fn1"><p>We will examine lists in more detail in a later chapter.<a href="#fnref1">↩</a></p></li> </ol> </div> </div> </div> {% endblock %} {% block toc %} <ul> <li><a href="#iteration">Iteration</a><ul> <li><a href="#updating-variables">Updating variables</a></li> <li><a href="#the-while-statement">The <code>while</code> statement</a></li> <li><a href="#infinite-loops">Infinite loops</a></li> <li><a href="#finishing-iterations-with-continue">Finishing iterations with <code>continue</code></a></li> <li><a href="#definite-loops-using-for">Definite loops using <code>for</code></a></li> <li><a href="#loop-patterns">Loop patterns</a><ul> <li><a href="#counting-and-summing-loops">Counting and summing loops</a></li> <li><a href="#maximum-and-minimum-loops">Maximum and minimum loops</a></li> </ul></li> <li><a href="#debugging">Debugging</a></li> <li><a href="#glossary">Glossary</a></li> <li><a href="#exercises">Exercises</a></li> </ul></li> </ul> {% endblock %} {% block extra_css %} <style type="text/css"> div.sourceCode { overflow-x: auto; } table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { margin: 0; padding: 0; vertical-align: baseline; border: none; } table.sourceCode { width: 100%; line-height: 100%; } td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; } td.sourceCode { padding-left: 5px; } code > span.kw { color: #007020; font-weight: bold; } /* Keyword */ code > span.dt { color: #902000; } /* DataType */ code > span.dv { color: #40a070; } /* DecVal */ code > span.bn { color: #40a070; } /* BaseN */ code > span.fl { color: #40a070; } /* Float */ code > span.ch { color: #4070a0; } /* Char */ code > span.st { color: #4070a0; } /* String */ code > span.co { color: #60a0b0; font-style: italic; } /* Comment */ code > span.ot { color: #007020; } /* Other */ code > span.al { color: #ff0000; font-weight: bold; } /* Alert */ code > span.fu { color: #06287e; } /* Function */ code > span.er { color: #ff0000; font-weight: bold; } /* Error */ code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ code > span.cn { color: #880000; } /* Constant */ code > span.sc { color: #4070a0; } /* SpecialChar */ code > span.vs { color: #4070a0; } /* VerbatimString */ code > span.ss { color: #bb6688; } /* SpecialString */ code > span.im { } /* Import */ code > span.va { color: #19177c; } /* Variable */ code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code > span.op { color: #666666; } /* Operator */ code > span.bu { } /* BuiltIn */ code > span.ex { } /* Extension */ code > span.pp { color: #bc7a00; } /* Preprocessor */ code > span.at { color: #7d9029; } /* Attribute */ code > span.do { color: #ba2121; font-style: italic; } /* Documentation */ code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ </style> {% endblock %} {% block title %}Chapter 5 | Python For Everyone | Trinket{% endblock %}
{ "pile_set_name": "Github" }
texexec --arg="ht-1=%2" --use=tex4ht --dvi --nobackend %5 %1 tex4ht %1 -i/tex4ht/ht-fonts/%3 -ewin32/tex4ht.env t4ht %1 %4 -ewin32/tex4ht.env
{ "pile_set_name": "Github" }
#include "libcflat.h" #include "vm.h" #include "smp.h" #include "asm/io.h" #include "asm/page.h" #ifndef USE_SERIAL #define USE_SERIAL #endif static struct spinlock lock; static int serial_iobase = 0x3f8; static int serial_inited = 0; static void serial_outb(char ch) { u8 lsr; do { lsr = inb(serial_iobase + 0x05); } while (!(lsr & 0x20)); outb(ch, serial_iobase + 0x00); } static void serial_init(void) { u8 lcr; /* set DLAB */ lcr = inb(serial_iobase + 0x03); lcr |= 0x80; outb(lcr, serial_iobase + 0x03); /* set baud rate to 115200 */ outb(0x01, serial_iobase + 0x00); outb(0x00, serial_iobase + 0x01); /* clear DLAB */ lcr = inb(serial_iobase + 0x03); lcr &= ~0x80; outb(lcr, serial_iobase + 0x03); } static void print_serial(const char *buf) { unsigned long len = strlen(buf); #ifdef USE_SERIAL unsigned long i; if (!serial_inited) { serial_init(); serial_inited = 1; } for (i = 0; i < len; i++) { serial_outb(buf[i]); } #else asm volatile ("rep/outsb" : "+S"(buf), "+c"(len) : "d"(0xf1)); #endif } void puts(const char *s) { spin_lock(&lock); print_serial(s); spin_unlock(&lock); } void exit(int code) { #ifdef USE_SERIAL static const char shutdown_str[8] = "Shutdown"; int i; /* test device exit (with status) */ outl(code, 0xf4); /* if that failed, try the Bochs poweroff port */ for (i = 0; i < 8; i++) { outb(shutdown_str[i], 0x8900); } #else asm volatile("out %0, %1" : : "a"(code), "d"((short)0xf4)); #endif } void __iomem *ioremap(phys_addr_t phys_addr, size_t size) { phys_addr_t base = phys_addr & PAGE_MASK; phys_addr_t offset = phys_addr - base; /* * The kernel sets PTEs for an ioremap() with page cache disabled, * but we do not do that right now. It would make sense that I/O * mappings would be uncached - and may help us find bugs when we * properly map that way. */ return vmap(phys_addr, size) + offset; }
{ "pile_set_name": "Github" }
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation ([email protected]) ** ** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you have questions regarding the use of this file, please contact ** Nokia at [email protected]. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qoptimizationpasses_p.h" #include "qbooleanfns_p.h" QT_BEGIN_NAMESPACE using namespace QPatternist; bool TrueFN::evaluateEBV(const DynamicContext::Ptr &) const { return true; } bool FalseFN::evaluateEBV(const DynamicContext::Ptr &) const { return false; } bool NotFN::evaluateEBV(const DynamicContext::Ptr &context) const { /* That little '!' is quite important in this function -- I forgot it ;-) */ return !m_operands.first()->evaluateEBV(context); } OptimizationPass::List NotFN::optimizationPasses() const { return OptimizationPasses::notFN; } QT_END_NAMESPACE
{ "pile_set_name": "Github" }
New-ComponentPage -Title 'Button' -Description 'Buttons allow users to take actions, and make choices, with a single tap.' -SecondDescription 'asdfasfas' -Content { New-Example -Title 'Contained Button' -Description 'Contained buttons are high-emphasis, distinguished by their use of elevation and fill. They contain actions that are primary to your app.' -Example { New-UDButton -Variant 'contained' -Text 'Default' } New-Example -Title 'Outlined Button' -Description "Outlined buttons are medium-emphasis buttons. They contain actions that are important, but aren’t the primary action in an app. Outlined buttons are also a lower emphasis alternative to contained buttons, or a higher emphasis alternative to text buttons." -Example { New-UDButton -Variant 'outlined' -Text 'Default' } New-Example -Title 'Buttons with icons and label' -Description 'Sometimes you might want to have icons for certain button to enhance the UX of the application as we recognize logos more easily than plain text. For example, if you have a delete button you can label it with a dustbin icon.' -Example { New-UDButton -Icon (New-UDIcon -Icon trash) -Text 'Delete' } New-Example -Title 'Buttons with event handlers' -Description 'You can specify a script block to execute when the button is clicked' -Example { New-UDButton -Text 'Message Box' -OnClick { Show-UDToast -Message 'Hello, world!' } } } -Cmdlet "New-UDButton"
{ "pile_set_name": "Github" }
const func = function (@foo() x, @bar({ a: 123 }) @baz() y) {};
{ "pile_set_name": "Github" }
IF statement Tests ------------------- var Tests = { 'support a block style': code: function var result=[] var a = 4 if a is 4 result.push('block') if a is 3 result.push('should not') end if return result expected: ['block'] 'if-then: one line if statement': code:function var result=[] var a = 4, b = 5 if a is 4 then result.push(1) if a isnt 3 then result.push(2) if b>3, result.push(3) return result expected: [1,2,3] 'else-block: support a block style': code: function var result=[] var a = 4, x if a is 4 result.push(1) x = 4 else result.push('else should not bi executed') if a is 3 result.push('if-true should not be executed') else result.push(2) x = 3 end if result.push(x) return result expected:[1,2,3] 'else-if: support if - else if': code: function var result=[] var a = 4 var x if a is 'moo' result.push('the cow') else if a is 3 result.push('if-true should not be executed') else if no x result.push(1) else result.push('last-else') end if if a is 'no' result.push('no') else if a isnt 4 result.push('if-true should not be executed') else if x result.push('neither') else result.push(2) end if return result expected:[1,2] }
{ "pile_set_name": "Github" }
## # Copyright (c) 2013 Apple Inc. All rights reserved. # # @APPLE_LICENSE_HEADER_START@ # # This file contains Original Code and/or Modifications of Original Code # as defined in and that are subject to the Apple Public Source License # Version 2.0 (the 'License'). You may not use this file except in # compliance with the License. Please obtain a copy of the License at # http://www.opensource.apple.com/apsl/ and read it before using this # file. # # The Original Code and all software distributed under the License are # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. # Please see the License for the specific language governing rights and # limitations under the License. # # @APPLE_LICENSE_HEADER_END@ # # # This unit test verifies that multiple interposing libraries can all # interpose the same function and the result is that they chain together. # That is, each one calls through to the next. # # On Tiger (10.4.0), this test fails with infinite recursion. # # The function foo() does string appends. This allows us to check: # 1) every interposer was called, and 2) they were called in the # correct order. # TESTROOT = ../.. include ${TESTROOT}/include/common.makefile all-check: all check check: export DYLD_INSERT_LIBRARIES="libfoo1.dylib:libfoo2.dylib" && ./main export DYLD_INSERT_LIBRARIES="libfoo2.dylib:libfoo1.dylib" && ./main all: ${CC} ${CCFLAGS} -dynamiclib base.c -o libbase.dylib ${CC} ${CCFLAGS} -I${TESTROOT}/include main.c libbase.dylib -o main ${CC} ${CCFLAGS} -I${TESTROOT}/include -dynamiclib foo1.c libbase.dylib -o libfoo1.dylib ${CC} ${CCFLAGS} -I${TESTROOT}/include -dynamiclib foo2.c libbase.dylib -o libfoo2.dylib clean: ${RM} ${RMFLAGS} *~ main libbase.dylib libfoo1.dylib libfoo2.dylib
{ "pile_set_name": "Github" }
/* ========================================================================= * * * * OpenMesh * * Copyright (c) 2001-2015, RWTH-Aachen University * * Department of Computer Graphics and Multimedia * * All rights reserved. * * www.openmesh.org * * * *---------------------------------------------------------------------------* * This file is part of OpenMesh. * *---------------------------------------------------------------------------* * * * 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. Neither the name of the copyright holder nor the names of its * * contributors may be used to endorse or promote products derived from * * this software without specific prior written permission. * * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * * ========================================================================= */ /*===========================================================================*\ * * * $Revision$ * * $Date$ * * * \*===========================================================================*/ #ifndef OPENMESH_ATTRIBKERNEL_HH #define OPENMESH_ATTRIBKERNEL_HH //== INCLUDES ================================================================= #include <OpenMesh/Core/Mesh/Attributes.hh> #include <OpenMesh/Core/Utils/GenProg.hh> #include <OpenMesh/Core/Utils/vector_traits.hh> #include <vector> #include <algorithm> //== NAMESPACES =============================================================== namespace OpenMesh { //== CLASS DEFINITION ========================================================= /** \class AttribKernelT AttribKernelT.hh <OpenMesh/Mesh/AttribKernelT.hh> The attribute kernel adds all standard properties to the kernel. Therefore the functions/types defined here provide a subset of the kernel interface as described in Concepts::KernelT. \see Concepts::KernelT */ template <class MeshItems, class Connectivity> class AttribKernelT : public Connectivity { public: //---------------------------------------------------------------- item types typedef MeshItems MeshItemsT; typedef Connectivity ConnectivityT; typedef typename Connectivity::Vertex Vertex; typedef typename Connectivity::Halfedge Halfedge; typedef typename Connectivity::Edge Edge; typedef typename Connectivity::Face Face; typedef typename MeshItems::Point Point; typedef typename MeshItems::Normal Normal; typedef typename MeshItems::Color Color; typedef typename MeshItems::TexCoord1D TexCoord1D; typedef typename MeshItems::TexCoord2D TexCoord2D; typedef typename MeshItems::TexCoord3D TexCoord3D; typedef typename MeshItems::Scalar Scalar; typedef typename MeshItems::TextureIndex TextureIndex; typedef typename MeshItems::VertexData VertexData; typedef typename MeshItems::HalfedgeData HalfedgeData; typedef typename MeshItems::EdgeData EdgeData; typedef typename MeshItems::FaceData FaceData; typedef AttribKernelT<MeshItems,Connectivity> AttribKernel; enum Attribs { VAttribs = MeshItems::VAttribs, HAttribs = MeshItems::HAttribs, EAttribs = MeshItems::EAttribs, FAttribs = MeshItems::FAttribs }; typedef VPropHandleT<VertexData> DataVPropHandle; typedef HPropHandleT<HalfedgeData> DataHPropHandle; typedef EPropHandleT<EdgeData> DataEPropHandle; typedef FPropHandleT<FaceData> DataFPropHandle; public: //-------------------------------------------------- constructor / destructor AttribKernelT() : refcount_vnormals_(0), refcount_vcolors_(0), refcount_vtexcoords1D_(0), refcount_vtexcoords2D_(0), refcount_vtexcoords3D_(0), refcount_htexcoords1D_(0), refcount_htexcoords2D_(0), refcount_htexcoords3D_(0), refcount_henormals_(0), refcount_hecolors_(0), refcount_ecolors_(0), refcount_fnormals_(0), refcount_fcolors_(0), refcount_ftextureIndex_(0) { this->add_property( points_, "v:points" ); if (VAttribs & Attributes::Normal) request_vertex_normals(); if (VAttribs & Attributes::Color) request_vertex_colors(); if (VAttribs & Attributes::TexCoord1D) request_vertex_texcoords1D(); if (VAttribs & Attributes::TexCoord2D) request_vertex_texcoords2D(); if (VAttribs & Attributes::TexCoord3D) request_vertex_texcoords3D(); if (HAttribs & Attributes::TexCoord1D) request_halfedge_texcoords1D(); if (HAttribs & Attributes::TexCoord2D) request_halfedge_texcoords2D(); if (HAttribs & Attributes::TexCoord3D) request_halfedge_texcoords3D(); if (HAttribs & Attributes::Color) request_halfedge_colors(); if (VAttribs & Attributes::Status) Connectivity::request_vertex_status(); if (HAttribs & Attributes::Status) Connectivity::request_halfedge_status(); if (HAttribs & Attributes::Normal) request_halfedge_normals(); if (EAttribs & Attributes::Status) Connectivity::request_edge_status(); if (EAttribs & Attributes::Color) request_edge_colors(); if (FAttribs & Attributes::Normal) request_face_normals(); if (FAttribs & Attributes::Color) request_face_colors(); if (FAttribs & Attributes::Status) Connectivity::request_face_status(); if (FAttribs & Attributes::TextureIndex) request_face_texture_index(); //FIXME: data properties might actually cost storage even //if there are no data traits?? this->add_property(data_vpph_); this->add_property(data_fpph_); this->add_property(data_hpph_); this->add_property(data_epph_); } virtual ~AttribKernelT() { // should remove properties, but this will be done in // BaseKernel's destructor anyway... } /** Assignment from another mesh of \em another type. \note All that's copied is connectivity and vertex positions. All other information (like e.g. attributes or additional elements from traits classes) is not copied. \note If you want to copy all information, including *custom* properties, use PolyMeshT::operator=() instead. TODO: version which copies standard properties specified by the user */ template <class _AttribKernel> void assign(const _AttribKernel& _other) { this->assign_connectivity(_other); for (typename Connectivity::VertexIter v_it = Connectivity::vertices_begin(); v_it != Connectivity::vertices_end(); ++v_it) {//assumes Point constructor supports cast from _AttribKernel::Point set_point(*v_it, (Point)_other.point(*v_it)); } } //-------------------------------------------------------------------- points const Point* points() const { return this->property(points_).data(); } const Point& point(VertexHandle _vh) const { return this->property(points_, _vh); } Point& point(VertexHandle _vh) { return this->property(points_, _vh); } void set_point(VertexHandle _vh, const Point& _p) { this->property(points_, _vh) = _p; } //------------------------------------------------------------ vertex normals const Normal* vertex_normals() const { return this->property(vertex_normals_).data(); } const Normal& normal(VertexHandle _vh) const { return this->property(vertex_normals_, _vh); } void set_normal(VertexHandle _vh, const Normal& _n) { this->property(vertex_normals_, _vh) = _n; } //------------------------------------------------------------- vertex colors const Color* vertex_colors() const { return this->property(vertex_colors_).data(); } const Color& color(VertexHandle _vh) const { return this->property(vertex_colors_, _vh); } void set_color(VertexHandle _vh, const Color& _c) { this->property(vertex_colors_, _vh) = _c; } //------------------------------------------------------- vertex 1D texcoords const TexCoord1D* texcoords1D() const { return this->property(vertex_texcoords1D_).data(); } const TexCoord1D& texcoord1D(VertexHandle _vh) const { return this->property(vertex_texcoords1D_, _vh); } void set_texcoord1D(VertexHandle _vh, const TexCoord1D& _t) { this->property(vertex_texcoords1D_, _vh) = _t; } //------------------------------------------------------- vertex 2D texcoords const TexCoord2D* texcoords2D() const { return this->property(vertex_texcoords2D_).data(); } const TexCoord2D& texcoord2D(VertexHandle _vh) const { return this->property(vertex_texcoords2D_, _vh); } void set_texcoord2D(VertexHandle _vh, const TexCoord2D& _t) { this->property(vertex_texcoords2D_, _vh) = _t; } //------------------------------------------------------- vertex 3D texcoords const TexCoord3D* texcoords3D() const { return this->property(vertex_texcoords3D_).data(); } const TexCoord3D& texcoord3D(VertexHandle _vh) const { return this->property(vertex_texcoords3D_, _vh); } void set_texcoord3D(VertexHandle _vh, const TexCoord3D& _t) { this->property(vertex_texcoords3D_, _vh) = _t; } //.------------------------------------------------------ halfedge 1D texcoords const TexCoord1D* htexcoords1D() const { return this->property(halfedge_texcoords1D_).data(); } const TexCoord1D& texcoord1D(HalfedgeHandle _heh) const { return this->property(halfedge_texcoords1D_, _heh); } void set_texcoord1D(HalfedgeHandle _heh, const TexCoord1D& _t) { this->property(halfedge_texcoords1D_, _heh) = _t; } //------------------------------------------------------- halfedge 2D texcoords const TexCoord2D* htexcoords2D() const { return this->property(halfedge_texcoords2D_).data(); } const TexCoord2D& texcoord2D(HalfedgeHandle _heh) const { return this->property(halfedge_texcoords2D_, _heh); } void set_texcoord2D(HalfedgeHandle _heh, const TexCoord2D& _t) { this->property(halfedge_texcoords2D_, _heh) = _t; } //------------------------------------------------------- halfedge 3D texcoords const TexCoord3D* htexcoords3D() const { return this->property(halfedge_texcoords3D_).data(); } const TexCoord3D& texcoord3D(HalfedgeHandle _heh) const { return this->property(halfedge_texcoords3D_, _heh); } void set_texcoord3D(HalfedgeHandle _heh, const TexCoord3D& _t) { this->property(halfedge_texcoords3D_, _heh) = _t; } //------------------------------------------------------------- edge colors const Color* edge_colors() const { return this->property(edge_colors_).data(); } const Color& color(EdgeHandle _eh) const { return this->property(edge_colors_, _eh); } void set_color(EdgeHandle _eh, const Color& _c) { this->property(edge_colors_, _eh) = _c; } //------------------------------------------------------------- halfedge normals const Normal& normal(HalfedgeHandle _heh) const { return this->property(halfedge_normals_, _heh); } void set_normal(HalfedgeHandle _heh, const Normal& _n) { this->property(halfedge_normals_, _heh) = _n; } //------------------------------------------------------------- halfedge colors const Color* halfedge_colors() const { return this->property(halfedge_colors_).data(); } const Color& color(HalfedgeHandle _heh) const { return this->property(halfedge_colors_, _heh); } void set_color(HalfedgeHandle _heh, const Color& _c) { this->property(halfedge_colors_, _heh) = _c; } //-------------------------------------------------------------- face normals const Normal& normal(FaceHandle _fh) const { return this->property(face_normals_, _fh); } void set_normal(FaceHandle _fh, const Normal& _n) { this->property(face_normals_, _fh) = _n; } //-------------------------------------------------------------- per Face Texture index const TextureIndex& texture_index(FaceHandle _fh) const { return this->property(face_texture_index_, _fh); } void set_texture_index(FaceHandle _fh, const TextureIndex& _t) { this->property(face_texture_index_, _fh) = _t; } //--------------------------------------------------------------- face colors const Color& color(FaceHandle _fh) const { return this->property(face_colors_, _fh); } void set_color(FaceHandle _fh, const Color& _c) { this->property(face_colors_, _fh) = _c; } //------------------------------------------------ request / alloc properties void request_vertex_normals() { if (!refcount_vnormals_++) this->add_property( vertex_normals_, "v:normals" ); } void request_vertex_colors() { if (!refcount_vcolors_++) this->add_property( vertex_colors_, "v:colors" ); } void request_vertex_texcoords1D() { if (!refcount_vtexcoords1D_++) this->add_property( vertex_texcoords1D_, "v:texcoords1D" ); } void request_vertex_texcoords2D() { if (!refcount_vtexcoords2D_++) this->add_property( vertex_texcoords2D_, "v:texcoords2D" ); } void request_vertex_texcoords3D() { if (!refcount_vtexcoords3D_++) this->add_property( vertex_texcoords3D_, "v:texcoords3D" ); } void request_halfedge_texcoords1D() { if (!refcount_htexcoords1D_++) this->add_property( halfedge_texcoords1D_, "h:texcoords1D" ); } void request_halfedge_texcoords2D() { if (!refcount_htexcoords2D_++) this->add_property( halfedge_texcoords2D_, "h:texcoords2D" ); } void request_halfedge_texcoords3D() { if (!refcount_htexcoords3D_++) this->add_property( halfedge_texcoords3D_, "h:texcoords3D" ); } void request_edge_colors() { if (!refcount_ecolors_++) this->add_property( edge_colors_, "e:colors" ); } void request_halfedge_normals() { if (!refcount_henormals_++) this->add_property( halfedge_normals_, "h:normals" ); } void request_halfedge_colors() { if (!refcount_hecolors_++) this->add_property( halfedge_colors_, "h:colors" ); } void request_face_normals() { if (!refcount_fnormals_++) this->add_property( face_normals_, "f:normals" ); } void request_face_colors() { if (!refcount_fcolors_++) this->add_property( face_colors_, "f:colors" ); } void request_face_texture_index() { if (!refcount_ftextureIndex_++) this->add_property( face_texture_index_, "f:textureindex" ); } //------------------------------------------------- release / free properties void release_vertex_normals() { if ((refcount_vnormals_ > 0) && (! --refcount_vnormals_)) this->remove_property(vertex_normals_); } void release_vertex_colors() { if ((refcount_vcolors_ > 0) && (! --refcount_vcolors_)) this->remove_property(vertex_colors_); } void release_vertex_texcoords1D() { if ((refcount_vtexcoords1D_ > 0) && (! --refcount_vtexcoords1D_)) this->remove_property(vertex_texcoords1D_); } void release_vertex_texcoords2D() { if ((refcount_vtexcoords2D_ > 0) && (! --refcount_vtexcoords2D_)) this->remove_property(vertex_texcoords2D_); } void release_vertex_texcoords3D() { if ((refcount_vtexcoords3D_ > 0) && (! --refcount_vtexcoords3D_)) this->remove_property(vertex_texcoords3D_); } void release_halfedge_texcoords1D() { if ((refcount_htexcoords1D_ > 0) && (! --refcount_htexcoords1D_)) this->remove_property(halfedge_texcoords1D_); } void release_halfedge_texcoords2D() { if ((refcount_htexcoords2D_ > 0) && (! --refcount_htexcoords2D_)) this->remove_property(halfedge_texcoords2D_); } void release_halfedge_texcoords3D() { if ((refcount_htexcoords3D_ > 0) && (! --refcount_htexcoords3D_)) this->remove_property(halfedge_texcoords3D_); } void release_edge_colors() { if ((refcount_ecolors_ > 0) && (! --refcount_ecolors_)) this->remove_property(edge_colors_); } void release_halfedge_normals() { if ((refcount_henormals_ > 0) && (! --refcount_henormals_)) this->remove_property(halfedge_normals_); } void release_halfedge_colors() { if ((refcount_hecolors_ > 0) && (! --refcount_hecolors_)) this->remove_property(halfedge_colors_); } void release_face_normals() { if ((refcount_fnormals_ > 0) && (! --refcount_fnormals_)) this->remove_property(face_normals_); } void release_face_colors() { if ((refcount_fcolors_ > 0) && (! --refcount_fcolors_)) this->remove_property(face_colors_); } void release_face_texture_index() { if ((refcount_ftextureIndex_ > 0) && (! --refcount_ftextureIndex_)) this->remove_property(face_texture_index_); } //---------------------------------------------- dynamic check for properties bool has_vertex_normals() const { return vertex_normals_.is_valid(); } bool has_vertex_colors() const { return vertex_colors_.is_valid(); } bool has_vertex_texcoords1D() const { return vertex_texcoords1D_.is_valid(); } bool has_vertex_texcoords2D() const { return vertex_texcoords2D_.is_valid(); } bool has_vertex_texcoords3D() const { return vertex_texcoords3D_.is_valid(); } bool has_halfedge_texcoords1D() const { return halfedge_texcoords1D_.is_valid();} bool has_halfedge_texcoords2D() const { return halfedge_texcoords2D_.is_valid();} bool has_halfedge_texcoords3D() const { return halfedge_texcoords3D_.is_valid();} bool has_edge_colors() const { return edge_colors_.is_valid(); } bool has_halfedge_normals() const { return halfedge_normals_.is_valid(); } bool has_halfedge_colors() const { return halfedge_colors_.is_valid(); } bool has_face_normals() const { return face_normals_.is_valid(); } bool has_face_colors() const { return face_colors_.is_valid(); } bool has_face_texture_index() const { return face_texture_index_.is_valid(); } public: typedef VPropHandleT<Point> PointsPropertyHandle; typedef VPropHandleT<Normal> VertexNormalsPropertyHandle; typedef VPropHandleT<Color> VertexColorsPropertyHandle; typedef VPropHandleT<TexCoord1D> VertexTexCoords1DPropertyHandle; typedef VPropHandleT<TexCoord2D> VertexTexCoords2DPropertyHandle; typedef VPropHandleT<TexCoord3D> VertexTexCoords3DPropertyHandle; typedef HPropHandleT<TexCoord1D> HalfedgeTexCoords1DPropertyHandle; typedef HPropHandleT<TexCoord2D> HalfedgeTexCoords2DPropertyHandle; typedef HPropHandleT<TexCoord3D> HalfedgeTexCoords3DPropertyHandle; typedef EPropHandleT<Color> EdgeColorsPropertyHandle; typedef HPropHandleT<Normal> HalfedgeNormalsPropertyHandle; typedef HPropHandleT<Color> HalfedgeColorsPropertyHandle; typedef FPropHandleT<Normal> FaceNormalsPropertyHandle; typedef FPropHandleT<Color> FaceColorsPropertyHandle; typedef FPropHandleT<TextureIndex> FaceTextureIndexPropertyHandle; public: //standard vertex properties PointsPropertyHandle points_pph() const { return points_; } VertexNormalsPropertyHandle vertex_normals_pph() const { return vertex_normals_; } VertexColorsPropertyHandle vertex_colors_pph() const { return vertex_colors_; } VertexTexCoords1DPropertyHandle vertex_texcoords1D_pph() const { return vertex_texcoords1D_; } VertexTexCoords2DPropertyHandle vertex_texcoords2D_pph() const { return vertex_texcoords2D_; } VertexTexCoords3DPropertyHandle vertex_texcoords3D_pph() const { return vertex_texcoords3D_; } //standard halfedge properties HalfedgeTexCoords1DPropertyHandle halfedge_texcoords1D_pph() const { return halfedge_texcoords1D_; } HalfedgeTexCoords2DPropertyHandle halfedge_texcoords2D_pph() const { return halfedge_texcoords2D_; } HalfedgeTexCoords3DPropertyHandle halfedge_texcoords3D_pph() const { return halfedge_texcoords3D_; } // standard edge properties HalfedgeNormalsPropertyHandle halfedge_normals_pph() const { return halfedge_normals_; } // standard edge properties HalfedgeColorsPropertyHandle halfedge_colors_pph() const { return halfedge_colors_; } // standard edge properties EdgeColorsPropertyHandle edge_colors_pph() const { return edge_colors_; } //standard face properties FaceNormalsPropertyHandle face_normals_pph() const { return face_normals_; } FaceColorsPropertyHandle face_colors_pph() const { return face_colors_; } FaceTextureIndexPropertyHandle face_texture_index_pph() const { return face_texture_index_; } VertexData& data(VertexHandle _vh) { return this->property(data_vpph_, _vh); } const VertexData& data(VertexHandle _vh) const { return this->property(data_vpph_, _vh); } FaceData& data(FaceHandle _fh) { return this->property(data_fpph_, _fh); } const FaceData& data(FaceHandle _fh) const { return this->property(data_fpph_, _fh); } EdgeData& data(EdgeHandle _eh) { return this->property(data_epph_, _eh); } const EdgeData& data(EdgeHandle _eh) const { return this->property(data_epph_, _eh); } HalfedgeData& data(HalfedgeHandle _heh) { return this->property(data_hpph_, _heh); } const HalfedgeData& data(HalfedgeHandle _heh) const { return this->property(data_hpph_, _heh); } private: //standard vertex properties PointsPropertyHandle points_; VertexNormalsPropertyHandle vertex_normals_; VertexColorsPropertyHandle vertex_colors_; VertexTexCoords1DPropertyHandle vertex_texcoords1D_; VertexTexCoords2DPropertyHandle vertex_texcoords2D_; VertexTexCoords3DPropertyHandle vertex_texcoords3D_; //standard halfedge properties HalfedgeTexCoords1DPropertyHandle halfedge_texcoords1D_; HalfedgeTexCoords2DPropertyHandle halfedge_texcoords2D_; HalfedgeTexCoords3DPropertyHandle halfedge_texcoords3D_; HalfedgeNormalsPropertyHandle halfedge_normals_; HalfedgeColorsPropertyHandle halfedge_colors_; // standard edge properties EdgeColorsPropertyHandle edge_colors_; //standard face properties FaceNormalsPropertyHandle face_normals_; FaceColorsPropertyHandle face_colors_; FaceTextureIndexPropertyHandle face_texture_index_; //data properties handles DataVPropHandle data_vpph_; DataHPropHandle data_hpph_; DataEPropHandle data_epph_; DataFPropHandle data_fpph_; unsigned int refcount_vnormals_; unsigned int refcount_vcolors_; unsigned int refcount_vtexcoords1D_; unsigned int refcount_vtexcoords2D_; unsigned int refcount_vtexcoords3D_; unsigned int refcount_htexcoords1D_; unsigned int refcount_htexcoords2D_; unsigned int refcount_htexcoords3D_; unsigned int refcount_henormals_; unsigned int refcount_hecolors_; unsigned int refcount_ecolors_; unsigned int refcount_fnormals_; unsigned int refcount_fcolors_; unsigned int refcount_ftextureIndex_; }; //============================================================================= } // namespace OpenMesh //============================================================================= #endif // OPENMESH_ATTRIBKERNEL_HH defined //=============================================================================
{ "pile_set_name": "Github" }
package io.github.iamyours.wandroid.util.glide.cache; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; public class FileUtil { public static void copyFileToDirectory(File src, File destDir) throws IOException { if (src == null) { throw new NullPointerException("Source must not be null"); } else { if (src.isFile()) { copyFileToDirectory(src, destDir,true); } else { throw new IOException("The source " + src + "must be a file."); } } } public static void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) throws IOException { if (destDir == null) { throw new NullPointerException("Destination must not be null"); } else if (destDir.exists() && !destDir.isDirectory()) { throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory"); } else { File destFile = new File(destDir, srcFile.getName()); copyFile(srcFile, destFile, preserveFileDate); } } private static void checkFileRequirements(File src, File dest) throws FileNotFoundException { if (src == null) { throw new NullPointerException("Source must not be null"); } else if (dest == null) { throw new NullPointerException("Destination must not be null"); } else if (!src.exists()) { throw new FileNotFoundException("Source '" + src + "' does not exist"); } } public static void copyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException { checkFileRequirements(srcFile, destFile); if (srcFile.isDirectory()) { throw new IOException("Source '" + srcFile + "' exists but is a directory"); } else if (srcFile.getCanonicalPath().equals(destFile.getCanonicalPath())) { throw new IOException("Source '" + srcFile + "' and destination '" + destFile + "' are the same"); } else { File parentFile = destFile.getParentFile(); if (parentFile != null && !parentFile.mkdirs() && !parentFile.isDirectory()) { throw new IOException("Destination '" + parentFile + "' directory cannot be created"); } else if (destFile.exists() && !destFile.canWrite()) { throw new IOException("Destination '" + destFile + "' exists but is read-only"); } else { doCopyFile(srcFile, destFile, preserveFileDate); } } } private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException { if (destFile.exists() && destFile.isDirectory()) { throw new IOException("Destination '" + destFile + "' exists but is a directory"); } else { FileInputStream fis = new FileInputStream(srcFile); Throwable var4 = null; try { FileChannel input = fis.getChannel(); Throwable var6 = null; try { FileOutputStream fos = new FileOutputStream(destFile); Throwable var8 = null; try { FileChannel output = fos.getChannel(); Throwable var10 = null; try { long size = input.size(); long pos = 0L; long bytesCopied; for(long count = 0L; pos < size; pos += bytesCopied) { long remain = size - pos; count = remain > 31457280L ? 31457280L : remain; bytesCopied = output.transferFrom(input, pos, count); if (bytesCopied == 0L) { break; } } } catch (Throwable var91) { var10 = var91; throw var91; } finally { if (output != null) { if (var10 != null) { try { output.close(); } catch (Throwable var90) { var10.addSuppressed(var90); } } else { output.close(); } } } } catch (Throwable var93) { var8 = var93; throw var93; } finally { if (fos != null) { if (var8 != null) { try { fos.close(); } catch (Throwable var89) { var8.addSuppressed(var89); } } else { fos.close(); } } } } catch (Throwable var95) { var6 = var95; throw var95; } finally { if (input != null) { if (var6 != null) { try { input.close(); } catch (Throwable var88) { var6.addSuppressed(var88); } } else { input.close(); } } } } catch (Throwable var97) { var4 = var97; throw var97; } finally { if (fis != null) { if (var4 != null) { try { fis.close(); } catch (Throwable var87) { var4.addSuppressed(var87); } } else { fis.close(); } } } long srcLen = srcFile.length(); long dstLen = destFile.length(); if (srcLen != dstLen) { throw new IOException("Failed to copy full contents from '" + srcFile + "' to '" + destFile + "' Expected length: " + srcLen + " Actual: " + dstLen); } else { if (preserveFileDate) { destFile.setLastModified(srcFile.lastModified()); } } } } }
{ "pile_set_name": "Github" }
armada-y := armada_crtc.o armada_drv.o armada_fb.o armada_fbdev.o \ armada_gem.o armada_output.o armada_overlay.o \ armada_slave.o armada-y += armada_510.o armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o obj-$(CONFIG_DRM_ARMADA) := armada.o
{ "pile_set_name": "Github" }
%YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!1386491679 &1 PresetManager: m_ObjectHideFlags: 0 m_DefaultList: []
{ "pile_set_name": "Github" }
name: gocd-agent description: | (Experimental) Gocd agent version: 16.2.1-rancher1 category: Continuous Integration maintainer: "Raul Sanchez <[email protected]>" minimum_rancher_version: v0.59.0 license:
{ "pile_set_name": "Github" }
package protocol import ( "net/http" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" ) // UnmarshalErrorHandler provides unmarshaling errors API response errors for // both typed and untyped errors. type UnmarshalErrorHandler struct { unmarshaler ErrorUnmarshaler } // ErrorUnmarshaler is an abstract interface for concrete implementations to // unmarshal protocol specific response errors. type ErrorUnmarshaler interface { UnmarshalError(*http.Response, ResponseMetadata) (error, error) } // NewUnmarshalErrorHandler returns an UnmarshalErrorHandler // initialized for the set of exception names to the error unmarshalers func NewUnmarshalErrorHandler(unmarshaler ErrorUnmarshaler) *UnmarshalErrorHandler { return &UnmarshalErrorHandler{ unmarshaler: unmarshaler, } } // UnmarshalErrorHandlerName is the name of the named handler. const UnmarshalErrorHandlerName = "awssdk.protocol.UnmarshalError" // NamedHandler returns a NamedHandler for the unmarshaler using the set of // errors the unmarshaler was initialized for. func (u *UnmarshalErrorHandler) NamedHandler() request.NamedHandler { return request.NamedHandler{ Name: UnmarshalErrorHandlerName, Fn: u.UnmarshalError, } } // UnmarshalError will attempt to unmarshal the API response's error message // into either a generic SDK error type, or a typed error corresponding to the // errors exception name. func (u *UnmarshalErrorHandler) UnmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() respMeta := ResponseMetadata{ StatusCode: r.HTTPResponse.StatusCode, RequestID: r.RequestID, } v, err := u.unmarshaler.UnmarshalError(r.HTTPResponse, respMeta) if err != nil { r.Error = awserr.NewRequestFailure( awserr.New(request.ErrCodeSerialization, "failed to unmarshal response error", err), respMeta.StatusCode, respMeta.RequestID, ) return } r.Error = v }
{ "pile_set_name": "Github" }
admin alexander alright andreas attlist auctions bastian blockwise bool charset checkbox checkboxes classpath clickable clipboard closable cmd codepoint codepoints colorize combo combobox comp conformance constr coords ctx damerau db dbname deactivate deactivates decompress decompressed decompresses dennis diacritics dir doctype download dublin editable eg egli endian erdal eval expr externalized filesystem fragmentation freq frontend fs ft ftcontains ftdata ftnot fullscreen fulltext gath gruen gui hannes hauser hidders highlighter holdability holupirek html idf idpos ids init inline inlined int io ip iter iterable jan javax jens joerg karaca kircher klinger konstanz launch lemke leo levenshtein lewandowski linux lithuanian localhost logarithmic logo lowercase lukas mac makoto markup materialization metadata michael michiels mille min monospace multimedia namespace namespaces nillable nmtoken nodeset nth num ok permille petrowsky philipp philippe placeholder poi popup pos pragma pragmas pre precalculates pred preds qizx qname realtime redo reparsed reversable rositsa sax schwarz scrollbar sebastian seiferle seq serializer shadura shneiderman snippet spannable specs squarified standalone stefan stopword stopwords str stratmann synchsafe teubner textfield tf thesaurus thumbnail thumbnails tim timestamp timezone tmp todo tokenize tokenizer tokenizers tokenizes toolbar tooltip treemap trie typeswitch ubuntu unicode unpin unpinned unpins unscanned uppercase uri url var warmups weiler whitespaces wildcard wildcards woerteler wolfgang workgroup xmark xml xmlns xpath xq xquery za ziemer zipped inlining accessor fallback orderedness glob castable erat stemmers dimitar popov tokenizable enum bulgarian czech danish persian finnish hungarian korean dutch norwegian portuguese romanian swedish turkish thai stemmer snowball tokenized multithreading curr lexer apache lucene lexing tokenization compressor util deselects snippets subtoken elmedin dedovic mnenomics mnemomic throwable lyubomyr havrylyuk todor grigoriev wiki multipart graf mutex deactivated zip href thrw cyrillic dmitry saxon incl arity malformed versioning validator zipping unzip payload credentials xslt username aaron donovan json lossless homepage milton rollbacks jetty servlet http mime clark streamable authentification optimizable stdin payloads keystore mnemomics ascii adam standardised infos proxy automagic servlets param urlencoded www sandbox sandboxed tabbed charles endpoint kronberg kirsten dirk gaussian specifity stockton rafael santos cookbook hedenus xqdoc flwor restxq downgrade downgrades unescape spec jsonml lax placeholders octet unindents hyperlink testcase testsuites testsuite testinit subarrays jav quaternary ignorable javascript inlineable autoflush soundex resizable updatable uris dist rewritable klavs prieditis selectable postfix arities mapper inlines gauss sortable losslessly taskbar johannes finckh unnests replicator refactorings xerces
{ "pile_set_name": "Github" }
/* * tvp5150 - Texas Instruments TVP5150A/AM1 video decoder registers * * Copyright (c) 2005,2006 Mauro Carvalho Chehab ([email protected]) * This code is placed under the terms of the GNU General Public License v2 */ #define TVP5150_VD_IN_SRC_SEL_1 0x00 /* Video input source selection #1 */ #define TVP5150_ANAL_CHL_CTL 0x01 /* Analog channel controls */ #define TVP5150_OP_MODE_CTL 0x02 /* Operation mode controls */ #define TVP5150_MISC_CTL 0x03 /* Miscellaneous controls */ #define TVP5150_AUTOSW_MSK 0x04 /* Autoswitch mask: TVP5150A / TVP5150AM */ /* Reserved 05h */ #define TVP5150_COLOR_KIL_THSH_CTL 0x06 /* Color killer threshold control */ #define TVP5150_LUMA_PROC_CTL_1 0x07 /* Luminance processing control #1 */ #define TVP5150_LUMA_PROC_CTL_2 0x08 /* Luminance processing control #2 */ #define TVP5150_BRIGHT_CTL 0x09 /* Brightness control */ #define TVP5150_SATURATION_CTL 0x0a /* Color saturation control */ #define TVP5150_HUE_CTL 0x0b /* Hue control */ #define TVP5150_CONTRAST_CTL 0x0c /* Contrast control */ #define TVP5150_DATA_RATE_SEL 0x0d /* Outputs and data rates select */ #define TVP5150_LUMA_PROC_CTL_3 0x0e /* Luminance processing control #3 */ #define TVP5150_CONF_SHARED_PIN 0x0f /* Configuration shared pins */ /* Reserved 10h */ #define TVP5150_ACT_VD_CROP_ST_MSB 0x11 /* Active video cropping start MSB */ #define TVP5150_ACT_VD_CROP_ST_LSB 0x12 /* Active video cropping start LSB */ #define TVP5150_ACT_VD_CROP_STP_MSB 0x13 /* Active video cropping stop MSB */ #define TVP5150_ACT_VD_CROP_STP_LSB 0x14 /* Active video cropping stop LSB */ #define TVP5150_GENLOCK 0x15 /* Genlock/RTC */ #define TVP5150_HORIZ_SYNC_START 0x16 /* Horizontal sync start */ /* Reserved 17h */ #define TVP5150_VERT_BLANKING_START 0x18 /* Vertical blanking start */ #define TVP5150_VERT_BLANKING_STOP 0x19 /* Vertical blanking stop */ #define TVP5150_CHROMA_PROC_CTL_1 0x1a /* Chrominance processing control #1 */ #define TVP5150_CHROMA_PROC_CTL_2 0x1b /* Chrominance processing control #2 */ #define TVP5150_INT_RESET_REG_B 0x1c /* Interrupt reset register B */ #define TVP5150_INT_ENABLE_REG_B 0x1d /* Interrupt enable register B */ #define TVP5150_INTT_CONFIG_REG_B 0x1e /* Interrupt configuration register B */ /* Reserved 1Fh-27h */ #define TVP5150_VIDEO_STD 0x28 /* Video standard */ /* Reserved 29h-2bh */ #define TVP5150_CB_GAIN_FACT 0x2c /* Cb gain factor */ #define TVP5150_CR_GAIN_FACTOR 0x2d /* Cr gain factor */ #define TVP5150_MACROVISION_ON_CTR 0x2e /* Macrovision on counter */ #define TVP5150_MACROVISION_OFF_CTR 0x2f /* Macrovision off counter */ #define TVP5150_REV_SELECT 0x30 /* revision select (TVP5150AM1 only) */ /* Reserved 31h-7Fh */ #define TVP5150_MSB_DEV_ID 0x80 /* MSB of device ID */ #define TVP5150_LSB_DEV_ID 0x81 /* LSB of device ID */ #define TVP5150_ROM_MAJOR_VER 0x82 /* ROM major version */ #define TVP5150_ROM_MINOR_VER 0x83 /* ROM minor version */ #define TVP5150_VERT_LN_COUNT_MSB 0x84 /* Vertical line count MSB */ #define TVP5150_VERT_LN_COUNT_LSB 0x85 /* Vertical line count LSB */ #define TVP5150_INT_STATUS_REG_B 0x86 /* Interrupt status register B */ #define TVP5150_INT_ACTIVE_REG_B 0x87 /* Interrupt active register B */ #define TVP5150_STATUS_REG_1 0x88 /* Status register #1 */ #define TVP5150_STATUS_REG_2 0x89 /* Status register #2 */ #define TVP5150_STATUS_REG_3 0x8a /* Status register #3 */ #define TVP5150_STATUS_REG_4 0x8b /* Status register #4 */ #define TVP5150_STATUS_REG_5 0x8c /* Status register #5 */ /* Reserved 8Dh-8Fh */ /* Closed caption data registers */ #define TVP5150_CC_DATA_INI 0x90 #define TVP5150_CC_DATA_END 0x93 /* WSS data registers */ #define TVP5150_WSS_DATA_INI 0x94 #define TVP5150_WSS_DATA_END 0x99 /* VPS data registers */ #define TVP5150_VPS_DATA_INI 0x9a #define TVP5150_VPS_DATA_END 0xa6 /* VITC data registers */ #define TVP5150_VITC_DATA_INI 0xa7 #define TVP5150_VITC_DATA_END 0xaf #define TVP5150_VBI_FIFO_READ_DATA 0xb0 /* VBI FIFO read data */ /* Teletext filter 1 */ #define TVP5150_TELETEXT_FIL1_INI 0xb1 #define TVP5150_TELETEXT_FIL1_END 0xb5 /* Teletext filter 2 */ #define TVP5150_TELETEXT_FIL2_INI 0xb6 #define TVP5150_TELETEXT_FIL2_END 0xba #define TVP5150_TELETEXT_FIL_ENA 0xbb /* Teletext filter enable */ /* Reserved BCh-BFh */ #define TVP5150_INT_STATUS_REG_A 0xc0 /* Interrupt status register A */ #define TVP5150_INT_ENABLE_REG_A 0xc1 /* Interrupt enable register A */ #define TVP5150_INT_CONF 0xc2 /* Interrupt configuration */ #define TVP5150_VDP_CONF_RAM_DATA 0xc3 /* VDP configuration RAM data */ #define TVP5150_CONF_RAM_ADDR_LOW 0xc4 /* Configuration RAM address low byte */ #define TVP5150_CONF_RAM_ADDR_HIGH 0xc5 /* Configuration RAM address high byte */ #define TVP5150_VDP_STATUS_REG 0xc6 /* VDP status register */ #define TVP5150_FIFO_WORD_COUNT 0xc7 /* FIFO word count */ #define TVP5150_FIFO_INT_THRESHOLD 0xc8 /* FIFO interrupt threshold */ #define TVP5150_FIFO_RESET 0xc9 /* FIFO reset */ #define TVP5150_LINE_NUMBER_INT 0xca /* Line number interrupt */ #define TVP5150_PIX_ALIGN_REG_LOW 0xcb /* Pixel alignment register low byte */ #define TVP5150_PIX_ALIGN_REG_HIGH 0xcc /* Pixel alignment register high byte */ #define TVP5150_FIFO_OUT_CTRL 0xcd /* FIFO output control */ /* Reserved CEh */ #define TVP5150_FULL_FIELD_ENA 0xcf /* Full field enable 1 */ /* Line mode registers */ #define TVP5150_LINE_MODE_INI 0xd0 #define TVP5150_LINE_MODE_END 0xfb #define TVP5150_FULL_FIELD_MODE_REG 0xfc /* Full field mode register */ /* Reserved FDh-FFh */
{ "pile_set_name": "Github" }
--- id: 589fc832f9fc0f352b528e78 title: Announce New Users challengeType: 2 forumTopicId: 301546 --- ## Description <section id='description'> Many chat rooms are able to announce when a user connects or disconnects and then display that to all of the connected users in the chat. Seeing as though you already are emitting an event on connect and disconnect, you will just have to modify this event to support such feature. The most logical way of doing so is sending 3 pieces of data with the event: name of the user connected/disconnected, the current user count, and if that name connected or disconnected. Change the event name to <code>'user'</code>, and pass an object along containing fields 'name', 'currentUsers', and 'connected' (to be <code>true</code> if connection, or <code>false</code> for disconnection of the user sent). Be sure to change both 'user count' events and set the disconnect one to send <code>false</code> for field 'connected' instead of <code>true</code> like the event emitted on connect. ```js io.emit('user', { name: socket.request.user.name, currentUsers, connected: true }); ``` Now your client will have all the necessary information to correctly display the current user count and announce when a user connects or disconnects! To handle this event on the client side we should listen for <code>'user'</code>, then update the current user count by using jQuery to change the text of <code>#num-users</code> to <code>'{NUMBER} users online'</code>, as well as append a <code>&#60;li&#62;</code> to the unordered list with id <code>messages</code> with <code>'{NAME} has {joined/left} the chat.'</code>. An implementation of this could look like the following: ```js socket.on('user', data => { $('#num-users').text(data.currentUsers + ' users online'); let message = data.name + (data.connected ? ' has joined the chat.' : ' has left the chat.'); $('#messages').append($('<li>').html('<b>' + message + '</b>')); }); ``` Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point <a href='https://gist.github.com/camperbot/bf95a0f74b756cf0771cd62c087b8286' target='_blank'>here</a>. </section> ## Instructions <section id='instructions'> </section> ## Tests <section id='tests'> ```yml tests: - text: Event <code>'user'</code> should be emitted with name, currentUsers, and connected. testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js').then(data => { assert.match(data, /io.emit.*('|")user\1.*name.*currentUsers.*connected/gis, 'You should have an event emitted named user sending name, currentUsers, and connected'); }, xhr => { throw new Error(xhr.statusText); }) - text: Client should properly handle and display the new data from event <code>'user'</code>. testString: getUserInput => $.get(getUserInput('url')+ '/public/client.js') .then(data => { assert.match(data, /socket.on.*('|")user\1[^]*num-users/gi, 'You should change the text of "#num-users" within on your client within the "user" event listener to show the current users connected'); assert.match(data, /socket.on.*('|")user\1[^]*messages.*li/gi, 'You should append a list item to "#messages" on your client within the "user" event listener to announce a user came or went'); }, xhr => { throw new Error(xhr.statusText); }) ``` </section> ## Challenge Seed <section id='challengeSeed'> </section> ## Solution <section id='solution'> ```js /** Backend challenges don't need solutions, because they would need to be tested against a full working project. Please check our contributing guidelines to learn more. */ ``` </section>
{ "pile_set_name": "Github" }
using Ncqrs.Commanding.ServiceModel; namespace Ncqrs.Commanding.CommandExecution { /// <summary> /// Defines an easy to use extension method for the <see cref="ICommandExecutor{TCommand}"/> interface. /// </summary> public static class ICommandExecutorExtensions { /// <summary> /// Registers the executor to the <see cref="CommandService"/> service. /// </summary> /// <typeparam name="TCommand">The type of command to register to the service.</typeparam> /// <param name="executor">The executor to register with the command.</param> /// <param name="service">The service on which we want to register the executor.</param> public static void RegisterWith<TCommand>(this ICommandExecutor<TCommand> executor, CommandService service) where TCommand : ICommand { service.RegisterExecutor(executor); } } }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <title>API documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale=1"> <link type='text/css' rel='stylesheet' href='../../../apidoc/stylesheets/bundled/bootstrap.min.css'/> <link type='text/css' rel='stylesheet' href='../../../apidoc/stylesheets/bundled/prettify.css'/> <link type='text/css' rel='stylesheet' href='../../../apidoc/stylesheets/bundled/bootstrap-responsive.min.css'/> <link type='text/css' rel='stylesheet' href='../../../apidoc/stylesheets/application.css'/> <!-- IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div id='container'> <ul class='breadcrumb'> <li> <a href='../../../apidoc/v2.en_GB.html'>Foreman v2</a> <span class='divider'>/</span> </li> <li> <a href='../../../apidoc/v2/config_templates.en_GB.html'> Config templates </a> <span class='divider'>/</span> </li> <li class='active'>clone</li> <li class='pull-right'> &nbsp;[ <a href="../../../apidoc/v2/config_templates/clone.pt_BR.html">pt_BR</a> | <a href="../../../apidoc/v2/config_templates/clone.de.html">de</a> | <a href="../../../apidoc/v2/config_templates/clone.it.html">it</a> | <a href="../../../apidoc/v2/config_templates/clone.sv_SE.html">sv_SE</a> | <a href="../../../apidoc/v2/config_templates/clone.zh_CN.html">zh_CN</a> | <b><a href="../../../apidoc/v2/config_templates/clone.en_GB.html">en_GB</a></b> | <a href="../../../apidoc/v2/config_templates/clone.cs_CZ.html">cs_CZ</a> | <a href="../../../apidoc/v2/config_templates/clone.fr.html">fr</a> | <a href="../../../apidoc/v2/config_templates/clone.ru.html">ru</a> | <a href="../../../apidoc/v2/config_templates/clone.ja.html">ja</a> | <a href="../../../apidoc/v2/config_templates/clone.es.html">es</a> | <a href="../../../apidoc/v2/config_templates/clone.ko.html">ko</a> | <a href="../../../apidoc/v2/config_templates/clone.ca.html">ca</a> | <a href="../../../apidoc/v2/config_templates/clone.gl.html">gl</a> | <a href="../../../apidoc/v2/config_templates/clone.en.html">en</a> | <a href="../../../apidoc/v2/config_templates/clone.zh_TW.html">zh_TW</a> | <a href="../../../apidoc/v2/config_templates/clone.nl_NL.html">nl_NL</a> | <a href="../../../apidoc/v2/config_templates/clone.pl.html">pl</a> ] </li> </ul> <div class='page-header'> <h1> POST /api/config_templates/:id/clone <br> <small>Clone a provision template</small> </h1> </div> <div> <h2>Examples</h2> <pre class="prettyprint">POST /api/config_templates/1007981701-centos5_3_pxelinux/clone { &quot;config_template&quot;: { &quot;name&quot;: &quot;&quot; } } 422 { &quot;error&quot;: { &quot;id&quot;: null, &quot;errors&quot;: { &quot;name&quot;: [ &quot;can&#39;t be blank&quot; ], &quot;operatingsystems&quot;: [ &quot;is invalid&quot; ] }, &quot;full_messages&quot;: [ &quot;Name can&#39;t be blank&quot;, &quot;Operatingsystems is invalid&quot; ] } }</pre> <h2>Params</h2> <table class='table'> <thead> <tr> <th>Param name</th> <th>Description</th> </tr> </thead> <tbody> <tr style='background-color:rgb(255,255,255);'> <td> <strong>location_id </strong><br> <small> optional </small> </td> <td> <p>Scope by locations</p> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a Integer</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(255,255,255);'> <td> <strong>organization_id </strong><br> <small> optional </small> </td> <td> <p>Scope by organisations</p> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a Integer</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(255,255,255);'> <td> <strong>id </strong><br> <small> required </small> </td> <td> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(255,255,255);'> <td> <strong>config_template </strong><br> <small> required </small> </td> <td> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a Hash</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(250,250,250);'> <td> <strong>config_template[name] </strong><br> <small> required </small> </td> <td> <p>template name</p> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a String</p> </li> </ul> </td> </tr> </tbody> </table> </div> </div> </div> <hr> <footer></footer> </div> <script type='text/javascript' src='../../../apidoc/javascripts/bundled/jquery.js'></script> <script type='text/javascript' src='../../../apidoc/javascripts/bundled/bootstrap-collapse.js'></script> <script type='text/javascript' src='../../../apidoc/javascripts/bundled/prettify.js'></script> <script type='text/javascript' src='../../../apidoc/javascripts/apipie.js'></script> </body> </html>
{ "pile_set_name": "Github" }
//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // <stack> // stack() // noexcept(is_nothrow_default_constructible<container_type>::value); // This tests a conforming extension #include <stack> #include <cassert> #include "../../../MoveOnly.h" int main() { #if __has_feature(cxx_noexcept) { typedef std::stack<MoveOnly> C; static_assert(std::is_nothrow_default_constructible<C>::value, ""); } #endif }
{ "pile_set_name": "Github" }
#MongoDB - Aula 02 - Ecercicio Autor: Sóstenes freitas de andrade usuario:(sostenesfreitas) ##Criando database ``` BlackArch(mongod-3.2.1) test> use be-mean-pokemons switched to db be-mean-pokemons BlackArch(mongod-3.2.1) be-mean-pokemons> ``` ##Listando databases ``` BlackArch(mongod-3.2.1) be-mean-pokemons> show dbs be-mean-instagram → 0.000GB be-mean-pokemons → 0.000GB be_mean → 0.002GB local → 0.000GB test → 0.000GB ``` ##Listando collections da database be-mean-pokemons ``` BlackArch(mongod-3.2.1) be-mean-pokemons> show collections ``` ##Cadastro dos pokemons ``` BlackArch(mongod-3.2.1) be-mean-pokemons> var pokes = [ {"name":"darkrai","attack":200.0,"defense":120.0,"height":10.0}, {"name":"charizard","attack":150.0,"defense":50.0,"height":89.0}, {"name":"umbreon","attack":77.0,"defense":55.0,"height":44.0}, {"name":"vaporeon","attack":87.0,"defense":29.0,"height":54.0}, {"name":"mew","attack":200.0,"defense":209.0,"height":4.0}, {"name":"mewtwo","attack":300.0,"defense":290.0,"height":40.0}, {"name":"arceus","attack":400.0,"defense":390.0,"height":400.0} ] BlackArch(mongod-3.2.1) be-mean-pokemons> db.pokemons.insert(pokes) ``` #Lista de todos os pokemons da collections pokemons ``` BlackArch(mongod-3.2.1) be-mean-pokemons> db.pokemons.find() { "_id": ObjectId("56c64b4304e657a13e0cd708"), "name": "darkrai", "attack": 200, "defense": 120, "height": 10, } { "_id": ObjectId("56c64b6904e657a13e0cd709"), "name": "charizard", "attack": 150, "defense": 50, "height": 89 } { "_id": ObjectId("56c64baa04e657a13e0cd70c"), "name": "umbreon", "attack": 77, "defense": 55, "height": 44 } { "_id": ObjectId("56c64bde04e657a13e0cd70d"), "name": "vaporeon", "attack": 87, "defense": 29, "height": 54 } { "_id": ObjectId("56c64bf304e657a13e0cd70e"), "name": "mew", "attack": 200, "defense": 209, "height": 4 } { "_id": ObjectId("56c64c0404e657a13e0cd70f"), "name": "mewtwo", "attack": 300, "defense": 290, "height": 40 } { "_id": ObjectId("56c64c2904e657a13e0cd710"), "name": "arceus", "attack": 400, "defense": 390, "height": 400 } { Fetched 8 record(s) in 2ms ``` #Query para buscar um pokemon ``` BlackArch(mongod-3.2.1) be-mean-pokemons> var query = {"name":"darkrai"} BlackArch(mongod-3.2.1) be-mean-pokemons> var poke = db.pokemons.findOne(query) BlackArch(mongod-3.2.1) be-mean-pokemons> poke { "_id": ObjectId("56c64b4304e657a13e0cd708"), "name": "darkrai", "attack": 200, "defense": 120, "height": 10 } ``` #Atualização do Pokemon selecionado ``` BlackArch(mongod-3.2.1) be-mean-pokemons> poke.description = "Melhor pokemon ever" Melhor pokemon ever BlackArch(mongod-3.2.1) be-mean-pokemons> db.pokemons.save(poke) Updated 1 existing record(s) in 1ms WriteResult({ "nMatched": 1, "nUpserted": 0, "nModified": 1 }) ```
{ "pile_set_name": "Github" }
page-slide-transitions { h2 { color: white; } ion-slides, .swiper-container { height: 70vh; width: auto; } .swiper-slide { background-size: cover !important; background-position: center !important; } .swiper-pagination-bullet { background-color: white; } // Custom Pagination Style 1 .custom-pagination.swiper-pagination-bullet { width: 20px; height: 20px; text-align: center; line-height: 20px; font-size: 12px; color: #000; opacity: 1; background: rgba(0, 0, 0, 0.2); } .custom-pagination.swiper-pagination-bullet-active { color: #fff; background: #f52c2c; transition: transform 0.3s; transform: scale(1.5); } // Custom Pagination Style 2 .custom-pagination-2.swiper-pagination-bullet { width: 20px; height: 20px; text-align: center; font-size: 12px; opacity: 1; line-height: 18px; color: #fff; background: rgba(0, 0, 0, 0.2); border: 1px solid white; } .custom-pagination-2.swiper-pagination-bullet-active { color: #fff; border-color: #a0f; background: transparent; } // Custom Pagination with Icons .custom-pagination-3.swiper-pagination-bullet { width: 20px; height: 20px; opacity: 1; border-radius: 0; background-size: cover; background-position: center; } .custom-pagination-3.swiper-pagination-bullet-active { width: 25px; height: 25px; transition: transform 0.3s; transform: scale(1.5); } // Icons developed by Paomedia: https://www.iconfinder.com/iconsets/small-n-flat .swiper-pagination-bullet.bullet-icon-1 { background: url(../assets/icon/camera.svg) no-repeat; } .bullet-icon-2 { background: url(../assets/icon/map.svg) no-repeat; } .bullet-icon-3 { background: url(../assets/icon/world.svg) no-repeat; } .bullet-icon-4 { background: url(../assets/icon/heart.svg) no-repeat; } }
{ "pile_set_name": "Github" }
/* PowerPC64 default implementation of memrchr. Copyright (C) 2013-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <sysdeps/powerpc/powerpc32/power4/multiarch/memrchr-ppc32.c>
{ "pile_set_name": "Github" }
module.exports = angular .module('diFileImport.directives.choose', []) .directive('fileImportChooseFile', function($rootScope, documentsService) { var $ = jQuery; var directive = { restrict: 'A', link: function(scope, el, attrs) { el.hide(); var isHtmlFlagSet = false $rootScope.$on('importFile.choose', function(event, args) { // Prevent angular bootstrap menu from tripping // over itself in the click handler they bind to // the document to close the menu. var jQEvent = $.Event('click'); // Hacky way of importing HTML file check; not recommended if(args && args.isHtml) isHtmlFlagSet = true jQEvent.stopPropagation(); el.trigger(jQEvent); }); el.change(function(e) { var file = this.files[0]; // Is it a markdown file or html file? documentsService.importFile(file, true, isHtmlFlagSet ); isHtmlFlagSet = false // Reset to clear the FileList, which is read-only this.value = '' }); } }; return directive; })
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> .wrap{ width: 50%; box-sizing: border-box; float: left; } .wrap, .list{ border: solid 1px green; padding: 30px; margin: 30px 0; } .list{ border: solid 1px red; } .list li{ border: solid 1px blue; padding: 10px; margin: 10px; } .count{ color: red; } </style> </head> <body> <p> 不论鼠标指针穿过被选元素或其子元素,都会触发 mouseover 事件。 <br /> 只有在鼠标指针穿过被选元素时,才会触发 mouseenter 事件 </p> <div class="wrap"> wrap, mouseover <ul class="mouseover list"> count: <span class="count"></span> <li>1</li> <li>2</li> <li>3</li> </ul> </div> <div class="wrap"> wrap, mouseenter <ul class="mouseenter list"> count: <span class="count"></span> <li>1</li> <li>2</li> <li>3</li> </ul> </div> <div class="wrap"> wrap, mouseout <ul class="mouseout list"> count: <span class="count"></span> <li>1</li> <li>2</li> <li>3</li> </ul> </div> <div class="wrap"> wrap, mouseleave <ul class="mouseleave list"> count: <span class="count"></span> <li>1</li> <li>2</li> <li>3</li> </ul> </div> <div class="wrap"> wrap, emulate mouseenter,用mouseover模拟实现mouseenter <ul class="emulate-mouseenter list"> count: <span class="count"></span> <li>1</li> <li>2</li> <li>3</li> </ul> </div> <div class="wrap"> wrap, emulate mouseenter,用mouseout模拟实现mouseleave <ul class="emulate-mouseleave list"> count: <span class="count"></span> <li>1</li> <li>2</li> <li>3</li> </ul> </div> <script> let $mouseover = document.querySelector('.mouseover') let $mouseenter = document.querySelector('.mouseenter') let $mouseout = document.querySelector('.mouseout') let $mouseleave = document.querySelector('.mouseleave') let $emulateMouseenter = document.querySelector('.emulate-mouseenter') let $emulateMouseleave = document.querySelector('.emulate-mouseleave') let $overCount = document.querySelector('.mouseover .count') let $enterCount = document.querySelector('.mouseenter .count') let $outCount = document.querySelector('.mouseout .count') let $leaveCount = document.querySelector('.mouseleave .count') let $emulateMouseenterCounter = document.querySelector('.emulate-mouseenter .count') let $emulateMouseleaveCount = document.querySelector('.emulate-mouseleave .count') let addCount = function (ele, start) { return function () { ele.innerHTML = ++start } } let docEle = document.documentElement let contains = docEle.contains ? function (parent, node) { return parent !== node && parent.contains(node) } : function (parent, node) { let result = parent !== node if (!result) { return result } if (result) { while (node && (node = node.parentNode)) { if (parent === node) { return true } } } return false } let emulateMouseenterCallback = addCount($emulateMouseenterCounter, 0) let emulateMouseleaveCallback = addCount($emulateMouseleaveCount, 0) let emulateEnterOrLeave = function (callback) { return function (e) { let relatedTarget = e.relatedTarget if (relatedTarget !== this && !contains(this, relatedTarget)) { callback.apply(this, arguments) } } } $mouseover.addEventListener('mouseover', addCount($overCount, 0), false) $mouseenter.addEventListener('mouseenter', addCount($enterCount, 0), false) $mouseout.addEventListener('mouseout', addCount($outCount, 0), false) $mouseleave.addEventListener('mouseleave', addCount($leaveCount, 0), false) $emulateMouseenter.addEventListener('mouseover', emulateEnterOrLeave(emulateMouseenterCallback), false) $emulateMouseleave.addEventListener('mouseout', emulateEnterOrLeave(emulateMouseleaveCallback), false) </script> </body> </html>
{ "pile_set_name": "Github" }
--TEST-- XHProf: Sampling Mode Test --FILE-- <?php include_once dirname(__FILE__).'/common.php'; function foo() { // sleep 0.8 seconds usleep(800000); } function bar() { foo(); } function goo() { bar(); } // call goo() once xhprof_sample_enable(); goo(); $output1 = xhprof_sample_disable(); // call goo() twice xhprof_sample_enable(); goo(); goo(); $output2 = xhprof_sample_disable(); // how many usleep samples did we get in single call to goo()? $count1 = 0; foreach ($output1 as $sample) { if ($sample == "main()==>goo==>bar==>foo==>usleep") { $count1++; } } // how many usleep samples did we get in two calls to goo()? $count2 = 0; foreach ($output2 as $sample) { if ($sample == "main()==>goo==>bar==>foo==>usleep") { $count2++; } } // // our default sampling frequency is 0.1 seconds. So // we would expect about 8 samples (given that foo() // sleeps for 0.8 seconds). However, we might in future // allow the sampling frequency to be modified. So rather // than depend on the absolute number of samples, we'll // check to see if $count2 is roughly double of $count1. // if (($count1 == 0) || (($count2 / $count1) > 2.5) || (($count2 / $count1) < 1.5)) { echo "Test failed\n"; echo "Count of usleep samples in one call to goo(): $count1\n"; echo "Count of usleep samples in two calls to goo(): $count2\n"; echo "Samples in one call to goo(): \n"; var_dump($output1); echo "Samples in two calls to goo(): \n"; var_dump($output2); } else { echo "Test passed\n"; } ?> --EXPECT-- Test passed
{ "pile_set_name": "Github" }
using Microsoft.Xrm.Sdk; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Xrm.Framework.CI.Sample.Plugins { public class SamplePlugin : IPlugin { public void Execute(IServiceProvider serviceProvider) { throw new InvalidPluginExecutionException("Sample Plugin"); } } }
{ "pile_set_name": "Github" }
import math import re import pandas as pd from tqdm import tqdm import featuretools as ft import featuretools.variable_types as vtypes def load_flight(month_filter=None, categorical_filter=None, nrows=None, demo=True, return_single_table=False, verbose=False): ''' Download, clean, and filter flight data from 2017. The original dataset can be found `here <https://www.transtats.bts.gov/DL_SelectFields.asp?DB_Short_Name=On-Time&Table_ID=236>`_. Args: month_filter (list[int]): Only use data from these months (example is ``[1, 2]``). To skip, set to None. categorical_filter (dict[str->str]): Use only specified categorical values. Example is ``{'dest_city': ['Boston, MA'], 'origin_city': ['Boston, MA']}`` which returns all flights in OR out of Boston. To skip, set to None. nrows (int): Passed to nrows in ``pd.read_csv``. Used before filtering. demo (bool): Use only two months of data. If False, use the whole year. return_single_table (bool): Exit the function early and return a dataframe. verbose (bool): Show a progress bar while loading the data. Examples: .. ipython:: :verbatim: In [1]: import featuretools as ft In [2]: es = ft.demo.load_flight(verbose=True, ...: month_filter=[1], ...: categorical_filter={'origin_city':['Boston, MA']}) 100%|xxxxxxxxxxxxxxxxxxxxxxxxx| 100/100 [01:16<00:00, 1.31it/s] In [3]: es Out[3]: Entityset: Flight Data Entities: airports [Rows: 55, Columns: 3] flights [Rows: 613, Columns: 9] trip_logs [Rows: 9456, Columns: 22] airlines [Rows: 10, Columns: 1] Relationships: trip_logs.flight_id -> flights.flight_id flights.carrier -> airlines.carrier flights.dest -> airports.dest ''' filename, csv_length = get_flight_filename(demo=demo) print('Downloading data ...') url = "https://api.featurelabs.com/datasets/{}?version={}".format(filename, ft.__version__) chunksize = math.ceil(csv_length / 99) pd.options.display.max_columns = 200 iter_csv = pd.read_csv(url, compression='zip', iterator=True, nrows=nrows, chunksize=chunksize) if verbose: iter_csv = tqdm(iter_csv, total=100) partial_df_list = [] for chunk in iter_csv: df = filter_data(_clean_data(chunk), month_filter=month_filter, categorical_filter=categorical_filter) partial_df_list.append(df) data = pd.concat(partial_df_list) if return_single_table: return data es = make_es(data) return es def make_es(data): es = ft.EntitySet('Flight Data') arr_time_columns = ['arr_delay', 'dep_delay', 'carrier_delay', 'weather_delay', 'national_airspace_delay', 'security_delay', 'late_aircraft_delay', 'canceled', 'diverted', 'taxi_in', 'taxi_out', 'air_time', 'dep_time'] variable_types = {'flight_num': vtypes.Categorical, 'distance_group': vtypes.Ordinal, 'canceled': vtypes.Boolean, 'diverted': vtypes.Boolean} es.entity_from_dataframe('trip_logs', data, index='trip_log_id', make_index=True, time_index='date_scheduled', secondary_time_index={'arr_time': arr_time_columns}, variable_types=variable_types) es.normalize_entity('trip_logs', 'flights', 'flight_id', additional_variables=['origin', 'origin_city', 'origin_state', 'dest', 'dest_city', 'dest_state', 'distance_group', 'carrier', 'flight_num']) es.normalize_entity('flights', 'airlines', 'carrier', make_time_index=False) es.normalize_entity('flights', 'airports', 'dest', additional_variables=['dest_city', 'dest_state'], make_time_index=False) return es def _clean_data(data): # Make column names snake case clean_data = data.rename( columns={col: convert(col) for col in data}) # Chance crs -> "scheduled" and other minor clarifications clean_data = clean_data.rename(columns={'crs_arr_time': 'scheduled_arr_time', 'crs_dep_time': 'scheduled_dep_time', 'crs_elapsed_time': 'scheduled_elapsed_time', 'nas_delay': 'national_airspace_delay', 'origin_city_name': 'origin_city', 'dest_city_name': 'dest_city', 'cancelled': 'canceled'}) # Combine strings like 0130 (1:30 AM) with dates (2017-01-01) clean_data['scheduled_dep_time'] = clean_data['scheduled_dep_time'].apply(lambda x: str(x)) + clean_data['flight_date'].astype('str') # Parse combined string as a date clean_data.loc[:, 'scheduled_dep_time'] = pd.to_datetime( clean_data['scheduled_dep_time'], format='%H%M%Y-%m-%d', errors='coerce') clean_data['scheduled_elapsed_time'] = pd.to_timedelta(clean_data['scheduled_elapsed_time'], unit='m') clean_data = _reconstruct_times(clean_data) # Create a time index 6 months before scheduled_dep clean_data.loc[:, 'date_scheduled'] = clean_data['scheduled_dep_time'].dt.date - \ pd.Timedelta('120d') # A null entry for a delay means no delay clean_data = _fill_labels(clean_data) # Nulls for scheduled values are too problematic. Remove them. clean_data = clean_data.dropna( axis='rows', subset=['scheduled_dep_time', 'scheduled_arr_time']) # Make a flight id. Define a flight as a combination of: # 1. carrier 2. flight number 3. origin airport 4. dest airport clean_data.loc[:, 'flight_id'] = clean_data['carrier'] + '-' + \ clean_data['flight_num'].apply(lambda x: str(x)) + ':' + clean_data['origin'] + '->' + clean_data['dest'] column_order = [ 'flight_id', 'flight_num', 'date_scheduled', 'scheduled_dep_time', 'scheduled_arr_time', 'carrier', 'origin', 'origin_city', 'origin_state', 'dest', 'dest_city', 'dest_state', 'distance_group', 'dep_time', 'arr_time', 'dep_delay', 'taxi_out', 'taxi_in', 'arr_delay', 'diverted', 'scheduled_elapsed_time', 'air_time', 'distance', 'carrier_delay', 'weather_delay', 'national_airspace_delay', 'security_delay', 'late_aircraft_delay', 'canceled' ] clean_data = clean_data[column_order] return clean_data def _fill_labels(clean_data): labely_columns = ['arr_delay', 'dep_delay', 'carrier_delay', 'weather_delay', 'national_airspace_delay', 'security_delay', 'late_aircraft_delay', 'canceled', 'diverted', 'taxi_in', 'taxi_out', 'air_time'] for col in labely_columns: clean_data.loc[:, col] = clean_data[col].fillna(0) return clean_data def _reconstruct_times(clean_data): """ Reconstruct departure_time, scheduled_dep_time, arrival_time and scheduled_arr_time by adding known delays to known times. We do: - dep_time is scheduled_dep + dep_delay - arr_time is dep_time + taxiing and air_time - scheduled arrival is scheduled_dep + scheduled_elapsed """ clean_data.loc[:, 'dep_time'] = clean_data['scheduled_dep_time'] + \ pd.to_timedelta(clean_data['dep_delay'], unit='m') clean_data.loc[:, 'arr_time'] = clean_data['dep_time'] + \ pd.to_timedelta(clean_data['taxi_out'] + clean_data['air_time'] + clean_data['taxi_in'], unit='m') clean_data.loc[:, 'scheduled_arr_time'] = clean_data['scheduled_dep_time'] + \ clean_data['scheduled_elapsed_time'] return clean_data def filter_data(clean_data, month_filter=None, categorical_filter=None): if month_filter is not None: tmp = clean_data['scheduled_dep_time'].dt.month.isin(month_filter) clean_data = clean_data[tmp] if categorical_filter is not None: tmp = False for key, values in categorical_filter.items(): tmp = tmp | clean_data[key].isin(values) clean_data = clean_data[tmp] return clean_data def convert(name): # Rename columns to underscore # Code via SO https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() def get_flight_filename(demo=True): if demo: filename = SMALL_FLIGHT_CSV rows = 860457 else: filename = BIG_FLIGHT_CSV rows = 5162742 return filename, rows SMALL_FLIGHT_CSV = 'data_2017_jan_feb.csv.zip' BIG_FLIGHT_CSV = 'data_all_2017.csv.zip'
{ "pile_set_name": "Github" }
#ifndef LIGHTGBM_TREELEARNER_SPLIT_INFO_HPP_ #define LIGHTGBM_TREELEARNER_SPLIT_INFO_HPP_ #include <LightGBM/meta.h> #include <cmath> #include <cstdint> #include <cstring> #include <limits> #include <functional> namespace LightGBM { /*! * \brief Used to store some information for gain split point */ struct SplitInfo { public: /*! \brief Feature index */ int feature = -1; /*! \brief Split threshold */ uint32_t threshold = 0; /*! \brief Left number of data after split */ data_size_t left_count = 0; /*! \brief Right number of data after split */ data_size_t right_count = 0; int num_cat_threshold = 0; /*! \brief Left output after split */ double left_output = 0.0; /*! \brief Right output after split */ double right_output = 0.0; /*! \brief Split gain */ double gain = kMinScore; /*! \brief Left sum gradient after split */ double left_sum_gradient = 0; /*! \brief Left sum hessian after split */ double left_sum_hessian = 0; /*! \brief Right sum gradient after split */ double right_sum_gradient = 0; /*! \brief Right sum hessian after split */ double right_sum_hessian = 0; std::vector<uint32_t> cat_threshold; /*! \brief True if default split is left */ bool default_left = true; int8_t monotone_type = 0; double min_constraint = -std::numeric_limits<double>::max(); double max_constraint = std::numeric_limits<double>::max(); inline static int Size(int max_cat_threshold) { return 2 * sizeof(int) + sizeof(uint32_t) + sizeof(bool) + sizeof(double) * 9 + sizeof(data_size_t) * 2 + max_cat_threshold * sizeof(uint32_t) + sizeof(int8_t); } inline void CopyTo(char* buffer) const { std::memcpy(buffer, &feature, sizeof(feature)); buffer += sizeof(feature); std::memcpy(buffer, &left_count, sizeof(left_count)); buffer += sizeof(left_count); std::memcpy(buffer, &right_count, sizeof(right_count)); buffer += sizeof(right_count); std::memcpy(buffer, &gain, sizeof(gain)); buffer += sizeof(gain); std::memcpy(buffer, &threshold, sizeof(threshold)); buffer += sizeof(threshold); std::memcpy(buffer, &left_output, sizeof(left_output)); buffer += sizeof(left_output); std::memcpy(buffer, &right_output, sizeof(right_output)); buffer += sizeof(right_output); std::memcpy(buffer, &left_sum_gradient, sizeof(left_sum_gradient)); buffer += sizeof(left_sum_gradient); std::memcpy(buffer, &left_sum_hessian, sizeof(left_sum_hessian)); buffer += sizeof(left_sum_hessian); std::memcpy(buffer, &right_sum_gradient, sizeof(right_sum_gradient)); buffer += sizeof(right_sum_gradient); std::memcpy(buffer, &right_sum_hessian, sizeof(right_sum_hessian)); buffer += sizeof(right_sum_hessian); std::memcpy(buffer, &default_left, sizeof(default_left)); buffer += sizeof(default_left); std::memcpy(buffer, &monotone_type, sizeof(monotone_type)); buffer += sizeof(monotone_type); std::memcpy(buffer, &min_constraint, sizeof(min_constraint)); buffer += sizeof(min_constraint); std::memcpy(buffer, &max_constraint, sizeof(max_constraint)); buffer += sizeof(max_constraint); std::memcpy(buffer, &num_cat_threshold, sizeof(num_cat_threshold)); buffer += sizeof(num_cat_threshold); std::memcpy(buffer, cat_threshold.data(), sizeof(uint32_t) * num_cat_threshold); } void CopyFrom(const char* buffer) { std::memcpy(&feature, buffer, sizeof(feature)); buffer += sizeof(feature); std::memcpy(&left_count, buffer, sizeof(left_count)); buffer += sizeof(left_count); std::memcpy(&right_count, buffer, sizeof(right_count)); buffer += sizeof(right_count); std::memcpy(&gain, buffer, sizeof(gain)); buffer += sizeof(gain); std::memcpy(&threshold, buffer, sizeof(threshold)); buffer += sizeof(threshold); std::memcpy(&left_output, buffer, sizeof(left_output)); buffer += sizeof(left_output); std::memcpy(&right_output, buffer, sizeof(right_output)); buffer += sizeof(right_output); std::memcpy(&left_sum_gradient, buffer, sizeof(left_sum_gradient)); buffer += sizeof(left_sum_gradient); std::memcpy(&left_sum_hessian, buffer, sizeof(left_sum_hessian)); buffer += sizeof(left_sum_hessian); std::memcpy(&right_sum_gradient, buffer, sizeof(right_sum_gradient)); buffer += sizeof(right_sum_gradient); std::memcpy(&right_sum_hessian, buffer, sizeof(right_sum_hessian)); buffer += sizeof(right_sum_hessian); std::memcpy(&default_left, buffer, sizeof(default_left)); buffer += sizeof(default_left); std::memcpy(&monotone_type, buffer, sizeof(monotone_type)); buffer += sizeof(monotone_type); std::memcpy(&min_constraint, buffer, sizeof(min_constraint)); buffer += sizeof(min_constraint); std::memcpy(&max_constraint, buffer, sizeof(max_constraint)); buffer += sizeof(max_constraint); std::memcpy(&num_cat_threshold, buffer, sizeof(num_cat_threshold)); buffer += sizeof(num_cat_threshold); cat_threshold.resize(num_cat_threshold); std::memcpy(cat_threshold.data(), buffer, sizeof(uint32_t) * num_cat_threshold); } inline void Reset() { // initialize with -1 and -inf gain feature = -1; gain = kMinScore; } inline bool operator > (const SplitInfo& si) const { double local_gain = this->gain; double other_gain = si.gain; // replace nan with -inf if (local_gain == NAN) { local_gain = kMinScore; } // replace nan with -inf if (other_gain == NAN) { other_gain = kMinScore; } int local_feature = this->feature; int other_feature = si.feature; // replace -1 with max int if (local_feature == -1) { local_feature = INT32_MAX; } // replace -1 with max int if (other_feature == -1) { other_feature = INT32_MAX; } if (local_gain != other_gain) { return local_gain > other_gain; } else { // if same gain, use smaller feature return local_feature < other_feature; } } inline bool operator == (const SplitInfo& si) const { double local_gain = this->gain; double other_gain = si.gain; // replace nan with -inf if (local_gain == NAN) { local_gain = kMinScore; } // replace nan with -inf if (other_gain == NAN) { other_gain = kMinScore; } int local_feature = this->feature; int other_feature = si.feature; // replace -1 with max int if (local_feature == -1) { local_feature = INT32_MAX; } // replace -1 with max int if (other_feature == -1) { other_feature = INT32_MAX; } if (local_gain != other_gain) { return local_gain == other_gain; } else { // if same gain, use smaller feature return local_feature == other_feature; } } }; struct LightSplitInfo { public: /*! \brief Feature index */ int feature = -1; /*! \brief Split gain */ double gain = kMinScore; /*! \brief Left number of data after split */ data_size_t left_count = 0; /*! \brief Right number of data after split */ data_size_t right_count = 0; inline void Reset() { // initialize with -1 and -inf gain feature = -1; gain = kMinScore; } void CopyFrom(const SplitInfo& other) { feature = other.feature; gain = other.gain; left_count = other.left_count; right_count = other.right_count; } void CopyFrom(const char* buffer) { std::memcpy(&feature, buffer, sizeof(feature)); buffer += sizeof(feature); std::memcpy(&left_count, buffer, sizeof(left_count)); buffer += sizeof(left_count); std::memcpy(&right_count, buffer, sizeof(right_count)); buffer += sizeof(right_count); std::memcpy(&gain, buffer, sizeof(gain)); buffer += sizeof(gain); } inline bool operator > (const LightSplitInfo& si) const { double local_gain = this->gain; double other_gain = si.gain; // replace nan with -inf if (local_gain == NAN) { local_gain = kMinScore; } // replace nan with -inf if (other_gain == NAN) { other_gain = kMinScore; } int local_feature = this->feature; int other_feature = si.feature; // replace -1 with max int if (local_feature == -1) { local_feature = INT32_MAX; } // replace -1 with max int if (other_feature == -1) { other_feature = INT32_MAX; } if (local_gain != other_gain) { return local_gain > other_gain; } else { // if same gain, use smaller feature return local_feature < other_feature; } } inline bool operator == (const LightSplitInfo& si) const { double local_gain = this->gain; double other_gain = si.gain; // replace nan with -inf if (local_gain == NAN) { local_gain = kMinScore; } // replace nan with -inf if (other_gain == NAN) { other_gain = kMinScore; } int local_feature = this->feature; int other_feature = si.feature; // replace -1 with max int if (local_feature == -1) { local_feature = INT32_MAX; } // replace -1 with max int if (other_feature == -1) { other_feature = INT32_MAX; } if (local_gain != other_gain) { return local_gain == other_gain; } else { // if same gain, use smaller feature return local_feature == other_feature; } } }; } // namespace LightGBM #endif // LightGBM_TREELEARNER_SPLIT_INFO_HPP_
{ "pile_set_name": "Github" }
{ "code": 401, "message": "Invalid credentials." }
{ "pile_set_name": "Github" }
/* * Copyright 2017 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.microbench.buffer; import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.UnpooledByteBufAllocator; import io.netty.microbench.util.AbstractMicrobenchmark; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; @State(Scope.Benchmark) @Warmup(iterations = 5) @Measurement(iterations = 10) @Threads(8) public class ByteBufAllocatorConcurrentBenchmark extends AbstractMicrobenchmark { private static final ByteBufAllocator unpooledAllocator = new UnpooledByteBufAllocator(true, true); @Param({ "00064", "00256", "01024", "04096" }) public int size; @Benchmark public boolean allocateRelease() { return unpooledAllocator.directBuffer(size).release(); } }
{ "pile_set_name": "Github" }
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See library home page at http://www.boost.org/libs/numeric/conversion // // Contact the author at: [email protected] // #ifndef BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP #define BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP #include "boost/limits.hpp" #include "boost/config.hpp" #include "boost/mpl/if.hpp" namespace boost { namespace numeric { namespace boundsdetail { template<class N> class Integral { typedef std::numeric_limits<N> limits ; public : static N lowest () { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); } static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); } static N smallest() { return static_cast<N>(1); } } ; template<class N> class Float { typedef std::numeric_limits<N> limits ; public : static N lowest () { return static_cast<N>(-limits::max BOOST_PREVENT_MACRO_SUBSTITUTION ()) ; } static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); } static N smallest() { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); } } ; template<class N> struct get_impl { typedef mpl::bool_< ::std::numeric_limits<N>::is_integer > is_int ; typedef Integral<N> impl_int ; typedef Float <N> impl_float ; typedef typename mpl::if_<is_int,impl_int,impl_float>::type type ; } ; } } } // namespace boost::numeric::boundsdetail. #endif // ///////////////////////////////////////////////////////////////////////////////////////////////
{ "pile_set_name": "Github" }
## Tbo 这是一个更友好、更强大、更轻巧、<del>更多 bug</del> 的框架 PS:[真正的粉丝群](https://telegram.me/TboJiangGroup) PSS:[开发文档](https://github.com/U2FsdGVkX1/Tbo/wiki) AD:[作者自己的 channel(与 Tbo 无关)](https://t.me/u2fplus1s) --- 为了保证 Tbo 正常运行,建议安装到符合以下条件的环境 1. 滋辞 [PDO](https://php.net/manual/zh/ref.pdo-mysql.php) 2. 滋辞 [pathinfo](https://github.com/U2FsdGVkX1/Tbo/wiki/%E5%BC%80%E5%90%AF-pathinfo-%E7%9A%84%E6%BB%8B%E8%BE%9E) 3. 滋辞 https(强烈建议使用 [Let's Encrypt](https://letsencrypt.org)) 4. PHP >= 5.4 5. 确保服务器能够访问到 Telegram(所以就不要使用国内的服务器了) 6. Config 目录拥有写权限 [安装过程](https://github.com/U2FsdGVkX1/Tbo/wiki/%E5%AE%89%E8%A3%85%E8%BF%87%E7%A8%8B) --- Tbo 使用了以下开源项目,感谢它们的贡献: [FrameLite](https://github.com/U2FsdGVkX1/FrameLite) [Bootstrap](https://github.com/twbs/bootstrap) [jQuery](https://github.com/jquery/jquery) [js.cookie](https://github.com/js-cookie/js-cookie) [Chart.js](https://github.com/chartjs/Chart.js) [Ace](https://github.com/ajaxorg/ace) [jquery-pjax](https://github.com/defunkt/jquery-pjax) --- 感谢他们建议反馈以及精神支持,使得 Tbo 更加强大(<del>更多 bug</del>) [Momiji.Jin](https://github.com/MoeLoli) [Guoguo](https://github.com/imguoguo) [myluoluo](https://github.com/myluoluo)
{ "pile_set_name": "Github" }
/* Copyright 2008-2011 Gephi Authors : Mathieu Bastian <[email protected]>, Sébastien Heymann <[email protected]> Website : http://www.gephi.org This file is part of Gephi. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. Copyright 2011 Gephi Consortium. All rights reserved. The contents of this file are subject to the terms of either the GNU General Public License Version 3 only ("GPL") or the Common Development and Distribution License("CDDL") (collectively, the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the License at http://gephi.org/about/legal/license-notice/ or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the specific language governing permissions and limitations under the License. When distributing the software, include this License Header Notice in each file and include the License files at /cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the License Header, with the fields enclosed by brackets [] replaced by your own identifying information: "Portions Copyrighted [year] [name of copyright owner]" If you wish your version of this file to be governed by only the CDDL or only the GPL Version 3, indicate your decision by adding "[Contributor] elects to include this software in this distribution under the [CDDL or GPL Version 3] license." If you do not indicate a single choice of license, a recipient has the option to distribute your version of this file under either the CDDL, the GPL Version 3 or to extend the choice of license to its licensees as provided above. However, if you add GPL Version 3 code and therefore, elected the GPL Version 3 license, then the option applies only if the new code is made subject to such option by the copyright holder. Contributor(s): Portions Copyrighted 2011 Gephi Consortium. */ package org.gephi.desktop.filters.query; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.Action; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.tree.TreeSelectionModel; import org.gephi.desktop.filters.FilterUIModel; import org.gephi.filters.api.FilterController; import org.gephi.filters.api.FilterModel; import org.gephi.filters.api.Query; import org.openide.explorer.ExplorerManager; import org.openide.explorer.view.BeanTreeView; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; import org.openide.nodes.Node; import org.openide.util.Lookup; /** * * @author Mathieu Bastian */ public class QueryExplorer extends BeanTreeView implements PropertyChangeListener, ChangeListener { private ExplorerManager manager; private FilterModel model; private FilterUIModel uiModel; private FilterController filterController; //state private boolean listenSelectedNodes = false; public QueryExplorer() { setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); } public void unsetup() { if (model != null) { model.removeChangeListener(this); model = null; } } public void setup(final ExplorerManager manager, final FilterModel model, FilterUIModel uiModel) { this.manager = manager; this.model = model; this.uiModel = uiModel; this.filterController = Lookup.getDefault().lookup(FilterController.class); if (model != null) { model.addChangeListener(this); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { manager.setRootContext(new RootNode(new QueryChildren(model.getQueries()))); } }); } else { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { manager.setRootContext(new AbstractNode(Children.LEAF) { @Override public Action[] getActions(boolean context) { return new Action[0]; } }); } }); } updateEnabled(model != null); if (!listenSelectedNodes) { manager.addPropertyChangeListener(this); listenSelectedNodes = true; } } @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) { if (uiModel == null) { return; } Node[] nodeArray = (Node[]) evt.getNewValue(); if (nodeArray.length > 0) { Node node = ((Node[]) evt.getNewValue())[0]; if (node instanceof RootNode) { uiModel.setSelectedQuery(null); filterController.setCurrentQuery(null); return; } while (!(node instanceof QueryNode)) { node = node.getParentNode(); if (node.getParentNode() == null) { uiModel.setSelectedQuery(null); filterController.setCurrentQuery(null); return; } } QueryNode queryNode = (QueryNode) node; final Query query = queryNode.getQuery(); new Thread(new Runnable() { @Override public void run() { uiModel.setSelectedQuery(query); model.removeChangeListener(QueryExplorer.this); filterController.setCurrentQuery(uiModel.getSelectedRoot()); model.addChangeListener(QueryExplorer.this); } }).start(); } } } @Override public void stateChanged(ChangeEvent e) { //System.out.println("model updated"); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { //uiModel.setSelectedQuery(model.getCurrentQuery()); saveExpandStatus(QueryExplorer.this.manager.getRootContext()); QueryExplorer.this.manager.setRootContext(new RootNode(new QueryChildren(QueryExplorer.this.model.getQueries()))); loadExpandStatus(QueryExplorer.this.manager.getRootContext()); } }); } private void updateEnabled(final boolean enabled) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { setRootVisible(enabled); setEnabled(enabled); } }); } private void loadExpandStatus(Node node) { if (node instanceof RootNode) { RootNode rootNode = (RootNode) node; for (Node n : rootNode.getChildren().getNodes()) { loadExpandStatus(n); } } else if (node instanceof QueryNode) { QueryNode queryNode = (QueryNode) node; if (uiModel.isExpanded(queryNode.getQuery())) { expandNode(queryNode); } Node firstChild = queryNode.getChildren().getNodeAt(0); if (firstChild != null && firstChild instanceof ParameterNode) { if (uiModel.isParametersExpanded(queryNode.getQuery())) { expandNode(firstChild); } } for (Node n : queryNode.getChildren().getNodes()) { loadExpandStatus(n); } } } private void saveExpandStatus(Node node) { if (node instanceof RootNode) { RootNode rootNode = (RootNode) node; for (Node n : rootNode.getChildren().getNodes()) { saveExpandStatus(n); } } else if (node instanceof QueryNode) { QueryNode queryNode = (QueryNode) node; Node firstChild = queryNode.getChildren().getNodeAt(0); boolean parameterExpanded = false; if (firstChild != null && firstChild instanceof ParameterNode) { parameterExpanded = isExpanded(firstChild); } uiModel.setExpand(queryNode.getQuery(), isExpanded(queryNode), parameterExpanded); for (Node n : queryNode.getChildren().getNodes()) { saveExpandStatus(n); } } } }
{ "pile_set_name": "Github" }
#include "v3p_f2c.h" #ifdef __cplusplus extern "C" { #endif #ifdef KR_headers shortint h_dim(a,b) shortint *a, *b; #else shortint h_dim(shortint *a, shortint *b) #endif { return( *a > *b ? *a - *b : 0); } #ifdef __cplusplus } #endif
{ "pile_set_name": "Github" }
(ns hugsql.expr-run "HugSQL auto-defines expressions in this namespace") (def ^:dynamic exprs (atom {}))
{ "pile_set_name": "Github" }
#!/bin/bash # # Add new Apache site. # # Not a script but a manual. exit 0 # Domain and DNS checks # # See /monitoring/domain-expiry.sh # See /monitoring/dns-watch.sh read -r -e -p "User name: " U read -r -e -p "Domain name without WWW: " DOMAIN adduser --disabled-password --gecos "" "$U" # Add webserver to this group adduser _web "$U" # Add system mail alias to deliver bounces to one address # E.g. VIRTUAL-USERGROUP could be one client # USER@HOSTNAME: VIRTUAL-USERGROUP@HOSTNAME # wordpress@HOSTNAME: VIRTUAL-USERGROUP@HOSTNAME # Set forwarding address on the smarthost # echo "[email protected]" >.courier-VIRTUAL-USERGROUP echo "${U}@$(hostname -f): webmaster@$(hostname -d)" >>/etc/courier/aliases/system-user makealiases # * Install SSH key S="$(getent passwd "$U"|cut -d: -f6)/.ssh";mkdir --mode 0700 "$S";touch "${S}/authorized_keys";chown -R "${U}:${U}" "$S" editor "${S}/authorized_keys" # * Git URL echo "ssh://${U}@${DOMAIN}:SSH-PORT/home/${U}/dev.git" # Website directories mkdir -v --mode=0750 "/home/${U}/website" #mkdir -v /home/${U}/website/{session,tmp,code,pagespeed,backup,fastcgicache} mkdir -v "/home/${U}/website/"{session,tmp,code,pagespeed,backup} chmod 0555 "/home/${U}/website/code" # Add hosting.yml cp -v /usr/local/src/debian-server-tools/webserver/hosting.yml "/home/${U}/website/" # Install WordPress # shellcheck disable=SC2164 cd "/home/${U}/website/code/" # Migrate files NOW! # # See /webserver/WordPress.md # # * HTML-ize WordPress # https://gist.github.com/szepeviktor/4535c5f20572b77f1f52 # Find non-standard permissions, line ends #grep -r -I -l $'\r'; grep -r -I -m 1 $'\r' | sed -e 's/\r/■/g' find . -type f -not -perm 644; find . -type d -not -perm 755 # Repair permissions, line ends #find . -type f "(" -name ".htaccess" -o -name "*.php" -o -name "*.js" -o -name "*.css" ")" -exec dos2unix --keepdate "{}" ";" find . -type f -exec chmod --changes 0644 "{}" ";" find . -mindepth 1 -type d -exec chmod --changes 0755 "{}" ";" # Sensitive files find . -name wp-config.php -exec chmod --verbose 0400 "{}" ";" #find . -path "*/sites/*/settings.php" -exec chmod --verbose 0400 "{}" ";" #find . -name .env -exec chmod --verbose 0400 "{}" ";" find . -name .htaccess -exec chmod --verbose 0640 "{}" ";" # Non-ASCII and non-Hungarian file names find . -regextype posix-basic -regex '.*[^áÁéÉíÍóÓöÖőŐúÚüÜűŰ ./0-9@A-Z_a-z-].*' # Set owner chown -c -R "${U}:${U}" "/home/${U}/" # wp-config.php skeleton # WAF for WordPress # Migrate database NOW! # # Create WordPress database from wp-config # See /mysql/wp-createdb.sh # /usr/local/src/debian-server-tools/mysql/wp-createdb.sh # See /mysql/alter-table.sql # Check core files u wp core verify-checksums # Add your WP user u wp user create viktor [email protected] --role=administrator --display_name=v --user_pass=PASSWORD # wp-cli configuration # path, url, debug, user, skip-plugins editor wp-cli.yml # Clean up old data u wp transient delete-all #u wp w3-total-cache flush u wp search-replace --precise --recurse-objects --all-tables-with-prefix --dry-run /oldhome/path /home/path # * Mount wp-content/cache on tmpfs # editor /etc/fstab # tmpfs /home/${U}/website/code/static/cache tmpfs user,noauto,rw,relatime,uid=$(id -u $U),gid=$(id -g $U),mode=0755 0 0 wp-lib.sh --root="/home/${U}/website/code/static/cache/" mount 100 # * Default image printf "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJ TUUH4gMUEQE5VHnaPwAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAnSURBVCjP Y0xLS2PABoyNjbGKMzGQCEY1EANYcIX32bNnR0OJfhoA+8EE7eneRVUAAAAASUVORK5CYII=" | base64 -d >checkered-16x16.png # PHP pool # shellcheck disable=SC2164 #cd /etc/php5/fpm/pool.d/ # shellcheck disable=SC2164 cd /etc/php/7.2/fpm/pool.d/ sed "s/@@USER@@/${U}/g" <../Skeleton-pool.conf >"${U}.conf" editor "${U}.conf" # SSL certificate # See /security/LetsEncrypt.md read -r -e -p "Common Name: " -i "$DOMAIN" CN editor "/etc/ssl/localcerts/${CN}-public.pem" nice openssl dhparam 2048 >>"/etc/ssl/localcerts/${CN}-public.pem" editor "/etc/ssl/private/${CN}-private.key" # Apache vhost # CloudFlase, Incapsula, StackPath #a2enmod remoteip # shellcheck disable=SC2164 cd /etc/apache2/sites-available/ # SSL # "001-${DOMAIN}.conf" non-SNI site # See /webserver/Apache-SSL.md sed -e "s/@@SITE_DOMAIN@@/${DOMAIN}/g" -e "s/@@SITE_USER@@/${U}/g" <Skeleton-site-ssl.conf >"${DOMAIN}.conf" # OCSP server monitoring ( cd /usr/local/src/debian-server-tools/ && ./install.sh monitoring/ocsp-check.sh editor "/usr/local/bin/ocsp--${DOMAIN}" chmod +x "/usr/local/bin/ocsp--${DOMAIN}" printf '05,35 * * * * nobody\t/usr/local/bin/ocsp--%s\n' "$DOMAIN" >"/etc/cron.d/ocsp-${DOMAIN//./-}" ) # Certificate's common name differs from domain name #sed -e "s/@@CN@@/${CN}/g" -e "s/@@SITE_USER@@/${U}/g" <Skeleton-site-ssl.conf >"${DOMAIN}.conf" # * HPKP (HTTP Public Key Pinning) including backup public key # Headers: Public-Key-Pins-Report-Only Public-Key-Pins # See https://developer.mozilla.org/en-US/docs/Web/Security/Public_Key_Pinning # See https://developers.google.com/web/updates/2015/09/HPKP-reporting-with-chrome-46 openssl x509 -in "/etc/ssl/localcerts/${CN}-public.pem" -noout -pubkey \ | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64 -A # * SRI (Subresource Integrity) for foreign CDN content # <link rel="stylesheet" href="URL" integrity="sha384-HASHBASE64" crossorigin="anonymous"> # See https://www.srihash.org/ openssl dgst -sha384 -binary | openssl enc -base64 -A # CAA DNS record to pin certificate authorities # See https://sslmate.com/labs/caa/ # In case of "www." set ServerAlias # Set WORDPRESS_ROOT_URL and WORDPRESS_UPLOADS_URL editor "${DOMAIN}.conf" # Enable site a2ensite "$DOMAIN" apache-resolve-hostnames.sh # Reload webserver and PHP # See /webserver/webrestart.sh webreload.sh # Fail2ban fail2ban-client set apache-combined addlogpath "/var/log/apache2/${U}-ssl-error.log" fail2ban-client set apache-instant addlogpath "/var/log/apache2/${U}-ssl-error.log" # * Non-SSL fail2ban-client set apache-combined addlogpath "/var/log/apache2/${U}-error.log" fail2ban-client set apache-instant addlogpath "/var/log/apache2/${U}-error.log" # Cron jobs # Mute cron errors # # php -r 'var_dump(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED ^ E_STRICT);' -> int(22517) # https://maximivanov.github.io/php-error-reporting-calculator/ # /usr/bin/php7.2 -d error_reporting=22517 -d disable_functions=error_reporting -f /path/to/cron.php # Cron log # cron-job-command | ts "\%d \%b \%Y \%T \%z" >>/path/to/cron.log # shellcheck disable=SC2164 cd /etc/cron.d/ # /usr/local/bin/wp --quiet --path=/home/USER/website/code/project cron event run --due-now # See /webserver/wp-install/wp-cron-cli.sh # See /webserver/preload-cache.sh # * Contact form notification email # Authenticated send to foreign mailboxes editor /etc/courier/esmtproutes # example.com:mail.hosting.tld,587 /SECURITY=REQUIRED # #example.com:mail.hosting.tld,465 /SECURITY=SMTPS editor /etc/courier/esmtpauthclient # mail.hosting.tld,587 username password # #mail.hosting.tld,465 username password # * Monit # See /monitoring/monit/services/.website # Git status check # See /monitoring/tripwire-fake.sh # Goaccess # See /monitoring/goaccess.sh # Document in hosting.yml # See /webserver/hosting.yml # * Install a Honey Pot # https://www.projecthoneypot.org/faq.php#c # * Development/Staging environment? # domain name, SMTP, robots.txt # Webmaster tools echo "https://www.google.com/webmasters/tools/dashboard?siteUrl=https://${DOMAIN}/" echo "https://www.bing.com/webmaster/home/addsite?from=mysites&addurl=https://${DOMAIN}/" echo "https://webmaster.yandex.com/site/https:${DOMAIN}:443/access/"
{ "pile_set_name": "Github" }
/* * Copyright (c) 2012 Stephen A. Pratt * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ using UnityEngine; using UnityEditor; using org.critterai.u3d.editor; using System; using org.critterai.nav.u3d.editor; namespace org.critterai.nmbuild.u3d.editor { internal sealed class InputCompileControl : BuildControl { private const string Category = "Input Compile"; private const float MarginSize = ControlUtil.MarginSize; private MiniInputCompile mCompiler; public override void Exit() { if (Context != null) { if (mCompiler != null && !mCompiler.IsFinished) Debug.LogError("Input compile aborted. (Forced exit.)"); } mCompiler = null; base.Exit(); } public override void Update() { if (Context == null || mCompiler == null) // Either an error, or nothing to do. return; NavmeshBuild build = Context.Build; if (!build) return; if (Context.Build.BuildState == NavmeshBuildState.Invalid && mCompiler != null) { Logger.PostError("Build has become invalid. Discarded input compile.", Context.Build); mCompiler = null; return; } if (!mCompiler.IsFinished) { mCompiler.Update(); return; } if (!mCompiler.HasData) { Logger.PostError("Input data compile failed.", null); mCompiler = null; } else if (build.HasInputData) { // Note: Don't apply the changes if it will cause // a state transition. It creates GUI control issues. ApplyData(); } } public bool HasInputData { get { return (mCompiler != null && mCompiler.HasData); } } protected override void OnGUIMain() { NavmeshBuild build = Context.Build; if (!build) return; Rect statusArea = Context.MainArea; if (build.BuildState == NavmeshBuildState.Invalid) return; InputBuildInfo info; InputGeometry geometry = null; ConnectionSet connections = null; int triCount = 0; int processorCount = 0; ViewOption viewFlags = 0; bool hasData = false; string topLabel; if (mCompiler != null) { if (mCompiler.IsFinished) { if (mCompiler.HasData) topLabel = "Input successfully compiled. (Needs to be accepted.)"; else topLabel = "No input data produced."; } else topLabel = "Compiling"; info = mCompiler.Info; geometry = mCompiler.Geometry; connections = mCompiler.Connections; triCount = mCompiler.TriCount; processorCount = (mCompiler.Processors == null ? 0 : mCompiler.Processors.Length); if (geometry != null) hasData = true; } else if (build.HasInputData) { topLabel = "Current Input"; viewFlags = (ViewOption.Input | ViewOption.Grid); info = build.InputInfo; geometry = build.InputGeom; connections = build.Connections; triCount = geometry.TriCount; processorCount = build.NMGenProcessors.Count; hasData = true; } else { topLabel = "Input needs to be compiled."; info = new InputBuildInfo(); } DebugContext.SetViews(viewFlags); if (!hasData && triCount > 0) { GUI.Box(Context.MainArea , string.Format("{0} {1:N0} triangles", topLabel, triCount) , EditorUtil.HelpStyle); OnGUICompiler(statusArea); return; } GUILayout.BeginArea(statusArea, GUI.skin.box); string currScene = System.IO.Path.GetFileName(EditorApplication.currentScene); int idx = currScene.LastIndexOf("."); if (idx >= 0) currScene = currScene.Substring(0, idx); if (currScene.Length == 0) currScene = "None"; GUILayout.BeginHorizontal(); GUILayout.Label("Input scene:"); GUILayout.Label(" Current: " + currScene); GUILayout.Label(" Last: " + NavEditorUtil.SceneDisplayName(build.BuildTarget.BuildInfo)); GUILayout.EndHorizontal(); if (NavEditorUtil.SceneMismatch(build.BuildTarget.BuildInfo)) { GUILayout.Box("Current scene does not match last input scene." , EditorUtil.WarningStyle); } GUILayout.Space(MarginSize); GUILayout.Label(topLabel); if (hasData) { GUILayout.Space(ControlUtil.MarginSize * 3); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label("Geometry"); GUILayout.Space(ControlUtil.MarginSize); GUILayout.Label(string.Format("Triangles: {0:N0}", triCount)); GUILayout.Space(ControlUtil.MarginSize); GUILayout.Label("Min Bounds: " + Vector3Util.ToString(geometry.BoundsMin)); GUILayout.Label("Max Bounds: " + Vector3Util.ToString(geometry.BoundsMax)); GUILayout.Space(ControlUtil.MarginSize); Vector3 diff = geometry.BoundsMax - geometry.BoundsMin; GUILayout.Label(string.Format("WxHxD: {0:f3} x {1:f3} x {2:f3}" , diff.x, diff.y, diff.z)); GUILayout.Space(ControlUtil.MarginSize * 2); // Note: The build press interprets zero root objects as a global search. GUILayout.Space(ControlUtil.MarginSize); GUILayout.Label("Components"); GUILayout.Space(ControlUtil.MarginSize); GUILayout.Label("Pre-filter: " + info.compCountPre); GUILayout.Label("Post-filter: " + info.compCountPost); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label("Modifiers"); GUILayout.Space(ControlUtil.MarginSize); GUILayout.Label("Component loaders: " + info.loaderCount); GUILayout.Label("Component filters: " + info.filterCount); GUILayout.Label("Area assignment: " + info.areaModifierCount); GUILayout.Label("Component compilers: " + info.compilerCount); GUILayout.Label("Input post-processors: " + info.postCount); GUILayout.Label("NMGen processors: " + processorCount); GUILayout.Label("Off-Mesh connections: " + connections.Count); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } GUILayout.EndArea(); OnGUICompiler(statusArea); } private void OnGUICompiler(Rect statusArea) { if (!(mCompiler == null || mCompiler.IsFinished)) { // Assuming that the draw area is at least 25 in height. Rect area = new Rect(statusArea.x, statusArea.yMax - 25 , statusArea.width, 25); mCompiler.OnGUI(area); } } private void ApplyData() { NavmeshBuild build = Context.Build; // Caller checks for null. if (!build.SetInputData(Logger, mCompiler.Geometry , mCompiler.Info, mCompiler.Processors, mCompiler.Connections , true)) { Logger.PostError("Could not apply input data.", build); return; // Let the compiler persist so user can review it. } mCompiler = null; } protected override void OnGUIButtons() { NavmeshBuild build = Context.Build; if (!build) return; if (build.BuildState == NavmeshBuildState.Invalid) { GUI.Box(Context.ButtonArea, ""); return; } bool hasLocalData = (mCompiler != null && mCompiler.HasData); bool dataExists = (build.HasInputData || hasLocalData); bool isCompiling = !(mCompiler == null || mCompiler.IsFinished); bool guiEnabled = GUI.enabled; GUI.enabled = !isCompiling; ControlUtil.BeginButtonArea(Context.ButtonArea); float origFVal = build.Config.WalkableSlope; GUILayout.Label(NMGenConfig.SlopeLabel); build.Config.WalkableSlope = EditorGUILayout.FloatField(build.Config.WalkableSlope); if (origFVal != build.Config.WalkableSlope) build.IsDirty = true; GUILayout.Space(MarginSize); string compileButtonText; GUIStyle style = (GUI.enabled && !dataExists) ? ControlUtil.HighlightedButton : GUI.skin.button; if (dataExists) compileButtonText = "Recompile"; else compileButtonText = "Compile"; if (GUILayout.Button(compileButtonText, style)) { GC.Collect(); Logger.ResetLog(); mCompiler = new MiniInputCompile(Context); if (mCompiler.IsFinished) mCompiler = null; } if (hasLocalData) { GUILayout.Space(MarginSize); style = (GUI.enabled ? ControlUtil.HighlightedButton : GUI.skin.button); if (GUILayout.Button("Accept", style)) ApplyData(); } GUI.enabled = guiEnabled; if (isCompiling) { GUILayout.Space(MarginSize); if (GUILayout.Button("Cancel Compile")) { mCompiler.Abort(); mCompiler = null; } } else { bool resetOK = (hasLocalData || build.HasInputData || build.HasBuildData); if (ControlUtil.OnGUIStandardButtons(Context, DebugContext, resetOK)) // Reset button clicked. mCompiler = null; } ControlUtil.EndButtonArea(); } } }
{ "pile_set_name": "Github" }
Amazon Kinesis Connector Library Copyright 2013-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
{ "pile_set_name": "Github" }
To build an installer: 1. Put libchewing/data/*.dat dictionary files in Dictionary subdir. 2. Put 64-bit ChewingTextService.dll in x64 subdir. 3. Put 32-bit ChewingTextService.dll in x86 subdir. 4. Put `32-bit` ChewingPreferences.exe in this dir. 5. Compile installer.nsi with NSIS.
{ "pile_set_name": "Github" }
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * @category Zend * @package Zend_Dojo * @subpackage View * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: DijitContainer.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Dojo_View_Helper_Dijit */ require_once 'Zend/Dojo/View/Helper/Dijit.php'; /** * Dijit layout container base class * * @uses Zend_Dojo_View_Helper_Dijit * @package Zend_Dojo * @subpackage View * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Dojo_View_Helper_DijitContainer extends Zend_Dojo_View_Helper_Dijit { /** * Capture locks * @var array */ protected $_captureLock = array(); /** * Metadata information to use with captured content * @var array */ protected $_captureInfo = array(); /** * Begin capturing content for layout container * * @param string $id * @param array $params * @param array $attribs * @return void */ public function captureStart($id, array $params = array(), array $attribs = array()) { if (array_key_exists($id, $this->_captureLock)) { require_once 'Zend/Dojo/View/Exception.php'; throw new Zend_Dojo_View_Exception(sprintf('Lock already exists for id "%s"', $id)); } $this->_captureLock[$id] = true; $this->_captureInfo[$id] = array( 'params' => $params, 'attribs' => $attribs, ); ob_start(); return; } /** * Finish capturing content for layout container * * @param string $id * @return string */ public function captureEnd($id) { if (!array_key_exists($id, $this->_captureLock)) { require_once 'Zend/Dojo/View/Exception.php'; throw new Zend_Dojo_View_Exception(sprintf('No capture lock exists for id "%s"; nothing to capture', $id)); } $content = ob_get_clean(); extract($this->_captureInfo[$id]); unset($this->_captureLock[$id], $this->_captureInfo[$id]); return $this->_createLayoutContainer($id, $content, $params, $attribs); } }
{ "pile_set_name": "Github" }
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; namespace Revenj.DomainPatterns { internal class DataContext : IDataContext { private readonly IServiceProvider Locator; private GlobalEventStore GlobalEventStore; private ConcurrentDictionary<Type, object> SingleLookups; private ConcurrentDictionary<Type, object> ManyLookups; private ConcurrentDictionary<Type, object> QuerySources; private ConcurrentDictionary<Type, object> SearchSources; private ConcurrentDictionary<Type, object> Repositories; private ConcurrentDictionary<Type, object> EventStores; private ConcurrentDictionary<Type, object> Histories; private IDataChangeNotification Changes; public DataContext(IServiceProvider locator) { this.Locator = locator; } private Func<string, T> GetSingleLookup<T>() { object lookup; if (SingleLookups == null) SingleLookups = new ConcurrentDictionary<Type, object>(1, 7); if (!SingleLookups.TryGetValue(typeof(T), out lookup)) { lookup = Locator.Resolve<Func<string, T>>(); SingleLookups.TryAdd(typeof(T), lookup); } return (Func<string, T>)lookup; } public T Find<T>(string uri) where T : IIdentifiable { var lookup = GetSingleLookup<T>(); return lookup(uri); } private Func<IEnumerable<string>, T[]> GetManyLookup<T>() { object lookup; if (ManyLookups == null) ManyLookups = new ConcurrentDictionary<Type, object>(1, 7); if (!ManyLookups.TryGetValue(typeof(T), out lookup)) { lookup = Locator.Resolve<Func<IEnumerable<string>, T[]>>(); ManyLookups.TryAdd(typeof(T), lookup); } return (Func<IEnumerable<string>, T[]>)lookup; } public T[] Find<T>(IEnumerable<string> uris) where T : IIdentifiable { var lookup = GetManyLookup<T>(); return lookup(uris); } private IQueryable<T> GetQuerySource<T>() { object queryable; if (QuerySources == null) QuerySources = new ConcurrentDictionary<Type, object>(1, 7); if (!QuerySources.TryGetValue(typeof(T), out queryable)) { queryable = Locator.Resolve<IQueryable<T>>(); QuerySources.TryAdd(typeof(T), queryable); } return (IQueryable<T>)queryable; } private IQueryableRepository<T> GetQueryRepository<T>() where T : IDataSource { object searchable; if (SearchSources == null) SearchSources = new ConcurrentDictionary<Type, object>(1, 7); if (!SearchSources.TryGetValue(typeof(T), out searchable)) { searchable = Locator.Resolve<IQueryableRepository<T>>(); SearchSources.TryAdd(typeof(T), searchable); } return (IQueryableRepository<T>)searchable; } public IQueryable<T> Query<T>() where T : IDataSource { return GetQuerySource<T>(); } public T[] Search<T>(ISpecification<T> filter, int? limit, int? offset) where T : IDataSource { return GetQueryRepository<T>().Search(filter, limit, offset); } public long Count<T>(ISpecification<T> filter) where T : IDataSource { return GetQueryRepository<T>().Count(filter); } public bool Exists<T>(ISpecification<T> filter) where T : IDataSource { return GetQueryRepository<T>().Exists(filter); } private IPersistableRepository<T> GetRepository<T>() where T : IAggregateRoot { object repository; if (Repositories == null) Repositories = new ConcurrentDictionary<Type, object>(1, 7); if (!Repositories.TryGetValue(typeof(T), out repository)) { repository = Locator.Resolve<IPersistableRepository<T>>(); Repositories.TryAdd(typeof(T), repository); } return (IPersistableRepository<T>)repository; } public void Create<T>(IEnumerable<T> aggregates) where T : IAggregateRoot { var repository = GetRepository<T>(); repository.Persist(aggregates, null, null); } public void Update<T>(IEnumerable<KeyValuePair<T, T>> pairs) where T : IAggregateRoot { var repository = GetRepository<T>(); repository.Persist(null, pairs, null); } public void Delete<T>(IEnumerable<T> aggregates) where T : IAggregateRoot { var repository = GetRepository<T>(); repository.Persist(null, null, aggregates); } private IEventStore<T> GetStore<T>() where T : IEvent { object store; if (EventStores == null) EventStores = new ConcurrentDictionary<Type, object>(1, 7); if (!EventStores.TryGetValue(typeof(T), out store)) { store = Locator.Resolve<IEventStore<T>>(); EventStores.TryAdd(typeof(T), store); } return (IEventStore<T>)store; } public string[] Submit<T>(IEnumerable<T> events) where T : IEvent { var store = GetStore<T>(); return store.Submit(events); } public void Queue<T>(IEnumerable<T> events) where T : IEvent { if (GlobalEventStore == null) GlobalEventStore = Locator.Resolve<GlobalEventStore>(); foreach (var e in events) GlobalEventStore.Queue(e); } public T Populate<T>(IReport<T> report) { if (report != null) return report.Populate(Locator); return default(T); } public IObservable<NotifyInfo> Track<T>() where T : IIdentifiable { if (Changes == null) Changes = Locator.Resolve<IDataChangeNotification>(); var name = typeof(T).FullName; return Changes.Notifications.Where(ni => ni.Name == name); } private IRepository<IHistory<T>> GetHistory<T>() where T : IObjectHistory { object repository; if (Histories == null) Histories = new ConcurrentDictionary<Type, object>(1, 7); if (!Histories.TryGetValue(typeof(T), out repository)) { repository = Locator.Resolve<IRepository<IHistory<T>>>(); Histories.TryAdd(typeof(T), repository); } return (IRepository<IHistory<T>>)repository; } public IHistory<T>[] History<T>(IEnumerable<string> uris) where T : IObjectHistory { var repository = GetHistory<T>(); return repository.Find(uris); } public OlapCubeQueryBuilder<TSource> CubeBuilder<TCube, TSource>() where TCube : IOlapCubeQuery<TSource> where TSource : IDataSource { var query = Locator.Resolve<IOlapCubeQuery<TSource>>(typeof(TCube)); return new OlapCubeQueryBuilder<TSource>(query); } public TResult[] InvalidItems<TValidation, TResult>(ISpecification<TResult> specification) where TValidation : IValidation<TResult> where TResult : IIdentifiable { var validation = Locator.Resolve<IValidation<TResult>>(typeof(TValidation)); var queryable = GetQuerySource<TResult>(); return validation.FindInvalidItems(queryable).ToArray(); } } }
{ "pile_set_name": "Github" }
#!/usr/bin/env bash # Copyright 2006-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the # Amazon Software License (the "License"). You may not use this file except in compliance with the License. A copy of the # License is located at http://aws.amazon.com/asl or in the "license" file accompanying this file. This file is distributed on an "AS # IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. __ZIP_PREFIX__EC2_HOME="${EC2_HOME:?EC2_HOME is not set}" __RPM_PREFIX__EC2_HOME=/usr/local/aes/cmdline "${EC2_HOME}"/bin/ec2-cmd DescribeImageAttribute "$@"
{ "pile_set_name": "Github" }
------------------------------------------------------------------------------- -- permission role def ------------------------------------------------------------------------------- CREATE TABLE AUTH_PERM_ROLE_DEF( PERM_ID BIGINT NOT NULL, ROLE_DEF_ID BIGINT NOT NULL, CONSTRAINT PK_AUTH_PERM_ROLE_DEF PRIMARY KEY(PERM_ID,ROLE_DEF_ID), CONSTRAINT FK_AUTH_PERM_ROLE_DEF_PERM FOREIGN KEY(PERM_ID) REFERENCES AUTH_PERM(ID), CONSTRAINT FK_AUTH_PERM_ROLE_DEF_ROLE_DEF FOREIGN KEY(ROLE_DEF_ID) REFERENCES AUTH_ROLE_DEF(ID) ) ENGINE=INNODB CHARSET=UTF8;
{ "pile_set_name": "Github" }
// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s -o - | llvm-readobj -t | FileCheck %s "@feat.00" = 123 .globl @feat.00 // CHECK: Symbol { // CHECK: Name: @feat.00 // CHECK: Value: 123 // CHECK: Section: (65535) // CHECK: BaseType: Null (0x0) // CHECK: ComplexType: Null (0x0) // CHECK: StorageClass: External (0x2) // CHECK: AuxSymbolCount: 0 // CHECK: }
{ "pile_set_name": "Github" }
6 12 8 6 10 6 10 10 10 10 91 8 8 6 8 14 14 17 12 8 6 4 8 10 6 6 16 14 8 12 8 17 6 8 10 12 12 14 8 14 8 12 12 4 6 6 8 4 10 8 10 14 4 8 2 14 12 10 6 8 6 8 2 8 6 6 8 4 10 8 10 6 6 10 8 18 10 16 10 4 4 8 10 8 10 6 16 6 13 4 12 10 8 14 10 10 14 10 10 10 6 4 8 8 10 10 6 14 8 6 6 16 4 10 10 12 13 14 12 12 12 14 6 15 10 2 16 12 6 6 14 6 8 8 8 14 10 4 8 12 10 10 6 10 6 10 12 8 12 10 6 6 10 6 8 10 8 20 12 6 12 14 10 12 14 8 4 6 12 10 18 6 8 14 12 4 14 12 10 10 12 4 10 10 10 8 6 8 15 4 10 6 10 12 12 10 16 10 16 8 17 12 14 12 10 8 8 4 4 8 10 8 6 8 8 10 8 6 8 10 8 16 8 10 4 10 8 10 6 10 4 8 4 6 10 4 4 4 4 8 6 4 10 8 8 8 14 6 10 10 8 2 10 6 14 6 10 8 4 6 4 15 4 8 6 10 16 8 10 16 8 12 6 6 14 6 8 16 8 6 4 6 14 6 6 12 14 10
{ "pile_set_name": "Github" }
attackState = {} function attackState.enter() if not self.target or not targetValid(self.target) then return nil end return { timer = config.getParameter("attackApproachTime"), stage = "approach" } end function attackState.enteringState(stateData) -- sb.logInfo("Entering attack state") end function attackState.update(dt, stateData) if not self.target then return true end stateData.timer = stateData.timer - dt local toTarget = entity.distanceToEntity(self.target) if stateData.stage == "approach" then move(toTarget, true) if vec2.mag(toTarget) <= config.getParameter("attackStartDistance") then -- sb.logInfo("winding up...") stateData.stage = "windup" stateData.timer = config.getParameter("attackWindupTime") end elseif stateData.stage == "windup" then animator.setAnimationState("movement", "swimSlow") setBodyDirection(toTarget) if stateData.timer <= 0 then -- sb.logInfo("charging...") stateData.stage = "charge" animator.setAnimationState("attack", "melee") stateData.chargeDirection = toTarget stateData.timer = config.getParameter("attackChargeTime") end elseif stateData.stage == "charge" then if collides("blockedSensors") then return true end if animator.animationState("attack") == "melee" then monster.setDamageOnTouch(true) mcontroller.controlParameters({flySpeed = config.getParameter("attackChargeSpeed")}) move(stateData.chargeDirection, true, true) else monster.setDamageOnTouch(false) move(stateData.chargeDirection, false) end end return stateData.timer <= 0 end function attackState.leavingState(stateData) monster.setDamageOnTouch(false) end
{ "pile_set_name": "Github" }
/* This file is part of Darling. Copyright (C) 2019 Lubos Dolezel Darling 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. Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>. */ #import <AddressBook/ABActionAutovalidatorCacheSimpleEntry.h> @implementation ABActionAutovalidatorCacheSimpleEntry - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { return [NSMethodSignature signatureWithObjCTypes: "v@:"]; } - (void)forwardInvocation:(NSInvocation *)anInvocation { NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]); } @end
{ "pile_set_name": "Github" }
### # Copyright (C) 2014-2018 Taiga Agile LLC # # This program 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. # # 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # File: projects/create/jira-import/jira-import.controller.coffee ### class JiraImportController @.$inject = [ 'tgJiraImportService', '$tgConfirm', '$translate', 'tgImportProjectService', ] constructor: (@jiraImportService, @confirm, @translate, @importProjectService) -> @.step = 'autorization-jira' @.project = null taiga.defineImmutableProperty @, 'projects', () => return @jiraImportService.projects taiga.defineImmutableProperty @, 'members', () => return @jiraImportService.projectUsers startProjectSelector: () -> @.step = 'project-select-jira' @jiraImportService.fetchProjects() onSelectProject: (project) -> @.step = 'project-form-jira' @.project = project @.fetchingUsers = true @jiraImportService.fetchUsers(@.project.get('id')).then () => @.fetchingUsers = false onSaveProjectDetails: (project) -> @.project = project @.step = 'project-members-jira' onCancelMemberSelection: () -> @.step = 'project-form-jira' startImport: (users) -> loader = @confirm.loader(@translate.instant('PROJECT.IMPORT.IN_PROGRESS.TITLE'), @translate.instant('PROJECT.IMPORT.IN_PROGRESS.DESCRIPTION'), true) loader.start() projectType = @.project.get('project_type') if projectType == "issues" and @.project.get('create_subissues') projectType = "issues-with-subissues" promise = @jiraImportService.importProject( @.project.get('name'), @.project.get('description'), @.project.get('id'), users, @.project.get('keepExternalReference'), @.project.get('is_private'), projectType, @.project.get('importer_type'), ) @importProjectService.importPromise(promise).then () => loader.stop() submitUserSelection: (users) -> @.startImport(users) return null angular.module('taigaProjects').controller('JiraImportCtrl', JiraImportController)
{ "pile_set_name": "Github" }
# Lines starting with '#' and sections without content # are not displayed by a call to 'details' # [Website] http://www.85play.com/management-games/4764/family-restaurant.html [filters] http://s0.2mdn.net/instream/flash/v3/ads_sdk_config.xml http://googleads.g.doubleclick.net/pagead/ads?ad_type=text&adsafe=high&channel=TextOverlay%2BAfvVast2&client=ca-games-pub-1263150590374933&correlator=1343552208638&dt=1343552208647&flash=11.3.300.268&frm=0&num_ads=3&output=xml_vast2&ref=http%3A%2F%2Fforums.fanboy.co.nz%2Fforums%2Fviewtopic.php%3Ff%3D8%26t%3D14057&sdkv=3.0.21&sz=400x300&t_pyv=allow&u_ah=1040&u_asa=1&u_aw=1920&u_cd=24&u_h=1080&u_his=1&u_java=true&u_nmime=45&u_nplug=6&u_tz=720&u_w=1920&unviewed_position_start=1&url=http%3A%2F%2Fwww.85play.com%2Fmanagement-games%2F4764%2Ffamily-restaurant.html&video_product_type=4&video_url_to_fetch=test.com&videoad_start_delay=1 http://googleads.g.doubleclick.net/crossdomain.xml http://s0.2mdn.net/instream/flash/v3/adsapi_3.swf http://s0.2mdn.net/instream/flash/v3/adsapi_3_0_21.swf http://s0.2mdn.net/instream/flash/v3/afv_text_ads_manager_0_21.swf [other] # Any other details [comments] fanboy
{ "pile_set_name": "Github" }
/* * DateJS Culture String File * Country Code: es-MX * Name: Spanish (Mexico) * Format: "key" : "value" * Key is the en-US term, Value is the Key in the current language. */ Date.CultureStrings = Date.CultureStrings || {}; Date.CultureStrings["es-MX"] = { "name": "es-MX", "englishName": "Spanish (Mexico)", "nativeName": "Español (México)", "Sunday": "domingo", "Monday": "lunes", "Tuesday": "martes", "Wednesday": "miércoles", "Thursday": "jueves", "Friday": "viernes", "Saturday": "sábado", "Sun": "dom", "Mon": "lun", "Tue": "mar", "Wed": "mié", "Thu": "jue", "Fri": "vie", "Sat": "sáb", "Su": "do", "Mo": "lu", "Tu": "ma", "We": "mi", "Th": "ju", "Fr": "vi", "Sa": "sá", "S_Sun_Initial": "d", "M_Mon_Initial": "l", "T_Tue_Initial": "m", "W_Wed_Initial": "m", "T_Thu_Initial": "j", "F_Fri_Initial": "v", "S_Sat_Initial": "s", "January": "enero", "February": "febrero", "March": "marzo", "April": "abril", "May": "mayo", "June": "junio", "July": "julio", "August": "agosto", "September": "septiembre", "October": "octubre", "November": "noviembre", "December": "diciembre", "Jan_Abbr": "ene", "Feb_Abbr": "feb", "Mar_Abbr": "mar", "Apr_Abbr": "abr", "May_Abbr": "may", "Jun_Abbr": "jun", "Jul_Abbr": "jul", "Aug_Abbr": "ago", "Sep_Abbr": "sep", "Oct_Abbr": "oct", "Nov_Abbr": "nov", "Dec_Abbr": "dic", "AM": "a.m.", "PM": "p.m.", "firstDayOfWeek": 0, "twoDigitYearMax": 2029, "mdy": "dmy", "M/d/yyyy": "dd/MM/yyyy", "dddd, MMMM dd, yyyy": "dddd, dd' de 'MMMM' de 'yyyy", "h:mm tt": "hh:mm tt", "h:mm:ss tt": "hh:mm:ss tt", "dddd, MMMM dd, yyyy h:mm:ss tt": "dddd, dd' de 'MMMM' de 'yyyy hh:mm:ss tt", "yyyy-MM-ddTHH:mm:ss": "yyyy-MM-ddTHH:mm:ss", "yyyy-MM-dd HH:mm:ssZ": "yyyy-MM-dd HH:mm:ssZ", "ddd, dd MMM yyyy HH:mm:ss": "ddd, dd MMM yyyy HH:mm:ss", "MMMM dd": "dd MMMM", "MMMM, yyyy": "MMMM' de 'yyyy", "/jan(uary)?/": "ene(ro)?", "/feb(ruary)?/": "feb(rero)?", "/mar(ch)?/": "mar(zo)?", "/apr(il)?/": "abr(il)?", "/may/": "may(o)?", "/jun(e)?/": "jun(io)?", "/jul(y)?/": "jul(io)?", "/aug(ust)?/": "ago(sto)?", "/sep(t(ember)?)?/": "sep(tiembre)?", "/oct(ober)?/": "oct(ubre)?", "/nov(ember)?/": "nov(iembre)?", "/dec(ember)?/": "dic(iembre)?", "/^su(n(day)?)?/": "^do(m(ingo)?)?", "/^mo(n(day)?)?/": "^lu(n(es)?)?", "/^tu(e(s(day)?)?)?/": "^ma(r(tes)?)?", "/^we(d(nesday)?)?/": "^mi(é(rcoles)?)?", "/^th(u(r(s(day)?)?)?)?/": "^ju(e(ves)?)?", "/^fr(i(day)?)?/": "^vi(e(rnes)?)?", "/^sa(t(urday)?)?/": "^sá(b(ado)?)?", "/^next/": "^next", "/^last|past|prev(ious)?/": "^last|past|prev(ious)?", "/^(\\+|aft(er)?|from|hence)/": "^(\\+|aft(er)?|from|hence)", "/^(\\-|bef(ore)?|ago)/": "^(\\-|bef(ore)?|ago)", "/^yes(terday)?/": "^yes(terday)?", "/^t(od(ay)?)?/": "^t(od(ay)?)?", "/^tom(orrow)?/": "^tom(orrow)?", "/^n(ow)?/": "^n(ow)?", "/^ms|milli(second)?s?/": "^ms|milli(second)?s?", "/^sec(ond)?s?/": "^sec(ond)?s?", "/^mn|min(ute)?s?/": "^mn|min(ute)?s?", "/^h(our)?s?/": "^h(our)?s?", "/^w(eek)?s?/": "^w(eek)?s?", "/^m(onth)?s?/": "^m(onth)?s?", "/^d(ay)?s?/": "^d(ay)?s?", "/^y(ear)?s?/": "^y(ear)?s?", "/^(a|p)/": "^(a|p)", "/^(a\\.?m?\\.?|p\\.?m?\\.?)/": "^(a\\.?m?\\.?|p\\.?m?\\.?)", "/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)/": "^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)", "/^\\s*(st|nd|rd|th)/": "^\\s*(st|nd|rd|th)", "/^\\s*(\\:|a(?!u|p)|p)/": "^\\s*(\\:|a(?!u|p)|p)", "LINT": "LINT", "TOT": "TOT", "CHAST": "CHAST", "NZST": "NZST", "NFT": "NFT", "SBT": "SBT", "AEST": "AEST", "ACST": "ACST", "JST": "JST", "CWST": "CWST", "CT": "CT", "ICT": "ICT", "MMT": "MMT", "BIOT": "BST", "NPT": "NPT", "IST": "IST", "PKT": "PKT", "AFT": "AFT", "MSK": "MSK", "IRST": "IRST", "FET": "FET", "EET": "EET", "CET": "CET", "UTC": "UTC", "GMT": "GMT", "CVT": "CVT", "GST": "GST", "BRT": "BRT", "NST": "NST", "AST": "AST", "EST": "EST", "CST": "CST", "MST": "MST", "PST": "PST", "AKST": "AKST", "MIT": "MIT", "HST": "HST", "SST": "SST", "BIT": "BIT", "CHADT": "CHADT", "NZDT": "NZDT", "AEDT": "AEDT", "ACDT": "ACDT", "AZST": "AZST", "IRDT": "IRDT", "EEST": "EEST", "CEST": "CEST", "BST": "BST", "PMDT": "PMDT", "ADT": "ADT", "NDT": "NDT", "EDT": "EDT", "CDT": "CDT", "MDT": "MDT", "PDT": "PDT", "AKDT": "AKDT", "HADT": "HADT" }; Date.CultureStrings.lang = "es-MX";
{ "pile_set_name": "Github" }
| types.cs:19:30:19:37 | VoidType |
{ "pile_set_name": "Github" }
#if !LPLESS #define LINQPAD_STATEMENTS #define LPLESS_TEMPLATE_V2 #endif #if !LPLESS_TEMPLATE_V2 #error Incompatible template format. #endif #if LINQPAD_PROGRAM_STATIC #define STATIC #endif #if LINQPAD_PROGRAM_TASK || LINQPAD_STATEMENTS || LINQPAD_EXPRESSION #define TASK #endif #if LINQPAD_PROGRAM_VOID || LINQPAD_STATEMENTS || LINQPAD_EXPRESSION #define VOID #endif #if LINQPAD_PROGRAM_ARGS #define ARGS #endif // {% imports #if TASK using System.Threading.Tasks; #endif // %} // {% generator %} partial class UserQuery { public const string PATH = // {% path-string null // %} ; public const string SOURCE = // {% source-string null // %} ; } partial class UserQuery { partial void OnInit(); partial void OnStart(); partial void OnFinish(); static void RunLoadedStatements(System.Action action) => action(); static void DumpLoadedExpression(object value) => System.Console.WriteLine(value); static async System.Threading.Tasks.Task<int> Main(string[] args) { var query = new UserQuery(); void RunHook(params System.Func<UserQuery, System.Action>[] hooks) { foreach (var hook in hooks) hook(query)(); } query.OnInit(); RunHook( // {% hook-init %} ); RunHook( // {% hook-start %} ); query.OnStart(); #if !VOID var result = #endif #if TASK await #endif #if !STATIC query. #endif RunUserAuthoredQuery #if ARGS (args) #else () #endif ; RunHook( // {% hook-finish %} ); query.OnFinish(); #if VOID return #if TASK await System.Threading.Tasks.Task.FromResult(0); #else 0; #endif #else // !VOID return result; #endif } } #if LINQPAD_PROGRAM partial class UserQuery { // {% program #if STATIC && !TASK && VOID && !ARGS static void RunUserAuthoredQuery() => #elif STATIC && !TASK && !VOID && !ARGS static int RunUserAuthoredQuery() => #elif STATIC && !TASK && VOID && ARGS static void RunUserAuthoredQuery(string[] args) => #elif STATIC && !TASK && !VOID && ARGS static int RunUserAuthoredQuery(string[] args) => #elif STATIC && TASK && VOID && !ARGS static async Task RunUserAuthoredQuery() => #elif STATIC && TASK && !VOID && !ARGS static async Task<int> RunUserAuthoredQuery() => #elif STATIC && TASK && VOID && ARGS static async Task RunUserAuthoredQuery(string[] args) => #elif STATIC && TASK && !VOID && ARGS static async Task<int> RunUserAuthoredQuery(string[] args) => #elif !STATIC && !TASK && VOID && !ARGS void RunUserAuthoredQuery() => #elif !STATIC && !TASK && !VOID && !ARGS int RunUserAuthoredQuery() => #elif !STATIC && !TASK && VOID && ARGS void RunUserAuthoredQuery(string[] args) => #elif !STATIC && !TASK && !VOID && ARGS int RunUserAuthoredQuery(string[] args) => #elif !STATIC && TASK && VOID && !ARGS async Task RunUserAuthoredQuery() => #elif !STATIC && TASK && !VOID && !ARGS async Task<int> RunUserAuthoredQuery() => #elif !STATIC && TASK && VOID && ARGS async Task RunUserAuthoredQuery(string[] args) => #elif !STATIC && TASK && !VOID && ARGS async Task<int> RunUserAuthoredQuery(string[] args) => #endif throw new NotImplementedException(); // %} } // {% program-types %} // {% program-namespaces %} #elif LINQPAD_EXPRESSION partial class UserQuery { Action<object> QueryExpressionPrinter { get; set; } = System.Console.WriteLine; async System.Threading.Tasks.Task RunUserAuthoredQuery() { await System.Threading.Tasks.Task.FromResult(0); // {% expression-printer QueryExpressionPrinter // %} ( // {% expression %} ); } } #elif LINQPAD_STATEMENTS partial class UserQuery { async System.Threading.Tasks.Task RunUserAuthoredQuery() { await System.Threading.Tasks.Task.FromResult(0); // {% statements %} } } #else #error Unsupported typeof LINQPad query #endif
{ "pile_set_name": "Github" }