text:
package com.github.pockethub.android.ui.repo;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.meisolsson.githubsdk.core.ServiceGenerator;
import com.meisolsson.githubsdk.model.Repository;
import com.meisolsson.githubsdk.model.User;
import com.github.kevinsawicki.wishlist.SingleTypeAdapter;
import com.github.pockethub.android.R;
import com.github.pockethub.android.core.PageIterator;
import com.github.pockethub.android.core.ResourcePager;
import com.github.pockethub.android.ui.PagedItemFragment;
import com.meisolsson.githubsdk.service.repositories.RepositoryService;

import java.util.List;

import static com.github.pockethub.android.Intents.EXTRA_USER;
import static com.github.pockethub.android.RequestCodes.REPOSITORY_VIEW;
import static com.github.pockethub.android.ResultCodes.RESOURCE_CHANGED;

/**
 * Fragment to display a list of repositories for a {@link User}
 */
public class UserRepositoryListFragment extends PagedItemFragment<Repository> {

    private User user;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);

        user = getParcelableExtra(EXTRA_USER);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        setEmptyText(R.string.no_repositories);
    }

    @Override
    protected ResourcePager<Repository> createPager() {
        return new ResourcePager<Repository>() {

            @Override
            protected Object getId(Repository resource) {
                return resource.id();
            }

            @Override
            public PageIterator<Repository> createIterator(int page, int size) {
                return new PageIterator<>(page1 ->
                        ServiceGenerator.createService(getContext(), RepositoryService.class)
                                .getUserRepositories(user.login(), page1), page);
            }
        };
    }

    @Override
    protected int getLoadingMessage() {
        return R.string.loading_repositories;
    }

    @Override
    protected int getErrorMessage(Exception exception) {
        return R.string.error_repos_load;
    }

    @Override
    protected SingleTypeAdapter<Repository> createAdapter(List<Repository> items) {
        return new UserRepositoryListAdapter(getActivity().getLayoutInflater(),
                items.toArray(new Repository[items.size()]), user);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == REPOSITORY_VIEW && resultCode == RESOURCE_CHANGED) {
            forceRefresh();
            return;
        }

        super.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public void onListItemClick(ListView list, View v, int position, long id) {
        Repository repo = (Repository) list.getItemAtPosition(position);
        startActivityForResult(RepositoryViewActivity.createIntent(repo),
                REPOSITORY_VIEW);
    }
}


text:
<?php if (!defined('APPLICATION')) exit();

class ConversationMessageModel extends Gdn_Model {
   /**
    * Class constructor.
    */
   public function __construct() {
      parent::__construct('ConversationMessage');
   }

   public function Get($ConversationID, $ViewingUserID, $Offset = '0', $Limit = '', $Wheres = '') {
      if ($Limit == '')
         $Limit = Gdn::Config('Conversations.Messages.PerPage', 50);

      $Offset = !is_numeric($Offset) || $Offset < 0 ? 0 : $Offset;
      if (is_array($Wheres))
         $this->SQL->Where($Wheres);

      $this->FireEvent('BeforeGet');
      return $this->SQL
         ->Select('cm.*')
         ->Select('iu.Name', '', 'InsertName')
         ->Select('iu.Photo', '', 'InsertPhoto')
         ->From('ConversationMessage cm')
         ->Join('Conversation c', 'cm.ConversationID = c.ConversationID')
         ->Join('UserConversation uc', 'c.ConversationID = uc.ConversationID and uc.UserID = '.$ViewingUserID)
         ->Join('User iu', 'cm.InsertUserID = iu.UserID')
         ->BeginWhereGroup()
         ->Where('uc.DateCleared is null')
         ->OrWhere('uc.DateCleared <', 'cm.DateInserted', TRUE, FALSE) // Make sure that cleared conversations do not show up unless they have new messages added.
         ->EndWhereGroup()
         ->Where('cm.ConversationID', $ConversationID)
         ->OrderBy('cm.DateInserted', 'asc')
         ->Limit($Limit, $Offset)
         ->Get();
   }

   public function GetNew($ConversationID, $LastMessageID) {
      $Session = Gdn::Session();
      $this->SQL->Where('MessageID > ', $LastMessageID);
      return $this->Get($ConversationID, $Session->UserID);
   }

   public function GetCount($ConversationID, $ViewingUserID, $Wheres = '') {
      if (is_array($Wheres))
         $this->SQL->Where($Wheres);

      $Data = $this->SQL
         ->Select('cm.MessageID', 'count', 'Count')
         ->From('ConversationMessage cm')
         ->Join('Conversation c', 'cm.ConversationID = c.ConversationID')
         ->Join('UserConversation uc', 'c.ConversationID = uc.ConversationID and uc.UserID = '.$ViewingUserID)
         ->BeginWhereGroup()
         ->Where('uc.DateCleared is null')
         ->OrWhere('uc.DateCleared >', 'c.DateUpdated', TRUE, FALSE) // Make sure that cleared conversations do not show up unless they have new messages added.
         ->EndWhereGroup()
         ->GroupBy('cm.ConversationID')
         ->Where('cm.ConversationID', $ConversationID)
         ->Get();
      if ($Data->NumRows() > 0)
         return $Data->FirstRow()->Count;

      return 0;
   }

   public function GetCountWhere($Wheres = '') {
      if (is_array($Wheres))
         $this->SQL->Where($Wheres);

      $Data = $this->SQL
         ->Select('MessageID', 'count', 'Count')
         ->From('ConversationMessage')
         ->Get();
      if ($Data->NumRows() > 0)
         return $Data->FirstRow()->Count;

      return 0;
   }

   public function Save($FormPostValues) {
      $Session = Gdn::Session();

      // Define the primary key in this model's table.
      $this->DefineSchema();

      // Add & apply any extra validation rules:
      $this->Validation->ApplyRule('Body', 'Required');
      $this->AddInsertFields($FormPostValues);

      // Validate the form posted values
      $MessageID = FALSE;
      if($this->Validate($FormPostValues)) {
         $Fields = $this->Validation->SchemaValidationFields(); // All fields on the form that relate to the schema
         $Fields['Format'] = C('Conversations.Message.Format','Ham');

         $MessageID = $this->SQL->Insert($this->Name, $Fields);
         $ConversationID = ArrayValue('ConversationID', $Fields, 0);
         $Px = $this->SQL->Database->DatabasePrefix;

         // Get the new message count for the conversation.
         $SQLR = $this->SQL
            ->Select('MessageID', 'count', 'CountMessages')
            ->Select('MessageID', 'max', 'LastMessageID')
            ->From('ConversationMessage')
            ->Where('ConversationID', $ConversationID)
            ->Get()->FirstRow(DATASET_TYPE_ARRAY);
         if (sizeof($SQLR)) {
            list($CountMessages, $LastMessageID) = array_values($SQLR);
         } else { return; }

         // Update the conversation's DateUpdated field
         $this->SQL
            ->Update('Conversation c')
            ->History()
            ->Set('CountMessages', $CountMessages)
            ->Set('LastMessageID', $LastMessageID)
            ->Where('ConversationID', $ConversationID)
            ->Put();

         // Update the last message of the users that were previously up-to-date on their read messages.
         $this->SQL
            ->Update('UserConversation uc')
            ->Set('uc.LastMessageID', $MessageID)
            ->Set('uc.CountReadMessages', "case uc.UserID when {$Session->UserID} then $CountMessages else uc.CountReadMessages end", FALSE)
            ->Where('uc.ConversationID', $ConversationID)
            ->Where('uc.Deleted', '0')
            ->Where('uc.CountReadMessages', $CountMessages - 1)
            ->Put();

         // Incrememnt the users' inbox counts.
         $this->SQL
            ->Update('User u')
            ->Join('UserConversation uc', 'u.UserID = uc.UserID')
            ->Set('u.CountUnreadConversations', 'coalesce(u.CountUnreadConversations, 0) + 1', FALSE)
            ->Where('uc.ConversationID', $ConversationID)
            ->Where('uc.LastMessageID', $MessageID)
            ->Where('uc.UserID <>', $Session->UserID)
            ->Put();

         // Grab the users that need to be notified.
         $UnreadData = $this->SQL
            ->Select('uc.UserID')
            ->From('UserConversation uc')
            ->Where('uc.ConversationID', $ConversationID) // hopefully coax this index.
            // ->Where('uc.LastMessageID', $MessageID)
            ->Where('uc.UserID <>', $Session->UserID)
            ->Get();

         $ActivityModel = new ActivityModel();
         foreach ($UnreadData->Result() as $User) {
            // Notify the users of the new message.
            $ActivityID = $ActivityModel->Add(
               $Session->UserID,
               'ConversationMessage',
               '',
               $User->UserID,
               '',
               "/messages/$ConversationID#$MessageID",
               FALSE
            );
            $Story = ArrayValue('Body', $Fields, '');
            $ActivityModel->SendNotification($ActivityID, $Story);
         }
      }
      return $MessageID;
   }
}

redpajama_set_name: RedPajamaGithub


text:
package de.fu_berlin.imp.apiua.diff.services.impl;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.IOException;

import org.junit.Test;

import com.bkahlert.nebula.utils.FileUtils;

import de.fu_berlin.imp.apiua.core.model.URI;
import de.fu_berlin.imp.apiua.core.model.data.IBaseDataContainer;
import de.fu_berlin.imp.apiua.core.model.data.impl.FileBaseDataContainer;
import de.fu_berlin.imp.apiua.diff.model.ICompilable;
import de.fu_berlin.imp.apiua.diff.services.ICompilationService;
import de.fu_berlin.imp.apiua.diff.services.impl.CompilationService;

// TODO test multiple BaseDataDirectories
public class CompilationServiceTest {
	private IBaseDataContainer createBaseDataContainer() throws IOException {
		File tempDirectory = FileUtils.getTempDirectory();
		File dataSet = new File(tempDirectory, "__dataset.txt");
		dataSet.createNewFile();
		dataSet.deleteOnExit();
		return new FileBaseDataContainer(tempDirectory);
	}

	private final ICompilable compilable = new ICompilable() {
		private static final long serialVersionUID = 1L;

		@Override
		public URI getUri() {
			return new URI("apiua://compilable");
		}
	};
	private final ICompilable compilable2 = new ICompilable() {
		private static final long serialVersionUID = 1L;

		@Override
		public URI getUri() {
			return new URI("apiua://compilable2");
		}
	};

	@Test
	public void testCompilationStates() throws IOException {
		IBaseDataContainer baseDataContainer = this.createBaseDataContainer();
		ICompilationService compilationService = new CompilationService(
				baseDataContainer);

		assertNull(compilationService.compiles(this.compilable));
		assertNull(compilationService.compiles(this.compilable2));

		compilationService
				.compiles(new ICompilable[] { this.compilable }, true);
		assertTrue(compilationService.compiles(this.compilable));
		assertNull(compilationService.compiles(this.compilable2));

		compilationService
				.compiles(new ICompilable[] { this.compilable }, null);
		assertNull(compilationService.compiles(this.compilable));
		assertNull(compilationService.compiles(this.compilable2));

		compilationService.compiles(new ICompilable[] { this.compilable },
				false);
		assertFalse(compilationService.compiles(this.compilable));
		assertNull(compilationService.compiles(this.compilable2));

		compilationService
				.compiles(new ICompilable[] { this.compilable }, true);
		compilationService.compiles(new ICompilable[] { this.compilable2 },
				false);
		assertTrue(compilationService.compiles(this.compilable));
		assertFalse(compilationService.compiles(this.compilable2));

		compilationService
				.compiles(new ICompilable[] { this.compilable }, null);
		compilationService.compiles(new ICompilable[] { this.compilable2 },
				true);
		assertNull(compilationService.compiles(this.compilable));
		assertTrue(compilationService.compiles(this.compilable2));

		compilationService.compiles(new ICompilable[] { this.compilable },
				false);
		compilationService.compiles(new ICompilable[] { this.compilable2 },
				false);
		assertFalse(compilationService.compiles(this.compilable));
		assertFalse(compilationService.compiles(this.compilable2));

		// check synchronization and persistence
		ICompilationService compilationService2 = new CompilationService(
				baseDataContainer);
		assertFalse(compilationService.compiles(this.compilable));
		assertFalse(compilationService.compiles(this.compilable2));
		assertFalse(compilationService2.compiles(this.compilable));
		assertFalse(compilationService2.compiles(this.compilable2));

		compilationService
				.compiles(new ICompilable[] { this.compilable }, null);
		compilationService.compiles(new ICompilable[] { this.compilable2 },
				true);
		assertNull(compilationService.compiles(this.compilable));
		assertTrue(compilationService.compiles(this.compilable2));

		// values stay unchanged since the second compilation service does not
		// know of changes in the persistence level
		assertFalse(compilationService2.compiles(this.compilable));
		assertFalse(compilationService2.compiles(this.compilable2));
	}

