text:
import os
import worlds as my_world

fldr = os.getcwd() + os.sep + 'data'  + os.sep + 'worlds'

class Planet(object):
    """
    class to manage the simplified evolution of a planet to
    build a virtual world. Takes basic atmospheric parameters
    and *very* roughly uses these to guess what the world would
    look like.
    The idea is to be able to auto generate worlds as follows:
    green lush worlds: sun > 0.15, rain > 0.15
    earth like worlds: sun=0.2, rain=0.1, wind=0.1
    metal rich worlds: sun<0.2, wind>0.2, seismic_activity>0.6
    """
    def __init__(self, name, num_seeds, width, height, wind, rain, sun, lava):
        """
        All parameters must be between 0 and 1 and show the probability of
        that event. The numbers below are rough guidelines for normal planets
        wind 0.0 -> 0.2 : determines air currents, rain movement, topsoil
        rain 0.1 -> 0.6 : determines plant growth, river networks
        sun  0.1 -> 0.6 : determines plant growth, river networks
        lava 0.1 -> 0.6 : during formation only - determines mountains
        """
        self.world = ''     # aikif.environment.world object
        self.name = name
        self.num_seeds = num_seeds
        self.grid_height = height
        self.grid_width = width
        self.wind = wind
        self.sun = sun
        self.rain = rain
        self.lava = lava

    def __str__(self):
        res = '\n-- Welcome to ' + self.name + ' --\n'
        res += self._stats_as_str(delim = ' = ', lf='\n')
        return res

    def _stats_as_str(self, delim = ',', lf='\n'):
        s = ''
        s += 'Sun ' + delim + str(self.sun) + lf
        s += 'Wind' + delim + str(self.wind) + lf
        s += 'Rain' + delim + str(self.rain) + lf
        s += 'Lava' + delim + str(self.lava) + lf
        return s

    def evolve(self, years):
        """
        run the evolution of the planet to see how it looks
        after 'years'
        """
        world_file = fldr + os.sep + self.name + '.txt'
        self.build_base()
        self.world.add_mountains()
        self.add_life()
        self.world.grd.save(world_file)

        print('TODO - run ' + str(years) + ' years')
        # time.sleep(3)
        # gui.display_map(world_file)

    def build_base(self):
        """
        create a base random land structure using the AIKIF world model
        """
        #print('Planet ' + self.name + ' has formed!')
        self.world = my_world.World( self.grid_height, self.grid_width, [' ','x','#'])

        perc_land = (self.lava + (self.wind/10) + (self.rain/20) + (self.sun/10))*100
        perc_sea = (100 - perc_land)
        perc_blocked = (self.lava/10)*100

        #print('Calculating world : sea=', perc_sea, ' land=', perc_land, ' mountain=', perc_blocked,  )
        self.world.build_random( self.num_seeds, perc_land, perc_sea, perc_blocked)

    def add_life(self):
        """
        adds plants and animals to the world. Tries to do this in groups
        or clusters as well as random 'outcrops' or herds.
        Uses rules list to determine types and quantities of life according
        to planets evolution and atmosphere.
        """
        #print('Adding Plants and Animals')
        from noise import pnoise2
        import random
        random.seed()
        octaves = (random.random() * 0.5) + 0.5
        freq = 16.0 * octaves
        for y in range(self.world.grd.grid_height - 1):
            for x in range(self.world.grd.grid_width - 1):
                pixel = self.world.grd.get_tile(y,x)
                if pixel == 'X':     # denoise blocks of mountains
                    n = int(pnoise2(x/freq, y / freq, 1)*12+3)
                    if n < 1 and random.randint(1,10) > 7:
                        self.world.grd.set_tile(y, x, 'A')


text:
using System;
using System.Runtime.InteropServices;

namespace pelda_pinvoke
{
    class Program
    {
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int MessageBox(IntPtr hWnd, string text, string caption, int options);

