text:
title: MySQL Master-Slave Replication
layout: post
og_image_url: "https://blog.virtengine.com/res/gotalk-intro.png"
description: MySQL Master-Slave Replication
---

MySQL is the world's most popular open source database.  MySQL can cost-effectively help you deliver high performance, scalable database applications.

###### REPLICATION

  Master-slave data replication allows for replicated data to be copied to multiple computers for backup and analysis by multiple parties. Needed changes identified by a group member must to be submitted to the designated "master" of the node. This differs from Master-Master replication, in which data can be updated by any authorized contributor of the group.

This article provides information to setting up MySQL master-slave database replication between two cloud servers.

SYSTEM SETUP

        OS	 : Ubuntu 14.04.2
        MySQL  : MySQL 5.5

SERVERS

MySQL replication needs atleast two servers, one act as master and others act as slaves. Master performs both write and read it replicates in all slaves. Slave also can write but it modified only in it's database.It does not replicate in any slaves.

My Servers are

        server1 : 192.168.1.12
        server2 : 192.168.1.13

  here we use server1 as master and server2 as slave.

###### Install and Configure MySQL in Master Server

        $ sudo apt-get install mysql-server

 After installing MYSQL, have to configure it

		$ nano /etc/mysql/my.cnf

Change bind-address to point to the Server1 IP address.

        bind-address   = 192.168.1.12

Just remove the comment for server-id and log_bin and save the file.

		log_bin        = /var/log/mysql/mysql-bin.log

Change the Server id as an unique positive Integer.

        server-id      = 1234

   note: use different id for server2.
Restart the mysql service.

		$ sudo service mysql restart

**Grant Replication to Slave**

Create a mysql user with password identification.

    $ mysql -u root -p pswd

    mysql> create user 'DBUSERNAME'@'%' IDENTIFIED BY 'slavepass';

Grant Slave replication Permission to that user.

		mysql> grant replication slave on *.* to 'DBUSERNAME'@'%'

**Create your own database**

Create database

    mysql> create database dbnew1
Create table

    mysql> create table dbnew1.student(s_name varchar(20),s_id int);

Insert data whatever you want

		mysql> insert into dbnew1.student('Devid',1001);

After insertion exit mysql

        mysql> exit

**Backup the MySql Database and Send to Slave**

 "mysqldump" is an effective tool to backup MySQL database. It creates a *.sql file with DROP table, CREATE table and INSERT into sql-statements of the source database. To restore the database,  execute the *.sql file on destination database.

     Syntax:  mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

     $ mysqldump -u root -p pswd --all-databases --master-data >masterdump.sql

 to verify the databases backup

     $grep CHANGE *sql  | head -1

    CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=919;

send the dumpfile.sql to slave server.

       $ scp masterdump.sql 192.168.1.13:
                   or
       $ sftp server2@192.168.1.13

######Install and Configure MySQL in Slave Server

   	 $ sudo apt-get install mysql-server

 After install MYSQL, have to configure it,

		$ nano /etc/mysql/my.cnf

Change bind-address to point to slave-ipaddress.

        bind-address   = 192.168.1.13

Change the Server id to an unique positive Integer.

        server-id      = 4321

Just remove the comment for server-id and log_bin and save the file.

		log_bin        = /var/log/mysql/mysql-bin.log

Restart the mysql service.

		$ sudo service mysql restart

**Inform Slave about the master**

	$ mysql -u root -p pswd

    mysql> CHANGE MASTER TO MASTER_HOST='192.168.1.12', MASTER_USER='DBUSERNAME', MASTER_PASSWORD='slavepass';

	mysql> exit

verify whether you have received the dupmfile.sql before use the following command.

 	$ mysql -u root < masterdump.sql

now open MySQL and start the Slave.

	mysql> start slave

    mysql> show slave status\G;

It show the following attribute's value like

	Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.1.12
                  Master_User: DBUSERNAME
              Master_Log_File: mysql-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
             Master_Server_Id: 1234
		       MASTER_LOG_POS: 919

now your slave started check the master replication

**insert a new row in master server**

	mysql> use dbnew1

   	mysql> insert into stu values('John',1004);
    mysql> select * from stu;
	+-----------+-------+
	| s_name 	| s_id 	|
	+----------+--------+
	| Devid   	| 1001 	|
	| mathi		| 1002 	|
	| thomas 	| 1003 	|
	| john     	| 1004 	|
	+------- ---+-------+
	4 rows in set (0.00 sec)

**show table in Slave Server**

    mysql> use dbnew1
	mysql> select * from stu;
	+-----------+-------+
	| s_name 	| s_id 	|
	+----------+--------+
	| Devid   	| 1001 	|
	| mathi		| 1002 	|
	| thomas 	| 1003 	|
	| john     	| 1004 	|
	+------- ---+-------+
	4 rows in set (0.00 sec)

MySQL Master-slave replication tested.

Thank you.


text:
<resources>
    <string name="app_name">fastcircleloading</string>
</resources>

redpajama_set_name: RedPajamaGithub


text:
title:  Satans smeltedigler
date:  04/07/2022
---

>

> «Vær edru og våk! Deres motstander, djevelen, går omkring som en brølende løve for å finne noen å sluke» (1 Pet 5,8).

`Les verset ovenfor. Hva er budskapet til oss? Spør deg selv: «Hvor seriøst tar jeg disse ordene?" Hva gjør du som viser om du tar dem på alvor?`

Har du sett en sulten løve? Den er fantastisk, for du vet den kan fange og spise nesten alt den vil. Peter sier at Satan går rundt på samme måte. Når vi ser oss rundt, ser vi følgene av hans ønske om å drepe. Død, lidelse og umoral overalt. Vi kan ikke unngå å se Satans verk.

`Les 1 Pet 5,8–11. Hvordan bør vi reagere på Satans angrep?`

`Hva lover Gud å gjøre for dem som lider? 1 Pet 5,10.`

Peter skriver dette i sammenheng med å svare på Satans angrep på kristentroen. Men som sagt arbeider Satan på mange ulike måter. Og selv om vi må være klar over fiendens makt og eksistens, må vi ikke miste motet, for vi må alltid huske at Jesus har seiret over Satan, at han er en beseiret fiende, og at bare vi holder kontakten med Jesus og holder oss til ham i tro, kan heller ikke vi beseires. Takket være korset er Kristi seier vår seier.

`Tenk på hvordan Satan ellers forårsaker smerte. Hvordan kan 1 Pet 5,8–11 hjelpe oss å takle den smerten vi påføres fordi vi lever i en verden der Satan herjer?`


text:
namespace boost { namespace spirit { namespace karma { namespace detail
{
    ///////////////////////////////////////////////////////////////////////////
    template <typename OutputIterator, typename Char>
    struct iterator_sink
    {
        typedef boost::iostreams::sink_tag category;
        typedef Char char_type;

        iterator_sink (OutputIterator& sink_)
          : sink(sink_)
        {}

        // Write up to n characters from the buffer s to the output sequence,
        // returning the number of characters written
        std::streamsize write (Char const* s, std::streamsize n)
        {
            std::streamsize bytes_written = 0;
            while (n--) {
                *sink = *s;
                ++sink; ++s; ++bytes_written;
            }
            return bytes_written;
        }

        OutputIterator& sink;
    };

}}}}

#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:background="#73c5d3"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/tv_header_add"
        style="@style/hdrStyleBlue"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="@string/str_class_notices"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="24sp" />

    <com.google.android.gms.ads.AdView android:id="@+id/adView"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         ads:adUnitId="ca-app-pub-9622708780152447/6520133416"
                         android:background="#FFFFFF"
                         android:layout_below="@id/tv_header_add"
                         ads:adSize="SMART_BANNER"/>

    <Button
        android:id="@+id/btn_classnotice"
        style="@style/hdrStyleBlue"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:drawableTop="@drawable/refresh_white_icon" />

    <TextView
        android:id="@+id/justnothing"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="5dp"
        android:layout_alignParentBottom="true"
        android:background="#36797f"
        android:text="" />

    <ListView
    android:id="@+id/lv_classnotices"
    android:layout_width="match_parent"
    android:layout_above="@id/justnothing"
    android:layout_below="@id/adView"
    android:background="#FFFFFF"
    android:layout_height="wrap_content" >
    </ListView>

</RelativeLayout>


text:
import Test.Tasty
import Test.Tasty.QuickCheck
import Test.Tasty.HUnit

import qualified NormalizationTests as Norm
import qualified SegmentationTests as Segm

main = defaultMain tests

tests :: TestTree
tests = testGroup "tests" [
         testGroup "norm" [
                        testCase "g1" (Norm.g1_check @?= True)
                       ],
         testGroup "segm" [
            testGroup "graph" [
               -- FIXME testProperty "g1" Segm.g1_prop,
               testCase "g2" (Segm.g2_check @?= True)
            ],
            testGroup "word" [
               testCase "w1" (Segm.w1_check @?= True)
            ]
        ]
       ]