	@Test
	public void testCompilerOutputs() throws IOException {
		IBaseDataContainer baseDataContainer = this.createBaseDataContainer();
		ICompilationService compilationService = new CompilationService(
				baseDataContainer);

		assertEquals("", compilationService.compilerOutput(this.compilable));
		assertEquals("", compilationService.compilerOutput(this.compilable2));

		compilationService.compilerOutput(this.compilable, "test");
		assertEquals("test", compilationService.compilerOutput(this.compilable));
		assertEquals("", compilationService.compilerOutput(this.compilable2));

		compilationService.compilerOutput(this.compilable, null);
		assertEquals("", compilationService.compilerOutput(this.compilable));
		assertEquals("", compilationService.compilerOutput(this.compilable2));

		compilationService.compilerOutput(this.compilable, " ");
		assertEquals("", compilationService.compilerOutput(this.compilable));
		assertEquals("", compilationService.compilerOutput(this.compilable2));

		compilationService.compilerOutput(this.compilable, "test2");
		compilationService.compilerOutput(this.compilable2, "   ");
		assertEquals("test2",
				compilationService.compilerOutput(this.compilable));
		assertEquals("", compilationService.compilerOutput(this.compilable2));

		compilationService.compilerOutput(this.compilable, null);
		compilationService.compilerOutput(this.compilable2, "test3");
		assertEquals("", compilationService.compilerOutput(this.compilable));
		assertEquals("test3",
				compilationService.compilerOutput(this.compilable2));

		compilationService.compilerOutput(this.compilable, "");
		compilationService.compilerOutput(this.compilable2, null);
		assertEquals("", compilationService.compilerOutput(this.compilable));
		assertEquals("", compilationService.compilerOutput(this.compilable2));

		// check synchronization and persistence
		ICompilationService compilationService2 = new CompilationService(
				baseDataContainer);
		assertEquals("", compilationService.compilerOutput(this.compilable));
		assertEquals("", compilationService.compilerOutput(this.compilable2));
		assertEquals("", compilationService2.compilerOutput(this.compilable));
		assertEquals("", compilationService2.compilerOutput(this.compilable2));

		compilationService.compilerOutput(this.compilable, "test4");
		compilationService.compilerOutput(this.compilable2, "test5");
		assertEquals("test4",
				compilationService.compilerOutput(this.compilable));
		assertEquals("test5",
				compilationService.compilerOutput(this.compilable2));
		assertEquals("test4",
				compilationService2.compilerOutput(this.compilable));
		assertEquals("test5",
				compilationService2.compilerOutput(this.compilable2));
	}

	@Test
	public void testRunOutputs() throws IOException {
		IBaseDataContainer baseDataContainer = this.createBaseDataContainer();
		ICompilationService compilationService = new CompilationService(
				baseDataContainer);

		assertEquals("", compilationService.executionOutput(this.compilable));
		assertEquals("", compilationService.executionOutput(this.compilable2));

		compilationService.executionOutput(this.compilable, "test");
		assertEquals("test",
				compilationService.executionOutput(this.compilable));
		assertEquals("", compilationService.executionOutput(this.compilable2));

		compilationService.executionOutput(this.compilable, null);
		assertEquals("", compilationService.executionOutput(this.compilable));
		assertEquals("", compilationService.executionOutput(this.compilable2));

		compilationService.executionOutput(this.compilable, " ");
		assertEquals("", compilationService.executionOutput(this.compilable));
		assertEquals("", compilationService.executionOutput(this.compilable2));

		compilationService.executionOutput(this.compilable, "test2");
		compilationService.executionOutput(this.compilable2, "   ");
		assertEquals("test2",
				compilationService.executionOutput(this.compilable));
		assertEquals("", compilationService.executionOutput(this.compilable2));

		compilationService.executionOutput(this.compilable, null);
		compilationService.executionOutput(this.compilable2, "test3");
		assertEquals("", compilationService.executionOutput(this.compilable));
		assertEquals("test3",
				compilationService.executionOutput(this.compilable2));

		compilationService.executionOutput(this.compilable, "");
		compilationService.executionOutput(this.compilable2, null);
		assertEquals("", compilationService.executionOutput(this.compilable));
		assertEquals("", compilationService.executionOutput(this.compilable2));

		// check synchronization and persistence
		ICompilationService compilationService2 = new CompilationService(
				baseDataContainer);
		assertEquals("", compilationService.executionOutput(this.compilable));
		assertEquals("", compilationService.executionOutput(this.compilable2));
		assertEquals("", compilationService2.executionOutput(this.compilable));
		assertEquals("", compilationService2.executionOutput(this.compilable2));

		compilationService.executionOutput(this.compilable, "test4");
		compilationService.executionOutput(this.compilable2, "test5");
		assertEquals("test4",
				compilationService.executionOutput(this.compilable));
		assertEquals("test5",
				compilationService.executionOutput(this.compilable2));
		assertEquals("test4",
				compilationService2.executionOutput(this.compilable));
		assertEquals("test5",
				compilationService2.executionOutput(this.compilable2));
	}
}


text:
{% extends 'base_small.html' %}

{% block copy_main %}

    <h2>404: The page you were looking for is not here... </h2>

{% endblock %}


text:
<?php
/**
 * Snippet German lexicon topic
 *
 * @package modx
 * @subpackage lexicon
 *
 * @language de
 * @namespace core
 * @topic snippet
 *
 * MODX Revolution translated to German by Jan-Christoph Ihrens (enigmatic_user, enigma@lunamail.de)
 */
$_lang['snippet'] = 'Snippet';
$_lang['snippets_available'] = 'Snippets, die Sie in Ihre Seite einbinden können';
$_lang['snippet_code'] = 'Snippet-Code (PHP)';
$_lang['snippet_delete_confirm'] = 'Sind Sie sicher, dass Sie dieses Snippet löschen möchten?';
$_lang['snippet_desc'] = 'Beschreibung';
$_lang['snippet_desc_category'] = 'Die Kategorie, zu der dieses Snippet gehört.';
$_lang['snippet_desc_description'] = 'Eine kurze Beschreibung dieses Snippets.';
$_lang['snippet_desc_name'] = 'Der Name dieses Snippets. Das Snippet kann dann mittels der [[NameOfSnippet]]-Tags genutzt werden.';
$_lang['snippet_duplicate_confirm'] = 'Sind Sie sicher, dass Sie dieses Snippet duplizieren möchten?';
$_lang['snippet_duplicate_error'] = 'Ein Fehler trat auf beim Duplizieren des Snippets.';
$_lang['snippet_err_create'] = 'Ein Fehler trat auf beim Erstellen des Snippets.';
$_lang['snippet_err_delete'] = 'Ein Fehler trat auf beim Versuch, das Snippet zu löschen.';
$_lang['snippet_err_duplicate'] = 'Ein Fehler trat auf beim Versuch, das Snippet zu duplizieren.';
$_lang['snippet_err_exists_name'] = 'Ein Snippet mit dem Namen "[[+name]]" existiert bereits.';
$_lang['snippet_err_invalid_name'] = 'Der Snippet-Name ist ungültig.';
$_lang['snippet_err_locked'] = 'Dieses Snippet ist für die Bearbeitung gesperrt.';
$_lang['snippet_err_nf'] = 'Snippet nicht gefunden!';
$_lang['snippet_err_ns'] = 'Snippet nicht angegeben.';
$_lang['snippet_err_ns_name'] = 'Bitte geben Sie einen Namen für das Snippet an.';
$_lang['snippet_err_remove'] = 'Ein Fehler trat auf beim Löschen des Snippets.';
$_lang['snippet_err_save'] = 'Ein Fehler trat auf beim Speichern des Snippets.';
$_lang['snippet_execonsave'] = 'Snippet nach dem Speichern ausführen.';
$_lang['snippet_lock'] = 'Snippet für die Bearbeitung sperren';
$_lang['snippet_lock_msg'] = 'Benutzer müssen das Attribut edit_locked attribute haben, um dieses Snippet bearbeiten zu können.';
$_lang['snippet_management_msg'] = 'Hier können Sie auswählen, welches Snippet Sie bearbeiten möchten.';
$_lang['snippet_msg'] = 'Hier können Sie Snippets hinzufügen/bearbeiten. Denken Sie daran: Snippets sind "roher" PHP-Code, und wenn der Output des Snippets an einem bestimmten Punkt innerhalb des Templates angezeigt werden soll, müssen Sie dafür sorgen, dass das Snippet einen Wert zurückgibt.';
$_lang['snippet_name'] = 'Snippet-Name';
$_lang['snippet_new'] = 'Neues Snippet';
$_lang['snippet_properties'] = 'Standardeigenschaften';
$_lang['snippet_title'] = 'Snippet erstellen/bearbeiten';
$_lang['snippet_untitled'] = 'Unbenanntes Snippet';
$_lang['snippets'] = 'Snippets';


text:
//
//  SingViewModel.h
//  HighCBar
//
//  Created by shadow on 14-6-28.
//  Copyright (c) 2014年 genio. All rights reserved.
//

#import "VViewModel.h"
#import "VDataCenter.h"
@class NSMutableOrderedDictionary;
@class SingViewModelUI;
@interface SingViewModel : VViewModel
@property (nonatomic, strong) SingViewModelUI *dataSourceUI;
@end
@interface SingViewModelUI : VViewModelUI
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *coverURL;
@property (nonatomic, strong) NSString *songURL;
@property (nonatomic, strong) NSString *accompanyURL;
@property (nonatomic, strong) NSString *songPath;
@property (nonatomic, strong) NSString *accompanyPath;
@property (nonatomic, strong) NSString *lyricURL;
@property (nonatomic, strong) NSString *lyricPath;
@property (nonatomic, strong) NSMutableOrderedDictionary *lyricDict;
@property (nonatomic, assign) double fromTime;
@property (nonatomic, assign) double toTime;
@property (nonatomic, assign) double duration;
@property (nonatomic, assign) unsigned long long size;

/**
 *  下载整首歌曲伴奏和原唱
 *
 *  @param success    成功回调
 *  @param failure    失败回调
 *  @param completion 完成回调
 */
- (void)playSong:(void (^) (NSString *accompanyPath, NSString *songPath))success failure:(void (^)(NSError *error))failure completion:(void (^) (void))completion;
- (void)playLrc:(void (^) (NSString *lyricPath, NSDictionary *lyricDict))success failure:(void (^)(NSError *error))failure completion:(void (^) (void))completion;
- (void)cancelPlay;

@end


text:
<?php
namespace Payum\Core\Request;

/**
 * Payout
 *
 * Pay a large sum of money from funds under one's control
 */
class Payout extends Generic
{
}


text:
<?php

namespace AppBundle\Form\Type\Medico;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class MedicoType extends AbstractType{

    /**
     * Builder del formulario
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add( 'nombre' ,   'text' , array(
                'attr' => array(
                    'class' => 'form-control',
                    'placeholder' => 'Nombre(s)',
                    'ng-model'=> 'medico.nombre' ),
                'label' => 'Nombre',
                'required' => true ) )
            ->add( 'apellidos' ,   'text' , array(
                'attr' => array(
                    'class' => 'form-control',
                    'placeholder' => 'Apellidos',
                    'ng-model'=> 'medico.apellidos' ),
                'label' => 'Apellidos',
                'required' => true ) )
            ->add('sexo', 'choice' , array(
                'attr' => array(
                    'class' => 'form-control',
                    'ng-model'=> 'medico.sexo' ),
                'label' => 'Sexo',
                'required' => true ,
                'choices'  => array('m' => 'Masculino', 'f' => 'Femenino')))
            ->add('fecha_nacimiento', 'date' , array(
                'attr' => array(
                    'class' => 'form-control',
                    'ng-model'=> 'medico.fecha_nacimiento' ),
                'label' => 'Fecha de nacimiento',
                'required' => true
            ))
            ->add('telefonoParticular', 'number' , array(
                    'attr' => array(
                        'class' => 'form-control',
                        'placeholder' => 'telefono Particular',
                        'ng-model'=> 'medico.telefonoParticular' ),
                    'label' => 'Télefono particular',
                    'required' => true )
            )
            ->add('telefonoEmergencia', 'number' , array(
                    'attr' => array(
                        'class' => 'form-control',
                        'placeholder' => 'telefono de emergencia',
                        'ng-model'=> 'paciente.telefonoEmergencia' ),
                    'label' => 'Télefono de emergencia',
                    'required' => true )
            )
            ->add('horario', new HorarioType())

        ;
    }

    /**
     * Función para agregar la opción data_class
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class'=> 'AppBundle\Document\Medico\Medico',

        ));
    }

    /**
     * Función para obtener el nombre del formulario
     * @return string
     */
    public function getName()
    {
        return 'form_medico';
    }

}


