text:
package io.datalayer.cassandra.helper;

import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CassandraHelper
{

    private final static Logger LOGGER = LoggerFactory.getLogger(CassandraHelper.class);

    private static boolean isStarted = false;
    private static EmbeddedCassandraService cassandra;
    private static Thread zkThread;

    public synchronized static void start(String... keyspaces) throws Exception
    {

        if (!isStarted)
        {

            File tmpCassandraFile = new File("tmp");
            if (tmpCassandraFile.exists())
            {
                // FileUtils.deleteDirectory(tmpCassandraFile);
            }

            // FileUtils.deleteDirectory(new File("./target/cassandra"));

            startCassandra();

            for (String keyspace : keyspaces)
            {
                createMutableKeyspace(keyspace);
            }

            isStarted = true;

        }

    }

    public synchronized static void stop()
            throws IOException,
            InterruptedException
    {

        if (cassandra != null)
        {
            cassandra.stop();
            TimeUnit.SECONDS.sleep(1);
        }

        if (zkThread != null)
        {
            zkThread.interrupt();
        }

    }

    private static void startCassandra() throws Exception
    {

        File storageCassandraFile = new File("target/cassandra-storage");
        if (storageCassandraFile.exists())
        {
            // FileUtils.deleteDirectory(storageCassandraFile);
        }

        cassandra = new EmbeddedCassandraService();
        cassandra.start();
    }

    private static void createMutableKeyspace(String keyspaceString)
    {

    }

}


text:
@class NSString;

@interface POPMutableAnimatableProperty : POPAnimatableProperty
{
    NSString *name;
    CDUnknownBlockType readBlock;
    CDUnknownBlockType writeBlock;
    double threshold;
}

@property(nonatomic) double threshold; // @synthesize threshold;
@property(copy, nonatomic) CDUnknownBlockType writeBlock; // @synthesize writeBlock;
@property(copy, nonatomic) CDUnknownBlockType readBlock; // @synthesize readBlock;
@property(copy, nonatomic) NSString *name; // @synthesize name;
- (void).cxx_destruct;

@end

redpajama_set_name: RedPajamaGithub


text:
var Backbone = require('backbone');
var ToolbarButton = require('./ToolbarButton');

module.exports = Backbone.Collection.extend({model: ToolbarButton});


text:
<?php
	// Build a list of the months.
	$aMonths = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

	// Header.
	$strPageTitle = ' :: New User Registration';
	require("./skins/{$CFG['skin']}/header.tpl.php");
?>

	<img src="images/ovbb.png" align="middle" border="0" alt="<?php echo(htmlsanitize($CFG['general']['name'])); ?> :: Powered by OvBB" />
	<?php echo(htmlsanitize($CFG['general']['name'])); ?> > Register