text:
module Azure::Kusto::Mgmt::V2019_05_15
  module Models
    #
    # The result returned from a data connection validation request.
    #
    class DataConnectionValidationResult

      include MsRestAzure

      # @return [String] A message which indicates a problem in data connection
      # validation.
      attr_accessor :error_message

      #
      # Mapper for DataConnectionValidationResult class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'DataConnectionValidationResult',
          type: {
            name: 'Composite',
            class_name: 'DataConnectionValidationResult',
            model_properties: {
              error_message: {
                client_side_validation: true,
                required: false,
                serialized_name: 'errorMessage',
                type: {
                  name: 'String'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
class Riot::Gear::OnceRunnable < Riot::RunnableBlock
  def initialize(description, &definition)
    super("[once] #{description}", &definition)
    @ran = false
  end

  # Applies the provided +&definition+ to the +situation+. But, it only
  # does so once.
  #
  # @param [Riot::Situation] situation An instance of a {Riot::Situation}
  # @return [Array<Symbol>]
  def run(situation)
    if @ran
      [:once_ignored]
    else
      @ran = true
      situation.evaluate(&definition)
      [:once]
    end
  end
end

module Riot::Gear::OnceContextHelper
  # A setup helper that will only run once and only in the context it
  # was defined in. This will not be run in any of its sub-contexts
  # and it will run before any assertions ... the same as any other
  # setup block.
  #
  #   once "doing this one thing" do
  #     topic.post "/user/things", :query => {"name" => "x"}
  #   end
  #
  # @param [String] description A description of what the block is for
  # @param [lambda] &definition The block that will be executed once
  # @return [Riot::Gear::OnceRunnable]
  def once(description="", &definition)
    @setups << Riot::Gear::OnceRunnable.new(description, &definition)
  end
end

Riot::Context.instance_eval { include Riot::Gear::OnceContextHelper }


text:
package no.agens.depth;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;

import no.agens.depth.lib.headers.PathBitmapMesh;
import no.agens.depth.lib.headers.Renderable;

public class Water extends Renderable {

    public static final int VERTS = 6;
    private float height, width;

    Foam[] foams = new Foam[4];
    int numberOfWaves;
    PathBitmapMesh water;
    private float waveHeight;

    public Water(Bitmap bitmap, Bitmap foam, float y, float height, float width, int waves) {
        super(bitmap, 0, y);
        this.height = height;
        this.width = width;
        numberOfWaves = waves;

        debugPaint.setColor(Color.RED);
        debugPaint.setStyle(Paint.Style.STROKE);
        lastEmit = System.currentTimeMillis();
        water = new PathBitmapMesh(VERTS, 1, bitmap, 1500);
        foams[0] = new Foam(VERTS, 1, foam, 0, height / 12, 1500);
        foams[1] = new Foam(VERTS, 1, foam, -height / 5, height / 5, 1500);
        foams[1].setAlpha(100);
        foams[2] = new Foam(VERTS, 1, foam, -height / 12, height / 12, 1450);
        foams[2].setVerticalOffset(height / 7);
        foams[3] = new Foam(VERTS, 1, foam, -height / 12, height / 12, 1400);
        foams[3].setVerticalOffset(height / 4);
        waveHeight = height / 10;
        createPath();
    }

    @Override
    public void pause() {
        super.pause();
        water.pause();
        for (Foam foam : foams)
            foam.pause();
    }

    @Override
    public void resume() {
        super.resume();
        water.resume();
        for (Foam foam : foams)
            foam.resume();
    }

    @Override
    public void destroy() {
        super.destroy();
        for (Foam foam : foams)
            foam.destroy();
    }

    Paint debugPaint = new Paint();

    @Override
    public void draw(Canvas canvas) {

        water.draw(canvas);
        for (Foam foam : foams) {
            foam.draw(canvas);
        }
    }

    @Override
    public void update(float deltaTime, float wind) {
        super.update(deltaTime, wind);
        for (Foam foam : foams) {
            foam.update(deltaTime);
        }
        water.matchVertsToPath(waterPath, height, ((bitmap.getWidth() / numberOfWaves) * 4f));
        for (Foam foam : foams) {
            foam.matchVertsToPath(waterPath, foam.getBitmap().getWidth() / numberOfWaves * 4f);
        }
        if (lastEmit + emitInterWall < System.currentTimeMillis()) {
            for (Foam foam : foams) {
                foam.calcWave();
            }
            lastEmit = System.currentTimeMillis();
        }

    }

    private Path waterPath = new Path();

    private void createPath() {
        waterPath.reset();
        waterPath.moveTo(0, y);

        int step = (int) (width / numberOfWaves);
        boolean goLeft = true;
        for (int i = 0; i < numberOfWaves; i++) {
            if (goLeft)
                waterPath.cubicTo(x + step * i, y, x + step * i + step / 2f, y + waveHeight, x + step * i + step, y);
            else
                waterPath.cubicTo(x + step * i, y, x + step * i + step / 2f, y - waveHeight, x + step * i + step, y);

            goLeft = !goLeft;
        }

    }

    long lastEmit;
    private int emitInterWall = 1000;

    public void setWaveHeight(float waveHeight) {
        this.waveHeight = waveHeight;
        createPath();
    }
}


text:
package org.openehealth.ipf.platform.camel.core.support.transform.min;

import org.openehealth.ipf.commons.core.modules.api.ValidationException;
import org.openehealth.ipf.commons.core.modules.api.Validator;

/**
 * @author Martin Krasser
 */
public class TestValidator implements Validator<String, String> {

    @Override
    public void validate(String message, String profile) {
        if (!message.equals(profile)) {
            throw new ValidationException("bullshit");
        }
    }

}


text:
class CreateEyeColours < ActiveRecord::Migration[5.1]
  def change
    create_table :eye_colours do |t|
      t.text :content

      t.timestamps
    end
  end
end


text:
ACE_RCSID(client, logging_app, "$Id: logging_app.cpp 82610 2008-08-12 19:46:36Z parsons $")

static u_short LOGGER_PORT = ACE_DEFAULT_SERVER_PORT;
static const ACE_TCHAR *const LOGGER_HOST = ACE_DEFAULT_SERVER_HOST;
static const int MAX_ITERATIONS = 10;

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  const ACE_TCHAR *logger_host = argc > 1 ? argv[1] : LOGGER_HOST;
  u_short logger_port  = argc > 2 ? ACE_OS::atoi (argv[2]) : LOGGER_PORT;
  int max_iterations = argc > 3 ? ACE_OS::atoi (argv[3]) : MAX_ITERATIONS;

  ACE_SOCK_Stream logger;
  ACE_SOCK_Connector connector;
  ACE_INET_Addr addr (logger_port, logger_host);

  if (connector.connect (logger, addr) == -1)
    ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);

  for (int i = 0; i < max_iterations; i++)
    {
      ACE_Log_Record log_record (LM_DEBUG,
                                 ACE_OS::time ((time_t *) 0),
                                 ACE_OS::getpid ());

      ACE_TCHAR buf[BUFSIZ];
      ACE_OS::sprintf (buf, ACE_TEXT ("message = %d\n"), i + 1);
      log_record.msg_data (buf);

      const size_t max_payload_size =
        4 // type()
        + 8 // timestamp
        + 4 // process id
        + 4 // data length
        + ACE_Log_Record::MAXLOGMSGLEN // data
        + ACE_CDR::MAX_ALIGNMENT; // padding;

      // Insert contents of <log_record> into payload stream.
      ACE_OutputCDR payload (max_payload_size);
      payload << log_record;

      // Get the number of bytes used by the CDR stream.
      ACE_CDR::ULong length =
        ACE_Utils::truncate_cast<ACE_CDR::ULong> (payload.total_length ());

      // Send a header so the receiver can determine the byte order and
      // size of the incoming CDR stream.
      ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + 8);
      header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER);

      // Store the size of the payload that follows
      header << ACE_CDR::ULong (length);

      // Use an iovec to send both buffer and payload simultaneously.
      iovec iov[2];
      iov[0].iov_base = header.begin ()->rd_ptr ();
      iov[0].iov_len  = 8;
      iov[1].iov_base = payload.begin ()->rd_ptr ();
      iov[1].iov_len  = length;

      if (logger.sendv_n (iov, 2) == -1)
        ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send"), -1);
    }

  if (logger.close () == -1)
    ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("close")), -1);

  return 0;
}


text:
<?php
namespace Chatter\Controller;

use Chatter\Form\ChatAddForm;
use Chatter\Form\ChatEditForm;
use Chatter\Entity\Chat;

class ChatController extends AbstractActionController
{
    public function indexAction()
    {
        $chats = $this->getEntityManager()->createQueryBuilder()
            ->select('c')
            ->from('Chatter\Entity\Chat', 'c')
            ->getQuery()
            ->getResult();

        return array(
            'chats' => $chats,
        );
    }

    public function addAction()
    {
        $chat = new Chat();
        $form = new ChatAddForm($this->em);
        $form->bind($chat);

        $request = $this->getRequest();
        if ($request->isPost()) {
            $form->setData($request->getPost());
            if ($form->isValid()) {
                $this->em->persist($chat);
                $this->em->flush($chat);
                $this->redirect()->toRoute('chat');
            }
        }

        return array(
            'form' => $form,
        );

        /*
        $form = new ChatForm();
        $form->get('submit')->setValue('Add');

        $request = $this->getRequest();
        if ($request->isPost()) {
            $chat = new Chat();
            $form->setInputFilter($chat->getInputFilter());
            $form->setData($request->getPost());

            if ($form->isValid()) {
                $chat->fromArray($form->getData());
                $chat->save($this->em);

                // Redirect to list of chats
                return $this->redirect()->toRoute('chat');
            }
        }

        return array(
            'form' => $form,
        );*/
    }

    public function editAction()
    {
        $id = (int) $this->params()->fromRoute('id', 0);
        if (!$id) {
            return $this->redirect()->toRoute('chat', array(
                'action' => 'add',
            ));
        }

        // Get the Chat with the specified id. An exception is thrown
        // if it cannot be found, in which case go to the index page.
        try {
            $chat = $this->getEntityManager()->find('Chatter\Entity\Chat', $id);
        } catch (\Exception $ex) {
            return $this->redirect()->toRoute('chat', array(
                'action' => 'index',
            ));
        }

        $form = new ChatEditForm($this->getEntityManager());
        $form->bind($chat);

        $request = $this->getRequest();
        if ($request->isPost()) {
            $form->setData($request->getPost());
            if ($form->isValid()) {
                $this->getEntityManager()->persist($chat);
                $this->getEntityManager()->flush($chat);
                $this->redirect()->toRoute('chat');
            }
        }

        return array(
            'chat' => $chat,
            'form'  => $form,
        );
    }

    public function deleteAction()
    {
        $id = (int) $this->params()->fromRoute('id', 0);

        // Get the Chat with the specified id. An exception is thrown
        // if it cannot be found, in which case go to the index page.
        try {
            $chat = $this->getEntityManager()->find('Chatter\Entity\Chat', $id);
        } catch (\Exception $ex) {
            return $this->redirect()->toRoute('chat', array(
                'action' => 'index',
            ));
        }

        $chat->delete($this->getEntityManager());

        return $this->redirect()->toRoute('chat', array(
            'action' => 'index',
        ));
    }
}


