text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.12.05 at 10:55:37 PM EAT
//

package org.akomantoso.schema.v2;

import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.namespace.QName;

/**
 *
 *

 * <?xml version="1.0" encoding="UTF-8"?><type xmlns="http://www.akomantoso.org/2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">Complex</type>
 *

 *
 *

 * <?xml version="1.0" encoding="UTF-8"?><name xmlns="http://www.akomantoso.org/2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">markerreq</name>
 *

 *
 *

 * <?xml version="1.0" encoding="UTF-8"?><comment xmlns="http://www.akomantoso.org/2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">the complex type markerreq defines the content model and attributes shared by all marker elements. Here the id attribute is required</comment>
 *

 *
 *
 *
Java class for markerreq complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="markerreq">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <attGroup ref="{http://www.akomantoso.org/2.0}corereq"/>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "markerreq")
@XmlSeeAlso({
    Marker.class
})
public class Markerreq {

    @XmlAttribute(name = "class")
    protected String clazz;
    @XmlAttribute(name = "style")
    protected String style;
    @XmlAttribute(name = "title")
    protected String titleAttr;
    @XmlAttribute(name = "refersTo")
    @XmlSchemaType(name = "anyURI")
    protected String refersTo;
    @XmlAttribute(name = "lang", namespace = "http://www.w3.org/XML/1998/namespace")
    protected String lang;
    @XmlAttribute(name = "id", required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    @XmlID
    @XmlSchemaType(name = "ID")
    protected String id;
    @XmlAttribute(name = "evolvingId")
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    @XmlSchemaType(name = "NMTOKEN")
    protected String evolvingId;
    @XmlAttribute(name = "status")
    protected StatusType status;
    @XmlAttribute(name = "period")
    @XmlSchemaType(name = "anyURI")
    protected String period;
    @XmlAttribute(name = "alternativeTo")
    @XmlSchemaType(name = "anyURI")
    protected String alternativeTo;
    @XmlAnyAttribute
    private Map<QName, String> otherAttributes = new HashMap<QName, String>();

    /**
     * Gets the value of the clazz property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getClazz() {
        return clazz;
    }

    /**
     * Sets the value of the clazz property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setClazz(String value) {
        this.clazz = value;
    }

    /**
     * Gets the value of the style property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getStyle() {
        return style;
    }

    /**
     * Sets the value of the style property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setStyle(String value) {
        this.style = value;
    }

    /**
     * Gets the value of the titleAttr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTitleAttr() {
        return titleAttr;
    }

    /**
     * Sets the value of the titleAttr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTitleAttr(String value) {
        this.titleAttr = value;
    }

    /**
     * Gets the value of the refersTo property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getRefersTo() {
        return refersTo;
    }

    /**
     * Sets the value of the refersTo property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setRefersTo(String value) {
        this.refersTo = value;
    }

    /**
     * Gets the value of the lang property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getLang() {
        return lang;
    }

    /**
     * Sets the value of the lang property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setLang(String value) {
        this.lang = value;
    }

    /**
     * Gets the value of the id property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getId() {
        return id;
    }

    /**
     * Sets the value of the id property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setId(String value) {
        this.id = value;
    }

    /**
     * Gets the value of the evolvingId property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getEvolvingId() {
        return evolvingId;
    }

    /**
     * Sets the value of the evolvingId property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setEvolvingId(String value) {
        this.evolvingId = value;
    }

    /**
     * Gets the value of the status property.
     *
     * @return
     *     possible object is
     *     {@link StatusType }
     *
     */
    public StatusType getStatus() {
        return status;
    }

    /**
     * Sets the value of the status property.
     *
     * @param value
     *     allowed object is
     *     {@link StatusType }
     *
     */
    public void setStatus(StatusType value) {
        this.status = value;
    }

    /**
     * Gets the value of the period property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getPeriod() {
        return period;
    }

    /**
     * Sets the value of the period property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setPeriod(String value) {
        this.period = value;
    }

    /**
     * Gets the value of the alternativeTo property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getAlternativeTo() {
        return alternativeTo;
    }

    /**
     * Sets the value of the alternativeTo property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setAlternativeTo(String value) {
        this.alternativeTo = value;
    }

    /**
     * Gets a map that contains attributes that aren't bound to any typed property on this class.
     *
     *

     * the map is keyed by the name of the attribute and
     * the value is the string value of the attribute.
     *
     * the map returned by this method is live, and you can add new attribute
     * by updating the map directly. Because of this design, there's no setter.
     *
     *
     * @return
     *     always non-null
     */
    public Map<QName, String> getOtherAttributes() {
        return otherAttributes;
    }

}


text:
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

namespace Microsoft.Owin.Security.OAuth.Messages
{
    /// <summary>
    /// Data object used by TokenEndpointRequest when the "grant_type" is "password".
    /// </summary>
    public class TokenEndpointRequestResourceOwnerPasswordCredentials
    {
        /// <summary>
        /// The value passed to the Token endpoint in the "username" parameter
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// The value passed to the Token endpoint in the "password" parameter
        /// </summary>
        public string Password { get; set; }