text:
layout: publication
title:  "Parametric Spaces Visualization"
title_short: "Parametric Spaces Visualization"
date:   2016-10-01 01:00:00
categories: research
tags:	2016
authors: 	"Romain Vuillemot, Stephane Derode"
website: https://github.com/sical/paramviz
description_short: "Parametric Spaces Visualization"

description: This project aims at combining visual exploration techniques with image analysis, for better understanding of input configurations values and dependencies. It is in collaboration with [Stephane Derrode](http://perso.ec-lyon.fr/derrode.stephane/) (image analysis Researcher) and is funded by [LIRIS Lab transverse](http://liris.cnrs.fr/projets-transversaux?set_language=fr) projects initiative to promote collaboration between teams from different Research areas.

---

**Parametric Spaces Visualization (ParamSpaceViz):** This project aims at combining visual exploration techniques with image analysis, for better understanding of input configurations values and dependencies. It is in collaboration with [Stephane Derrode](http://perso.ec-lyon.fr/derrode.stephane/) (image analysis Researcher) and is funded by [LIRIS Lab transverse](http://liris.cnrs.fr/projets-transversaux?set_language=fr) projects initiative to promote collaboration between teams from different research areas.


text:
package net.runelite.client.plugins.keyremapping;

import com.google.common.base.Strings;
import java.awt.event.KeyEvent;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.VarClientStr;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.input.KeyListener;

class KeyRemappingListener implements KeyListener
{
	@Inject
	private KeyRemappingPlugin plugin;

	@Inject
	private KeyRemappingConfig config;

	@Inject
	private Client client;

	@Inject
	private ClientThread clientThread;

	private final Map<Integer, Integer> modified = new HashMap<>();
	private final Set<Character> blockedChars = new HashSet<>();

	@Override
	public void keyTyped(KeyEvent e)
	{
		char keyChar = e.getKeyChar();
		if (keyChar != KeyEvent.CHAR_UNDEFINED && blockedChars.contains(keyChar) && plugin.chatboxFocused())
		{
			e.consume();
		}
	}

	@Override
	public void keyPressed(KeyEvent e)
	{
		if (!plugin.chatboxFocused())
		{
			return;
		}

		if (!plugin.isTyping())
		{
			int mappedKeyCode = KeyEvent.VK_UNDEFINED;

			if (config.cameraRemap())
			{
				if (config.up().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_UP;
				}
				else if (config.down().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_DOWN;
				}
				else if (config.left().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_LEFT;
				}
				else if (config.right().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_RIGHT;
				}
			}

			// In addition to the above checks, the F-key remapping shouldn't
			// activate when dialogs are open which listen for number keys
			// to select options
			if (config.fkeyRemap() && !plugin.isDialogOpen())
			{
				if (config.f1().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F1;
				}
				else if (config.f2().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F2;
				}
				else if (config.f3().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F3;
				}
				else if (config.f4().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F4;
				}
				else if (config.f5().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F5;
				}
				else if (config.f6().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F6;
				}
				else if (config.f7().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F7;
				}
				else if (config.f8().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F8;
				}
				else if (config.f9().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F9;
				}
				else if (config.f10().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F10;
				}
				else if (config.f11().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F11;
				}
				else if (config.f12().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_F12;
				}
				else if (config.esc().matches(e))
				{
					mappedKeyCode = KeyEvent.VK_ESCAPE;
				}
			}

			if (plugin.isDialogOpen() && config.space().matches(e))
			{
				mappedKeyCode = KeyEvent.VK_SPACE;
			}

			if (mappedKeyCode != KeyEvent.VK_UNDEFINED && mappedKeyCode != e.getKeyCode())
			{
				final char keyChar = e.getKeyChar();
				modified.put(e.getKeyCode(), mappedKeyCode);
				e.setKeyCode(mappedKeyCode);
				// arrow keys and fkeys do not have a character
				e.setKeyChar(KeyEvent.CHAR_UNDEFINED);
				if (keyChar != KeyEvent.CHAR_UNDEFINED)
				{
					// If this key event has a valid key char then a key typed event may be received next,
					// we must block it
					blockedChars.add(keyChar);
				}
			}

			switch (e.getKeyCode())
			{
				case KeyEvent.VK_ENTER:
				case KeyEvent.VK_SLASH:
				case KeyEvent.VK_COLON:
					// refocus chatbox
					plugin.setTyping(true);
					clientThread.invoke(plugin::unlockChat);
					break;
			}

		}
		else
		{
			switch (e.getKeyCode())
			{
				case KeyEvent.VK_ESCAPE:
					// When exiting typing mode, block the escape key
					// so that it doesn't trigger the in-game hotkeys
					e.consume();
					plugin.setTyping(false);
					clientThread.invoke(() ->
					{
						client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, "");
						plugin.lockChat();
					});
					break;
				case KeyEvent.VK_ENTER:
					plugin.setTyping(false);
					clientThread.invoke(plugin::lockChat);
					break;
				case KeyEvent.VK_BACK_SPACE:
					// Only lock chat on backspace when the typed text is now empty
					if (Strings.isNullOrEmpty(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT)))
					{
						plugin.setTyping(false);
						clientThread.invoke(plugin::lockChat);
					}
					break;
			}
		}
	}

	@Override
	public void keyReleased(KeyEvent e)
	{
		final int keyCode = e.getKeyCode();
		final char keyChar = e.getKeyChar();

		if (keyChar != KeyEvent.CHAR_UNDEFINED)
		{
			blockedChars.remove(keyChar);
		}

		final Integer mappedKeyCode = modified.remove(keyCode);
		if (mappedKeyCode != null)
		{
			e.setKeyCode(mappedKeyCode);
			e.setKeyChar(KeyEvent.CHAR_UNDEFINED);
		}
	}
}


text:
/*
 *
 */
package com.wci.umls.server.examples;

import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.wci.umls.server.helpers.ConfigUtility;
import com.wci.umls.server.model.content.Descriptor;
import com.wci.umls.server.services.helpers.ReportHelper;

/**
 * Example demonstrating loading descriptors by terminology id.
 */
public class GetDescriptorByTerminologyIdTest extends ExampleSupport {

  /** The auth token. */
  private static String authToken;

  /**
   * Create test fixtures per test.
   *
   * @throws Exception the exception
   */
  @Override
  @Before
  public void setup() throws Exception {

    // authentication
    authToken =
        securityClient.authenticate(testUser, testPassword).getAuthToken();

  }

  /**
   * Demonstrates how to find a MSH descriptor by D#.
   *
   * @throws Exception the exception
   */
  @Test
  public void getMshDescriptorByDescriptorIdTest() throws Exception {

    // Identify
    String terminologyId = "D002319";
    String terminology = "MSH";
    String version = "2015_2014_09_08";

    // contentClient is defined and initialized in the superclass
    Descriptor descriptor =
        contentClient.getDescriptor(terminologyId, terminology, version, null,
            authToken);

    // Output the descriptor as XML
    Logger.getLogger(getClass()).info(
        "xml = " + ConfigUtility.getStringForGraph(descriptor));

    // Output the descriptor as JSON
    Logger.getLogger(getClass()).info(
        "json = " + ConfigUtility.getJsonForGraph(descriptor));

    // Report of the descriptor
    Logger.getLogger(getClass()).info(
        ReportHelper.getDescriptorReport(descriptor));

  }

  /**
   * Teardown.
   *
   * @throws Exception the exception
   */
  @Override
  @After
  public void teardown() throws Exception {

    // logout
    securityClient.logout(authToken);
  }

  /**
   * Returns the parameter types.
   *
   * @param parameters the parameters
   * @return the parameter types
   */
  @SuppressWarnings("static-method")
  public Class<?>[] getParameterTypes(Object[] parameters) {
    Class<?>[] types = new Class<?>[parameters.length];
    for (int i = 0; i < parameters.length; i++) {
      types[i] = parameters[i].getClass();
    }
    return types;
  }

}


text:
Completable Futures
------