text:
/* @version $Id$ */

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Enumeration;
import java.util.Properties;

import org.apache.commons.daemon.Daemon;
import org.apache.commons.daemon.DaemonContext;

public class ServiceDaemon implements Daemon {

    private Properties prop = null;
    private Process proc[] = null;
    private ServiceDaemonReadThread readout[] = null;
    private ServiceDaemonReadThread readerr[] = null;

    public ServiceDaemon() {
        super();
        System.err.println("ServiceDaemon: instance "+this.hashCode()+
                           " created");
    }

    protected void finalize() {
        System.err.println("ServiceDaemon: instance "+this.hashCode()+
                           " garbage collected");
    }

    /**
     * init and destroy were added in jakarta-tomcat-daemon.
     */
    public void init(DaemonContext context)
    throws Exception {
        /* Set the err */
        System.setErr(new PrintStream(new FileOutputStream(new File("ServiceDaemon.err")),true));
        System.err.println("ServiceDaemon: instance "+this.hashCode()+
                           " init");

        /* read the properties file */
        prop = new Properties();
        try {
            prop.load(new FileInputStream("startfile"));
        }
        catch (Exception e) {
            // Cannot find startfile.properties.
            // XXX: Should we print something?
        }
        /* create an array to store the processes */
        int i=0;
        for (Enumeration e = prop.keys(); e.hasMoreElements() ;) {
            e.nextElement();
            i++;
        }
        System.err.println("ServiceDaemon: init for " + i + " processes");
        proc = new Process[i];
        readout = new ServiceDaemonReadThread[i];
        readerr = new ServiceDaemonReadThread[i];
        for (i=0;i<proc.length;i++) {
            proc[i] = null;
            readout[i] = null;
            readerr[i] = null;
        }

        System.err.println("ServiceDaemon: init done ");

    }

    public void start() {
        /* Dump a message */
        System.err.println("ServiceDaemon: starting");

        /* Start */
        int i=0;
        for (Enumeration e = prop.keys(); e.hasMoreElements() ;) {
            String name = (String) e.nextElement();
            System.err.println("ServiceDaemon: starting: " + name + " : " + prop.getProperty(name));
            try {
                proc[i] = Runtime.getRuntime().exec(prop.getProperty(name));
            } catch(Exception ex) {
               System.err.println("Exception: " + ex);
           }
           /* Start threads to read from Error and Out streams */
           readerr[i] =
               new ServiceDaemonReadThread(proc[i].getErrorStream());
           readout[i] =
               new ServiceDaemonReadThread(proc[i].getInputStream());
           readerr[i].start();
           readout[i].start();
           i++;
        }
    }

    public void stop()
    throws IOException, InterruptedException {
        /* Dump a message */
        System.err.println("ServiceDaemon: stopping");

        for (int i=0;i<proc.length;i++) {
            if ( proc[i]==null)
               continue;
            proc[i].destroy();
            try {
                proc[i].waitFor();
            } catch(InterruptedException ex) {
                System.err.println("ServiceDaemon: exception while stopping:" +
                                    ex);
            }
        }

        System.err.println("ServiceDaemon: stopped");
    }

    public void destroy() {
        System.err.println("ServiceDaemon: instance "+this.hashCode()+
                           " destroy");
    }

}


text:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Target_realisasi extends CI_Controller
{

    function __construct() {
        parent::__construct();
    }

    function target_realisasi_tahun() {
        check_login();

        $p_year_period_id = getVarClean('p_year_period_id','int',0);

        $sql = "select * from v_target_vs_real_anual
                where p_year_period_id = ?";

        $query = $this->db->query($sql, array($p_year_period_id));
        $result = $query->row_array();
        //echo base_url();exit;
        echo '[['.$result['target_amt'].','.$result['realisasi_amt'].',"'.$result['year_code'].'"]]';
        exit;
    }

    function t_target_realisasi_bulan_all() {
        check_login();

        $p_year_period_id = getVarClean('p_year_period_id','int',0);

        $sql = "SELECT
					MAX(p_finance_period_id) as p_finance_period_id,
					MAX(p_year_period_id) as p_year_period_id,
					to_char(MAX(start_date),'dd-mm-yyyy') as start_date,
					to_char(MAX(end_date),'dd-mm-yyyy') as end_date,
					MAX(p_vat_type_id) as p_vat_type_id,
					MAX(bulan) as bulan,
					SUM (target_amount) as target_amount,
					SUM (realisasi_amt) as realisasi_amt,
					MAX (penalty_amt) as penalty_amt,
					SUM (debt_amt) as debt_amt
				FROM
					f_target_vs_real_monthly_new(?,null)
				GROUP BY p_finance_period_id

				ORDER BY MAX(start_date) ASC";

        $query = $this->db->query($sql, array($p_year_period_id));
        $result = $query->result_array();
        //print_r($result);exit;
        $s_result ="[";
        for ($i=0;$i<count($result);$i++){
        	$s_result = $s_result . '["'.$result[$i]['bulan'].'","'.$result[$i]['target_amount'].'","'.$result[$i]['realisasi_amt'].'","'.$result[$i]['penalty_amt'].'","'.$result[$i]['debt_amt'].'"],';
        }
        $s_result = substr($s_result, 0, -1)  ;

        $s_result = $s_result . "]";
        echo $s_result;
        exit;
    }

    function target_realisasi_tahun_per_jenis() {
        check_login();

        $p_year_period_id = getVarClean('p_year_period_id','int',0);

        $sql = "SELECT t_revenue_target_id,
                    p_year_period_id,
                    p_vat_type_id,
                    vat_code,
                    year_code,
                    target_amount,
                    realisasi_amt
                FROM v_revenue_target_vs_realisasi
                WHERE p_year_period_id = ?
                ORDER BY p_vat_type_id";

        $query = $this->db->query($sql, array($p_year_period_id));
        $result = $query->result_array();
        //print_r($result);exit;
        $s_result ="[";
        for ($i=0;$i<count($result);$i++){
            $s_result = $s_result . '['.$result[$i]['target_amount'].','.$result[$i]['realisasi_amt'].',"'.$result[$i]['vat_code'].'"],';
        }
        $s_result = substr($s_result, 0, -1)  ;

        $s_result = $s_result . "]";
        echo $s_result;
        exit;
    }

    function target_realisasi_per_tahun() {
        check_login();

        $t_revenue_target_id = getVarClean('t_revenue_target_id','int',0);

        $sql = "SELECT target_amount, realisasi_amt, vat_code, year_code
                FROM v_revenue_target_vs_realisasi
                WHERE t_revenue_target_id = ?";

        $query = $this->db->query($sql, array($t_revenue_target_id));
        $result = $query->row_array();
        //echo base_url();exit;
        echo '[['.$result['target_amount'].','.$result['realisasi_amt'].',"'.$result['vat_code'].'","'.$result['year_code'].'"]]';
        exit;
    }

    function target_realisasi_bidang_per_tahun() {
        check_login();

        $t_revenue_target_id = getVarClean('t_revenue_target_id','int',0);
        $p_year_period_id = getVarClean('p_year_period_id','int',0);

        $sql = "SELECT t_revenue_target_id, p_year_period_id, p_vat_group_id, group_code,   year_code, target_amount, realisasi_amt
                FROM (SELECT max(t_revenue_target_id) as t_revenue_target_id,
                        max(p_year_period_id) as p_year_period_id, p_vat_group_id, group_code, max(year_code) as year_code, sum(target_amount) as target_amount, sum(realisasi_amt) as realisasi_amt
                    FROM v_revenue_target_vs_realisasi
                    WHERE p_year_period_id = ?
                    GROUP BY p_vat_group_id,group_code
                    ORDER BY group_code)
                WHERE t_revenue_target_id = ?";

        $query = $this->db->query($sql, array($p_year_period_id, $t_revenue_target_id));
        $result = $query->row_array();
        //echo base_url();exit;
        echo '[['.$result['target_amount'].','.$result['realisasi_amt'].',"'.$result['group_code'].'","'.$result['year_code'].'"]]';
        exit;
    }

}


text:
<?php

namespace ZfcRbacTest\Guard;

use Zend\ServiceManager\ServiceManager;
use ZfcRbac\Guard\GuardPluginManager;
use ZfcRbac\Options\ModuleOptions;

/**
 * @covers \ZfcRbac\Guard\GuardPluginManager
 */
class GuardPluginManagerTest extends \PHPUnit_Framework_TestCase
{
    public function guardProvider()
    {
        return [
            [
                'ZfcRbac\Guard\RouteGuard',
                [
                    'admin/*' => 'foo'
                ]
            ],
            [
                'ZfcRbac\Guard\ControllerGuard',
                [
                    [
                        'controller' => 'Foo',
                        'actions'    => 'bar',
                        'roles'      => 'baz'
                    ]
                ]
            ]
        ];
    }

    /**
     * @dataProvider guardProvider
     */
    public function testCanCreateDefaultGuards($type, $options)
    {
        $serviceManager = new ServiceManager();
        $serviceManager->setService('ZfcRbac\Options\ModuleOptions', new ModuleOptions());
        $serviceManager->setService(
            'ZfcRbac\Service\RoleService',
            $this->getMock('ZfcRbac\Service\RoleService', [], [], '', false)
        );

        $pluginManager = new GuardPluginManager();
        $pluginManager->setServiceLocator($serviceManager);

        $guard = $pluginManager->get($type, $options);

        $this->assertInstanceOf($type, $guard);
    }

    public function testThrowExceptionForInvalidPlugin()
    {
        $this->setExpectedException('ZfcRbac\Exception\RuntimeException');

        $pluginManager = new GuardPluginManager();
        $pluginManager->get('stdClass');
    }
}


text:
package com.yourblogz.clawer.website;

import org.jsoup.nodes.Document;

import com.yourblogz.clawer.Clawer;
import com.yourblogz.clawer.bean.CsdnBean;

