text:
<?php

namespace Repository;

use Silex\Application;
use Entity\Company;
use Repository\BaseRepository;
use Repository\CategoryRepository;

/**
 * Company Repository
 *
 * @see BaseRepository
 *
 * @author Pomian Ghe. Aurelian
 */
class CompanyRepository extends BaseRepository
{
    /**
     * @var CategoryRepository
     */
    protected $categoryRepository;

    /**
     * {@inheritdoc}
     */
    public function __construct(Application $app)
    {
        parent::__construct($app);
        $this->categoryRepository = new CategoryRepository($this->app);
    }

    /**
     * Find all companies as arrays grouped by category.
     *
     * @return Company[category][]
     */
    public function findAllAsArraysGroupedByCategory()
    {
        $companiesArr = $this->findAll('category_id');
        $companyMapByCategory = [];

        $categories = $this->categoryRepository->findAll();

        foreach ($companiesArr as $company) {
            $companyMapByCategory[$company->category_id][] = $company;
        }

        return $companyMapByCategory;
    }

    /**
     * {@inheritdoc}
     */
    protected function getTableName()
    {
        return 'company';
    }

    /**
     * {@inheritdoc}
     */
    protected function getNewEntityInstance()
    {
        return new Company();
    }
}


text:
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery                                    |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2014 Piwigo Team                  http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify  |
// | it under the terms of the GNU General Public License as published by  |
// | the Free Software Foundation                                          |
// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+

if (!defined('PHPWG_ROOT_PATH'))
{
  die ("Hacking attempt!");
}

include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php');
include_once(PHPWG_ROOT_PATH.'admin/include/c13y_internal.class.php');
include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');

// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok                      |
// +-----------------------------------------------------------------------+
check_status(ACCESS_ADMINISTRATOR);

// +-----------------------------------------------------------------------+
// |                                actions                                |
// +-----------------------------------------------------------------------+

// Check for upgrade : code inspired from punbb
if (isset($_GET['action']) and 'check_upgrade' == $_GET['action'])
{
  if (!fetchRemote(PHPWG_URL.'/download/latest_version', $result))
  {
    $page['errors'][] = l10n('Unable to check for upgrade.');
  }
  else
  {
    $versions = array('current' => PHPWG_VERSION);
    $lines = @explode("\r\n", $result);

    // if the current version is a BSF (development branch) build, we check
    // the first line, for stable versions, we check the second line
    if (preg_match('/^BSF/', $versions['current']))
    {
      $versions['latest'] = trim($lines[0]);

      // because integer are limited to 4,294,967,296 we need to split BSF
      // versions in date.time
      foreach ($versions as $key => $value)
      {
        $versions[$key] =
          preg_replace('/BSF_(\d{8})(\d{4})/', '$1.$2', $value);
      }
    }
    else
    {
      $versions['latest'] = trim($lines[1]);
    }

    if ('' == $versions['latest'])
    {
      $page['errors'][] = l10n('Check for upgrade failed for unknown reasons.');
    }
    // concatenation needed to avoid automatic transformation by release
    // script generator
    else if ('%'.'PWGVERSION'.'%' == $versions['current'])
    {
      $page['infos'][] = l10n('You are running on development sources, no check possible.');
    }
    else if (version_compare($versions['current'], $versions['latest']) < 0)
    {
      $page['infos'][] = l10n('A new version of Piwigo is available.');
    }
    else
    {
      $page['infos'][] = l10n('You are running the latest version of Piwigo.');
    }
  }
}
// Show phpinfo() output
else if (isset($_GET['action']) and 'phpinfo' == $_GET['action'])
{
  phpinfo();
  exit();
}

// +-----------------------------------------------------------------------+
// |                             template init                             |
// +-----------------------------------------------------------------------+

$template->set_filenames(array('intro' => 'intro.tpl'));

if ($conf['show_newsletter_subscription']) {
  $template->assign(
    array(
      'EMAIL' => $user['email'],
      'SUBSCRIBE_BASE_URL' => get_newsletter_subscribe_base_url($user['language']),
      )
    );
}

$php_current_timestamp = date("Y-m-d H:i:s");
$db_version = pwg_get_db_version();
list($db_current_date) = pwg_db_fetch_row(pwg_query('SELECT now();'));

$query = '
SELECT COUNT(*)
  FROM '.IMAGES_TABLE.'
;';
list($nb_elements) = pwg_db_fetch_row(pwg_query($query));

$query = '
SELECT COUNT(*)
  FROM '.CATEGORIES_TABLE.'
;';
list($nb_categories) = pwg_db_fetch_row(pwg_query($query));

$query = '
SELECT COUNT(*)
  FROM '.CATEGORIES_TABLE.'
  WHERE dir IS NULL
;';
list($nb_virtual) = pwg_db_fetch_row(pwg_query($query));

$query = '
SELECT COUNT(*)
  FROM '.CATEGORIES_TABLE.'
  WHERE dir IS NOT NULL
;';
list($nb_physical) = pwg_db_fetch_row(pwg_query($query));

$query = '
SELECT COUNT(*)
  FROM '.IMAGE_CATEGORY_TABLE.'
;';
list($nb_image_category) = pwg_db_fetch_row(pwg_query($query));

$query = '
SELECT COUNT(*)
  FROM '.TAGS_TABLE.'
;';
list($nb_tags) = pwg_db_fetch_row(pwg_query($query));

$query = '
SELECT COUNT(*)
  FROM '.IMAGE_TAG_TABLE.'
;';
list($nb_image_tag) = pwg_db_fetch_row(pwg_query($query));

$query = '
SELECT COUNT(*)
  FROM '.USERS_TABLE.'
;';
list($nb_users) = pwg_db_fetch_row(pwg_query($query));

$query = '
SELECT COUNT(*)
  FROM '.GROUPS_TABLE.'
;';
list($nb_groups) = pwg_db_fetch_row(pwg_query($query));

$query = '
SELECT COUNT(*)
  FROM '.RATE_TABLE.'
;';
list($nb_rates) = pwg_db_fetch_row(pwg_query($query));

$template->assign(
  array(
    'PHPWG_URL' => PHPWG_URL,
    'PWG_VERSION' => PHPWG_VERSION,
    'OS' => PHP_OS,
    'PHP_VERSION' => phpversion(),
    'DB_ENGINE' => 'MySQL',
    'DB_VERSION' => $db_version,
    'DB_ELEMENTS' => l10n_dec('%d photo', '%d photos', $nb_elements),
    'DB_CATEGORIES' =>
      l10n_dec('%d album including', '%d albums including', $nb_categories).
      l10n_dec('%d physical', '%d physicals', $nb_physical).
      l10n_dec(' and %d virtual', ' and %d virtuals', $nb_virtual),
    'DB_IMAGE_CATEGORY' => l10n_dec('%d association', '%d associations', $nb_image_category),
    'DB_TAGS' => l10n_dec('%d tag', '%d tags', $nb_tags),
    'DB_IMAGE_TAG' => l10n_dec('%d association', '%d associations', $nb_image_tag),
    'DB_USERS' => l10n_dec('%d user', '%d users', $nb_users),
    'DB_GROUPS' => l10n_dec('%d group', '%d groups', $nb_groups),
    'DB_RATES' => ($nb_rates == 0) ? l10n('no rate') : l10n('%d rates', $nb_rates),
    'U_CHECK_UPGRADE' => PHPWG_ROOT_PATH.'admin.php?action=check_upgrade',
    'U_PHPINFO' => PHPWG_ROOT_PATH.'admin.php?action=phpinfo',
    'PHP_DATATIME' => $php_current_timestamp,
    'DB_DATATIME' => $db_current_date,
    )
  );

if ($conf['activate_comments'])
{
  $query = '
SELECT COUNT(*)
  FROM '.COMMENTS_TABLE.'
;';
  list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
  $template->assign('DB_COMMENTS', l10n_dec('%d comment', '%d comments', $nb_comments));
}

if ($nb_elements > 0)
{
  $query = '
SELECT MIN(date_available)
  FROM '.IMAGES_TABLE.'
;';
  list($first_date) = pwg_db_fetch_row(pwg_query($query));

  $template->assign(
    'first_added',
    array(
      'DB_DATE' =>
      l10n('first photo added on %s', format_date($first_date))
      )
    );
}

// graphics library
switch (pwg_image::get_library())
{
  case 'imagick':
    $library = 'ImageMagick';
    $img = new Imagick();
    $version = $img->getVersion();
    if (preg_match('/ImageMagick \d+\.\d+\.\d+-?\d*/', $version['versionString'], $match))
    {
      $library = $match[0];
    }
    $template->assign('GRAPHICS_LIBRARY', $library);
    break;

  case 'ext_imagick':
    $library = 'External ImageMagick';
    exec($conf['ext_imagick_dir'].'convert -version', $returnarray);
    if (preg_match('/Version: ImageMagick (\d+\.\d+\.\d+-?\d*)/', $returnarray[0], $match))
    {
      $library .= ' ' . $match[1];
    }
    $template->assign('GRAPHICS_LIBRARY', $library);
    break;

  case 'gd':
    $gd_info = gd_info();
    $template->assign('GRAPHICS_LIBRARY', 'GD '.@$gd_info['GD Version']);
    break;
}

// +-----------------------------------------------------------------------+
// |                           sending html code                           |
// +-----------------------------------------------------------------------+

$template->assign_var_from_handle('ADMIN_CONTENT', 'intro');

// Check integrity
$c13y = new check_integrity();
// add internal checks
new c13y_internal();
// check and display
$c13y->check();
$c13y->display();

?>

redpajama_set_name: RedPajamaGithub


text:
package io.fabric8.kubernetes.client.dsl.internal;

import io.fabric8.kubernetes.api.builder.Visitor;
import io.fabric8.kubernetes.api.model.Doneable;
import io.fabric8.kubernetes.api.model.HasMetadata;
import io.fabric8.kubernetes.api.model.KubernetesResourceList;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientException;
import io.fabric8.kubernetes.client.dsl.ClientResource;

import java.lang.reflect.InvocationTargetException;

public class HasMetadataOperation<C extends KubernetesClient, T extends HasMetadata, L extends KubernetesResourceList, D extends Doneable<T>, R extends ClientResource<T, D>> extends BaseOperation<C, T, L, D, R> {

  protected HasMetadataOperation(C client, String resourceT, String namespace, String name) {
    super(client, resourceT, namespace, name);
  }

  @Override
  public D edit(final boolean cascade) throws KubernetesClientException {
    final BaseOperation oper = this;

    final Visitor<T> visitor = new Visitor<T>() {
      @Override
      public void visit(T resource) {
        try {
          if (cascade) {
            Reaper reaper = ReaperFactory.getReaper(oper);
            if (reaper != null) {
              reaper.reap();
            }
          }
          resource.getMetadata().setResourceVersion(null);
          handleReplace(getResourceUrl(), resource);
        } catch (Exception e) {
          throw KubernetesClientException.launderThrowable(e);
        }
      }
    };

    try {
      return getDoneableType().getDeclaredConstructor(getType(), Visitor.class).newInstance(get(), visitor);
    } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | InstantiationException e) {
      throw KubernetesClientException.launderThrowable(e);
    }
  }

  @Override
  public T replace(T item, boolean cascade) {
    try {
      if (cascade) {
        Reaper reaper = ReaperFactory.getReaper(this);
        if (reaper != null) {
          reaper.reap();
        }
      }
      item.getMetadata().setResourceVersion(null);
      return handleReplace(getResourceUrl(), item);
    } catch (Exception e) {
      throw KubernetesClientException.launderThrowable(e);
    }
  }
}


text:
/*
 * Configuration :
 * To use without BIOS -DOVERRIDE=base_address -DCONTROLLER=FD or SEAGATE
 * -DIRQ will override the default of 5.
 * Note: You can now set these options from the kernel's "command line".
 * The syntax is:
 *
 *     st0x=ADDRESS,IRQ                (for a Seagate controller)
 * or:
 *     tmc8xx=ADDRESS,IRQ              (for a TMC-8xx or TMC-950 controller)
 * eg:
 *     tmc8xx=0xC8000,15
 *
 * will configure the driver for a TMC-8xx style controller using IRQ 15
 * with a base address of 0xC8000.
 *
 * -DFAST or -DFAST32 will use blind transfers where possible
 *
 * -DARBITRATE will cause the host adapter to arbitrate for the
 *	bus for better SCSI-II compatibility, rather than just
 *	waiting for BUS FREE and then doing its thing.  Should
 *	let us do one command per Lun when I integrate my
 *	reorganization changes into the distribution sources.
 *
 * -DSLOW_HANDSHAKE will allow compatibility with broken devices that don't
 *	handshake fast enough (ie, some CD ROM's) for the Seagate
 * 	code.
 *
 * -DSLOW_RATE=x, x some number will let you specify a default
 *	transfer rate if handshaking isn't working correctly.
 */

#include <linux/module.h>

#include <asm/io.h>
#include <asm/system.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/config.h>
#include <linux/proc_fs.h>

#include <linux/blk.h>
#include "scsi.h"
#include "hosts.h"
#include "seagate.h"
#include "constants.h"
#include<linux/stat.h>