        static void Main(string[] args)
        {
            MessageBox(IntPtr.Zero, "Pinvoke Minta", "Pinvoke", 0);
            Console.ReadKey();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Qt 4.8: states.h Example File (demos/sub-attaq/states.h)</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />

  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />

      Home

    Qt Reference Documentation

Qt HOME

DEV

          DOC

BLOG

Qt 4.8

ALL VERSIONS

API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

Examples

Examples

Tutorials

Demos

QML Examples

          Search index:

          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />

 Close

All | API | Articles | Examples

 results:

            </fieldset>
          </form>

            API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

            Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

            Examples

Examples

Tutorials

Demos

QML Examples

Home

A

A

A

                Print

states.h Example File

demos/sub-attaq/states.h

 #ifndef STATES_H
 #define STATES_H

 //Qt
 #include <QtCore/QState>
 #include <QtCore/QSignalTransition>
 #include <QtCore/QPropertyAnimation>
 #include <QtGui/QKeyEventTransition>
 #include <QtCore/QSet>

 class GraphicsScene;
 class Boat;
 class SubMarine;
 class QStateMachine;

 class PlayState : public QState
 {
 public:
     PlayState(GraphicsScene *scene, QState *parent = 0);
     ~PlayState();

  protected:
     void onEntry(QEvent *);

 private :
     GraphicsScene *scene;
     QStateMachine *machine;
     int currentLevel;
     int score;
     QState *parallelChild;

     friend class UpdateScoreState;
     friend class UpdateScoreTransition;
     friend class WinTransition;
     friend class CustomSpaceTransition;
     friend class WinState;
     friend class LostState;
     friend class LevelState;
 };

 class LevelState : public QState
 {
 public:
     LevelState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
 protected:
     void onEntry(QEvent *);
 private :
     void initializeLevel();
     GraphicsScene *scene;
     PlayState *game;
 };

 class PauseState : public QState
 {
 public:
     PauseState(GraphicsScene *scene, QState *parent = 0);

 protected:
     void onEntry(QEvent *);
     void onExit(QEvent *);
 private :
     GraphicsScene *scene;
     Boat *boat;
 };

 class LostState : public QState
 {
 public:
     LostState(GraphicsScene *scene, PlayState *game, QState *parent = 0);

 protected:
     void onEntry(QEvent *);
     void onExit(QEvent *);
 private :
     GraphicsScene *scene;
     PlayState *game;
 };

 class WinState : public QState
 {
 public:
     WinState(GraphicsScene *scene, PlayState *game, QState *parent = 0);

 protected:
     void onEntry(QEvent *);
     void onExit(QEvent *);
 private :
     GraphicsScene *scene;
     PlayState *game;
 };

 class UpdateScoreState : public QState
 {
 public:
     UpdateScoreState(PlayState *game, QState *parent);
 private:
     QPropertyAnimation *scoreAnimation;
     PlayState *game;
 };

 //These transtion is used to update the score
 class UpdateScoreTransition : public QSignalTransition
 {
 public:
     UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
 protected:
     virtual bool eventTest(QEvent *event);
 private:
     PlayState * game;
     GraphicsScene *scene;
 };

 //These transtion test if we have won the game
 class WinTransition : public QSignalTransition
 {
 public:
     WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
 protected:
     virtual bool eventTest(QEvent *event);
 private:
     PlayState * game;
     GraphicsScene *scene;
 };

 //These transtion is true if one level has been completed and the player want to continue
  class CustomSpaceTransition : public QKeyEventTransition
 {
 public:
     CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
 protected:
     virtual bool eventTest(QEvent *event);
 private:
     PlayState *game;
     int key;
 };

 #endif // STATES_H

      <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.

      The documentation provided herein is licensed under the terms of the
      GNU Free Documentation
      License version 1.3 as published by the Free Software Foundation.

      Documentation sources may be obtained from
      www.qt-project.org.

      Digia, Qt and their respective logos are trademarks of Digia Plc
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. Privacy Policy


text:
<?php

namespace AsyncInterop\Loop;

/**
 * MUST be thrown if any operation (except disable() and cancel()) is attempted with an invalid watcher identifier.
 *
 * An invalid watcher identifier is any identifier that is not yet emitted by the driver or cancelled by the user.
 */
class InvalidWatcherException extends \Exception
{
    /** @var string */
    private $watcherId;

    /**
     * @param string $watcherId The watcher identifier.
     * @param string|null $message The exception message.
     */
    public function __construct($watcherId, $message = null)
    {
        $this->watcherId = $watcherId;

        if ($message === null) {
            $message = "An invalid watcher identifier has been used: '{$watcherId}'";
        }

        parent::__construct($message);
    }

    /**
     * @return string The watcher identifier.
     */
    public function getWatcherId()
    {
        return $this->watcherId;
    }
}


text:
import java.lang.reflect.Executable

case class Tested(foo: Int, bar: String, baz: Double):
  def target(abc: Tested, efg: Tested) = ()
  def symbolic(`def`: Int, *** : Int, `unary_!`: Int) = ()

def run(cls: Class[_]) =
  extension(m: Executable) def parameters: List[String] = m.getParameters.toList.map(_.getName)

  val ctorParams = cls.getConstructors.head.parameters
    assert(ctorParams == List("foo", "bar", "baz"))

    val targetParams = cls.getMethods.toList.find(_.getName == "target").get.parameters
    assert(targetParams == List("abc", "efg"))

    val symbolicParams = cls.getMethods.toList.find(_.getName == "symbolic").get.parameters
    assert(symbolicParams == List("def", "$times$times$times", "unary_$bang"))

@main def Test =
  run(classOf[TestedOld])
  run(classOf[Tested])


text:
package org.jentrata.ebms;

import org.apache.camel.Exchange;

public class EbmsConstants {

    public static final String JENTRATA_VERSION = "JentrataVersion";

    //Jentrata Message Header keys
    public static final String SOAP_VERSION = "JentrataSOAPVersion";
    public static final String EBMS_VERSION = "JentrataEBMSVersion";
    public static final String VALID_PARTNER_AGREEMENT = "JentrataIsValidPartnerAgreement";
    public static final String EBMS_MESSAGE_MEP = "JentrataMEP";

    public static final String SOAP_VERSION_1_1 = "1.1";
    public static final String SOAP_VERSION_1_2 = "1.2";

    public static final String SOAP_1_1_NAMESPACE = "http://schemas.xmlsoap.org/soap/envelope/";

    public static final String SOAP_1_2_NAMESPACE = "http://www.w3.org/2003/05/soap-envelope";
    public static final String EBXML_V2_NAMESPACE = "http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd";

    public static final String EBXML_V3_NAMESPACE = "http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/";

    public static final String EBMS_V2 = "ebMSV2";
    public static final String EBMS_V3 = "ebMSV3";

    public static final String EBMS_V3_MEP_ONE_WAY = "http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/oneWay";
    public static final String EBMS_V3_MEP_TWO_WAY = "http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/twoWay";

    public static final String EBMS_V3_MEP_BINDING_PUSH = "ttp://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/push";

    public static final String EBMS_RECEIPT_REQUIRED = "JentrataReceiptRequired";

    public static final String CONTENT_ID = "Content-ID";
    public static final String CONTENT_LENGTH = Exchange.CONTENT_LENGTH;
    public static final String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
    public static final String CONTENT_DISPOSITION = "Content-Disposition";
    public static final String CONTENT_TYPE = Exchange.CONTENT_TYPE;

    public static final String SOAP_XML_CONTENT_TYPE = "application/soap+xml";
    public static final String TEXT_XML_CONTENT_TYPE = "text/xml";
    public static final String MESSAGE_ID = "JentrataMessageID";
    public static final String REF_TO_MESSAGE_ID = "JentrataRefMessageID";
    public static final String MESSAGE_FROM = "JentrataFrom";
    public static final String MESSAGE_FROM_TYPE = "JentrataFromPartyIdType";
    public static final String MESSAGE_FROM_ROLE = "JentrataPartyFromRole";
    public static final String MESSAGE_TO = "JentrataTo";
    public static final String MESSAGE_TO_TYPE = "JentrataToPartyIdType";
    public static final String MESSAGE_TO_ROLE = "JentrataPartyToRole";
    public static final String MESSAGE_AGREEMENT_REF = "JentrataAgreementRef";
    public static final String MESSAGE_PART_PROPERTIES = "JentraraPartProperties";
    public static final String MESSAGE_PAYLOAD_SCHEMA = "JentrataPayloadSchema";
    public static final String MESSAGE_DIRECTION = "JentrataMessageDirection";
    public static final String MESSAGE_DIRECTION_INBOUND = "inbox";
    public static final String MESSAGE_DIRECTION_OUTBOUND = "outbox";
    public static final String MESSAGE_STATUS = "JentrataMessageStatus";
    public static final String MESSAGE_STATUS_DESCRIPTION = "JentrataMessageStatusDesc";
    public static final String MESSAGE_TYPE = "JentrataMessageType";
    public static final String MESSAGE_SERVICE = "JentrataService";
    public static final String MESSAGE_ACTION = "JentrataAction";
    public static final String MESSAGE_CONVERSATION_ID = "JentrataConversationId";
    public static final String CPA = "JentrataCPA";
    public static final String CPA_ID = "JentrataCPAId";
    public static final String PAYLOAD_ID = "JentrataPayloadId";
    public static final String PAYLOAD_FILENAME = "JentrataPayloadFilename";
    public static final String PAYLOAD_COMPRESSION = "JentrataPayloadCompression";
    public static final String CPA_ID_UNKNOWN = "UNKNOWN";
    public static final String CONTENT_CHAR_SET = "JentrataCharSet";
    public static final String SOAP_BODY_PAYLOAD_ID = "soapbodypart";
    public static final String SECURITY_CHECK = "JentrataSecurityCheck";
    public static final String SECURITY_RESULTS = "JentrataSecurityResults";

    public static final String SECURITY_ERROR_CODE = "JentrataSecurityErrorCode";
    public static final String EBMS_ERROR = "JentrataEbmsError";
    public static final String EBMS_ERROR_CODE = "JentrataEbmsErrorCode";
    public static final String EBMS_ERROR_DESCRIPTION = "JentrataEbmsErrorDesc";
    public static final String MESSAGE_PAYLOADS = "JentrataPayloads";
    public static final String COMPRESSION_TYPE = "CompressionType";
    public static final String GZIP = "application/gzip";
    public static final String MESSAGE_DATE = "JentrataMessageDate";
    public static final String MESSAGE_RECEIPT_PATTERN = "JentrataMessageReceipt";
    public static final String MESSAGE_DUP_DETECTION = "JentrataDupDetection";
    public static final String DUPLICATE_MESSAGE = "JentrataIsDuplicateMessage";
    public static final String DUPLICATE_MESSAGE_ID = "JentrataDuplicateMessageId";
    public static final String VALIDATION_ERROR_DESC = "JentrataValidationErrorDesc";
    public static final String EBMS_VALIDATION_ERROR = "JentrataValidationError";

    public static final String DEFAULT_CPA_ID = "JentrataDefaultCPAId";
    public static final String DELIVERY_ERROR = "JentrataDeliveryError";
}


text:
Smart Column Colors
=

This plugin alert us when we reach a defined amount of characters per line.

Instead of showing a line over all the content, showing the limit,
SmartColumnColors displays a bg/fg distinctive for that character in particular.

How it looks? (red character)
-
![ScreenShot](https://raw.githubusercontent.com/gagoar/SmartColumnColors/master/screenshot.png)

Install
-

if you are using [janus](https://github.com/carlhuda/janus), put it under ~/.janus like this:

``` bash
  git clone git@github.com:gagoar/SmartColumnColors.git
```

then all you need to do is restart your vim/mvim

Options (colors, column limit)
-

Custom column number? (on your .vimrc/.vimrc.after)

``` vim
  let g:smart_display_opts = { 'column' : NN }
```
where NN it's the column number that you want highlighted

Custom Highlighted colors? (on your .vimrc/.vimrc.after)

``` vim
  let g:smart_display_opts = {'guifg': 'White', 'guibg': 'Red' }
```

`note` you could use all the properties mentioned erlier in the same
declaration:

``` vim
  let g:smart_display_opts = {'guifg': 'White', 'guibg': 'Red', 'column' : 82 }
```

Alternative Column
-
To enable a secondary column line declare
```vim
  let b:enable_alternative_smart_column = 1
```
or customize it with the same [options](#options-colors-column-limit)
```vim
  let g:smart_display_alternative_opts = {'guifg': 'White', 'guibg': 'Red' , 'column': 120} " defaults
```

Disabling
-

To disable it globally place the following in your `.vimrc`:
``` vim
  let g:loaded_SmartColumnColors = 1
```

To disable it for just the current buffer set the following anywhere it makes sense:
``` vim
  let b:disable_SmartColumnColors = 1
```

If you just wanted to do that temporarily you can execute in your vim:
``` vim
  set b:disable_SmartColumnColors = 0
```

or

``` vim
  unlet b:disable_SmartColumnColors` and it will start working again.
```


text:
package org.jboss.resteasy.reactive.server.vertx.test.resource.basic.resource;

import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;

public interface SubResourceLocatorFoo<T> {
    @GET
    T getFoo(@HeaderParam("foo") String val);
}


text:
package org.apache.ambari.server.controller.internal;

import java.util.Collection;

/**
 * Indicates that there is a problem with the cluster topology configuration.
 */
public class ConfigurationTopologyException extends Exception {
  public ConfigurationTopologyException(Collection<String> properties) {
    super(String.format("Unable to resolve host names for the following configuration properties %s", properties));
  }

  public ConfigurationTopologyException(String s) {
    super(s);
  }

  public ConfigurationTopologyException(String s, Throwable throwable) {
    super(s, throwable);
  }
}


text:
/* $Id$ */

package com.zoho.books.model;

import org.json.JSONObject;

/**

* This class is used to make an object for payment gateway.

*/

public class PaymentGateway
{
	private String gatewayName = "";
	private String identifier = "";
	private String additionalField1 = "";
	private String additionalField2 = "";
	private String additionalField3 = "";
	private String currencyId = "";
	private String currencyCode = "";
	private String supportedCurrencies = "";
	private boolean enabled = false;
	private boolean configured = false;

	private String nameFormatted = "";
	private String name = "";
	private String paymentType = "";

	/**

	* set the gateway name.

	* @param gatewayName  Name of the payment gateway associated with the invoice. E.g. paypal, google_check_out.

	*/

	public void setGatewayName(String gatewayName)
	{
		this.gatewayName = gatewayName;
	}

	/**

	* get the gateway name.

	* @return Returns the name of the payment gateway associated with the invoice.

	*/

	public String getGatewayName()
	{
		return gatewayName;
	}

	/**

	* set the identifier.

	* @param identifier  Identifier of the payment gateway.

	*/

	public void setIdentifier(String identifier)
	{
		this.identifier = identifier;
	}

	/**

	* get the identifier.

	* @return Returns the identifier of the payment gateway.

	*/

	public String getIdentifier()
	{
		return identifier;
	}

	/**

	* set the additional field1.

	* @param additionalField1  Paypal payment method.

	*/

	public void setAdditionalField1(String additionalField1)
	{
		this.additionalField1 = additionalField1;
	}

	/**

	* get the additional field1.

	* @return Returns the paypal payment method.

	*/

	public String getAdditionalField1()
	{
		return additionalField1;
	}

	/**

	* set the additional field2.

	* @param additionalField2  Paypal payment method.

	*/

	public void setAdditionalField2(String additionalField2)
	{
		this.additionalField2 = additionalField2;
	}

	/**

	* get the additional field2.

	* @return Returns the paypal payment method.

	*/

	public String getAdditionalField2()
	{
		return additionalField2;
	}

	/**

	* set the additional field3.

	* @param additionalField3  Paypal payment method.

	*/

	public void setAdditionalField3(String additionalField3)
	{
		this.additionalField3 = additionalField3;
	}

	/**

	* get the additional field3.

	* @return Returns the paypal payment method.

	*/

	public String getAdditionalField3()
	{
		return additionalField3;
	}

	/**

	* set the currency id.

	* @param currencyId  ID of the currency.

	*/

	public void setCurrencyId(String currencyId)
	{
		this.currencyId = currencyId;
	}

	/**

	* get the currency id.

	* @return Returns the ID of the currency.

	*/

	public String getCurrencyId()
	{
		return currencyId;
	}

	/**

	* set the currency code.

	* @param currencyCode  Standard code of the currency.

	*/

	public void setCurrencyCode(String currencyCode)
	{
		this.currencyCode = currencyCode;
	}

	/**

	* get the currency code.

	* @return Returns the standard code of the currency.

	*/

	public String getCurrencyCode()
	{
		return currencyCode;
	}

	/**

	* set the supported currencies.

	* @param supportedCurrencies  Supported currencies for the payment gateway.

	*/

	public void setSupportedCurrencies(String supportedCurrencies)
	{
		this.supportedCurrencies = supportedCurrencies;
	}

	/**

	* get the supported currencies.

	* @return Returns the supported currencies for the payment gateway.

	*/

	public String getSupportedCurrencies()
	{
		return supportedCurrencies;
	}

	/**

	* set is enabled.

	* @param enabled  To determine whether the payment gateway is enabled or disabled.

	*/

	public void setEnabled(boolean enabled)
	{
		this.enabled = enabled;
	}

	/**

	* get is enabled.

	* @return Returns true if the payment gateway is enable else returns false.

	*/

	public boolean isEnabled()
	{
		return enabled;
	}

	/**

	* set is configured.

	* @param configured  To determine whether the payment gateway is configured or not.

	*/

	public void setConfigured(boolean configured)
	{
		this.configured = configured;
	}

	/**

	* get is configured.

	* @return Returns true if the payment gateway is configured else returns false.

	*/

	public boolean isConfigured()
	{
		return configured;
	}

	/**

	* set the name format.

	* @param nameFormatted  Format of the gateway name.

	*/

	public void setNameFormatted(String nameFormatted)
	{
		this.nameFormatted = nameFormatted;
	}

	/**

	* get the name format.

	* @return Returns the format of the gateway name.

	*/

	public String getNameFormatted()
	{
		return nameFormatted;
	}

	/**

	* set the name.

	* @param name  Name of the gateway.

	*/

	public void setName(String name)
	{
		this.name = name;
	}

	/**

	* get the name.

	* @return Returns the name of the gateway.

	*/

	public String getName()
	{
		return name;
	}

	/**

	* set the payment type.

	* @param paymentType  Type of the payment gateway.

	*/

	public void setPaymentType(String paymentType)
	{
		this.paymentType = paymentType;
	}

	/**

	* get the payment type.

	* @return Returns the type of the payment gateway.

	*/

	public String getPaymentType()
	{
		return paymentType;
	}

	/**

	* Convert PaymentGateway object into JSONObject.

	* @return Returns a JSONObject.

	*/

	public JSONObject toJSON()throws Exception
	{
		JSONObject jsonObject = new JSONObject();

		if(gatewayName != null && !gatewayName.equals(""))
		{
			jsonObject.put("gateway_name", gatewayName);
		}

		if(additionalField1 != null && !additionalField1.equals(""))
		{
			jsonObject.put("additional_field1", additionalField1);
		}

		return jsonObject;
	}

}


text:
using SixLabors.Shapes;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.ConstrainedExecution;
using System.Windows.Forms;
using TQVaultAE.Domain.Contracts.Providers;
using TQVaultAE.Domain.Contracts.Services;
using TQVaultAE.Domain.Entities;
using TQVaultAE.Domain.Helpers;
using TQVaultAE.GUI.Helpers;

namespace TQVaultAE.GUI.Components
{
	public partial class ComboBoxCharacterItem : UserControl
	{
		/// <summary>
		/// Default Height for this control
		/// </summary>
		internal const int BASE_HEIGHT = 60;

		private ComboBoxCharacterDropDown DropDown;
		private IDatabase Database;
		private ITagService TagService;
		private ITranslationService TranslationService;
		private IFontService FontService;

		/// <summary>
		/// a <see cref="PlayerSave"/> or a <see cref="string"/>
		/// </summary>
		public object Item { get; private set; }

		public ComboBoxCharacterItem()
		{
			InitializeComponent();

			this.scalingLabelTags.Text = $"{Presentation.Resources.GlobalTags} : ";
			this.scalingLabelArchived.Text = Presentation.Resources.GlobalArchived;

			this.ProcessAllControls(ctr =>
			{
				ctr.Click += Ctr_Click;
				ctr.MouseEnter += Ctr_MouseEnter;
				ctr.MouseLeave += Ctr_MouseLeave;
			});
		}

		private void Ctr_MouseLeave(object sender, EventArgs e)
		{
			this.BackColor = Color.White;
		}

		private void Ctr_MouseEnter(object sender, EventArgs e)
		{
			this.BackColor = SystemColors.MenuHighlight;
		}

		public event EventHandler SelectedItemChanged;
		private void Ctr_Click(object sender, EventArgs e)
		{
			SelectedItemChanged?.Invoke(this, EventArgs.Empty);
		}

		public void Init(ComboBoxCharacterDropDown dropDown, object item, ITranslationService translationService, IFontService fontService, IDatabase database, ITagService tagService)
		{
			this.Item = item;
			this.TranslationService = translationService;
			this.FontService = fontService;
			this.DropDown = dropDown;
			this.Database = database;
			this.TagService = tagService;

			this.scalingLabelCharName.Font = FontService.GetFont(this.scalingLabelCharName.Font.Size);
			this.scalingLabelPlayerHeader.Font =
			this.scalingLabelLevel.Font =
			this.scalingLabelCLassName.Font = FontService.GetFont(this.scalingLabelCLassName.Font.Size);
			this.scalingLabelTags.Font =
			this.scalingLabelMasteries.Font =
			this.scalingLabelModName.Font =
			this.scalingLabelArchived.Font = FontService.GetFontLight(this.scalingLabelArchived.Font.Size);

			this.scalingLabelArchived.Visible =
			this.bufferedFlowLayoutPanelTags.Visible =
			this.bufferedFlowLayoutPanelSubTitle.Visible =
			this.scalingLabelModName.Visible =
			this.scalingLabelArchived.Visible = false;

			this.scalingLabelCharName.Text =
			this.scalingLabelPlayerHeader.Text =
			this.scalingLabelLevel.Text =
			this.scalingLabelCLassName.Text = string.Empty;
		}

		public void RefreshContent()
		{
			this.Invoke(_RefreshContent);
		}

		private void _RefreshContent()
		{
			if (this.Item is PlayerSave ps)
			{
				this.scalingLabelCharName.Text = ps.Name;
				this.scalingLabelPlayerHeader.Text = ps.Info?.HeaderVersion.ToString();

				this.scalingLabelLevel.Text = ps.Info?.CurrentLevel is null
					? string.Empty
					: $"{TranslationService.TranslateXTag("tagMenuImport05")} : {ps.Info.CurrentLevel}";

				this.scalingLabelCLassName.Text = ps.Info?.Class is null
					? string.Empty
					: TranslationService.TranslateXTag(ps.Info.Class, true, true);

				// Masteries
				this.scalingLabelMasteries.Text = string.Empty;
				List<string> masteryNames = new();
				var dbr = ps.Info?.ActiveMasteriesRecordNames;
				if (dbr?.Any() ?? false)
				{
					foreach (var recId in dbr)
					{
						var masteryInfo = this.Database.GetInfo(recId);
						var masteryName = this.TranslationService.TranslateXTag(masteryInfo.DescriptionTag);
						masteryNames.Add(masteryName);
					}
					this.scalingLabelMasteries.Text = masteryNames.JoinString(" + ");
					this.bufferedFlowLayoutPanelSubTitle.Visible = this.scalingLabelMasteries.Visible = true;
				}

				// Mod
				// TODO - How to link a character Save with a mod ?

				#region Tags

				this.scalingLabelArchived.Visible =
				this.bufferedFlowLayoutPanelTags.Visible = false;

				// Is Archived
				this.scalingLabelArchived.Visible = ps.IsArchived;

				this.ClearTagList();

				this.TagService.LoadTags(ps);

				if (ps.Tags.Any())
				{
					// refresh assigned tag list
					int idx = 0;
					foreach (var tag in ps.Tags)
					{
						var ctr = new ScalingLabel()
						{
							Name = ComboBoxCharacter.TAGKEY + idx++,
							Text = tag.Key,
							BackColor = tag.Value,
							Font = FontService.GetFontLight(this.scalingLabelArchived.Font.Size),
							AutoSize = true,
						};
						ctr.MouseEnter += Ctr_MouseEnter;
						ctr.MouseLeave += Ctr_MouseLeave;
						this.bufferedFlowLayoutPanelTags.Controls.Add(ctr);
					}
				}

				if (ps.Tags.Any() || ps.IsArchived)
					this.scalingLabelTags.Visible = this.bufferedFlowLayoutPanelTags.Visible = true;

				#endregion
			}
			else if (this.Item is string str)
			{
				this.scalingLabelCharName.Text = str;
				this.scalingLabelPlayerHeader.Text =
				this.scalingLabelLevel.Text =
				this.scalingLabelCLassName.Text = string.Empty;
			}
		}

		private void ClearTagList()
		{
			this.bufferedFlowLayoutPanelTags.Controls.OfType<ScalingLabel>()
				.Where(ctr => ctr.Name.StartsWith(ComboBoxCharacter.TAGKEY))
				.ToList().ForEach(ctr => this.bufferedFlowLayoutPanelTags.Controls.Remove(ctr));
		}
	}
}


text:
package com.artclod.mathml.scalar.apply.trig

import com.artclod.mathml.scalar._
import com.artclod.mathml.scalar.concept._

import scala.util._

case class ApplyTan(value: MathMLElem) extends UnaryFunction(value, Tan) {

	override def eval(b: Map[String, Double]) = Try(Trigonometry.tan(v.eval(b).get))

	override def constant: Option[Constant] = v.c match {
		case Some(v) => Some(Trigonometry.tan(v))
		case _ => None
	}

	def simplifyStep() = ApplyTan(v.s)

	def derivative(x: String) = (ApplySec(v.s) ^ `2`) * v.d(x)

	override def toMathJS: String = "tan(" + value.toMathJS + ")"

}


text:
 <?php echo $heading; ?>

<a href="<?php echo site_url('admin/home'); ?>"> Home

<a href="<?php echo site_url('admin/groupplan'); ?>"> Group plans

<?php echo $heading; ?>

<?php
if ($this->session->flashdata('success')) {
    ?>

            X
            <?= $this->session->flashdata('success') ?>

    <?php
    $this->session->set_flashdata('success', false);
} else if ($this->session->flashdata('error')) {
    ?>

            X
            <?= $this->session->flashdata('error') ?>

    <?php
    $this->session->set_flashdata('error', false);
} else {
    if (!empty(validation_errors())) {
        ?>

                X
                <?php echo validation_errors(); ?>

        <?php
    }
}
?>

            <form class="form-horizontal form-validate" action="" id="post_info" method="POST" enctype="multipart/form-data">

                            Group Name *

                                <input type="text" class="form-control" placeholder="Enter Group Name" name="name" value="<?php echo (isset($Groupplans['name'])) ? $Groupplans['name'] : set_value('name'); ?>">

                            Group Slogan

                                <input type="text" class="form-control" placeholder="Enter Group Slogan" name="slogan" value="<?php echo (isset($Groupplans['slogan'])) ? $Groupplans['slogan'] : set_value('slogan'); ?>">

                            Group Introduction

                                <textarea id="introduction" name="introduction" placeholder="Enter Group Introduction" class="form-control"><?php echo (isset($Groupplans['introduction'])) ? $Groupplans['introduction'] : set_value('introduction'); ?></textarea>

                            Group user limit

                                <input type="text" id="user_limit" name="user_limit" placeholder="Enter Group user Limit" class="form-control" value="<?php echo (isset($Groupplans['user_limit'])) ? $Groupplans['user_limit'] : set_value('user_limit'); ?>">

                            Group Image

                                    <input type="file" name="group_cover" id="uploadFile" class="file-styled">

                                    Choose Images

                        <?php
//                        pr($post_datas['media']);
                        if (isset($Groupplans['group_cover']) && !empty($Groupplans['group_cover'])) {
                            ?>

                                            <img src="<?php echo DEFAULT_GROUPPLAN_IMAGE_PATH . $Groupplans['group_cover']; ?>" alt="">

                            <?php
                        }
                        ?>

                            <button class="btn btn-success" type="submit">Save </button>

            </form>


text:
package org.kie.workbench.common.stunner.core.client.preferences;

import java.lang.annotation.Annotation;

import org.jboss.errai.ioc.client.api.ManagedInstance;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kie.workbench.common.stunner.core.client.ManagedInstanceStub;
import org.kie.workbench.common.stunner.core.preferences.StunnerPreferences;
import org.kie.workbench.common.stunner.core.util.DefinitionUtils;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class StunnerPreferencesRegistriesTest {

    private static final String DEF_SET_ID = "ds1";

    @Mock
    private DefinitionUtils definitionUtils;

    @Mock
    private StunnerPreferencesRegistry preferencesRegistry;
    private ManagedInstance<StunnerPreferencesRegistry> preferencesRegistries;

    @Mock
    private Annotation qualifier;

    @Mock
    private StunnerPreferences preferences;

    private StunnerPreferencesRegistries tested;

    @Mock
    private StunnerTextPreferences textPreferences;

    @Before
    @SuppressWarnings("unchecked")
    public void setUp() throws Exception {
        preferencesRegistries = spy(new ManagedInstanceStub<>(preferencesRegistry));
        when(preferencesRegistry.get(StunnerPreferences.class)).thenReturn(preferences);
        when(preferencesRegistry.get(StunnerTextPreferences.class)).thenReturn(textPreferences);
        when(definitionUtils.getQualifier(eq(DEF_SET_ID))).thenReturn(qualifier);
        tested = new StunnerPreferencesRegistries(definitionUtils,
                                                  preferencesRegistries);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void testGet() {
        StunnerPreferences instance = tested.get(DEF_SET_ID, StunnerPreferences.class);
        verify(preferencesRegistries, times(1)).select(eq(qualifier));
        assertEquals(preferences, instance);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void testGetTextPreferences() {
        StunnerTextPreferences instance = tested.get(DEF_SET_ID, StunnerTextPreferences.class);
        verify(preferencesRegistries, times(1)).select(eq(qualifier));
        assertEquals(textPreferences, instance);
    }
}


text:
namespace Google.Cloud.ArtifactRegistry.V1Beta2.Snippets
{
    // [START artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_sync]
    using Google.Cloud.ArtifactRegistry.V1Beta2;

    public sealed partial class GeneratedArtifactRegistryClientSnippets
    {
        /// <summary>Snippet for GetProjectSettings</summary>
        /// <remarks>
        /// This snippet has been automatically generated and should be regarded as a code template only.
        /// It will require modifications to work:
        /// - It may require correct/in-range values for request initialization.
        /// - It may require specifying regional endpoints when creating the service client as shown in
        ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
        /// </remarks>
        public void GetProjectSettingsRequestObject()
        {
            // Create client
            ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.Create();
            // Initialize request argument(s)
            GetProjectSettingsRequest request = new GetProjectSettingsRequest
            {
                ProjectSettingsName = ProjectSettingsName.FromProject("[PROJECT]"),
            };
            // Make the request
            ProjectSettings response = artifactRegistryClient.GetProjectSettings(request);
        }
    }
    // [END artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_sync]
}


text:
import numpy as np
import scipy.special

class NeuralNetwork(object):
    "my neural network"

    def __init__(self, inputnodes, hiddennodes, outputnodes, learningrate):
        # set number of nodes in each input, hidden, output layer
        self.inodes = inputnodes
        self.hnodes = hiddennodes
        self.onodes = outputnodes

        # link weight matrices, wih and who
        # weights inside the arrays are w_i_j, where link is from node i to node j in the next layer
        # w11 w21
        # w12 w22 etc
        self.wih = np.random.normal(
            0.0, pow(self.inodes, -0.5), (self.hnodes, self.inodes)
        )
        self.who = np.random.normal(
            0.0, pow(self.hnodes, -0.5), (self.onodes, self.hnodes)
        )

        # learning rate
        self.learningrate = learningrate

        # activation function is the sigmoid function
        self.activation_function = lambda x: scipy.special.expit(x)
        self.inverse_activation_function = lambda x: scipy.special.logit(x)

    def train(self, inputs_list, targets_list):
        "train the neural network"
        # convert inputs list to 2d array
        inputs = np.array(inputs_list, ndmin=2).T
        targets = np.array(targets_list, ndmin=2).T

        # calculate signals into hidden layer
        hidden_inputs = np.dot(self.wih, inputs)
        # calculate the signals emerging from hidden layer
        hidden_outputs = self.activation_function(hidden_inputs)

        # calculate signals into final output layer
        final_inputs = np.dot(self.who, hidden_outputs)
        # calculate the signals emerging from final output layer
        final_outputs = self.activation_function(final_inputs)

        # output layer error is the (target - actual)
        output_errors = targets - final_outputs
        # hidden layer error is the output_errors, split by weights, recombined at hidden nodes
        hidden_errors = np.dot(self.who.T, output_errors)

        # update the weights for the links between the hidden and output layers
        whodotmata = output_errors * final_outputs * (1.0 - final_outputs)
        whodotmatb = np.transpose(hidden_outputs)
        whodot = np.dot(whodotmata, whodotmatb)
        self.who += self.learningrate * whodot

        # update the weights for the links between the input and hidden layers
        wihdotmata = hidden_errors * hidden_outputs * (1.0 - hidden_outputs)
        wihdotmatb = np.transpose(inputs)
        wihdot = np.dot(wihdotmata, wihdotmatb)
        self.wih += self.learningrate * wihdot

    def query(self, inputs_list):
        "query the neural network"
        inputs = np.array(inputs_list, ndmin=2).T

        # calculate signals into hidden layer
        hidden_inputs = np.dot(self.wih, inputs)
        # calculate the signals emerging from hidden layer
        hidden_outputs = self.activation_function(hidden_inputs)

        # calculate signals into final output layer
        final_inputs = np.dot(self.who, hidden_outputs)
        # calculate the signals emerging from final output layer
        final_outputs = self.activation_function(final_inputs)

        return final_outputs

    def backquery(self, targets_list):
        "backquery the neural network"
        final_outputs = np.array(targets_list, ndmin=2).T
        final_inputs = self.inverse_activation_function(final_outputs)
        hidden_outputs = np.dot(self.who.T, final_inputs)

        hidden_outputs -= np.min(hidden_outputs)
        hidden_outputs /= np.max(hidden_outputs)
        hidden_outputs *= 0.98
        hidden_outputs += 0.01

        hidden_inputs = self.inverse_activation_function(hidden_outputs)

        inputs = np.dot(self.wih.T, hidden_inputs)

        inputs -= np.min(inputs)
        inputs /= np.max(inputs)
        inputs *= 0.98
        inputs += 0.01

        return inputs


text:
<?php

if(!defined('SRCPATH'))
{
	define('SRCPATH', realpath(dirname(__FILE__).'/../../../src/PASL'));
	ini_set('include_path', get_include_path().PATH_SEPARATOR . SRCPATH);
}

require_once('simpletest/autorun.php');
require_once('DB/DB.php');
require_once('Authentication/Authentication.php');

class PASL_AuthenticationTest extends UnitTestCase
{
	public $strMyDsn;
	public $aMyDsn = Array();

	public $aPostCredentials = Array();
	public $aPostCredentialsMD5 = Array();

	function PASL_AuthenticationTest()
	{
		$this->UnitTestCase("PASL Authetication Tests");

		/* !!! CANNOT RUN THIS TEST WITHOUT POINTING AT A LIVE DSN !!! */
		$this->strMyDsn = "mysql://openpasl_test:openpasl_test@localhost/openpasl_test";

		$this->aMyDsn["phptype"] = "mysql";
		$this->aMyDsn["hostspec"] = "localhost";
		$this->aMyDsn["database"] = "openpasl_test";
		$this->aMyDsn["dsn"] = $this->strMyDsn;
		$this->aMyDsn["username"] = "openpasl_test";
		$this->aMyDsn["password"] = "openpasl_test";
		$this->aMyDsn["dbsyntax"] = '';
		$this->aMyDsn["protocol"] = 'tcp';

		$this->aPostCredentials['username'] = 'openpasl_test';
		$this->aPostCredentials['password'] = 'openpasl_test';

		$this->aPostCredentialsMD5['username'] = 'openpasl_test_md5';
		$this->aPostCredentialsMD5['password'] = 'openpasl_test';

		$this->aBadUser['username'] = 'x_openpasl_test';
		$this->aBadUser['password'] = 'openpasl_test';

		$this->aBadPassword['username'] = 'openpasl_test';
		$this->aBadPassword['password'] = 'x_openpasl_test';
	}

	function TestProvider_mysql()
	{
		$db = \PASL\DB::singleton($this->strMyDsn);

		$oAuth = new \PASL\Authentication('mysql');
		$authProvider = $oAuth->getProvider();

		$this->assertIsA($authProvider, "PASL\Authentication\iProvider");
		$this->assertIsA($authProvider, "PASL\Authentication\Provider_mysql");
	}

	function TestAuth_mysql()
	{
		$db = \PASL\DB::singleton($this->strMyDsn);

		$oAuth = new PASL_Authentication('mysql');

		/**
		 * @var PASL_Authentication_Provider_mysql
		 */
		$authProvider = $oAuth->getProvider();
		$authProvider->setDriver($db);
		$authProvider->setQuery('SELECT * FROM `pasl_authentication_tests` WHERE `username`="%s" LIMIT 1');

		// Set encryption to none
		$authProvider->setEncryption('none');

		$this->assertTrue($oAuth->authenticate($this->aPostCredentials));
	}

	function TestAuth_mysql_md5()
	{
		$db = \PASL\DB::singleton($this->strMyDsn);

		$oAuth = new \PASL\Authentication('mysql');

		/**
		 * @var PASL_Authentication_Provider_mysql
		 */
		$authProvider = $oAuth->getProvider();
		$authProvider->setDriver($db);
		$authProvider->setQuery('SELECT * FROM `pasl_authentication_tests` WHERE `username`="%s" LIMIT 1');

		$this->assertTrue($oAuth->authenticate($this->aPostCredentialsMD5));
	}

	function TestAuth_mysql_saml()
	{

	}

	function TestAuth_mysql_bad_user()
	{
		$db = \PASL\DB::singleton($this->strMyDsn);

		$oAuth = new \PASL\Authentication('mysql');

		/**
		 * @var PASL_Authentication_Provider_mysql
		 */
		$authProvider = $oAuth->getProvider();
		$authProvider->setDriver($db);
		$authProvider->setEncryption('none');
		$authProvider->setQuery('SELECT * FROM `pasl_authentication_tests` WHERE `username`="%s" LIMIT 1');

		$this->assertFalse($oAuth->authenticate($this->aBadUser));

		$oErr = $oAuth->getError();
		$this->assertEqual($oErr, PASL_AUTH_BAD_USER);
	}

	function TestAuth_mysql_bad_password()
	{
		$db = \PASL\DB::singleton($this->strMyDsn);

		$oAuth = new \PASL\Authentication('mysql');

		/**
		 * @var PASL_Authentication_Provider_mysql
		 */
		$authProvider = $oAuth->getProvider();
		$authProvider->setDriver($db);
		$authProvider->setEncryption('none');
		$authProvider->setQuery('SELECT * FROM `pasl_authentication_tests` WHERE `username`="%s" LIMIT 1');

		$this->assertFalse($oAuth->authenticate($this->aBadPassword));

		$oErr = $oAuth->getError();
		$this->assertEqual($oErr, PASL_AUTH_BAD_PASSWORD);
	}
}
?>


text:
#ifndef __CFORMATELEMENT__MULBERRY__
#define __CFORMATELEMENT__MULBERRY__

#include "ETag.h"

#include "cdstring.h"

#if __dest_os == __win32_os
#include "jWin.h"
#include "Mac2Win.h"
#endif

#if __dest_os == __linux_os
class CFormattedTextDisplay;
typedef CFormattedTextDisplay CDisplayFormatter;

#include <jColor.h>

#elif __dest_os == __mac_os || __dest_os == __mac_os_x
#define CDisplayFormatter CFormattedTextDisplay
class CDisplayFormatter;
#else
class CDisplayFormatter;
#endif

class CFormatElement
{
public:
	CFormatElement();
	CFormatElement(SInt32 start, SInt32 stop);
	virtual ~CFormatElement();
	void setStart(SInt32 start);
	SInt32 getStart();
	void setStop(SInt32 stop);
	virtual void draw(CDisplayFormatter *display)=0;
	CFormatElement *next;
protected:
	int start;
	int stop;
};

class CFontFormatElement : public CFormatElement
{
public:
	CFontFormatElement();
	CFontFormatElement(SInt32 start, SInt32 stop, const char *font);
	virtual ~CFontFormatElement();
	void draw(CDisplayFormatter *display);
private:
	cdstring font;
};

class CColorFormatElement : public CFormatElement
{
public:
	CColorFormatElement();
	CColorFormatElement(SInt32 start, SInt32 stop, int r, int g, int b);
	CColorFormatElement(SInt32 start, SInt32 stop, RGBColor color);
	CColorFormatElement(SInt32 start, SInt32 stop, const char* color, bool background = false);
	void draw(CDisplayFormatter *display);
	void setColor(int r, int g, int b);
	RGBColor getColor() const
		{ return color; }
private:
	RGBColor color;
};

class CFontSizeFormatElement : public CFormatElement
{
public:
	CFontSizeFormatElement();
	CFontSizeFormatElement(SInt32 start, SInt32 stop, short change, bool add = true, bool override = false);
	void draw(CDisplayFormatter *display);
private:
	short sizeChange;
	bool adding;
	bool overrideprefs;
};

class CAlignmentFormatElement : public CFormatElement
{
public:
	CAlignmentFormatElement();
	CAlignmentFormatElement(SInt32 start, SInt32 stop, ETag tag);
	void draw(CDisplayFormatter *display);
private:
	ETag tagid;
};

class CFaceFormatElement : public CFormatElement
{
public:
	CFaceFormatElement();
	CFaceFormatElement(SInt32 start, SInt32 stop, ETag tag);
	void draw(CDisplayFormatter *display);
private:
	ETag tagid;
};

class CExcerptFormatElement : public CFormatElement
{
public:
	CExcerptFormatElement();
	CExcerptFormatElement(SInt32 start, SInt32 stop);
	CExcerptFormatElement(SInt32 start, SInt32 stop, char ex);
	void draw(CDisplayFormatter *display);
private:
	char Excerpt;
};

#endif


text:
<?xml version="1.0" encoding="UTF-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:state_enabled="true" android:state_pressed="false" android:drawable="@drawable/renew_btn_normal" />
    <item android:state_enabled="true" android:state_pressed="true" android:drawable="@drawable/renew_btn_press" />
    <item android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/home_btn_bg_d" />
    <item android:drawable="@drawable/renew_btn_normal" />
</selector>


text:
#include "cp15.h"
#include <rtdef.h>

/** Set CNTFRQ
 *  This function assigns the given value to PL1 Physical Timer Counter Frequency Register (CNTFRQ).
 *  @param value: CNTFRQ Register value to set
 */
static inline void __set_cntfrq(rt_uint32_t value)
{
    __set_cp(15, 0, value, 14, 0, 0);
}

/** Get CNTFRQ
 *  This function returns the value of the PL1 Physical Timer Counter Frequency Register (CNTFRQ).
 *  return CNTFRQ Register value
 */
static inline rt_uint32_t __get_cntfrq(void)
{
    rt_uint32_t result;
    __get_cp(15, 0, result, 14, 0 , 0);
    return result;
}

/** Set CNTP_TVAL
 *  This function assigns the given value to PL1 Physical Timer Value Register (CNTP_TVAL).
 *  param value: CNTP_TVAL Register value to set
 */
static inline void __set_cntp_tval(rt_uint32_t value)
{
    __set_cp(15, 0, value, 14, 2, 0);
}

/** Get CNTP_TVAL
 *  This function returns the value of the PL1 Physical Timer Value Register (CNTP_TVAL).
 *  return CNTP_TVAL Register value
 */
static inline rt_uint32_t __get_cntp_tval(void)
{
    rt_uint32_t result;
    __get_cp(15, 0, result, 14, 2, 0);
    return result;
}

/** Get CNTPCT
 *  This function returns the value of the 64 bits PL1 Physical Count Register (CNTPCT).
 *  return CNTPCT Register value
 */
static inline rt_uint64_t __get_cntpct(void)
{
    rt_uint64_t result;
    __get_cp64(15, 0, result, 14);
    return result;
}

/** Set CNTP_CVAL
 *  This function assigns the given value to 64bits PL1 Physical Timer CompareValue Register (CNTP_CVAL).
 *  param value: CNTP_CVAL Register value to set
*/
static inline void __set_cntp_cval(rt_uint64_t value)
{
    __set_cp64(15, 2, value, 14);
}

/** Get CNTP_CVAL
 *  This function returns the value of the 64 bits PL1 Physical Timer CompareValue Register (CNTP_CVAL).
 *  return CNTP_CVAL Register value
 */
static inline rt_uint64_t __get_cntp_cval(void)
{
    rt_uint64_t result;
    __get_cp64(15, 2, result, 14);
    return result;
}

/** Set CNTP_CTL
 *  This function assigns the given value to PL1 Physical Timer Control Register (CNTP_CTL).
 *  param value: CNTP_CTL Register value to set
 */
static inline void __set_cntp_ctl(uint32_t value)
{
    __set_cp(15, 0, value, 14, 2, 1);
}

/** Get CNTP_CTL register
 *  return CNTP_CTL Register value
 */
static inline rt_uint32_t __get_cntp_ctl(void)
{
    rt_uint32_t result;
    __get_cp(15, 0, result, 14, 2, 1);
    return result;
}

/** Configures the frequency the timer shall run at.
 *  param value The timer frequency in Hz.
 */
void gtimer_set_counter_frequency(rt_uint32_t value)
{
    __set_cntfrq(value);
    __asm__ volatile ("isb 0xF":::"memory");
}

/** Get the frequency the timer shall run at.
 *  return timer frequency in Hz.
 */
rt_uint32_t gtimer_get_counter_frequency(void)
{
    return(__get_cntfrq());
}

/** Sets the reset value of the timer.
 *  param value: The value the timer is loaded with.
 */
void gtimer_set_load_value(rt_uint32_t value)
{
    __set_cntp_tval(value);
    __asm__ volatile ("isb 0xF":::"memory");
}

/** Get the current counter value.
 *  return Current counter value.
 */
rt_uint32_t gtimer_get_current_value(void)
{
    return(__get_cntp_tval());
}

/** Get the current physical counter value.
 *  return Current physical counter value.
 */
rt_uint64_t gtimer_get_current_physical_value(void)
{
    return(__get_cntpct());
}

/** Set the physical compare value.
 *  param value: New physical timer compare value.
 */
void gtimer_set_physical_compare_value(rt_uint64_t value)
{
    __set_cntp_cval(value);
    __asm__ volatile ("isb 0xF":::"memory");
}

/** Get the physical compare value.
 *  return Physical compare value.
 */
rt_uint64_t gtimer_get_physical_compare_value(void)
{
    return(__get_cntp_cval());
}

/** Configure the timer by setting the control value.
 *  param value: New timer control value.
 */
void gtimer_set_control(rt_uint32_t value)
{
    __set_cntp_ctl(value);
    __asm__ volatile ("isb 0xF":::"memory");
}

/** Get the control value.
 *  return Control value.
 */
rt_uint32_t gtimer_get_control(void)
{
    return(__get_cntp_ctl());
}


text:
#ifdef AWS_MULTI_FRAMEWORK
#import <AWSRuntime/AmazonServiceException.h>
#else
#import "AmazonServiceException.h"
#endif

/**
 * <p>
 * An item collection is too large. This exception is only returned for
 * tables that have one or more local secondary indexes.
 * </p>
 */
@interface DynamoDBItemCollectionSizeLimitExceededException:AmazonServiceException
{
}

-(id)initWithMessage:(NSString *)message;

/**
 * Returns a string representation of this object; useful for testing and
 * debugging.
 *
 * @return A string representation of this object.
 */
-(NSString *)description;

@end


text:
<!doctype html>

    <meta charset="utf-8">
    <title>fancy animated menu</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">
    <link rel="shortcut icon" href="/favicon.ico">

    <link rel="stylesheet" href="styles/main.css">

Home

About us

Offer

Contact


text:
package org.craft.client.gui;

import java.io.*;
import java.util.*;

import javax.imageio.*;

import org.craft.client.*;
import org.craft.client.gui.widgets.*;
import org.craft.client.render.*;
import org.craft.client.render.fonts.*;
import org.craft.entity.*;
import org.craft.resources.*;
import org.craft.utils.*;
import org.craft.world.*;
import org.craft.world.loaders.*;
import org.craft.world.populators.*;

public class GuiSelectWorld extends Gui
{

    public class GuiWorldSlot extends GuiListSlot
    {

        private String worldFolderName;
        private String worldName;
        private String dateString;

        public GuiWorldSlot(String folderName, String name, long timestamp)
        {
            this.worldFolderName = folderName;
            this.worldName = name;
            Calendar calendar = (Calendar) Calendar.getInstance().clone();
            calendar.setTimeInMillis(timestamp);
            String hour = "" + calendar.get(Calendar.HOUR_OF_DAY);
            String minute = "" + calendar.get(Calendar.MINUTE);
            String second = "" + calendar.get(Calendar.SECOND);
            String day = "" + calendar.get(Calendar.DAY_OF_MONTH);
            if(hour.length() < 2)
                hour = "0" + hour;
            if(minute.length() < 2)
                minute = "0" + minute;
            if(second.length() < 2)
                second = "0" + second;
            if(day.length() < 2)
                day = "0" + day;
            dateString = hour + ":" + minute + ":" + second + " " + calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-" + day;

        }

        @Override
        public void render(int index, int x, int y, int w, int h, int mx, int my, boolean selected, RenderEngine engine, GuiList<?> owner)
        {
            if(selected)
                Gui.drawTexturedRect(engine, x, y, w, h, 0, 0, 1, 1);
            FontRenderer font = oc.getFontRenderer();
            font.drawShadowedString(worldName, 0xFFFFFFFF, x + 2, y, engine);
            font.drawShadowedString(worldFolderName, 0xFFC0C0C0, x + 2, y + 20, engine);
            font.drawShadowedString(dateString, 0xFFFFFFFF, x + 2, y + 40, engine);
        }

        /**
         * Returns world's folder name
         */
        public String getFolderName()
        {
            return worldFolderName;
        }

    }

    private File[]                   worldFolders;
    private GuiList<GuiWorldSlot>    worldList;
    private GuiButton                playButton;
    private HashMap<String, Texture> textureMap;
    private Texture                  worldSnapshot;
    private Shader                   worldSnapshotShader;
    private File                     saveFolder;
    private GuiButton                deleteButton;

    public GuiSelectWorld(OurCraft game, File saveFolder, File... worldFolders)
    {
        super(game);
        this.saveFolder = saveFolder;
        textureMap = new HashMap<String, Texture>();
        if(worldFolders == null)
            worldFolders = new File[0];
        this.worldFolders = worldFolders;

        try
        {
            worldSnapshotShader = new Shader(new String(oc.getAssetsLoader().getResource(new ResourceLocation("ourcraft/shaders", "worldSnap.vsh")).getData(), "UTF-8"), new String(oc.getAssetsLoader().getResource(new ResourceLocation("ourcraft/shaders", "worldSnap.fsh")).getData(), "UTF-8"));
        }
        catch(UnsupportedEncodingException e)
        {
            e.printStackTrace();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

    }

    @Override
    public boolean requiresMouse()
    {
        return true;
    }

    @Override
    public void init()
    {
        worldList = new GuiList<GuiWorldSlot>(2, oc.getDisplayWidth() / 8, oc.getDisplayHeight() / 8 - 40, oc.getDisplayWidth() - oc.getDisplayWidth() / 4, oc.getDisplayHeight() - oc.getDisplayHeight() / 4, 80);
        Arrays.sort(worldFolders, new Comparator<File>()
        {

            @Override
            public int compare(File a, File b)
            {
                File aWorldDataFile = new File(a, "world.data");
                File bWorldDataFile = new File(b, "world.data");
                if(aWorldDataFile.exists() && bWorldDataFile.exists())
                {
                    return Long.compare(bWorldDataFile.lastModified(), aWorldDataFile.lastModified());
                }
                return 1;
            }
        });
        for(File worldFolder : worldFolders)
        {
            File worldDataFile = new File(worldFolder, "world.data");
            if(worldDataFile.exists())
            {

                if(!worldFolder.exists())
                    worldFolder.mkdirs();
                WorldLoader worldLoader = new VanillaWorldLoader(new ResourceLocation(worldFolder.getName()), new DiskSimpleResourceLoader(worldFolder.getParentFile().getAbsolutePath()));

                HashMap<String, String> worldInfos = worldLoader.loadWorldInfos(worldDataFile);
                File snapshotFile = new File(worldFolder, "worldSnapshot.png");
                if(snapshotFile.exists())
                {
                    try
                    {
                        textureMap.put(worldFolder.getName(), OpenGLHelper.loadTexture(ImageIO.read(snapshotFile)));
                    }
                    catch(IOException e)
                    {
                        e.printStackTrace();
                    }
                }
                long timestamp = 0L;
                String name = worldFolder.getName();
                if(worldInfos.containsKey("timestamp"))
                    timestamp = Long.parseLong(worldInfos.get("timestamp"));
                if(worldInfos.containsKey("name"))
                    name = worldInfos.get("name");
                worldList.addSlot(new GuiWorldSlot(worldFolder.getName(), name, timestamp));
            }
        }
        playButton = new GuiButton(1, oc.getDisplayWidth() - oc.getDisplayWidth() / 8 - 200, oc.getDisplayHeight() - oc.getDisplayHeight() / 8 - 40, 200, 40, I18n.format("menu.selectworld.play"), getFontRenderer());
        playButton.enabled = false;
        addWidget(playButton);
        addWidget(worldList);
        addWidget(new GuiButton(3, oc.getDisplayWidth() / 8, oc.getDisplayHeight() - oc.getDisplayHeight() / 8 - 40, 200, 40, I18n.format("menu.selectworld.new"), getFontRenderer()));
        addWidget(new GuiButton(4, oc.getDisplayWidth() - oc.getDisplayWidth() / 8 - 200, oc.getDisplayHeight() - oc.getDisplayHeight() / 8 + 10, 200, 40, I18n.format("menu.back"), getFontRenderer()));

        deleteButton = new GuiButton(5, oc.getDisplayWidth() / 8, oc.getDisplayHeight() - oc.getDisplayHeight() / 8 + 10, 200, 40, I18n.format("menu.selectworld.delete"), getFontRenderer());
        deleteButton.enabled = false;
        addWidget(deleteButton);
    }

    public void actionPerformed(GuiWidget widget)
    {
        final int id = widget.getID();
        if(id == 1)
        {
            GuiWorldSlot worldSlot = worldList.getSelected();
            if(worldSlot != null)
            {
                launchGameOnWorld(worldSlot.getFolderName());
            }
        }
        else if(id == 2)
        {
            playButton.enabled = worldList.getSelected() != null;
            deleteButton.enabled = worldList.getSelected() != null;
            if(worldList.getSelected() != null)
            {
                String name = worldList.getSelected().worldFolderName;
                this.worldSnapshot = textureMap.get(name);
            }
            else
                worldSnapshot = null;
        }
        else if(id == 3)
        {
            oc.openMenu(new GuiCreateWorld(oc, saveFolder, worldFolders));
        }
        else if(id == 4)
        {
            oc.openMenu(new GuiMainMenu(oc));
        }
        else if(id == 5)
        {
            GuiWorldSlot worldSlot = worldList.getSelected();
            oc.openMenu(new GuiDeleteWorld(oc, saveFolder, worldFolders, worldSlot.worldFolderName));
        }
    }

    /**
     * Opens given world
     */
    private void launchGameOnWorld(String worldName)
    {
        WorldGenerator generator = new WorldGenerator();
        generator.addPopulator(new RockPopulator());
        generator.addPopulator(new GrassPopulator());
        generator.addPopulator(new TreePopulator());
        generator.addPopulator(new FlowerPopulator());
        WorldLoader worldLoader;
        try
        {
            File worldFolder = new File(SystemUtils.getGameFolder(), "worlds/" + worldName);
            if(!worldFolder.exists())
                worldFolder.mkdirs();
            worldLoader = new VanillaWorldLoader(new ResourceLocation(worldName), new DiskSimpleResourceLoader(worldFolder.getParentFile().getAbsolutePath()));
            World clientWorld = new World(worldName, new BaseChunkProvider(worldLoader), generator, worldLoader);

            EntityPlayer player = new EntityPlayer(clientWorld, oc.getSession().getUUID());
            player.setLocation(0, 160 + 17, 0);
            clientWorld.spawn(player);
            oc.getRenderEngine().setRenderViewEntity(player);
            oc.setPlayerController(new LocalPlayerController(player));

            Entity testEntity = new Entity(clientWorld);
            testEntity.setLocation(player.posX + 10, player.posY + 20, player.posZ);
            clientWorld.spawn(testEntity);

            new ThreadGetChunksFromCamera(oc).start();
            oc.setWorld(clientWorld);
            oc.setPlayer(player);
            oc.openMenu(new GuiIngame(oc));
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public void update()
    {
        super.update();
    }

    public void draw(int mx, int my, RenderEngine renderEngine)
    {
        drawBackground(mx, my, renderEngine);
        if(worldSnapshot != null)
        {
            Shader oldShader = renderEngine.getCurrentShader();
            renderEngine.setCurrentShader(worldSnapshotShader);
            renderEngine.bindTexture(worldSnapshot);
            drawTexturedRect(renderEngine, 0, 0, oc.getDisplayWidth(), oc.getDisplayHeight(), 0, 0, 1, 1);
            renderEngine.setCurrentShader(oldShader);
        }
        super.draw(mx, my, renderEngine);
    }
}


text:
//*****************************************************************************
//
// ref.c - Driver for the ref Module.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup ref_api ref
//! @{
//
//*****************************************************************************

#include "inc/hw_regaccess.h"
#include "inc/hw_memmap.h"

#ifdef __MSP430_HAS_REF__
#include "ref.h"

#include <assert.h>

void Ref_setReferenceVoltage(uint16_t baseAddress,
                             uint8_t referenceVoltageSelect)
{
    HWREG8(baseAddress + OFS_REFCTL0_L) &= ~(REFVSEL_3);
    HWREG8(baseAddress + OFS_REFCTL0_L) |= referenceVoltageSelect;
}

void Ref_disableTempSensor(uint16_t baseAddress)
{
    HWREG8(baseAddress + OFS_REFCTL0_L) |= REFTCOFF;
}

void Ref_enableTempSensor(uint16_t baseAddress)
{
    HWREG8(baseAddress + OFS_REFCTL0_L) &= ~(REFTCOFF);
}

void Ref_enableReferenceVoltageOutput(uint16_t baseAddress)
{
    HWREG8(baseAddress + OFS_REFCTL0_L) |= REFOUT;
}

void Ref_disableReferenceVoltageOutput(uint16_t baseAddress)
{
    HWREG8(baseAddress + OFS_REFCTL0_L) &= ~(REFOUT);
}

void Ref_enableReferenceVoltage(uint16_t baseAddress)
{
    HWREG8(baseAddress + OFS_REFCTL0_L) |= REFON;
}

void Ref_disableReferenceVoltage(uint16_t baseAddress)
{
    HWREG8(baseAddress + OFS_REFCTL0_L) &= ~(REFON);
}

uint16_t Ref_getBandgapMode(uint16_t baseAddress)
{
    return (HWREG16((baseAddress) + OFS_REFCTL0) & BGMODE);
}

bool Ref_isBandgapActive(uint16_t baseAddress)
{
    if(HWREG16((baseAddress) + OFS_REFCTL0) & REFBGACT)
    {
        return (REF_ACTIVE);
    }
    else
    {
        return (REF_INACTIVE);
    }
}

uint16_t Ref_isRefGenBusy(uint16_t baseAddress)
{
    return (HWREG16((baseAddress) + OFS_REFCTL0) & REFGENBUSY);
}

bool Ref_isRefGenActive(uint16_t baseAddress)
{
    if(HWREG16((baseAddress) + OFS_REFCTL0) & REFGENACT)
    {
        return (REF_ACTIVE);
    }
    else
    {
        return (REF_INACTIVE);
    }
}

#endif
//*****************************************************************************
//
//! Close the doxygen group for ref_api
//! @}
//
//*****************************************************************************


text:
package com.github.ltsopensource.alarm;

/**
 * @author Robert HG (254963746@qq.com) on 2/17/16.
 */
public class AlarmNotifyException extends RuntimeException {

    public AlarmNotifyException() {
        super();
    }

    public AlarmNotifyException(String message) {
        super(message);
    }

    public AlarmNotifyException(String message, Throwable cause) {
        super(message, cause);
    }

    public AlarmNotifyException(Throwable cause) {
        super(cause);
    }
}


text:
<?php

namespace CoreBundle\Model\om;

use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use CoreBundle\Model\EmpContact;
use CoreBundle\Model\EmpContactPeer;
use CoreBundle\Model\EmpContactQuery;
use CoreBundle\Model\EmpProfile;
use CoreBundle\Model\ListContTypes;

/**
 * @method EmpContactQuery orderById($order = Criteria::ASC) Order by the id column
 * @method EmpContactQuery orderByContact($order = Criteria::ASC) Order by the contact column
 * @method EmpContactQuery orderByEmpProfileId($order = Criteria::ASC) Order by the emp_profile_id column
 * @method EmpContactQuery orderByListContTypesId($order = Criteria::ASC) Order by the list_cont_types_id column
 *
 * @method EmpContactQuery groupById() Group by the id column
 * @method EmpContactQuery groupByContact() Group by the contact column
 * @method EmpContactQuery groupByEmpProfileId() Group by the emp_profile_id column
 * @method EmpContactQuery groupByListContTypesId() Group by the list_cont_types_id column
 *
 * @method EmpContactQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method EmpContactQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method EmpContactQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method EmpContactQuery leftJoinEmpProfile($relationAlias = null) Adds a LEFT JOIN clause to the query using the EmpProfile relation
 * @method EmpContactQuery rightJoinEmpProfile($relationAlias = null) Adds a RIGHT JOIN clause to the query using the EmpProfile relation
 * @method EmpContactQuery innerJoinEmpProfile($relationAlias = null) Adds a INNER JOIN clause to the query using the EmpProfile relation
 *
 * @method EmpContactQuery leftJoinListContTypes($relationAlias = null) Adds a LEFT JOIN clause to the query using the ListContTypes relation
 * @method EmpContactQuery rightJoinListContTypes($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ListContTypes relation
 * @method EmpContactQuery innerJoinListContTypes($relationAlias = null) Adds a INNER JOIN clause to the query using the ListContTypes relation
 *
 * @method EmpContact findOne(PropelPDO $con = null) Return the first EmpContact matching the query
 * @method EmpContact findOneOrCreate(PropelPDO $con = null) Return the first EmpContact matching the query, or a new EmpContact object populated from the query conditions when no match is found
 *
 * @method EmpContact findOneByContact(string $contact) Return the first EmpContact filtered by the contact column
 * @method EmpContact findOneByEmpProfileId(int $emp_profile_id) Return the first EmpContact filtered by the emp_profile_id column
 * @method EmpContact findOneByListContTypesId(int $list_cont_types_id) Return the first EmpContact filtered by the list_cont_types_id column
 *
 * @method array findById(int $id) Return EmpContact objects filtered by the id column
 * @method array findByContact(string $contact) Return EmpContact objects filtered by the contact column
 * @method array findByEmpProfileId(int $emp_profile_id) Return EmpContact objects filtered by the emp_profile_id column
 * @method array findByListContTypesId(int $list_cont_types_id) Return EmpContact objects filtered by the list_cont_types_id column
 */
abstract class BaseEmpContactQuery extends ModelCriteria
{
    /**
     * Initializes internal state of BaseEmpContactQuery object.
     *
     * @param     string $dbName The dabase name
     * @param     string $modelName The phpName of a model, e.g. 'Book'
     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     */
    public function __construct($dbName = null, $modelName = null, $modelAlias = null)
    {
        if (null === $dbName) {
            $dbName = 'default';
        }
        if (null === $modelName) {
            $modelName = 'CoreBundle\\Model\\EmpContact';
        }
        parent::__construct($dbName, $modelName, $modelAlias);
    }

    /**
     * Returns a new EmpContactQuery object.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param   EmpContactQuery|Criteria $criteria Optional Criteria to build the query from
     *
     * @return EmpContactQuery
     */
    public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof EmpContactQuery) {
            return $criteria;
        }
        $query = new EmpContactQuery(null, null, $modelAlias);

        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }

    /**
     * Find object by primary key.
     * Propel uses the instance pool to skip the database if the object exists.
     * Go fast if the query is untouched.
     *
     *
     * $obj  = $c->findPk(12, $con);
     *
     *
     * @param mixed $key Primary key to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return   EmpContact|EmpContact[]|mixed the result, formatted by the current formatter
     */
    public function findPk($key, $con = null)
    {
        if ($key === null) {
            return null;
        }
        if ((null !== ($obj = EmpContactPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
            // the object is already in the instance pool
            return $obj;
        }
        if ($con === null) {
            $con = Propel::getConnection(EmpContactPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        if ($this->formatter || $this->modelAlias || $this->with || $this->select
         || $this->selectColumns || $this->asColumns || $this->selectModifiers
         || $this->map || $this->having || $this->joins) {
            return $this->findPkComplex($key, $con);
        } else {
            return $this->findPkSimple($key, $con);
        }
    }

    /**
     * Alias of findPk to use instance pooling
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return                 EmpContact A model object, or null if the key is not found
     * @throws PropelException
     */
     public function findOneById($key, $con = null)
     {
        return $this->findPk($key, $con);
     }

    /**
     * Find object by primary key using raw SQL to go fast.
     * Bypass doSelect() and the object formatter by using generated code.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return                 EmpContact A model object, or null if the key is not found
     * @throws PropelException
     */
    protected function findPkSimple($key, $con)
    {
        $sql = 'SELECT `id`, `contact`, `emp_profile_id`, `list_cont_types_id` FROM `emp_contact` WHERE `id` = :p0';
        try {
            $stmt = $con->prepare($sql);
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
        }
        $obj = null;
        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $obj = new EmpContact();
            $obj->hydrate($row);
            EmpContactPeer::addInstanceToPool($obj, (string) $key);
        }
        $stmt->closeCursor();

        return $obj;
    }

    /**
     * Find object by primary key.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return EmpContact|EmpContact[]|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex($key, $con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKey($key)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    }

    /**
     * Find objects by primary key
     *
     * $objs = $c->findPks(array(12, 56, 832), $con);
     *
     * @param     array $keys Primary keys to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return PropelObjectCollection|EmpContact[]|mixed the list of results, formatted by the current formatter
     */
    public function findPks($keys, $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKeys($keys)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->format($stmt);
    }

    /**
     * Filter the query by primary key
     *
     * @param     mixed $key Primary key to use for the query
     *
     * @return EmpContactQuery The current query, for fluid interface
     */
    public function filterByPrimaryKey($key)
    {

        return $this->addUsingAlias(EmpContactPeer::ID, $key, Criteria::EQUAL);
    }

    /**
     * Filter the query by a list of primary keys
     *
     * @param     array $keys The list of primary key to use for the query
     *
     * @return EmpContactQuery The current query, for fluid interface
     */
    public function filterByPrimaryKeys($keys)
    {

        return $this->addUsingAlias(EmpContactPeer::ID, $keys, Criteria::IN);
    }

    /**
     * Filter the query on the id column
     *
     * Example usage:
     *
     * $query->filterById(1234); // WHERE id = 1234
     * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
     * $query->filterById(array('min' => 12)); // WHERE id >= 12
     * $query->filterById(array('max' => 12)); // WHERE id <= 12
     *
     *
     * @param     mixed $id The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpContactQuery The current query, for fluid interface
     */
    public function filterById($id = null, $comparison = null)
    {
        if (is_array($id)) {
            $useMinMax = false;
            if (isset($id['min'])) {
                $this->addUsingAlias(EmpContactPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($id['max'])) {
                $this->addUsingAlias(EmpContactPeer::ID, $id['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpContactPeer::ID, $id, $comparison);
    }

    /**
     * Filter the query on the contact column
     *
     * Example usage:
     *
     * $query->filterByContact('fooValue');   // WHERE contact = 'fooValue'
     * $query->filterByContact('%fooValue%'); // WHERE contact LIKE '%fooValue%'
     *
     *
     * @param     string $contact The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpContactQuery The current query, for fluid interface
     */
    public function filterByContact($contact = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($contact)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $contact)) {
                $contact = str_replace('*', '%', $contact);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpContactPeer::CONTACT, $contact, $comparison);
    }

    /**
     * Filter the query on the emp_profile_id column
     *
     * Example usage:
     *
     * $query->filterByEmpProfileId(1234); // WHERE emp_profile_id = 1234
     * $query->filterByEmpProfileId(array(12, 34)); // WHERE emp_profile_id IN (12, 34)
     * $query->filterByEmpProfileId(array('min' => 12)); // WHERE emp_profile_id >= 12
     * $query->filterByEmpProfileId(array('max' => 12)); // WHERE emp_profile_id <= 12
     *
     *
     * @see       filterByEmpProfile()
     *
     * @param     mixed $empProfileId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpContactQuery The current query, for fluid interface
     */
    public function filterByEmpProfileId($empProfileId = null, $comparison = null)
    {
        if (is_array($empProfileId)) {
            $useMinMax = false;
            if (isset($empProfileId['min'])) {
                $this->addUsingAlias(EmpContactPeer::EMP_PROFILE_ID, $empProfileId['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($empProfileId['max'])) {
                $this->addUsingAlias(EmpContactPeer::EMP_PROFILE_ID, $empProfileId['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpContactPeer::EMP_PROFILE_ID, $empProfileId, $comparison);
    }

    /**
     * Filter the query on the list_cont_types_id column
     *
     * Example usage:
     *
     * $query->filterByListContTypesId(1234); // WHERE list_cont_types_id = 1234
     * $query->filterByListContTypesId(array(12, 34)); // WHERE list_cont_types_id IN (12, 34)
     * $query->filterByListContTypesId(array('min' => 12)); // WHERE list_cont_types_id >= 12
     * $query->filterByListContTypesId(array('max' => 12)); // WHERE list_cont_types_id <= 12
     *
     *
     * @see       filterByListContTypes()
     *
     * @param     mixed $listContTypesId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpContactQuery The current query, for fluid interface
     */
    public function filterByListContTypesId($listContTypesId = null, $comparison = null)
    {
        if (is_array($listContTypesId)) {
            $useMinMax = false;
            if (isset($listContTypesId['min'])) {
                $this->addUsingAlias(EmpContactPeer::LIST_CONT_TYPES_ID, $listContTypesId['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($listContTypesId['max'])) {
                $this->addUsingAlias(EmpContactPeer::LIST_CONT_TYPES_ID, $listContTypesId['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpContactPeer::LIST_CONT_TYPES_ID, $listContTypesId, $comparison);
    }

    /**
     * Filter the query by a related EmpProfile object
     *
     * @param   EmpProfile|PropelObjectCollection $empProfile The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return                 EmpContactQuery The current query, for fluid interface
     * @throws PropelException - if the provided filter is invalid.
     */
    public function filterByEmpProfile($empProfile, $comparison = null)
    {
        if ($empProfile instanceof EmpProfile) {
            return $this
                ->addUsingAlias(EmpContactPeer::EMP_PROFILE_ID, $empProfile->getId(), $comparison);
        } elseif ($empProfile instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(EmpContactPeer::EMP_PROFILE_ID, $empProfile->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByEmpProfile() only accepts arguments of type EmpProfile or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the EmpProfile relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return EmpContactQuery The current query, for fluid interface
     */
    public function joinEmpProfile($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('EmpProfile');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'EmpProfile');
        }

        return $this;
    }

    /**
     * Use the EmpProfile relation EmpProfile object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   \CoreBundle\Model\EmpProfileQuery A secondary query class using the current class as primary query
     */
    public function useEmpProfileQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinEmpProfile($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'EmpProfile', '\CoreBundle\Model\EmpProfileQuery');
    }

    /**
     * Filter the query by a related ListContTypes object
     *
     * @param   ListContTypes|PropelObjectCollection $listContTypes The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return                 EmpContactQuery The current query, for fluid interface
     * @throws PropelException - if the provided filter is invalid.
     */
    public function filterByListContTypes($listContTypes, $comparison = null)
    {
        if ($listContTypes instanceof ListContTypes) {
            return $this
                ->addUsingAlias(EmpContactPeer::LIST_CONT_TYPES_ID, $listContTypes->getId(), $comparison);
        } elseif ($listContTypes instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(EmpContactPeer::LIST_CONT_TYPES_ID, $listContTypes->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByListContTypes() only accepts arguments of type ListContTypes or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the ListContTypes relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return EmpContactQuery The current query, for fluid interface
     */
    public function joinListContTypes($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('ListContTypes');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'ListContTypes');
        }

        return $this;
    }

    /**
     * Use the ListContTypes relation ListContTypes object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   \CoreBundle\Model\ListContTypesQuery A secondary query class using the current class as primary query
     */
    public function useListContTypesQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinListContTypes($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'ListContTypes', '\CoreBundle\Model\ListContTypesQuery');
    }

    /**
     * Exclude object from result
     *
     * @param   EmpContact $empContact Object to remove from the list of results
     *
     * @return EmpContactQuery The current query, for fluid interface
     */
    public function prune($empContact = null)
    {
        if ($empContact) {
            $this->addUsingAlias(EmpContactPeer::ID, $empContact->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }

}