<?php
	// If there are any errors, display them to the user.
	if(is_array($aError))
	{
		DisplayErrors($aError);
	}
	else
	{
		echo('
');
	}
?>

<form name="theform" action="register.php" method="post">
<table cellpadding="4" cellspacing="1" border="0" bgcolor="<?php echo($CFG['style']['table']['bgcolor']); ?>" width="100%" align="center">

	Required Information

Passwords are case-sensitive. Only your username will be public by default.

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">Desired Username
	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>"><input type="text" name="username" size="25" maxlength="<?php echo($CFG['maxlen']['username']); ?>" value="<?php echo(htmlsanitize($aReg['username'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">Password
	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>"><input type="password" name="passworda" size="25" maxlength="<?php echo($CFG['maxlen']['password']); ?>" value="<?php echo(htmlsanitize($aReg['passworda'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">Password Again
	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>"><input type="password" name="passwordb" size="25" maxlength="<?php echo($CFG['maxlen']['password']); ?>" value="<?php echo(htmlsanitize($aReg['passwordb'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">E-Mail Address
	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>"><input type="text" name="emaila" size="25" maxlength="<?php echo($CFG['maxlen']['email']); ?>" value="<?php echo(htmlsanitize($aReg['emaila'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">
		E-Mail Address Again

Enter your e-mail address again for confirmation.

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>"><input type="text" name="emailb" size="25" maxlength="<?php echo($CFG['maxlen']['email']); ?>" value="<?php echo(htmlsanitize($aReg['emailb'])); ?>" />

<?php
	// Display the CAPTCHA if Image Verification is enabled.
	if($CFG['reg']['verify_img'])
	{
?>

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">
		Verification Image

Enter the text to verify that this registration is not being performed by an automated process.

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>">
		<img src="regimage.php<?php if(SID){echo('?'.stripslashes(SID));} ?>" alt="Verification Image" />

		<input type="text" name="verifyimg" size="10" maxlength="7" style="width: 210px; text-align: center" />

<?php
	}
?>

	Optional Information

Everything here will be public.

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">Web Site
	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>"><input type="text" name="website" size="25" maxlength="<?php echo($CFG['maxlen']['website']); ?>" value="<?php echo(isset($_REQUEST['submit']) ? htmlsanitize($aReg['website']) : 'http://'); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">AIM Handle
	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>"><input type="text" name="aim" size="25" maxlength="<?php echo($CFG['maxlen']['aim']); ?>" value="<?php echo(htmlsanitize($aReg['aim'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">ICQ Number
	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>"><input type="text" name="icq" size="25" maxlength="<?php echo($CFG['maxlen']['icq']); ?>" value="<?php echo(htmlsanitize($aReg['icq'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">MSN Messenger Handle
	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>"><input type="text" name="msn" size="25" maxlength="<?php echo($CFG['maxlen']['msn']); ?>" value="<?php echo(htmlsanitize($aReg['msn'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">Yahoo! Messenger Handle
	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>"><input type="text" name="yahoo" size="25" maxlength="<?php echo($CFG['maxlen']['yahoo']); ?>" value="<?php echo(htmlsanitize($aReg['yahoo'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">
		Referrer

Enter the username of the <?php echo(htmlsanitize($CFG['general']['name'])); ?> member who referrered you here (if any).

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>"><input type="text" name="referrer" size="25" maxlength="<?php echo($CFG['maxlen']['username']); ?>" value="<?php echo(htmlsanitize($aReg['referrer'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">Birthday
	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>">

			 Month
			 Day
			 Year

				<select name="birthmonth">
					<option value="0"<?php if($aReg['birthmonth']==0){echo(' selected="selected"');} ?>></option>
<?php
	// Print out an option for each month of the year.
	foreach($aMonths as $iMonthID => $strMonth)
	{
		$strSelected = ($iMonthID == $aReg['birthmonth']) ? ' selected="selected"' : '';
		echo("\t\t\t\t\t<option value=\"{$iMonthID}\"{$strSelected}>{$strMonth}</option>\n");
	}
?>
				</select>

				<select name="birthdate">
					<option value="0"<?php if($aReg['birthdate']==0){echo(' selected="selected"');} ?>></option>
<?php
	// Print out an option for each day in the month.
	for($iDayID = 1; $iDayID < 32; $iDayID++)
	{
		$strSelected = ($iDayID == $aReg['birthdate']) ? ' selected="selected"' : '';
		echo("\t\t\t\t\t<option value=\"{$iDayID}\"{$strSelected}>{$iDayID}</option>\n");
	}
?>
				</select>

			<input type="text" name="birthyear" size="4" maxlength="4" value="<?php if($aReg['birthyear']){echo($aReg['birthyear']);} ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">
		Biography

A few details about yourself

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>"><input type="text" name="bio" size="25" maxlength="<?php echo($CFG['maxlen']['bio']); ?>" value="<?php echo(htmlsanitize($aReg['bio'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">
		Location

Where are you currently residing?

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>"><input type="text" name="residence" size="25" maxlength="<?php echo($CFG['maxlen']['location']); ?>" value="<?php echo(htmlsanitize($aReg['residence'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">Interests
	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>"><input type="text" name="interests" size="25" maxlength="<?php echo($CFG['maxlen']['interests']); ?>" value="<?php echo(htmlsanitize($aReg['interests'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">Occupation
	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>"><input type="text" name="occupation" size="25" maxlength="<?php echo($CFG['maxlen']['occupation']); ?>" value="<?php echo(htmlsanitize($aReg['occupation'])); ?>" />

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">
		Signature

This will appear at the bottom of each of your posts.

BB Code is on.
[img] tags are on.
Smilies are on.

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>">
		<textarea class="medium" name="signature" rows="5" cols="35"><?php echo(htmlsanitize($aReg['signature'])); ?></textarea>

[<a href="#" onclick="javascript:alert('The maximum permitted length is <?php echo($CFG['maxlen']['signature']); ?> characters.\n\nYour signature is '+document.theform.signature.value.length+' characters long.');">Check signature length.]

Account Preferences

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">Allow administrators and moderators to send you e-mail notices?
	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium"><input type="radio" name="allowmail" value="1"<?php if($aReg['allowmail']){echo(' checked="checked"');} ?> />Yes.   <input type="radio" name="allowmail" value="0"<?php if(!$aReg['allowmail']){echo(' checked="checked"');} ?> />No.

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">
		Browse the forums in Invisible Mode?

If you select Yes, only administrators will be able to tell if you are online or not.

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium"><input type="radio" name="invisible" value="1"<?php if($aReg['invisible']){echo(' checked="checked"');} ?> />Yes.   <input type="radio" name="invisible" value="0"<?php if(!$aReg['invisible']){echo(' checked="checked"');} ?> />No.

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">
		Make your e-mail address public?

If you select Yes, users will be able to see your e-mail address (in your profile).

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium"><input type="radio" name="publicemail" value="1"<?php if($aReg['publicemail']){echo(' checked="checked"');} ?> />Yes.   <input type="radio" name="publicemail" value="0"<?php if(!$aReg['publicemail']){echo(' checked="checked"');} ?> />No.

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">Automatically login when you return?
	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium"><input type="radio" name="autologin" value="1"<?php if($aReg['autologin']){echo(' checked="checked"');} ?> />Yes.   <input type="radio" name="autologin" value="0"<?php if(!$aReg['autologin']){echo(' checked="checked"');} ?> />No.

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">
		Enable private messages?

If you select Yes, you will be able to send and receive private messages to and from other <?php echo(htmlsanitize($CFG['general']['name'])); ?> members.

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium"><input type="radio" name="enablepms" value="1"<?php if($aReg['enablepms']){echo(' checked="checked"');} ?> />Yes.   <input type="radio" name="enablepms" value="0"<?php if(!$aReg['enablepms']){echo(' checked="checked"');} ?> />No.

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">Notify you via e-mail when new private messages are received?
	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium"><input type="radio" name="pmnotifya" value="1"<?php if($aReg['pmnotifya']){echo(' checked="checked"');} ?> />Yes.   <input type="radio" name="pmnotifya" value="0"<?php if(!$aReg['pmnotifya']){echo(' checked="checked"');} ?> />No.

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">
		Pop up a box when new private messages become available?

If you select Yes, while browsing the forums a warning box will pop up on your screen when new private messages are available.

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium"><input type="radio" name="pmnotifyb" value="1"<?php if($aReg['pmnotifyb']){echo(' checked="checked"');} ?> />Yes.   <input type="radio" name="pmnotifyb" value="0"<?php if(!$aReg['pmnotifyb']){echo(' checked="checked"');} ?> />No.

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">Show users' signatures with their posts?
	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium"><input type="radio" name="showsigs" value="1"<?php if($aReg['showsigs']){echo(' checked="checked"');} ?> />Yes.   <input type="radio" name="showsigs" value="0"<?php if(!$aReg['showsigs']){echo(' checked="checked"');} ?> />No.

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">Show users' avatars with their posts?
	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium"><input type="radio" name="showavatars" value="1"<?php if($aReg['showavatars']){echo(' checked="checked"');} ?> />Yes.   <input type="radio" name="showavatars" value="0"<?php if(!$aReg['showavatars']){echo(' checked="checked"');} ?> />No.

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">Default Thread View
	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>">
		<select name="threadview" class="small">
			<option value="0"<?php if($aReg['threadview']==0){echo(' selected="selected"');} ?>>Use forum default.</option>
			<option value="1"<?php if($aReg['threadview']==1){echo(' selected="selected"');} ?>>Show threads from the last day.</option>
			<option value="2"<?php if($aReg['threadview']==2){echo(' selected="selected"');} ?>>Show threads from the last 2 days.</option>
			<option value="5"<?php if($aReg['threadview']==5){echo(' selected="selected"');} ?>>Show threads from the last 5 days.</option>
			<option value="10"<?php if($aReg['threadview']==10){echo(' selected="selected"');} ?>>Show threads from the last 10 days.</option>
			<option value="20"<?php if($aReg['threadview']==20){echo(' selected="selected"');} ?>>Show threads from the last 20 days.</option>
			<option value="30"<?php if($aReg['threadview']==30){echo(' selected="selected"');} ?>>Show threads from the last 30 days.</option>
			<option value="45"<?php if($aReg['threadview']==45){echo(' selected="selected"');} ?>>Show threads from the last 45 days.</option>
			<option value="60"<?php if($aReg['threadview']==60){echo(' selected="selected"');} ?>>Show threads from the last 60 days.</option>
			<option value="75"<?php if($aReg['threadview']==75){echo(' selected="selected"');} ?>>Show threads from the last 75 days.</option>
			<option value="100"<?php if($aReg['threadview']==100){echo(' selected="selected"');} ?>>Show threads from the last 100 days.</option>
			<option value="365"<?php if($aReg['threadview']==365){echo(' selected="selected"');} ?>>Show threads from the last year.</option>
			<option value="1000"<?php if($aReg['threadview']==1000){echo(' selected="selected"');} ?>>Show all threads.</option>
		</select>

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">
		Default Posts Per Page

The number of posts that are shown on each page of thread

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>">
		<select name="postsperpage" class="small">
			<option value="0"<?php if($aReg['postsperpage']==0){echo(' selected="selected"');} ?>>Use forum default.</option>
			<option value="5"<?php if($aReg['postsperpage']==5){echo(' selected="selected"');} ?>>Show 5 posts per page.</option>
			<option value="10"<?php if($aReg['postsperpage']==10){echo(' selected="selected"');} ?>>Show 10 posts per page.</option>
			<option value="20"<?php if($aReg['postsperpage']==20){echo(' selected="selected"');} ?>>Show 20 posts per page.</option>
			<option value="30"<?php if($aReg['postsperpage']==30){echo(' selected="selected"');} ?>>Show 30 posts per page.</option>
			<option value="40"<?php if($aReg['postsperpage']==40){echo(' selected="selected"');} ?>>Show 40 posts per page.</option>
		</select>

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">
		Default Threads Per Page

The number of threads that are shown on each page of a forum or search result

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>">
		<select name="threadsperpage" class="small">
			<option value="0"<?php if($aReg['threadsperpage']==0){echo(' selected="selected"');} ?>>Use forum default.</option>
			<option value="5"<?php if($aReg['threadsperpage']==5){echo(' selected="selected"');} ?>>Show 5 threads per page.</option>
			<option value="10"<?php if($aReg['threadsperpage']==10){echo(' selected="selected"');} ?>>Show 10 threads per page.</option>
			<option value="20"<?php if($aReg['threadsperpage']==20){echo(' selected="selected"');} ?>>Show 20 threads per page.</option>
			<option value="30"<?php if($aReg['threadsperpage']==30){echo(' selected="selected"');} ?>>Show 30 threads per page.</option>
			<option value="40"<?php if($aReg['threadsperpage']==40){echo(' selected="selected"');} ?>>Show 40 threads per page.</option>
		</select>

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">
		Start Of The Week

Select the day on which weeks start in your culture so that the forum calendar will appear correct for you.

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>">
		<select name="weekstart" class="small">
			<option value="0"<?php if($aReg['weekstart']==0){echo(' selected="selected"');} ?>>Sunday</option>
			<option value="1"<?php if($aReg['weekstart']==1){echo(' selected="selected"');} ?>>Monday</option>
			<option value="2"<?php if($aReg['weekstart']==2){echo(' selected="selected"');} ?>>Tuesday</option>
			<option value="3"<?php if($aReg['weekstart']==3){echo(' selected="selected"');} ?>>Wednesday</option>
			<option value="4"<?php if($aReg['weekstart']==4){echo(' selected="selected"');} ?>>Thursday</option>
			<option value="5"<?php if($aReg['weekstart']==5){echo(' selected="selected"');} ?>>Friday</option>
			<option value="6"<?php if($aReg['weekstart']==6){echo(' selected="selected"');} ?>>Saturday</option>
		</select>

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>" class="medium">
		Time Offset

The time is now <?php echo(gmdate('g:ia', $CFG['globaltime'])); ?> GMT. Select the appropriate offset so the displayed times will be correct for you.

	<td bgcolor="<?php echo($CFG['style']['table']['cellb']); ?>">
		<select name="timeoffset" class="small">
			<option value="-43200"<?php if($aReg['timeoffset'] == -43200){echo(' selected="selected"');} ?>>[GMT -12:00] International Date Line West</option>
			<option value="-39600"<?php if($aReg['timeoffset'] == -39600){echo(' selected="selected"');} ?>>[GMT -11:00] Midway Islands, Samoa</option>
			<option value="-36000"<?php if($aReg['timeoffset'] == -36000){echo(' selected="selected"');} ?>>[GMT -10:00] Hawaii-Aleutian Time</option>
			<option value="-32400"<?php if($aReg['timeoffset'] == -32400){echo(' selected="selected"');} ?>>[GMT -09:00] Alaska Time</option>
			<option value="-28800"<?php if($aReg['timeoffset'] == -28800){echo(' selected="selected"');} ?>>[GMT -08:00] Pacific Time (US & Canada)</option>
			<option value="-25200"<?php if($aReg['timeoffset'] == -25200){echo(' selected="selected"');} ?>>[GMT -07:00] Mountain Time (US & Canada)</option>
			<option value="-21600"<?php if($aReg['timeoffset'] == -21600){echo(' selected="selected"');} ?>>[GMT -06:00] Central Time (US & Canada)</option>
			<option value="-18000"<?php if($aReg['timeoffset'] == -18000){echo(' selected="selected"');} ?>>[GMT -05:00] Eastern Time (US & Canada)</option>
			<option value="-14400"<?php if($aReg['timeoffset'] == -14400){echo(' selected="selected"');} ?>>[GMT -04:00] Atlantic Time (Canada)</option>
			<option value="-12600"<?php if($aReg['timeoffset'] == -12600){echo(' selected="selected"');} ?>>[GMT -03:30] Newfoundland Time</option>
			<option value="-10800"<?php if($aReg['timeoffset'] == -10800){echo(' selected="selected"');} ?>>[GMT -03:00] Brasilia, Buenos Aires, Greenland</option>
			<option value="-7200"<?php if($aReg['timeoffset'] == -7200){echo(' selected="selected"');} ?>>[GMT -02:00] Mid-Atlantic Time</option>
			<option value="-3600"<?php if($aReg['timeoffset'] == -3600){echo(' selected="selected"');} ?>>[GMT -01:00] Azores, Cape Verde Island</option>
			<option value="0"<?php if($aReg['timeoffset'] == 0){echo(' selected="selected"');} ?>>[GMT +00:00] Western Europe Time</option>
			<option value="3600"<?php if($aReg['timeoffset'] == 3600){echo(' selected="selected"');} ?>>[GMT +01:00] Central Europe Time</option>
			<option value="7200"<?php if($aReg['timeoffset'] == 7200){echo(' selected="selected"');} ?>>[GMT +02:00] Eastern Europe Time</option>
			<option value="10800"<?php if($aReg['timeoffset'] == 10800){echo(' selected="selected"');} ?>>[GMT +03:00] Eastern Africa Time</option>
			<option value="12600"<?php if($aReg['timeoffset'] == 12600){echo(' selected="selected"');} ?>>[GMT +03:30] Middle East Time</option>
			<option value="14400"<?php if($aReg['timeoffset'] == 14400){echo(' selected="selected"');} ?>>[GMT +04:00] Near East Time</option>
			<option value="16200"<?php if($aReg['timeoffset'] == 16200){echo(' selected="selected"');} ?>>[GMT +04:30] Kabul Time</option>
			<option value="18000"<?php if($aReg['timeoffset'] == 18000){echo(' selected="selected"');} ?>>[GMT +05:00] Pakistan-Lahore Time</option>
			<option value="19800"<?php if($aReg['timeoffset'] == 19800){echo(' selected="selected"');} ?>>[GMT +05:30] India Time</option>
			<option value="20700"<?php if($aReg['timeoffset'] == 20700){echo(' selected="selected"');} ?>>[GMT +05:45] Kathmandu Time</option>
			<option value="21600"<?php if($aReg['timeoffset'] == 21600){echo(' selected="selected"');} ?>>[GMT +06:00] Bangladesh Time</option>
			<option value="25200"<?php if($aReg['timeoffset'] == 25200){echo(' selected="selected"');} ?>>[GMT +07:00] Christmas Island Time</option>
			<option value="28800"<?php if($aReg['timeoffset'] == 28800){echo(' selected="selected"');} ?>>[GMT +08:00] China-Taiwan Time</option>
			<option value="32400"<?php if($aReg['timeoffset'] == 32400){echo(' selected="selected"');} ?>>[GMT +09:00] Japan Time</option>
			<option value="34200"<?php if($aReg['timeoffset'] == 34200){echo(' selected="selected"');} ?>>[GMT +09:30] Australia Central Time</option>
			<option value="36000"<?php if($aReg['timeoffset'] == 36000){echo(' selected="selected"');} ?>>[GMT +10:00] Australia Eastern Time</option>
			<option value="39600"<?php if($aReg['timeoffset'] == 39600){echo(' selected="selected"');} ?>>[GMT +11:00] Soloman Time</option>
			<option value="43200"<?php if($aReg['timeoffset'] == 43200){echo(' selected="selected"');} ?>>[GMT +12:00] New Zealand Time</option>
		</select>

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">
		Are you currently observing Daylight Saving Time/Summer Time?

Adjust this setting if the forum times appear off, despite the Time Offset being correct.

	<td bgcolor="<?php echo($CFG['style']['table']['cella']); ?>" class="medium">
		<input type="radio" name="dst" value="0"<?php if(!$aReg['dst']){echo(' checked="checked"');} ?> />No.   <input type="radio" name="dst" value="1"<?php if($aReg['dst']){echo(' checked="checked"');} ?> />Yes. Adjustment is <input style="font-size: 11px; text-align: right;" type="text" name="dsth" size="1" maxlength="2" value="<?php echo($aReg['dsth']); ?>" />:<input style="font-size: 11px;" type="text" name="dstm" size="2" maxlength="2" value="<?php printf('%02u', $aReg['dstm']); ?>" /> hours.

<input type="submit" name="submit" value="Submit" />

</form>

<?php
	// Footer.
	require("./skins/{$CFG['skin']}/footer.tpl.php");
?>


text:
__MODULE_ENABLED = True

try:
    import cPickle as pickle
except:
    import pickle

try:
    import redis
except ImportError as exception:
    __MODULE_ENABLED = False

from time import time

from tori.exception               import *
from tori.session.repository.base import Base

class Redis(Base):
    def __init__(self, prefix='tori/session', redis_client=None, use_localhost_as_fallback=True):
        if not __MODULE_ENABLED:
            raise ImportError('Failed to enable Redis session storage.')

        Base.__init__(self)

        self._redis = redis_client
        self._prefix = prefix

        self._use_localhost_as_fallback = use_localhost_as_fallback

    @property
    def __api(self):
        if not self._redis and not self._use_localhost_as_fallback:
            raise InvalidInput('The Redis API (PIP: redis) must be provided.')
        elif not self._redis and self._use_localhost_as_fallback:
            pool        = redis.ConnectionPool(host='localhost', port=6379, db=0)
            self._redis = redis.Redis(connection_pool=pool)

        return self._redis

    def __compose_key(self, id, key):
        return '/'.join([self._prefix, id, key])

    def delete(self, id, key):
        actual_key = self.__compose_key(id, key)

        self.__api.delete(actual_key)

    def get(self, id, key):
        actual_key = self.__compose_key(id, key)
        content    = self.__api.get(actual_key)

        if content:
            content = pickle.loads(content)

        return content

    def registered(self, id):
        actual_key = self.__compose_key(id, '*')

        return self.__api.keys(actual_key)

    def reset(self, id):
        self.delete(id, '*')

    def set(self, id, key, content):
        actual_key = self.__compose_key(id, key)

        self.__api.set(actual_key, pickle.dumps(content))


text:
const queryString = require('query-string').parse(window.location.search);
const ansiUp = require('ansi_up');

const modal = require('../modal');
const commonMethods = require('../infrastructures/common-methods');
const helpers = require('../infrastructures/helper.js');
const showInfra = require('../infrastructures/show_infra');

const { toLocaleString } = helpers;
const alertSuccess = helpers.alert_success;
const alertDanger = helpers.alert_danger;
const alertAndShowInfra = helpers.alert_and_show_infra;

const hasSelected = commonMethods.has_selected;
const checkTag = commonMethods.check_tag;

const Snapshot = require('../models/snapshot').default;
const EC2Instance = require('../models/ec2_instance').default;
const Infrastructure = require('../models/infrastructure').default;

module.exports = Vue.extend({
  template: '#ec2-tabpane-template',

  props: {
    physical_id: {
      type: String,
      required: true,
    },
    infra_id: {
      type: Number,
      required: true,
    },
  },

  data() {
    return {
      loading: false,
      loading_s: false,
      loading_snapshots: false,
      loading_groups: false,
      inprogress: false, // for cook
      ec2_status_changing: false,
      chef_console_text: '',
      selected_dish: null,
      ec2: { availability_zones: {}, snapshots: [] },
      volume_selected: '',
      sort_key: '',
      sort_asc: false,
      schedule_type: '',
      schedule: {},
      loading_volumes: false,
      attachable_volumes: [],
      max_sec_group: null,
      rules_summary: null,
      x_chef: null,
      x_zabbix: null,
      editing_policy: {},
      volume_options: {},
      page: 0,
      dispItemSize: 10,
      filteredLength: null,
      filterKey: '',
      placement: 'left',
      lang: queryString.lang,
      sec_group: t('ec2_instances.msg.security_groups'),
      change_status: t('ec2_instances.change_status'),
      attach_vol: t('ec2_instances.attach'),
      changing_status: t('ec2_instances.changing_status'),
      is_yum_update: false,
      change_scale_type_to: '',
      cook_status: '',
    };
  },

  methods: {
    start_ec2() {
      if (this.running) { return; }
      if (this.ec2_status_changing) { return; }
      this.ec2_status_changing = true;

      const self = this;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);
      ec2.start_ec2()
        .done(alertSuccess(this._show_ec2))
        .fail(alertDanger(this._show_ec2));
    },

    stop_ec2() {
      if (this.stopped) { return; }
      if (this.ec2_status_changing) { return; }
      this.ec2_status_changing = true;

      const self = this;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);
      ec2.stop_ec2()
        .done(alertSuccess(this._show_ec2))
        .fail(alertDanger(this._show_ec2));
    },

    reboot_ec2() {
      if (this.stopped) { return; }
      if (this.ec2_status_changing) { return; }
      this.ec2_status_changing = true;

      const self = this;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);
      ec2.reboot_ec2()
        .fail(alertDanger(this._show_ec2));
    },

    detach_ec2() {
      const self = this;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);
      modal.Confirm(t('ec2_instances.ec2_instance'), t('ec2_instances.confirm.detach'), 'danger').done(() => {
        ec2.detach_ec2(self.x_zabbix, self.x_chef)
          .done(alertSuccess(() => {
            showInfra(infra.id);
          }))
          .fail(alertDanger(this._show_ec2));
      });
    },

    terminate_ec2() {
      const self = this;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);
      modal.Confirm(t('ec2_instances.ec2_instance'), t('ec2_instances.confirm.terminate'), 'danger').done(() => {
        ec2.terminate_ec2()
          .done(alertSuccess(() => {
            showInfra(infra.id);
          }))
          .fail(alertDanger(this._show_ec2));
      });
    },

    _cook(methodName, params) {
      const self = this;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);

      const dfd = ec2[methodName](params);
      dfd.fail(
        // cook start fail
        alertDanger(this._show_ec2),
      ).progress((state, msg) => {
        // cook start success
        if (state !== 'start') { return; }

        alertSuccess(() => {
          self.inprogress = true;
          Vue.nextTick(() => {
            self.watch_cook(dfd);
          });
        })(msg);
      });
    },

    watch_cook(dfd) {
      const self = this;
      const el = document.getElementById('cook-status');

      // 更新されるたびにスクロールすると、scrollHeight 等が重い処理なのでブラウザが固まってしまう。
      // そのため、100msに1回スクロールするようにしている。
      {
        const scroll = () => {
          Vue.nextTick(() => {
            el.scrollTop = el.scrollHeight;
            if (self.inprogress) { setTimeout(scroll, 100); }
          });
        };
        scroll();
      }

      dfd.done(() => {
        // cook end
        self.chef_console_text = '';
        self.inprogress = false;
        if (self.is_yum_update) {
          this._prompt_yum_log();
        } else {
          this._show_ec2();
        }
      }).progress((state, msg) => {
        if (state !== 'update') { return; }

        self.chef_console_text += msg;
      });
    },

    register_for_known_hosts() {
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, this.physical_id);

      ec2.register_for_known_hosts()
        .done(alertSuccess(this._show_ec2))
        .fail(alertDanger(this._show_ec2));
    },

    apply_dish() {
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, this.physical_id);
      ec2.apply_dish(this.selected_dish)
        .done(alertSuccess(this._show_ec2))
        .fail(alertDanger(this._show_ec2));
    },

    run_ansible_playbook() {
      const self = this;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);

      const dfd = ec2.run_ansible_playbook();
      dfd.fail(
        // run_ansible start fail
        alertDanger(this._show_ec2),
      ).progress((state, msg) => {
        // run_ansible start success
        if (state !== 'start') { return; }

        alertSuccess(() => {
          self.inprogress = true;
          Vue.nextTick(() => {
            self.watch_cook(dfd);
          });
        })(msg);
      });
    },

    yum_update(security, exec) {
      const self = this;
      self.is_yum_update = true;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);

      const securityBool = (security === 'security');
      const execBool = (exec === 'exec');

      modal.Confirm(t('infrastructures.infrastructure'), t('nodes.msg.yum_update_confirm'), 'danger').done(() => {
        const dfd = ec2.yum_update(securityBool, execBool).fail(
          // cook start fail
          alertDanger(this._show_ec2),
        ).progress((state) => {
          // cook start success
          if (state !== 'start') { return; }
          self.inprogress = true;
          Vue.nextTick(() => {
            self.watch_cook(dfd);
          });
        });
      });
    },

    _prompt_yum_log() {
      const self = this;
      self.is_yum_update = false;

      modal.ConfirmHTML(t('infrastructures.infrastructure'), t('nodes.msg.yum_update_success', { physical_id: self.physical_id }), 'success').done(() => {
        self.$parent.tabpaneID = 'infra_logs';
        this._loading();
      }).fail(() => {
        this._show_ec2();
      });
    },

    edit_ansible_playbook() {
      this.$parent.tabpaneID = 'edit_ansible_playbook';
      this._loading();
    },
    select_servertest() {
      this.$parent.tabpaneID = 'serverspec';
      this._loading();
    },
    serverspec_results() {
      this.$parent.tabpaneID = 'serverspec_results';
      this._loading();
    },
    view_rules() {
      this.$parent.tabpaneID = 'view-rules';
      this.$parent.sec_group = this.ec2.security_groups;
      this._loading();
      this.$parent.instance_type = 'ec2';
    },

    _show_ec2() { this.$parent.show_ec2(this.physical_id); },

    _label_class(status) {
      if (status === 'Success') {
        return 'label-success';
      } if (status === 'Failed') {
        return 'label-danger';
      } if (status === 'UnExecuted') {
        return 'label-warning';
      } // InProgress, Pending and others.
      return 'label-default';
    },

    is_role(run) { return run.indexOf('role') !== -1; },
    is_first(idx) { return (idx === 0); },
    ansi_up(log) { return ansiUp.ansi_to_html(log); },

    _loading() { this.$parent.loading = true; },

    change_scale() {
      const self = this;
      self.loading = true;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);
      ec2.change_scale(self.change_scale_type_to).done((msg) => {
        alertSuccess(this._show_ec2)(msg);
        $('#change-scale-modal').modal('hide');
      }).fail((msg) => {
        alertDanger(this._show_ec2)(msg);
        $('#change-scale-modal').modal('hide');
      });
    },

    change_schedule() {
      switch (this.schedule_type) {
        case 'yum':
          this.change_yum_schedule();
          break;
        case 'snapshot':
          this.change_snapshot_schedule();
          break;

        // no default
      }
    },

    change_yum_schedule() {
      const self = this;
      self.loading_s = true;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);
      ec2.schedule_yum(self.schedule).done((msg) => {
        self.loading_s = false;
        $('#change-schedule-modal').modal('hide');
        alertSuccess()(msg);
      }).fail((msg) => {
        self.loading_s = false;
        alertDanger()(msg);
      });
    },

    change_snapshot_schedule() {
      const self = this;
      self.loading_s = true;
      const s = new Snapshot(this.infra_id);
      s.schedule(self.volume_selected, self.physical_id, self.schedule).done((msg) => {
        self.ec2.snapshot_schedules[self.volume_selected] = self.schedule;
        self.loading_s = false;
        $('#change-schedule-modal').modal('hide');
        alertSuccess()(msg);
      }).fail((msg) => {
        self.loading_s = false;
        alertDanger()(msg);
      });
    },

    is_root_device(deviceName) {
      return this.ec2.root_device_name === deviceName;
    },

    create_snapshot(volumeId) {
      const self = this;
      modal.Confirm(t('snapshots.create_snapshot'), t('snapshots.msg.create_snapshot', {
        volume_id: volumeId,
      })).done(() => {
        const snapshot = new Snapshot(self.infra_id);

        snapshot.create(volumeId, self.physical_id).progress(() => {
          modal.Alert(t('snapshots.snapshots'), t('snapshots.msg.creation_started'));
        }).done(self.load_snapshots)
          .fail(alertDanger());

        self.load_snapshots();
      });
    },

    open_schedule_modal() { $('#change-schedule-modal').modal('show'); },

    open_yum_schedule_modal() {
      this.schedule_type = 'yum';
      this.schedule = this.ec2.yum_schedule;
      this.open_schedule_modal();
    },
    open_snapshot_schedule_modal(volumeId) {
      this.schedule_type = 'snapshot';
      this.schedule = Object.assign({}, this.ec2.snapshot_schedules[volumeId]);
      this.open_schedule_modal();
    },

    load_snapshots() {
      const self = this;
      const snapshot = new Snapshot(this.infra_id);
      this.loading_snapshots = true;
      snapshot.index(null).done((data) => {
        self.ec2.snapshots = data.snapshots.map((s) => {
          s.selected = false;
          return s;
        });
        self.sort_key = '';
        self.sort_by('start_time');
        self.loading_snapshots = false;
      }).fail(alertDanger());
    },

    delete_selected_snapshots() {
      const self = this;
      const snapshots = this.ec2.snapshots.filter(snapshot => snapshot.selected === true);
      const snapshotIds = snapshots.map(snapshot => snapshot.snapshot_id);
      let confirmBody = t('snapshots.msg.delete_snapshot');
      confirmBody += `<ul><li>${snapshotIds.join('</li><li>')}</li></ul>`;
      modal.ConfirmHTML(t('snapshots.delete_snapshot'), confirmBody, 'danger').done(() => {
        const s = new Snapshot(self.infra_id);

        snapshots.forEach((snapshot) => {
          s.destroy(snapshot.snapshot_id)
            .done(() => {
              const index = self.ec2.snapshots.indexOf(snapshot);
              self.ec2.snapshots.splice(index, 1);
            })
            .fail(alertDanger());
        });
      });
    },

    snapshot_status(snapshot) {
      if (snapshot.state === 'pending') {
        return `${snapshot.state}(${snapshot.progress})`;
      }
      return snapshot.state;
    },

    sort_by(key) {
      if (this.sort_key === key) {
        this.sort_asc = !this.sort_asc;
      } else {
        this.sort_asc = false;
        this.sort_key = key;
      }
      if (!this.sort_key) {
        return;
      }
      this.ec2.snapshots = this.ec2.snapshots.sort((a, b) => {
        if (a[key] < b[key]) {
          if (this.sort_asc) {
            return -1;
          }
          return 1;
        }
        if (a[key] > b[key]) {
          if (this.sort_asc) {
            return 1;
          }
          return -1;
        }
        return 0;
      });
    },

    sorting_by(key) {
      return this.sort_key === key;
    },

    load_volumes() {
      if ($('#attachButton.dropdown.open').length) { return; }
      const self = this;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);
      this.loading_volumes = true;
      ec2.attachable_volumes(this.ec2.availability_zone).done((data) => {
        self.attachable_volumes = data.attachable_volumes;
        self.loading_volumes = false;
      });
    },

    attach_volume(volumeId) {
      const self = this;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, self.physical_id);
      modal.Prompt(t('ec2_instances.set_device_name'), t('ec2_instances.device_name')).done((deviceName) => {
        ec2.attach_volume(volumeId, deviceName).done((data) => {
          modal.Alert(t('infrastructures.infrastructure'), t('ec2_instances.msg.volume_attached', data)).done(this._show_ec2);
        }).fail(alertDanger());
      });
      $('[id^=bootstrap_prompt_]').val(this.suggest_device_name);
    },

    detach_volume() {
      const self = this;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, this.physical_id);
      modal.Confirm(
        t('ec2_instances.detach_volume'),
        t('ec2_instances.msg.detach_volume', { volume_id: this.volume_selected, physical_id: this.physical_id }),
        'danger',
      ).done(() => {
        ec2.detach_volume(self.volume_selected).done((data) => {
          modal.Alert(t('ec2_instances.detach_volume'), data).done(this._show_ec2);
        }).fail(alertDanger());
      });
    },

    edit_retention_policy() {
      const self = this;
      if (Object.keys(self.ec2.retention_policies).includes(self.volume_selected)) {
        self.editing_policy = Object.assign({}, self.ec2.retention_policies[self.volume_selected]);
      } else {
        self.editing_policy = {};
      }
    },

    save_retention_policy(volumeId, policy) {
      const self = this;
      const retentionPolicies = self.ec2.retention_policies;
      const infra = new Infrastructure(self.infra_id);
      const snapshot = new Snapshot(infra.id);
      snapshot.save_retention_policy(volumeId, policy.enabled, policy.max_amount)
        .done((msg) => {
          retentionPolicies[volumeId] = policy;

          $('#retention-policy-modal').modal('hide');
          alertSuccess()(msg);
        }).fail(alertDanger());
    },

    on_click_volume(volumeId) {
      const self = this;
      const panelOpened = document.getElementById('ebs_panel').classList.contains('in');
      const same = this.volume_selected === volumeId;
      if (panelOpened && same) {
        $('#ebs_panel').collapse('hide');
        setTimeout(() => {
          self.volume_selected = '';
        }, 300);
      } else {
        this.volume_selected = volumeId;
        this.$nextTick(() => {
          $('#ebs_panel').collapse('show');
        });
      }
    },

    latest_snapshot(volumeId) {
      return this.ec2.snapshots
        .filter(snapshot => (
          snapshot.volume_id === volumeId
          && snapshot.state === 'completed'
        ))
        .sort((a, b) => {
          if (a.start_time < b.start_time) {
            return -1;
          }
          if (a.start_time > b.start_time) {
            return 1;
          }
          return 0;
        })
        .slice(-1)[0];
    },

    latest_snapshot_date(volumeId) {
      const snapshot = this.latest_snapshot(volumeId);
      if (snapshot) {
        const date = new Date(snapshot.start_time);
        return date.toLocaleString();
      }
      return undefined;
    },

    create_volume() {
      const infra = new Infrastructure(this.infra_id);
      const instance = new EC2Instance(infra, this.physical_id);
      const self = this;
      this.loading_s = true;
      instance.create_volume(this.volume_options)
        .done((msg) => {
          self.loading_s = false;
          $('#create_volume_modal').modal('hide');
          alertSuccess()(msg, true);
        })
        .fail((data) => {
          self.loading_s = false;
          alertDanger()(data);
        });
    },

    init_volume_options(snapshot) {
      if (typeof snapshot === 'undefined') {
        this.volume_options = {};
      } else {
        this.volume_options = {
          snapshot_id: snapshot.snapshot_id,
          size: snapshot.volume_size,
          encrypted: snapshot.encrypted,
          availability_zone: this.ec2.availability_zone,
        };
      }
    },

    toLocaleString,

    capitalize(str) {
      // 中身はUpperCamelCaseにする処理
      const capitalizeStr = str.charAt(0).toUpperCase() + str.slice(1);
      return capitalizeStr.replace(/[-_ ]+(.)/g, (match, p1) => p1.toUpperCase());
    },

    get_security_groups() {
      const self = this;
      self.loading_groups = true;
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, this.physical_id);
      ec2.get_security_groups().done((data) => {
        self.rules_summary = data.params;
        self.loading_groups = false;
        self.filteredLength = data.params.length;
      });
    },

    check(i) { i.checked = !i.checked; },
    reload() { this.$parent.show_ec2(this.physical_id); },

    submit_groups() {
      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, this.physical_id);
      const groupIds = this.rules_summary.filter(t => t.checked).map(t => t.group_id);

      ec2.submit_groups(groupIds)
        .done(alertSuccess(this._show_ec2))
        .fail(alertDanger(this._show_ec2));
    },

    showPrev() {
      if (this.isStartPage) return;
      this.page -= 1;
    },
    showNext() {
      if (this.isEndPage) return;
      this.page += 1;
    },
    check_tag(r) {
      return checkTag(r);
    },
    roundup(val) { return (Math.ceil(val)); },
    suffix_current_az(zoneName) {
      return (this.ec2.availability_zone === zoneName) ? (`${zoneName}(current)`) : zoneName;
    },
  },

  computed: {
    ec2_btn_class() {
      if (this.running) {
        return 'btn-success';
      }
      return 'btn-default';
    },
    has_selected() {
      return hasSelected(this.rules_summary);
    },

    ansible_status_class() { return this._label_class(this.ansible_status); },
    servertest_status_class() { return this._label_class(this.servertest_status); },
    update_status_class() { return this._label_class(this.update_status); },

    ansible_status() { return this.capitalize(this.ec2.info.ansible_status.value); },
    servertest_status() { return this.capitalize(this.ec2.info.servertest_status.value); },
    update_status() { return this.capitalize(this.ec2.info.update_status.value); },

    ansible_time() { return this.ansible_status === 'UnExecuted' ? '' : toLocaleString(this.ec2.info.ansible_status.updated_at); },
    serverspec_time() { return this.servertest_status === 'UnExecuted' ? '' : toLocaleString(this.ec2.info.servertest_status.updated_at); },
    update_time() { return this.update_status === 'UnExecuted' ? '' : toLocaleString(this.ec2.info.update_status.updated_at); },

    dishes_empty() { return !this.ec2.dishes.length; },

    running() { return this.ec2.status === 'running'; },
    stopped() { return this.ec2.status === 'stopped'; },

    dish_option() {
      return [{ text: 'Select!', value: '0' }].concat(this.ec2.dishes.map(dish => ({ text: dish.name, value: dish.id })));
    },

    next_run() { return (new Date().getHours() + parseInt(this.schedule.time, 10)) % 24; },

    filled_all() {
      if (!this.schedule.enabled) return true;
      switch (this.schedule.frequency) {
        case 'weekly':
          return this.schedule.day_of_week && this.schedule.time;
        case 'daily':
          return this.schedule.time;
        case 'intervals':
          return parseInt(this.schedule.time, 10);
        default:
          return false;
      }
    },

    selected_snapshots() { return this.ec2.snapshots.filter(snapshot => snapshot.selected === true); },

    suggest_device_name() {
      // TODO: iikanji ni sitai
      let suggestedDeviceLetterCode = 102; // same as aws default 'f'

      const deviceLetterCodes = this.ec2.block_devices.map(x => x.device_name.slice(-1).charCodeAt());

      while (deviceLetterCodes.indexOf(suggestedDeviceLetterCode) !== -1) {
        if (suggestedDeviceLetterCode === 122) { // 'z'
          suggestedDeviceLetterCode = 63; // '?'
          break;
        }
        suggestedDeviceLetterCode += 1;
      }

      return `/dev/sd${String.fromCharCode(suggestedDeviceLetterCode)}`;
    },

    is_valid_amount() { return this.editing_policy.max_amount >= 3 && this.editing_policy.max_amount < 1000; },
    is_retention_policy_set() { return this.volume_selected && this.ec2.retention_policies[this.volume_selected].enabled; },
    is_snapshot_schedule_set() { return this.volume_selected && this.ec2.snapshot_schedules[this.volume_selected].enabled; },

    schedule_indicator_message() {
      const schedule = this.ec2.snapshot_schedules[this.volume_selected];
      switch (schedule.frequency) {
        case 'intervals':
          return t('schedules.label.per_n_hours', { n: schedule.time });
        case 'daily':
          return t('schedules.label.daily', { n: schedule.time });
        case 'weekly':
          return t('schedules.label.weekly', { n: schedule.time, w: t(`schedules.day_of_week.${schedule.day_of_week}`) });
        default:
          return undefined;
      }
    },

    dispItems() {
      const startPage = this.page * this.dispItemSize;
      if (this.filterKey === '') {
        return this.rules_summary.slice(startPage, startPage + this.dispItemSize);
      }

      return this.rules_summary;
    },

    filterd_dispitems() {
      const self = this;
      const items = this.dispItems.filter((data) => {
        if (self.filterKey === '') {
          return true;
        }
        return JSON.stringify(data).toLowerCase().indexOf(self.filterKey.toLowerCase()) !== -1;
      });
      self.filteredLength = items.length;
      return items;
    },

    filterd_snapshot() {
      const self = this;
      const items = this.ec2.snapshots.filter((data) => {
        if (self.volume_selected === '') {
          return true;
        }
        return JSON.stringify(data.volume_id).indexOf(self.volume_selected) !== -1;
      });
      this.filteredLength = items.length;
      return items;
    },

    isStartPage() { return (this.page === 0); },
    isEndPage() { return ((this.page + 1) * this.dispItemSize >= this.rules_summary.length); },

    can_create_volume() {
      return this.volume_options.volume_type
             && this.volume_options.size
             && this.volume_options.availability_zone;
    },
  },

  mounted() {
    this.$nextTick(() => {
      const self = this;

      const infra = new Infrastructure(this.infra_id);
      const ec2 = new EC2Instance(infra, this.physical_id);
      ec2.show().done((data) => {
        self.ec2 = data;
        self.max_sec_group = data.security_groups.length - 1;
        let dishId = '0';
        if (self.ec2.selected_dish) {
          dishId = self.ec2.selected_dish.id;
        }
        self.selected_dish = dishId;

        if (self.ec2.info.cook_status === 'InProgress' || self.ec2.info.update_status === 'InProgress') {
          const dfd = $.Deferred();
          ec2.watch_cook(dfd); // watch WebSocket and trigger event.
          self.watch_cook(dfd); // watch dfd event and update DOM.
          self.inprogress = true;
        }
        self.$parent.loading = false;
      }).fail(alertAndShowInfra(infra.id));
    });
  },

  filters: {
    zero_as_null(str) { return (str === 0) ? null : str; },
  },
});


text:
 Posts

    <input class="form-control" placeholder="Filter posts..." v-model="postsFilter">

  <transition-group
    tag="div"
    class="list-group"
    :css="false"
    @before-enter="handleBeforeEnter"
    @enter="handleEnter">
    <router-link v-if="filteredPosts.length"
                 class="list-group-item"
                 v-for="(post, index) in filteredPosts"
                 :key="index"
                 :data-index="index"
                 :to="{ name: 'post', params: { id: post.id }}">
      #{{ index+1 }} {{ post.title }}
    </router-link>
  </transition-group>


text:
require "application_system_test_case"

class BusynessesTest < ApplicationSystemTestCase
  setup do
    @role_admin_busyness = role_admin_busynesses(:one)
  end

  test "visiting the index" do
    visit role_admin_busynesses_url
    assert_selector "h1", text: "Busynesses"
  end

  test "creating a Busyness" do
    visit role_admin_busynesses_url
    click_on "New Busyness"

    fill_in "Identifier", with: @role_admin_busyness.identifier
    fill_in "Name", with: @role_admin_busyness.name
    click_on "Create Busyness"

    assert_text "Busyness was successfully created"
    click_on "Back"
  end

  test "updating a Busyness" do
    visit role_admin_busynesses_url
    click_on "Edit", match: :first

    fill_in "Identifier", with: @role_admin_busyness.identifier
    fill_in "Name", with: @role_admin_busyness.name
    click_on "Update Busyness"

    assert_text "Busyness was successfully updated"
    click_on "Back"
  end

  test "destroying a Busyness" do
    visit role_admin_busynesses_url
    page.accept_confirm do
      click_on "Destroy", match: :first
    end

    assert_text "Busyness was successfully destroyed"
  end
end


text:
@interface SimplePageScroll()
@property (nonatomic, strong) NSArray *fileNames;
@end

#define PAGE_CONTROL_HEIGHT 44.0f
#define IMAGE_BUNDLE_NAME @"help.bundle"

#ifdef DEBUG
#   define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define DLog(...)
#endif

typedef NS_ENUM(NSInteger, DeviceType)
{
    DEVICE_TYPE_IPHONE_CLASSIC,
    DEVICE_TYPE_IPHONE_TALL,
    DEVICE_TYPE_IPAD_CLASSIC
};

@interface SimplePageScroll ()
@property NSInteger numberOfImages;
@end

@implementation SimplePageScroll

+ (DeviceType)screenPhysicalSize
{
    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    {
        CGSize result = [[UIScreen mainScreen] bounds].size;
        if (result.height < 500)
            return DEVICE_TYPE_IPHONE_CLASSIC;  // iPhone 4S / 4th Gen iPod Touch or earlier
        else
            return DEVICE_TYPE_IPHONE_TALL;  // iPhone 5
    }
    else
    {
        return DEVICE_TYPE_IPAD_CLASSIC; // iPad
    }
}

- (CGRect)scrollViewFrame
{
    CGRect rect;

    if ([[self class] screenPhysicalSize] == DEVICE_TYPE_IPHONE_CLASSIC) {
        rect = CGRectMake(0, 20, 320, 416);
    }
    else if ([[self class] screenPhysicalSize] == DEVICE_TYPE_IPHONE_TALL) {
        rect = CGRectMake(0, 20, 320, 504);
    }
    else if (([[self class] screenPhysicalSize]) == DEVICE_TYPE_IPAD_CLASSIC) {
        rect = CGRectMake(0, 20, 320, 416);
    }
    return rect;
}

- (NSArray*)enumImagesInBundle:(NSString*)bundleName
{
    NSBundle *main = [NSBundle mainBundle];
    NSArray *images = [main URLsForResourcesWithExtension:@"png" subdirectory:bundleName];

    // convert to subpath
    __block NSMutableArray *result = [NSMutableArray array];
    [images enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        [result addObject: [NSString stringWithFormat:@"%@/%@", bundleName, [obj lastPathComponent]]];
    }];

    return [result sortedArrayUsingSelector:@selector(compare:)];
}

- (NSArray*)getFileNames
{
    NSError *error;
    NSString *resourcePath = [[NSBundle mainBundle] pathForResource:[IMAGE_BUNDLE_NAME stringByAppendingString:@"/namelist"] ofType:@"txt"];

    NSString *strFileContent = [NSString stringWithContentsOfFile:resourcePath
                                                         encoding:NSUTF8StringEncoding error:&error];

    NSAssert(error == nil, @"getFileNames error");

    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^.*$" options:NSRegularExpressionAnchorsMatchLines error:&error];

    NSArray *matchedResult = [regex matchesInString:strFileContent options:NSMatchingReportProgress range: NSMakeRange(0, [strFileContent length])];

    NSMutableArray *fileNames = [NSMutableArray array];

    for (NSTextCheckingResult *aResult in matchedResult) {

        [fileNames addObject: [strFileContent substringWithRange: aResult.range]];
    };

    return fileNames;
}

- (UIScrollView*)setupScrollViewWithFileNames:(NSArray*)fileNamesArray
{
    CGRect frame = [self scrollViewFrame];
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame: frame];

    //NSArray *imageFiles = [self enumImagesInBundle: IMAGE_BUNDLE_NAME];

    CGRect unitRect = CGRectMake(0, 0, frame.size.width, frame.size.height);
    CGRect baseRect = CGRectMake(0, 0, frame.size.width, frame.size.height);

    NSInteger numberOfImages = self.fileNames.count;

    for (NSInteger i = 0; i < numberOfImages; i++) {
        NSString *img = [NSString stringWithFormat:@"%@/%@",IMAGE_BUNDLE_NAME, self.fileNames[i]];
        DLog(@"load image [%ld] named : %@", (long)i, img);
        UIImageView *imgView = [[UIImageView alloc] initWithImage: [UIImage imageNamed: img]];
        imgView.contentMode = UIViewContentModeScaleAspectFit;
        imgView.frame = CGRectOffset(baseRect, unitRect.size.width * i, 0);
        [scrollView addSubview: imgView];
    }

    CGSize size = CGSizeMake(unitRect.size.width * numberOfImages, unitRect.size.height);
    scrollView.contentSize = size;
    scrollView.showsHorizontalScrollIndicator = NO;
    scrollView.delegate = self;
    scrollView.pagingEnabled = YES;
    self.numberOfImages = numberOfImages;
    [self.view addSubview: scrollView];
    return scrollView;
}

- (UIPageControl*)setupPageControlWithNumberOfPages:(NSInteger)number
{
    UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame: CGRectMake(0, self.view.frame.size.height - PAGE_CONTROL_HEIGHT, self.view.frame.size.width, PAGE_CONTROL_HEIGHT)];

    [pageControl addTarget: self action: @selector(changePage:) forControlEvents:UIControlEventTouchUpInside];

    pageControl.numberOfPages = number;
    pageControl.backgroundColor = [UIColor blackColor];
    pageControl.alpha = .85;
    [self.view addSubview: pageControl];
    return pageControl;
}

- (void)handleTapGestureRecognizer:(UITapGestureRecognizer *)tapGestureRecognizer
{
    // As the document said, this message will forward to the presenting view controller

    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.fileNames = [self getFileNames];
    self.scrollView = [self setupScrollViewWithFileNames:self.fileNames];
    self.pageControl = [self setupPageControlWithNumberOfPages: self.numberOfImages];
    self.tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(handleTapGestureRecognizer:)];

    [self.view bringSubviewToFront: self.pageControl];
    [self.view addGestureRecognizer: self.tapGestureRecognizer];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - IBActions

- (IBAction)changePage:(UIPageControl*)sender {

    NSInteger page = sender.currentPage;
    CGRect frame = self.scrollView.frame;
    frame.origin.x = frame.size.width * page;
    frame.origin.y = 0;

    [self.scrollView scrollRectToVisible:frame animated:YES];
    self.currentIndex = page;
}

#pragma mark - scroll delegate -

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    NSInteger nPage = self.scrollView.contentOffset.x / self.view.frame.size.width;

    if (nPage != self.currentIndex) {
        self.currentIndex = nPage;
        self.pageControl.currentPage = self.currentIndex;
    }
}
@end

#undef DLog


text:
<?php

namespace HealthCareAbroad\AdminBundle\Event;

use HealthCareAbroad\HelperBundle\Event\BaseEvent;

class AdminUserTypeEvent extends BaseEvent
{
    public function getAdminUserType()
    {
        return $this->getData();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="bootstrap/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false"
        >
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app/controllers</directory>
            <directory suffix=".php">./app/redhotmayo</directory>
            <exclude>
                <directory suffix=".php">./app/tests</directory>
                <directory suffix="ServiceProvider.php">./app</directory>
            </exclude>
        </whitelist>
    </filter>

    <testsuites>
        <testsuite name="all">
            <directory>./app/tests/</directory>
        </testsuite>
    </testsuites>

    <logging>
        <log type="coverage-html" target="../test_coverage/"/>
    </logging>
</phpunit>


text:
#ifndef itkScaleLogarithmicTransform_h
#define itkScaleLogarithmicTransform_h

#include "itkScaleTransform.h"

namespace itk
{
/** \class ScaleLogarithmicTransform
 * \brief Logarithmic Scale transformation of a vector space (e.g. space coordinates)
 *
 * The only difference between this class and its superclass the ScaleTransform
 * is that here the parameters of the transformation are the logarithms of the
 * scales. This facilitates to linearize the expressions used for optimization.
 *
 * \ingroup ITKTransform
 */
template<typename TParametersValueType=float,
  unsigned int NDimensions = 3>
class ITK_TEMPLATE_EXPORT ScaleLogarithmicTransform :
  public ScaleTransform<TParametersValueType, NDimensions>
{
public:
  /** Standard class typedefs.   */
  typedef ScaleLogarithmicTransform                         Self;
  typedef ScaleTransform<TParametersValueType, NDimensions> Superclass;
  typedef SmartPointer<Self>                                Pointer;
  typedef SmartPointer<const Self>                          ConstPointer;

  /** New macro for creation of through a smart pointer. */
  itkNewMacro(Self);

  /** Run-time type information (and related methods). */
  itkTypeMacro(ScaleLogarithmicTransform, ScaleTransform);

  /** Dimension of the domain space. */
  itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
  itkStaticConstMacro(ParametersDimension, unsigned int, NDimensions);

  /** Scalar type. */
  typedef typename Superclass::ScalarType ScalarType;

  /** Parameters type. */
  typedef typename Superclass::ParametersType      ParametersType;
  typedef typename ParametersType::ValueType       ParametersValueType;
  typedef typename Superclass::FixedParametersType FixedParametersType;
  typedef typename FixedParametersType::ValueType  FixedParametersValueType;

  /** Jacobian type. */
  typedef typename Superclass::JacobianType JacobianType;

  /** Standard vector type for this class. */
  typedef typename Superclass::ScaleType ScaleType;
  typedef typename ScaleType::ValueType  ScalesValueType;

  /** Standard vector type for this class. */
  typedef typename Superclass::InputVectorType  InputVectorType;
  typedef typename Superclass::OutputVectorType OutputVectorType;

  /** Standard covariant vector type for this class. */
  typedef typename Superclass::InputCovariantVectorType  InputCovariantVectorType;
  typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;

  /** Standard vnl_vector type for this class. */
  typedef typename Superclass::InputVnlVectorType  InputVnlVectorType;
  typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;

  /** Standard coordinate point type for this class. */
  typedef typename Superclass::InputPointType  InputPointType;
  typedef typename Superclass::OutputPointType OutputPointType;

  /** Set parameters.
   * This method sets the parameters for the transform
   * value specified by the user. */
  void SetParameters(const ParametersType & parameters) ITK_OVERRIDE;

  /** Get the parameters that uniquely define the transform
   * This is typically used by optimizers.
   * There are 4 parameters. The first one represents the
   * rotation, the second one the scale and the last
   * two represent the offset. */
  const ParametersType & GetParameters(void) const ITK_OVERRIDE;

  /** Compute the Jacobian Matrix of the transformation at one point,
   *  allowing for thread-safety. */
  virtual void ComputeJacobianWithRespectToParameters( const InputPointType  & p, JacobianType & jacobian) const ITK_OVERRIDE;

protected:
  /** Construct an ScaleLogarithmicTransform object. */
  ScaleLogarithmicTransform();

  /** Destroy an ScaleLogarithmicTransform object. */
  ~ScaleLogarithmicTransform();

  /** Print contents of an ScaleLogarithmicTransform */
  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

private:
  ITK_DISALLOW_COPY_AND_ASSIGN(ScaleLogarithmicTransform);

};                                               // class
                                                 // ScaleLogarithmicTransform
}  // namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkScaleLogarithmicTransform.hxx"
#endif

#endif /* itkScaleLogarithmicTransform_h */


text:
@interface WBMyFunCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UILabel *sourceLabel;
@property (weak, nonatomic) IBOutlet UIButton *attentionButton;

@end

@implementation WBMyFunCell

- (IBAction)attention {
}

+ (WBMyFunCell *)cellWithTableView:(UITableView *)tableView
{
    static NSString *cellID = @"WBMyFunCell";
    WBMyFunCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell) {
        cell = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil].lastObject;
    }
    return cell;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code

    self.nameLabel.font = [UIFont systemFontOfSize:15];
    self.contentLabel.font = [UIFont systemFontOfSize:13];
    self.sourceLabel.font = [UIFont systemFontOfSize:13];

    self.iconView.layer.cornerRadius = kWBMyFunCellIconViewHeight * 0.5;
    self.iconView.clipsToBounds = YES;

    self.attentionButton.titleLabel.font = [UIFont systemFontOfSize:11];
    [self.attentionButton setBackgroundImage:[UIImage imageWithColor:kBaseViewControllerBackgroundColor alpha:1.0] forState:UIControlStateHighlighted];
}

#pragma mark - Setter

- (void)setMyFun:(WBMyFun *)myFun
{
    _myFun = myFun;

    self.nameLabel.text = myFun.name;
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:myFun.avatar_large] placeholderImage:[UIImage imageNamed:@"sign-up_avatar_default"]];
    self.contentLabel.text = myFun.status.text;
    self.attentioned = myFun.following;
    self.sourceLabel.text = myFun.status.source;
}

- (void)setAttentioned:(BOOL)attentioned
{
    _attentioned = attentioned;
    if (attentioned) {
        [self.attentionButton setTitle:@"互相关注" forState:UIControlStateNormal];
        [self.attentionButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    } else {
        [self.attentionButton setTitle:@"加关注" forState:UIControlStateNormal];
        [self.attentionButton setTitleColor:kSystemNavigationItemHighlightColor forState:UIControlStateNormal];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end


text:
#ifndef XENIA_GPU_VULKAN_PIPELINE_CACHE_H_
#define XENIA_GPU_VULKAN_PIPELINE_CACHE_H_

#include <unordered_map>

#include "xenia/base/string_buffer.h"
#include "xenia/base/xxhash.h"
#include "xenia/gpu/register_file.h"
#include "xenia/gpu/spirv_shader_translator.h"
#include "xenia/gpu/vulkan/render_cache.h"
#include "xenia/gpu/vulkan/vulkan_shader.h"
#include "xenia/gpu/xenos.h"
#include "xenia/ui/spirv/spirv_disassembler.h"
#include "xenia/ui/vulkan/vulkan.h"
#include "xenia/ui/vulkan/vulkan_device.h"

namespace xe {
namespace gpu {
namespace vulkan {

// Configures and caches pipelines based on render state.
// This is responsible for properly setting all state required for a draw
// including shaders, various blend/etc options, and input configuration.
class PipelineCache {
 public:
  enum class UpdateStatus {
    kCompatible,
    kMismatch,
    kError,
  };

  PipelineCache(RegisterFile* register_file, ui::vulkan::VulkanDevice* device);
  ~PipelineCache();

  VkResult Initialize(VkDescriptorSetLayout uniform_descriptor_set_layout,
                      VkDescriptorSetLayout texture_descriptor_set_layout,
                      VkDescriptorSetLayout vertex_descriptor_set_layout);
  void Shutdown();

  // Loads a shader from the cache, possibly translating it.
  VulkanShader* LoadShader(xenos::ShaderType shader_type,
                           uint32_t guest_address, const uint32_t* host_address,
                           uint32_t dword_count);

  // Configures a pipeline using the current render state and the given render
  // pass. If a previously available pipeline is available it will be used,
  // otherwise a new one may be created. Any state that can be set dynamically
  // in the command buffer is issued at this time.
  // Returns whether the pipeline could be successfully created.
  UpdateStatus ConfigurePipeline(VkCommandBuffer command_buffer,
                                 const RenderState* render_state,
                                 VulkanShader* vertex_shader,
                                 VulkanShader* pixel_shader,
                                 xenos::PrimitiveType primitive_type,
                                 VkPipeline* pipeline_out);

  // Sets required dynamic state on the command buffer.
  // Only state that has changed since the last call will be set unless
  // full_update is true.
  bool SetDynamicState(VkCommandBuffer command_buffer, bool full_update);

  // Pipeline layout shared by all pipelines.
  VkPipelineLayout pipeline_layout() const { return pipeline_layout_; }

  // Clears all cached content.
  void ClearCache();

 private:
  // Creates or retrieves an existing pipeline for the currently configured
  // state.
  VkPipeline GetPipeline(const RenderState* render_state, uint64_t hash_key);

  bool TranslateShader(VulkanShader::VulkanTranslation& translation);

  void DumpShaderDisasmAMD(VkPipeline pipeline);
  void DumpShaderDisasmNV(const VkGraphicsPipelineCreateInfo& info);

  // Gets a geometry shader used to emulate the given primitive type.
  // Returns nullptr if the primitive doesn't need to be emulated.
  VkShaderModule GetGeometryShader(xenos::PrimitiveType primitive_type,
                                   bool is_line_mode);

  RegisterFile* register_file_ = nullptr;
  ui::vulkan::VulkanDevice* device_ = nullptr;

  // Temporary storage for AnalyzeUcode calls.
  StringBuffer ucode_disasm_buffer_;
  // Reusable shader translator.
  std::unique_ptr<ShaderTranslator> shader_translator_ = nullptr;
  // Disassembler used to get the SPIRV disasm. Only used in debug.
  xe::ui::spirv::SpirvDisassembler disassembler_;
  // All loaded shaders mapped by their guest hash key.
  std::unordered_map<uint64_t, VulkanShader*> shader_map_;

  // Vulkan pipeline cache, which in theory helps us out.
  // This can be serialized to disk and reused, if we want.
  VkPipelineCache pipeline_cache_ = nullptr;
  // Layout used for all pipelines describing our uniforms, textures, and push
  // constants.
  VkPipelineLayout pipeline_layout_ = nullptr;

  // Shared geometry shaders.
  struct {
    VkShaderModule line_quad_list;
    VkShaderModule point_list;
    VkShaderModule quad_list;
    VkShaderModule rect_list;
  } geometry_shaders_;

  // Shared dummy pixel shader.
  VkShaderModule dummy_pixel_shader_;

  // Hash state used to incrementally produce pipeline hashes during update.
  // By the time the full update pass has run the hash will represent the
  // current state in a way that can uniquely identify the produced VkPipeline.
  XXH3_state_t hash_state_;
  // All previously generated pipelines mapped by hash.
  std::unordered_map<uint64_t, VkPipeline> cached_pipelines_;

  // Previously used pipeline. This matches our current state settings
  // and allows us to quickly(ish) reuse the pipeline if no registers have
  // changed.
  VkPipeline current_pipeline_ = nullptr;

 private:
  UpdateStatus UpdateState(VulkanShader* vertex_shader,
                           VulkanShader* pixel_shader,
                           xenos::PrimitiveType primitive_type);

  UpdateStatus UpdateRenderTargetState();
  UpdateStatus UpdateShaderStages(VulkanShader* vertex_shader,
                                  VulkanShader* pixel_shader,
                                  xenos::PrimitiveType primitive_type);
  UpdateStatus UpdateVertexInputState(VulkanShader* vertex_shader);
  UpdateStatus UpdateInputAssemblyState(xenos::PrimitiveType primitive_type);
  UpdateStatus UpdateViewportState();
  UpdateStatus UpdateRasterizationState(xenos::PrimitiveType primitive_type);
  UpdateStatus UpdateMultisampleState();
  UpdateStatus UpdateDepthStencilState();
  UpdateStatus UpdateColorBlendState();

  bool SetShadowRegister(uint32_t* dest, uint32_t register_name);
  bool SetShadowRegister(float* dest, uint32_t register_name);
  bool SetShadowRegisterArray(uint32_t* dest, uint32_t num,
                              uint32_t register_name);

  struct UpdateRenderTargetsRegisters {
    uint32_t rb_modecontrol;
    reg::RB_SURFACE_INFO rb_surface_info;
    reg::RB_COLOR_INFO rb_color_info;
    reg::RB_DEPTH_INFO rb_depth_info;
    reg::RB_COLOR_INFO rb_color1_info;
    reg::RB_COLOR_INFO rb_color2_info;
    reg::RB_COLOR_INFO rb_color3_info;
    uint32_t rb_color_mask;
    uint32_t rb_depthcontrol;
    uint32_t rb_stencilrefmask;

    UpdateRenderTargetsRegisters() { Reset(); }
    void Reset() { std::memset(this, 0, sizeof(*this)); }
  } update_render_targets_regs_;

  struct UpdateShaderStagesRegisters {
    xenos::PrimitiveType primitive_type;
    uint32_t pa_su_sc_mode_cntl;
    reg::SQ_PROGRAM_CNTL sq_program_cntl;
    VulkanShader* vertex_shader;
    VulkanShader* pixel_shader;

    UpdateShaderStagesRegisters() { Reset(); }
    void Reset() { std::memset(this, 0, sizeof(*this)); }
  } update_shader_stages_regs_;
  VkPipelineShaderStageCreateInfo update_shader_stages_info_[3];
  uint32_t update_shader_stages_stage_count_ = 0;

  struct UpdateVertexInputStateRegisters {
    VulkanShader* vertex_shader;

    UpdateVertexInputStateRegisters() { Reset(); }
    void Reset() { std::memset(this, 0, sizeof(*this)); }
  } update_vertex_input_state_regs_;
  VkPipelineVertexInputStateCreateInfo update_vertex_input_state_info_;
  VkVertexInputBindingDescription update_vertex_input_state_binding_descrs_[32];
  VkVertexInputAttributeDescription
      update_vertex_input_state_attrib_descrs_[96];

  struct UpdateInputAssemblyStateRegisters {
    xenos::PrimitiveType primitive_type;
    uint32_t pa_su_sc_mode_cntl;
    uint32_t multi_prim_ib_reset_index;

    UpdateInputAssemblyStateRegisters() { Reset(); }
    void Reset() { std::memset(this, 0, sizeof(*this)); }
  } update_input_assembly_state_regs_;
  VkPipelineInputAssemblyStateCreateInfo update_input_assembly_state_info_;

  struct UpdateViewportStateRegisters {
    // uint32_t pa_cl_clip_cntl;
    uint32_t rb_surface_info;
    uint32_t pa_cl_vte_cntl;
    uint32_t pa_su_sc_mode_cntl;
    uint32_t pa_sc_window_offset;
    uint32_t pa_sc_window_scissor_tl;
    uint32_t pa_sc_window_scissor_br;
    float pa_cl_vport_xoffset;
    float pa_cl_vport_yoffset;
    float pa_cl_vport_zoffset;
    float pa_cl_vport_xscale;
    float pa_cl_vport_yscale;
    float pa_cl_vport_zscale;

    UpdateViewportStateRegisters() { Reset(); }
    void Reset() { std::memset(this, 0, sizeof(*this)); }
  } update_viewport_state_regs_;
  VkPipelineViewportStateCreateInfo update_viewport_state_info_;

  struct UpdateRasterizationStateRegisters {
    xenos::PrimitiveType primitive_type;
    uint32_t pa_cl_clip_cntl;
    uint32_t pa_su_sc_mode_cntl;
    uint32_t pa_sc_screen_scissor_tl;
    uint32_t pa_sc_screen_scissor_br;
    uint32_t pa_sc_viz_query;
    uint32_t pa_su_poly_offset_enable;
    uint32_t multi_prim_ib_reset_index;

    UpdateRasterizationStateRegisters() { Reset(); }
    void Reset() { std::memset(this, 0, sizeof(*this)); }
  } update_rasterization_state_regs_;
  VkPipelineRasterizationStateCreateInfo update_rasterization_state_info_;

  struct UpdateMultisampleStateeRegisters {
    uint32_t pa_sc_aa_config;
    uint32_t pa_su_sc_mode_cntl;
    uint32_t rb_surface_info;

    UpdateMultisampleStateeRegisters() { Reset(); }
    void Reset() { std::memset(this, 0, sizeof(*this)); }
  } update_multisample_state_regs_;
  VkPipelineMultisampleStateCreateInfo update_multisample_state_info_;

  struct UpdateDepthStencilStateRegisters {
    uint32_t rb_depthcontrol;
    uint32_t rb_stencilrefmask;

    UpdateDepthStencilStateRegisters() { Reset(); }
    void Reset() { std::memset(this, 0, sizeof(*this)); }
  } update_depth_stencil_state_regs_;
  VkPipelineDepthStencilStateCreateInfo update_depth_stencil_state_info_;

  struct UpdateColorBlendStateRegisters {
    uint32_t rb_color_mask;
    uint32_t rb_blendcontrol[4];
    uint32_t rb_modecontrol;

    UpdateColorBlendStateRegisters() { Reset(); }
    void Reset() { std::memset(this, 0, sizeof(*this)); }
  } update_color_blend_state_regs_;
  VkPipelineColorBlendStateCreateInfo update_color_blend_state_info_;
  VkPipelineColorBlendAttachmentState update_color_blend_attachment_states_[4];

  struct SetDynamicStateRegisters {
    uint32_t pa_sc_window_offset;

    uint32_t pa_su_sc_mode_cntl;
    uint32_t pa_sc_window_scissor_tl;
    uint32_t pa_sc_window_scissor_br;

    uint32_t rb_surface_info;
    uint32_t pa_su_sc_vtx_cntl;
    // Bias is in Vulkan units because depth format may potentially effect it.
    float pa_su_poly_offset_scale;
    float pa_su_poly_offset_offset;
    uint32_t pa_cl_vte_cntl;
    float pa_cl_vport_xoffset;
    float pa_cl_vport_yoffset;
    float pa_cl_vport_zoffset;
    float pa_cl_vport_xscale;
    float pa_cl_vport_yscale;
    float pa_cl_vport_zscale;

    float rb_blend_rgba[4];
    uint32_t rb_stencilrefmask;

    reg::SQ_PROGRAM_CNTL sq_program_cntl;
    uint32_t sq_context_misc;
    uint32_t rb_colorcontrol;
    reg::RB_COLOR_INFO rb_color_info;
    reg::RB_COLOR_INFO rb_color1_info;
    reg::RB_COLOR_INFO rb_color2_info;
    reg::RB_COLOR_INFO rb_color3_info;
    float rb_alpha_ref;
    uint32_t pa_su_point_size;

    SetDynamicStateRegisters() { Reset(); }
    void Reset() { std::memset(this, 0, sizeof(*this)); }
  } set_dynamic_state_registers_;
};

}  // namespace vulkan
}  // namespace gpu
}  // namespace xe

#endif  // XENIA_GPU_VULKAN_PIPELINE_CACHE_H_


text:
package org.apache.tinkerpop.gremlin.process.traversal;

import org.apache.tinkerpop.gremlin.process.computer.Computer;
import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
import org.apache.tinkerpop.gremlin.structure.Column;
import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public class BytecodeTest {

    @Test
    public void shouldHaveProperHashAndEquality() {
        final GraphTraversalSource g = EmptyGraph.instance().traversal();
        final Traversal.Admin traversal1 = g.V().out().repeat(__.out().in()).times(2).groupCount().by(__.outE().count()).select(Column.keys).order().by(Order.decr).asAdmin();
        final Traversal.Admin traversal2 = g.V().out().repeat(__.out().in()).times(2).groupCount().by(__.outE().count()).select(Column.keys).order().by(Order.decr).asAdmin();
        final Traversal.Admin traversal3 = g.V().out().repeat(__.out().in()).times(2).groupCount().by(__.outE().count()).select(Column.values).order().by(Order.decr).asAdmin();

        assertEquals(traversal1, traversal2);
        assertNotEquals(traversal1, traversal3);
        assertNotEquals(traversal2, traversal3);
        //
        assertEquals(traversal1.hashCode(), traversal2.hashCode());
        assertNotEquals(traversal1.hashCode(), traversal3.hashCode());
        assertNotEquals(traversal2.hashCode(), traversal3.hashCode());
        //
        assertEquals(traversal1.getBytecode(), traversal2.getBytecode());
        assertNotEquals(traversal1.getBytecode(), traversal3.getBytecode());
        assertNotEquals(traversal2.getBytecode(), traversal3.getBytecode());
        //
        assertEquals(traversal1.getBytecode().hashCode(), traversal2.getBytecode().hashCode());
        assertNotEquals(traversal1.getBytecode().hashCode(), traversal3.getBytecode().hashCode());
        assertNotEquals(traversal2.getBytecode().hashCode(), traversal3.getBytecode().hashCode());

    }

    @Test
    public void shouldCloneCorrectly() {
        final GraphTraversalSource g = EmptyGraph.instance().traversal();
        final Bytecode bytecode = g.V().out().asAdmin().getBytecode();
        final Bytecode bytecodeClone = bytecode.clone();
        assertEquals(bytecode, bytecodeClone);
        assertEquals(bytecode.hashCode(), bytecodeClone.hashCode());
        bytecodeClone.addStep("in", "created"); // mutate the clone and the original should stay the same
        assertNotEquals(bytecode, bytecodeClone);
        assertNotEquals(bytecode.hashCode(), bytecodeClone.hashCode());
        assertEquals(2, IteratorUtils.count(bytecode.getInstructions()));
        assertEquals(3, IteratorUtils.count(bytecodeClone.getInstructions()));
    }

    @Test
    public void shouldIncludeBindingsInEquality() {
        final Bindings b = new Bindings();
        final GraphTraversalSource g = EmptyGraph.instance().traversal().withBindings(b);

        final Bytecode bytecode1 = g.V().out(b.of("a", "created")).asAdmin().getBytecode();
        final Bytecode bytecode2 = g.V().out(b.of("a", "knows")).asAdmin().getBytecode();
        final Bytecode bytecode3 = g.V().out(b.of("b", "knows")).asAdmin().getBytecode();
        final Bytecode bytecode4 = g.V().out(b.of("b", "knows")).asAdmin().getBytecode();

        assertNotEquals(bytecode1, bytecode2);
        assertNotEquals(bytecode1, bytecode3);
        assertNotEquals(bytecode2, bytecode3);
        assertNotEquals(bytecode2, bytecode4);
        assertNotEquals(bytecode1, bytecode4);
        assertEquals(bytecode3, bytecode4);

        assertEquals(1, bytecode1.getBindings().size());
        assertEquals("created", bytecode1.getBindings().get("a"));
    }

    @Test
    public void shouldConvertStrategies() {
        final GraphTraversalSource g = EmptyGraph.instance().traversal();
        Bytecode bytecode = g.withStrategies(ReadOnlyStrategy.instance()).getBytecode();
        assertEquals(ReadOnlyStrategy.instance(), bytecode.getSourceInstructions().iterator().next().getArguments()[0]);
        bytecode = g.withStrategies(SubgraphStrategy.build().edges(__.hasLabel("knows")).create()).getBytecode();
        assertEquals(SubgraphStrategy.build().edges(__.hasLabel("knows")).create().getEdgeCriterion().asAdmin().getBytecode(),
                ((SubgraphStrategy) bytecode.getSourceInstructions().iterator().next().getArguments()[0]).getEdgeCriterion().asAdmin().getBytecode());
    }

    @Test
    public void shouldConvertComputer() {
        final GraphTraversalSource g = EmptyGraph.instance().traversal();
        Bytecode bytecode = g.withComputer(Computer.compute().workers(10)).getBytecode();
        assertEquals(VertexProgramStrategy.build().create(), bytecode.getSourceInstructions().iterator().next().getArguments()[0]);
        assertEquals(VertexProgramStrategy.build().workers(10).create().getConfiguration().getInt(VertexProgramStrategy.WORKERS),
                ((VertexProgramStrategy) bytecode.getSourceInstructions().iterator().next().getArguments()[0]).getConfiguration().getInt(VertexProgramStrategy.WORKERS));
    }
}


text:
package nl.nn.adapterframework.pipes;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import nl.nn.adapterframework.configuration.ApplicationWarnings;
import nl.nn.adapterframework.configuration.ConfigurationException;
import nl.nn.adapterframework.core.ConfiguredTestBase;
import nl.nn.adapterframework.core.PipeForward;

public class ForwardHandlingTest extends ConfiguredTestBase {

	@Override
	public void setUp() throws Exception {
		super.setUp();
		ApplicationWarnings.removeInstance();
	}

	@Test
	public void testFindForwardToPipeExplicit() throws ConfigurationException {
		XmlSwitch pipe1 = new XmlSwitch();
		pipe1.setName("pipe1");
		pipe1.registerForward(new PipeForward("fakeForward", "pipe3"));
		pipeline.addPipe(pipe1);

		EchoPipe pipe2 = new EchoPipe();
		pipe2.setName("pipe2");
		pipeline.addPipe(pipe2);

		EchoPipe pipe3 = new EchoPipe();
		pipe3.setName("pipe3");
		pipeline.addPipe(pipe3);

		configureAdapter();

		PipeForward forward = pipe1.findForward("fakeForward");
		assertEquals("pipe3", forward.getPath());
		assertEquals(0, getConfigurationWarnings().size());
		assertEquals(0, ApplicationWarnings.getSize());
	}

	@Test
	public void testFindForwardToPipeImplicit() throws ConfigurationException {
		XmlSwitch pipe1 = new XmlSwitch();
		pipe1.setName("pipe1");
		pipeline.addPipe(pipe1);

		EchoPipe pipe2 = new EchoPipe();
		pipe2.setName("pipe2");
		pipeline.addPipe(pipe2);

		EchoPipe pipe3 = new EchoPipe();
		pipe3.setName("pipe3");
		pipeline.addPipe(pipe3);

		configureAdapter();

		PipeForward forward = pipe1.findForward("pipe2");
		assertEquals("pipe2", forward.getPath());
		assertEquals(0, getConfigurationWarnings().size());
		assertEquals(0, ApplicationWarnings.getSize());
	}

	@Test
	public void testFindForwardToNextPipeImplicit() throws ConfigurationException {
		XmlSwitch pipe1 = new XmlSwitch();
		pipe1.setName("pipe1");
		pipeline.addPipe(pipe1);

		EchoPipe pipe2 = new EchoPipe();
		pipe2.setName("pipe2");
		pipeline.addPipe(pipe2);

		EchoPipe pipe3 = new EchoPipe();
		pipe3.setName("pipe3");
		pipeline.addPipe(pipe3);

		configureAdapter();

		PipeForward forward = pipe2.findForward("success");
		assertEquals("pipe3", forward.getPath());
		assertEquals(0, getConfigurationWarnings().size());
		assertEquals(0, ApplicationWarnings.getSize());
	}

	@Test
	public void testFindForwardToExitExplicit() throws ConfigurationException {
		XmlSwitch pipe1 = new XmlSwitch();
		pipe1.setName("pipe1");
		pipe1.registerForward(new PipeForward("ready", "READY"));
		pipeline.addPipe(pipe1);

		EchoPipe pipe2 = new EchoPipe();
		pipe2.setName("pipe2");
		pipeline.addPipe(pipe2);

		configureAdapter();

		PipeForward forward = pipe1.findForward("ready");
		assertEquals("READY", forward.getPath());
		assertEquals(0, getConfigurationWarnings().size());
		assertEquals(0, ApplicationWarnings.getSize());
	}

	@Test
	public void testFindForwardToExitImplicit() throws ConfigurationException {
		XmlSwitch pipe1 = new XmlSwitch();
		pipe1.setName("pipe1");
		pipeline.addPipe(pipe1);

		EchoPipe pipe2 = new EchoPipe();
		pipe2.setName("pipe2");
		pipeline.addPipe(pipe2);

		configureAdapter();

		PipeForward forward = pipe2.findForward("success");
		assertEquals("READY", forward.getPath());
		assertEquals(0, getConfigurationWarnings().size());
		assertEquals(0, ApplicationWarnings.getSize());
	}

}


text:
.bolder {
	font-weight: bold;
}
.fill {
	float:left;
	border:0;
    background-size: cover !important;
	background-clip: border-box !important;
	min-width: 250px;
	min-height: 200px;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2021 The Chromium Authors. All rights reserved.
     Use of this source code is governed by a BSD-style license that can be
     found in the LICENSE file. -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    style="@style/AlertDialogContent">

    <TextView
        android:id="@+id/reactions_progress_percentage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:textAppearance="@style/TextAppearance.TextMedium.Primary.Baseline.Light" />

    <org.chromium.components.browser_ui.widget.MaterialProgressBar
        android:id="@+id/reactions_progress_bar"
        android:layout_marginTop="16dp"
        android:layout_gravity="center_horizontal"
        android:layout_width="112dp"
        android:layout_height="4dp" />

    <org.chromium.ui.widget.ButtonCompat
        android:id="@+id/reactions_progress_cancel"
        android:text="@string/cancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="16dp"
        android:textAppearance="@style/TextAppearance.Button.Text.Blue.Dark"
        style="@style/TextButton" />

</LinearLayout>


text:
package com.alltheducks.remotegenerator.closure;

import com.alltheducks.remotegenerator.exception.TranslationException;
import com.alltheducks.remotegenerator.exception.TypeDefinitionException;
import com.alltheducks.remotegenerator.model.ConvertedType;
import com.alltheducks.remotegenerator.model.builder.ConvertedTypeBuilder;
import com.alltheducks.remotegenerator.translator.TypeTranslator;
import com.google.common.reflect.TypeToken;

import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.*;

public class ClosureTypeTranslator extends TypeTranslator {

    public static final Map<TypeToken<?>,String> PRIMITIVE_TRANSLATIONS;
    public static final Map<TypeToken<?>,String> CLASS_TRANSLATIONS;
    static {
        PRIMITIVE_TRANSLATIONS = new HashMap<TypeToken<?>,String>();
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(List.class), "Array");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(String.class), "string");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(Character.class), "string");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(char.class), "string");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(Boolean.class), "boolean");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(boolean.class), "boolean");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(Number.class), "number");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(byte.class), "number");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(short.class), "number");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(int.class), "number");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(long.class), "number");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(float.class), "number");
        PRIMITIVE_TRANSLATIONS.put(TypeToken.of(double.class), "number");

        CLASS_TRANSLATIONS = new HashMap<TypeToken<?>,String>();
        CLASS_TRANSLATIONS.put(TypeToken.of(Date.class), "goog.date.DateTime");
        CLASS_TRANSLATIONS.put(TypeToken.of(Map.class), "goog.structs.Map");

    }

    @Override
    public ConvertedType translate(Field field) throws TranslationException {
        try {
            return this.buildType(TypeToken.of(field.getGenericType())).getConvertedType();
        } catch (Exception e) {
            throw new TranslationException("Failed to translate Field to type.", e);
        }
    }

    private ConvertedTypeBuilder buildType(TypeToken<?> typeToken) throws Exception {
        return buildType(typeToken, false);
    }

    private ConvertedTypeBuilder buildType(TypeToken<?> typeToken, boolean skipGenerics) throws TranslationException {

        try {

            if (typeToken.isArray()) {
                ConvertedTypeBuilder convertedTypeBuilder = this.buildType(typeToken.getComponentType(), skipGenerics);
                convertedTypeBuilder.prependName("Array.<").appendName(">");
                return convertedTypeBuilder;
            }

            if(!skipGenerics) {
                TypeVariable<? extends Class<?>>[] typeParameters = typeToken.getRawType().getTypeParameters();
                if (typeParameters.length > 0) {

                    ConvertedTypeBuilder convertedTypeBuilder = this.buildType(typeToken, true);
                    convertedTypeBuilder.appendName(".<");

                    convertedTypeBuilder.appendTypeBuilder(this.translateGenericType(typeParameters[0], typeToken, skipGenerics));
                    for(int i = 1; i < typeParameters.length; i++) {
                        convertedTypeBuilder.appendName(",");
                        convertedTypeBuilder.appendTypeBuilder(this.translateGenericType(typeParameters[i], typeToken, skipGenerics));
                    }

                    convertedTypeBuilder.appendName(">");

                    return convertedTypeBuilder;
                }
            }

            if(this.getPackageTypes() != null) {
                for(TypeToken<?> packageType : this.getPackageTypes()) {
                    if(packageType.isAssignableFrom(typeToken)) {
                        String typeName = this.getPackageTranslator().translate(packageType.getRawType().getName());
                        ConvertedTypeBuilder convertedTypeBuilder = new ConvertedTypeBuilder();
                        convertedTypeBuilder.appendName(typeName);
                        convertedTypeBuilder.addRequires(typeName);
                        return convertedTypeBuilder;
                    }
                }
            }

            for(TypeToken<?> primitiveClass : PRIMITIVE_TRANSLATIONS.keySet()) {
                if(primitiveClass.isAssignableFrom(typeToken)) {
                    ConvertedTypeBuilder convertedTypeBuilder = new ConvertedTypeBuilder();
                    convertedTypeBuilder.appendName(PRIMITIVE_TRANSLATIONS.get(primitiveClass));
                    return convertedTypeBuilder;
                }
            }

            for(TypeToken<?> clazz : CLASS_TRANSLATIONS.keySet()) {
                if(clazz.isAssignableFrom(typeToken)) {
                    String typeName = CLASS_TRANSLATIONS.get(clazz);
                    ConvertedTypeBuilder convertedTypeBuilder = new ConvertedTypeBuilder();
                    convertedTypeBuilder.appendName(typeName);
                    convertedTypeBuilder.addRequires(typeName);
                    return convertedTypeBuilder;
                }
            }

        } catch (Exception e) {
            throw new TranslationException("Failed to translate type: " + typeToken.toString(), e);
        }

        throw new TypeDefinitionException("No translation definition for type: " + typeToken.toString());

    }

    private ConvertedTypeBuilder translateGenericType(Type parameterType, TypeToken<?> typeToken, boolean skipGenerics) throws Exception {
        TypeToken<?> newTypeToken = typeToken.resolveType(parameterType);
        return this.buildType(newTypeToken, skipGenerics);
    }

}