struct proc_dir_entry proc_scsi_seagate = {
    PROC_SCSI_SEAGATE, 7, "seagate",
    S_IFDIR | S_IRUGO | S_IXUGO, 2
};

#ifndef IRQ
#define IRQ 5
#endif

#if (defined(FAST32) && !defined(FAST))
#define FAST
#endif

#if defined(SLOW_RATE) && !defined(SLOW_HANDSHAKE)
#define SLOW_HANDSHAKE
#endif

#if defined(SLOW_HANDSHAKE) && !defined(SLOW_RATE)
#define SLOW_RATE 50
#endif

#if defined(LINKED)
#undef LINKED		/* Linked commands are currently broken ! */
#endif

static int internal_command(unsigned char target, unsigned char lun,
			    const void *cmnd,
			 void *buff, int bufflen, int reselect);

static int incommand;			/*
						set if arbitration has finished and we are
						in some command phase.
					*/

static const void *base_address = NULL;	/*
						Where the card ROM starts,
						used to calculate memory mapped
						register location.
					*/
#ifdef notyet
static volatile int abort_confirm = 0;
#endif

static volatile void *st0x_cr_sr;       /*
						control register write,
						status register read.
						256 bytes in length.

						Read is status of SCSI BUS,
						as per STAT masks.

					*/

static volatile void *st0x_dr;         /*
						data register, read write
						256 bytes in length.
					*/

static volatile int st0x_aborted=0;	/*
						set when we are aborted, ie by a time out, etc.
					*/

static unsigned char controller_type = 0; /* set to SEAGATE for ST0x boards or FD for TMC-8xx boards */
static unsigned char irq = IRQ;

#define retcode(result) (((result) << 16) | (message << 8) | status)
#define STATUS (*(volatile unsigned char *) st0x_cr_sr)
#define CONTROL STATUS
#define DATA (*(volatile unsigned char *) st0x_dr)

void st0x_setup (char *str, int *ints) {
    controller_type = SEAGATE;
    base_address = (void *) ints[1];
    irq = ints[2];
}

void tmc8xx_setup (char *str, int *ints) {
    controller_type = FD;
    base_address = (void *) ints[1];
    irq = ints[2];
}

#ifndef OVERRIDE
static const char *  seagate_bases[] = {
	(char *) 0xc8000, (char *) 0xca000, (char *) 0xcc000,
	(char *) 0xce000, (char *) 0xdc000, (char *) 0xde000
};

typedef struct {
	const char *signature ;
	unsigned offset;
	unsigned length;
	unsigned char type;
} Signature;

static const Signature signatures[] = {
#ifdef CONFIG_SCSI_SEAGATE
{"ST01 v1.7  (C) Copyright 1987 Seagate", 15, 37, SEAGATE},
{"SCSI BIOS 2.00  (C) Copyright 1987 Seagate", 15, 40, SEAGATE},

/*
 * The following two lines are NOT mistakes.  One detects ROM revision
 * 3.0.0, the other 3.2.  Since seagate has only one type of SCSI adapter,
 * and this is not going to change, the "SEAGATE" and "SCSI" together
 * are probably "good enough"
 */

{"SEAGATE SCSI BIOS ",16, 17, SEAGATE},
{"SEAGATE SCSI BIOS ",17, 17, SEAGATE},

/*
 * However, future domain makes several incompatible SCSI boards, so specific
 * signatures must be used.
 */

{"FUTURE DOMAIN CORP. (C) 1986-1989 V5.0C2/14/89", 5, 46, FD},
{"FUTURE DOMAIN CORP. (C) 1986-1989 V6.0A7/28/89", 5, 46, FD},
{"FUTURE DOMAIN CORP. (C) 1986-1990 V6.0105/31/90",5, 47, FD},
{"FUTURE DOMAIN CORP. (C) 1986-1990 V6.0209/18/90",5, 47, FD},
{"FUTURE DOMAIN CORP. (C) 1986-1990 V7.009/18/90", 5, 46, FD},
{"FUTURE DOMAIN CORP. (C) 1992 V8.00.004/02/92",   5, 44, FD},
{"IBM F1 BIOS V1.1004/30/92",			   5, 25, FD},
{"FUTURE DOMAIN TMC-950",                        5, 21, FD},
#endif /* CONFIG_SCSI_SEAGATE */
}
;

#define NUM_SIGNATURES (sizeof(signatures) / sizeof(Signature))
#endif /* n OVERRIDE */

/*
 * hostno stores the hostnumber, as told to us by the init routine.
 */

static int hostno = -1;
static void seagate_reconnect_intr(int, void *, struct pt_regs *);

#ifdef FAST
static int fast = 1;
#endif

#ifdef SLOW_HANDSHAKE
/*
 * Support for broken devices :
 * The Seagate board has a handshaking problem.  Namely, a lack
 * thereof for slow devices.  You can blast 600K/second through
 * it if you are polling for each byte, more if you do a blind
 * transfer.  In the first case, with a fast device, REQ will
 * transition high-low or high-low-high before your loop restarts
 * and you'll have no problems.  In the second case, the board
 * will insert wait states for up to 13.2 usecs for REQ to
 * transition low->high, and everything will work.
 *
 * However, there's nothing in the state machine that says
 * you *HAVE* to see a high-low-high set of transitions before
 * sending the next byte, and slow things like the Trantor CD ROMS
 * will break because of this.
 *
 * So, we need to slow things down, which isn't as simple as it
 * seems.  We can't slow things down period, because then people
 * who don't recompile their kernels will shoot me for ruining
 * their performance.  We need to do it on a case per case basis.
 *
 * The best for performance will be to, only for borken devices
 * (this is stored on a per-target basis in the scsi_devices array)
 *
 * Wait for a low->high transition before continuing with that
 * transfer.  If we timeout, continue anyways.  We don't need
 * a long timeout, because REQ should only be asserted until the
 * corresponding ACK is received and processed.
 *
 * Note that we can't use the system timer for this, because of
 * resolution, and we *really* can't use the timer chip since
 * gettimeofday() and the beeper routines use that.  So,
 * the best thing for us to do will be to calibrate a timing
 * loop in the initialization code using the timer chip before
 * gettimeofday() can screw with it.
 */

static int borken_calibration = 0;
static void borken_init (void) {
  register int count = 0, start = jiffies + 1, stop = start + 25;

  while (jiffies < start);
  for (;jiffies < stop; ++count);

/*
 * Ok, we now have a count for .25 seconds.  Convert to a
 * count per second and divide by transfer rate in K.
 */

  borken_calibration =  (count * 4) / (SLOW_RATE*1024);

  if (borken_calibration < 1)
  	borken_calibration = 1;
#if (DEBUG & DEBUG_BORKEN)
  printk("scsi%d : borken calibrated to %dK/sec, %d cycles per transfer\n",
	hostno, BORKEN_RATE, borken_calibration);
#endif
}

static inline void borken_wait(void) {
  register int count;
  for (count = borken_calibration; count && (STATUS & STAT_REQ);
  	--count);
#if (DEBUG & DEBUG_BORKEN)
  if (count)
  	printk("scsi%d : borken timeout\n", hostno);
#endif
}

#endif /* def SLOW_HANDSHAKE */

int seagate_st0x_detect (Scsi_Host_Template * tpnt)
	{
     struct Scsi_Host *instance;
#ifndef OVERRIDE
	int i,j;
#endif

     tpnt->proc_dir = &proc_scsi_seagate;
/*
 *	First, we try for the manual override.
 */
#ifdef DEBUG
	printk("Autodetecting ST0x / TMC-8xx\n");
#endif

	if (hostno != -1)
		{
		printk ("ERROR : seagate_st0x_detect() called twice.\n");
		return 0;
		}

      /* If the user specified the controller type from the command line,
	 controller_type will be non-zero, so don't try to detect one */

	if (!controller_type) {
#ifdef OVERRIDE
	base_address = (void *) OVERRIDE;

/* CONTROLLER is used to override controller (SEAGATE or FD). PM: 07/01/93 */
#ifdef CONTROLLER
	controller_type = CONTROLLER;
#else
#error Please use -DCONTROLLER=SEAGATE or -DCONTROLLER=FD to override controller type
#endif /* CONTROLLER */
#ifdef DEBUG
	printk("Base address overridden to %x, controller type is %s\n",
		base_address,controller_type == SEAGATE ? "SEAGATE" : "FD");
#endif
#else /* OVERRIDE */
/*
 *	To detect this card, we simply look for the signature
 *	from the BIOS version notice in all the possible locations
 *	of the ROM's.  This has a nice side effect of not trashing
 * 	any register locations that might be used by something else.
 *
 * XXX - note that we probably should be probing the address
 * space for the on-board RAM instead.
 */

	for (i = 0; i < (sizeof (seagate_bases) / sizeof (char  * )); ++i)
		for (j = 0; !base_address && j < NUM_SIGNATURES; ++j)
		if (!memcmp ((const void *) (seagate_bases[i] +
		    signatures[j].offset), (const void *) signatures[j].signature,
		    signatures[j].length)) {
			base_address = (const void *) seagate_bases[i];
			controller_type = signatures[j].type;
		}
#endif /* OVERRIDE */
	} /* (! controller_type) */

	tpnt->this_id = (controller_type == SEAGATE) ? 7 : 6;
	tpnt->name = (controller_type == SEAGATE) ? ST0X_ID_STR : FD_ID_STR;

	if (base_address)
		{
		st0x_cr_sr =(void *) (((const unsigned char *) base_address) + (controller_type == SEAGATE ? 0x1a00 : 0x1c00));
		st0x_dr = (void *) (((const unsigned char *) base_address ) + (controller_type == SEAGATE ? 0x1c00 : 0x1e00));
#ifdef DEBUG
		printk("%s detected. Base address = %x, cr = %x, dr = %x\n", tpnt->name, base_address, st0x_cr_sr, st0x_dr);
#endif
/*
 *	At all times, we will use IRQ 5.  Should also check for IRQ3 if we
 * 	loose our first interrupt.
 */
		instance = scsi_register(tpnt, 0);
		hostno = instance->host_no;
		if (request_irq((int) irq, seagate_reconnect_intr, SA_INTERRUPT,
		   (controller_type == SEAGATE) ? "seagate" : "tmc-8xx", NULL)) {
			printk("scsi%d : unable to allocate IRQ%d\n",
				hostno, (int) irq);
			return 0;
		}
		instance->irq = irq;
		instance->io_port = (unsigned int) base_address;
#ifdef SLOW_HANDSHAKE
		borken_init();
#endif

		printk("%s options:"
#ifdef ARBITRATE
		" ARBITRATE"
#endif
#ifdef SLOW_HANDSHAKE
		" SLOW_HANDSHAKE"
#endif
#ifdef FAST
#ifdef FAST32
		" FAST32"
#else
		" FAST"
#endif
#endif
#ifdef LINKED
		" LINKED"
#endif
	      "\n", tpnt->name);
		return 1;
		}
	else
		{
#ifdef DEBUG
		printk("ST0x / TMC-8xx not detected.\n");
#endif
		return 0;
		}
	}

const char *seagate_st0x_info(struct Scsi_Host * shpnt) {
      static char buffer[64];
	sprintf(buffer, "%s at irq %d, address 0x%05X",
		(controller_type == SEAGATE) ? ST0X_ID_STR : FD_ID_STR,
		irq, (unsigned int)base_address);
	return buffer;
}

int seagate_st0x_proc_info(char *buffer, char **start, off_t offset,
                               int length, int hostno, int inout)
{
       const char *info = seagate_st0x_info(NULL);
       int len;
       int pos;
       int begin;

       if (inout) return(-ENOSYS);

       begin = 0;
       strcpy(buffer,info);
       strcat(buffer,"\n");

       pos = len = strlen(buffer);

       if (pos<offset) {
               len = 0;
               begin = pos;
               }

       *start = buffer + (offset - begin);
       len -= (offset - begin);
       if ( len > length ) len = length;
       return(len);
}

/*
 * These are our saved pointers for the outstanding command that is
 * waiting for a reconnect
 */

static unsigned char current_target, current_lun;
static unsigned char *current_cmnd, *current_data;
static int current_nobuffs;
static struct scatterlist *current_buffer;
static int current_bufflen;

#ifdef LINKED

/*
 * linked_connected indicates whether or not we are currently connected to
 * linked_target, linked_lun and in an INFORMATION TRANSFER phase,
 * using linked commands.
 */

static int linked_connected = 0;
static unsigned char linked_target, linked_lun;
#endif

static void (*done_fn)(Scsi_Cmnd *) = NULL;
static Scsi_Cmnd * SCint = NULL;

/*
 * These control whether or not disconnect / reconnect will be attempted,
 * or are being attempted.
 */

#define NO_RECONNECT 	0
#define RECONNECT_NOW 	1
#define CAN_RECONNECT	2

#ifdef LINKED

/*
 * LINKED_RIGHT indicates that we are currently connected to the correct target
 * for this command, LINKED_WRONG indicates that we are connected to the wrong
 * target.  Note that these imply CAN_RECONNECT.
 */

#define LINKED_RIGHT 	3
#define LINKED_WRONG	4
#endif