[![Analytics](https://ga-beacon.appspot.com/UA-59411913-3/shekhargulati/java8-the-missing-tutorial/09-completable-futures)](https://github.com/igrigorik/ga-beacon)


text:
<TITLE>Review for In & Out (1997)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

In & Out (1997)

reviewed by
James Sanford

IN & OUT
(Paramount Pictures)
Like a senior citizen with a nose-ring, "In & Out" wears its hipness
rather uncomfortably. A comedy that makes a half-hearted attempt to
address the currently trendy subject of "coming out," "In & Out" has
many funny moments, a typically charming performance by Kevin Kline and
a boatload of good intentions. Why then does it feel so curiously
hollow?

Part of the problem lies in the screenplay by Paul Rudnick, a bright,
sassy writer (he penned "Jeffrey" and ghostwrites the "If You Ask Me"
column by Libby Gelman-Waxner in Premiere). Rudnick's central idea is a
takeoff on Tom Hanks' famous acceptance speech at the Oscars in 1993,
when he thanked his high-school teacher for inspiration in creating the
character of the gay attorney in "Philadelphia."

In "In & Out," Matt Dillon (cleverly sending up Ethan Hawke and similar
high-minded young actors) is cast as Cameron Drake, who wins an Oscar
for his performance as a gay soldier in something called "To Serve and
Protect"; in the process, he beats out Steven Seagal, nominated for
"Snowball In Hell." Picking up the prize, Drake gives credit to his
high-school English teacher Howard Brackett (Kline),  which thrills
Brackett, his fiancee Emily (Joan Cusack) and Brackett's parents (Debbie
Reynolds and Wilford Brimley), all watching back home in Greenleaf,
Indiana. Not so thrilling however are the three little words that
follow: "And he's gay." That turns out to be news to everyone, even, it
appears, Howard, who's been planning to wed Emily that Sunday after a
three-year engagement.

It's no time at all before the tiny town is buzzing with local gossip
and reporters anxious for details. Among the newshounds is Peter Malloy
(Tom Selleck, looking like he's seen better days), who dogs Brackett,
determined to get a career-saving exclusive. The rest of the story
follows Brackett's desperate attempts to assert his masculinity and
heterosexuality, his mom's efforts to keep the wedding on track, and the
town's struggle to determine exactly what to think about this bombshell.

Amusing moments abound in the film, as Brackett has to fend off
questions like "do you know Ellen?", and has to defend the honor of
Barbra Streisand against a lout who claims "she was too old for
"Yentl"." But Rudnick seems to be reining himself in: Every time the
movie seems on the verge of taking off into something truly wild and
edgy, it quickly retreats, almost apologetically. The big moment in "In
& Out," a lingering kiss between Brackett and Malloy, is not exactly
going to rock anybody's world in 1997, and that image is as far out as
the film is willing to go. Rudnick's maudlin tendencies emerge in the
final reel, in the form of a lengthy "Dead Poets Society"-style scene
that falls resoundingly flat.

Director Frank Oz doesn't help matters. Though he did a terrific job
with the Steve Martin-Michael Caine vehicle "Dirty Rotten Scoundrels"
years ago, Oz never finds a rhythm here. Many scenes in "In & Out"
either end abruptly or wind down without much of a punch. Everyone seems
to be taking their best shot at keeping things lively, but there's a
stifling inertia that seems to hang over the whole film like heavy
humidity, and the comic sparks never fly. James Sanford

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
"san policy=OnlineAll" | Out-File $Env:Temp\sanpol.txt -Encoding ascii
diskpart /s $Env:Temp\sanpol.txt

# bring disks online
get-disk | Set-disk -IsOffline $false
get-disk | Where-Object { $_.PartitionStyle -eq "RAW" } | ForEach-Object {

    Initialize-Disk -Number $_.Number -PartitionStyle GPT
    new-partition -disknumber $_.Number -usemaximumsize | format-volume -filesystem NTFS -AllocationUnitSize 65536

}

# Assign drive letters based on size
$drives = "T", "L", "D"

$sortedDisks = get-partition | Where-Object { $_.Type -eq "Basic" -and $_.DriveLetter.tostring().trim() -eq ""} | Sort-Object -Property Size

for($i = 0; $i -lt $sortedDisks.Count; $i++) {

    $currentDisk = $sortedDisks[$i]
    $currentDisk | Set-Partition -NewDriveLetter $drives[$i]

}

#Disable Recycle bin
$volumes=Get-Volume | Where-Object {$_.FileSystem -eq "NTFS" -and $_.DriveLetter -ne "C"}
$Drives=foreach ($volume in $volumes) {
    $DriveLetter=$Volume.DriveLetter
    [string]$ObjectId=($Volume.ObjectId | Select-String -Pattern "Volume{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}}\\").Matches.Value.SubString(6,38)
    Remove-Item -Path $('{0}:\$Recycle.Bin' -f $DriveLetter) -Force -Recurse -ErrorAction SilentlyContinue
    New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\Volume\$ObjectId" -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\Volume\$ObjectId" -Name NukeOnDelete -Type DWord -Value 1
    Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\Volume\$ObjectId" -Name MaxCapacity -Type DWord -Value 0
}

#Remove Everyone permissions
icacls D:\ /remove:g "everyone"
icacls L:\ /remove:g "everyone"
icacls T:\ /remove:g "everyone"

#create path for tempdb
mkdir "T:\MSSQL15.MSSQLSERVER\MSSQL\Data"


text:
export const WIDTH = 450;
export const HEIGHT = 450;


text:
package net.lshift.diffa.kernel.config.system

import net.lshift.diffa.kernel.config._
import net.lshift.diffa.kernel.frontend.DomainEndpointDef
import net.lshift.diffa.kernel.frontend.DomainPairDef
import net.lshift.diffa.kernel.config.User
import net.lshift.diffa.kernel.config.Member
import net.lshift.diffa.kernel.util.MissingObjectException
import scala.beans.BeanProperty

/**
 * This provides configuration options for the entire system and hence should only be
 * accessible to internally trusted components or external users with elevated privileges
 */
trait SystemConfigStore {

  /**
   * This creates a new space with the given path, delimited by forward slashes.
   *
   * If the path foo/bar/baz is requested, it will be assumed that the parent path foo/bar already exists.
   *
   * Note also that each path segment will be validated to make sure that it doesn't contain any illegal characters.
   *
   * @see ValidationUtil#ensurePathSegmentFormat
   * @throws MissingObjectException If the parent space does not exist.
   * @throws ConfigValidationException If any path segment contains invalid characters
   */
  def createOrUpdateSpace(path: String) : Space

  /**
   * Returns the complete subspace closure for a given parent space, including the parent. This returns a flat
   * list of a subspace hierarchy that where the elements are ordered by descending tree depth.
   *
   * This allows callers to apply functions to an entire subspace tree recursively.
   */
  def listSubspaces(parent:Long) : Seq[Space]
  def listSuperspaceIds(child:Long): Seq[Long]

  @Deprecated def createOrUpdateDomain(domain: String)

  //def deleteDomain(name: String)
  def deleteSpace(id: Long)
  def doesDomainExist(name: String): Boolean

  def doesSpaceExist(space: Long): Boolean

  def lookupSpaceByPath(path: String) : Space

  def lookupSpacePathById(space: Long) : String

  @Deprecated  def listDomains : Seq[String]
  def listSpaces : Seq[Space]

  /**
   * Sets the given configuration option to the given value.
   * This option is marked as internal will not be returned by the allConfigOptions method. This allows
   * properties to be prevented from being shown in the user-visible system configuration views.
   */
  def setSystemConfigOption(key:String, value:String)
  def clearSystemConfigOption(key:String)
  def maybeSystemConfigOption(key:String) : Option[String]

  // TODO This requires a unit test
  def systemConfigOptionOrDefault(key:String, defaultVal:String) : String

  /**
   * Enumerate all pairs of all domains
   */
  def listPairs : Seq[DomainPairDef]

  /**
   * Enumerate all pairs of all domains
   */
  def listEndpoints : Seq[DomainEndpointDef]

  def createOrUpdateUser(user: User)

  def getUserToken(username: String): String
  def clearUserToken(username: String)
  def deleteUser(name: String): Unit
  def listUsers : Seq[User]
  def listDomainMemberships(username: String) : Seq[Member]
  def getUser(name: String) : User
  def getUserByToken(token: String) : User
  def containsRootUser(names:Seq[String]):Boolean

  def storePolicy(policy:PolicyKey, stmts:Seq[PolicyStatement])
  def lookupPolicyStatements(policy:PolicyKey): Seq[PolicyStatement]
  def removePolicy(policy:PolicyKey)
}

case class PolicyKey(space:java.lang.Long, name:String)
case class PolicyStatement(@BeanProperty var privilege:String = null, @BeanProperty var target:String = null) {
  def this() = this(privilege = null)

    // TODO: Breakdown the target string, and allow matching against components
  def appliesTo(objType:String, objName:String) = true
}


text:
<DOCTYPE HTML!>

<title>

Mitchell and Erin's messages thing!

</title>

Im still working on this site. It'll serve as my central hub for my videos games and other stuffs. So yeah, come back later :P Oh, Erin, I love you sweety <3

I love you too bub! I have your password mwhahaha! Gee, didn't anyone teach you not to give out your password? Haha I'm only joking, I feel privileged. Thank you for teaching me your ways... Hopefully I don't mess this up :')
Look, I almost stand out more than the skeletons :')

 Bub, shush, you are amazing!


text:
module Spree
  module UserMethods
    extend ActiveSupport::Concern

    include Spree::UserApiAuthentication
    include Spree::UserReporting
    include Spree::UserAddressBook
    include Spree::UserPaymentSource

    included do
      extend Spree::DisplayMoney

      has_many :role_users, foreign_key: "user_id", class_name: "Spree::RoleUser", dependent: :destroy
      has_many :spree_roles, through: :role_users, source: :role, class_name: "Spree::Role"

      has_many :user_stock_locations, foreign_key: "user_id", class_name: "Spree::UserStockLocation"
      has_many :stock_locations, through: :user_stock_locations

      has_many :spree_orders, foreign_key: "user_id", class_name: "Spree::Order"
      has_many :orders, foreign_key: "user_id", class_name: "Spree::Order"

      has_many :store_credits, -> { includes(:credit_type) }, foreign_key: "user_id", class_name: "Spree::StoreCredit"
      has_many :store_credit_events, through: :store_credits
      money_methods :total_available_store_credit

      after_create :auto_generate_spree_api_key

      include Spree::RansackableAttributes unless included_modules.include?(Spree::RansackableAttributes)

      self.whitelisted_ransackable_associations = %w[addresses]
      self.whitelisted_ransackable_attributes = %w[id email]
    end

    # has_spree_role? simply needs to return true or false whether a user has a role or not.
    def has_spree_role?(role_in_question)
      spree_roles.any? { |role| role.name == role_in_question.to_s }
    end

    def auto_generate_spree_api_key
      return if !respond_to?(:spree_api_key) || spree_api_key.present?

      if Spree::Config.generate_api_key_for_all_roles || (spree_roles.map(&:name) & Spree::Config.roles_for_auto_api_key).any?
        generate_spree_api_key!
      end
    end

    # @return [Spree::Order] the most-recently-created incomplete order
    # since the customer's last complete order.
    def last_incomplete_spree_order(store: nil, only_frontend_viewable: true)
      self_orders = orders
      self_orders = self_orders.where(frontend_viewable: true) if only_frontend_viewable
      self_orders = self_orders.where(store: store) if store
      self_orders = self_orders.where('updated_at > ?', Spree::Config.completable_order_updated_cutoff_days.days.ago) if Spree::Config.completable_order_updated_cutoff_days
      self_orders = self_orders.where('created_at > ?', Spree::Config.completable_order_created_cutoff_days.days.ago) if Spree::Config.completable_order_created_cutoff_days
      last_order = self_orders.order(:created_at).last
      last_order unless last_order.try!(:completed?)
    end

    def total_available_store_credit
      store_credits.reload.to_a.sum(&:amount_remaining)
    end
  end
end


text:
const yotiService = require('../../src/services/yotiService.js');
const mockYotiClient = require('../helpers/mockYotiClient.js');

yotiService.getClient = function() {
  return mockYotiClient;
};


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.camunda.bpm.model.bpmn.impl.instance;

import org.camunda.bpm.model.bpmn.instance.Expression;
import org.camunda.bpm.model.bpmn.instance.TimeDate;
import org.camunda.bpm.model.xml.ModelBuilder;
import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext;
import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder;

import static org.camunda.bpm.model.bpmn.impl.BpmnModelConstants.BPMN20_NS;
import static org.camunda.bpm.model.bpmn.impl.BpmnModelConstants.BPMN_ELEMENT_TIME_DATE;
import static org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider;

/**
 * The BPMN timeDate element of the BPMN tTimerEventDefinition type
 *
 * @author Sebastian Menski
 */
public class TimeDateImpl extends ExpressionImpl implements TimeDate {

  public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(TimeDate.class, BPMN_ELEMENT_TIME_DATE)
      .namespaceUri(BPMN20_NS)
      .extendsType(Expression.class)
      .instanceProvider(new ModelTypeInstanceProvider<TimeDate>() {
        public TimeDate newInstance(ModelTypeInstanceContext instanceContext) {
          return new TimeDateImpl(instanceContext);
        }
      });

    typeBuilder.build();
  }

  public TimeDateImpl(ModelTypeInstanceContext instanceContext) {
    super(instanceContext);
  }

}


text:
package com.intellij.openapi.fileTypes;

public class StdFileTypes {
    public static final LanguageFileType JAVA = null;
}


text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { FeedListItemComponent } from './feed-list-item.component';

describe('ListItemComponent', () => {
  let component: FeedListItemComponent;
  let fixture: ComponentFixture<FeedListItemComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ FeedListItemComponent ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(FeedListItemComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});


text:
package org.kie.perf.metrics;

import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;

import com.codahale.metrics.Histogram;
import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.MetricSet;
import com.codahale.metrics.UniformReservoir;

public class CPUUsageHistogramSet implements MetricSet {

    private Class<?> scenario;
    private Histogram cpuUsageHistogram = new Histogram(new UniformReservoir());
    private OperatingSystemMXBean operatingSystemMXBean;
    private Method getProcessCpuLoad;
    private Timer timer = new Timer();

    private static CPUUsageHistogramSet instance = null;

    private CPUUsageHistogramSet(Class<?> scenario) {
        this.scenario = scenario;

        operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
        try {
            getProcessCpuLoad = operatingSystemMXBean.getClass().getMethod("getProcessCpuLoad");
            getProcessCpuLoad.setAccessible(true);
        } catch (Exception e) {

        }
    }

    public static CPUUsageHistogramSet getInstance(Class<?> scenario) {
        if (instance == null) {
            instance = new CPUUsageHistogramSet(scenario);
        }
        return instance;
    }

    private void update() {
        Double value = null;
        try {
            value = (Double) getProcessCpuLoad.invoke(operatingSystemMXBean);
            value *= 100;
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (value != null) {
            long cpu = Math.round(value);
            cpuUsageHistogram.update(cpu);
        }
    }

    public void start() {
        timer.scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {
                update();
            }
        }, 100, 200);
    }

    public void stop() {
        timer.cancel();
    }

    @Override
    public Map<String, Metric> getMetrics() {
        final Map<String, Metric> metrics = new HashMap<String, Metric>();

        metrics.put(MetricRegistry.name(scenario, "cpu.usage"), cpuUsageHistogram);

        return metrics;
    }

}


text:
package hll

import (
	"crypto/rand"
	"encoding/binary"
	"testing"

	"github.com/bmizerany/assert"
)