public class CsdnClawer extends Clawer<CsdnBean> {

    private CsdnBean csdnBean = null;

    public CsdnClawer(String name) {
        super(name);
        addSites("http://blog.csdn.net/",
                 "http://blog.csdn.net/?page=2",
                 "http://blog.csdn.net/?page=3");
        addRules("^http://blog\\.csdn\\.net/([\\w\\d]+)/article/details/[\\d]+$");
    }

    @Override
    protected void page(Document page) {
        csdnBean = new CsdnBean();
        service.data(csdnBean);
    }

}


text:
USE `stackoverflow17_06`;

SET foreign_key_checks = 0;
DROP TABLE IF EXISTS `PostBlockType`;
DROP TABLE IF EXISTS `PostBlockDiffOperation`;
DROP TABLE IF EXISTS `PostBlockDiff`;
DROP TABLE IF EXISTS `PostVersion`;
DROP TABLE IF EXISTS `PostBlockVersion`;
DROP TABLE IF EXISTS `PostVersionUrl`;
DROP TABLE IF EXISTS `PostReferenceGH`;
SET foreign_key_checks = 1;

CREATE TABLE `PostBlockType` (
  Id TINYINT NOT NULL,
  Type VARCHAR(50) NOT NULL,
  PRIMARY KEY(Id)
);

INSERT INTO `PostBlockType` VALUES(1, 'TextBlock');
INSERT INTO `PostBlockType` VALUES(2, 'CodeBlock');

CREATE TABLE `PostBlockDiffOperation` (
  Id TINYINT NOT NULL,
  Name VARCHAR(50) NOT NULL,
  PRIMARY KEY(Id)
);

INSERT INTO `PostBlockDiffOperation` VALUES(-1, 'DELETE');
INSERT INTO `PostBlockDiffOperation` VALUES(0, 'EQUAL');
INSERT INTO `PostBlockDiffOperation` VALUES(1, 'INSERT');

CREATE TABLE `PostBlockDiff` (
  Id INT NOT NULL AUTO_INCREMENT,
  PostId INT NOT NULL,
  PostHistoryId INT NOT NULL,
  PredPostBlockVersionId INT NOT NULL,
  PostBlockVersionId INT NOT NULL,
  PostBlockDiffOperationId TINYINT NOT NULL,
  Text TEXT NOT NULL,
  PRIMARY KEY(Id),
  FOREIGN KEY(PostId) REFERENCES Posts(Id),
  FOREIGN KEY(PostHistoryId) REFERENCES PostHistory(Id),
  FOREIGN KEY(PostBlockDiffOperationId) REFERENCES PostBlockDiffOperation(Id)
) AUTO_INCREMENT = 1;

CREATE TABLE `PostVersion` (
  Id INT NOT NULL AUTO_INCREMENT,
  PostId INT NOT NULL,
  PostHistoryId INT NOT NULL,
  PostTypeId TINYINT NOT NULL,
  PredPostHistoryId INT DEFAULT NULL,
  SuccPostHistoryId INT DEFAULT NULL,
  PRIMARY KEY(Id),
  UNIQUE(PostHistoryId, PredPostHistoryId, SuccPostHistoryId),
  FOREIGN KEY(PostId) REFERENCES Posts(Id),
  FOREIGN KEY(PostHistoryId) REFERENCES PostHistory(Id),
  FOREIGN KEY(PostTypeId) REFERENCES PostType(Id),
  FOREIGN KEY(PredPostHistoryId) REFERENCES PostHistory(Id),
  FOREIGN KEY(SuccPostHistoryId) REFERENCES PostHistory(Id)
);

CREATE TABLE `PostBlockVersion` (
  Id INT NOT NULL AUTO_INCREMENT,
  PostVersionId INT DEFAULT NULL,
  PostId INT NOT NULL,
  PostHistoryId INT NOT NULL,
  PostBlockTypeId TINYINT NOT NULL,
  LocalId INT NOT NULL,
  Content TEXT NOT NULL,
  Length INT NOT NULL,
  LineCount INT NOT NULL,
  RootPostBlockId INT DEFAULT NULL,
  PredPostBlockId INT DEFAULT NULL,
  PredEqual BOOLEAN DEFAULT NULL,
  PredSimilarity DOUBLE DEFAULT NULL,
  PredCount INT DEFAULT NULL,
  SuccCount INT DEFAULT NULL,
  PRIMARY KEY(Id),
  UNIQUE(PostHistoryId, PostBlockTypeId, LocalId),
  FOREIGN KEY(PostVersionId) REFERENCES PostVersion(Id),
  FOREIGN KEY(PostId) REFERENCES Posts(Id),
  FOREIGN KEY(PostHistoryId) REFERENCES PostHistory(Id),
  FOREIGN KEY(PostBlockTypeId) REFERENCES PostBlockType(Id),
  FOREIGN KEY(RootPostBlockId) REFERENCES PostBlockVersion(Id),
  FOREIGN KEY(PredPostBlockId) REFERENCES PostBlockVersion(Id)
) AUTO_INCREMENT = 1;

ALTER TABLE `PostBlockDiff` ADD FOREIGN KEY(PredPostBlockVersionId) REFERENCES PostBlockVersion(Id);
ALTER TABLE `PostBlockDiff` ADD FOREIGN KEY(PostBlockVersionId) REFERENCES PostBlockVersion(Id);

CREATE TABLE `PostVersionUrl` (
  Id INT NOT NULL AUTO_INCREMENT,
  PostId INT NOT NULL,
  PostHistoryId INT NOT NULL,
  PostBlockVersionId INT NOT NULL,
  Url TEXT,
  PRIMARY KEY(Id),
  FOREIGN KEY(PostId) REFERENCES Posts(Id),
  FOREIGN KEY(PostBlockVersionId) REFERENCES PostBlockVersion(Id),
  FOREIGN KEY(PostHistoryId) REFERENCES PostHistory(Id)
);

CREATE TABLE `PostReferenceGH` (
  FileId VARCHAR(40) NOT NULL,
  RepoName TEXT NOT NULL,
  Branch TEXT NOT NULL,
  Path TEXT NOT NULL,
  FileExt TEXT NOT NULL,
  Size INT NOT NULL,
  PostId INT NOT NULL,
  PostTypeId TINYINT NOT NULL,
  Url TEXT NOT NULL,
  FOREIGN KEY(PostId) REFERENCES Posts(Id)
);


text:
package org.apache.hadoop.registry.client.api;

import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;

/**
 * Combinable Flags to use when creating a service entry.
 */
@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface BindFlags {

  /**
   * Create the entry.. This is just "0" and can be "or"ed with anything
   */
  int CREATE = 0;

  /**
   * The entry should be created even if an existing entry is there.
   */
  int OVERWRITE = 1;

}


text:
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager

class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Detective',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role', models.CharField(choices=[('det1', 'det1'), ('det2', 'det2'), ('det3', 'det3'), ('det4', 'det4'), ('det5', 'det5')], default=None, max_length=10, null=True)),
                ('taxi', models.IntegerField(default=10)),
                ('bus', models.IntegerField(default=8)),
                ('underground', models.IntegerField(default=4)),
            ],
        ),
        migrations.CreateModel(
            name='Game',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_modified', models.DateTimeField(auto_now=True)),
                ('complete', models.BooleanField(default=False)),
                ('player1_is_x', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='MrX',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('taxi', models.IntegerField(default=4)),
                ('bus', models.IntegerField(default=3)),
                ('underground', models.IntegerField(default=3)),
                ('black', models.IntegerField(default=5)),
                ('x2', models.IntegerField(default=2)),
                ('game', models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='mrx', to='syard_main.Game')),
            ],
        ),
        migrations.CreateModel(
            name='Round',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_modified', models.DateTimeField(auto_now=True)),
                ('mrx_loc', models.IntegerField(null=True)),
                ('det1_loc', models.IntegerField(null=True)),
                ('det2_loc', models.IntegerField(null=True)),
                ('det3_loc', models.IntegerField(null=True)),
                ('det4_loc', models.IntegerField(null=True)),
                ('det5_loc', models.IntegerField(null=True)),
                ('num', models.IntegerField(default=0)),
                ('game', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rounds', to='syard_main.Game')),
            ],
        ),
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('friends', models.ManyToManyField(blank=True, related_name='_userprofile_friends_+', to='syard_main.UserProfile')),
                ('games', models.ManyToManyField(blank=True, db_index=True, related_name='users', to='syard_main.Game')),
                ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
            ],
            managers=[
                ('active', django.db.models.manager.Manager()),
            ],
        ),
        migrations.AddField(
            model_name='game',
            name='host',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='host', to='syard_main.UserProfile'),
        ),
        migrations.AddField(
            model_name='game',
            name='player_1',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='player_1', to='syard_main.UserProfile'),
        ),
        migrations.AddField(
            model_name='game',
            name='player_2',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='player_2', to='syard_main.UserProfile'),
        ),
        migrations.AddField(
            model_name='game',
            name='winner',
            field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='won', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='detective',
            name='game',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dets', to='syard_main.Game'),
        ),
    ]


text:
function a({ option1, option2 }) {
  "use strict";
}


text:
package bamfo.gui.configurations;

import bamfo.call.OneFilter;
import bamfo.gui.utils.BamfoMiscFile;
import java.awt.Color;
import java.awt.Component;
import java.io.File;
import java.util.EventObject;
import javax.swing.BorderFactory;
import javax.swing.JTable;
import javax.swing.event.CellEditorListener;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;

/**
 * Warning: The Panel only deals with string in the key threshold box.
 *
 *
 * @author tomasz
 */