/*
 * This determines if we are expecting to reconnect or not.
 */

static int should_reconnect = 0;

/*
 * The seagate_reconnect_intr routine is called when a target reselects the
 * host adapter.  This occurs on the interrupt triggered by the target
 * asserting SEL.
 */

static void seagate_reconnect_intr(int irq, void *dev_id, struct pt_regs *regs)
	{
	int temp;
	Scsi_Cmnd * SCtmp;

/* enable all other interrupts. */
	sti();
#if (DEBUG & PHASE_RESELECT)
	printk("scsi%d : seagate_reconnect_intr() called\n", hostno);
#endif

	if (!should_reconnect)
	    printk("scsi%d: unexpected interrupt.\n", hostno);
	else {
		 should_reconnect = 0;

#if (DEBUG & PHASE_RESELECT)
		printk("scsi%d : internal_command("
		       "%d, %08x, %08x, %d, RECONNECT_NOW\n", hostno,
			current_target, current_data, current_bufflen);
#endif

		temp =  internal_command (current_target, current_lun,
			current_cmnd, current_data, current_bufflen,
			RECONNECT_NOW);

		if (msg_byte(temp) != DISCONNECT) {
			if (done_fn) {
#if (DEBUG & PHASE_RESELECT)
				printk("scsi%d : done_fn(%d,%08x)", hostno,
				hostno, temp);
#endif
				if(!SCint) panic("SCint == NULL in seagate");
				SCtmp = SCint;
				SCint = NULL;
				SCtmp->result = temp;
				done_fn (SCtmp);
			} else
				printk("done_fn() not defined.\n");
			}
		}
	}

/*
 * The seagate_st0x_queue_command() function provides a queued interface
 * to the seagate SCSI driver.  Basically, it just passes control onto the
 * seagate_command() function, after fixing it so that the done_fn()
 * is set to the one passed to the function.  We have to be very careful,
 * because there are some commands on some devices that do not disconnect,
 * and if we simply call the done_fn when the command is done then another
 * command is started and queue_command is called again...  We end up
 * overflowing the kernel stack, and this tends not to be such a good idea.
 */

static int recursion_depth = 0;

int seagate_st0x_queue_command (Scsi_Cmnd * SCpnt,  void (*done)(Scsi_Cmnd *))
	{
	int result, reconnect;
	Scsi_Cmnd * SCtmp;

	done_fn = done;
	current_target = SCpnt->target;
	current_lun = SCpnt->lun;
	(const void *) current_cmnd = SCpnt->cmnd;
	current_data = (unsigned char *) SCpnt->request_buffer;
	current_bufflen = SCpnt->request_bufflen;
	SCint = SCpnt;
	if(recursion_depth) {
	  return 0;
	};
	recursion_depth++;
	do{
#ifdef LINKED
/*
 * Set linked command bit in control field of SCSI command.
 */

	  current_cmnd[SCpnt->cmd_len] |= 0x01;
	  if (linked_connected) {
#if (DEBUG & DEBUG_LINKED)
	    printk("scsi%d : using linked commands, current I_T_L nexus is ",
	      hostno);
#endif
	    if ((linked_target == current_target) &&
	      (linked_lun == current_lun)) {
#if (DEBUG & DEBUG_LINKED)
	    printk("correct\n");
#endif
	      reconnect = LINKED_RIGHT;
	    } else {
#if (DEBUG & DEBUG_LINKED)
	    printk("incorrect\n");
#endif
	      reconnect = LINKED_WRONG;
	    }
	  } else
#endif /* LINKED */
	    reconnect = CAN_RECONNECT;

	  result = internal_command (SCint->target, SCint->lun, SCint->cmnd, SCint->request_buffer,
				     SCint->request_bufflen,
				     reconnect);
	  if (msg_byte(result) == DISCONNECT)  break;
	  SCtmp = SCint;
	  SCint = NULL;
	  SCtmp->result = result;
	  done_fn (SCtmp);
	} while(SCint);
	recursion_depth--;
	return 0;
      }

int seagate_st0x_command (Scsi_Cmnd * SCpnt) {
	return internal_command (SCpnt->target, SCpnt->lun, SCpnt->cmnd, SCpnt->request_buffer,
				 SCpnt->request_bufflen,
				 (int) NO_RECONNECT);
}

static int internal_command(unsigned char target, unsigned char lun, const void *cmnd,
			 void *buff, int bufflen, int reselect) {
	int len = 0;
	unsigned char *data = NULL;
	struct scatterlist *buffer = NULL;
	int nobuffs = 0;
	int clock;
	int temp;
#ifdef SLOW_HANDSHAKE
	int borken;	/* Does the current target require Very Slow I/O ? */
#endif

#if (DEBUG & PHASE_DATAIN) || (DEBUG & PHASE_DATOUT)
	int transfered = 0;
#endif

#if (((DEBUG & PHASE_ETC) == PHASE_ETC) || (DEBUG & PRINT_COMMAND) || \
	(DEBUG & PHASE_EXIT))
	int i;
#endif

#if ((DEBUG & PHASE_ETC) == PHASE_ETC)
	int phase=0, newphase;
#endif

	int done = 0;
	unsigned char status = 0;
	unsigned char message = 0;
	register unsigned char status_read;

	unsigned transfersize = 0, underflow = 0;

	incommand = 0;
	st0x_aborted = 0;

#ifdef SLOW_HANDSHAKE
	borken = (int) SCint->device->borken;
#endif

#if (DEBUG & PRINT_COMMAND)
	printk ("scsi%d : target = %d, command = ", hostno, target);
	print_command((unsigned char *) cmnd);
	printk("\n");
#endif

#if (DEBUG & PHASE_RESELECT)
	switch (reselect) {
	case RECONNECT_NOW :
		printk("scsi%d : reconnecting\n", hostno);
		break;
#ifdef LINKED
	case LINKED_RIGHT :
		printk("scsi%d : connected, can reconnect\n", hostno);
		break;
	case LINKED_WRONG :
		printk("scsi%d : connected to wrong target, can reconnect\n",
			hostno);
		break;
#endif
	case CAN_RECONNECT :
		printk("scsi%d : allowed to reconnect\n", hostno);
		break;
	default :
		printk("scsi%d : not allowed to reconnect\n", hostno);
	}
#endif

	if (target == (controller_type == SEAGATE ? 7 : 6))
		return DID_BAD_TARGET;

/*
 *	We work it differently depending on if this is is "the first time,"
 *	or a reconnect.  If this is a reselect phase, then SEL will
 *	be asserted, and we must skip selection / arbitration phases.
 */

	switch (reselect) {
	case RECONNECT_NOW:
#if (DEBUG & PHASE_RESELECT)
		printk("scsi%d : phase RESELECT \n", hostno);
#endif

/*
 *	At this point, we should find the logical or of our ID and the original
 *	target's ID on the BUS, with BSY, SEL, and I/O signals asserted.
 *
 *	After ARBITRATION phase is completed, only SEL, BSY, and the
 *	target ID are asserted.  A valid initiator ID is not on the bus
 *	until IO is asserted, so we must wait for that.
 */
		clock = jiffies + 10;
		for (;;) {
			temp = STATUS;
			if ((temp & STAT_IO) && !(temp & STAT_BSY))
				break;

			if (jiffies > clock) {
#if (DEBUG & PHASE_RESELECT)
				printk("scsi%d : RESELECT timed out while waiting for IO .\n",
					hostno);
#endif
				return (DID_BAD_INTR << 16);
			}
		}

/*
 * 	After I/O is asserted by the target, we can read our ID and its
 *	ID off of the BUS.
 */

		if (!((temp = DATA) & (controller_type == SEAGATE ? 0x80 : 0x40)))
			{
#if (DEBUG & PHASE_RESELECT)
			printk("scsi%d : detected reconnect request to different target.\n"
			       "\tData bus = %d\n", hostno, temp);
#endif
			return (DID_BAD_INTR << 16);
			}

		if (!(temp & (1 << current_target)))
			{
			printk("scsi%d : Unexpected reselect interrupt.  Data bus = %d\n",
				hostno, temp);
			return (DID_BAD_INTR << 16);
			}

		buffer=current_buffer;
		cmnd=current_cmnd;      /* WDE add */
		data=current_data;      /* WDE add */
		len=current_bufflen;    /* WDE add */
		nobuffs=current_nobuffs;

/*
 * 	We have determined that we have been selected.  At this point,
 *	we must respond to the reselection by asserting BSY ourselves
 */

#if 1
		CONTROL = (BASE_CMD | CMD_DRVR_ENABLE | CMD_BSY);
#else
		CONTROL = (BASE_CMD | CMD_BSY);
#endif

/*
 *	The target will drop SEL, and raise BSY, at which time we must drop
 *	BSY.
 */

		for (clock = jiffies + 10; (jiffies < clock) &&  (STATUS & STAT_SEL););

		if (jiffies >= clock)
			{
			CONTROL = (BASE_CMD | CMD_INTR);
#if (DEBUG & PHASE_RESELECT)
			printk("scsi%d : RESELECT timed out while waiting for SEL.\n",
				hostno);
#endif
			return (DID_BAD_INTR << 16);
			}

		CONTROL = BASE_CMD;

/*
 *	At this point, we have connected with the target and can get
 *	on with our lives.
 */
		break;
	case CAN_RECONNECT:

#ifdef LINKED
/*
 * This is a bletcherous hack, just as bad as the Unix #! interpreter stuff.
 * If it turns out we are using the wrong I_T_L nexus, the easiest way to deal
 * with it is to go into our INFORMATION TRANSFER PHASE code, send a ABORT
 * message on MESSAGE OUT phase, and then loop back to here.
 */

connect_loop :

#endif

#if (DEBUG & PHASE_BUS_FREE)
		printk ("scsi%d : phase = BUS FREE \n", hostno);
#endif

/*
 *	BUS FREE PHASE
 *
 * 	On entry, we make sure that the BUS is in a BUS FREE
 *	phase, by insuring that both BSY and SEL are low for
 *	at least one bus settle delay.  Several reads help
 *	eliminate wire glitch.
 */

		clock = jiffies + ST0X_BUS_FREE_DELAY;

#if !defined (ARBITRATE)
		while (((STATUS |  STATUS | STATUS) &
			 (STAT_BSY | STAT_SEL)) &&
			 (!st0x_aborted) && (jiffies < clock));

		if (jiffies > clock)
			return retcode(DID_BUS_BUSY);
		else if (st0x_aborted)
			return retcode(st0x_aborted);
#endif

#if (DEBUG & PHASE_SELECTION)
		printk("scsi%d : phase = SELECTION\n", hostno);
#endif

		clock = jiffies + ST0X_SELECTION_DELAY;

/*
 * Arbitration/selection procedure :
 * 1.  Disable drivers
 * 2.  Write HOST adapter address bit
 * 3.  Set start arbitration.
 * 4.  We get either ARBITRATION COMPLETE or SELECT at this
 *     point.
 * 5.  OR our ID and targets on bus.
 * 6.  Enable SCSI drivers and asserted SEL and ATTN
 */

#if defined(ARBITRATE)
	cli();
	CONTROL = 0;
	DATA = (controller_type == SEAGATE) ? 0x80 : 0x40;
	CONTROL = CMD_START_ARB;
	sti();
	while (!((status_read = STATUS) & (STAT_ARB_CMPL | STAT_SEL)) &&
		(jiffies < clock) && !st0x_aborted);

	if (!(status_read & STAT_ARB_CMPL)) {
#if (DEBUG & PHASE_SELECTION)
		if (status_read & STAT_SEL)
			printk("scsi%d : arbitration lost\n", hostno);
		else
			printk("scsi%d : arbitration timeout.\n", hostno);
#endif
		CONTROL = BASE_CMD;
		return retcode(DID_NO_CONNECT);
	};

#if (DEBUG & PHASE_SELECTION)
	printk("scsi%d : arbitration complete\n", hostno);
#endif
#endif

/*
 *	When the SCSI device decides that we're gawking at it, it will
 *	respond by asserting BUSY on the bus.
 *
 * 	Note : the Seagate ST-01/02 product manual says that we should
 * 	twiddle the DATA register before the control register.  However,
 *	this does not work reliably so we do it the other way around.
 *
 *	Probably could be a problem with arbitration too, we really should
 *	try this with a SCSI protocol or logic analyzer to see what is
 *	going on.
 */
	cli();
	DATA = (unsigned char) ((1 << target) | (controller_type == SEAGATE ? 0x80 : 0x40));
	CONTROL = BASE_CMD | CMD_DRVR_ENABLE | CMD_SEL |
		(reselect ? CMD_ATTN : 0);
	sti();
		while (!((status_read = STATUS) & STAT_BSY) &&
			(jiffies < clock) && !st0x_aborted)

#if 0 && (DEBUG & PHASE_SELECTION)
		{
		temp = clock - jiffies;

		if (!(jiffies % 5))
			printk("seagate_st0x_timeout : %d            \r",temp);

		}
		printk("Done.                                             \n");
		printk("scsi%d : status = %02x, seagate_st0x_timeout = %d, aborted = %02x \n",
			hostno, status_read, temp, st0x_aborted);
#else
		;
#endif

		if ((jiffies >= clock)  && !(status_read & STAT_BSY))
			{
#if (DEBUG & PHASE_SELECTION)
			printk ("scsi%d : NO CONNECT with target %d, status = %x \n",
				hostno, target, STATUS);
#endif
			return retcode(DID_NO_CONNECT);
			}

/*
 *	If we have been aborted, and we have a command in progress, IE the
 *	target still has BSY asserted, then we will reset the bus, and
 * 	notify the midlevel driver to expect sense.
 */

		if (st0x_aborted) {
			CONTROL = BASE_CMD;
			if (STATUS & STAT_BSY) {
				printk("scsi%d : BST asserted after we've been aborted.\n",
					hostno);
				seagate_st0x_reset(NULL, 0);
				return retcode(DID_RESET);
			}
			return retcode(st0x_aborted);
		}

/* Establish current pointers.  Take into account scatter / gather */

	if ((nobuffs = SCint->use_sg)) {
#if (DEBUG & DEBUG_SG)
	{
	int i;
	printk("scsi%d : scatter gather requested, using %d buffers.\n",
		hostno, nobuffs);
	for (i = 0; i < nobuffs; ++i)
		printk("scsi%d : buffer %d address = %08x length = %d\n",
			hostno, i, buffer[i].address, buffer[i].length);
	}
#endif

		buffer = (struct scatterlist *) SCint->buffer;
		len = buffer->length;
		data = (unsigned char *) buffer->address;
	} else {
#if (DEBUG & DEBUG_SG)
	printk("scsi%d : scatter gather not requested.\n", hostno);
#endif
		buffer = NULL;
		len = SCint->request_bufflen;
		data = (unsigned char *) SCint->request_buffer;
	}

#if (DEBUG & (PHASE_DATAIN | PHASE_DATAOUT))
	printk("scsi%d : len = %d\n", hostno, len);
#endif

		break;
#ifdef LINKED
	case LINKED_RIGHT:
	    	break;
	case LINKED_WRONG:
		break;
#endif
	}