        /// <summary>
        /// The value passed to the Token endpoint in the "scope" parameter
        /// </summary>
        [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "This is just a data class.")]
        public IList<string> Scope { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
@interface PodsDummy_XLPagerTabStrip : NSObject
@end
@implementation PodsDummy_XLPagerTabStrip
@end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Ticket IDs</title>

    <link href="/template/dist/css/bootstrap.min.css" rel="stylesheet">

    <link href="/template/dashboard/dashboard.css" rel="stylesheet">

    <link href="/vendor/c3/c3.min.css" rel="stylesheet" type="text/css">

          Ticket IDs

Tickets

Reports

Customers

IDs

Logout

ID List

          <form class="form-inline">
            <input type="text" class="form-control" id="search" placeholder="Type to search">
          </form>

                  Name
                  Current Id
                  Change

                  No name provided
                  No email provided

                    <form class="form-inline" method="POST" action="/api/counter/:id/rename">

                        <input type="text" class="form-control" name="newId" placeholder="New ID">

                          <input type="submit" class="btn btn-danger" value="Rename">

                    </form>


text:
import pandas, time, math

class Fusion:
    def merge_activities(self, main_activity, cardio_activity):
        complete_cardio = self._interpolate_cardio(main_activity, cardio_activity)

        # and merge it back into the main activity
        for trackpoint in main_activity.trackpoints:
            timestamp = self._date_to_timestamp(trackpoint.time)

            try:
                bpm = float(complete_cardio[timestamp])
                bpm = 0 if math.isnan(bpm) else int(bpm)
            except KeyError:
                bpm = 0

            trackpoint.heart_rate = bpm

    def _interpolate_cardio(self, main_activity, cardio_activity):
        # determine the workout bounds
        main_start = self._date_to_timestamp(main_activity.started_at)
        main_end = self._date_to_timestamp(main_activity.completed_at)

        # interpolate the cardio data
        cardio_map = {self._date_to_timestamp(t.time): t.heart_rate for t in cardio_activity.trackpoints}
        cardio_map_interpolated = pandas.Series(cardio_map, index=range(main_start, main_end + 1))
        cardio_map_interpolated = cardio_map_interpolated.interpolate()

        return cardio_map_interpolated.to_dict()

    def _date_to_timestamp(self, date):
        return int(time.mktime(date.timetuple()))


text:
{-# LANGUAGE Trustworthy #-}
module FP15.Types (
  module FP15.Xtn
, module FP15.Disp
, module FP15.Name
, module FP15.Value
, module FP15.Expr
, module FP15.Modules
, module FP15.Types
, Void
, Map
) where
import Data.Map.Strict(Map)
import qualified Data.List.NonEmpty as NE
import Data.Void(Void)
import FP15.Value
import FP15.Xtn
import FP15.Disp
import FP15.Name
import FP15.Expr
import FP15.Modules

-- * Type Synonyms
-- Short identifiers are needed because of 80-char line length limit.

-- | A strict set.
type Set e = Map e ()

-- | A non-empty list.
type NE a = NE.NonEmpty a

{-# ANN module "HLint: ignore Use import/export shortcut" #-}


text:
package org.fcrepo.client;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;

import java.util.Calendar;

import javax.swing.ImageIcon;
import javax.swing.JInternalFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/**
 * @author Bill Niebel
 */
public class BatchOutput
        extends JInternalFrame {

    private static final long serialVersionUID = 1L;

    JTextArea jTextArea = null;

    String directoryPath = null; //2003.12.03 niebel

    public BatchOutput(String title) {
        super(title, true, //resizable
              true, //TITLE_PROPERTY
              true, //maximizable
              true);//iconifiable
        setVisible(false);
        jTextArea = new JTextArea();
        jTextArea.setEditable(false);
        JScrollPane jScrollPane = new JScrollPane(jTextArea);
        getContentPane().add(jScrollPane);
        ImageIcon newIcon =
            new ImageIcon(ClassLoader.
                          getSystemResource("images/client/standard/general/New16.gif"));
        setFrameIcon(newIcon);
        setSize(400, 400);
    }

    public JTextArea getJTextArea() {
        return jTextArea;
    }

    //2003.12.03 niebel vvvvv -- duplicate output to file
    /**
     * extract parent directory from filepath of pidsfile, store it as directory
     * where processing progress report will be written. see also
     * BatchBuildGUI.java, BatchBuildIngestGUI.java, and BatchIngestGUI.java,
     * each of which calls setDirectoryPath()
     */
    public void setDirectoryPath(String pidsfilepath) {
        File pidsfile = new File(pidsfilepath);
        directoryPath = pidsfile.getParent();
    }

    /**
     * write processing progress report to directory stored by
     * setDirectoryPath(). contents is jTextArea.getText(); filename based on
     * current time. see also BatchThread.java, which calls flush2file().
     */
    public void flush2file() {
        StringBuffer filename = new StringBuffer();
        {
            Calendar now = Calendar.getInstance();
            filename.append(now.get(Calendar.YEAR));
            int month = now.get(Calendar.MONTH) + 1;
            filename.append((month < 10 ? "0" : "") + month);
            int day = now.get(Calendar.DAY_OF_MONTH);
            filename.append((day < 10 ? "0" : "") + day);
            int militaryHour = now.get(Calendar.HOUR_OF_DAY);
            filename
                    .append("-" + (militaryHour < 10 ? "0" : "") + militaryHour);
            int minute = now.get(Calendar.MINUTE);
            filename.append((minute < 10 ? "0" : "") + minute);
            int second = now.get(Calendar.SECOND);
            filename.append((second < 10 ? "0" : "") + second);
            int milliseconds = now.get(Calendar.MILLISECOND);
            filename
                    .append("-"
                            + (milliseconds < 10 ? "00"
                                    : milliseconds < 100 ? "0" : "")
                            + milliseconds);
            filename.append(".txt");
        }
        try {
            File file = new File(directoryPath, filename.toString());
            FileOutputStream fileOutputStream = new FileOutputStream(file);
            PrintStream userLog = new PrintStream(fileOutputStream);
            userLog.print(jTextArea.getText());
            userLog.close();
        } catch (FileNotFoundException e) {
            jTextArea.append("COULD NOT WRITE PROCESSING REPORT TO FILE!!!\n");
        }
    }
    //2003.12.03 niebel ^^^^^
}


text:
package com.vyserion.lodbot.plugins.leaderboards.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.UncategorizedSQLException;

import com.vyserion.lodbot.plugins.leaderboards.data.LeaderboardColumnDao;
import com.vyserion.lodbot.plugins.leaderboards.data.LeaderboardDao;
import com.vyserion.lodbot.plugins.leaderboards.domain.Leaderboard;
import com.vyserion.lodbot.plugins.leaderboards.domain.LeaderboardColumn;

public class LeaderboardController
{
    private static final Logger logger = LoggerFactory.getLogger(LeaderboardController.class);

    private LeaderboardController()
    {
    }

    /**
     * Gets the list of leaderboards
     *
     * @param dao
     *            The LeaderboardDao.
     * @return A list of leaderboards.
     */
    public static List<Leaderboard> getLeaderboards(LeaderboardDao dao)
    {
        return dao.getLeaderboards();
    }

    /**
     * Creates a new leaderboard.
     *
     * @param dao
     *            The LeaderboardDao.
     * @param columnDao
     *            The LeaderboardColumnDao.
     * @param name
     *            The name of the leaderboard.
     * @param columns
     *            The columns of the leaderboard.
     * @return An error or success code.
     */
    public static String createLeaderboard(LeaderboardDao dao, LeaderboardColumnDao columnDao, String name,
            String columnsStr)
    {
        List<LeaderboardColumn> columnsToAdd = new ArrayList<>();
        String[] columns = columnsStr.split(",");
        for (String column : columns)
        {
            columnsToAdd.add(new LeaderboardColumn(column));
        }

        try
        {
            Map<String, ?> params = dao.createLeaderboard(name);
            int leaderboardId = (int) params.get("leaderboardid");

            for (LeaderboardColumn column : columnsToAdd)
            {
                columnDao.createLeaderboardColumn(leaderboardId, column.getName(), column.getType().name());
            }

            return LeaderboardMessages.NO_ERROR;
        }
        catch (Exception e)
        {
            if (e instanceof UncategorizedSQLException)
            {
                return e.getCause().getMessage();
            }

            throw e;
        }
    }

    /**
     * Updates the name of a leaderboard.
     *
     * @param dao
     *            The LeaderboardDao.
     * @param oldName
     *            The current name of the leaderboard.
     * @param name
     *            The new name of the leaderboard.
     * @return An error or success code.
     */
    public static String updateLeaderboardName(LeaderboardDao dao, String oldName, String name)
    {
        Leaderboard leaderboard = dao.getLeaderboard(oldName);
        if (null == leaderboard)
        {
            return LeaderboardMessages.MISSING_LEADERBOARD_CODE;
        }
        int leaderboardId = leaderboard.getId();

        try
        {
            dao.updateLeaderboardName(leaderboardId, name);
            return LeaderboardMessages.NO_ERROR;
        }
        catch (Exception e)
        {
            if (e instanceof UncategorizedSQLException)
            {
                return e.getCause().getMessage();
            }

            throw e;
        }
    }

    public static String updateLeaderboardColumn(LeaderboardColumnDao columnDao, LeaderboardColumn oldColumn,
            LeaderboardColumn newColumn)
    {
        return "";
    }

    /**
     * Deletes a leaderboard.
     *
     * @param dao
     *            The LeaderboardDao.
     * @param name
     *            The name of the leaderboard.
     * @return An error or success code.
     */
    public static String deleteLeaderboard(LeaderboardDao dao, LeaderboardColumnDao columnDao, String name)
    {
        Leaderboard leaderboard = dao.getLeaderboard(name);
        if (null == leaderboard)
        {
            return LeaderboardMessages.MISSING_LEADERBOARD_CODE;
        }
        int leaderboardId = leaderboard.getId();

        try
        {
            columnDao.deleteLeaderboardColumns(leaderboardId);
            dao.deleteLeaderboard(leaderboardId);
            return LeaderboardMessages.NO_ERROR;
        }
        catch (Exception e)
        {
            if (e instanceof UncategorizedSQLException)
            {
                return e.getCause().getMessage();
            }

            throw e;
        }
    }

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>4. Py4J Python API — Py4J</title>
    <link rel="stylesheet" href="_static/py4jdoc.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="author" title="About these documents" href="about.html" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="Py4J" href="index.html" />
    <link rel="next" title="4.1. py4j.java_gateway — Py4J Main API" href="py4j_java_gateway.html" />
    <link rel="prev" title="3. Advanced Topics" href="advanced_topics.html" />

Py4J - A Bridge between Python and Java

Navigation

          index

          modules |

          next |

          previous |

Home |

Download |

Doc |

Blog |

github |

About »

Previous topic

3. Advanced Topics

Next topic

4.1. py4j.java_gateway — Py4J Main API

This Page

Show Source

Quick search

              <form class="search" action="search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>

              Enter search terms or a module, class or function name.

4. Py4J Python API¶

Using Py4J is usually as simple as creating a JavaGateway object:

java_gateway = JavaGateway()
# you are now connected to the JVM
# and you can call any method defined on the Java side.

You can still customize and extend Py4J in many ways (e.g., you can choose the
port to which you want to connect). The following modules are documented. Note
that users are expected to only use py4j.java_gateway or
py4j.clientserver.

4.1. py4j.java_gateway — Py4J Main API

4.1.1. JavaGateway

4.1.1.1. Examples

4.1.2. GatewayParameters

4.1.3. CallbackServerParameters

4.1.4. GatewayClient

4.1.5. GatewayConnection

4.1.6. JVMView

4.1.7. JavaObject

4.1.8. JavaMember

4.1.9. JavaClass

4.1.10. JavaPackage

4.1.11. PythonProxyPool

4.1.12. CallbackServer

4.1.13. CallbackConnection

4.1.14. Py4J Core Signals

4.1.15. Py4J Functions

4.2. py4j.clientserver — Py4J Single Threading Model Implementation

4.2.1. ClientServer

4.2.1.1. Examples

4.2.2. JavaParameters

4.2.3. PythonParameters

4.2.4. JavaClient

4.2.5. PythonServer

4.2.6. ClientServerConnection

4.3. py4j.protocol — Py4J Protocol

4.3.1. Py4JError

4.3.2. Py4JJavaError

4.3.3. Py4JNetworkError

4.3.4. Py4JAuthenticationError

4.3.5. Py4J Protocol Functions

4.4. py4j.java_collections — Py4J Collections API

4.4.1. JavaIterator

4.4.2. JavaList

4.4.3. JavaMap

4.4.4. JavaSet

4.4.5. JavaArray

4.5. py4j.finalizer — Py4J Finalizer API

4.5.1. ThreadSafeFinalizer

4.5.2. Finalizer

4.5.3. Py4J Finalizer Functions

4.6. py4j.signals — Py4J Signals API

4.6.1. Signal

Questions/Feedback?

Try the FAQ -- It answers many questions.

Search for information in the archives of the py4j-users mailing list, or post a question.

If you notice errors with this documentation, open a ticket and let us know. Please, only open a ticket for feedback or improvements on the docs. To get help, use the links above!

Request professional services to get a custom feature implemented quickly or to receive commercial support.

Navigation

          index

          modules |

          next |

          previous |

Home |

Download |

Doc |

Blog |

github |

About »

      © Copyright 2009-2015, Barthélémy Dagenais.
      Created using Sphinx 3.2.1.


text:
//Copyright (c) 2012-2015 Christian Schwarz
//
//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.

#pragma once
#ifndef PYCAST_COMMON_OPENCLPROVIDER_H
#define PYCAST_COMMON_OPENCLPROVIDER_H

#ifdef __APPLE__
	#include <OpenCL/cl.h>
#elif __unix
	#include <CL/cl.h>
#endif

#include <string.h>
#include <map>

namespace common {

	class OpenCLProvider {
		public:
			static cl_command_queue	get_command_queue();
			static cl_context		get_context();
			static cl_kernel		get_kernel_from_file(char* kernelfile, char* functionname);

		private:
			static bool				initialize();
			static char*			load_program_source(char* kernelfile);

			static cl_command_queue				clCommandQueue;
			static cl_context					clContext;
			static cl_device_id					clDevice;
			static std::map<char*, cl_kernel>	*kernelMap;
	};

}

#endif /* PYCAST_COMMON_OPENCLPROVIDER_H */


text:
/**
 * @file
 * @brief
 *
 * @author  Anton Kozlov
 * @date    18.02.2013
 */

#ifndef SECURITY_SECURITY_H_
#define SECURITY_SECURITY_H_

#include <stddef.h>
#include <sys/types.h>

struct node;

/**
 * @brief Checks permission to create node in @a dir with mode @a mode
 * @a dir is already checked for #S_IWOTH
 *
 * @param dir directory node where new node is creating
 * @param mode mode of creating node
 *
 * @return 0 on allowed
 * @return -EACCES in access denied
 */
extern int security_node_create(struct node *dir, mode_t mode);

/**
 * @brief Sets node credentials of current user
 *
 * @param node
 */
extern void security_node_cred_fill(struct node *node);

/**
 * @brief Checks permission on node delete. @a dir already checked for
 * #S_IWOTH
 *
 * @param dir directory node from where node is deletting
 * @param node node is deletting
 *
 * @return 0 on allowed
 * @return -EACCES in access denied
 */
extern int security_node_delete(struct node *dir, struct node *node);

/**
 * @brief Checks node for access.
 *
 * @param node node to check
 * @param flags access flags in MAY format
 *
 * @return 0 on allowed
 * @return -EACCES in access denied
 */
extern int security_node_permissions(struct node *node, int flags);

/**
 * @brief Checks for mount operation. @a dev is already checked for
 * #S_IROTH and #S_IXOTH
 *
 * @param dev device node which is mounted
 *
 * @return 0 on allowed
 * @return -EACCES in access denied
 */
extern int security_mount(struct node *dev, struct node *mountpoint);

/**
 * @brief Checks for umount operation.
 *
 * @param mountpoint root directory node
 *
 * @return 0 on allowed
 * @return -EACCES in access denied
 */
extern int security_umount(struct node *mountpoint);

/**
 * @brief Check for xattr get.
 *
 * @param node
 * @param name
 * @param value
 * @param len
 *
 * @return 0 on allowed
 * @return -EACCES on denied
 *
 */
extern int security_xattr_get(struct node *node, const char *name, char *value, size_t len);

/**
 * @brief Check for xattr set.
 *
 * @param node
 * @param name
 * @param value
 * @param len
 * @param flags
 *
 * @return 0 on allowed
 * @return -EACCES on denied
 *
 */
extern int security_xattr_set(struct node *node, const char *name,
			const char *value, size_t len, int flags);

/**
 * @brief Check for xattr set.
 *
 * @param node
 *
 * @return 0 on allowed
 * @return -EACCES on denied
 *
 */
extern int security_xattr_list(struct node *node, char *list, size_t len);

struct idesc;

extern int security_xattr_idesc_get(struct idesc *idesc, const char *name, char *value, size_t len);

extern int security_xattr_idesc_set(struct idesc *idesc, const char *name, const char *value, size_t len, int flags);

extern int security_xattr_idesc_list(struct idesc *idesc, char *list, size_t len);

struct sock;
extern int security_sock_create(struct sock *sock);
extern int security_sock_label(struct sock *sock, char *label, size_t len);

#endif /* SECURITY_SECURITY_H_ */


text:
{% for plugin in plugins %}
	{% include "cms/toolbar/draggable_item.html" with plugin=plugin %}
{% endfor %}


text:
package org.drools.lang.api;

import java.util.Collection;
import java.util.Collections;

import org.drools.Cheese;
import org.drools.CommonTestMethodBase;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.StockTick;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.definition.KnowledgePackage;
import org.drools.definition.type.FactType;
import org.drools.event.rule.AfterActivationFiredEvent;
import org.drools.event.rule.AgendaEventListener;
import org.drools.io.ResourceFactory;
import org.drools.lang.descr.AttributeDescr;
import org.drools.lang.descr.PackageDescr;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.WorkingMemoryEntryPoint;
import org.junit.Test;
import org.mockito.ArgumentCaptor;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

/**
 * DescrBuilderTest
 */
public class DescrBuilderTest extends CommonTestMethodBase {

    @Test
    public void testPackage() {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                .attribute( "dialect" ).value( "mvel" ).end()
                .getDescr();

        assertEquals( "org.drools",
                      pkg.getName() );
        assertEquals( "mvel",
                      pkg.getAttribute( "dialect" ).getValue() );
        assertNull( pkg.getAttribute( "salience" ) );

        KnowledgePackage kpkg = compilePkgDescr( pkg );

        assertEquals( "org.drools",
                      kpkg.getName() );
    }

    @Test
    public void testPackageAttributes() {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                // first syntax
                .attribute( "dialect" ).value( "mvel" ).end()
                // second syntax
                .attribute( "salience",
                            "10" )
                // third syntax
                .attribute( "lock-on-active",
                            "true",
                            AttributeDescr.Type.BOOLEAN )
                .getDescr();

        assertEquals( "org.drools",
                      pkg.getName() );
        assertEquals( 3,
                      pkg.getAttributes().size() );
        assertEquals( "mvel",
                      pkg.getAttribute( "dialect" ).getValue() );
        assertEquals( "10",
                      pkg.getAttribute( "salience" ).getValue() );
        assertEquals( "true",
                      pkg.getAttribute( "lock-on-active" ).getValue() );
        assertEquals( AttributeDescr.Type.BOOLEAN,
                      pkg.getAttribute( "lock-on-active" ).getType() );
        assertNull( pkg.getAttribute( "no-loop" ) );

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                      kpkg.getName() );
    }

    @Test
    public void testPackageImports() {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                .newImport().target( "java.util.List" ).end()
                .newImport().target( "org.drools.examples.*" ).end()
                .getDescr();

        assertEquals( 2,
                      pkg.getImports().size() );
        assertEquals( "java.util.List",
                      pkg.getImports().get( 0 ).getTarget() );
        assertEquals( "org.drools.examples.*",
                      pkg.getImports().get( 1 ).getTarget() );
    }

    @Test
    public void testGlobals() {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                .newGlobal().type( "java.util.List" ).identifier( "list" ).end()
                .newGlobal().type( "Person" ).identifier( "bob" ).end()
                .getDescr();

        assertEquals( 2,
                      pkg.getGlobals().size() );
        assertEquals( "java.util.List",
                      pkg.getGlobals().get( 0 ).getType() );
        assertEquals( "list",
                      pkg.getGlobals().get( 0 ).getIdentifier() );
        assertEquals( "Person",
                      pkg.getGlobals().get( 1 ).getType() );
        assertEquals( "bob",
                      pkg.getGlobals().get( 1 ).getIdentifier() );

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                      kpkg.getName() );
    }

    @Test
    public void testFunctions() {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                // functions
                .newFunctionImport().target( "java.lang.Math.max" ).end()
                .newFunction().returnType( "long" ).name( "myMax" )
                    .parameter( "long",
                                "v1" ).parameter( "long",
                                                  "v2" )
                    .body( "return max(v1, v2);" )
                .end()
                // rule
                .newRule().name( "test" )
                    .lhs()
                        .eval().constraint( "myMax(5, 10) == 10" ).end()
                    .end()
                    .rhs( "// do something" )
                .end()
                .getDescr();

        assertEquals( 1,
                      pkg.getFunctionImports().size() );
        assertEquals( 1,
                      pkg.getFunctions().size() );
        assertEquals( 1,
                      pkg.getRules().size() );

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                      kpkg.getName() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( Collections.singletonList( kpkg ) );
        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        int rules = ksession.fireAllRules();
        assertEquals( 1,
                      rules );
    }

    @Test
    public void testNamedConsequence() {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                .newRule().name( "test" )
                    .lhs()
                        .pattern("Cheese").constraint( "type == \"stilton\"" ).end()
                        .namedConsequence().name("c1").end()
                        .pattern("Cheese").constraint( "type == \"cheddar\"" ).end()
                    .end()
                    .rhs( "// do something" )
                    .namedRhs( "c1", "// do something else" )
                .end()
                .getDescr();

        assertEquals( 1,
                      pkg.getRules().size() );

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                kpkg.getName() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( Collections.singletonList( kpkg ) );
        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);

        Cheese stilton = new Cheese( "stilton", 5 );
        Cheese cheddar = new Cheese( "cheddar", 7 );
        Cheese brie = new Cheese( "brie", 5 );

        ksession.insert( stilton );
        ksession.insert( cheddar );
        ksession.insert( brie );

        int rules = ksession.fireAllRules();
        assertEquals( 2,
                      rules );
    }

    @Test
    public void testConditionalBranch() {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                .newRule().name( "test" )
                    .lhs()
                        .pattern("Cheese").constraint( "type == \"stilton\"" ).end()
                        .conditionalBranch()
                            .condition().constraint("price < 10").end()
                            .consequence().name("c1").end()
                        .end()
                        .pattern("Cheese").constraint( "type == \"cheddar\"" ).end()
                    .end()
                    .rhs( "// do something" )
                    .namedRhs( "c1", "// do something else" )
                .end()
                .getDescr();

        assertEquals( 1,
                      pkg.getRules().size() );

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                kpkg.getName() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( Collections.singletonList( kpkg ) );
        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);

        Cheese stilton = new Cheese( "stilton", 5 );
        Cheese cheddar = new Cheese( "cheddar", 7 );
        Cheese brie = new Cheese( "brie", 5 );

        ksession.insert( stilton );
        ksession.insert( cheddar );
        ksession.insert( brie );

        int rules = ksession.fireAllRules();
        assertEquals( 2,
                      rules );
    }

    @Test
    public void testDeclare() throws InstantiationException,
                             IllegalAccessException {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.beans" )
                // declare
                .newDeclare()
                    .type().name( "StockTick" )
                    .newAnnotation( "role" ).value( "event" ).end()
                    .newAnnotation( "author" ).value( "bob" ).end()
                    .newField( "symbol" ).type( "String" ).end()
                    .newField( "price" ).type( "double" ).end()
                .end()
                .newDeclare()
                    .enumerative().name( "Planets" )
                    .newAnnotation( "kind" ).value( "enum" ).end()
                    .newEnumLiteral( "earth" ).constructorArg( "6.0" ).constructorArg( "10.0" ).end()
                    .newEnumLiteral( "jupiter" ).constructorArg( "44.0" ).constructorArg( "50.0" ).end()
                    .newField( "mass" ).type( "double" ).end()
                    .newField( "radius" ).type( "double" ).end()
                .end()
                .getDescr();

        assertEquals( 1,
                      pkg.getTypeDeclarations().size() );

        assertEquals( 1,
                      pkg.getEnumDeclarations().size() );

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.beans",
                      kpkg.getName() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( Collections.singletonList( kpkg ) );

        FactType stType = kbase.getFactType( "org.beans",
                                             "StockTick" );
        assertNotNull( stType );
        Object st = stType.newInstance();
        stType.set( st,
                    "symbol",
                    "RHT" );
        stType.set( st,
                    "price",
                    10 );

        assertEquals( "RHT",
                      stType.get( st,
                                  "symbol" ) );

        //stType.getAnnotation("author"); TODO: implement support for this

    }

    @Test
    public void testDeclareEntryPoint() throws InstantiationException,
                                       IllegalAccessException {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                // declare
                .newDeclare().entryPoint()
                    .entryPointId( "ep1" )
                .end()
                .newDeclare().entryPoint()
                    .entryPointId( "ep3" )
                .end()
                .getDescr();

        assertEquals( 2,
                      pkg.getEntryPointDeclarations().size() );

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                      kpkg.getName() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( Collections.singletonList( kpkg ) );

        assertEquals( 2,
                      kbase.getEntryPointIds().size() );

    }

    @Test
    public void testRuleRHSOptional() throws InstantiationException,
                                       IllegalAccessException {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                .newRule().name( "r1" )
                    .lhs()
                        .pattern("StockTick").constraint( "company == \"RHT\"" ).end()
                    .end()
                .end()
                .getDescr();

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                      kpkg.getName() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( Collections.singletonList( kpkg ) );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        ksession.insert( new StockTick(1, "RHT", 80, 1 ) );
        int rules = ksession.fireAllRules();
        assertEquals( 1, rules );
    }

    @Test
    public void testRuleRHSComment() throws InstantiationException,
                                       IllegalAccessException {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                .newRule().name( "r1" )
                    .lhs()
                        .pattern("StockTick").constraint( "company == \"RHT\"" ).end()
                    .end()
                    .rhs( "// some comment" )
                .end()
                .getDescr();

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                      kpkg.getName() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( Collections.singletonList( kpkg ) );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        ksession.insert( new StockTick(1, "RHT", 80, 1 ) );
        int rules = ksession.fireAllRules();
        assertEquals( 1, rules );
    }

    @Test
    public void testTopLevelAccumulate() throws InstantiationException,
                                       IllegalAccessException {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                .newRule().name( "r1" )
                    .lhs()
                        .accumulate()
                            .source()
                                .pattern("StockTick").constraint( "company == \"RHT\"" ).bind( "$p", "price", false ).end()
                            .end()
                            .function( "sum", "$sum", "$p" )
                            .function( "count", "$cnt", "$p" )
                        .end()
                    .end()
                    .rhs( "// some comment" )
                .end()
                .getDescr();

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                      kpkg.getName() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( Collections.singletonList( kpkg ) );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        AgendaEventListener ael = mock( AgendaEventListener.class );
        ksession.addEventListener( ael );

        ksession.insert( new StockTick(1, "RHT", 80, 1 ) );
        ksession.insert( new StockTick(2, "RHT", 100, 10 ) );
        int rules = ksession.fireAllRules();
        assertEquals( 1, rules );

        ArgumentCaptor<AfterActivationFiredEvent> cap = ArgumentCaptor.forClass( AfterActivationFiredEvent.class );
        verify( ael ).afterActivationFired( cap.capture() );

        assertThat( ((Number) cap.getValue().getActivation().getDeclarationValue( "$sum" )).intValue(), is( 180 ) );
        assertThat( ((Number) cap.getValue().getActivation().getDeclarationValue( "$cnt" )).intValue(), is( 2 ) );
    }

    @Test
    public void testRule() throws InstantiationException,
                                       IllegalAccessException {
        PackageDescr pkg = DescrFactory.newPackage()
                .name( "org.drools" )
                .newRule().name( "r1" )
                    .lhs()
                        .and()
                            .or()
                                .pattern( "StockTick" ).constraint( "price > 100" ).end()
                                .pattern( "StockTick" ).constraint( "price < 10" ).end()
                            .end()
                            .pattern("StockTick").constraint( "company == \"RHT\"" ).end()
                        .end()
                    .end()
                    .rhs( "    System.out.println(\"foo\");\n" )
                .end()
                .getDescr();

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                      kpkg.getName() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( Collections.singletonList( kpkg ) );

        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        ksession.insert( new StockTick(1, "RHT", 80, 1 ) );
        int rules = ksession.fireAllRules();
        assertEquals( 0, rules );

        ksession = kbase.newStatefulKnowledgeSession();
        ksession.insert( new StockTick(2, "RHT", 150, 1 ) );
        rules = ksession.fireAllRules();
        assertEquals( 1, rules );
    }

    @Test
    public void testFromEntryPoint() throws InstantiationException,
                                            IllegalAccessException {
        PackageDescr pkg = DescrFactory
                .newPackage().name("org.drools")
                .newRule().name("from rule")
                    .lhs()
                        .pattern("String").id("s", false).from().entryPoint("EventStream").end()
                    .end()
                .rhs("//System.out.println(s);")
                .end().getDescr();

        KnowledgePackage kpkg = compilePkgDescr( pkg );
        assertEquals( "org.drools",
                      kpkg.getName() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( Collections.singletonList( kpkg ) );

        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        WorkingMemoryEntryPoint ep = ksession.getWorkingMemoryEntryPoint( "EventStream" );
        ep.insert( "Hello World!" );
        int rules = ksession.fireAllRules();
        assertEquals( 1, rules );

    }

    private KnowledgePackage compilePkgDescr( PackageDescr pkg ) {
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add( ResourceFactory.newDescrResource( pkg ),
                      ResourceType.DESCR );

        assertFalse( kbuilder.getErrors().toString(),
                     kbuilder.hasErrors() );
        Collection<KnowledgePackage> kpkgs = kbuilder.getKnowledgePackages();
        assertEquals( 1,
                      kpkgs.size() );

        return kpkgs.iterator().next();

    }

}


text:
<?php
/**
 * Smush backup class
 *
 * @package WP_Smush
 */

if ( ! defined( 'WPINC' ) ) {
	die;
}

/**
 * Class WP_Smush_Backup
 */
class WP_Smush_Backup extends WP_Smush_Module {

	/**
	 * WP_Smushit instance.
	 *
	 * @var WP_Smushit
	 */
	private $smush;

	/**
	 * Key for storing file path for image backup
	 *
	 * @var string
	 */
	private $backup_key = 'smush-full';

	/**
	 * WP_Smush_Backup constructor.
	 */
	public function init() {
		// Handle Restore operation.
		add_action( 'wp_ajax_smush_restore_image', array( $this, 'restore_image' ) );

		// Handle bulk restore from modal.
		add_action( 'wp_ajax_get_image_count', array( $this, 'get_image_count' ) );
		add_action( 'wp_ajax_restore_step', array( $this, 'restore_step' ) );
	}

	/**
	 * Creates a backup of file for the given attachment path
	 *
	 * Checks if there is a existing backup, else create one
	 *
	 * @param string $file_path      File path.
	 * @param string $backup_path    Backup path.
	 * @param string $attachment_id  Attachment ID.
	 *
	 * @return string
	 */
	public function create_backup( $file_path = '', $backup_path = '', $attachment_id = '' ) {
		$copied = false;

		if ( empty( $file_path ) ) {
			return '';
		}

		// Return file path if backup is disabled.
		if ( ! $this->settings->get( 'backup' ) || ! WP_Smush::is_pro() ) {
			return $file_path;
		}

		$mod = WP_Smush::get_instance()->core()->mod;

		// Get a backup path if empty.
		if ( empty( $backup_path ) ) {
			$backup_path = $mod->smush->get_image_backup_path( $file_path );
		}

		// If we don't have any backup path yet, bail!
		if ( empty( $backup_path ) ) {
			return $file_path;
		}

		$attachment_id = ! empty( $mod->smush->attachment_id ) ? $mod->smush->attachment_id : $attachment_id;
		if ( ! empty( $attachment_id ) && $mod->png2jpg->is_converted( $attachment_id ) ) {
			// No need to create a backup, we already have one if enabled.
			return $file_path;
		}

		// Check for backup from other plugins, like nextgen, if it doesn't exists, create our own.
		if ( ! file_exists( $backup_path ) ) {
			$copied = @copy( $file_path, $backup_path );
		}
		// Store the backup path in image backup sizes.
		if ( $copied ) {
			$this->add_to_image_backup_sizes( $attachment_id, $backup_path );
		}
	}

	/**
	 * Store new backup path for the image
	 *
	 * @param string $attachment_id  Attachment ID.
	 * @param string $backup_path    Backup path.
	 * @param string $backup_key     Backup key.
	 *
	 * @return bool|int
	 */
	public function add_to_image_backup_sizes( $attachment_id = '', $backup_path = '', $backup_key = '' ) {
		if ( empty( $attachment_id ) || empty( $backup_path ) ) {
			return false;
		}
		// Get the Existing backup sizes.
		$backup_sizes = get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true );
		if ( empty( $backup_sizes ) ) {
			$backup_sizes = array();
		}

		// Prevent phar deserialization vulnerability.
		// Return if backup file doesn't exists.
		if ( 0 === strpos( strtolower( trim( $backup_path ) ), 'phar://' ) || ! file_exists( $backup_path ) ) {
			return false;
		}
		list( $width, $height ) = getimagesize( $backup_path );
		// Store our backup Path.
		$backup_key                  = empty( $backup_key ) ? $this->backup_key : $backup_key;
		$backup_sizes[ $backup_key ] = array(
			'file'   => wp_basename( $backup_path ),
			'width'  => $width,
			'height' => $height,
		);

		return update_post_meta( $attachment_id, '_wp_attachment_backup_sizes', $backup_sizes );
	}

	/**
	 * Restore the image and its sizes from backup
	 *
	 * @param string $attachment  Attachment.
	 * @param bool   $resp        Send JSON response or not.
	 *
	 * @return bool
	 */
	public function restore_image( $attachment = '', $resp = true ) {
		// If no attachment id is provided, check $_POST variable for attachment_id.
		if ( empty( $attachment ) ) {
			// Check Empty fields.
			if ( empty( $_POST['attachment_id'] ) || empty( $_POST['_nonce'] ) ) {
				wp_send_json_error(
					array(
						'error'   => 'empty_fields',
						'message' => esc_html__( 'Error in processing restore action, Fields empty.', 'wp-smushit' ),
					)
				);
			}
			// Check Nonce.
			if ( ! wp_verify_nonce( $_POST['_nonce'], 'wp-smush-restore-' . $_POST['attachment_id'] ) ) {
				wp_send_json_error(
					array(
						'error'   => 'empty_fields',
						'message' => esc_html__( 'Image not restored, Nonce verification failed.', 'wp-smushit' ),
					)
				);
			}
		}

		// Store the restore success/failure for Full size image.
		$restored = $restore_png = false;

		// Process now.
		$attachment_id = empty( $attachment ) ? absint( (int) $_POST['attachment_id'] ) : $attachment;

		// Set a Option to avoid the smush-restore-smush loop.
		update_option( "wp-smush-restore-$attachment_id", true );

		// Restore Full size -> get other image sizes -> restore other images.
		// Get the Original Path.
		$file_path = WP_Smush_Helper::get_attached_file( $attachment_id );

		// Get the backup path.
		$backup_sizes = get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true );

		$smush = WP_Smush::get_instance()->core()->mod->smush;

		// If there are.
		if ( ! empty( $backup_sizes ) ) {
			// 1. Check if the image was converted from PNG->JPG, Get the corresponding backup path
			if ( ! empty( $backup_sizes['smush_png_path'] ) ) {
				$backup_path = $backup_sizes['smush_png_path'];
				// If we don't have the backup path in backup sizes, Check for legacy original file path.
				if ( empty( $backup_path ) ) {
					// Check if it's a jpg converted from png, and restore the jpg to png.
					$original_file = get_post_meta( $attachment_id, WP_SMUSH_PREFIX . 'original_file', true );
					$backup_path   = $smush->original_file( $original_file );
				}

				// If we have a backup path for PNG file, use restore_png().
				if ( ! empty( $backup_path ) ) {
					$restore_png = true;
				}
			}

			// 2. If we don't have a backup path from PNG->JPG, check for normal smush backup path.
			if ( empty( $backup_path ) ) {

				if ( ! empty( $backup_sizes[ $this->backup_key ] ) ) {
					$backup_path = $backup_sizes[ $this->backup_key ];
				} else {
					// If we don't have a backup path, check for legacy backup naming convention.
					$backup_path = $smush->get_image_backup_path( $file_path );
				}
			}
			$backup_path = is_array( $backup_path ) && ! empty( $backup_path['file'] ) ? $backup_path['file'] : $backup_path;
		}

		$backup_full_path = str_replace( wp_basename( $file_path ), wp_basename( $backup_path ), $file_path );

		// Finally, if we have the backup path, perform the restore operation.
		if ( ! empty( $backup_full_path ) ) {
			/**
			 * Allows S3 to hook, check and download the file
			 */
			do_action( 'smush_file_exists', $backup_full_path, $attachment_id, array() );

			if ( $restore_png ) {
				// restore PNG full size and all other image sizes.
				$restored = $this->restore_png( $attachment_id, $backup_full_path, $file_path );

				// JPG file is already deleted, Update backup sizes.
				if ( $restored ) {
					$this->remove_from_backup_sizes( $attachment_id, 'smush_png_path', $backup_sizes );
				}
			} else {
				// If file exists, corresponding to our backup path.
				// Restore.
				$restored = @copy( $backup_full_path, $file_path );

				// Remove the backup, if we were able to restore the image.
				if ( $restored ) {

					// Update backup sizes.
					$this->remove_from_backup_sizes( $attachment_id, '', $backup_sizes );

					// Delete the backup.
					$this->remove_backup( $attachment_id, $backup_full_path );
				}
			}
		} elseif ( file_exists( $file_path . '_backup' ) ) {
			// Try to restore from other backups, if any.
			$restored = @copy( $file_path . '_backup', $file_path );
		}

		// Generate all other image size, and update attachment metadata.
		$metadata = wp_generate_attachment_metadata( $attachment_id, $file_path );

		// Update metadata to db if it was successfully generated.
		if ( ! empty( $metadata ) && ! is_wp_error( $metadata ) ) {
			wp_update_attachment_metadata( $attachment_id, $metadata );
		}

		// If any of the image is restored, we count it as success.
		if ( $restored ) {
			// Remove the Meta, And send json success.
			delete_post_meta( $attachment_id, WP_Smushit::$smushed_meta_key );

			// Remove PNG to JPG conversion savings.
			delete_post_meta( $attachment_id, WP_SMUSH_PREFIX . 'pngjpg_savings' );

			// Remove Original File.
			delete_post_meta( $attachment_id, WP_SMUSH_PREFIX . 'original_file' );

			// Delete resize savings.
			delete_post_meta( $attachment_id, WP_SMUSH_PREFIX . 'resize_savings' );

			// Get the Button html without wrapper.
			$button_html = $smush->set_status( $attachment_id, false, false, false );

			// Remove the transient.
			delete_option( "wp-smush-restore-$attachment_id" );

			if ( $resp ) {
				$size = file_exists( $file_path ) ? filesize( $file_path ) : 0;
				if ( $size > 0 ) {
					$update_size = size_format( $size, 0 ); // Used in js to update image stat.
				}

				wp_send_json_success(
					array(
						'button'   => $button_html,
						'new_size' => isset( $update_size ) ? $update_size : 0,
					)
				);
			} else {
				return true;
			}
		}
		// Remove the transient.
		delete_option( "wp-smush-restore-$attachment_id" );

		if ( $resp ) {
			wp_send_json_error( array( 'message' => '
' . __( 'Unable to restore image', 'wp-smushit' ) . '
' ) );
		}

		return false;
	}

	/**
	 * Restore PNG.
	 *
	 * @param string $image_id       Image ID.
	 * @param string $original_file  Original file.
	 * @param string $file_path      File path.
	 *
	 * @return bool
	 */
	private function restore_png( $image_id = '', $original_file = '', $file_path = '' ) {
		// If we don't have attachment id, there is nothing we can do.
		if ( empty( $image_id ) ) {
			return false;
		}

		$meta = '';

		$mod = WP_Smush::get_instance()->core()->mod;

		// Else get the Attachment details.
		/**
		 * For Full Size
		 * 1. Get the original file path
		 * 2. Update the attachment metadata and all other meta details
		 * 3. Delete the JPEG
		 * 4. And we're done
		 * 5. Add a action after updating the URLs, that'd allow the users to perform a additional search, replace action
		 */
		if ( empty( $original_file ) ) {
			$original_file = get_post_meta( $image_id, WP_SMUSH_PREFIX . 'original_file', true );
		}
		$original_file_path = $mod->smush->original_file( $original_file );
		if ( file_exists( $original_file_path ) ) {
			// Update the path details in meta and attached file, replace the image.
			$meta = $mod->png2jpg->update_image_path( $image_id, $file_path, $original_file_path, $meta, 'full', 'restore' );

			// Unlink JPG.
			if ( ! empty( $meta['file'] ) && $original_file == $meta['file'] ) {
				@unlink( $file_path );
			}

			$meta = wp_generate_attachment_metadata( $image_id, $original_file_path );

			/**
			 *  Perform a action after the image URL is updated in post content
			 */
			do_action( 'wp_smush_image_url_updated', $image_id, $file_path, $original_file );
		}
		// Update Meta.
		if ( ! empty( $meta ) ) {
			// Remove Smushing, while attachment data is updated for the image.
			remove_filter( 'wp_update_attachment_metadata', array( $mod->smush, 'smush_image' ), 15 );
			wp_update_attachment_metadata( $image_id, $meta );

			return true;
		}

		return false;

	}

	/**
	 *  Remove the backup path for a give attachment id and path
	 *
	 * @param string $attachment_id  Attachment ID.
	 * @param string $path           File path.
	 */
	private function remove_backup( $attachment_id = '', $path = '' ) {
		@unlink( $path );
	}

	/**
	 * Remove a specific backup key from Backup Size array
	 *
	 * @param string $attachment_id  Attachment ID.
	 * @param string $backup_key     Backup key.
	 * @param array  $backup_sizes   Backup sizes.
	 */
	private function remove_from_backup_sizes( $attachment_id = '', $backup_key = '', $backup_sizes = array() ) {
		// Get backup sizes.
		$backup_sizes = empty( $backup_sizes ) ? get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true ) : $backup_sizes;
		$backup_key   = empty( $backup_key ) ? $this->backup_key : $backup_key;

		// If we don't have any backup sizes list or if the particular key is not set, return.
		if ( empty( $backup_sizes ) || ! isset( $backup_sizes[ $backup_key ] ) ) {
			return;
		}

		unset( $backup_sizes[ $backup_key ] );

		// Store it in attachment meta.
		update_post_meta( $attachment_id, '_wp_attachment_backup_sizes', $backup_sizes );
	}

	/**
	 * Get the number of attachments that can be restored.
	 *
	 * @since 3.2.2
	 */
	public function get_image_count() {
		check_ajax_referer( 'smush_bulk_restore', '_wpnonce' );
		wp_send_json_success(
			array(
				'items' => WP_Smush::get_instance()->core()->mod->db->get_attachments_with_backups( true ),
			)
		);
	}

	/**
	 * Bulk restore images from the modal.
	 *
	 * @since 3.2.2
	 */
	public function restore_step() {
		check_ajax_referer( 'smush_bulk_restore', '_wpnonce' );
		$id = filter_input( INPUT_POST, 'item', FILTER_SANITIZE_NUMBER_INT, FILTER_NULL_ON_FAILURE );

		$status = $id ? $this->restore_image( $id, false ) : false;

		$original_meta = wp_get_attachment_metadata( $id, true );

		// Try to get the file name from path.
		$file_name = explode( '/', $original_meta['file'] );

		if ( is_array( $file_name ) ) {
			$file_name = array_pop( $file_name );
		} else {
			$file_name = $original_meta['file'];
		}

		wp_send_json_success(
			array(
				'success' => $status,
				'src'     => $file_name,
				'thumb'   => wp_get_attachment_image( $id ),
				'link'    => WP_Smush_Helper::get_image_media_link( $id, $file_name, true ),
			)
		);
	}

}


text:
'use strict';

angular.module('publicApp')
  .factory('Io', function () {
    if (typeof io === 'undefined') {
      throw new Error('Socket.io required');
    }
    return io;
  });


text:
const polylock = require('./../lib/index.js');
let resource_manager = new polylock();
let start_ms = (new Date()).getTime();

let results = Promise.all([
    contended({'resource_a': 'read',  'resource_b': 'write'}, 'A_read_B_write_1'),
    contended({'resource_a': 'read',  'resource_b': 'write'}, 'A_read_B_write_2'),
    contended({'resource_a': 'read',  'resource_b': 'write'}, 'A_read_B_write_3'),
    contended({'resource_a': 'read',  'resource_c': 'write'}, 'A_read_C_write_4'),
    contended({'resource_a': 'read',  'resource_d': 'write'}, 'A_read_D_write_5'),
    contended({'resource_a': 'write', 'resource_e': 'read' }, 'A_write_E_read_6'),
]).then((results) => {
    console.log(results);
});

function contended (locks, descr) {
    console.log(`${ts()}\tWAIT\t${descr}\twaiting for locks`);
    return resource_manager
        .wait(locks)
        .then((release) => {
            console.log(`${ts()}\tGRANT\t${descr}\tlocks granted, starting critical section`);
            return critical_section(descr)
                .then((retval) => {
                    console.log(`${ts()}\tRELEASE\t${descr}\tcritical section done, releasing locks`);
                    release();
                    return retval;
                });
        });
}

function critical_section (descr) {
    console.log(`${ts()}\tBEGIN\t${descr}\tstarting async operation`);
    return new Promise((resolve) => {
        setTimeout(
            function () {
                resolve(Math.floor(Math.random() * 100));
                console.log(`${ts()}\tCOMMIT\t${descr}\tfinished async operation`);
            },
            1000 + Math.floor(Math.random() * 1000)
        );
    }).then((retval) => {
        return {
            'operation': descr,
            'result':    retval,
        };
    });
}

function ts () {
    return `${(new Date()).getTime() - start_ms}ms`;
}


text:
/* This program is free software: you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public License
 as published by the Free Software Foundation, either version 3 of
 the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */

package com.conveyal.gtfs.model;

import java.io.IOException;

public class Frequency extends Entity {