func TestSparseIterator(t *testing.T) {
	s := newSparse(5)
	inputs := []uint64{3, 5, 6, 6, 10}
	for _, x := range inputs {
		s.Add(x)
	}
	iter := s.GetIterator()
	for _, elem := range inputs {
		iterOutput, ok := iter()
		assert.T(t, ok)
		assert.Equal(t, uint64(elem), iterOutput)
	}
	_, ok := iter()
	assert.T(t, !ok) // iterator should be exhausted
}

func TestRho(t *testing.T) {
	testCases := []struct {
		input        uint64
		expectResult uint8
	}{
		{1, 1},
		{0, 63},
		{4, 3},
	}

	for i, testCase := range testCases {
		actualResult := rho(testCase.input)
		if testCase.expectResult != actualResult {
			t.Errorf("Case %d actual result was %v", i, actualResult)
		}
	}
}

func Dedupe(input []uint64, p, pPrime uint) []uint64 {
	var output []uint64
	for idx, value := range input {
		if idx > 0 && getIndex(value, p, pPrime) == getIndex(input[idx-1], p, pPrime) {
			continue
		}
		output = append(output, value)
	}
	return output
}

func TestMerge(t *testing.T) {
	const p = 12
	const pPrime = 25

	convertToHashCodes := func(xs []uint64) {
		for i, x := range xs {
			xs[i] = encodeHash(x, p, pPrime)
		}
	}

	rands1 := randUint64s(t, 200)
	convertToHashCodes(rands1)
	sortHashcodesByIndex(rands1, p, pPrime)
	input1 := makeU64SliceIt(rands1)

	rands2 := randUint64s(t, 100)
	convertToHashCodes(rands2)
	sortHashcodesByIndex(rands2, p, pPrime)
	input2 := makeU64SliceIt(rands2)

	merged := merge(p, pPrime, 0, input1, input2)

	var lastIndex uint64
	mergedIter := merged.GetIterator()
	value, valid := mergedIter()
	for valid {
		index, _ := decodeHash(value, p, pPrime)
		assert.T(t, index > lastIndex, index, lastIndex)
		lastIndex = index
		value, valid = mergedIter()
	}
}

func randUint64s(t *testing.T, count int) []uint64 {
	output := make([]uint64, count)
	for i := 0; i < count; i++ {
		output[i] = randUint64(t)
	}
	return output
}

func randUint64(t *testing.T) uint64 {
	buf := make([]byte, 8)
	n, err := rand.Read(buf)
	assert.T(t, err == nil && n == 8, err, n)
	return binary.LittleEndian.Uint64(buf)
}


text:
import os
import pdb
import sys
import tempfile
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
import pdb

from services.mcord.models import VPGWCComponent, MCORDService

from xosresource import XOSResource

class XOSVPGWCComponent(XOSResource):
    provides = "tosca.nodes.VPGWCComponent"
    xos_model = VPGWCComponent
    copyin_props = ["s5s8_pgw_tag", "display_message"]
    name_field = None

    def get_xos_args(self, throw_exception=True):
        args = super(XOSVPGWCComponent, self).get_xos_args()

        provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
        if provider_name:
            args["provider_service"] = self.get_xos_object(MCORDService, throw_exception=throw_exception, name=provider_name)

        return args

    def get_existing_objs(self):
        args = self.get_xos_args(throw_exception=False)
        provider_service = args.get("provider", None)
        if provider_service:
            return [ self.get_xos_object(provider_service=provider_service) ]
        return []

    def postprocess(self, obj):
        pass

    def can_delete(self, obj):
        return super(XOSVPGWCComponent, self).can_delete(obj)


text:
title: openresty capture
date: 2020-05-11
private: true
---
# openresty capture
# location capture
几乎所有的 Nginx 模块都可以通过 ngx.location.capture 或 ngx.location.capture_multi 与 ngx_lua 模块完成调用

capture 自己的location 时,可传参数

    location = /redis {
        echo user_name $arg_user_name;
    }

    location = /capture {
        content_by_lua_block {
            local res = ngx.location.capture( "/redis",
                { args = { user_name = "ahui" } }
            )
            if res then
                ngx.say("status: ", res.status) -- 200 ?
                ngx.say("body:")
                ngx.print(res.body)
                ngx.print(res.header) -- table
            end
        }
    }

其它可传参:

    method
    body
    args GET args
    ctx
        specify a Lua table to be the ngx.ctx table for the subrequest.
    vars
        specified Nginx variables in the subrequest
    copy_all_vars
        specify whether to copy over all the Nginx variable values of the current request to the subrequest in question.
    share_all_vars
        specify whether to share all the Nginx variables of the subrequest with the current (parent) request.

## method

    res = ngx.location.capture(
        '/foo/bar',
        { method = ngx.HTTP_POST, body = 'hello, world' }
    )

## The args (GET)

    -- ngx.location.capture('/foo?a=1&b=3&c=%3a')
    ngx.location.capture('/foo?a=1',
        { args = { b = 3, c = ':' } }
    )

## vars(ngx.var)
ngx.var in subrequest will not affect the current (parent) request.

    location /other {
        content_by_lua_block {
            ngx.say("dog = ", ngx.var.dog)
            ngx.say("cat = ", ngx.var.cat)
        }
    }

    location /lua {
        set $dog '';
        set $cat '';
        content_by_lua_block {
            res = ngx.location.capture("/other",
                { vars = { dog = "hello", cat = 32 }});

            ngx.print(res.body)
        }
    }

## copy_all_vars
    location /other {
        set $dog "$dog world";
        echo "$uri dog: $dog";
    }

    location /lua {
        set $dog 'hello';
        content_by_lua_block {
            res = ngx.location.capture("/other",
                { copy_all_vars = true });

            ngx.print(res.body)
            ngx.say(ngx.var.uri, ": ", ngx.var.dog)
        }
    }

## share_all_vars
> modifications of the Nginx variables in the subrequest will affect the current (parent) request.

This option is set to false by default

    location /other {
        set $dog "$dog world";
        echo "$uri dog: $dog";
    }

    location /lua {
        set $dog 'hello';
        content_by_lua_block {
            res = ngx.location.capture("/other",
                { share_all_vars = true });
            ngx.print(res.body)
            ngx.say(ngx.var.uri, ": ", ngx.var.dog)
        }
    }

Accessing location /lua gives

    /other dog: hello world
    /lua: hello world

## ngx.ctx
共享同一个 ngx.ctx 表。

    location /sub {
        content_by_lua_block {
            ngx.ctx.foo = "bar";
        }
    }
    location /lua {
        content_by_lua_block {
            res = ngx.location.capture("/sub", { ctx = ngx.ctx })
            -- ctx = {}
            --res = ngx.location.capture("/sub", { ctx = ctx })
            ngx.say(ngx.ctx.foo);
        }
    }

## always_forward_body
    when set to true, the current (parent) request's request body will be forwarded to the subrequest


text:
package nl.fontys.sofa.limo.view.wizard.leg.multimode;

import java.util.HashMap;
import javax.swing.event.ChangeListener;
import nl.fontys.sofa.limo.domain.component.leg.MultiModeLeg;
import org.openide.WizardDescriptor;
import org.openide.WizardValidationException;
import org.openide.util.HelpCtx;

/**
 * Multimode leg Wizard.
 *
 * @author Pascal Lindner
 */
public class MultimodeLegTableWizard implements WizardDescriptor.ValidatingPanel<WizardDescriptor> {

    private MultimodeLegTablePanel component;
    private MultiModeLeg leg;

    @Override
    public MultimodeLegTablePanel getComponent() {
        if (component == null) {
            component = new MultimodeLegTablePanel();
        }
        return component;
    }

    @Override
    public HelpCtx getHelp() {
        return HelpCtx.DEFAULT_HELP;
    }

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

    @Override
    public void validate() throws WizardValidationException {
        if (getComponent().getLegModel().getMap() == null || getComponent().getLegModel().getMap().isEmpty()) {
            throw new WizardValidationException(null, "A multi-mode leg should contain at least one leg!", null);
        }
    }

    @Override
    public void addChangeListener(ChangeListener l) {
    }

    @Override
    public void removeChangeListener(ChangeListener l) {
    }

    @Override
    public void readSettings(WizardDescriptor wiz) {
        leg = (MultiModeLeg) wiz.getProperty("leg");
        if (leg.getLegs() != null) {
            getComponent().getLegModel().addLegs(new HashMap<>(leg.getLegs()));
        }
    }

    //Save the Map of Legs
    @Override
    public void storeSettings(WizardDescriptor wiz) {
        leg.setLegs(getComponent().getLegModel().getMap());
    }

}


text:
package de.tum.bio.proteomics.io.fasta;

import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import de.tum.bio.proteomics.FastaFile;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.ReadOnlyDoubleProperty;
import javafx.beans.property.ReadOnlyStringProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

/**
 * Deserializes FASTA files.
 *
 * @author Matthias Stahl
 */

public class FastaFileReader implements FastaReader {

	private DoubleProperty progressProperty = new SimpleDoubleProperty();
	private StringProperty statusProperty = new SimpleStringProperty();

	public static enum DatabaseType {
			UniProt(">.*?\\|((?:[a-z][a-z]*[0-9]+[a-z0-9]*))\\|.*?", ">");

			String regExHeader;
			String rowStarter;
			private DatabaseType(String regExHeader, String rowStarter) {
				this.regExHeader = regExHeader;
				this.rowStarter = rowStarter;
			}

			private String getRegExHeader() {
				return regExHeader;
			}

			private String getRowStarter() {
				return rowStarter;
			}
		};

	public FastaFile read(String filePath, DatabaseType databaseType) throws IOException {
		Path path = Paths.get(filePath);
		String fastaString = null;
		BufferedReader reader = null;
		try {
			setStatusProperty("Open fasta...");
			setProgressProperty(-1.0);
			StringBuilder tmp = new StringBuilder();
			String line = null;
			reader = Files.newBufferedReader(path);
			long numberOfLines = Files.lines(path).count();
			long lineCount = 1;
			setStatusProperty("Read fasta...");
			while ((line = reader.readLine()) != null) {
				setProgressProperty(((double) lineCount/numberOfLines));
				tmp.append(line + "\n");
				lineCount++;
			}
			fastaString = tmp.toString();
		} catch (IOException e) {
			throw e;
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (IOException e) {
					throw e;
			    }
			}
		}
		if (fastaString != null) {
			setStatusProperty("Read headers...");
			setProgressProperty(-1.0);
			Map<String, String> headersAndSequences = getHeadersAndSequences(fastaString, databaseType);
			setStatusProperty("Identify IDs...");
			Map<String, String> idsAndSequences = getIdsAndSequences(headersAndSequences, databaseType);
			setStatusProperty("Done.");
			setProgressProperty(0.0);
			return new FastaFile(idsAndSequences, headersAndSequences, databaseType, -1, path.getFileName().toString());
		} else {
			return null;
		}
	}

	private Map<String, String> getHeadersAndSequences(String fastaString, DatabaseType databaseType) {
		Map<String, String> result = new HashMap<String, String>();
		StringBuilder headerBuilder = new StringBuilder();
		StringBuilder sequenceBuilder = new StringBuilder();

		if (!fastaString.isEmpty()) {
			if (databaseType == null) {
				databaseType = DatabaseType.UniProt;
			}
			String[] fastaArray = fastaString.split("\n", -1);
			for (String entry : fastaArray) {
				// Go through each entry and collect information
				if (entry.startsWith(databaseType.getRowStarter())) {
					// Check if there are old entries and save them to map
					if (headerBuilder.length() > 0) {
						result.put(headerBuilder.toString(), sequenceBuilder.toString());
						headerBuilder.setLength(0);
						sequenceBuilder.setLength(0);
					}
					// It's a header
					headerBuilder.append(entry.trim());
				} else {
					// It's part of the sequence
					sequenceBuilder.append(entry.trim());
				}
			}
			// Save last entry
			result.put(headerBuilder.toString(), sequenceBuilder.toString());
		}
		return result;
	}

	private Map<String, String> getIdsAndSequences(Map<String, String> headersAndSequences, DatabaseType databaseType) {
		Map<String, String> result = new HashMap<String, String>();

		if (databaseType == null) {
			databaseType = DatabaseType.UniProt;
		}

		// Create a new ID search pattern dependent on database type
		Pattern p = Pattern.compile(databaseType.getRegExHeader(), Pattern.CASE_INSENSITIVE | Pattern.DOTALL);

		// Go through each fasta entry and parse header, then create new hashmap for ids and sequences
		for (Entry<String, String> entry : headersAndSequences.entrySet()) {
			Matcher m = p.matcher(entry.getKey());
		    if (m.find()) {
		        String id = m.group(1);
		        result.put(id, entry.getValue());
		    }
		}
		return result;
	}

	public ReadOnlyDoubleProperty getProgressProperty() {
		return progressProperty;
	}

	private void setProgressProperty(double value) {
		progressProperty.set(value);
	}

	public ReadOnlyStringProperty getStatusProperty() {
		return statusProperty;
	}

	private void setStatusProperty(String status) {
		statusProperty.set(status);
	}
}