/*
 * 	There are several conditions under which we wish to send a message :
 *	1.  When we are allowing disconnect / reconnect, and need to establish
 *	    the I_T_L nexus via an IDENTIFY with the DiscPriv bit set.
 *
 *	2.  When we are doing linked commands, are have the wrong I_T_L nexus
 *	    established and want to send an ABORT message.
 */

	CONTROL = BASE_CMD | CMD_DRVR_ENABLE |
		(((reselect == CAN_RECONNECT)
#ifdef LINKED
		|| (reselect == LINKED_WRONG)
#endif
		)  ? CMD_ATTN : 0) ;

/*
 * 	INFORMATION TRANSFER PHASE
 *
 *	The nasty looking read / write inline assembler loops we use for
 *	DATAIN and DATAOUT phases are approximately 4-5 times as fast as
 *	the 'C' versions - since we're moving 1024 bytes of data, this
 *	really adds up.
 */

#if ((DEBUG & PHASE_ETC) == PHASE_ETC)
	printk("scsi%d : phase = INFORMATION TRANSFER\n", hostno);
#endif

	incommand = 1;
	transfersize = SCint->transfersize;
	underflow = SCint->underflow;

/*
 * 	Now, we poll the device for status information,
 *	and handle any requests it makes.  Note that since we are unsure of
 *	how much data will be flowing across the system, etc and cannot
 *	make reasonable timeouts, that we will instead have the midlevel
 * 	driver handle any timeouts that occur in this phase.
 */

	while (((status_read = STATUS) & STAT_BSY) && !st0x_aborted && !done)
		{
#ifdef PARITY
		if (status_read & STAT_PARITY)
			{
			printk("scsi%d : got parity error\n", hostno);
			st0x_aborted = DID_PARITY;
			}
#endif

		if (status_read & STAT_REQ)
			{
#if ((DEBUG & PHASE_ETC) == PHASE_ETC)
			if ((newphase = (status_read & REQ_MASK)) != phase)
				{
				phase = newphase;
				switch (phase)
				{
				case REQ_DATAOUT:
					printk("scsi%d : phase = DATA OUT\n",
						hostno);
					break;
				case REQ_DATAIN :
					printk("scsi%d : phase = DATA IN\n",
						hostno);
					break;
				case REQ_CMDOUT :
					printk("scsi%d : phase = COMMAND OUT\n",
						hostno);
					break;
				case REQ_STATIN :
					 printk("scsi%d : phase = STATUS IN\n",
						hostno);
					break;
				case REQ_MSGOUT :
					printk("scsi%d : phase = MESSAGE OUT\n",
						hostno);
					break;
				case REQ_MSGIN :
					printk("scsi%d : phase = MESSAGE IN\n",
						hostno);
					break;
				default :
					printk("scsi%d : phase = UNKNOWN\n",
						hostno);
					st0x_aborted = DID_ERROR;
				}
				}
#endif
		switch (status_read & REQ_MASK)
		{
		case REQ_DATAOUT :
/*
 * If we are in fast mode, then we simply splat the data out
 * in word-sized chunks as fast as we can.
 */

#ifdef FAST
if (!len) {
#if 0
	printk("scsi%d: underflow to target %d lun %d \n",
		hostno, target, lun);
	st0x_aborted = DID_ERROR;
	fast = 0;
#endif
	break;
}

if (fast && transfersize && !(len % transfersize) && (len >= transfersize)
#ifdef FAST32
	&& !(transfersize % 4)
#endif
	) {
#if (DEBUG & DEBUG_FAST)
	printk("scsi%d : FAST transfer, underflow = %d, transfersize = %d\n"
	       "         len = %d, data = %08x\n", hostno, SCint->underflow,
	       SCint->transfersize, len, data);
#endif

	__asm__("
	cld;
"
#ifdef FAST32
"	shr $2, %%ecx;
1:	lodsl;
	movl %%eax, (%%edi);
"
#else
"1:	lodsb;
	movb %%al, (%%edi);
"
#endif
"	loop 1b;" : :
	/* input */
	"D" (st0x_dr), "S" (data), "c" (SCint->transfersize) :
	/* clobbered */
	"eax", "ecx", "esi" );

	len -= transfersize;
	data += transfersize;

#if (DEBUG & DEBUG_FAST)
	printk("scsi%d : FAST transfer complete len = %d data = %08x\n",
		hostno, len, data);
#endif

} else
#endif

{
/*
 * 	We loop as long as we are in a data out phase, there is data to send,
 *	and BSY is still active.
 */
		__asm__ (

/*
	Local variables :
	len = ecx
	data = esi
	st0x_cr_sr = ebx
	st0x_dr =  edi

	Test for any data here at all.
*/
	"\torl %%ecx, %%ecx
	jz 2f

	cld

	movl " SYMBOL_NAME_STR(st0x_cr_sr) ", %%ebx
	movl " SYMBOL_NAME_STR(st0x_dr) ", %%edi

1:	movb (%%ebx), %%al\n"
/*
	Test for BSY
*/

	"\ttest $1, %%al
	jz 2f\n"

/*
	Test for data out phase - STATUS & REQ_MASK should be REQ_DATAOUT, which is 0.
*/
	"\ttest $0xe, %%al
	jnz 2f	\n"
/*
	Test for REQ
*/
	"\ttest $0x10, %%al
	jz 1b
	lodsb
	movb %%al, (%%edi)
	loop 1b

2:
									":
/* output */
"=S" (data), "=c" (len) :
/* input */
"0" (data), "1" (len) :
/* clobbered */
"eax", "ebx", "edi");
}

			if (!len && nobuffs) {
				--nobuffs;
				++buffer;
				len = buffer->length;
				data = (unsigned char *) buffer->address;
#if (DEBUG & DEBUG_SG)
	printk("scsi%d : next scatter-gather buffer len = %d address = %08x\n",
		hostno, len, data);
#endif
			}
			break;

		case REQ_DATAIN :
#ifdef SLOW_HANDSHAKE
	if (borken) {
#if (DEBUG & (PHASE_DATAIN))
		transfered += len;
#endif
		for (; len && (STATUS & (REQ_MASK | STAT_REQ)) == (REQ_DATAIN |
			STAT_REQ); --len) {
				*data++ = DATA;
				borken_wait();
}
#if (DEBUG & (PHASE_DATAIN))
		transfered -= len;
#endif
	} else
#endif
#ifdef FAST
if (fast && transfersize && !(len % transfersize) && (len >= transfersize)
#ifdef FAST32
	&& !(transfersize % 4)
#endif
	) {
#if (DEBUG & DEBUG_FAST)
	printk("scsi%d : FAST transfer, underflow = %d, transfersize = %d\n"
	       "         len = %d, data = %08x\n", hostno, SCint->underflow,
	       SCint->transfersize, len, data);
#endif
	__asm__("
	cld;
"
#ifdef FAST32
"	shr $2, %%ecx;
1:	movl (%%esi), %%eax;
	stosl;
"
#else
"1:	movb (%%esi), %%al;
	stosb;
"
#endif

"	loop 1b;" : :
	/* input */
	"S" (st0x_dr), "D" (data), "c" (SCint->transfersize) :
	/* clobbered */
	"eax", "ecx", "edi");

	len -= transfersize;
	data += transfersize;

#if (DEBUG & PHASE_DATAIN)
	printk("scsi%d: transfered += %d\n", hostno, transfersize);
	transfered += transfersize;
#endif

#if (DEBUG & DEBUG_FAST)
	printk("scsi%d : FAST transfer complete len = %d data = %08x\n",
		hostno, len, data);
#endif

} else
#endif
{

#if (DEBUG & PHASE_DATAIN)
	printk("scsi%d: transfered += %d\n", hostno, len);
	transfered += len;	/* Assume we'll transfer it all, then
				   subtract what we *didn't* transfer */
#endif

/*
 * 	We loop as long as we are in a data in phase, there is room to read,
 * 	and BSY is still active
 */

			__asm__ (
/*
	Local variables :
	ecx = len
	edi = data
	esi = st0x_cr_sr
	ebx = st0x_dr

	Test for room to read
*/
	"\torl %%ecx, %%ecx
	jz 2f

	cld
	movl " SYMBOL_NAME_STR(st0x_cr_sr) ", %%esi
	movl " SYMBOL_NAME_STR(st0x_dr) ", %%ebx

1:	movb (%%esi), %%al\n"
/*
	Test for BSY
*/

	"\ttest $1, %%al
	jz 2f\n"

/*
	Test for data in phase - STATUS & REQ_MASK should be REQ_DATAIN, = STAT_IO, which is 4.
*/
	"\tmovb $0xe, %%ah
	andb %%al, %%ah
	cmpb $0x04, %%ah
	jne 2f\n"

/*
	Test for REQ
*/
	"\ttest $0x10, %%al
	jz 1b

	movb (%%ebx), %%al
	stosb
	loop 1b\n"

"2:\n"
									:
/* output */
"=D" (data), "=c" (len) :
/* input */
"0" (data), "1" (len) :
/* clobbered */
"eax","ebx", "esi");

#if (DEBUG & PHASE_DATAIN)
	printk("scsi%d: transfered -= %d\n", hostno, len);
	transfered -= len;		/* Since we assumed all of Len got
					 * transfered, correct our mistake */
#endif
}

			if (!len && nobuffs) {
				--nobuffs;
				++buffer;
				len = buffer->length;
				data = (unsigned char *) buffer->address;
#if (DEBUG & DEBUG_SG)
	printk("scsi%d : next scatter-gather buffer len = %d address = %08x\n",
		hostno, len, data);
#endif
			}

			break;

		case REQ_CMDOUT :
			while (((status_read = STATUS) & STAT_BSY) &&
			       ((status_read & REQ_MASK) == REQ_CMDOUT))
				if (status_read & STAT_REQ) {
					DATA = *(const unsigned char *) cmnd;
					cmnd = 1+(const unsigned char *) cmnd;
#ifdef SLOW_HANDSHAKE
					if (borken)
						borken_wait();
#endif
				}
			break;

		case REQ_STATIN :
			status = DATA;
			break;

		case REQ_MSGOUT :
/*
 *	We can only have sent a MSG OUT if we requested to do this
 *	by raising ATTN.  So, we must drop ATTN.
 */

			CONTROL = BASE_CMD | CMD_DRVR_ENABLE;
/*
 * 	If we are reconnecting, then we must send an IDENTIFY message in
 *	 response  to MSGOUT.
 */
			switch (reselect) {
			case CAN_RECONNECT:
				DATA = IDENTIFY(1, lun);

#if (DEBUG & (PHASE_RESELECT | PHASE_MSGOUT))
				printk("scsi%d : sent IDENTIFY message.\n", hostno);
#endif
				break;
#ifdef LINKED
			case LINKED_WRONG:
				DATA = ABORT;
				linked_connected = 0;
				reselect = CAN_RECONNECT;
				goto connect_loop;
#if (DEBUG & (PHASE_MSGOUT | DEBUG_LINKED))
				printk("scsi%d : sent ABORT message to cancel incorrect I_T_L nexus.\n", hostno);
#endif
#endif /* LINKED */
#if (DEBUG & DEBUG_LINKED)
	    printk("correct\n");
#endif
			default:
				DATA = NOP;
				printk("scsi%d : target %d requested MSGOUT, sent NOP message.\n", hostno, target);
			}
			break;

		case REQ_MSGIN :
			switch (message = DATA) {
			case DISCONNECT :
				should_reconnect = 1;
				current_data = data;    /* WDE add */
				current_buffer = buffer;
				current_bufflen = len;  /* WDE add */
				current_nobuffs = nobuffs;
#ifdef LINKED
				linked_connected = 0;
#endif
				done=1;
#if (DEBUG & (PHASE_RESELECT | PHASE_MSGIN))
				printk("scsi%d : disconnected.\n", hostno);
#endif
				break;

#ifdef LINKED
			case LINKED_CMD_COMPLETE:
			case LINKED_FLG_CMD_COMPLETE:
#endif
			case COMMAND_COMPLETE :
/*
 * Note : we should check for underflow here.
 */
#if (DEBUG & PHASE_MSGIN)
				printk("scsi%d : command complete.\n", hostno);
#endif
				done = 1;
				break;
			case ABORT :
#if (DEBUG & PHASE_MSGIN)
				printk("scsi%d : abort message.\n", hostno);
#endif
				done=1;
				break;
			case SAVE_POINTERS :
				current_buffer = buffer;
				current_bufflen = len;  /* WDE add */
				current_data = data;	/* WDE mod */
				current_nobuffs = nobuffs;
#if (DEBUG & PHASE_MSGIN)
				printk("scsi%d : pointers saved.\n", hostno);
#endif
				break;
			case RESTORE_POINTERS:
				buffer=current_buffer;
				cmnd=current_cmnd;
				data=current_data;	/* WDE mod */
				len=current_bufflen;
				nobuffs=current_nobuffs;
#if (DEBUG & PHASE_MSGIN)
				printk("scsi%d : pointers restored.\n", hostno);
#endif
				break;
			default:

/*
 * 	IDENTIFY distinguishes itself from the other messages by setting the
 *	high byte.
 *
 *	Note : we need to handle at least one outstanding command per LUN,
 *	and need to hash the SCSI command for that I_T_L nexus based on the
 *	known ID (at this point) and LUN.
 */

				if (message & 0x80) {
#if (DEBUG & PHASE_MSGIN)
					printk("scsi%d : IDENTIFY message received from id %d, lun %d.\n",
						hostno, target, message & 7);
#endif
				} else {

/*
 *      We should go into a MESSAGE OUT phase, and send  a MESSAGE_REJECT
 * 	if we run into a message that we don't like.  The seagate driver
 * 	needs some serious restructuring first though.
 */

#if (DEBUG & PHASE_MSGIN)
					printk("scsi%d : unknown message %d from target %d.\n",
						hostno,  message,   target);
#endif
				}
			}
			break;

		default :
			printk("scsi%d : unknown phase.\n", hostno);
			st0x_aborted = DID_ERROR;
		}

#ifdef SLOW_HANDSHAKE
/*
 * I really don't care to deal with borken devices in each single
 * byte transfer case (ie, message in, message out, status), so
 * I'll do the wait here if necessary.
 */
		if (borken)
			borken_wait();
#endif

		} /* if ends */
		} /* while ends */