    public String trip_id;
    public int start_time;
    public int end_time;
    public int headway_secs;
    public int exact_times;

    @Override
    public Object getKey() {
        return trip_id;
    }

    public static class Factory extends Entity.Factory<Frequency> {

        public Factory() {
            tableName = "frequencies";
            requiredColumns = new String[] {"trip_id"};
        }

        @Override
        public Frequency fromCsv() throws IOException {
            Frequency f = new Frequency();
            f.trip_id = getStringField("trip_id", true);
            f.start_time = getTimeField("start_time");
            f.end_time = getTimeField("end_time");
            f.headway_secs = getIntField("headway_secs", true);
            f.exact_times = getIntField("exact_times", false);
            return f;
        }

    }

}


text:
<?php
class BaseaBetterTwitterSlotComponents extends aSlotComponents
{
  public function executeEditView()
  {
    // Must be at the start of both view components
    $this->setup();
 		$this->setupOptions();

    // Careful, don't clobber a form object provided to us with validation errors
    // from an earlier pass
    if (!isset($this->form))
    {
      $this->form = new aBetterTwitterSlotEditForm($this->id, $this->slot->getArrayValue());
    }
		$this->getSlotValues();
  }

  public function executeNormalView()
  {
    $this->setup();
 		$this->setupOptions();
		$this->getSlotValues();
  }