text:
var _ = require('lodash');

function existy (x) { return x != null; }
function truthy (x) { return (x !== false) && existy(x); }

function cat () {
  var head = _.first(arguments);
  if (existy(head))
    return head.concat.apply(head, _.rest(arguments));
  return [];
}

function construct (head, tail) {
  return cat([head], _.toArray(tail));
}

function dispatch (/* funs */) {
  var funs = _.toArray(arguments);
  var size = funs.length;

  return function (target /*, args*/) {
    var ret = undefined;
    var args = _.rest(arguments);

    for (var i=0; i<size; i++) {
      var fun = funs[i];
      ret = fun.apply(fun, construct(target, args));

      if (existy(ret))
        return ret;
    }

    return ret;
  }
}

exports.existy = existy;
exports.truthy = truthy;
exports.cat = cat;
exports.construct = construct;
exports.dispatch = dispatch;


text:
body, p, div, h1, h2, h3, h4, h5, h6, table, tbody, tr, td, span, blockquote, a, abbr, address, cite, code, img, ul, ol, li, dl, dd, dt, form, label, fieldset, caption, input, textarea, button {
	border:0;
	outline:0;
	font-family:Arial, Helvetica, Sans-Serif;
	color:#fff;
	vertical-align:baseline;
	list-style:none;
	text-decoration:none;
	line-height:1.5em;
	margin:0;
	padding:0
}
p{
    text-align: justify ;
}
#horizontal-ad
{
display:block;
}
#vertical-ad
{
display:none;
}
#bsads
{
	margin-top:20px;
	padding-left:10px;
}
@font-face {
	font-family: 'OstrichSansCondensedLight';
	src: url('Fonts/ostrich-light-webfont.eot');
	src: url('Fonts/ostrich-light-webfont.eot?#iefix') format('embedded-opentype'),  url('Fonts/ostrich-light-webfont.woff') format('woff'),  url('Fonts/ostrich-light-webfont.ttf') format('truetype'),  url('Fonts/ostrich-light-webfont.svg#OstrichSansCondensedLight') format('svg');
	font-weight: normal;
	font-style: normal;
}
@font-face {
	font-family: 'OstrichSansMedium';
	src: url('Fonts/ostrich-regular-webfont.eot');
	src: url('Fonts/ostrich-regular-webfont.eot?#iefix') format('embedded-opentype'),  url('Fonts/ostrich-regular-webfont.woff') format('woff'),  url('Fonts/ostrich-regular-webfont.ttf') format('truetype'),  url('Fonts/ostrich-regular-webfont.svg#OstrichSansMedium') format('svg');
	font-weight: normal;
	font-style: normal;
}
@font-face {
	font-family: 'OstrichSansBold';
	src: url('Fonts/ostrich-bold-webfont.eot');
	src: url('Fonts/ostrich-bold-webfont.eot?#iefix') format('embedded-opentype'),  url('Fonts/ostrich-bold-webfont.woff') format('woff'),  url('Fonts/ostrich-bold-webfont.ttf') format('truetype'),  url('Fonts/ostrich-bold-webfont.svg#OstrichSansBold') format('svg');
	font-weight: normal;
	font-style: normal;
}
@font-face {
	font-family: 'OstrichSansBlack';
	src: url('Fonts/ostrich-black-webfont.eot');
	src: url('Fonts/ostrich-black-webfont.eot?#iefix') format('embedded-opentype'),  url('Fonts/ostrich-black-webfont.woff') format('woff'),  url('Fonts/ostrich-black-webfont.ttf') format('truetype'),  url('Fonts/ostrich-black-webfont.svg#OstrichSansBlack') format('svg');
	font-weight: normal;
	font-style: normal;
}
@font-face {
	font-family: 'OstrichSansRoundedMedium';
	src: url('Fonts/ostrich-rounded-webfont.eot');
	src: url('Fonts/ostrich-rounded-webfont.eot?#iefix') format('embedded-opentype'),  url('Fonts/ostrich-rounded-webfont.woff') format('woff'),  url('Fonts/ostrich-rounded-webfont.ttf') format('truetype'),  url('Fonts/ostrich-rounded-webfont.svg#OstrichSansRoundedMedium') format('svg');
	font-weight: normal;
	font-style: normal;
}
@font-face {
	font-family: 'OstrichSansDashedMedium';
	src: url('Fonts/ostrich-dashed-webfont.eot');
	src: url('Fonts/ostrich-dashed-webfont.eot?#iefix') format('embedded-opentype'),  url('Fonts/ostrich-dashed-webfont.woff') format('woff'),  url('Fonts/ostrich-dashed-webfont.ttf') format('truetype'),  url('Fonts/ostrich-dashed-webfont.svg#OstrichSansDashedMedium') format('svg');
	font-weight: normal;
	font-style: normal;
}
body {
	background:#195f88;
	font-size:14px
}
div#wrap {
	width:1100px;
	position:relative;
	margin:0 auto!important
}
div#sidebar {
	width:340px;
	height:100%;
	float:left;
	background:#2c2c2c;
	border-right:1px solid #2e2f2f;
	position:fixed
}
a#logo {
	text-align:center;
	display:block;
	border-bottom:1px solid #353535;
	width:100%;
	position:relative;
	z-index:999;
	opacity:1;
	-webkit-transition:all 300ms;
	-moz-transition:all 300ms;
	-o-transition:all 300ms;
	transition:all 300ms;
	padding: 15px 0 9px 0;
}
ul#navigation {
	margin-top:25px;
	margin-right:-5px;
	position:relative;
	width:360px;
	z-index:999
}
ul#navigation li {
	border:none;
	background:none;
	margin:0;
	padding:0
}
ul#navigation li a:link, ul#navigation li a:visited {
	text-decoration:none;
	font-family:'OstrichSansBlack', Arial, sans-serif;
	margin-bottom:1px;
	width:auto;
	font-size:15px;
	text-align:left;
	padding-left:10px !important;
	display:block;
	transition:all 200ms;
	-webkit-transition:all 200ms;
	-moz-transition:all 200ms;
	-o-transition:all 200ms;
	padding:5px 10px 5px 0
}
ul#navigation li a:hover, ul#navigation li a.active {
	background:#1b1b1b;
	color:#FFF;
}
div#container {
	width:730px;
	float:right;
	padding-right:25px;
	left:-5px;
	position:relative;
	padding-top:0;
	background:#619ec2;
}
div.page {
	margin-bottom:5px solid #dbdbdb;
	margin-bottom:0;
	padding-top:20px;
        min-height: 600px;
}
div.page_content {
	padding:25px 0 40px 25px
}
div#container h3.page_title {
	font-family: 'OstrichSansBlack';
	margin-left:25px;
	font-size:35px;
	color:#fff;
	border-bottom:1px solid #fff;
	text-shadow:1px 1px 2px #185477;
	line-height:2;
	padding:5px 0 0px 0px
}
div#works {
	margin-top:10px;
	overflow:visible!important;
	width:725px;
}
div#works img {
	width:28%;
	min-height:150px;
	position:relative;
	margin-right:26px;
	margin-bottom:18px;
	float:left;
	cursor:pointer;
	transition:all 500ms;
	-webkit-transition:all 500ms;
	-moz-transition:all 500ms;
	-o-transition:all 500ms;
	background:#fff;
}
div#works img:hover {
	top:-10px!important;
	opacity:.5!important
}
ul#works_filter {
	margin-top:40px !important;
	float:left;
	clear:both;
	margin:15px 0 5px
}
ul#works_filter li {
	border:none;
	background:none;
	float:left;
	padding:0
}
ul#works_filter li a:link, ul#works_filter li a:visited {
	font-size:12px;
	text-decoration:none;
	display:block;
	color:#FFF;
	margin-right:1px;
	padding:2px 10px
}
ul#works_filter li a:hover, ul#works_filter li a.selected {
	background:#0D4667;
	color:#fff;
	opacity:1;
	-webkit-border-radius: 0.2em;
	-moz-border-radius: 0.2em;
	border-radius: 0.2em;
	/* IE hacks */
    zoom: 1;
 *display: inline;
}
.social_icons {
	margin:0 auto;
	margin-top:20px;
	background:#0D4667;
	border-radius:2em;
	line-height:45px;
	height:45px;
	width:142px;
}
.social_icons li {
	display:inline;
	padding:0px !important;
	margin:0px;
}
.social_icons li img {
	border:0px !important;
}
#contact_form input {
	background:#195f88;
}
fieldset#contact_form {
	width:100%;
	float:left
}
fieldset#contact_form textarea {
	width:97.5%;
	background:#195f88;
	height:150px
}
img.no_border {
	border:none!important
}
ul.pagination li, ul.pagination li:hover {
	display:inline;
	background:none;
	border:none;
	margin-left:1px;
	padding:0
}
ul.pagination a:link, ul.pagination a:visited {
	display:inline-block;
	text-decoration:none;
	background:url(./images/bg/15.png);
	padding:5px 10px
}
div.footer {
	text-align:center;
	font-size:12px;
	margin-top:40px;
	padding:15px 0
}
.gotop {
	position:fixed;
	right:15px;
	bottom:15px;
	opacity:.3;
	padding:10px;
	color:#fff;
	display:block;
	text-decoration:none;
	text-align:center;
	font-size:13px;
	font-weight:bold;
	z-index:999;
	transition:all 300ms;
	-webkit-transition:all 300ms
}
.gotop:hover {
	color:#eee;
	opacity:.7
}
.gotop.hidden {
	display:none;
	opacity:0
}
a.gotop {
	text-decoration:none!important
}
h1, h2, h3, h4, h5, h6 {
	font-family:Arial, Helvetica, sans-serif;
	font-weight:bold;
	color:#1d1d1d
}
h4.blue {
	font-family: 'OstrichSansBlack';
	color: #0D4667;
	text-shadow: 1px 1px 0px #84BBDB;
	font-size: 28px;
	margin-top:20px;
}
.one_half {
	float:left;
	width:50%
}
.one_third {
	float:left;
	width:33.33%
}
.one_fourth {
	float:left;
	width:25%
}
.one_half > .column_content, .one_third > .column_content, .one_fourth > .column_content, .one_half > div, .one_third > div, .one_fourth > div {
	padding-right:15px
}
.last > .column_content, .last > div {
	padding-right:0
}
.one_half.last > .column_content, .one_half.last > div {
	padding-left:15px
}
.one_third.first > .column_content, .one_third.first > div {
	padding-right:20px;
	padding-left:0
}
.one_third > .column_content, .one_third > div {
	padding-left:10px;
	padding-right:10px
}
.one_third.last > .column_content, .one_third.last > div {
	padding-left:20px;
	padding-right:0
}
.column_content {
	margin-top:20px;
}
.column_content p {
	margin-left:68px;
}
.column_content h4 {
	font-family: 'OstrichSansBlack';
	color:#0d4667;
	text-shadow:1px 1px 0px #84bbdb;
	font-size:28px;
}
.first {
	clear:left
}
.last {
	clear:right
}
.left {
	float:left
}
.clear {
	clear:both
}
.space {
	display:block;
	float:left;
	clear:both;
	margin:10px 0
}
ul li {
	line-height:2;
	background:url(../images/icons/bullet.jpg) no-repeat left center;
	padding-left:15px;
}
a:link, a:visited {
	text-decoration:none;
}
input, textarea, button {
	color: #000000;
	clear:both;
	margin-bottom:1px;
	padding:10px
}
input {
	width:70%;
}
button {
	cursor:pointer;
	margin-right:-2px !important;
	font-style:normal
}
ol li {
	list-style:decimal inside;
	padding:5px 0
}
blockquote {
	border-left:5px solid #7cb3d3;
	font-style:italic;
	padding:10px;
	margin:20px;
}