#if (DEBUG & (PHASE_DATAIN | PHASE_DATAOUT | PHASE_EXIT))
	printk("scsi%d : Transfered %d bytes\n", hostno, transfered);
#endif

#if (DEBUG & PHASE_EXIT)
#if 0		/* Doesn't work for scatter / gather */
	printk("Buffer : \n");
	for (i = 0; i < 20; ++i)
		printk ("%02x  ", ((unsigned char *) data)[i]);	/* WDE mod */
	printk("\n");
#endif
	printk("scsi%d : status = ", hostno);
	print_status(status);
	printk("message = %02x\n", message);
#endif

/* We shouldn't reach this until *after* BSY has been deasserted */
#ifdef notyet
	if (st0x_aborted) {
		if (STATUS & STAT_BSY) {
			seagate_st0x_reset(NULL);
			st0x_aborted = DID_RESET;
		}
		abort_confirm = 1;
	}
#endif

#ifdef LINKED
else {
/*
 * Fix the message byte so that unsuspecting high level drivers don't
 * puke when they see a LINKED COMMAND message in place of the COMMAND
 * COMPLETE they may be expecting.  Shouldn't be necessary, but it's
 * better to be on the safe side.
 *
 * A non LINKED* message byte will indicate that the command completed,
 * and we are now disconnected.
 */

		switch (message) {
		case LINKED_CMD_COMPLETE :
		case LINKED_FLG_CMD_COMPLETE :
			message = COMMAND_COMPLETE;
			linked_target = current_target;
			linked_lun = current_lun;
			linked_connected = 1;
#if (DEBUG & DEBUG_LINKED)
			printk("scsi%d : keeping I_T_L nexus established for linked command.\n",
				hostno);
#endif
/*
 * We also will need to adjust status to accommodate intermediate conditions.
 */
			if ((status == INTERMEDIATE_GOOD) ||
				(status == INTERMEDIATE_C_GOOD))
				status = GOOD;

			break;
/*
 * We should also handle what are "normal" termination messages
 * here (ABORT, BUS_DEVICE_RESET?, and COMMAND_COMPLETE individually,
 * and flake if things aren't right.
 */

		default :
#if (DEBUG & DEBUG_LINKED)
			printk("scsi%d : closing I_T_L nexus.\n", hostno);
#endif
			linked_connected = 0;
		}
	}
#endif /* LINKED */

	if (should_reconnect) {
#if (DEBUG & PHASE_RESELECT)
		printk("scsi%d : exiting seagate_st0x_queue_command() with reconnect enabled.\n",
			hostno);
#endif
		CONTROL = BASE_CMD | CMD_INTR ;
	} else
		CONTROL = BASE_CMD;

	return retcode (st0x_aborted);
	}

int seagate_st0x_abort (Scsi_Cmnd * SCpnt)
	{
	  st0x_aborted = DID_ABORT;

	  return SCSI_ABORT_PENDING;
	}

/*
	the seagate_st0x_reset function resets the SCSI bus
*/

int seagate_st0x_reset (Scsi_Cmnd * SCpnt, unsigned int reset_flags)
	{
	unsigned clock;
	/*
		No timeouts - this command is going to fail because
		it was reset.
	*/

#ifdef DEBUG
	printk("In seagate_st0x_reset()\n");
#endif

	/* assert  RESET signal on SCSI bus.  */

	CONTROL = BASE_CMD  | CMD_RST;
	clock=jiffies+2;

	/* Wait.  */

	while (jiffies < clock);

	CONTROL = BASE_CMD;

	st0x_aborted = DID_RESET;

#ifdef DEBUG
	printk("SCSI bus reset.\n");
#endif
	return SCSI_RESET_WAKEUP;
	}

#include <asm/segment.h>
#include "sd.h"
#include <scsi/scsi_ioctl.h>

int seagate_st0x_biosparam(Disk * disk, kdev_t dev, int* ip) {
  unsigned char buf[256 + sizeof(int) * 2], cmd[6], *data, *page;
  int *sizes, result, formatted_sectors, total_sectors;
  int cylinders, heads, sectors;
  int capacity;

/*
 * Only SCSI-I CCS drives and later implement the necessary mode sense
 * pages.
 */

  if (disk->device->scsi_level < 2)
	return -1;

  sizes = (int *) buf;
  data = (unsigned char *) (sizes + 2);

  cmd[0] = MODE_SENSE;
  cmd[1] = (disk->device->lun << 5) & 0xe5;
  cmd[2] = 0x04; /* Read page 4, rigid disk geometry page current values */
  cmd[3] = 0;
  cmd[4] = 255;
  cmd[5] = 0;

/*
 * We are transferring 0 bytes in the out direction, and expect to get back
 * 24 bytes for each mode page.
 */

  sizes[0] = 0;
  sizes[1] = 256;

  memcpy (data, cmd, 6);

  if (!(result = kernel_scsi_ioctl (disk->device, SCSI_IOCTL_SEND_COMMAND, (void *) buf))) {
/*
 * The mode page lies beyond the MODE SENSE header, with length 4, and
 * the BLOCK DESCRIPTOR, with length header[3].
 */

    page = data + 4 + data[3];
    heads = (int) page[5];
    cylinders = (page[2] << 16) | (page[3] << 8) | page[4];

    cmd[2] = 0x03; /* Read page 3, format page current values */
    memcpy (data, cmd, 6);

    if (!(result = kernel_scsi_ioctl (disk->device, SCSI_IOCTL_SEND_COMMAND, (void *) buf))) {
      page = data + 4 + data[3];
      sectors = (page[10] << 8) | page[11];

/*
 * Get the total number of formatted sectors from the block descriptor,
 * so we can tell how many are being used for alternates.
 */

      formatted_sectors = (data[4 + 1] << 16) | (data[4 + 2] << 8) |
	data[4 + 3] ;

      total_sectors = (heads * cylinders * sectors);

/*
 * Adjust the real geometry by subtracting
 * (spare sectors / (heads * tracks)) cylinders from the number of cylinders.
 *
 * It appears that the CE cylinder CAN be a partial cylinder.
 */

printk("scsi%d : heads = %d cylinders = %d sectors = %d total = %d formatted = %d\n",
    hostno, heads, cylinders, sectors, total_sectors, formatted_sectors);

      if (!heads || !sectors || !cylinders)
	result = -1;
      else
	cylinders -= ((total_sectors - formatted_sectors) / (heads * sectors));

/*
 * Now, we need to do a sanity check on the geometry to see if it is
 * BIOS compatible.  The maximum BIOS geometry is 1024 cylinders *
 * 256 heads * 64 sectors.
 */

      if ((cylinders > 1024) || (sectors > 64)) {
	/* The Seagate's seem to have some mapping
	 * Multiple heads * sectors * cyl to get capacity
	 * Then start rounding down. */
	capacity = heads * sectors * cylinders;
	sectors = 17;	/* Old MFM Drives use this, so does the Seagate */
	heads = 2;
	capacity = capacity / sectors;
	while (cylinders > 1024)
	{
		heads *= 2;	/* For some reason, they go in multiples */
		cylinders = capacity / heads;
	}
      }
      ip[0] = heads;
      ip[1] = sectors;
      ip[2] = cylinders;

/*
 * There should be an alternate mapping for things the seagate doesn't
 * understand, but I couldn't say what it is with reasonable certainty.
 */

      }
    }

  return result;
}

#ifdef MODULE
/* Eventually this will go into an include file, but this will be later */
Scsi_Host_Template driver_template = SEAGATE_ST0X;

#include "scsi_module.c"
#endif


text: require 'mactag'


text:
<?php
namespace Wave\Exceptions;

class WaveUnexpectedException extends WaveException
{
	/**
	 * @param string $message
	 * @param int $code
	 * @param \Exception $previous
	 */
	public function __construct($message, $code = 0, \Exception $previous = null)
	{
		parent::__construct("Unexpected exception $message", $code, $previous);
	}
}