  protected function getSlotValues()
	{
		$this->values = $this->slot->getArrayValue();
	}

	protected function setupOptions()
	{
    $this->options['join_text'] = $this->getOption('join_text', 'auto');
    $this->options['avatar_size'] = $this->getOption('avatar_size', false); // This can be set by the user. Setting it here will disable the users ability to change it
    $this->options['count'] = $this->getOption('count', false); // This can be set by the user. Setting it here will disable the users ability to change it
    $this->options['query'] = $this->getOption('query', false);
    $this->options['auto_join_text_default'] = $this->getOption('auto_join_text_default','we said,');
    $this->options['auto_join_text_ed'] = $this->getOption('auto_join_text_ed','we');
    $this->options['auto_join_text_ing'] = $this->getOption('auto_join_text_ing','we were');
    $this->options['auto_join_text_reply'] = $this->getOption('auto_join_text_reply','we replied to');
    $this->options['auto_join_text_url'] = $this->getOption('auto_join_text_url','we were checking out');
    $this->options['loading_text'] = $this->getOption('loading_text','loading tweets...');
	}

}


text:
package com.panibrat.university.console.controller.filter.predicate;

import com.panibrat.university.entity.Student;
import com.google.common.base.Predicate;

public class FacultyPredicate implements Predicate<Student> {