a#logo:hover, a.facebook:hover, a.twitter:hover, a.linkedin:hover, a.dribbble:hover, div.image_gallery img:hover {
	opacity:.5
}
fieldset#contact_form button, .right {
	float:right
}
div.misc a, a:hover {
	text-decoration:none
}
div.blogpost a.readmore:hover, ul.pagination a:hover, ul.pagination a.active_page {
	background:url(./images/bg/50.png);
	color:#FFF
}
ol.comments li.comment a.reply:hover, div.tab ul.tab_menu li:hover, div.tab ul.tab_menu li.active {
	background:#8f8f8f;
	color:#FFF
}
.knob {
	color: White !important;
	text-shadow:1px 1px 0px #0d4667;
	font-size:25px !important;
}
.clearfix {
	float: none;
	clear: both;
}
.prev {
	position:absolute;
	margin-left:-5px;
	margin-top: 20px;
}
.next {
	position:absolute;
	margin-left: 680px;
	margin-top: 20px;
}
.button {
	color:#fff;
	-webkit-border-radius: 0.2em;
	-moz-border-radius: 0.2em;
	border-radius: 0.2em;
	/* IE hacks */
    zoom: 1;
 *display: inline;
	position: relative;
	overflow: visible;
	display: inline-block;
	padding: 0.5em 1em;
	font-size:12px;
	margin: 0;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	outline: none;
	background-color: #0D4667;
	-webkit-background-clip: padding;
	-moz-background-clip: padding;
	-o-background-clip: padding-box;
	/*background-clip: padding-box;*/ /* commented out due to Opera 11.10 bug */
    -webkit-border-radius: 0.2em;
	-moz-border-radius: 0.2em;
	border-radius: 0.2em;
	/* IE hacks */
    zoom: 1;
 *display: inline;
}
.button:hover, .button:focus, .button:active {
	border-color: #3072b3;
	text-decoration: none;
	color: #fff;
	background-color: #35779d;
}
.button:active, .button.active {
	color: #fff;
	background-color: #12415c;
}

/* overrides extra padding on button elements in Firefox */
.button::-moz-focus-inner {
 padding: 0;
 border: 0;
}
ul.sublist li {
	width: 140px;
	float: left;
}
ul.sublist li {
	background: url('../images/ico-arrow.gif') 0px 10px no-repeat;
	font-size:12px;
}
ul.sublist li a {
	color:#fff;
	text-decoration:none;
}
ul.sublist li a:hover {
	color:#002b44;
}
/* GRID */
.grid {
	border: 1px solid #4b88ad;
	border-bottom: none;
	border-right: none;
	overflow: hidden;
}
.grid li {
	border-bottom: 1px solid #4b88ad;
	border-right: 1px solid #4b88ad;
	float: left;
	overflow: hidden;
	position: relative;
	width: 25%;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
	-webkit-transition: all .3s ease-in-out;
	-moz-transition: all .3s ease-in-out;
	-o-transition: all .3s ease-in-out;
	-ms-transition: all .3s ease-in-out;
	padding-left:10px !important;
}
.ie7 .grid li {
	width: 19.9%;
	padding-left:10px !important;
}
.grid li a {
	display: block;
}
.grid img {
	display: block;
	height: auto;
	border:0px !important;
	width: 100%;
	opacity: .65;
	-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=65)";
	filter: alpha(opacity=65);
	-webkit-transition: all .3s ease-in-out;
	-moz-transition: all .3s ease-in-out;
	-o-transition: all .3s ease-in-out;
	-ms-transition: all .3s ease-in-out;
	transition: all .3s ease-in-out;
}
.grid li:hover img {
	opacity: 1;
	-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
	filter: alpha(opacity=100);
}
/* CLIENTS */

#clients li:hover .original_img,  .ie7 #clients li:hover a img, .ie8 #clients li:hover a img {
	opacity: 1;
	-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
	filter: alpha(opacity=100);
}
#clients li:hover .grayscale_img {
	opacity: 0;
	-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
	filter: alpha(opacity=0);
}
/* CLIENTS */

#clients .westfield:hover, #clients .westfield.active {
	background: #d9001f;
}
#clients .smuin:hover, #clients .smuin.active {
	background: #2a2333;
}
#clients .cytosport:hover, #clients .cytosport.active {
	background: #292c33;
}
#clients .toyota:hover, #clients .toyota.active {
	background: #f60031;
}
#clients .lands_end:hover, #clients .lands_end.active {
	background: #1e1d3c;
}
#clients .microsoft:hover, #clients .microsoft.active {
	background: #0079b0;
}
#clients .a_e:hover, #clients .a_e.active {
	background: #451e53;
}
#clients .skittles:hover, #clients .skittles.active {
	background: #d9001f;
}
#clients .juicy_fruit:hover, #clients .juicy_fruit.active {
	background: #fdbb00;
}
#clients .ge:hover, #clients .ge.active {
	background: #0977b4;
}
#clients .glad:hover, #clients .glad.active {
	background: #f6a200;
}
#clients .altoids:hover, #clients .altoids.active {
	background: #a7000a;
}
#clients .absolut:hover, #clients .absolut.active {
	background: #919191;
}
#clients .facebook:hover, #clients .facebook.active {
	background: #44559b;
}
#clients .jameson:hover, #clients .jameson.active {
	background: #003e25;
}
#clients .toyota:hover, #clients .toyota.active {
	background: #f60031;
}
#clients .orbit:hover, #clients .orbit.active {
	background: #95d2ef;
}
#clients .zynga:hover, #clients .zynga.active {
	background: #a9011b;
}
#clients .nike:hover, #clients .nike.active {
	background: #868686;
}
#clients .adidas:hover, #clients .adidas.active {
	background: #395cd4;
}
#clients .campaign:hover {
	background: transparent;
}
.flex-control-nav {
	display:none;
}

.imgsocial{
    width: 30px;
    height: 30px;
}


text:
/*
 Hack of winchPC.c which is--
 Hack of canonical.c & gateway.c
 See p. 277  _Linux Application Development_ Johnson, Troan, Addison-Wesley, 1998

10/28/2012
  Hack of dateselect.c to provide selection of launch times stored int POD.

09/12/2013
  Hack of 'launchselect.c'

11/27/2013
  Hack of 'canldr.c'

compile/link--
./mm

compile and execute--
./mm && sudo ./cangate /dev/ttyUSB0
  OR
./mm && sudo ./cangate /dev/ttyUSB0 ../test/testmsg1.txt

*/
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <time.h>

#include "common_can.h"

#include "PC_gateway_comm.h"	// Common to PC and STM32
#include "USB_PC_gateway.h"
#include "commands.h"
#include "cmd_s.h"
#include "sockclient.h"

/* Subroutine prototypes */
int CANsendmsg(struct CANRCVBUF* pin);

/* Buffer for PC msg */
#define PCMSGBUFSIZE	256
u8 PCmsg[PCMSGBUFSIZE];

/* Initial test msg */
char *ptestfox = "THE FOX JUMPED OVER A LAZY DOG'S BACK 0123456789\n";
#define TESTBINSIZE	11
unsigned char testbin[TESTBINSIZE] = {CAN_PC_ESCAPE,CAN_PC_ESCAPE,0x01,0x02,0x03,0x04,0xAA,0x55,CAN_PC_FRAMEBOUNDARY,CAN_PC_ESCAPE,CAN_PC_FRAMEBOUNDARY};
unsigned char *ptestbin = &testbin[0];

static struct PCTOGATEWAY pctogateway; // Receives de-stuffed incoming msgs from PC.
static struct CANRCVBUF canrcvbuf;
//static struct PCTOGATECOMPRESSED pctogatecompressed;

/* For input file */
#define LINESIZE	256
char listbuf[LINESIZE];

/* Keyboard key to break loop and exit */
#define CONTROLC 0x03	/* Control C input char */

#define NOSERIALCHARS	10000	/* usec to wait for chars to be received on serial port */

/* baudrate settings are defined in <asm/termbits.h>, which is
  included by <termios.h> */
//#define BAUDRATE B115200
#define BAUDRATE B230400
//#define BAUDRATE B460800
//#define BAUDRATE B921600
/* Serial port definition */

#define SERIALPORT "/dev/ttyUSB0"	/*  */
// #define _POSIX_SOURCE 1 /* POSIX compliant source */
char * serialport_default = SERIALPORT;
char * serialport;

#define SIZESERIALIN		8192	/* Size of buffer for serial input */
#define SIZESERIALOUTBUFF 	4096	/* Size of buffer for serial chars that go out */

#define LINEINSIZE		4096	/* Size of input line from stdin (keyboard) */

struct LINEIN
{
	char b[LINEINSIZE];
	int	idx;
	int	size;
}lineinK,lineinS;

#define BUFSIZE	4096
char buf[BUFSIZE];

/* For start stop */
struct SS
{
	time_t t;	// Linux time
	struct tm tm;	// Year, month, etc.
	char c[14];	// ascii yymmddhhmmss (e.g. 111229235900'\0' for Dec 12, 2011 23:59:00)
}s_start,s_stop;
char * pc;

/* Start|stop linux times */
//time_t t_start_pod;
//time_t t_stop_pod;
//unsigned long long ll_start,ll_stop;

struct timeval tv;	/* time value for select() */

//fd_set fdsetRd,fdsetRdx;	/* fd_set struc */
//fd_set fdsetWr,fdsetWrx;
//int iSelRet;	/* select() return value */

/* The following needs to have file scope so that we can use them in signal handlers */
struct termios pts;	/* termios settings on port */
struct termios sts;	/* termios settings on stdout/in */
struct termios pots;	/* saved termios settings */
struct termios sots;	/* saved termios settings */
struct sigaction sact;	/* used to initialize the signal handler */
fd_set	ready;		/* used for select */

//int fds;	/* file descriptor, serial */
int fdp;	/* port file descriptor */

int done;	/* Prorgram termination flag */
int filedone;	/* File closed flag */
int opensw;	/* 0 = file has not been opened; 1 = file is open */
int nofilesw;	/* 0 = file name specified; 1 = no file name on command line */
int goodfilesw;	/* 0 = no file was opened and written; 1 = yes we did it */

int	linect;

char vv[512];	/* General purpose char buffer */

FILE *fpOut;
FILE *fpList;
int fpListsw = 0; // 0 = no test msg file list

/* Sequence number checking */
u8 sequence_prev;

/* Debug */
u32 err_seq;
u32 err_ascii;

/* =========================== Assemble an input line =================================== */
int linecompleted(struct LINEIN *p, char c)
{ /* Assemble a full line */
	p->b[p->idx++] = c;	/* Store the char received */
	if (p->idx >= (LINEINSIZE-1)) p->idx--; /* Don't run off end of buffer */
	if ( c == '\n')	/* NL completes the line */
	{
		p->b[p->idx] = '\0';	/* Place null at end of line */
		p->size = p->idx;	/* Save length of string */
		p->idx = 0;		/* reset the index */
		return 1;		/* show we have a full line */
	}
	return 0;

}
/* ====================================================================================== */