text:
(function() {
    'use strict';

    angular
        .module('app.home')
        .controller('HomeController', HomeController)
        .factory('FeedService', FeedService);

    FeedService.$inject = ['$log', '$timeout', '$http'];

    function FeedService(console, $timeout, $http) {

        var parseFeed = function(url) {
            return $http.jsonp('//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=50&callback=JSON_CALLBACK&q=' + encodeURIComponent(url));
        };

        return {
            parseFeed: parseFeed
        };
    }

    HomeController.$inject = ['$scope', 'ChartData', '$timeout', 'Colors', 'FileUploader', 'FeedService'];
    function HomeController($scope, ChartData, $timeout, Colors, FileUploader, FeedService) {
        var vm = this;

        activate();

        ////////////////

        function activate() {

          //// rss feed

          retrieveFromLocalStorage();

          $scope.phMessage = "Enter Feed URL";
          $scope.currentButtonText=$scope.allFeeds[0].titleText;

          $scope.loadFeed=function(e,url){
            $scope.currentButtonText = angular.element(e.target).text();
            // empty out filter text from last time they put one in, because
            // when they hit a new feed it is confusing.
            $scope.filterText = "";
            console.log("loadFeed / click event fired");

            if ($scope.currentButtonText == $scope.allFeeds[0].titleText)
            {
              //console.log($scope.feedSrc);
              url = $scope.feedSrc;
            }

            $scope.feedSrc = url;
            if (url === undefined || url === "")
            {
              $scope.phMessage = "Please enter a valid Feed URL & try again.";
              return;
            }

            console.log("button text: " + angular.element(e.target).text());
            console.log("value of url: " );
            console.log(url);

            FeedService.parseFeed(url).then(function(res){
                $scope.loadButonText=angular.element(e.target).text();
                $scope.feeds=res.data.responseData.feed.entries;
            });
          };

          $scope.clearText=function()
          {
            $scope.filterText = "";
          };

          function saveToLocalStorage(feeds)
          {
            // Put the object into storage

            localStorage.setItem('feeds', angular.toJson(feeds));
            console.log(angular.toJson(feeds));
            console.log("wrote feeds to localStorage");
          }

          function retrieveFromLocalStorage()
          {
            $scope.allFeeds = [];
            console.log("retrieving localStorage...");
            try
            {
              $scope.allFeeds = JSON.parse(localStorage['feeds']);
              console.log($scope.allFeeds.length);

              // console.log(JSON.stringify($scope.allFeeds));
              if ($scope.allFeeds === null)
              {
              console.log("couldn't retrieve feeds" );
              loadDefaultFeeds();
              }
            }
            catch (ex)
            {
              console.log("ex: " + ex);
              loadDefaultFeeds();
              saveToLocalStorage($scope.allFeeds);
            }
          }

          function loadDefaultFeeds()
          {
            $scope.allFeeds = [{titleText:"Load (from textbox)",url:""},
                    {titleText:"CodeProject C#",url:"http://www.codeproject.com/webservices/articlerss.aspx?cat=3"},
                    {titleText:"ComputerWorld - News",url:"http://www.computerworld.com/index.rss"},
                    {titleText:"Dr. Dobb's",url:"http://www.drdobbs.com/rss/all"},
                    {titleText:"InfoWorld Today's News",url:"http://www.infoworld.com/news/feed"},
                    {titleText:"Inc. Magazine",url:"http://www.inc.com/rss/homepage.xml"},
                    {titleText:"TechCrunch",url:"http://feeds.feedburner.com/TechCrunch"},
                    {titleText:"CNN",url:"http://rss.cnn.com/rss/cnn_topstories.rss"}
                    ];
          }

          $scope.removeAllFeedsFromLocalStorage = removeAllFeedsFromLocalStorage;
          $scope.saveFeed = saveFeed;

          function removeAllFeedsFromLocalStorage()
          {
            localStorage.removeItem('feeds');
          }

          function saveFeed()
          {
            console.log("feedSrc");
            console.log($scope.feedSrc);
            if ($scope.feedSrc === undefined || $scope.feedSrc == "")
            {
              alert("Please provide a Feed URL and try again.");
              return;
            }
            var titleText = prompt("Please enter the feed title text", "");
            if (titleText !== null) {
              f = new Feed(titleText, $scope.feedSrc);
              $scope.allFeeds.push(f);
              saveToLocalStorage($scope.allFeeds);
            }
          }
        //// End Rss Feed

          vm.chartdata = [
              { y: '2006', a: 100, b: 90 },
              { y: '2007', a: 75,  b: 65 },
              { y: '2008', a: 50,  b: 40 },
              { y: '2009', a: 75,  b: 65 },
              { y: '2010', a: 50,  b: 40 },
              { y: '2011', a: 75,  b: 65 },
              { y: '2012', a: 100, b: 90 }
          ];

          vm.areaOptions = {
            xkey: 'y',
            ykeys: ['a', 'b'],
            labels: ['Serie A', 'Serie B'],
            lineColors: [ Colors.byName('purple'), Colors.byName('info') ],
            resize: true
          };

           vm.barOptions = {
            xkey: 'y',
            ykeys: ['a', 'b'],
            labels: ['Series A', 'Series B'],
            xLabelMargin: 2,
            barColors: [ Colors.byName('info'), Colors.byName('danger') ],
            resize: true
          };

          vm.polarData = [
                {
                  value: 300,
                  color: Colors.byName('pink'),
                  highlight: Colors.byName('pink'),
                  label: 'Red'
                },
                {
                  value: 50,
                  color: Colors.byName('purple'),
                  highlight: Colors.byName('purple'),
                  label: 'Green'
                },
                {
                  value: 100,
                  color: Colors.byName('pink'),
                  highlight: Colors.byName('pink'),
                  label: 'Yellow'
                },
                {
                  value: 140,
                  color: Colors.byName('purple'),
                  highlight: Colors.byName('purple'),
                  label: 'Grey'
                },
              ];

          vm.polarOptions = {
            scaleShowLabelBackdrop : true,
            scaleBackdropColor : 'rgba(255,255,255,0.75)',
            scaleBeginAtZero : true,
            scaleBackdropPaddingY : 1,
            scaleBackdropPaddingX : 1,
            scaleShowLine : true,
            segmentShowStroke : true,
            segmentStrokeColor : '#fff',
            segmentStrokeWidth : 2,
            animationSteps : 100,
            animationEasing : 'easeOutBounce',
            animateRotate : true,
            animateScale : false
          };

          // Radar chart
          // -----------------------------------

          vm.radarData = {
            labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'],
            datasets: [
              {
                label: 'My First dataset',
                fillColor: 'rgba(114,102,186,0.2)',
                strokeColor: 'rgba(114,102,186,1)',
                pointColor: 'rgba(114,102,186,1)',
                pointStrokeColor: '#fff',
                pointHighlightFill: '#fff',
                pointHighlightStroke: 'rgba(114,102,186,1)',
                data: [65,59,90,81,56,55,40]
              },
              {
                label: 'My Second dataset',
                fillColor: 'rgba(151,187,205,0.2)',
                strokeColor: 'rgba(151,187,205,1)',
                pointColor: 'rgba(151,187,205,1)',
                pointStrokeColor: '#fff',
                pointHighlightFill: '#fff',
                pointHighlightStroke: 'rgba(151,187,205,1)',
                data: [28,48,40,19,96,27,100]
              }
            ]
          };

          vm.radarOptions = {
            scaleShowLine : true,
            angleShowLineOut : true,
            scaleShowLabels : false,
            scaleBeginAtZero : true,
            angleLineColor : 'rgba(0,0,0,.1)',
            angleLineWidth : 1,
            /*jshint -W109*/
            pointLabelFontFamily : "'Arial'",
            pointLabelFontStyle : 'bold',
            pointLabelFontSize : 10,
            pointLabelFontColor : '#565656',
            pointDot : true,
            pointDotRadius : 3,
            pointDotStrokeWidth : 1,
            pointHitDetectionRadius : 20,
            datasetStroke : true,
            datasetStrokeWidth : 2,
            datasetFill : true
          };

          var uploader = vm.uploader = new FileUploader({
              url: 'server/upload.php'
          });

          // FILTERS

          uploader.filters.push({
              name: 'customFilter',
              fn: function(/*item, options*/) {
                  return this.queue.length < 10;
              }
          });

          // CALLBACKS

          uploader.onWhenAddingFileFailed = function(item /*{File|FileLikeObject}*/, filter, options) {
              console.info('onWhenAddingFileFailed', item, filter, options);
          };
          uploader.onAfterAddingFile = function(fileItem) {
              console.info('onAfterAddingFile', fileItem);
          };
          uploader.onAfterAddingAll = function(addedFileItems) {
              console.info('onAfterAddingAll', addedFileItems);
          };
          uploader.onBeforeUploadItem = function(item) {
              console.info('onBeforeUploadItem', item);
          };
          uploader.onProgressItem = function(fileItem, progress) {
              console.info('onProgressItem', fileItem, progress);
          };
          uploader.onProgressAll = function(progress) {
              console.info('onProgressAll', progress);
          };
          uploader.onSuccessItem = function(fileItem, response, status, headers) {
              console.info('onSuccessItem', fileItem, response, status, headers);
          };
          uploader.onErrorItem = function(fileItem, response, status, headers) {
              console.info('onErrorItem', fileItem, response, status, headers);
          };
          uploader.onCancelItem = function(fileItem, response, status, headers) {
              console.info('onCancelItem', fileItem, response, status, headers);
          };
          uploader.onCompleteItem = function(fileItem, response, status, headers) {
              console.info('onCompleteItem', fileItem, response, status, headers);
          };
          uploader.onCompleteAll = function() {
              console.info('onCompleteAll');
          };

          console.info('uploader', uploader);

          // SPLINE
          // -----------------------------------
          vm.splineData = ChartData.load('server/chart/spline.json');
          vm.splineOptions = {
              series: {
                  lines: {
                      show: false
                  },
                  points: {
                      show: true,
                      radius: 4
                  },
                  splines: {
                      show: true,
                      tension: 0.4,
                      lineWidth: 1,
                      fill: 0.5
                  }
              },
              grid: {
                  borderColor: '#eee',
                  borderWidth: 1,
                  hoverable: true,
                  backgroundColor: '#fcfcfc'
              },
              tooltip: true,
              tooltipOpts: {
                  content: function (label, x, y) { return x + ' : ' + y; }
              },
              xaxis: {
                  tickColor: '#fcfcfc',
                  mode: 'categories'
              },
              yaxis: {
                  min: 0,
                  max: 150, // optional: use it for a clear represetation
                  tickColor: '#eee',
                  position: ($scope.app.layout.isRTL ? 'right' : 'left'),
                  tickFormatter: function (v) {
                      return v/* + ' visitors'*/;
                  }
              },
              shadowSize: 0
          };

        }
    }
})();


text:
'''
Getline - A library to get text from the console
Author: Tim Henderson
Contact: tim.tadh@hackthology.com
Copyright (c) 2010 All Rights Reserved.
Licensed under a BSD style license see the LICENSE file.

File: __dumb_impl
Purpose: A functionality reduced implementation.
'''

class Getlines(object):

	def __init__(self, histfile='.hist'):
		pass

	def getline(self, prompt=''):
		return raw_input(prompt)

getline = Getlines().getline


text:
package cases;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.List;

import de.dfki.lt.mdparser.data.Data;
import de.dfki.lt.mdparser.sentencesplitter.SSPredictor;

public class SSPredictorTest {

  public static void main(String[] args) throws IOException {

    String conllInputFile = "";
    String taggerFile = "";
    String language = args[0];
    if (language.equals("english")) {
      taggerFile = "resources/tagger/BROWN_MEDLINE/MEDLINE-BROWN-FINAL";
      conllInputFile = "input/english-devel.conll";
    } else if (language.equals("german")) {
      taggerFile = "resources/tagger/NEGRA/NEGRA";
      conllInputFile = "resources/input/german_tiger_test.conll";
    }
    String[] modelFiles =
        { "temp/ssalpha.txt", "temp/m.txt", "temp/lc.txt", "temp/ne.txt", "temp/end.txt", taggerFile };
    SSPredictor ssp = new SSPredictor(modelFiles);
    String inp = ssp.readInput(conllInputFile, "conll");
    List<String> tokensList = ssp.tokenise(
        //"Meinen Sie, das ist eine Chance, um einen Konsens im Umgang mit Rechtradikalen "
        //+ "zu finden? So gut wie nichts in der Hand."
        inp);

    //System.out.println(tokensList);
    List<List<String>> result = ssp.predict(tokensList);
    FileOutputStream out = new FileOutputStream("temp/res.txt");
    OutputStreamWriter or = new OutputStreamWriter(out, "UTF-8");
    BufferedWriter curBw = new BufferedWriter(or);
    for (int i = 0; i < result.size(); i++) {
      System.out.println(result.get(i));
      for (int k = 0; k < result.get(i).size(); k++) {
        curBw.append(result.get(i).get(k));
        if (k < result.get(i).size() - 1) {
          //curBw.append(" ");
        }
      }
      curBw.append("\n");
    }
    System.out.println(result.size());
    Data d = new Data(conllInputFile, true);
    System.out.println(d.getSentences().length);
    curBw.close();
    //ssp.evaluate(result, inputFile);
  }
}


text:
<?php

require_once(TANGRA_MAIN_DIR.'interfaces/i_db_storable.class.php');

require_once('rss_channel.class.php');
require_once(DIR_INC.'modules/tangra_cms/classes/rss/rss_channel_dbc.class.php');

class RSS_Channel_DBC extends RSS_Channel implements I_DB_Storable {
	public function save(DB_Connection $dbc) {
		$ret = false;

		if ($this->get_id()) {
			$ret = $this->update($dbc);
		} else {
			$ret = $this->insert($dbc);
			$this->set_id($ret);

		}

		return $ret;
	}

	public function load_by_id(DB_Connection $dbc, $id) {
		$ret = false;

		if (tangra_is_int($id)) {
			$sql = "select title, ".
							"link, ".
							"description, ".
							"language, ".
							"copyright, ".
							"managing_editor, ".
							"web_master, ".
							"ttl, ".
							"disabled ".
						"from rss_channels ".
						"where id = $id";
			$rez = $dbc->execute($sql);

			if (!$rez->is_eof()) {
				$rez_obj = $rez->fetch_object();

				$this->set_id($id);
				$this->set_title(stripslashes($rez_obj->TITLE));
				$this->set_link(stripslashes($rez_obj->LINK));
				$this->set_description(stripslashes($rez_obj->DESCRIPTION));
				$this->set_copyright(stripslashes($rez_obj->COPYRIGHT));
				$this->set_managing_editor(stripslashes($rez_obj->MANAGING_EDITOR));
				$this->set_web_master(stripslashes($rez_obj->WEB_MASTER));
				$this->set_ttl($rez_obj->TTL);
				$this->set_disabled($rez_obj->DISABLED);

				$ret = $id;
			}
		}

		return $ret;
	}