class FilterItemPanel extends javax.swing.JPanel
        implements TableCellRenderer, TableCellEditor {

    volatile OneFilter oneFilter;

    /**
     * Creates new form FilterItemPanel
     */
    public FilterItemPanel() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content oneFilter this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        BedOrKeyGroup = new javax.swing.ButtonGroup();
        filterNameTextfield = new javax.swing.JTextField();
        nameLabel = new javax.swing.JLabel();
        bedRadio = new javax.swing.JRadioButton();
        keyRadio = new javax.swing.JRadioButton();
        bedTextField = new javax.swing.JTextField();
        keyTextField = new javax.swing.JTextField();
        relationCombobox = new javax.swing.JComboBox();
        bedBrowseButton = new javax.swing.JButton();
        thresholdTextField = new javax.swing.JTextField();

        setBackground(new java.awt.Color(255, 255, 255));
        setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.GRAY));
        setMaximumSize(new java.awt.Dimension(20, 80));
        setMinimumSize(new java.awt.Dimension(20, 80));
        setPreferredSize(new java.awt.Dimension(20, 80));

        filterNameTextfield.setPreferredSize(new java.awt.Dimension(10, 24));

        nameLabel.setText("Name:");

        bedRadio.setBackground(new java.awt.Color(255, 255, 255));
        BedOrKeyGroup.add(bedRadio);
        bedRadio.setText("Region");
        bedRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bedRadioActionPerformed(evt);
            }
        });

        keyRadio.setBackground(new java.awt.Color(255, 255, 255));
        BedOrKeyGroup.add(keyRadio);
        keyRadio.setText("Key");
        keyRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                keyRadioActionPerformed(evt);
            }
        });

        bedTextField.setEditable(false);
        bedTextField.setPreferredSize(new java.awt.Dimension(10, 24));

        keyTextField.setPreferredSize(new java.awt.Dimension(10, 24));

        relationCombobox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<", "<=", "=", ">", ">=" }));
        relationCombobox.setPreferredSize(new java.awt.Dimension(53, 24));
        relationCombobox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                keyRelationHandler(evt);
            }
        });

        bedBrowseButton.setText("...");
        bedBrowseButton.setPreferredSize(new java.awt.Dimension(24, 24));
        bedBrowseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bedBrowseButtonActionPerformed(evt);
            }
        });

        thresholdTextField.setPreferredSize(new java.awt.Dimension(10, 24));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(nameLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(filterNameTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(bedRadio)
                    .addComponent(keyRadio))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(keyTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(relationCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(thresholdTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(bedTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bedBrowseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(bedRadio)
                            .addComponent(bedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(bedBrowseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(keyRadio)
                            .addComponent(keyTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(relationCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(thresholdTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(filterNameTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(nameLabel))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void bedRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bedRadioActionPerformed
        selectBed(bedRadio.isSelected());
    }//GEN-LAST:event_bedRadioActionPerformed

    private void keyRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keyRadioActionPerformed
        selectBed(bedRadio.isSelected());
    }//GEN-LAST:event_keyRadioActionPerformed

    private void keyRelationHandler(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keyRelationHandler
        //updateThisFilter();
    }//GEN-LAST:event_keyRelationHandler

    private void bedBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bedBrowseButtonActionPerformed

        // try to figure out current bed file directory
        File nowdir = null;
        try {
            nowdir = new File(bedTextField.getText()).getParentFile();
        } catch (Exception ex) {
            nowdir = null;
        }

        File newbed;
        if (nowdir == null) {
            newbed = BamfoMiscFile.chooseFile();
        } else {
            newbed = BamfoMiscFile.chooseFile(nowdir);
        }

        if (newbed != null) {
            bedTextField.setText(newbed.getAbsolutePath());
            updateThisFilter();
        }
    }//GEN-LAST:event_bedBrowseButtonActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup BedOrKeyGroup;
    private javax.swing.JButton bedBrowseButton;
    private javax.swing.JRadioButton bedRadio;
    private javax.swing.JTextField bedTextField;
    private javax.swing.JTextField filterNameTextfield;
    private javax.swing.JRadioButton keyRadio;
    private javax.swing.JTextField keyTextField;
    private javax.swing.JLabel nameLabel;
    private javax.swing.JComboBox relationCombobox;
    private javax.swing.JTextField thresholdTextField;
    // End of variables declaration//GEN-END:variables

    void selectBed(boolean bed) {
        bedRadio.setSelected(bed);
        bedTextField.setEnabled(bed);
        bedBrowseButton.setEnabled(bed);
        keyRadio.setSelected(!bed);
        keyTextField.setEnabled(!bed);
        relationCombobox.setEnabled(!bed);
        thresholdTextField.setEnabled(!bed);
    }

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        oneFilter = (OneFilter) value;
        filterNameTextfield.setText(oneFilter.getFiltername());
        if (oneFilter.getBedfile() == null) {
            selectBed(false);
            setBedpath("");
            setKey(oneFilter.getKey());
            setThreshold(oneFilter.getKeyThresholdString());
            setRelation(oneFilter.getKeyRelation());
        } else {
            selectBed(true);
            setBedpath(oneFilter.getBedfile().getAbsolutePath());
        }
        return this;
    }

    // below are functions that will be used to interface between the form/panel
    // and renderers and editors
    void setFilterName(String filtername) {
        filterNameTextfield.setText(filtername);
    }

    String getFilterName() {
        return filterNameTextfield.getText();
    }

    String getKey() {
        return keyTextField.getText();
    }

    void setKey(String key) {
        if (key == null) {
            keyTextField.setText("");
        } else {
            keyTextField.setText(key);
        }
    }

    String getThreshold() {
        return thresholdTextField.getText();
    }

    void setThreshold(String threshold) {
        if (threshold != null) {
            thresholdTextField.setText(threshold);
        } else {
            thresholdTextField.setText("");
        }
    }

    OneFilter.Relation getRelation() {
        String relationString = (String) relationCombobox.getSelectedItem();
        if (relationString.equalsIgnoreCase(">")) {
            return OneFilter.Relation.Greater;
        } else if (relationString.equalsIgnoreCase(">=")) {
            return OneFilter.Relation.GreaterOrEqual;
        }
        if (relationString.equalsIgnoreCase("=")) {
            return OneFilter.Relation.Equal;
        }
        if (relationString.equalsIgnoreCase("<")) {
            return OneFilter.Relation.Less;
        }
        if (relationString.equalsIgnoreCase("<=")) {
            return OneFilter.Relation.LessOrEqual;
        } else {
            return null;
        }

    }

    void setRelation(OneFilter.Relation relation) {
        if (relation == null) {
            return;
        }
        String relationString = "";
        switch (relation) {
            case Greater:
                relationString = ">";
                break;
            case GreaterOrEqual:
                relationString = ">=";
                break;
            case Less:
                relationString = "<";
                break;
            case LessOrEqual:
                relationString = "<=";
                break;
            case Equal:
                relationString = "=";
                break;
            default:
                System.out.println("setRelation in default?");
                break;
        }
        relationCombobox.setSelectedItem(relationString);
    }

    void setBedpath(File bedpath) {
        if (bedpath == null) {
            bedTextField.setText("");
        } else {
            bedTextField.setText(bedpath.getAbsolutePath());
        }
    }

    void setBedpath(String bedpath) {
        if (bedpath == null) {
            bedTextField.setText("");
        } else {
            bedTextField.setText(bedpath);
        }
    }

    String getBedpath() {
        return bedTextField.getText();
    }

    void setBedRadio(boolean bybed) {
        bedRadio.setSelected(bybed);
        keyRadio.setSelected(!bybed);
    }

    @Override
    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
        oneFilter = (OneFilter) value;
        selectBed(oneFilter.getBedfile() != null);
        setFilterName(oneFilter.getFiltername());
        setKey(oneFilter.getKey());
        setThreshold(oneFilter.getKeyThresholdString());
        setBedpath(oneFilter.getBedfile());
        // explicitly set the radio button
        setRelation(oneFilter.getKeyRelation());
        return this;
    }

    @Override
    public Object getCellEditorValue() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean isCellEditable(EventObject anEvent) {
        return true;
    }

    @Override
    public boolean shouldSelectCell(EventObject anEvent) {
        return true;
    }

    /**
     * Function that uses values in the GUI components to change the information
     * saved in the OneFilter that they represent.
     *
     */
    private synchronized void updateThisFilter() {
        oneFilter.setFiltername(filterNameTextfield.getText());
        String temp;
        if (bedRadio.isSelected()) {
            temp = bedTextField.getText();
            if (temp.length() > 0) {
                oneFilter.setBedfile(new File(temp));
            }
            oneFilter.setKey(null);
            oneFilter.setKeyThresholdString(null);
            oneFilter.setKeyRelation(null);
        } else {
            oneFilter.setBedfile(null);
            temp = keyTextField.getText();
            if (temp.length() > 2) {
                temp = temp.substring(0, 2);
            }
            oneFilter.setKey(temp);

            temp = thresholdTextField.getText();
            oneFilter.setKeyThresholdString(temp);
            oneFilter.setKeyThresholdDouble(null);

            oneFilter.setKeyRelation(getRelation());
        }
    }

    @Override
    public boolean stopCellEditing() {
        updateThisFilter();
        return true;
    }

    @Override
    public void cancelCellEditing() {
    }

    @Override
    public void addCellEditorListener(CellEditorListener l) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void removeCellEditorListener(CellEditorListener l) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }
}


text:
{% extends path+"/_layout-case-simple.html" %}

{% block actioncolumn %}

Return to case list

 {% if data['pbachoice']=='yes'%}

Ready for paper based assessment

Start assessment

{% else %}

Appointment booked

{% endif %}

{% endblock %}

{% block citizen_detail %}
Bobby Henderson
{% endblock %}

{% block citizen_content %}

{% if data['pbachoice'] %}

{% else %}

New evidence recorded

	         1

Bobby's case should be reviewed before making a recommendation

	         2

Make recommendation

{% endif %}

 Back

Appointment referral justification

Evidence considered

	{% if data['pbachoice']=='no'%}

	UC 50

	MED 3

	GP Report

{% else %}

	UC 50

	MED 3

{% endif %}

Reason

{{customer.name.first}} needs a face to face examination because the evidence we already have is not enough to determine the level of disability

Further details

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras tincidunt nec mi volutpat egestas. Aliquam malesuada erat magna, sed commodo risus commodo eu.

Appointment

Complex neuro

Justification

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras tincidunt nec mi volutpat egestas. Aliquam malesuada erat magna, sed commodo risus commodo eu.

{% endblock %}

{# {% block page_script %}

{% endblock %} #}


text:
<?php

	$name = $_POST["url"];
	$img = imagecreatefrompng($name);
	imageAlphaBlending($img, true);
	imageSaveAlpha($img, true);
	imagepng($img, $name);

?>


text:
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))

describe Twitter::Client, "#featured(:users)" do
  before(:each) do
    @twitter = client_context
    @uris = Twitter::Client.class_eval("@@FEATURED_URIS")
    @response = mas_net_http_response(:success)
    @connection = mas_net_http(@response)
    @users = [
      Twitter::User.new(:screen_name => 'twitter4r'),
      Twitter::User.new(:screen_name => 'dictionary'),
    ]
    Twitter::User.stub!(:unmarshal).and_return(@users)
  end

  it "should create expected HTTP GET request" do
    @twitter.should_receive(:rest_oauth_connect).with(:get, @uris[:users]).and_return(@response)
    @twitter.featured(:users)
  end

  it "should bless Twitter::User models returned" do
    @twitter.should_receive(:bless_models).with(@users).and_return(@users)
    @twitter.featured(:users)
  end

  after(:each) do
    nilize(@twitter, @uris, @response, @connection)
  end
end

describe Twitter::User, ".featured" do
  before(:each) do
    @twitter = client_context
  end

  it "should delegate #featured(:users) message to given client context" do
    @twitter.should_receive(:featured).with(:users).and_return([])
    Twitter::User.featured(@twitter)
  end

  after(:each) do
    nilize(@twitter)
  end
end


text:
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// MIT X11 license, Copyright (c) 2005-2006 by:                               //
//                                                                            //
// Authors:                                                                   //
//      Michael Dominic K. <michaldominik@gmail.com>                          //
//                                                                            //
// 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.                                     //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

namespace Diva.Editor.Gui {

        using System;
        using Gtk;
        using Mono.Unix;
        using Widgets;
        using System.Collections.Generic;

        public class StuffMenu : Menu {

                // Translatable /////////////////////////////////////////////

                readonly static string tagSS = Catalog.GetString
                        ("Tag");

                readonly static string createNewTagSS = Catalog.GetString
                        ("Create new tag...");

                // Delegates & events ///////////////////////////////////////

                // Fields ///////////////////////////////////////////////////

                Core.Stuff stuff;                        // Stuff that this menu was spawned for
                Model.Root modelRoot;                    // App model
                Dictionary <object, Core.Tag> itemToTag; // For individual tag toggles

                // Public methods ///////////////////////////////////////////

                /* Constructor */
                public StuffMenu (Model.Root root, Core.Stuff stuff)
                {
                        itemToTag = new Dictionary <object, Core.Tag> ();
                        modelRoot = root;
                        this.stuff = stuff;

                        // Tags
                        MenuItem tagMenuItem = new MenuItem (tagSS);
                        tagMenuItem.Submenu = CreateTagsMenu ();
                        Append (tagMenuItem);
                }

                // Private methods ////////////////////////////////////////////

                Menu CreateTagsMenu ()
                {
                        Menu tagsMenu = new Menu ();

                        MenuItem newTagItem = new MenuItem (createNewTagSS);
                        newTagItem.Activated += OnNewTagActivated;
                        tagsMenu.Append (newTagItem);

                        // All tags
                        foreach (Core.Tag tag in modelRoot.Tags) {
                                CheckMenuItem item = new CheckMenuItem (tag.Name);
                                item.Active = stuff.HasTag (tag);
                                item.Toggled += OnTagToggled;
                                tagsMenu.Append (item);
                                itemToTag [item] = tag;
                        }

                        return tagsMenu;
                }

                /* New tag */
                public void OnNewTagActivated (object sender, EventArgs args)
                {
                        // FIXME: Parent to the window
                        EditTagDialog dialog = new EditTagDialog (modelRoot, null);
                        ResponseType response = (ResponseType) dialog.Run ();

                        if (response == ResponseType.Ok)
                                modelRoot.Tags.CreateAndApply (dialog.TagName,
                                                               stuff);

                        dialog.Destroy ();
                }

                /* Tag status changed */
                public void OnTagToggled (object sender, EventArgs args)
                {
                        Core.Tag tag = itemToTag [sender];

                        if ((sender as CheckMenuItem).Active == true)
                                modelRoot.Tags.Apply (tag, stuff);
                        else
                                modelRoot.Tags.Remove (tag, stuff);
                }

        }

}


text:
<?php

/**
 * @group pholio
 */
final class PholioTransactionView
  extends PhabricatorApplicationTransactionView {

  protected function shouldGroupTransactions(
    PhabricatorApplicationTransaction $u,
    PhabricatorApplicationTransaction $v) {

    if ($u->getAuthorPHID() != $v->getAuthorPHID()) {
      // Don't group transactions by different authors.
      return false;
    }

    if (($v->getDateCreated() - $u->getDateCreated()) > 60) {
      // Don't group if transactions happened more than 60s apart.
      return false;
    }

    switch ($u->getTransactionType()) {
      case PhabricatorTransactions::TYPE_COMMENT:
      case PholioTransactionType::TYPE_INLINE:
        break;
      default:
        return false;
    }

    switch ($v->getTransactionType()) {
      case PholioTransactionType::TYPE_INLINE:
        return true;
    }

    return parent::shouldGroupTransactions($u, $v);
  }

  protected function renderTransactionContent(
    PhabricatorApplicationTransaction $xaction) {

    $out = array();

    $group = $xaction->getTransactionGroup();
    if ($xaction->getTransactionType() == PholioTransactionType::TYPE_INLINE) {
      array_unshift($group, $xaction);
    } else {
      $out[] = parent::renderTransactionContent($xaction);
    }

    if (!$group) {
      return $out;
    }

    $inlines = array();
    foreach ($group as $xaction) {
      switch ($xaction->getTransactionType()) {
        case PholioTransactionType::TYPE_INLINE:
          $inlines[] = $xaction;
          break;
        default:
          throw new Exception("Unknown grouped transaction type!");
      }
    }

    if ($inlines) {
      $header = phutil_tag(
        'div',
        array(
          'class' => 'phabricator-transaction-subheader',
        ),
        pht('Inline Comments'));

      $out[] = $header;
      foreach ($inlines as $inline) {
        if (!$inline->getComment()) {
          continue;
        }
        $out[] = $this->renderInlineContent($inline);
      }
    }

    return $out;
  }

  private function renderInlineContent(PholioTransaction $inline) {
    $comment = $inline->getComment();

    $thumb = phutil_tag(
      'img',
      array(
        'src' => '/pholio/inline/thumb/'.$comment->getImageID(),
        ));

    $link = phutil_tag(
      'a',
      array(
        'href' => '#'
      ),
      $thumb);

    $inline_comment = parent::renderTransactionContent($inline);

    return phutil_tag(
      'div',
      array('class' => 'pholio-transaction-inline-comment'),
      array($link, $inline_comment));
  }

}


text:
//-----------------------------------------------------------------------
// <copyright file="EnumeratorExtensions.cs" company="Akka.NET Project">
//     Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com>
//     Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------

using System.Collections.Generic;

namespace Akka.Util.Internal.Collections
{
    /// <summary>
    /// TBD
    /// </summary>
    public static class EnumeratorExtensions
    {
        /// <summary>
        /// TBD
        /// </summary>
        /// <typeparam name="T">TBD</typeparam>
        /// <param name="enumerable">TBD</param>
        /// <returns>TBD</returns>
        public static Iterator<T> Iterator<T>(this IEnumerable<T> enumerable)
        {
            return new Iterator<T>(enumerable);
        }
    }
}


text:
describe('Contribution Conditions', function() {
  'use strict';

  beforeEach(function(done) {
    var _this = this;

    requirejs(
      ['jquery', 'ContributionConditions'],
      function($, ContributionConditions) {
        _this.$html = $(window.__html__['spec/javascripts/fixtures/ContributionConditions.html']).appendTo('body');
        _this.component = _this.$html.find('[data-dough-component="ContributionConditions"]');
        _this.contributionConditions = ContributionConditions;
        _this.obj = new _this.contributionConditions(_this.component);
        done();
      }, done);
  });

  afterEach(function() {
    this.$html.remove();
  });

  describe('When an employee contribution percentage is entered', function() {

    beforeEach(function() {
      this.employeeContributions = this.component.find('[data-wpcc-employee-contributions]');
      this.eligibleSalary = this.component.find('[data-wpcc-contribution-salary]');
      this.contributionWarning = this.component.find('[data-wpcc-callout-contribution-gt40000]');

      this.obj.init();
    });

    describe('When salary contribution is under 40000', function() {
      it('Does not display the callout message', function() {
        this.employeeContributions.val(20);
        this.eligibleSalary.text('£60,000');
        this.employeeContributions.trigger('keyup');
        expect(
          this.contributionWarning.hasClass('details__callout--inactive')
        ).to.be.true;
      });
    });

    describe('When salary contribution is over 40000', function() {
      it('Displays the callout message', function() {
        this.employeeContributions.val(100);
        this.eligibleSalary.text('£60,000');
        this.employeeContributions.trigger('keyup');
        expect(
          this.contributionWarning.hasClass('details__callout--active')
        ).to.be.true;
      });
    });
  });
});


text:
from django.contrib import admin
from django.utils.translation import ugettext as _
from .models import Session, Dive, DataPoint

class DiveInline(admin.TabularInline):
    model = Dive

class DataPointInline(admin.TabularInline):
    model = DataPoint

class SessionAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'dive_count', 'comment')
    list_filter = ('date',)

    inlines = [DiveInline]

    def dive_count(self, obj):
        return obj.dive_set.count()
    dive_count.short_description = _(u'Antal dyk')

class DiveAdmin(admin.ModelAdmin):
    list_display = ('session', )

    inlines = [DataPointInline]

class DataPointAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', )

admin.site.register(Session, SessionAdmin)
admin.site.register(Dive, DiveAdmin)
admin.site.register(DataPoint, DataPointAdmin)


text:
class CreatePlaces < ActiveRecord::Migration
  def change
    create_table :places do |t|
      t.string :name
      t.string :country

      t.timestamps
    end
  end
end


text:
@extends('Akademik.masterAkademik')
@section('judul','Daftar Jadwal')

@section('content')

					Daftar Jadwal

									{{ Form::open(['route' => 'Jadwal.search','method' => 'post']) }}
											{{ Form::text('cari',null,['id' => 'cari','class' => 'col s12']) }}
											Cari
									{{ Form::close() }}

										No
										@sortablelink('kode_jadwal','Kode Jadwal')
										@sortablelink('kode_kelas','Kelas')
										@sortablelink('nip','Nama Dosen')
										@sortablelink('kode_ruang','Ruang')
										@sortablelink('kode_jurusan','Jurusan')
										@sortablelink('kode_mk','Mata Kuliah')
										Aksi

									@foreach($jadwals as $jadwal)

										{{ ++$no }}
										{{ $jadwal->kode_jadwal }}
										kelas_id)) }}">{{ $jadwal->nama_kelas }}
										{{ $jadwal->nama_dosen }}
										{{ $jadwal->nama_ruang }}
										{{ $jadwal->nama_jurusan }}
										{{ $jadwal->makul }}

											{{Form::Open(['method' => 'DELETE','route' => ['Jadwal.destroy',encrypt($jadwal->jadwal_id)]])}}
												jadwal_id))}}" class="btn-floating btn-sm waves-light waves-effect blue">
													mode_edit

												<button type="submit" class="btn btn-floating waves-effect waves-light red">
													delete
												</button>
											{{ Form::close()}}

									@endforeach

								{!! $jadwals->appends(\Request::except('page'))->render('vendor.pagination.customPagination') !!}

							@if(session()->has('status'))

							@endif