    private final String faculty;

    public FacultyPredicate(String faculty) {
        this.faculty = faculty;
    }

    @Override
    public boolean apply(Student s) {
        return s.getFaculty().equalsIgnoreCase(faculty);
    }
}


text:
#pragma once

#include "../inc/MarlinConfigPre.h"

#if ENABLED(EMERGENCY_PARSER)
  #include "../feature/e_parser.h"
#endif

// Used in multiple places
// You can build it but not manipulate it.
// There are only few places where it's required to access the underlying member: GCodeQueue, SerialMask and MultiSerial
struct serial_index_t {
  // A signed index, where -1 is a special case meaning no action (neither output or input)
  int8_t  index;

  // Check if the index is within the range [a ... b]
  constexpr inline bool within(const int8_t a, const int8_t b) const { return WITHIN(index, a, b); }
  constexpr inline bool valid() const { return WITHIN(index, 0, 7); } // At most, 8 bits

  // Construction is either from an index
  constexpr serial_index_t(const int8_t index) : index(index) {}

  // Default to "no index"
  constexpr serial_index_t() : index(-1) {}
};

// In order to catch usage errors in code, we make the base to encode number explicit
// If given a number (and not this enum), the compiler will reject the overload, falling back to the (double, digit) version
// We don't want hidden conversion of the first parameter to double, so it has to be as hard to do for the compiler as creating this enum
enum class PrintBase {
  Dec = 10,
  Hex = 16,
  Oct = 8,
  Bin = 2
};

// A simple feature list enumeration
enum class SerialFeature {
  None                = 0x00,
  MeatPack            = 0x01,   //!< Enabled when Meatpack is present
  BinaryFileTransfer  = 0x02,   //!< Enabled for BinaryFile transfer support (in the future)
  Virtual             = 0x04,   //!< Enabled for virtual serial port (like Telnet / Websocket / ...)
  Hookable            = 0x08,   //!< Enabled if the serial class supports a setHook method
};
ENUM_FLAGS(SerialFeature);

// flushTX is not implemented in all HAL, so use SFINAE to call the method where it is.
CALL_IF_EXISTS_IMPL(void, flushTX);
CALL_IF_EXISTS_IMPL(bool, connected, true);
CALL_IF_EXISTS_IMPL(SerialFeature, features, SerialFeature::None);

// A simple forward struct to prevent the compiler from selecting print(double, int) as a default overload
// for any type other than double/float. For double/float, a conversion exists so the call will be invisible.
struct EnsureDouble {
  double a;
  operator double() { return a; }
  // If the compiler breaks on ambiguity here, it's likely because print(X, base) is called with X not a double/float, and
  // a base that's not a PrintBase value. This code is made to detect the error. You MUST set a base explicitly like this:
  // SERIAL_PRINT(v, PrintBase::Hex)
  EnsureDouble(double a) : a(a) {}
  EnsureDouble(float a) : a(a) {}
};

// Using Curiously-Recurring Template Pattern here to avoid virtual table cost when compiling.
// Since the real serial class is known at compile time, this results in the compiler writing
// a completely efficient code.
template <class Child>
struct SerialBase {
  #if ENABLED(EMERGENCY_PARSER)
    const bool ep_enabled;
    EmergencyParser::State emergency_state;
    inline bool emergency_parser_enabled() { return ep_enabled; }
    SerialBase(bool ep_capable) : ep_enabled(ep_capable), emergency_state(EmergencyParser::State::EP_RESET) {}
  #else
    SerialBase(const bool) {}
  #endif