	protected function insert(DB_Connection $dbc) {
		$ret = false;

		$id = $dbc->generate_id('rss_channels_seq');

		$title = addslashes($this->get_title());
		$link = addslashes($this->get_link());
		$description = addslashes($this->get_description());
		$language = addslashes($this->get_language());
		$copyright = addslashes($this->get_copyright());
		$managing_editor = addslashes($this->get_managing_editor());
		$web_master = addslashes($this->get_web_master());
		$ttl = $this->get_ttl();
		$disabled = $this->get_disabled() ? 1 : 0;

		if ($id) {
			$sql = "insert into rss_channels (id, ".
											"title, ".
											"link, ".
											"description, ".
											"language, ".
											"copyright, ".
											"managing_editor, ".
											"web_master, ".
											"ttl, ".
											"disabled ".
									      ") ".
								"values ".
									      "($id,".
									      "'$title', ".
									      "'$link', ".
									      "'$description', ".
									      "'$language', ".
									      "'$copyright', ".
									      "'$managing_editor', ".
									      "'$web_master', ".
									      "$ttl, ".
									      "$disabled ".
									      ")";
			$dbc->execute($sql);
			$ret = $id;
		} else {
			throw new TE_Exception('ID not generated - rss_channels_seq');
		}

		return $ret;
	}

	protected function update(DB_Connection $dbc) {
		$id = $this->get_id();

		$title = addslashes($this->get_title());
		$link = addslashes($this->get_link());
		$description = addslashes($this->get_description());
		$language = addslashes($this->get_language());
		$copyright = addslashes($this->get_copyright());
		$managing_editor = addslashes($this->get_managing_editor());
		$web_master = addslashes($this->get_web_master());
		$ttl = $this->get_ttl();
		$disabled = $this->get_disabled() ? 1 : 0;

		$sql = "update rss_channels set ".
						"title = '$title', ".
						"link = '$link', ".
						"description = '$description', ".
						"language = '$language', ".
						"copyright = '$copyright', ".
						"managing_editor = '$managing_editor', ".
						"web_master = '$web_master', ".
						"ttl = $ttl, ".
						"disabled = $disabled ".
					"where id = ".$id;

		$dbc->execute($sql);
		$ret = $id;

		return $ret;
	}

	public static function get_sql_for_grid() {
		$sql = "select id, title, disabled from rss_channels order by title asc";

		return $sql;
	}

	public static function get_sql_count_for_grid() {
		$sql = "select count(id) as total_rows from rss_channels ";

		return $sql;
	}

	public static function delete(DB_Connection $dbc, $id) {
		tangra_if_not_int_throw_e($id);

		$sql = "delete from rss_channels where id = $id";
		$dbc->execute($sql);
	}

	public static function load_rss_channels_ol_map(DB_Connection $dbc) {
		$sql = "select id, title from rss_channels order by title asc";
		$rez = $dbc->execute($sql);

		$ret = array();
		$ids = array();

		while($rez_obj = $rez->fetch_object()) {
			array_push($ids, $rez_obj->ID);
			$ret['ol_map'][$rez_obj->ID] = $rez_obj->TITLE;
		}

		if ($ids) {
			$ret['ids'] = $ids;
		}

		return $ret;
	}
}


text:
<?php
namespace Quazardous\Silex\Pack;

use Pimple\Container;
use Silex\Application;

/**
 *
 * Add some basic function to implement needed pack interface.
 *
 */
trait JetPackTrait
{
    /**
     * You can define the pack suffix. It's 'Pack' by default.
     * @const static::PACK_SUFFIX
     */
    //const PACK_SUFFIX = 'Pack';

    protected $packOptions = [
        'twig_templates_subpath' => 'views',
        'entity_subnamespace' => 'Entity',
        'entity_use_simple_annotation' => true,
        'target_entities_mapping' => [],
        'configs_subpath' => 'configs',
        'public_subpath' => 'public',
        'assets_subpath' => 'assets',
        'translations_subpath' => 'locale',
        'mount_prefix' => '/',
        'mount_host' => null,
    ];

    /**
     * Set the pack's options from the app container.
     * @see \Quazardous\Silex\Api\OptionnablePackInterface::setPackOptions()
     * @param Container $app
     */
    public function setPackOptions(Container $app) {
        foreach ($this->packOptions as $key => &$value) {
            $key = $this->_ns($key);
            if (isset($app[$key])) {
                $value = $app[$key];
            }
        }
    }

    /**
     * Return the name of the pack. It's the short class name without the 'Pack' suffix.
     * @see \Quazardous\Silex\Api\PackInterface::getName()
     * @return string
     */
    public function getName()
    {
        static $names = [];
        $me = get_class($this);
        if (empty($names[$me])) {
            $names[$me] = $this->getReflector()->getShortName();
            $suffix = defined('static::PACK_SUFFIX') ? static::PACK_SUFFIX : 'Pack';
            if (strrpos($names[$me], $suffix) == (strlen($names[$me]) - strlen($suffix))) {
                $names[$me] = substr($names[$me], 0, strlen($names[$me]) - strlen($suffix));
            }
        }
        return $names[$me];
    }

    /**
     * Return the path for the Twig templates. By default, it's a 'views' folder in the pack class namespace path.
     * @see \Quazardous\Silex\Api\TwiggablePackInterface::getTwigTemplatesPath()
     * @return string
     */
    public function getTwigTemplatesPath(Container $app)
    {
        static $paths = [];
        $me = get_class($this);
        if (empty($paths[$me])) {
            $subpath = $this->packOptions['twig_templates_subpath'];
            $paths[$me] = dirname($this->getReflector()->getFileName()) . '/' . $subpath;
        }
        return $paths[$me];
    }

    /**
     * Return a default mapping for the pack's entities.
     * @see \Quazardous\Silex\Api\EntitablePackInterface::getEntityMappings()
     * @return array
     */
    public function getEntityMappings(Container $app)
    {
        static $mappings = [];
        $me = get_class($this);
        if (empty($mappings[$me])) {
            $subns = $this->packOptions['entity_subnamespace'];
            $subns = trim($subns, '\\');
            $simple = $this->packOptions['entity_use_simple_annotation'];
            $ns = $this->getReflector()->getNamespaceName() . '\\' . $subns;
            $subpath = str_replace('\\', '/', $subns);
            $path = dirname($this->getReflector()->getFileName()) . '/' . $subpath;
            if (is_dir($path)) {
                $mappings[$me] = [
                    'type' => 'annotation',
                    'namespace' => $ns,
                    'path' => $path,
                    'use_simple_annotation_reader' => $simple,
                ];
            }
        }
        if (empty($mappings[$me])) {
            return [];
        }
        return [$mappings[$me]];
    }

    /**
     * Return a default interface to entity class mapping for the pack's entities.
     * @see \Quazardous\Silex\Api\EntitablePackInterface::getTargetEntitiesMapping()
     * @return array
     */
    public function getTargetEntitiesMapping(Container $app)
    {
        return (array)$this->packOptions['target_entities_mapping'];
    }

    /**
     * The path of the configs.
     * @see \Quazardous\Silex\Api\ConfigurablePackInterface::getConfigsPath()
     * @return string
     */
    public function getConfigsPath(Container $app)
    {
        static $paths = [];
        $me = get_class($this);
        if (empty($paths[$me])) {
            $subpath = $this->packOptions['configs_subpath'];
            $paths[$me] = dirname($this->getReflector()->getFileName()) . '/' . $subpath;
        }
        return $paths[$me];
    }

    /**
     * The path of the assets.
     * @see \Quazardous\Silex\Api\AssetablePackInterface::getAssetsPath()
     * @return string
     */
    public function getAssetsPath(Container $app)
    {
        static $paths = [];
        $me = get_class($this);
        if (empty($paths[$me])) {
            $subpath = $this->packOptions['assets_subpath'];
            $paths[$me] = dirname($this->getReflector()->getFileName()) . '/' . $subpath;
        }
        return $paths[$me];
    }

    /**
     * No assetic formulae by default.
     * @see \Quazardous\Silex\Api\AssetablePackInterface::getAsseticFormulae()
     * @return array
     */
    public function getAsseticFormulae(Container $app)
    {
        return [];
    }

    /**
     * The path of the translations.
     * @see \Quazardous\Silex\Api\TranslatablePackInterface::getTranslationsPath()
     * @return string
     */
    public function getTranslationsPath(Container $app)
    {
        static $paths = [];
        $me = get_class($this);
        if (empty($paths[$me])) {
            $subpath = $this->packOptions['translations_subpath'];
            $paths[$me] = dirname($this->getReflector()->getFileName()) . '/' . $subpath;
        }
        return $paths[$me];
    }

    /**
     * By default mount the pack on '/'.
     * @see \Quazardous\Silex\Api\MountablePackInterface::getMountPrefix()
     * @return string
     */
    public function getMountPrefix(Container $app) {
        return $this->packOptions['mount_prefix'];
    }

    /**
     * No specific host by default.
     * @see \Quazardous\Silex\Api\MountablePackInterface::getMountHost()
     * @return string
     */
    public function getMountHost(Container $app) {
        return $this->packOptions['mount_host'];;
    }

    /**
     * No controllers by default.
     * @see Silex\Api\ControllerProviderInterface::connect()
     * @return ControllerCollection A ControllerCollection instance
     */
    public function connect(Application $app)
    {
        return $app['controllers_factory'];
    }

    /**
     * No Twig extension by default.
     * @see \Quazardous\Silex\Api\TwiggablePackInterface::getTwigExtensions()
     * @return (\Twig_SimpleFilter|\Twig_SimpleFunction)[]
     */
    public function getTwigExtensions(Container $app)
    {
        return [];
    }

    /**
     * No commands by default.
     * @see \Quazardous\Silex\Api\ConsolablePackInterface::getConsoleCommands()
     * @return \Symfony\Component\Console\Command\Command[]
     */
    public function getConsoleCommands(Container $app)
    {
        return [];
    }

    /**
     * A list of symlinks to add.
     * @see \Quazardous\Silex\Api\LinkablePackInterface::getSymlinks()
     * @return array
     */
    public function getSymlinks(Container $app)
    {
        $symlinks = [];
        if ($this->getPublicPath($app)) {
            $symlinks[$this->getPublicPath($app)] = 'packs/' . $this->_ns();
        }
        return $symlinks;
    }

    /**
     * By default, public is the public folder.
     * @see \Quazardous\Silex\Api\LinkablePackInterface::getPublicPath()
     * @return string
     */
    public function getPublicPath(Container $app) {
        static $paths = [];
        $me = get_class($this);
        if (empty($paths[$me])) {
            $subpath = $this->packOptions['public_subpath'];
            $paths[$me] = dirname($this->getReflector()->getFileName()) . '/' . $subpath;
        }
        return $paths[$me];
    }

    /**
     * Returns the the pack namespace path.
     * @return string
     */
    public function getPackPath(Container $app) {
        static $paths = [];
        $me = get_class($this);
        if (empty($paths[$me])) {
            $paths[$me] = dirname($this->getReflector()->getFileName());
        }
        return $paths[$me];
    }

    /**
     *
     * @return \ReflectionClass
     */
    protected function getReflector() {
        static $reflectors = [];
        $me = get_class($this);
        if (empty($reflectors[$me])) {
            $reflectors[$me] = new \ReflectionClass($this);
        }
        return $reflectors[$me];
    }

    /**
     * Helper function  to prefix ids with the pack name as namespace.
     * ie. for a pack named 'MyFooPack', the  id 'bar' becomes 'MyFoo.bar' or 'my_foo.bar' (with decamelize).
     *
     * @param string $id an id to namespace
     * @param boolean $decamelize
     * @param string $separator
     * @return string the pack namespaced id
     */
    protected function _ns($id = null, $decamelize = true, $separator = '.') {
        static $decamelizeds = [];
        $me = get_class($this);
        if ($decamelize && empty($decamelizeds[$me])) {
            $decamelizeds[$me] = \decamelize($this->getName());
        }
        $ns = $decamelize ? $decamelizeds[$me] : $this->getName();
        return $ns . ($id ? $separator . $id : '');
    }

}


text:
import { Component } from '@angular/core';

@Component({
  templateUrl: `./usermanagement.component.html`
})
export class UsermanagementComponent { }


text:
@interface HBBaseCollectionView : UIView<
UICollectionViewDataSource,
UICollectionViewDelegate,
UICollectionViewDelegateFlowLayout,HBCollectionViewControllerConfig,HBWaterFLayoutDelegate>

@property (nonatomic, strong) NSMutableDictionary * dataDictionary;

@property (nonatomic, strong) UICollectionView          *collectionView;
@property (nonatomic, strong) HBCollectionFallFLayout   *collectionViewFlowLayout;

@property (nonatomic, assign         ) BOOL    nodeselectRow;
@property (nonatomic, assign,readonly) CGFloat itemWidth;

-(void)viewDidCurrentView;
-(CGRect)adjustContentOffSet:(CGFloat)top bottom:(CGFloat)bottom;

@end


text:
require "spec_helper"