/* Restore original terminal settings on exit */
void cleanup_termios(int signal)
{
	tcsetattr(fdp, TCSANOW, &pots);
	tcsetattr(STDIN_FILENO, TCSANOW, &sots);
	printf("\nwinchPC exit due to Control C\n");
	exit(0);
}
/* ************************************************************************************************************ */
/*  Yes, this is where it starts.                                                                               */
/* ************************************************************************************************************ */
int main(int argc, char *argv[])
{
/* Misc */
	int	i,j;		/* The for loop variable of choice */
	int	select_timeout;
	int	xret;	// Subroutine return value
	int	port;	// Socket port number

	fpListsw = 0; // 0 = no test msg file list opened

	printf ("CANGATGE has started\n");

printf ("argc %u\n",argc);

	if (argc > 4)
	{
			printf ("Command line error: too many arguments %i args, for example--\n./cangate /dev/ttyUSB0\nOR,\n./cangate /dev/ttyUSB0 ../test/testmsg1.txt\n",argc); return -1;
	}

	if (argc < 2)
	{
		printf("Command line error: no arguments, for example--\n./cangate /dev/ttyUSB0\nOR,\n./cangate /dev/ttyUSB0 ../test/testmsg1.txt\n"); return -1;
	}

	/* Determine if it is a socket connection or uart */
	if (strncmp(argv[1], "/dev/tty", 8) == 0) // uart?
	{ // Here, yes.
		serialport = argv[1];
		if (argc == 3)
		{ // Here there were two arguments on the command line and 2nd is presumed to be the file with the test msgs.
			if ( (fpList = fopen (argv[2],"r")) == NULL)
			{
				printf("Test msg file given on command line did not open: %s\n",argv[2]); return -1;
			}
			else
			{
				printf("Test msg file opened: %s\n",argv[2]);
				fpListsw = 1; // test msg file list
			}
		}
	/* =============== Serial port setup ===================================================================== */
//         fd = open(serialport, O_RDWR | O_NOCTTY | O_NONBLOCK );
         fdp = open(serialport, O_RDWR);

	 if (fdp < 0) {perror(serialport); printf ("Error: So sorry, the serial port did not open\n"); return -1; }

        tcgetattr(fdp,&pots); 		/* Get the current port configuration for saving */

	/* Modify the serial port settings */
	pts.c_lflag &= ~ICANON;	/* Turn off canonicalization, i.e. set raw mode (no chars are special) */
	pts.c_lflag &=~(ECHO | ECHOCTL | ECHONL); /* No local echo */
	pts.c_cc[VMIN] = 1; /* See page 307 */
	pts.c_cc[VTIME] = 0;
	/* Without the following two lines the remote system would see Return twice for each press */
	pts.c_oflag &= ~ONLCR;
	pts.c_iflag &= ~ICRNL;

	pts.c_cflag &= ~(CSIZE | PARENB);
	pts.c_cflag |= CS8;	// 8 bits
	pts.c_cflag |= CREAD;	// Enable reading
	pts.c_cflag |= CLOCAL;	// Disable waiting for modem lines

	/* No flow control */
	pts.c_cflag &= ~CRTSCTS;
	pts.c_iflag &= ~(IXON | IXOFF | IXANY);
	/* Speed */
	cfsetospeed(&pts, BAUDRATE);
	cfsetispeed(&pts, BAUDRATE);

	/* Modify the local terminal settings */
	tcgetattr(STDIN_FILENO,&sts);	/* Current settings */
	sots = sts;			/* Save current settings */
	sts.c_iflag &= ~BRKINT;		/* Turn off break.  Only useful when serial port can send break */
	sts.c_iflag |= IGNBRK;		/* Ignore breaks */
	sts.c_lflag &= ~ISIG;		/* This keeps driver from sending SIGINTR, SIGQUIT, SIGTSTP when
					INTR, QUIT, or SUSP is received. */
	sts.c_cc[VMIN] = 1;
	sts.c_cc[VTIME] = 0;
	sts.c_lflag &= ~ICANON;
	sts.c_lflag &= ~(ECHO | ECHOCTL | ECHONL); /* No local echo */

	/* Set the signal handler to restore the old termios handler */
	/* Setup the signal handlers */
	sact.sa_handler = cleanup_termios;
	sigaction(SIGHUP, &sact, NULL);
	sigaction(SIGINT, &sact, NULL); /* User sent Control C */
	sigaction(SIGPIPE, &sact, NULL);
	sigaction(SIGTERM, &sact, NULL);

	/* With signal handlers setup we can now set the modifed termios settings */
	tcsetattr(fdp, TCSANOW, &pts);	/* TCSANOW = take effect immediately */
	tcsetattr(STDIN_FILENO, TCSANOW, &sts);
	/* =============== End Serial port setup ================================================================ */
	}
	else
	{ // Here, not a uart.  See if it looks like an ip address

		char* parg = argv[1];
		j = 0;
		for (i = 0; i < strlen(argv[1]); i++)
		{
			if (*parg++ == '.') j += 1;
		}
		if ( j != 3) {printf("1st arg doesn't look like /dev/tty, or ip address xxx.xxx.xxx.xxx -- %s %i\n", argv[1],j); return -1;}

		/* Here, the arguments should be: <ip> <port> <optional test file> */
		if (argc < 3){printf ("1st arg looks like an IP, but not enough arguments\n"); return -1;}

		/* Here, next argument should be the port number */
		sscanf(argv[2],"%i",&port);

		fdp = sockclient_connect(argv[1], port);
		if (fdp < 0){ printf("socket did not open: ip %s, port: %i\n",argv[1],port); return -1;}

		printf ("Socket opened OK.  IP: %s PORT: %i\n",argv[1], port);

		if (argc == 4)
		{ // Here there were three arguments on the command line. the 3rd is presumed to be the file with the test msgs.
			if ( (fpList = fopen (argv[3],"r")) == NULL)
			{
				printf("Test msg file given on command line did not open: %s\n",argv[3]); return -1;
			}
			else
			{
				printf("Test msg file opened: %s\n",argv[3]);
				fpListsw = 1; // test msg file list
			}
		}
	}

	/* Message for the hapless op (maybe he or she would rather have Morse code?) */
	printf ("Control C to break & exit\n");

	lineinK.idx = 0;lineinS.idx=0;	/* jic */

	/* Timer for detecting response failure from gateway/CAN BUS */
	select_timeout = 1000;	// 1000 usec (1 ms) timeout
	struct timeval TMDETECT = {0,select_timeout}; //  timeout
	struct timeval tmdetect;

	PC_msg_initg(&pctogateway);		// Initialize struct for a msg from gateway to PC
	pctogateway.mode_link = MODE_LINK;	// Set modes for routines that receive and send CAN msgs
	do_printmenu();				// Print an initial keyboard command menu
/* ************************************************************************************************** */
	/* The following is endless until broken by ctl C */
/* ************************************************************************************************** */
	do
	{
		FD_ZERO(&ready);		/* Clear file descriptors */
		FD_SET(STDIN_FILENO, &ready); 	/* Add stdin to set */
		FD_SET(fdp, &ready);		/* Add serial port to set */
		tmdetect = TMDETECT;		/* Refresh timeout timer */

		select (fdp+1, &ready, NULL, NULL, &tmdetect);	/* Wait for something to happen */

		/* Send again if we timed out waiting for an expected response */
		if ( !( (FD_ISSET(fdp, &ready)) || (FD_ISSET(STDIN_FILENO, &ready)) ) )
		{ // When no file descriptors are responsible, then it must have been the timeout expiring
		/* Sending test msgs to CAN if we opened a file with the list. */

		}

		/* Incoming bytes from CAN gateway, arriving via serial port (file descriptor: 'fdp'). */
		if (FD_ISSET(fdp, &ready))	/* Was the serial port in the select's return? */
		{ /* fdp has characters for us */
			xret = USB_PC_get_msg_mode(fdp, &pctogateway, &canrcvbuf); // Build msg from incoming bytes
			if ( xret != 0 ) // Did the above result in frame, or line, from the gateway?
			{ // Here yes.  We have a msg, but it might not be valid.
				if (xret == 1)
				{ // Here the msg had not errors.
					do_canbus_msg(&canrcvbuf);	// Do something appropriate to the command in effect (commands.c)

					/* Poll for outputting test msgs, timed/throttled by counting incoming CAN msgs. */
					if (fpListsw > 0)
						cmd_s_do_msg(fpList, fdp);
				}
				else
				{ // Something wrong with the msg
					if (xret < -4) // Did msg complete, but compression returned an error?
					{ // Here, yes.
						printf("CANuncompress error (with and without -4 offset): %i %i\n", xret, xret + 4);
					}
					else
					{ // Here, msg did not complete correctly: xret = (-4 <= (return code) < 0)
						printf("\nPC_msg_get_msg_mode error: %i\n",xret);
						err_ascii += 1;
					}
					/* Check for sequence error (even though msg might have had errors). */
					sequence_prev += 1;
					if (pctogateway.seq != sequence_prev)
					{
						printf("Seq err-- new %u old %u\n",pctogateway.seq,sequence_prev);
						sequence_prev = pctogateway.seq;
						err_seq += 1;
					}
				}
				PC_msg_initg(&pctogateway);	// Initialize struct for a msg from gateway to PC
			}
		}

		/* Incoming data arriving from keyboard (STDIN). */
		if (FD_ISSET(STDIN_FILENO, &ready))		// Was the keyboard in the select's return ?
		{ /* standard input has characters for us */
			i = read (STDIN_FILENO, buf, BUFSIZE);	// Read one or more chars from keyboard
			if (i >= 1)				// If no chars then assume it is a EOF
			{
				for (j = 0; j < i; j++)	// Look at all the chars available
				{
					write(STDOUT_FILENO,&buf[j],1); // Echo input back to the Hapless Op

					if (buf[j] == CONTROLC) done = 1;		// Ctl C causes loop to break
					if (linecompleted(&lineinK,buf[j]) == 1)	// Did we get a new line?
					{ // Receiving a '\n' line completes a line.
						do_command_keybrd(&lineinK.b[0], fdp);
					}
				}
			}
			else
			{
				done = 1;
			}
		}

	} while (done == 0); // End "do" when someone sets the 'done' switch to non-zero

	/* Restore original terminal settings and exit */
	tcsetattr(fdp, TCSANOW, &pots);
	tcsetattr(STDIN_FILENO, TCSANOW, &sots);
	printf ("\ncangate Done\n");

	if (goodfilesw == 0)
	{ // Here a file was not opened (and written)

		exit(-1);	// Let a script calling this know to exit
	}
	else
	{ // What looks like a valid file was opened and then closed
		exit(0);	// Let a script calling this know to proceed
	}
}
/* **************************************************************************************
 * int CANsendmsg(struct CANRCVBUF* pin);
 * @brief	: Send CAN msg to gateway.
 * @param	: pin = pointer to struct that is ready to go
 * @return	: 0 = OK;
 * ************************************************************************************** */

//extern int fdp;		/* port file descriptor (cangate.c) */
int CANsendmsg(struct CANRCVBUF* pin)
{
	int size;
	struct PCTOGATECOMPRESSED pctogate;
	u8 c[128];	// Framed and byte stuffed chars that go to the serial port

	/* Compress the msg if possible */
	if (CANcompress(&pctogate, pin) == 0)
	{ // Here, compressed.
		size = PC_msg_prep(&c[0], 128, &pctogate.cm[0], (int)pctogate.ct);
	}
	else
	{ // Here, extended address format
		size = PC_msg_prep(&c[0], 128, (u8*)pin, (int)sizeof(struct CANRCVBUF));
	}
	write(fdp,&c[0],size);	// Send it out the serial port.
int i; printf("CT:%d %d ",(int)pctogate.ct,size); for (i=0;i<size;i++) printf("%02x ",c[i]); printf("\n");

	return 0;
}


text:
using System.Collections.Generic;
using Orchard.Localization;
using Orchard.MediaProcessing.Descriptors;
using Orchard.MediaProcessing.Descriptors.Filter;

namespace Orchard.MediaProcessing.Services {
    public class ImageProcessingManager : IImageProcessingManager {
        private readonly IEnumerable<IImageFilterProvider> _filterProviders;

        public ImageProcessingManager(
            IEnumerable<IImageFilterProvider> filterProviders) {
            _filterProviders = filterProviders;
            T = NullLocalizer.Instance;
        }

        public Localizer T { get; set; }

        public IEnumerable<TypeDescriptor<FilterDescriptor>> DescribeFilters() {
            var context = new DescribeFilterContext();

            foreach (var provider in _filterProviders) {
                provider.Describe(context);
            }
            return context.Describe();
        }
    }
}


text:
import * as React from 'react';

import CreatableSelect from 'react-select/creatable';
import { ColourOption, groupedOptions, FlavourOption } from '../data';

export default class CreatableGroup extends React.Component {
    handleIsValidNewOption = (inputValue: any, value: any, groups: any) => {
        for (const group of groups) {
            console.group(`Group: ${group.label}`);
            for (const option of group.options) {
                console.log(`Option: ${option.label}`);
            }
            console.groupEnd();
        }

        return true;
    }
    render() {
        return (
            <CreatableSelect<ColourOption | FlavourOption>
                isValidNewOption={this.handleIsValidNewOption}
                options={groupedOptions}
            />
        );
    }
}