  #define SerialChild static_cast<Child*>(this)

  // Static dispatch methods below:
  // The most important method here is where it all ends to:
  void write(uint8_t c)             { SerialChild->write(c); }

  // Called when the parser finished processing an instruction, usually build to nothing
  void msgDone() const              { SerialChild->msgDone(); }

  // Called on initialization
  void begin(const long baudRate)   { SerialChild->begin(baudRate); }

  // Called on destruction
  void end()                        { SerialChild->end(); }

  /** Check for available data from the port
      @param index  The port index, usually 0 */
  int available(serial_index_t index=0) const { return SerialChild->available(index); }

  /** Read a value from the port
      @param index  The port index, usually 0 */
  int read(serial_index_t index=0)        { return SerialChild->read(index); }

  /** Combine the features of this serial instance and return it
      @param index  The port index, usually 0 */
  SerialFeature features(serial_index_t index=0) const { return static_cast<const Child*>(this)->features(index);  }

  // Check if the serial port has a feature
  bool has_feature(serial_index_t index, SerialFeature flag) const { return (features(index) & flag) != SerialFeature::None; }

  // Check if the serial port is connected (usually bypassed)
  bool connected() const            { return SerialChild->connected(); }

  // Redirect flush
  void flush()                      { SerialChild->flush(); }

  // Not all implementation have a flushTX, so let's call them only if the child has the implementation
  void flushTX()                    { CALL_IF_EXISTS(void, SerialChild, flushTX); }

  // Glue code here
  void write(const char *str)                    { while (*str) write(*str++); }
  void write(const uint8_t *buffer, size_t size) { while (size--) write(*buffer++); }
  void print(char *str)                          { write(str); }
  void print(const char *str)                    { write(str); }
  // No default argument to avoid ambiguity

  // Define print for every fundamental integer type, to ensure that all redirect properly
  // to the correct underlying implementation.

  // Prints are performed with a single size, to avoid needing multiple print functions.
  // The fixed integer size used for prints will be the larger of long or a pointer.
  #if __LONG_WIDTH__ >= __INTPTR_WIDTH__
    typedef long int_fixed_print_t;
    typedef unsigned long uint_fixed_print_t;
  #else
    typedef intptr_t int_fixed_print_t;
    typedef uintptr_t uint_fixed_print_t;

    FORCE_INLINE void print(intptr_t c, PrintBase base)         { printNumber_signed(c, base); }
    FORCE_INLINE void print(uintptr_t c, PrintBase base)        { printNumber_unsigned(c, base); }
  #endif

  FORCE_INLINE void print(char c, PrintBase base)               { printNumber_signed(c, base); }
  FORCE_INLINE void print(short c, PrintBase base)              { printNumber_signed(c, base); }
  FORCE_INLINE void print(int c, PrintBase base)                { printNumber_signed(c, base); }
  FORCE_INLINE void print(long c, PrintBase base)               { printNumber_signed(c, base); }
  FORCE_INLINE void print(unsigned char c, PrintBase base)      { printNumber_unsigned(c, base); }
  FORCE_INLINE void print(unsigned short c, PrintBase base)     { printNumber_unsigned(c, base); }
  FORCE_INLINE void print(unsigned int c, PrintBase base)       { printNumber_unsigned(c, base); }
  FORCE_INLINE void print(unsigned long c, PrintBase base)      { printNumber_unsigned(c, base); }

  void print(EnsureDouble c, int digits)           { printFloat(c, digits); }

  // Forward the call to the former's method