describe PlatformsController do
  describe "routing" do

    it "recognizes and generates #index" do
      { :get => "/platforms" }.should route_to(:controller => "platforms", :action => "index")
    end

    it "recognizes and generates #new" do
      { :get => "/platforms/new" }.should route_to(:controller => "platforms", :action => "new")
    end

    it "recognizes and generates #show" do
      { :get => "/platforms/1" }.should route_to(:controller => "platforms", :action => "show", :id => "1")
    end

    it "recognizes and generates #edit" do
      { :get => "/platforms/1/edit" }.should route_to(:controller => "platforms", :action => "edit", :id => "1")
    end

    it "recognizes and generates #create" do
      { :post => "/platforms" }.should route_to(:controller => "platforms", :action => "create")
    end

    it "recognizes and generates #update" do
      { :put => "/platforms/1" }.should route_to(:controller => "platforms", :action => "update", :id => "1")
    end

    it "recognizes and generates #destroy" do
      { :delete => "/platforms/1" }.should route_to(:controller => "platforms", :action => "destroy", :id => "1")
    end

  end
end


text:
<!DOCTYPE html>

    <meta charset="utf-8">

    <title>Legislador presume que no contamina… con auto de 600 mil pesos | La Red Semanario</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

        <meta name="keywords" content="PAN,diputados,contaminación" />

    <meta name="description" content="Y ya saben de dónde salió toda la lana… para erguirse como ejemplo de conciencia ecológica, el coordinador panista en la Cámara de Diputados, Marko Cortés, presumió el cambio de su camioneta Suburban">
<meta property="og:type" content="article">
<meta property="og:title" content="Legislador presume que no contamina… con auto de 600 mil pesos">
<meta property="og:url" content="https://laredsemanario.com/2016/04/Legislador-presume-que-no-contamina-con-auto-de-600-mil-pesos/index.html">
<meta property="og:site_name" content="La Red Semanario">
<meta property="og:description" content="Y ya saben de dónde salió toda la lana… para erguirse como ejemplo de conciencia ecológica, el coordinador panista en la Cámara de Diputados, Marko Cortés, presumió el cambio de su camioneta Suburban">
<meta property="og:image" content="http://i2.wp.com/www.sopitas.com/wp-content/uploads/2016/04/auto-electrico-pan.jpg">
<meta property="og:updated_time" content="2016-04-13T13:42:01.662Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Legislador presume que no contamina… con auto de 600 mil pesos">
<meta name="twitter:description" content="Y ya saben de dónde salió toda la lana… para erguirse como ejemplo de conciencia ecológica, el coordinador panista en la Cámara de Diputados, Marko Cortés, presumió el cambio de su camioneta Suburban">
<meta name="twitter:image" content="http://i2.wp.com/www.sopitas.com/wp-content/uploads/2016/04/auto-electrico-pan.jpg">
<meta name="twitter:creator" content="@3171117842">
<meta property="fb:app_id" content="956176474392711">

        <link rel="icon" href="/favicon.ico" />

    <link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/vendor/titillium-web/styles.css">
    <link rel="stylesheet" href="/vendor/source-code-pro/styles.css">

    <link rel="stylesheet" href="/css/style.css">

        <link rel="stylesheet" href="/vendor/fancybox/jquery.fancybox.css">

        <link rel="stylesheet" href="/vendor/scrollLoading/style.css">

                                    Inicio

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="Buscar" />
        <button type="submit" class="search-form-submit"></button>
    </form>

            <input type="text" class="ins-search-input" placeholder="Escribe algo..." />

    PoliticaNacional

        Legislador presume que no contamina… con auto de 600 mil pesos

    <time datetime="2016-04-13T13:27:44.000Z" itemprop="datePublished">2016-04-13</time>

PAN

contaminación

diputados

Y ya saben de dónde salió toda la lana… para erguirse como ejemplo de conciencia ecológica, el coordinador panista en la Cámara de Diputados, Marko Cortés, presumió el cambio de su camioneta Suburban 2009 por un auto Leaf Nissan 2016, con el cual contribuye a la reducción de contaminantes.

En lugar de optar por una bicicleta, andar "a patín" o aplicar el viaje en transporte público (pues para que diario pueda tomarse selfies), el del PAN prefirió moverse a partir de ahora en una nave de sólo 598 mil 800 pesos… claro, cubierta con los recursos de la bancada que coordina.

"Fue en una agencia y se hizo a través del grupo parlamentario; se entregó la camioneta Suburban que teníamos y el carro que se adquirió es éste", explicó Cortés, quien también dio a conocer la intención de que toda la flotilla de autos que pertenecen a la bancada panista se cambie por autos 100% eléctricos.

Como ellos no pagan, el legislador comentó que recomendarán hacer lo mismo a los de otros partidos, para que así todos los diputados puedan presumir naves nuevas y no contaminantes. En su lógica, Cortés explicó que, si de todos modos van a gastar <s>a nuestras costillas</s>, pues hacerlo con algo bueno:

"Buscaremos que en la sesión de la Junta de Coordinación Política se ponga a consideración nuestra propuesta para que aquellos vehículos que de por sí ya vaya adquirir la Cámara de Diputados, vía arrendamiento o vía directa, pues sea bajo este esquema, de vehículos completamente eléctricos como éste".

Cercano a los 600 mil pesos, el carrito es el "más accesible" que se pudo comprar, señala el diputado… al menos en cuanto a lo que en autos eléctricos se refiere. Sin embargo, aunque el fregadazo de dinero se ve superlativo, a mediano plazo el ahorro vale la pena… dice el legislador. Por ejemplo, en su antigua camioneta llenar el tanque representaba un gasto de mil 200 pesos, ahora sólo le costará… perdón, nos costará 40 o 50 pesitos.

Está bien que busquen no contaminar… pero qué diferencia hubiera sido que el diputado dijera: "con mi dinero me compré esta nave"…

Vía Milenio

              La Red Semanario

    Compartir

        Please enable JavaScript to view the comments powered by Disqus.

seguir:

        más nuevo

            Diputados piden a ex presidentes renunciar a pensión millonaria

        antiguo

México y Alemania intensificarán relaciones bilaterales: Merkel

recientes

Nacional

Detienen a Leopoldo Duarte, acusado de abuso sexual en el Colegio Matatena

<time datetime="2016-05-11T14:29:50.000Z" itemprop="datePublished">2016-05-11</time>

Ciencia

Telescopio espacial Kepler descubre 1284 nuevos planetas fuera del sistema solar

<time datetime="2016-05-11T14:24:56.000Z" itemprop="datePublished">2016-05-11</time>

Deportes

Billy Álvarez dejaría Cruz Azul

<time datetime="2016-05-11T14:14:24.000Z" itemprop="datePublished">2016-05-11</time>

Politica

Por ser desproporcionadas, El Bronco cancelará 10 mil becas estudiantiles

<time datetime="2016-05-11T14:08:06.000Z" itemprop="datePublished">2016-05-11</time>

Cultura

Los 11 mandamientos de la Iglesia de Satán son mucho más sensatos de lo que imaginarías

<time datetime="2016-05-10T14:05:56.000Z" itemprop="datePublished">2016-05-10</time>

© 2014 - 2016 La Red Semanario


text:
package com.example.contactcenterinsights;

// [START contactcenterinsights_create_phrase_matcher_all_of]

import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient;
import com.google.cloud.contactcenterinsights.v1.ExactMatchConfig;
import com.google.cloud.contactcenterinsights.v1.LocationName;
import com.google.cloud.contactcenterinsights.v1.PhraseMatchRule;
import com.google.cloud.contactcenterinsights.v1.PhraseMatchRuleConfig;
import com.google.cloud.contactcenterinsights.v1.PhraseMatchRuleGroup;
import com.google.cloud.contactcenterinsights.v1.PhraseMatcher;
import java.io.IOException;

public class CreatePhraseMatcherAllOf {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace this variable before running the sample.
    String projectId = "my_project_id";

    createPhraseMatcherAllOf(projectId);
  }

  public static PhraseMatcher createPhraseMatcherAllOf(String projectId) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) {
      // Construct a phrase matcher that matches all of its rule groups.
      PhraseMatcher.Builder phraseMatcher =
          PhraseMatcher.newBuilder()
              .setDisplayName("NON_SHIPPING_PHONE_SERVICE")
              .setTypeValue(1)
              .setActive(true);

      // Construct a rule group to match the word "PHONE" or "CELLPHONE", ignoring case sensitivity.
      PhraseMatchRuleGroup.Builder ruleGroup1 = PhraseMatchRuleGroup.newBuilder().setTypeValue(2);

      String[] words1 = {"PHONE", "CELLPHONE"};
      for (String w : words1) {
        PhraseMatchRule.Builder rule =
            PhraseMatchRule.newBuilder()
                .setQuery(w)
                .setConfig(
                    PhraseMatchRuleConfig.newBuilder()
                        .setExactMatchConfig(ExactMatchConfig.newBuilder().build())
                        .build());
        ruleGroup1.addPhraseMatchRules(rule.build());
      }
      phraseMatcher.addPhraseMatchRuleGroups(ruleGroup1.build());

      // Construct another rule group to not match the word "SHIPPING" or "DELIVERY",
      // ignoring case sensitivity.
      PhraseMatchRuleGroup.Builder ruleGroup2 = PhraseMatchRuleGroup.newBuilder().setTypeValue(1);

      String[] words2 = {"SHIPPING", "DELIVERY"};
      for (String w : words2) {
        PhraseMatchRule.Builder rule =
            PhraseMatchRule.newBuilder()
                .setQuery(w)
                .setNegated(true)
                .setConfig(
                    PhraseMatchRuleConfig.newBuilder()
                        .setExactMatchConfig(ExactMatchConfig.newBuilder().build())
                        .build());
        ruleGroup2.addPhraseMatchRules(rule.build());
      }
      phraseMatcher.addPhraseMatchRuleGroups(ruleGroup2.build());

      // Construct a parent resource.
      LocationName parent = LocationName.of(projectId, "us-central1");

      // Call the Insights client to create a phrase matcher.
      PhraseMatcher response = client.createPhraseMatcher(parent, phraseMatcher.build());
      System.out.printf("Created %s%n", response.getName());
      return response;
    }
  }
}

// [END contactcenterinsights_create_phrase_matcher_all_of]


text:
from monty.pprint import pprint_table, draw_tree

import unittest

class PprintTableTest(unittest.TestCase):
    def test_print(self):
        table = [["one", "two"], ["1", "2"]]
        pprint_table(table)

class DrawTreeTest(unittest.TestCase):
    def test_draw_tree(self):
        class Node(object):
            def __init__(self, name, children):
                self.name = name
                self.children = children

            def __str__(self):
                return self.name

        root = Node('root', [
            Node('sub1', []),
            Node('sub2', [
                Node('sub2sub1', [])
            ]),
            Node('sub3', [
                Node('sub3sub1', [
                    Node('sub3sub1sub1', [])
                ]),
                Node('sub3sub2', [])
            ])
        ])

        print(draw_tree(root))

if __name__ == "__main__":
    unittest.main()


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

class Products extends CI_Controller {

	/**
	 * Index Page for this controller.
	 */
	public function index()
	{
		$this->load->view('products/home');
	}
}


text:
package org.spongepowered.common.data.manipulator.immutable;

import org.spongepowered.api.data.DataContainer;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.data.manipulator.immutable.ImmutableRepresentedItemData;
import org.spongepowered.api.data.manipulator.mutable.RepresentedItemData;
import org.spongepowered.api.data.value.immutable.ImmutableValue;
import org.spongepowered.api.item.inventory.ItemStackComparators;
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
import org.spongepowered.common.data.manipulator.immutable.common.AbstractImmutableSingleData;
import org.spongepowered.common.data.manipulator.mutable.SpongeRepresentedItemData;
import org.spongepowered.common.data.value.immutable.ImmutableSpongeValue;

public class ImmutableSpongeRepresentedItemData extends AbstractImmutableSingleData<ItemStackSnapshot, ImmutableRepresentedItemData, RepresentedItemData> implements ImmutableRepresentedItemData {

    private final ImmutableValue<ItemStackSnapshot> immutableValue = new ImmutableSpongeValue<>(Keys.REPRESENTED_ITEM, ItemStackSnapshot.NONE, this.value);

    public ImmutableSpongeRepresentedItemData(ItemStackSnapshot itemStack) {
        super(ImmutableRepresentedItemData.class, itemStack, Keys.REPRESENTED_ITEM);
    }

    @Override
    public ImmutableValue<ItemStackSnapshot> item() {
        return this.immutableValue;
    }

    @Override
    protected ImmutableValue<?> getValueGetter() {
        return item();
    }

    @Override
    public RepresentedItemData asMutable() {
        return new SpongeRepresentedItemData(this.value);
    }

    @Override
    public DataContainer toContainer() {
        return super.toContainer()
            .set(Keys.REPRESENTED_ITEM, this.value);
    }

    @Override
    public int compareTo(ImmutableRepresentedItemData o) {
        return ItemStackComparators.ALL.compare(o.item().get().createStack(), this.getValue().createStack());
    }

}


text:
#pragma once

#include "esp_err.h"

#ifdef __cplusplus
extern "C" {
#endif

esp_err_t tcp_server_wait_for_connection(void);

esp_err_t tcp_server_send(uint8_t *payload, size_t size);

void tcp_server_close_when_done(void);

#ifdef __cplusplus
}
#endif