@endsection


text:
#ifndef NX_FOUNDATION_NXALLOCATOR_DEFAULT
#define NX_FOUNDATION_NXALLOCATOR_DEFAULT
/*----------------------------------------------------------------------------*\
|
|					Public Interface to NVIDIA PhysX Technology
|
|							     www.nvidia.com
|
\*----------------------------------------------------------------------------*/
/** \addtogroup foundation
  @{
*/

#include "Nx.h"
#include "NxUserAllocator.h"

#include <stdlib.h>

#if defined(WIN32) && NX_DEBUG_MALLOC
	#include <crtdbg.h>
#endif
/**
\brief Default memory allocator using standard C malloc / free / realloc.
*/
class NxAllocatorDefault
	{
	public:
		/**
		Allocates size bytes of memory.

		Compatible with the standard C malloc().

		\param size Number of bytes to allocate.
		\param type A hint about what the memory will be used for. See #NxMemoryType.
		*/
		NX_INLINE void* malloc(size_t size, NxMemoryType type)
			{
			NX_UNREFERENCED_PARAMETER(type);
			return ::malloc(size);
			}

		/**
		Allocates size bytes of memory.

		Same as above, but with extra debug info fields.

		\param size Number of bytes to allocate.
		\param fileName File which is allocating the memory.
		\param line Line which is allocating the memory.
		\param className Name of the class which is allocating the memory.
		\param type A hint about what the memory will be used for. See #NxMemoryType.
		*/
		NX_INLINE void* mallocDEBUG(size_t size, const char* fileName, int line, const char* className, NxMemoryType type)
			{
			NX_UNREFERENCED_PARAMETER(type);
			NX_UNREFERENCED_PARAMETER(className);
#ifdef _DEBUG
	#if defined(WIN32) && NX_DEBUG_MALLOC
			return ::_malloc_dbg(size, _NORMAL_BLOCK, fileName, line);
	#else
			NX_UNREFERENCED_PARAMETER(fileName);
			NX_UNREFERENCED_PARAMETER(line);
	// TODO: insert a Linux Debugger Function
			return ::malloc(size);
	#endif
#else
			NX_UNREFERENCED_PARAMETER(fileName);
			NX_UNREFERENCED_PARAMETER(line);
			NX_UNREFERENCED_PARAMETER(size);
			NX_ASSERT(0);//Don't use debug malloc for release mode code!
			return 0;
#endif
			}

		/**
		Resizes the memory block previously allocated with malloc() or
		realloc() to be size() bytes, and returns the possibly moved memory.

		Compatible with the standard C realloc().

		\param memory Memory block to change the size of.
		\param size New size for memory block.
		*/
		NX_INLINE void* realloc(void* memory, size_t size)
			{
			return ::realloc(memory,size);
			}

		/**
		Frees the memory previously allocated by malloc() or realloc().

		Compatible with the standard C free().

		\param memory Memory to free.
		*/
		NX_INLINE void free(void* memory)
			{
			if(memory)	::free(memory);	// Deleting null ptrs is valid, but still useless
			}

		/**
		Check a memory block is valid.
		*/
		NX_INLINE void check(void* memory)
			{
			NX_UNREFERENCED_PARAMETER(memory);
			}
	};

 /** @} */