  // Default implementation for anything without a specialization
  // This handles integers since they are the most common
  template <typename T>
  void print(T c)    { print(c, PrintBase::Dec); }

  void print(float c)    { print(c, 2); }
  void print(double c)    { print(c, 2); }

  void println(char *s)               { print(s); println(); }
  void println(const char *s)         { print(s); println(); }
  void println(float c, int digits)   { print(c, digits); println(); }
  void println(double c, int digits)  { print(c, digits); println(); }
  void println()                      { write('\r'); write('\n'); }

  // Default implementations for types without a specialization. Handles integers.
  template <typename T>
  void println(T c, PrintBase base)   { print(c, base); println(); }

  template <typename T>
  void println(T c)                   { println(c, PrintBase::Dec); }

  // Forward the call to the former's method
  void println(float c)               { println(c, 2); }
  void println(double c)              { println(c, 2); }

  // Print a number with the given base
  NO_INLINE void printNumber_unsigned(uint_fixed_print_t n, PrintBase base) {
    if (n) {
      unsigned char buf[8 * sizeof(long)]; // Enough space for base 2
      int8_t i = 0;
      while (n) {
        buf[i++] = n % (uint_fixed_print_t)base;
        n /= (uint_fixed_print_t)base;
      }
      while (i--) write((char)(buf[i] + (buf[i] < 10 ? '0' : 'A' - 10)));
    }
    else write('0');
  }

  NO_INLINE void printNumber_signed(int_fixed_print_t n, PrintBase base) {
    if (base == PrintBase::Dec && n < 0) {
      n = -n; // This works because all platforms Marlin's builds on are using 2-complement encoding for negative number
              // On such CPU, changing the sign of a number is done by inverting the bits and adding one, so if n = 0x80000000 = -2147483648 then
              // -n = 0x7FFFFFFF + 1 => 0x80000000 = 2147483648 (if interpreted as unsigned) or -2147483648 if interpreted as signed.
              // On non 2-complement CPU, there would be no possible representation for 2147483648.
      write('-');
    }
    printNumber_unsigned((uint_fixed_print_t)n , base);
  }

  // Print a decimal number
  NO_INLINE void printFloat(double number, uint8_t digits) {
    // Handle negative numbers
    if (number < 0.0) {
      write('-');
      number = -number;
    }

    // Round correctly so that print(1.999, 2) prints as "2.00"
    double rounding = 0.5;
    LOOP_L_N(i, digits) rounding *= 0.1;
    number += rounding;

    // Extract the integer part of the number and print it
    unsigned long int_part = (unsigned long)number;
    double remainder = number - (double)int_part;
    printNumber_unsigned(int_part, PrintBase::Dec);

    // Print the decimal point, but only if there are digits beyond
    if (digits) {
      write('.');
      // Extract digits from the remainder one at a time
      while (digits--) {
        remainder *= 10.0;
        unsigned long toPrint = (unsigned long)remainder;
        printNumber_unsigned(toPrint, PrintBase::Dec);
        remainder -= toPrint;
      }
    }
  }
};

// All serial instances will be built by chaining the features required
// for the function in the form of a template type definition.


text:
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>

#include "tests.h"

#define WRITE_BUFFER_SIZE 32768

void stress_2(void)
{
	int fd, i;
	pid_t pid;
	ssize_t written;
	int64_t remains;
	int64_t repeat;
	size_t block;
	char *file_name;
	char buf[WRITE_BUFFER_SIZE];

	file_name = "stress_2_test_file";
	fd = open(file_name, O_CREAT | O_WRONLY,
		S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
	CHECK(fd != -1);
	CHECK(unlink(file_name) != -1);
	pid = getpid();
	srand(pid);
	repeat = tests_repeat_parameter;
	for (;;) {
		for (i = 0; i < WRITE_BUFFER_SIZE;++i)
			buf[i] = rand();
		CHECK(lseek(fd, 0, SEEK_SET) != -1);
		remains = tests_size_parameter;
		while (remains > 0) {
			if (remains > WRITE_BUFFER_SIZE)
				block = WRITE_BUFFER_SIZE;
			else
				block = remains;
			written = write(fd, buf, block);
			if (written <= 0) {
				CHECK(errno == ENOSPC); /* File system full */
				errno = 0;
				break;
			}
			remains -= written;
		}
		if (tests_repeat_parameter > 0 && --repeat <= 0)
			break;
	}
	CHECK(close(fd) != -1);
}

/* Title of this test */

const char *stress_2_get_title(void)
{
	return "Create / overwrite a large deleted file";
}

/* Description of this test */

const char *stress_2_get_description(void)
{
	return
		"Create a file named stress_2_test_file. " \
		"Open it, delete it while holding the open file descriptor, " \
		"then fill it with random data. " \
		"Repeated re-write the file some number of times. " \
		"The repeat count is given by the -n or --repeat option, " \
		"otherwise it defaults to 10. " \
		"The file size is given by the -z or --size option, " \
		"otherwise it defaults to 1000000.";
}

int main(int argc, char *argv[])
{
	int run_test;

	/* Set default test file size */
	tests_size_parameter = 1000000;

	/* Set default test repetition */
	tests_repeat_parameter = 10;

	/* Handle common arguments */
	run_test = tests_get_args(argc, argv, stress_2_get_title(),
			stress_2_get_description(), "zn");
	if (!run_test)
		return 1;
	/* Change directory to the file system and check it is ok for testing */
	tests_check_test_file_system();
	/* Do the actual test */
	stress_2();
	return 0;
}


text:
MUI.files[MUI.path.source + 'Components/Tabs.js'] = 'loaded';

MUI.extend({
	/*

	Function: initializeTabs
		Add click event to each list item that fires the selected function.

	*/
	initializeTabs: function(el){
		$(el).setStyle('list-style', 'none'); // This is to fix a glitch that occurs in IE8 RC1 when dynamically switching themes
		$(el).getElements('li').each(function(listitem){
			listitem.addEvent('click', function(e){
				MUI.selected(this, el);
			});
		});
	},
	/*

	Function: selected
		Add "selected" class to current list item and remove it from sibling list items.

	Syntax:
		(start code)
			selected(el, parent);
		(end)

Arguments:
	el - the list item
	parent - the ul

	*/
	selected: function(el, parent){
		$(parent).getChildren().each(function(listitem){
			listitem.removeClass('selected');
		});
		el.addClass('selected');
	}
});


text:
package org.apache.camel.component.google.mail;

import com.google.api.services.gmail.model.ListMessagesResponse;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.google.mail.internal.GmailUsersMessagesApiMethod;
import org.apache.camel.component.google.mail.internal.GoogleMailApiCollection;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.junit.jupiter.api.Assertions.assertTrue;

/**
 * Test class for {@link com.google.api.services.gmail.Gmail$Users$Messages} APIs.
 */
@EnabledIf(value = "org.apache.camel.component.google.mail.AbstractGoogleMailTestSupport#hasCredentials",
           disabledReason = "Google Mail credentials were not provided")
public class GmailUsersMessagesConsumerIT extends AbstractGoogleMailTestSupport {

    // userid of the currently authenticated user
    public static final String CURRENT_USERID = "me";
    private static final Logger LOG = LoggerFactory.getLogger(GmailUsersMessagesConsumerIT.class);
    private static final String PATH_PREFIX
            = GoogleMailApiCollection.getCollection().getApiName(GmailUsersMessagesApiMethod.class).getName();

    @Test
    public void testConsumer() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMinimumMessageCount(1);

        assertMockEndpointsSatisfied();

        assertTrue(mock.getExchanges().get(0).getIn().getBody() instanceof ListMessagesResponse);
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() {

                from("google-mail://" + PATH_PREFIX + "/list?userId=me").to("mock:result");

            }
        };
    }
}


text:
layout: page-fullwidth
subheadline: "Prayer"
title: "Abraham's Prayer"
meta_description: "How to pray and how not to pray. The prayer of of a true prayer warrior"
teaser: "And when you pray, do not keep on babbling like pagans, for they think they will be heard because of their many words (Matthew 6:7). Do not be quick with your mouth, do not be hasty in your heart to utter anything before God. God is in heaven and you are on earth, so let your words be few (Ecclesiastes 5:2). Then the LORD answered Job out of the whirlwind and said, \"Who is this that darkens counsel by words without knowledge?\" (Job 38:1-2)"
permalink: /bible-topics/meditations/abraham-prayer/
breadcrumbs: true
header: no
image:
    thumb: "/thumbs/candle-prayer.jpg"
categories:
    - bible-study
---

(Bấm vào đây để đọc tiếng Việt)

## Introduction

Though this article is about prayer, its goal is to take the eyes of the one who prays away from himself, from the objects of his prayer, or even the technicalities, the how-to's of the prayer itself, and focus them on the Person to whom he prays.

There seems to be a consensus that a good thing came about, someone was healed, found a job, disaster averted, because there was someone who prayed. In our house there is a wood carving which says "Prayer Changes Things." Many books are written with annecdotes of miraculous things that happened because of prayers. These stories became the mountain peak of experience that seemed to endure much longer than the folks whose lives gave rise to such stories.

Another assumption that seems to be prevalent in the mind of believers of almost any religions is their deity seems to be passive, or aloof, until invoked by the prayers of the faithful. Oftentimes the believers had to pray long and hard to move the hands of their divine being.

## Testimonies on the power of prayer

We often hear stories of parents praying for their children for decades until one day came the good news, the prodigals came home and all praises be to God. And recounts of groups of believers gathered together to pray for someone who had fallen down with some potentially terminal illness. And many more stories told and written through the ages.

There is no doubt God heals and intervenes in the affairs of men, and He treasures the prayers of His saints, He felt every aching heart crying out for redemption, but does He have to wait until someone prays? God loves a sinner more than anyone who might know to pray for him, especially a sinner who has no one to pray for him.

## Abraham, Lot, and Sodom

Genesis 18 and 19 recorded an event in which fire was sent from heaven to destroy the two great cities of biblical time: Sodom and Gomorrah. Special attention is paid to Sodom as it is the place of residence of the nephew of Lot. In this passage we find Abraham praying for Sodom in the way different than anything we often hear in praying circles. We aren't here to study the form, but to study the unfolding of events leading to Abraham's act of praying, as well as the content of his prayer.