#endif
//NVIDIACOPYRIGHTBEGIN
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010 NVIDIA Corporation
// All rights reserved. www.nvidia.com
///////////////////////////////////////////////////////////////////////////
//NVIDIACOPYRIGHTEND


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Syll. fung. (Abellini) 2: 618 (1883)

#### Original name
Dothidea hibiscicola Schwein., 1832

### Remarks
null


text:
require 'spec_helper'
require 'dragon'

describe Command do
  describe '.handler' do

    let(:fake_engine) { instance_double('Engine') }
    let(:fake_handler) { instance_double('CommandHandler') }

    it 'should indicate a reasonable handler class' do
      expect(Object).to receive(:const_get).
        with("Dragon::Handlers::CommandHandler").
        and_return(fake_handler)

      expect(fake_handler).to receive(:new).with(fake_engine)

      subject.class.handler(fake_engine)
    end
  end
end


text:
package org.apache.felix.ipojo.test.scenarios.service.dependency;

import java.util.Properties;

import org.apache.felix.ipojo.ComponentInstance;
import org.apache.felix.ipojo.architecture.Architecture;
import org.apache.felix.ipojo.architecture.InstanceDescription;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
import org.apache.felix.ipojo.test.scenarios.util.Utils;
import org.osgi.framework.ServiceReference;

public class MethodSimpleDependencies extends OSGiTestCase {

	ComponentInstance instance3, instance4, instance5, instance6, instance7;
	ComponentInstance fooProvider;

	public void setUp() {
		try {
			Properties prov = new Properties();
			prov.put("instance.name","FooProvider");
			fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
			fooProvider.stop();

			Properties i3 = new Properties();
			i3.put("instance.name","Object");
			instance3 = Utils.getFactoryByName(getContext(), "MObjectCheckServiceProvider").createComponentInstance(i3);
            assertNotNull("check instance 3", instance3);

			Properties i4 = new Properties();
			i4.put("instance.name","Ref");
			instance4 = Utils.getFactoryByName(getContext(), "MRefCheckServiceProvider").createComponentInstance(i4);
            assertNotNull("check instance 4", instance4);

            Properties i5 = new Properties();
            i5.put("instance.name","Both");
            instance5 = Utils.getFactoryByName(getContext(), "MBothCheckServiceProvider").createComponentInstance(i5);
            assertNotNull("check instance 5", instance5);

            Properties i6 = new Properties();
            i6.put("instance.name","Map");
            instance6 = Utils.getFactoryByName(getContext(), "MMapCheckServiceProvider").createComponentInstance(i6);

            Properties i7 = new Properties();
            i7.put("instance.name","Dictionary");
            instance7 = Utils.getFactoryByName(getContext(), "MDictCheckServiceProvider").createComponentInstance(i7);
		} catch(Exception e) { fail(e.getMessage()); }

	}

	public void tearDown() {
		instance3.dispose();
		instance4.dispose();
		instance5.dispose();
		instance6.dispose();
        instance7.dispose();
        fooProvider.dispose();
        instance3 = null;
        instance4 = null;
        instance5 = null;
        instance6 = null;
        instance7 = null;
		fooProvider = null;
	}

	public void testObject() {
		ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
		assertNotNull("Check architecture availability", arch_ref);
		InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
		assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);

		fooProvider.start();

		id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
		assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);

		ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
		assertNotNull("Check CheckService availability", cs_ref);
		CheckService cs = (CheckService) getContext().getService(cs_ref);
		Properties props = cs.getProps();
		//Check properties
		assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
		assertEquals("check void bind invocation -1", ((Integer)props.get("voidB")).intValue(), 0);
		assertEquals("check void unbind callback invocation -1", ((Integer)props.get("voidU")).intValue(), 0);
		assertEquals("check object bind callback invocation -1", ((Integer)props.get("objectB")).intValue(), 1);
		assertEquals("check object unbind callback invocation -1", ((Integer)props.get("objectU")).intValue(), 0);
		assertEquals("check ref bind callback invocation -1", ((Integer)props.get("refB")).intValue(), 0);
		assertEquals("check ref unbind callback invocation -1", ((Integer)props.get("refU")).intValue(), 0);
		assertEquals("check both bind callback invocation -1", ((Integer)props.get("bothB")).intValue(), 0);
        assertEquals("check both unbind callback invocation -1", ((Integer)props.get("bothU")).intValue(), 0);

		fooProvider.stop();

		id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
		assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);

		id = null;
		cs = null;
		getContext().ungetService(arch_ref);
		getContext().ungetService(cs_ref);
	}

	public void testRef() {
		ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
		assertNotNull("Check architecture availability", arch_ref);
		InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
		assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);

		fooProvider.start();

		id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
		assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);

		ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
		assertNotNull("Check CheckService availability", cs_ref);
		CheckService cs = (CheckService) getContext().getService(cs_ref);
		Properties props = cs.getProps();
		//Check properties
		assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
		assertEquals("check void bind invocation -1", ((Integer)props.get("voidB")).intValue(), 0);
		assertEquals("check void unbind callback invocation -1", ((Integer)props.get("voidU")).intValue(), 0);
		assertEquals("check object bind callback invocation -1", ((Integer)props.get("objectB")).intValue(), 0);
		assertEquals("check object unbind callback invocation -1", ((Integer)props.get("objectU")).intValue(), 0);
		assertEquals("check ref bind callback invocation -1", ((Integer)props.get("refB")).intValue(), 1);
		assertEquals("check ref unbind callback invocation -1", ((Integer)props.get("refU")).intValue(), 0);
		assertEquals("check both bind callback invocation -1", ((Integer)props.get("bothB")).intValue(), 0);
        assertEquals("check both unbind callback invocation -1", ((Integer)props.get("bothU")).intValue(), 0);

		fooProvider.stop();

		id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
		assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);

		id = null;
		cs = null;
		getContext().ungetService(arch_ref);
		getContext().ungetService(cs_ref);
	}

	public void testBoth() {
        ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
        assertNotNull("Check architecture availability", arch_ref);
        InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
        assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);

        fooProvider.start();

        id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
        assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);

        ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
        assertNotNull("Check CheckService availability", cs_ref);
        CheckService cs = (CheckService) getContext().getService(cs_ref);
        Properties props = cs.getProps();
        //Check properties
        assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
        assertEquals("check void bind invocation -1", ((Integer)props.get("voidB")).intValue(), 0);
        assertEquals("check void unbind callback invocation -1", ((Integer)props.get("voidU")).intValue(), 0);
        assertEquals("check object bind callback invocation -1", ((Integer)props.get("objectB")).intValue(), 0);
        assertEquals("check object unbind callback invocation -1", ((Integer)props.get("objectU")).intValue(), 0);
        assertEquals("check ref bind callback invocation -1", ((Integer)props.get("refB")).intValue(), 0);
        assertEquals("check ref unbind callback invocation -1", ((Integer)props.get("refU")).intValue(), 0);
        assertEquals("check both bind callback invocation -1", ((Integer)props.get("bothB")).intValue(), 1);
        assertEquals("check both unbind callback invocation -1", ((Integer)props.get("bothU")).intValue(), 0);

        fooProvider.stop();

        id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
        assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);

        id = null;
        cs = null;
        getContext().ungetService(arch_ref);
        getContext().ungetService(cs_ref);
    }

	public void testMap() {
        ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
        assertNotNull("Check architecture availability", arch_ref);
        InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
        assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);

        fooProvider.start();

        id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
        assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);

        ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
        assertNotNull("Check CheckService availability", cs_ref);
        CheckService cs = (CheckService) getContext().getService(cs_ref);
        Properties props = cs.getProps();
        //Check properties
        assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
        assertEquals("check void bind invocation -1", ((Integer)props.get("voidB")).intValue(), 0);
        assertEquals("check void unbind callback invocation -1", ((Integer)props.get("voidU")).intValue(), 0);
        assertEquals("check object bind callback invocation -1", ((Integer)props.get("objectB")).intValue(), 0);
        assertEquals("check object unbind callback invocation -1", ((Integer)props.get("objectU")).intValue(), 0);
        assertEquals("check ref bind callback invocation -1", ((Integer)props.get("refB")).intValue(), 0);
        assertEquals("check ref unbind callback invocation -1", ((Integer)props.get("refU")).intValue(), 0);
        assertEquals("check both bind callback invocation -1", ((Integer)props.get("bothB")).intValue(), 0);
        assertEquals("check both unbind callback invocation -1", ((Integer)props.get("bothU")).intValue(), 0);
        assertEquals("check map bind callback invocation -1", ((Integer)props.get("mapB")).intValue(), 1);
        assertEquals("check map unbind callback invocation -1", ((Integer)props.get("mapU")).intValue(), 0);
        assertEquals("check dict bind callback invocation -1", ((Integer)props.get("dictB")).intValue(), 0);
        assertEquals("check dict unbind callback invocation -1", ((Integer)props.get("dictU")).intValue(), 0);

        fooProvider.stop();

        id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
        assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);

        id = null;
        cs = null;
        getContext().ungetService(arch_ref);
        getContext().ungetService(cs_ref);
    }

	public void testDict() {
        ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
        assertNotNull("Check architecture availability", arch_ref);
        InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
        assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);

        fooProvider.start();

        id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
        assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);

        ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
        assertNotNull("Check CheckService availability", cs_ref);
        CheckService cs = (CheckService) getContext().getService(cs_ref);
        Properties props = cs.getProps();
        //Check properties
        assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
        assertEquals("check void bind invocation -1", ((Integer)props.get("voidB")).intValue(), 0);
        assertEquals("check void unbind callback invocation -1", ((Integer)props.get("voidU")).intValue(), 0);
        assertEquals("check object bind callback invocation -1", ((Integer)props.get("objectB")).intValue(), 0);
        assertEquals("check object unbind callback invocation -1", ((Integer)props.get("objectU")).intValue(), 0);
        assertEquals("check ref bind callback invocation -1", ((Integer)props.get("refB")).intValue(), 0);
        assertEquals("check ref unbind callback invocation -1", ((Integer)props.get("refU")).intValue(), 0);
        assertEquals("check both bind callback invocation -1", ((Integer)props.get("bothB")).intValue(), 0);
        assertEquals("check both unbind callback invocation -1", ((Integer)props.get("bothU")).intValue(), 0);
        assertEquals("check map bind callback invocation -1", ((Integer)props.get("mapB")).intValue(), 0);
        assertEquals("check map unbind callback invocation -1", ((Integer)props.get("mapU")).intValue(), 0);
        assertEquals("check dict bind callback invocation -1", ((Integer)props.get("dictB")).intValue(), 1);
        assertEquals("check dict unbind callback invocation -1", ((Integer)props.get("dictU")).intValue(), 0);

        fooProvider.stop();

        id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
        assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);

        id = null;
        cs = null;
        getContext().ungetService(arch_ref);
        getContext().ungetService(cs_ref);
    }

}


text:
namespace Microsoft.DataTransfer.CsvFile.Reader
{
    sealed class CsvReaderConfiguration
    {
        public bool TrimQuoted { get; set; }
        public bool IgnoreUnquotedNulls { get; set; }
    }
}


text:
package org.apache.hadoop.fs.contract.s3;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.contract.AbstractContractRootDirectoryTest;
import org.apache.hadoop.fs.contract.AbstractFSContract;

import org.junit.Ignore;
import org.junit.Test;

/**
 * root dir operations against an S3 bucket
 */
@Deprecated
public class TestS3ContractRootDir extends AbstractContractRootDirectoryTest {

  @Override
  protected AbstractFSContract createContract(Configuration conf) {
    return new S3Contract(conf);
  }

  @Override
  @Test
  @Ignore
  public void testRmEmptyRootDirNonRecursive() {
  }

  @Override
  @Test
  @Ignore
  public void testRmRootRecursive() {
  }
}


text:
Mjölnir Authentication Server
=============================

[![Build Status](https://travis-ci.org/rutkai/Mjolnir-Authentication-Server.svg?branch=master)](https://travis-ci.org/rutkai/Mjolnir-Authentication-Server)

Abstract
--------

Mjölnir authentication is fully compatible with Yggdrasil authentication which is used by Minecraft and other Mojang apps.
However, Mjölnir is developed for replacing the authentication system of Minecraft in case you want an own authentication server.

Features (planned):

- Backup authentication server (in proxy mode)
- Rate limit

In which cases are good such a system?

- You have users who do not have premium but you still want to maintain an online server.
- You want to have a backup authentication system.
- ...or just because you can do it. :)

Usage (clients/servers)
------------------------------

See [Usage guide](docs/Usage.md).

Installation/Usage (Mjölnir)
----------------------

See [Installation guide](docs/Installation.md).

Utilities
---------

See [Utilities page](docs/Utilities.md).

Dev Installation
----------------

See [Contribution guide](CONTRIBUTION.md) for dev installation.

Specification
-------------

[Documentation](http://wiki.vg/Authentication)

Roadmap/Changelog
-----------------

* 1.0.0: User management with file backend
* 1.1.0: MongoDB backend
* 1.2.0: Transparent (proxy) mode

License
-------

**MIT**


text:
package org.sanelib.ils.api.services.binder;

import org.sanelib.ils.api.converters.binder.BinderViewConverter;
import org.sanelib.ils.api.dto.binder.BinderDto;
import org.sanelib.ils.api.services.ApiEndPointConstants;
import org.sanelib.ils.api.services.ApiServiceBase;
import org.sanelib.ils.core.activities.ActivitiProcessConstants;
import org.sanelib.ils.core.dao.read.admin.BinderViewRepository;
import org.sanelib.ils.core.domain.view.admin.BinderView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

@Component
@Path(ApiEndPointConstants.Admin.BINDER_END_POINT)
@Produces(MediaType.APPLICATION_JSON)
public class BinderService extends ApiServiceBase {

    @Autowired
    BinderViewRepository binderViewRepository;

    @Autowired
    BinderViewConverter binderViewConverter;

    @GET
    @SuppressWarnings("unchecked")
    public List getAllBinders() throws Throwable {

        List dtoList = new ArrayList<>();
        List viewList = binderViewRepository.getAllBinders();

        dtoList.addAll((Collection) viewList.stream().map(v -> binderViewConverter.convert((BinderView) v)).collect(Collectors.toList()));

        return dtoList;
    }

    @POST
    public String addBinder(BinderDto dto) throws Throwable {
        return execute(dto, ActivitiProcessConstants.Admin.ADD_BINDER);
    }

    @PUT
    public String updateBinder(BinderDto dto) throws Throwable {
        return execute(dto, ActivitiProcessConstants.Admin.UPDATE_BINDER);
    }

    @DELETE
    @Path("/{libraryId}/{id}")
    public String deleteBinder(@PathParam("libraryId") String libraryId, @PathParam("id") String id) throws Throwable {
        BinderDto dto = new BinderDto();

        dto.setLibraryId(libraryId);
        dto.setId(id);

        return execute(dto, ActivitiProcessConstants.Admin.DELETE_BINDER);
    }
}