The story starts out with the Lord's monologue: "Shall I hide from Abraham what I am about to do?" It was God who chose to reveal to Abraham his plan. Abraham was probably going about his daily routines with fleeting thoughts of when he and his beloved would have a child to continue his lineage. Though a child was born unto him through the maid servant Hagar, he and his wife were very likely wondering if God's promise concerning a child of their own was still something to come though it had been a long time since they first heard it.

Up to this point, Abraham wasn't praying about Sodom, and neither was he praying about his nephew Lot, at least not until the Lord revealed his plan to him. And even when he began to pray, his prayer is unlike anything you and I are familiar with.

Abraham didn't pray about Lot. But upon hearing the Lord share his plan to destroy Sodom, he asked:

"Will You indeed sweep away the righteous with the wicked? 24"Suppose there are fifty righteous within the city; will You indeed sweep it away and not spare the place for the sake of the fifty righteous who are in it? 25"Far be it from You to do such a thing, to slay the righteous with the wicked, so that the righteous and the wicked are treated alike. Far be it from You! Shall not the Judge of all the earth deal justly?"

The Lord answered:

If I find in Sodom fifty righteous within the city, then I will spare the whole place on their account.

Then Abraham proceeded to see how far he can go in numbers of righteous before the Lord would destroy the city. Forty five righteous? Forty? Thirty? Twenty? And finally ten? To each the Lord answered that He wouldn't destroy the city for their sake.

## The most important thing

Why didn't Abraham pray specifically for his nephew Lot? Of course there were many important things in Abraham's life, and Lot was among them (Genesis 13:8-9), but there was something infinitely more important: God's character. As each question was asked with a decreased number of righteous, Abraham felt he knew the Lord a little more. To him, everything else, from Lot, to the city of Sodom, and even to the nagging question in his heart about a promised offspring, and the rest of worldly concerns, pales by comparison to the knowledge of God.

Abraham had an expectation of what the God of the universe should be: "Far be it from You to do such a thing, to slay the righteous with the wicked." Abraham didn't need to go any further. For now he knew even with one righteous in the city, the Lord would spare it for the sake of one. That is the God that Abraham wanted to know, and to trust. He can trust Him with the fate of Lot and Sodom. From this point on, whatever happens he knew all is well. His world is safe.

## Seek first the kingdom of God

> 31So do not worry, saying, 'What shall we eat?' or 'What shall we drink?' or 'What shall we wear?' 32For the pagans run after all these things, and your heavenly Father knows that you need them. 33But seek first his kingdom and his righteousness, and all these things will be given to you as well. 34Therefore do not worry about tomorrow, for tomorrow will worry about itself. Each day has enough trouble of its own (Matthew 6:31-34).

Seek first God's kingdom and His righteousness. This was what we observed from Abraham's conversation with God.

Surely Abraham is a man like us with many needs to be prayed for. We know he and his wife Sarah are still waiting for God's promise to be fulfilled in their lives concerning a child. We also know he must be anxious about his nephew Lot and his family in Sodom. And then perhaps in their old age they might have some physical needs to be attended to. And other common worries of people of this world.

But we didn't hear any reference to these things in Abraham's prayer to God. Instead we heard him probing the depth of God's love for those who belong to him. If Abraham could trust God on this matter, he could trust Him on everything else.

Abraham must have heard of Sodom's reputation as a very sinful city. Yet he didn't ask God to send fire down to destroy it. He chose instead to focus on the righteous, if any, who might dwell in the city. But his prayer is not just about saving the righteous, it's about the character of God. How God answered Abraham's series of questions will shape in his mind the image of God which in turn will affect his view of the world.

Abraham is truly a man who seeks first God's kingdom and His righteousness.

Abraham's prayer also helps us understand 2 Peter 3:18 which says:

But grow in the grace and knowledge of our Lord and Savior Jesus Christ.

Let Abraham's prayer guide us in how we learn about God.

## His eye is on the sparrow

> 29Are not two sparrows sold for a penny? Yet not one of them will fall to the ground outside your Father's care.[a] 30And even the very hairs of your head are all numbered. 31So don't be afraid; you are worth more than many sparrows (Matthew 10:29-31).

If God cares for each sparrow, or even something that seems as insignificant as a strand of hair on your head, wouldn't he also care about important things in your life such as your health, your daily bread, or other concerns that may weigh heavily on your minds? How about things that appear to be spiritual such as ministries, evangelistic endeavors?

## Conclusion

God is not aloof, and neither does He slumber nor sleep. As in the case of Abraham concerning Sodom and his nephew Lot, it was God who brought the news to him. Abraham's prayer was a response to God's gracious wish to share with him what that he could not conceive in his limited understanding: "Shall I hide from Abraham what I'm about to do?"

It was also God who brought to Moses his plan to deliver His people from Egypt while the thoughts of Egypt and the people he once knew had long faded from his memory. Moses was now eighty years old and had been accustomed to a quiet life in the desert. No, he wasn't praying for his still enslaved people, neither was there anyone around who shares his vision of delivering his people from Egypt.

What about Jonah, was it him who loved the people of Nineveh, or was it God? Was it Jonah who had a great vision of evangelizing these people or was it God who revealed to him His heart: "For God so loved the world"?

It was the same way with the apostle Paul. He was busy persecuting Christians when God revealed to him that he was to become instrumental in guiding them in the right path in their new found faith in Christ. As a matter of fact, Paul was already set apart by God in his mother's womb for the work He already planned for him to do (Galatians 1:15), and this was long before Paul knew how to pray.

None of these men took any initiative in these great undertakings. They simply carried on their lives the way they knew best, completely oblivious to the great events that were to take place later after they were brought into the service of the King of heaven.

There are of course times we need to pray, and pray earnestly, for matters of great urgency. Though we know God already knew everything about us, our being able to share our burdens with God is a great blessing, especially when there is a promise that the Holy Spirit will help us express thoughts that otherwise might elude us in our times of need.

But need we pray all the time? Imagine a child talking to his parents incessantly. Prayer is not just about talking to God, but it's about listening as well. Consider listening to God as a an infinitely better form of prayer. And more often than not God speaks to us through Scriptures. Lastly, it's better to be still and acknowledge that He is God.

"And when you pray, do not keep on babbling like pagans, for they think they will be heard because of their many words (Matthew 6:7).

Do not be quick with your mouth, do not be hasty in your heart to utter anything before God. God is in heaven and you are on earth, so let your words be few (Ecclesiastes 5:2).

Then the LORD answered Job out of the whirlwind and said, "Who is this that darkens counsel by words without knowledge?" (Job 38:1-2).

{% include bible-study/bible-study-footer %}

Meditations

        {% include bible-study/meditations %}

    {% include next-previous-post-in-category %}


text:
var common         = require('../../../common');
var net            = require('net');
var assert         = require('assert');
var TcpVideoStream = require(common.lib + '/video/TcpVideoStream');

var server = net.createServer(function(connection) {
});

var events = [];
server.listen(common.TCP_PORT, function() {
  var video = new TcpVideoStream({ip: 'localhost', port: common.TCP_PORT, timeout: 100});

  video.connect(function(err) {
    if (err) throw err;

    events.push('connectCb');
  });

  video
    .on('error', function(err) {
      assert.equal(/timeout/i.test(err.message), true);

      events.push('close');
      server.close();
    });
});

process.on('exit', function() {
  assert.deepEqual(events, ['connectCb', 'close']);
});


text:
import os
import sys
import subprocess

root_dir = '/opt/az/lib/python3.10/site-packages/azure/cli/command_modules'
mod_list = [mod for mod in sorted(os.listdir(root_dir)) if os.path.isdir(os.path.join(root_dir, mod)) and mod != '__pycache__']

pytest_base_cmd = '/opt/az/bin/python3 -m pytest -x -v --boxed -p no:warnings --log-level=WARN'
pytest_parallel_cmd = '{} -n auto'.format(pytest_base_cmd)
serial_test_modules = ['botservice', 'network', 'cloud', 'appservice']

for mod_name in mod_list:
    cmd = '{} --junit-xml /azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(
        pytest_base_cmd if mod_name in serial_test_modules else pytest_parallel_cmd, mod_name, mod_name)
    print('Running:', cmd, flush=True)
    exit_code = subprocess.call(cmd, shell=True)
    if exit_code == 5:
        print('No tests found for {}'.format(mod_name))
    elif exit_code != 0:
        sys.exit(exit_code)

exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_parallel_cmd)], shell=True)
sys.exit(exit_code)


text:
#pragma once

#include "jdksavb_world.h"

#ifdef __cplusplus
extern "C" {
#endif

struct jdksavb_packetizer_signals
{
};

#ifdef __cplusplus
}
#endif


text:
<template>

${heading}

    <form role="form" submit.delegate="welcome()">

        First Name
        <input type="text" value.bind="firstName" class="form-control" id="fn" placeholder="first name">

        Last Name
        <input type="text" value.bind="lastName" class="form-control" id="ln" placeholder="last name">

        Full Name

${fullName}

      <button type="submit" class="btn btn-default">Submit</button>
    </form>

</template>


text:
:mod:`~webhelpers.mimehelper` -- MIMEtypes helper
=================================================

:mod:`webhelpers.mimehelper`
----------------------------

.. currentmodule:: webhelpers.mimehelper

.. autoclass:: MIMETypes
    :members:


text:
<select{% if not disabled %} name="{{ prefix }}-day"{% else %} disabled="disabled"{% endif %}>
	{% for d, sel in days %}
	<option value="{{ d }}"{% if sel %} selected="selected"{% endif %}>{{ d }}</option>
	{% endfor %}
</select>{% if disabled %}
<input type="hidden" name="{{ prefix }}-day" value="{{ day }}" />{% endif %}

<select{% if not disabled %} name="{{ prefix }}-month"{% else %} disabled="disabled"{% endif %}>{% for m, sel in months %}
	<option value="{{ forloop.counter }}"{% if sel %} selected="selected"{% endif %}>{{ m }}</option>{% endfor %}
</select>{% if disabled %}
<input type="hidden" name="{{ prefix }}-month" value="{{ month }}" />{% endif %}

<select{% if not disabled %} name="{{ prefix }}-year"{% else %} disabled="disabled"{% endif %}>
	{% for y, sel in years %}
	<option value="{{ y }}"{% if sel %} selected="selected"{% endif %}>{{ y }}</option>
	{% endfor %}
</select>{% if disabled %}
<input type="hidden" name="{{ prefix }}-year" value="{{ year }}" />{% endif %}